Skip to content
Code-Schnipsel Gruppen Projekte
Commit 66901a11 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

Merge branch 'next-2.x' into 'main'

feat: change invoice status via the grid

See merge request !75
Übergeordnete 16079763 5e31acff
Branches next-3.x
No related tags found
2 Merge Requests!80Update 'next-3.x' with latest changes from 'main',!75feat: change invoice status via the grid
Pipeline #9657 mit Warnungen bestanden mit Phasen
in 1 Minute und 21 Sekunden
Dieser Diff ist reduziert.
/**
* @module package/quiqqer/invoice/bin/backend/controls/panels/status/StatusWindow
* @author www.pcsg.de (Henning Leutz)
*/
define('package/quiqqer/invoice/bin/backend/controls/panels/status/StatusWindow', [
'qui/QUI',
'qui/controls/windows/Confirm',
'package/quiqqer/invoice/bin/ProcessingStatus',
'package/quiqqer/erp/bin/backend/utils/ERPEntities',
'package/quiqqer/invoice/bin/Invoices',
'Locale',
'Ajax'
], function(QUI, QUIConfirm, ProcessingStatus, ERPEntities, Invoices, QUILocale, QUIAjax) {
'use strict';
const lg = 'quiqqer/invoice';
return new Class({
Extends: QUIConfirm,
Type: 'package/quiqqer/invoice/bin/backend/controls/panels/status/StatusWindow',
Binds: [
'$onOpen',
'$onSubmit'
],
options: {
hash: false,
maxWidth: 550,
maxHeight: 300,
autoclose: false
},
initialize: function(options) {
this.parent(options);
this.setAttributes({
icon: 'fa fa-check',
title: QUILocale.get(lg, 'window.status.title', {
invoiceId: this.getAttribute('hash')
})
});
this.addEvents({
onOpen: this.$onOpen,
onSubmit: this.$onSubmit
});
},
/**
* event: on import
*/
$onOpen: function() {
this.Loader.show();
this.getContent().set('html', '');
let Select, invoiceData;
return ERPEntities.getEntity(this.getAttribute('hash'), 'quiqqer/invoice').then((data) => {
invoiceData = data;
this.setAttributes({
icon: 'fa fa-check',
title: QUILocale.get(lg, 'window.status.title', {
invoiceId: data.prefixedNumber
})
});
this.refresh();
new Element('p', {
html: QUILocale.get(lg, 'window.status.text', {
invoiceId: data.prefixedNumber
})
}).inject(this.getContent());
Select = new Element('select', {
styles: {
display: 'block',
margin: '20px auto 0',
width: '80%'
}
}).inject(this.getContent());
}).then(() => {
return ProcessingStatus.getList();
}).then((statusList) => {
statusList = statusList.data;
new Element('option', {
html: '',
value: '',
'data-color': ''
}).inject(Select);
for (let i = 0, len = statusList.length; i < len; i++) {
new Element('option', {
html: statusList[i].title,
value: statusList[i].id,
'data-color': statusList[i].color
}).inject(Select);
}
Select.value = invoiceData.status;
this.Loader.hide();
});
},
/**
* event: on submit
*/
$onSubmit: function() {
this.Loader.show();
QUIAjax.post('package_quiqqer_invoice_ajax_invoices_setStatus', () => {
this.fireEvent('statusChanged', [this]);
this.close();
}, {
'package': 'quiqqer/invoice',
invoiceId: this.getAttribute('hash'),
status: this.getContent().getElement('select').value,
onError: () => {
this.Loader.hide();
}
});
}
});
});
\ No newline at end of file
......@@ -1684,6 +1684,27 @@
<de><![CDATA[Heutiges Datum verwenden]]></de>
<en><![CDATA[Use today's date]]></en>
</locale>
<locale name="journal.contextMenu.change.status">
<de><![CDATA[Rechnungsstatus ändern]]></de>
<en><![CDATA[Change Invoice status]]></en>
</locale>
<locale name="window.status.title">
<de><![CDATA[Status Änderung für Rechnung: [invoiceId]]]></de>
<en><![CDATA[Status change for invoice: [invoiceId]]]></en>
</locale>
<locale name="window.status.text" html="true">
<de><![CDATA[
Wechsel den Status der Rechnung <strong>[invoiceId]</strong>.
Beachte, Statusänderungen können verschiedene Aktionen auslösen.
]]></de>
<en><![CDATA[
Change the status of the invoice <strong>[invoiceId]</strong>.
Note, status changes can trigger different actions.
]]></en>
</locale>
</groups>
<groups name="quiqqer/invoice" datatype="php">
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren