Preorder fix attribute statusflag

This commit is contained in:
Luca Haid
2025-01-21 13:18:50 +00:00
parent eaa885e97d
commit ee7c1469f5
3 changed files with 52 additions and 5 deletions
@@ -1,8 +1,24 @@
window.localStorage.setItem('tt-table-WarehouseOrderRequest', JSON.stringify({
filters: {
takeOverBy: null
}
}));
Vue.component('warehouse-order-request', {
//language=Vue
template: `
<tt-card>
<tt-table-crud @openHistory="historyModal = true; historyModalId = $event.id" 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"
:text="showHiddenRequests ? 'Erledigte Bestellungen ausblenden' : 'Erledigte Bestellungen anzeigen'"
:additional-class="showHiddenRequests ? 'btn-danger' : 'btn-primary'"/>
</div>
</template>
<template v-slot:create="{ row }">
{{ row.create ? window.moment(row.create * 1000).format('DD.MM.YYYY') : '' }}
</template>
@@ -12,7 +28,7 @@ Vue.component('warehouse-order-request', {
</template>
<template v-slot:takeover="{ row }">
{{ row.takeover ? window.moment(row.takeover * 1000).format('DD.MM.YYYY') : '' }}
{{ row.takeOver ? window.moment(row.takeOver * 1000).format('DD.MM.YYYY') : '' }}
</template>
<template v-slot:note="{ row }">
@@ -25,14 +41,14 @@ Vue.component('warehouse-order-request', {
</tt-card>
`, data() {
return {
window: window, historyModal: false, historyModalId: null,
window: window, historyModal: false, historyModalId: null, showHiddenRequests: false
}
},
async mounted() {
// set a watch to ref.crud crudModal and if crudModal and then log ref crudModalData
if (this.window.TT_CONFIG.WAREHOUSE_ADMIN !== '1') return
this.$refs.crud.$watch('crudModal', (value) => {
if (value) {
console.log(this.$refs.crud.crudModalData)
// 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
if (!this.$refs.crud.crudModalData.id) return
@@ -53,5 +69,11 @@ Vue.component('warehouse-order-request', {
}
})
},
watch: {
showHiddenRequests(value) {
// set filter data inside table takeOverBy to !NULL
this.$refs.crud.$refs.table.$set(this.$refs.crud.$refs.table.filters, 'takeOverBy', value ? '' : null)
}
}
})