@@ -111,8 +113,8 @@ Vue.component('workorder-admin', {
- Sollen {{ workordersToAssign.length }} Workorder(s) der Firma {{ massAssignModalData.companyName }} zugewiesen werden?
-
+ Sollen {{ workordersToAssign.length }} Workorder(s) der Firma {{ massAssignModalData.companyName }} zugewiesen werden?
+
@@ -125,7 +127,7 @@ Vue.component('workorder-admin', {
crudConfig: {
...window.TT_CONFIG.CRUD_CONFIG, selectable: false, expandable: true,
customRowClass: (row) => {
- if (['completed', 'new', 'cancelled'].includes(row.status)) return 'tt-rml-workorder-irrelevant';
+ if (['completed', 'new', 'cancelled', 'charged', 'archived'].includes(row.status)) return 'tt-rml-workorder-irrelevant';
if (['correction_requested', 'intervention_required'].includes(row.status)) return 'tt-rml-workorder-high';
const deadlineDate = moment.unix(row.deadlineDate);
if (!deadlineDate.isValid()) return 'tt-rml-workorder-irrelevant';
@@ -134,17 +136,42 @@ Vue.component('workorder-admin', {
if (daysLeft <= 21) return 'tt-rml-workorder-medium';
return 'tt-rml-workorder-ontrack';
},
- additionalActions: []
+ additionalActions: [
+ {
+ key: 'charge_workorder',
+ title: 'Verrechnen',
+ class: 'fas fa-euro-sign text-purple',
+ condition: (row) => row.status === 'completed'
+ }
+ ]
}
}
},
computed: {
companiesForMassAssign() {
if (this.workordersToAssign.length === 0) return [];
- return Object.values(this.companiesByTenant)[0] || [];
+ const rows = this.$refs.table?.$refs.table.rows;
+ if (!rows) return[];
+ const firstWorkorder = rows.find(r => r.id === this.workordersToAssign[0]);
+ if (!firstWorkorder) return [];
+ return this.companiesByTenant[firstWorkorder.tenantId] || [];
}
},
methods: {
+ async chargeWorkorder(row) {
+ if (!confirm(`Soll der Auftrag #${row.id} wirklich als "verrechnet" markiert werden?`)) return;
+ try {
+ const { data } = await axios.post(`${window.TT_CONFIG.BASE_PATH}/WorkorderAdmin/chargeWorkorder`, { workorderId: row.id });
+ if (data.success) {
+ window.notify('success', data.message);
+ this.$refs.table.$refs.table.refreshTable();
+ } else {
+ window.notify('error', data.message || 'Aktion fehlgeschlagen.');
+ }
+ } catch (e) {
+ window.notify('error', 'Ein Netzwerkfehler ist aufgetreten.');
+ }
+ },
async acceptDocumentation(workorderId) {
const {data} = await axios.post(`${window.TT_CONFIG.BASE_PATH}/WorkorderAdmin/acceptDocumentation`, { workorderId });
if (data.success) {
@@ -306,4 +333,4 @@ Vue.component('workorder-admin', {
deep: true
}
}
-});
+});
\ No newline at end of file
diff --git a/public/js/pages/WorkorderTenantConfig/WorkorderTenantConfig.js b/public/js/pages/WorkorderTenantConfig/WorkorderTenantConfig.js
index cf23f8eb6..2b3e29821 100644
--- a/public/js/pages/WorkorderTenantConfig/WorkorderTenantConfig.js
+++ b/public/js/pages/WorkorderTenantConfig/WorkorderTenantConfig.js
@@ -61,19 +61,27 @@ Vue.component('workorder-tenant-config', {