added new tracking support

This commit is contained in:
2024-09-20 11:13:08 +02:00
parent aae4443f01
commit 3eeb0d3697
4 changed files with 233 additions and 27 deletions
@@ -3,8 +3,9 @@ Vue.component('warehouse-e-shop-order', {
//language=Vue
template: `
<tt-card>
<tt-table-crud @openHistory="historyModal = true; historyModalId = $event.id"
<tt-table-crud @openHistory="historyModal = true; historyModalId = $event.id"
@openSingleOrderEmail="openSingleOrderEmailModal = true; singleOrderEmailModalId = $event.id"
@showTrackingHistory="openTrackingHistoryModal = true; trackingHistoryModalId = $event.id"
ref="table">
<template v-slot:table-top-buttons>
@@ -19,48 +20,71 @@ Vue.component('warehouse-e-shop-order', {
</template>
<template v-slot:expandedRow="{ row }">
<div>
<ul class="list-group" v-if="articleItems && articleItems[row.id]">
<li class="list-group-item" v-for="item in articleItems[row.id]">
Menge: {{ item.quantity }} | {{ item.articlePacketTitle || item.articleTitle }}
</li>
</ul>
<div>
<ul class="list-group" v-if="articleItems && articleItems[row.id]">
<li class="list-group-item" v-for="item in articleItems[row.id]">
Menge: {{ item.quantity }} | {{ item.articlePacketTitle || item.articleTitle }}
</li>
</ul>
</div>
</template>
</tt-table-crud>
<warehouse-history-modal :show.sync="historyModal" :id="historyModalId"/>
<!-- add a tt-modal which just shows some text from the api to show a email for a single order-->
<tt-modal :show.sync="openSingleOrderEmailModal"
:title="'Email für Bestellung ' + singleOrderEmailModalId"
<!-- add a tt-modal which just shows some text from the api to show a email for a single order-->
<tt-modal :show.sync="openSingleOrderEmailModal"
:title="'Email für Bestellung ' + singleOrderEmailModalId"
@close="openSingleOrderEmailModal = false"
save-text="E-Mail senden"
@submit="sendSingleOrderEmail"
:delete="false"
>
<div v-if="singleOrderEmailModalId && singleOrderEmailModalText">
<p v-html="singleOrderEmailModalText.body.replaceAll('\\n', '<br>')"></p>
<p v-html="singleOrderEmailModalText.body.replaceAll('\\n', '<br>')"></p>
</div>
<!-- else show loader-->
<!-- else show loader-->
<div v-else>
<tt-loader/>
<tt-loader/>
</div>
</tt-modal>
<tt-modal :show.sync="openTrackingHistoryModal"
:title="'Tracking Historie für Bestellung ' + trackingHistoryModalId"
@close="openTrackingHistoryModal = false"
:delete="false"
:save="false"
>
<div v-if="trackingHistoryModalData">
<ul class="list-group">
<li class="list-group item" v-for="entry in trackingHistoryModalData.history">
<strong>{{ entry.date }} {{ entry.time }}</strong> - {{ entry.evtDscr }}
</li>
</ul>
</div>
</tt-modal>
</tt-card>
`, data() {
return {
window: window, historyModal: false, historyModalId: null, articleItems: null, openSingleOrderEmailModal: false, singleOrderEmailModalId: null, singleOrderEmailModalText: null
window: window,
historyModal: false,
historyModalId: null,
articleItems: null,
openSingleOrderEmailModal: false,
singleOrderEmailModalId: null,
singleOrderEmailModalText: null,
openTrackingHistoryModal: false,
trackingHistoryModalId: null,
trackingHistoryModalData: null,
}
},
async mounted() {
}, async mounted() {
const response = await axios.get(`${window['TT_CONFIG']['BASE_PATH']}/WarehouseEShopOrder/getAllItemsPerOrder`);
console.log(response.data);
this.articleItems = response.data;
},
methods: {
}, methods: {
async sendSingleOrderEmail() {
const response = await axios.get(`${window['TT_CONFIG']['BASE_PATH']}/WarehouseEShopOrder/singleOrderEmail?id=${this.singleOrderEmailModalId}`);
if (response.data.message) {
@@ -70,8 +94,7 @@ Vue.component('warehouse-e-shop-order', {
window.notify('error', 'Ein Fehler ist aufgetreten');
}
await this.$refs.table.$refs.table.fetchData();
},
async createCSVExportAndMarkAsAccepted() {
}, async createCSVExportAndMarkAsAccepted() {
const response = await axios.post(`${window['TT_CONFIG']['BASE_PATH']}/WarehouseEShopOrder/CSVExportNewOrdersMarkAccepted`);
if (response.data.message) {
@@ -108,8 +131,7 @@ Vue.component('warehouse-e-shop-order', {
await this.$refs.table.$refs.table.fetchData();
}
},
watch: {
}, watch: {
singleOrderEmailModalId() {
this.openSingleOrderEmailModal = !!this.singleOrderEmailModalId;
this.singleOrderEmailModalText = null;
@@ -118,6 +140,21 @@ Vue.component('warehouse-e-shop-order', {
.then(response => this.singleOrderEmailModalText = response.data)
.catch(error => window.notify('error', error.response?.data?.message || 'Ein Fehler ist aufgetreten'));
}
},
async trackingHistoryModalId() {
this.openTrackingHistoryModal = !!this.trackingHistoryModalId;
this.trackingHistoryModalData = null;
if (this.trackingHistoryModalId) {
const response = await axios.get(`${window['TT_CONFIG']['BASE_PATH']}/WarehouseEShopOrder/fetchGLSTracking?id=${this.trackingHistoryModalId}`);
const data = response.data;
// if data is a empty string, show error
if (!data) {
window.notify('error', data.message || 'Keine Daten gefunden');
return;
}
// if data is not empty, show data
this.$set(this, 'trackingHistoryModalData', data);
}
}
}
})