improved multiple warehouse stuff
This commit is contained in:
@@ -19,7 +19,7 @@ class WarehouseOrderRequestController extends TTCrud {
|
||||
'fields' => [
|
||||
'articleId' => [
|
||||
'apiUrl' => '/WarehouseArticle/autoComplete',
|
||||
'type' => 'autocomplete',
|
||||
'type' => 'input-article',
|
||||
'emitDisplayValue' => true,
|
||||
'customFieldReference' => 'WarehouseArticle',
|
||||
'label' => 'Artikel',
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
async function handleApiResponse(responsePromise) {
|
||||
const res = await responsePromise;
|
||||
if (res.data.success === false) return window.notify('error', `Fehler: ${res.data.errors.join(', ')}`);
|
||||
if (!res.data.success) {
|
||||
const errors = res.data.errors;
|
||||
const errorMessage = Array.isArray(errors) ? errors.join(', ') : Object.values(errors).join(', ');
|
||||
return window.notify('error', `Fehler: ${errorMessage}`);
|
||||
}
|
||||
window.notify('success', res.data.message || 'Erfolgreich');
|
||||
|
||||
window.dispatchEvent(new Event('refreshTable'));
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ Vue.component('change-status-modal', {
|
||||
return [
|
||||
{value: 'noChanges', text: 'Keine Änderungen'},
|
||||
{value: 'accepted', text: 'Akzeptiert'},
|
||||
{value: 'ordered', text: 'Bestellt'},
|
||||
{value: 'cancelled', text: 'Storniert'},
|
||||
];
|
||||
case 'accepted':
|
||||
@@ -174,7 +175,7 @@ Vue.component('change-status-modal', {
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<tt-modal :show="true" @submit="submit" @update:show="$emit('close')" title="Status ändern" :save-loading="submitLoading">
|
||||
<tt-modal :show="true" :delete="false" @submit="submit" @update:show="$emit('close')" title="Status ändern" :save-loading="submitLoading">
|
||||
<tt-loader :absolute="false" v-if="!order"/>
|
||||
<template v-else>
|
||||
<tt-select label="Neuer Status" v-model="newStatus" :options="availableStatuses" sm row/>
|
||||
@@ -381,6 +382,8 @@ Vue.component('warehouse-order-modal', {
|
||||
return;
|
||||
}
|
||||
|
||||
this.order.editor = parseInt(window.TT_CONFIG['USER_ID']);
|
||||
|
||||
const orderRequests = JSON.parse(localStorage.getItem('WarehouseOrder_create'));
|
||||
if (!orderRequests) return;
|
||||
|
||||
@@ -388,7 +391,10 @@ Vue.component('warehouse-order-modal', {
|
||||
const positions = JSON.parse(orderRequest.positions);
|
||||
const parsedPositions = await Promise.all(positions.map(async p => {
|
||||
const distributor = (await axios.get(`${window.TT_CONFIG.BASE_PATH}/WarehouseOrder/getArticleDistributorData`,
|
||||
{params: {articleId: p.articleId}})).data[0];
|
||||
{params: {articleId: p.articleId}}))
|
||||
.data
|
||||
.filter(d => !isNaN(d.purchasePrice))
|
||||
.sort((a, b) => a.purchasePrice - b.purchasePrice)[0];
|
||||
return {
|
||||
article: p.articleId,
|
||||
amount: p.amount,
|
||||
|
||||
Reference in New Issue
Block a user