Refactor code structure for improved readability and maintainability
Playwright Tests / test (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
This commit is contained in:
@@ -1509,7 +1509,6 @@ $inv.sprev = (change) => {
|
||||
}
|
||||
$ocms.postXT({
|
||||
url: $ocms.url('req/' + (change === true ?'sedit':'sprep')), data: { invc: JSON.stringify($inv.invcPayload(d)), id: d.invid ||'' }, success: (response) => {
|
||||
l.rC('freeze');
|
||||
let c = $$.dc('imagecollection pdfpreview'), vhr = Math.round(vh() * 0.88), invid = response.id, invtp = response.total;
|
||||
if (invtp > 10) {
|
||||
$$.dc('note warn', c).text($ict.tpe);
|
||||
@@ -1523,15 +1522,20 @@ $inv.sprev = (change) => {
|
||||
$ocms.dlg(c, {
|
||||
size: [vhr, Math.round(vw() * 0.88)], zindex: 50, form: false, button: $rct.crI, confirm: function (e) {
|
||||
let ct = $(this);
|
||||
l.aC('freeze'); /* spinner while the invoice is finalized/emailed on the backend */
|
||||
$ocms.postXT({
|
||||
url: $ocms.url('req/sconf'), data: { id: invid }, success: () => {
|
||||
url: $ocms.url('req/sconf'), data: { id: invid }, success: (cresp) => {
|
||||
ct.trigger('modal_close');
|
||||
window.open($ocms.url('req/idoc') + '?id=' + invid, '_blank'); /* open pdf in new tab */
|
||||
if (cresp.hasFile === true) {
|
||||
window.open($ocms.url('req/idoc') + '?id=' + invid, '_blank'); /* open pdf in new tab, only if a file was actually created */
|
||||
}
|
||||
$ocms.init('req'); /* go back to request list */
|
||||
$inv.rReload();
|
||||
}, error: () => {
|
||||
alert($t.f1);
|
||||
ct.trigger('modal_close');
|
||||
}, complete: () => {
|
||||
l.rC('freeze');
|
||||
}
|
||||
});
|
||||
}, cancel: function (e) {
|
||||
@@ -1546,6 +1550,10 @@ $inv.sprev = (change) => {
|
||||
$inv.rReload();
|
||||
}
|
||||
});
|
||||
}, error: () => {
|
||||
alert($ict.eis);
|
||||
}, complete: () => {
|
||||
l.rC('freeze');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user