Documnet type display fixed
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import VueDatePicker from '@vuepic/vue-datepicker';
|
||||
import { axiosInstance, type Contractor, type OrderProduct, type Route, type Order } from '@/main'
|
||||
import VueDatePicker from '@vuepic/vue-datepicker'
|
||||
import { axiosInstance, type Contractor, type Order, type OrderProduct, type Route } from '@/main'
|
||||
import { useCategoriesStore } from '@/stores/categories.store'
|
||||
import { useContractorsStore } from '@/stores/contractors.store'
|
||||
import { useOrdersStore } from '@/stores/orders.store'
|
||||
@@ -31,6 +31,7 @@ const filteredRoutes = ref<Array<Route>>();
|
||||
const showRoutesDropdown = ref<boolean>(false);
|
||||
const routeInput = ref(null);
|
||||
const invoices = ref();
|
||||
const documentType = ref<number>()
|
||||
|
||||
const showErrorNotification = ref<boolean>(false);
|
||||
const showSuccessNotification = ref<boolean>(false);
|
||||
@@ -69,6 +70,7 @@ function createJSON(event: Event) {
|
||||
if(typeof deliveryDate.value != typeof Date) {
|
||||
deliveryDate.value = new Date(deliveryDate.value as unknown as string);
|
||||
}
|
||||
|
||||
const json = {
|
||||
MZN_UUID: uuid.value,
|
||||
MZN_DataZam: new Date(Date.now()).toISOString(),
|
||||
@@ -76,7 +78,7 @@ function createJSON(event: Event) {
|
||||
MZN_PodID: contractor.value?.Knt_KntId,
|
||||
MZN_MZTID: route.value?.MZT_MZTID,
|
||||
MZN_Uwagi: additionalNotes.value,
|
||||
MZN_TypDokumentu: order.value.MZN_TypDokumentu === 306 ? 306 : 301,
|
||||
MZN_TypDokumentu: documentType.value,
|
||||
MZamElem: new Array<OrderProduct>,
|
||||
};
|
||||
|
||||
@@ -234,6 +236,11 @@ onMounted(function (){
|
||||
if(contractor.value != undefined) {
|
||||
fetchInvoices();
|
||||
}
|
||||
if(order.value != undefined) {
|
||||
documentType.value = order.value.MZN_TypDokumentu === 306 ? 306 : 301
|
||||
}else documentType.value = 301
|
||||
console.log(documentType.value)
|
||||
|
||||
});
|
||||
|
||||
onBeforeUnmount( function () {
|
||||
@@ -295,13 +302,14 @@ onBeforeUnmount( function () {
|
||||
<span v-else>Brak nierozliczonych faktur</span>
|
||||
</div>
|
||||
<div class="field mb-3">
|
||||
<div>
|
||||
<label class="label is-small">Dokument WZ</label>
|
||||
<input
|
||||
v-model="order.MZN_TypDokumentu"
|
||||
v-model="documentType"
|
||||
type="checkbox"
|
||||
:true-value="306"
|
||||
:false-value="301"
|
||||
>
|
||||
:false-value="301">
|
||||
</div>
|
||||
</div>
|
||||
<div class="field mb-3">
|
||||
<label class="label is-small">Data dostawy</label>
|
||||
|
||||
@@ -62,6 +62,10 @@ function viewOrder(order : Order, clone: boolean) {
|
||||
order.loading = true;
|
||||
siteControlStore.viewOrder(order.MZN_UUID, clone);
|
||||
}
|
||||
function documnetType(order : Order):string {
|
||||
if(order.MZN_TypDokumentu == 306) return "Dokument WZ"
|
||||
else return ""
|
||||
}
|
||||
|
||||
async function fetchOrders(event : Event | null) {
|
||||
event?.preventDefault();
|
||||
@@ -128,7 +132,7 @@ fetchOrders(null);
|
||||
:class="{'confirmed' : order.MZN_Bufor == 0 && order.MZN_Anulowane != 1,
|
||||
'cancelled' : order.MZN_Anulowane == 1,
|
||||
'is-skeleton' : areOrdersLoading}">
|
||||
<label class="label" :class="{'is-invisible': areOrdersLoading}">Zamówienie nr {{order.MZN_MZNID}}, Typ dokumentu {{order.MZN_TypDokumentu}} </label>
|
||||
<label class="label" :class="{'is-invisible': areOrdersLoading}">Zamówienie nr {{order.MZN_MZNID}}. {{documnetType(order)}} </label>
|
||||
<label class="label is-small" :class="{'is-invisible': areOrdersLoading}">Klient</label>
|
||||
<div class="field is-small mb-3" :class="{'is-invisible': areOrdersLoading}">
|
||||
<input class="input is-small is-static"
|
||||
|
||||
@@ -169,6 +169,18 @@ onBeforeUnmount(async function() {
|
||||
await siteControlStore.newOrder(false);
|
||||
})
|
||||
|
||||
function documnetType(order : Order):string {
|
||||
if(order.MZN_TypDokumentu == 306) return ", Dokument WZ"
|
||||
else return ""
|
||||
}
|
||||
function ifOneWZExists(orders: Array<UnwrapRefSimple<Order>> ):string {
|
||||
for (const order of orders) {
|
||||
console.log(order.MZN_TypDokumentu);
|
||||
if (order.MZN_TypDokumentu === 306) return ". Dokument WZ"; // ❗ PRZERYWA funkcję natychmiast
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
function hasNonEmptyUwagi(item: any): boolean {
|
||||
let found = false;
|
||||
item.orders.forEach(order => {
|
||||
@@ -254,7 +266,7 @@ function hasNonEmptyUwagi(item: any): boolean {
|
||||
class="pb-4" style="display: block; page-break-inside: avoid;">
|
||||
<p class="is-size-6 px-2">NIP {{order.MZN_PodNipE}}</p>
|
||||
<p class="is-size-6 px-2">{{order.MZN_PodNazwa1 + order.MZN_PodNazwa2 + order.MZN_PodNazwa3}}</p>
|
||||
<p class="is-size-5 px-2">ZAMÓWIENIE NR {{order.MZN_MZNID}}, Typ dokumentu {{order.MZN_TypDokumentu}}</p>
|
||||
<p class="is-size-5 px-2">ZAMÓWIENIE NR {{order.MZN_MZNID}} {{documnetType(order)}}</p>
|
||||
<DataTable :value="order.products" class="mb-3" style="padding:0" scrollable>
|
||||
<Column field="kod" header="Indeks" frozen></Column>
|
||||
<Column field="nazwa" header="Nazwa"/>
|
||||
@@ -282,10 +294,11 @@ function hasNonEmptyUwagi(item: any): boolean {
|
||||
ZAMÓWIENIA NR
|
||||
<span
|
||||
v-for="(orderByNip, index) in orderByRouteAndNipRef.get(route.MZT_Nazwa1).get(nip).orders">{{ orderByNip.MZN_MZNID
|
||||
}} TYP ZAMÓWIENIA {{orderByNip.MZN_TypDokumentu}}
|
||||
}}
|
||||
<span
|
||||
v-if="index !== orderByRouteAndNipRef.get(route.MZT_Nazwa1).get(nip).orders.length - 1">, </span>
|
||||
</span>
|
||||
<span>{{ifOneWZExists(orderByRouteAndNipRef.get(route.MZT_Nazwa1).get(nip).orders)}}</span>
|
||||
</p>
|
||||
<p class="is-size-5 px-2"
|
||||
v-else>
|
||||
|
||||
Reference in New Issue
Block a user