added new features for warehouse order request
This commit is contained in:
@@ -1,21 +1,46 @@
|
||||
window.localStorage.setItem('tt-table-WarehouseOrderRequest', JSON.stringify({
|
||||
filters: {
|
||||
takeOverBy: null
|
||||
takeOverBy: null,
|
||||
canceled: 0
|
||||
}
|
||||
}));
|
||||
|
||||
window.TT_CONFIG["CRUD_CONFIG"]["additionalActions"] = [
|
||||
...window.TT_CONFIG["CRUD_CONFIG"]["additionalActions"],
|
||||
{
|
||||
"key": "cancel",
|
||||
"title": "Bestellwunsch stornieren",
|
||||
"class": "fas fa-times text-danger",
|
||||
"condition": (row) => window.TT_CONFIG['WAREHOUSE_ADMIN'] === '1' && row.canceled === 0,
|
||||
},
|
||||
{
|
||||
"key": "uncancel",
|
||||
"title": "Bestellwunsch wiederherstellen",
|
||||
"class": "fas fa-check text-success",
|
||||
"condition": (row) => window.TT_CONFIG['WAREHOUSE_ADMIN'] === '1' && row.canceled === 1,
|
||||
},
|
||||
]
|
||||
|
||||
Vue.component('warehouse-order-request', {
|
||||
//language=Vue
|
||||
template: `
|
||||
<tt-card>
|
||||
<tt-table-crud @openHistory="historyModal = true; historyModalId = $event.id" ref="crud">
|
||||
<tt-table-crud @openHistory="historyModal = true; historyModalId = $event.id"
|
||||
@cancel="cancelOrderRequest($event, '1')"
|
||||
@uncancel="cancelOrderRequest($event, '0')"
|
||||
ref="crud">
|
||||
<!-- <slot name="table-top-buttons"></slot> add checkbox "Ausgeblendete Bestellungen anzeigen-->
|
||||
|
||||
<template v-slot:table-top-buttons>
|
||||
<div class="d-flex">
|
||||
<tt-button @click="showHiddenRequests = !showHiddenRequests"
|
||||
<tt-button
|
||||
class="mr-2"
|
||||
@click="showHiddenRequests = !showHiddenRequests"
|
||||
:text="showHiddenRequests ? 'Erledigte Bestellungen ausblenden' : 'Erledigte Bestellungen anzeigen'"
|
||||
:additional-class="showHiddenRequests ? 'btn-danger' : 'btn-primary'"/>
|
||||
<tt-button @click="showCanceledRequests = !showCanceledRequests"
|
||||
:text="showCanceledRequests ? 'Stornierte Bestellungen ausblenden' : 'Stornierte Bestellungen anzeigen'"
|
||||
:additional-class="showCanceledRequests ? 'btn-danger' : 'btn-primary'"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -41,13 +66,14 @@ Vue.component('warehouse-order-request', {
|
||||
</tt-card>
|
||||
`, data() {
|
||||
return {
|
||||
window: window, historyModal: false, historyModalId: null, showHiddenRequests: false
|
||||
window: window, historyModal: false, historyModalId: null, showHiddenRequests: false, showCanceledRequests: false
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
if (this.window.TT_CONFIG.WAREHOUSE_ADMIN !== '1') return
|
||||
|
||||
this.$refs.crud.$watch('crudModal', (value) => {
|
||||
return
|
||||
if (value) {
|
||||
// if id is not 'create' then check if order is set and if not set it to current date
|
||||
// if order is set then check if takeover is set and if not set it to current date
|
||||
@@ -70,10 +96,32 @@ Vue.component('warehouse-order-request', {
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// portected function cancelAction() {
|
||||
// $id = $this->request->id;
|
||||
// $cancel = $this->request->cancel;
|
||||
async cancelOrderRequest(row, cancel) {
|
||||
if (!window.confirm('Bestellwunsch wirklich stornieren?')) return
|
||||
|
||||
const response = await axios.get(window.TT_CONFIG["BASE_PATH"] + '/WarehouseOrderRequest/cancel?id=' + row.id + '&cancel=' + cancel);
|
||||
if (response.data.success) {
|
||||
this.window.notify('success', response.data.message || 'Erfolgreich aktualisiert')
|
||||
this.$refs.crud.$refs.table.refresh()
|
||||
return
|
||||
}
|
||||
this.window.notify('error', response.data.message || 'Fehler beim aktualisieren')
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
showHiddenRequests(value) {
|
||||
// set filter data inside table takeOverBy to !NULL
|
||||
async showHiddenRequests(value) {
|
||||
this.showCanceledRequests = false
|
||||
this.$refs.crud.$refs.table.$set(this.$refs.crud.$refs.table.filters, 'canceled', '')
|
||||
this.$refs.crud.$refs.table.$set(this.$refs.crud.$refs.table.filters, 'takeOverBy', value ? '' : null)
|
||||
},
|
||||
async showCanceledRequests(value) {
|
||||
this.showHiddenRequests = false
|
||||
this.$refs.crud.$refs.table.$set(this.$refs.crud.$refs.table.filters, 'canceled', value ? '1' : '')
|
||||
this.$refs.crud.$refs.table.$set(this.$refs.crud.$refs.table.filters, 'takeOverBy', '')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user