Simplify addcost management
This commit is contained in:
parent
5101400f64
commit
08c752f1b3
1 changed files with 18 additions and 19 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue