feat: WarehouseArticle now supports showId get parameter for filtering
feat: tt-position-manager now emits displayValue if emitDisplayValue is true feat: tt-position-manager now has slot form-actions-append feat: WarehouseOrderController now support text-articles feat: WarehouseOrder now showing "Zum Artikel" button if article is selected
This commit is contained in:
@@ -278,8 +278,19 @@ Vue.component('warehouse-order-modal', {
|
||||
v-model="order.positions"
|
||||
:config="positionsConfig"
|
||||
@updateField-article="fetchDistributors"
|
||||
@updateField-article_text="fetchDistributors"
|
||||
@updateField-distributorId="fetchDistributorData"
|
||||
/>
|
||||
>
|
||||
<template #form-actions-append>
|
||||
<!-- v-if $refs.positionsManager.formData.article parse is int and not NaN we show a <tt-button> with a @click to BASE_PATH /WarehouseArticle?showId-->
|
||||
<tt-button
|
||||
v-if="!isNaN(parseInt($refs.positionsManager.formData.article))"
|
||||
text="Zum Artikel"
|
||||
sm
|
||||
additional-class="btn-outline-primary"
|
||||
@click="window.open(window.TT_CONFIG['BASE_PATH'] + '/WarehouseArticle?showId=' + $refs.positionsManager.formData.article)"/>
|
||||
</template>
|
||||
</tt-positions-manager>
|
||||
|
||||
<hr>
|
||||
<h4 class="text-center">Lieferadresse</h4>
|
||||
@@ -319,6 +330,7 @@ Vue.component('warehouse-order-modal', {
|
||||
return {
|
||||
window: window,
|
||||
showSendShippingNote: null,
|
||||
lastDistributorFetch: null,
|
||||
positionsConfig: {
|
||||
customOrdering: 'distributorId',
|
||||
fields: {
|
||||
@@ -327,6 +339,7 @@ Vue.component('warehouse-order-modal', {
|
||||
label: 'Artikel',
|
||||
apiUrl: '/WarehouseArticle/autoComplete',
|
||||
customFieldReference: 'WarehouseArticle',
|
||||
emitDisplayValue: true,
|
||||
},
|
||||
distributorId: {type: 'select', label: 'Lieferant', options: [], customFieldReference: 'WarehouseDistributor'},
|
||||
distributorArticleNumber: {type: 'input', label: 'Lieferant Art-Nr.'},
|
||||
@@ -334,23 +347,12 @@ Vue.component('warehouse-order-modal', {
|
||||
buyPrice: {type: 'input', label: 'Einkaufspreis', inputType: 'number'},
|
||||
verwendung: {type: 'input', label: 'Verwendung'},
|
||||
},
|
||||
validateForm: (formData) => {
|
||||
const fields = [
|
||||
{key: 'amount', message: 'Bitte füllen Sie die Menge aus'},
|
||||
{key: 'distributorId', message: 'Bitte füllen Sie den Lieferanten aus'},
|
||||
{key: 'article', message: 'Bitte füllen Sie den Artikel aus'},
|
||||
{key: 'buyPrice', message: 'Bitte füllen Sie den Einkaufspreis aus'}
|
||||
];
|
||||
|
||||
for (const field of fields) {
|
||||
if (!formData[field.key]) {
|
||||
window.notify('error', field.message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
validateFormOptions: [
|
||||
{key: 'amount', message: 'Bitte füllen Sie die Menge aus'},
|
||||
{key: 'distributorId', message: 'Bitte füllen Sie den Lieferanten aus'},
|
||||
{key: 'article', message: 'Bitte füllen Sie den Artikel aus'},
|
||||
{key: 'buyPrice', message: 'Bitte füllen Sie den Einkaufspreis aus'}
|
||||
],
|
||||
},
|
||||
order: {
|
||||
extReference: '',
|
||||
@@ -436,7 +438,9 @@ Vue.component('warehouse-order-modal', {
|
||||
async fetchDistributors(article) {
|
||||
const url = `${window.TT_CONFIG["BASE_PATH"]}/WarehouseOrder/getArticleDistributorData`;
|
||||
const params = typeof article === 'string' ? {allDistributor: true} : {articleId: article};
|
||||
if (JSON.stringify(params) === JSON.stringify(this.lastDistributorFetch)) return;
|
||||
|
||||
this.lastDistributorFetch = params;
|
||||
const response = await axios.get(url, {params});
|
||||
this.positionsConfig.fields.distributorId.options = response.data.map(distributor => ({
|
||||
value: distributor.id,
|
||||
@@ -573,10 +577,8 @@ Vue.component('warehouse-order', {
|
||||
},
|
||||
methods: {
|
||||
async closeModal() {
|
||||
console.log("hi");
|
||||
this.orderModalId = null;
|
||||
this.changeStatusModalId = null;
|
||||
console.log("hi");
|
||||
await new Promise(resolve => setTimeout(resolve, 250));
|
||||
this.$refs.table.$refs.table.refreshTable();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user