new update

This commit is contained in:
Luca Haid
2025-04-24 13:39:26 +02:00
parent adabe9a7a2
commit 4108eb99c9
22 changed files with 992 additions and 337 deletions
@@ -44,7 +44,7 @@ Vue.component('warehouse-offer-modal', {
</div>
<template v-slot:footer-prepend>
<template v-slot:footer-prepend v-if="window.TT_CONFIG['WAREHOUSE_ADMIN'] === '1'">
<tt-input placeholder="Vorlagenname" no-form-group v-model="templateName"/>
<tt-button text="Als Vorlage speichern" @click="saveTemplate" icon="fas fa-save" additional-class="btn-success"/>
</template>
@@ -217,12 +217,15 @@ Vue.component('warehouse-offer', {
<div style="display: flex; gap: 8px">
<button @click="offerModalId = 'create'" class="btn btn-primary">Angebot erstellen</button>
<div class="dropdown">
<button class="btn btn-outline-primary dropdown-toggle" @click="offerTemplatesDropdown = !offerTemplatesDropdown">
<button class="btn btn-outline-primary dropdown-toggle" @click.stop="offerTemplatesDropdown = !offerTemplatesDropdown" >
Angebot aus Vorlage erstellen <i class="fas fa-caret-down"></i>
</button>
<ul class="dropdown-menu" :class="{'show': offerTemplatesDropdown}">
<li v-for="template in offerTemplates" @click="createOfferFromTemplate(template)">
<ul class="dropdown-menu" :class="{'show': offerTemplatesDropdown}" >
<li v-for="template in offerTemplates" @click="createOfferFromTemplate(template)" style="display: flex; gap: 2px;cursor: pointer;margin-bottom: 4px;margin-right: 4px">
<a class="dropdown-item">{{ template.templateName }}</a>
<tt-button
v-if="window.TT_CONFIG['WAREHOUSE_ADMIN'] === '1'"
icon="fas fa-trash" sm additional-class="btn-danger" @click.stop="deleteTemplate(template.id)"/>
</li>
</ul>
</div>
@@ -259,6 +262,15 @@ Vue.component('warehouse-offer', {
this.$refs.modal.offer.notes = template.notes;
this.window.notify('success', 'Angebot aus Vorlage erstellt');
},
async deleteTemplate(id) {
const response = await axios.get(`${window.TT_CONFIG["BASE_PATH"]}/WarehouseOffer/deleteTemplate?id=${id}`);
if (response.data.success) {
this.offerTemplates = this.offerTemplates.filter(template => template.id !== id);
this.window.notify('success', 'Vorlage erfolgreich gelöscht');
} else {
this.window.notify('error', response.data.message || 'Ein Fehler ist aufgetreten');
}
}
}
});