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:
@@ -480,14 +480,22 @@ $inv.cSt = function (data) {
|
||||
});
|
||||
};
|
||||
$inv.eHtml = function (ev) {
|
||||
let t = $(this), frmct = ev.data instanceof jQuery ? ev.data : ev.data.t, flds = [
|
||||
{ name: 'txt', label: 'Text', type: 'html', value: frmct.html(), tinymce: true, attr: { style: 'height: 300px' } }
|
||||
];
|
||||
let t = $(this), frmct = ev.data instanceof jQuery ? ev.data : ev.data.t;
|
||||
/* invoiceemail must stay plain text — using the TinyMCE/html editor here used to wrap the
|
||||
address in <p> tags, which then got posted and persisted verbatim into SendToEmail. */
|
||||
let isPlainText = ev.data.nme === 'invoiceemail';
|
||||
let flds = isPlainText
|
||||
? [{ name: 'txt', label: 'Text', type: 'text', value: frmct.text() }]
|
||||
: [{ name: 'txt', label: 'Text', type: 'html', value: frmct.html(), tinymce: true, attr: { style: 'height: 300px' } }];
|
||||
let change = ev.data.change || null;
|
||||
let sets = {
|
||||
title: t.data('dialog') || '',
|
||||
success: function (response) {
|
||||
frmct.html(response.txt);
|
||||
if (isPlainText) {
|
||||
frmct.text(response.txt || '');
|
||||
} else {
|
||||
frmct.html(response.txt);
|
||||
}
|
||||
if (typeof change === 'function') {
|
||||
change(response.txt);
|
||||
}
|
||||
@@ -962,7 +970,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);
|
||||
@@ -976,15 +983,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) {
|
||||
@@ -999,6 +1011,10 @@ $inv.sprev = (change) => {
|
||||
$inv.rReload();
|
||||
}
|
||||
});
|
||||
}, error: () => {
|
||||
alert($ict.eis);
|
||||
}, complete: () => {
|
||||
l.rC('freeze');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
|
||||
@keyframes fis_spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.edit_frm {
|
||||
|
||||
@@ -376,6 +380,22 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.freeze::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 3rem;
|
||||
height: 3rem;
|
||||
margin: -1.5rem 0 0 -1.5rem;
|
||||
border: 0.4rem solid rgba(255, 255, 255, .35);
|
||||
border-top-color: #FFF;
|
||||
border-radius: 50%;
|
||||
z-index: 11;
|
||||
pointer-events: none;
|
||||
animation: fis_spin 0.8s linear infinite;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user