Simplify addcost management

This commit is contained in:
Ludovic Stephan 2017-03-26 18:10:26 -03:00
parent 5101400f64
commit 08c752f1b3

View file

@ -795,27 +795,26 @@ $(document).ready(function() {
}
}
var addcostDialog = new UserDialog({
'title': 'Majoration',
'content': '<input type="text" placeholder="Trigramme" autocomplete="off" name="trigramme" spellcheck="false" style="text-transform:uppercase" autofocus><input type="number" lang="en" step="0.01" min="0.01" placeholder="€" name="amount">',
'callback_as_dict': true,
});
function askAddcost(errors = '') {
addcostDialog.open(
function(data) {
api_with_auth({
url: Urls['kfet.kpsul.update_addcost'](),
data: data,
on_400: function(data) {
askAddcost(getErrorsHtml(data));
},
next_focus: kpsul.account_manager,
});
},
errors,
kpsul.account_manager
);
var addcostDialog = new UserDialog({
'title': 'Majoration',
'content': '<input type="text" placeholder="Trigramme" autocomplete="off" name="trigramme" spellcheck="false" style="text-transform:uppercase" autofocus><input type="number" lang="en" step="0.01" min="0.01" placeholder="€" name="amount">',
'callback_as_dict': true,
});
function callback(data) {
api_with_auth({
url: Urls['kfet.kpsul.update_addcost'](),
data: data,
on_400: function(data) {
askAddcost(getErrorsHtml(data));
},
next_focus: kpsul.account_manager,
});
}
addcostDialog.open(callback, errors, kpsul.account_manager);
}