WarehouseOffer fixed bugs

This commit is contained in:
Luca Haid
2025-07-21 12:27:26 +02:00
parent 48f5d2fae4
commit a867bcc6b8
17 changed files with 526 additions and 303 deletions
@@ -45,7 +45,7 @@ Vue.component('warehouse-e-shop-order-modal-positions-mgmt', {
}
for (const response of articlePacketResponses) {
this.$set(this.articlePacketNames, response.data[0].value, response.data[0].text);
this.$set(this.articlePacketNames, response.data[0].value, response.data[0].data[0].text); // Adjusted for packet autocomplete response structure
}
},
@@ -109,47 +109,47 @@ Vue.component('warehouse-e-shop-order-modal-positions-mgmt', {
},
}, watch: {positions: {handler: 'fetchNames', immediate: true}}, //language=Vue
template: `
<div>
<div>
<div style="display: grid;grid-template-columns: 2fr 1fr 0.5fr 1fr;grid-gap: 10px;">
<tt-autocomplete v-model="articleId" :api-url="articleAPIUrl" label="Artikel" sm ref="article"/>
<tt-autocomplete v-model="articlePacketId" :api-url="articlePacketAPIUrl" label="Artikel Packet" sm/>
<tt-input v-model="amount" label="Menge" sm/>
<div style="display: flex;flex-direction: column;justify-content: center;padding-top: 13px;">
<button @click="addPosition" class="btn btn-primary">Hinzufügen</button>
</div>
</div>
<div style="display: grid;grid-template-columns: 2fr 1fr 0.5fr 1fr;grid-gap: 10px;">
<tt-autocomplete v-model="articleId" :api-url="articleAPIUrl" label="Artikel" sm ref="article"/>
<tt-autocomplete v-model="articlePacketId" :api-url="articlePacketAPIUrl" label="Artikel Packet" sm/>
<tt-input v-model="amount" label="Menge" sm/>
<div style="display: flex;flex-direction: column;justify-content: center;padding-top: 13px;">
<button @click="addPosition" class="btn btn-primary">Hinzufügen</button>
</div>
</div>
<div style="display: flex; align-items: center; justify-content: center;">
<table class="table table-striped table-sm" style="width: max-content">
<thead>
<tr>
<th>Artikel</th>
<th>Menge</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
<tr v-if="positions.length === 0">
<td colspan="4" class="text-center">Keine Einträge</td>
</tr>
<tr v-for="(position, index) in positions" :key="index">
<td>{{ position.articleId ? articleNames[position.articleId] : position.articlePacketId ? articlePacketNames[position.articlePacketId] :
'Loading...' }}
</td>
<td>{{ position.quantity }}</td>
<td>
<button class="btn btn-sm btn-danger" @click="deletePosition(position.id)">Löschen</button>
<button class="btn btn-sm btn-primary" @click="editPosition(position.id)">Bearbeiten</button>
</td>
</tr>
</tbody>
</table>
</div>
<div style="display: flex; align-items: center; justify-content: center;">
<table class="table table-striped table-sm" style="width: max-content">
<thead>
<tr>
<th>Artikel</th>
<th>Menge</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
<tr v-if="positions.length === 0">
<td colspan="4" class="text-center">Keine Einträge</td>
</tr>
<tr v-for="(position, index) in positions" :key="index">
<td>{{ position.articleId ? articleNames[position.articleId] : position.articlePacketId ? articlePacketNames[position.articlePacketId] :
'Loading...' }}
</td>
<td>{{ position.quantity }}</td>
<td>
<button class="btn btn-sm btn-danger" @click="deletePosition(position.id)">Löschen</button>
<button class="btn btn-sm btn-primary" @click="editPosition(position.id)">Bearbeiten</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
`,
</div>
`,
})
@@ -157,83 +157,89 @@ Vue.component('warehouse-e-shop-order-modal-positions-mgmt', {
Vue.component('warehouse-e-shop-order', {
//language=Vue
template: `
<tt-card>
<tt-table-crud @openHistory="historyModal = true; historyModalId = $event.id"
@openSingleOrderEmail="openSingleOrderEmailModal = true; singleOrderEmailModalId = $event.id"
@createShippingNote="createShippingNote($event.id)"
@showTrackingHistory="openTrackingHistoryModal = true; trackingHistoryModalId = $event.id"
ref="table">
<tt-card>
<tt-table-crud @openHistory="historyModal = true; historyModalId = $event.id"
@openSingleOrderEmail="openSingleOrderEmailModal = true; singleOrderEmailModalId = $event.id"
@createShippingNote="createShippingNote($event.id)"
@showTrackingHistory="openTrackingHistoryModal = true; trackingHistoryModalId = $event.id"
ref="table">
<template v-slot:table-top-buttons>
<button @click="createCSVExportAndMarkAsAccepted" type="button" class="btn btn-outline-success">
<i class="fas fa-file-excel"></i>
Excel Export für neue Bestellungen
</button>
</template>
<template v-slot:table-top-buttons>
<button @click="createCSVExportAndMarkAsAccepted" type="button" class="btn btn-outline-success">
<i class="fas fa-file-excel"></i>
Excel Export für neue Bestellungen
</button>
</template>
<template v-slot:deliveryaddressname="{ row }">
{{ row.deliveryAddressName }} {{ row.deliveryAddressAdditional ? '(' + row.deliveryAddressAdditional + ')' : '' }}
</template>
<template v-slot:deliveryaddressname="{ row }">
{{ row.deliveryAddressName }} {{ row.deliveryAddressAdditional ? '(' + row.deliveryAddressAdditional + ')' : '' }}
</template>
<template v-slot:create="{ row }">
{{ window.moment(row.create * 1000).format('DD.MM.YYYY HH:mm:ss') }}
</template>
<template v-slot:create="{ row }">
{{ window.moment(row.create * 1000).format('DD.MM.YYYY HH:mm:ss') }}
</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>
</template>
<template v-slot:addressid="{ row }">
<span v-if="row.addressId === 209">Energie Steiermark</span>
<span v-else-if="row.addressId === 9633">SBIDI</span>
<span v-else>Unbekannt</span>
</template>
<template v-slot:positions-modal="{ crudModalData }">
<div>
<warehouse-e-shop-order-modal-positions-mgmt :id="crudModalData.id"/>
</div>
</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>
</template>
</tt-table-crud>
<warehouse-history-modal :show.sync="historyModal" :id="historyModalId"/>
<template v-slot:positions-modal="{ crudModalData }">
<div>
<warehouse-e-shop-order-modal-positions-mgmt :id="crudModalData.id"/>
</div>
</template>
<!-- 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>
</div>
<!-- else show loader-->
<div v-else>
<tt-loader/>
</div>
</tt-modal>
</tt-table-crud>
<warehouse-history-modal :show.sync="historyModal" :id="historyModalId"/>
<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>
<!-- 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>
</div>
<!-- else show loader-->
<div v-else>
<tt-loader/>
</div>
</tt-modal>
</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() {
</tt-card>
`, data() {
return {
window: window,
historyModal: false,