Zmiany w nagłówkach zamówień
This commit is contained in:
2
components.d.ts
vendored
2
components.d.ts
vendored
@@ -9,6 +9,7 @@ declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
CancelationModal: typeof import('./src/components/CancelationModal.vue')['default']
|
||||
Column: typeof import('primevue/column')['default']
|
||||
ColumnGroup: typeof import('primevue/columngroup')['default']
|
||||
ConfirmationModal: typeof import('./src/components/ConfirmationModal.vue')['default']
|
||||
ConfirmedForm: typeof import('./src/components/ConfirmedForm.vue')['default']
|
||||
DataTable: typeof import('primevue/datatable')['default']
|
||||
@@ -24,6 +25,7 @@ declare module 'vue' {
|
||||
OrdersSelector: typeof import('./src/components/OrdersSelector.vue')['default']
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
Row: typeof import('primevue/row')['default']
|
||||
SummaryComponent: typeof import('./src/components/SummaryComponent.vue')['default']
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,9 @@ function cancelOrder(event: Event) {
|
||||
<form class="box is-shadowless">
|
||||
<div class="mb-3">
|
||||
<div class="box">
|
||||
<h1 class="title mb-3 is-6"><b>ZAMÓWIENIE</b></h1>
|
||||
<h1 class="subtitle is-6 mb-3" v-if="uuid != null" ><b>{{ uuid }}</b></h1>
|
||||
<div class="mb-3">
|
||||
<h1 class="title is-5" v-if="order != undefined"><b>ZAMÓWIENIE NR {{order.MZN_MZNID}}</b></h1>
|
||||
</div>
|
||||
<div class="field mb-3" v-if="contractor != undefined">
|
||||
<label class="label is-small">Klient</label>
|
||||
<div class="field is-small mb-3">
|
||||
@@ -76,6 +77,15 @@ function cancelOrder(event: Event) {
|
||||
readonly/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field mb-3" v-if="order != undefined">
|
||||
<label class="label is-small">Uwagi do zamówienia</label>
|
||||
<p v-if="order.MZN_Uwagi != undefined" class="mb-3">
|
||||
{{ order.MZN_Uwagi }}
|
||||
</p>
|
||||
<p v-else class="mb-3">
|
||||
Brak uwag.
|
||||
</p>
|
||||
</div>
|
||||
<button class="button is-danger" @click="cancelOrder">Anuluj zamówienie</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,8 +6,9 @@ import { useContractorsStore } from '@/stores/contractors.store'
|
||||
import { useOrdersStore } from '@/stores/orders.store'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useSiteControlStore } from '@/stores/siteControl.store'
|
||||
import { onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||
import { useRoutesStore } from '@/stores/routes.store'
|
||||
import { Order } from '@/main'
|
||||
|
||||
const categoriesStore = useCategoriesStore();
|
||||
const contractorsStore = useContractorsStore();
|
||||
@@ -16,7 +17,7 @@ const siteControlStore = useSiteControlStore();
|
||||
const routesStore = useRoutesStore();
|
||||
|
||||
const { contractor, contractors } = storeToRefs(contractorsStore);
|
||||
const { deliveryDate, uuid, additionalNotes } = storeToRefs(ordersStore);
|
||||
const { deliveryDate, uuid, order, additionalNotes } = storeToRefs(ordersStore);
|
||||
const { categories } = storeToRefs(categoriesStore);
|
||||
const { showConfirmationModal, showCancellationModal, isDarkTheme } = storeToRefs(siteControlStore);
|
||||
const { route, routes } = storeToRefs(routesStore);
|
||||
@@ -30,6 +31,7 @@ const routeSearch = ref<string>();
|
||||
const filteredRoutes = ref<Array<Route>>();
|
||||
const showRoutesDropdown = ref<boolean>(false);
|
||||
const routeInput = ref(null);
|
||||
const invoices = ref();
|
||||
|
||||
const showErrorNotification = ref<boolean>(false);
|
||||
const showSuccessNotification = ref<boolean>(false);
|
||||
@@ -52,6 +54,16 @@ watch(route, (route) => {
|
||||
}
|
||||
}, { immediate: true });
|
||||
|
||||
const totalAmountUnpaid = computed(() => {
|
||||
let total = 0;
|
||||
let totalPaid = 0;
|
||||
for(let invoice of invoices.value) {
|
||||
total += Number(invoice.BZd_KwotaSys);
|
||||
totalPaid += Number(invoice.BZd_KwotaRozSys);
|
||||
}
|
||||
return (total - totalPaid).toFixed(2);
|
||||
});
|
||||
|
||||
function createJSON(event: Event) {
|
||||
event.preventDefault();
|
||||
console.log(deliveryDate.value);
|
||||
@@ -64,6 +76,7 @@ function createJSON(event: Event) {
|
||||
MZN_DataDos: deliveryDate.value != undefined ? deliveryDate.value.toISOString().split('T')[0] : null,
|
||||
MZN_PodID: contractor.value?.Knt_KntId,
|
||||
MZN_MZTID: route.value?.MZT_MZTID,
|
||||
MZN_Uwagi: additionalNotes.value,
|
||||
MZamElem: new Array<OrderProduct>
|
||||
};
|
||||
|
||||
@@ -121,6 +134,9 @@ function createJSON(event: Event) {
|
||||
console.log(JSON.stringify(json));
|
||||
axiosInstance.post('/zamowienie', JSON.stringify(json)).then( response => {
|
||||
uuid.value = response.data.MZN_UUID;
|
||||
order.value = {} as Order;
|
||||
order.value.MZN_MZNID = response.data.MZN_MZNID;
|
||||
order.value.MZN_Bufor = 1;
|
||||
showSuccessNotification.value = true;
|
||||
successNotificationMessage.value = "Zamówienie zostało zapisane do bazy danych."
|
||||
});
|
||||
@@ -166,6 +182,7 @@ function selectContractorFromDropdown(selectedContractor : Contractor) {
|
||||
console.log(selectedContractor);
|
||||
contractor.value = selectedContractor;
|
||||
showContractorsDropdown.value = false;
|
||||
fetchInvoices();
|
||||
}
|
||||
|
||||
function filterRoutes() {
|
||||
@@ -205,8 +222,17 @@ function handleClickOutsideDropdown(event : Event) {
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchInvoices() {
|
||||
const response = await axiosInstance.get('/zaleglosci/' + contractor.value?.Knt_KntId);
|
||||
invoices.value = response.data;
|
||||
|
||||
}
|
||||
|
||||
onMounted(function (){
|
||||
document.addEventListener('click', handleClickOutsideDropdown);
|
||||
if(contractor.value != undefined) {
|
||||
fetchInvoices();
|
||||
}
|
||||
});
|
||||
|
||||
onBeforeUnmount( function () {
|
||||
@@ -219,8 +245,8 @@ onBeforeUnmount( function () {
|
||||
<div>
|
||||
<div class="box mb-5">
|
||||
<div class="mb-3">
|
||||
<h1 class="title is-5"><b>ZAMÓWIENIE</b></h1>
|
||||
<h1 class="subtitle is-5" v-if="uuid != undefined" ><b>{{ uuid }}</b></h1>
|
||||
<h1 class="title is-5" v-if="uuid == undefined"><b>NOWE ZAMÓWIENIE</b></h1>
|
||||
<h1 class="title is-5" v-else-if="order != undefined"><b>ZAMÓWIENIE NR {{order.MZN_MZNID}}</b></h1>
|
||||
</div>
|
||||
<div class="field mb-3">
|
||||
<label class="label is-small">Klient</label>
|
||||
@@ -249,6 +275,22 @@ onBeforeUnmount( function () {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field mb-3">
|
||||
<DataTable :value="invoices" scrollable v-if="invoices != undefined && invoices.length > 0">
|
||||
<Column field="BZd_NumerPelny" header="Numer faktury" frozen/>
|
||||
<Column field="BZd_DataDok" header="Data"/>
|
||||
<Column field="BZd_Termin" header="Termin zapłaty"/>
|
||||
<Column field="BZd_KwotaSys" header="Kwota faktury"/>
|
||||
<Column field="BZd_KwotaRozSys" header="Kwota rozliczona"/>
|
||||
<ColumnGroup type="footer">
|
||||
<Row>
|
||||
<Column footer="Kwota zadłużenia" :colspan="4" footerStyle="text-align:right" />
|
||||
<Column :footer="totalAmountUnpaid" />
|
||||
</Row>
|
||||
</ColumnGroup>
|
||||
</DataTable>
|
||||
<span v-else>Brak nierozliczonych faktur</span>
|
||||
</div>
|
||||
<div class="field mb-3">
|
||||
<label class="label is-small">Data dostawy</label>
|
||||
<div class="field is-small">
|
||||
|
||||
@@ -54,10 +54,10 @@ function routeLogin() {
|
||||
<template>
|
||||
<nav class="navbar has-shadow is-fixed-top" role="navigation" aria-label="main navigation">
|
||||
<div class="navbar-brand">
|
||||
<a class="navbar-item is-overflow-hidden" style="max-width: calc(100vw - 50px); white-space: nowrap; overflow: hidden">
|
||||
<div class="navbar-item is-overflow-hidden" style="max-width: calc(100vw - 50px); white-space: nowrap; overflow: hidden">
|
||||
<h3 class="title is-4">Mleczarnia</h3>
|
||||
<h4 v-if="username != undefined" class="subtitle is-4"> {{'- ' + username}}</h4>
|
||||
</a>
|
||||
</div>
|
||||
<button @click="makeBurger" class="button navbar-burger is-pulled-right" data-target="navMenu" v-bind:class="{ 'is-active': activator }">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
|
||||
@@ -16,8 +16,8 @@ const areOrdersLoading = ref<boolean>(false);
|
||||
const { isDarkTheme, isLoading } = storeToRefs(siteControlStore);
|
||||
|
||||
const date = new Date(Date.now());
|
||||
const startDate = new Date(date.getFullYear(), date.getMonth(), (date.getDate() - 2));
|
||||
const endDate = new Date(date.getFullYear()+1, date.getMonth(), date.getDay());
|
||||
const startDate = new Date(date.getFullYear(), date.getMonth(), (date.getDate()));
|
||||
const endDate = new Date(date.getFullYear(), date.getMonth()+1, date.getDate());
|
||||
searchOrderDate.value?.push(startDate, endDate);
|
||||
|
||||
watch(isInBufor, (val) => {
|
||||
@@ -75,6 +75,7 @@ async function fetchOrders(event : Event) {
|
||||
orders.value = await ordersStore.fetchOrdersByDateStartAndEnd(searchOrderDate.value[0], searchOrderDate.value[1], buffer.value);
|
||||
}
|
||||
areOrdersLoading.value = false;
|
||||
console.log(orders.value);
|
||||
}
|
||||
|
||||
fetchOrders(null);
|
||||
@@ -94,6 +95,7 @@ fetchOrders(null);
|
||||
:highlight="dates"
|
||||
input-class-name="input is-small calendar-background"
|
||||
menu-class-name="calendar-background"
|
||||
format="dd/MM/yyyy"
|
||||
range/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -125,13 +127,7 @@ fetchOrders(null);
|
||||
:class="{'confirmed' : order.MZN_Bufor == 0 && order.MZN_Anulowane != 1,
|
||||
'cancelled' : order.MZN_Anulowane == 1,
|
||||
'is-skeleton' : areOrdersLoading}">
|
||||
<label class="label is-small" :class="{'is-invisible': areOrdersLoading}">Numer zamówienia</label>
|
||||
<div class="field is-small mb-3" :class="{'is-invisible': areOrdersLoading}">
|
||||
<input class="input is-small is-static"
|
||||
type="text"
|
||||
:value="order.MZN_MZNID"
|
||||
readonly/>
|
||||
</div>
|
||||
<label class="label" :class="{'is-invisible': areOrdersLoading}">Zamówienie nr {{order.MZN_MZNID}}</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"
|
||||
@@ -165,7 +161,16 @@ fetchOrders(null);
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<label class="label is-small mb-5" :class="{'is-invisible': areOrdersLoading}">Produkty</label>
|
||||
<label class="label is-small" :class="{'is-invisible': areOrdersLoading}">Uwagi</label>
|
||||
<div class="field is-small mb-3" :class="{'is-invisible': areOrdersLoading}">
|
||||
<span v-if=" order.MZN_Uwagi != null && order.MZN_Uwagi != ''">
|
||||
{{ order.MZN_Uwagi }}
|
||||
</span>
|
||||
<span v-else>
|
||||
Brak
|
||||
</span>
|
||||
</div>
|
||||
<label class="label is-small mb-4" :class="{'is-invisible': areOrdersLoading}">Produkty</label>
|
||||
<div class="field columns is-multiline is-mobile">
|
||||
<template v-for="product in order.MZamElem" :key="product.MZE_TwrKod">
|
||||
<div class="column is-6 py-0">{{ product.MZE_TwrKod }}</div>
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
|
||||
async function fetchOrders() {
|
||||
isLoading.value=true;
|
||||
console.log((confirmedOrders.value) ? true : null);
|
||||
orders.value = await ordersStore.fetchOrdersByDateStartAndEnd(searchDate.value != undefined ? searchDate.value : new Date(Date.now()),
|
||||
searchDate.value != undefined ? searchDate.value : new Date(Date.now()),
|
||||
(confirmedOrders.value) ? true : null);
|
||||
(confirmedOrders.value) ? false : null);
|
||||
const productsMap = await categoriesStore.sumProductsFromOrders(orders.value);
|
||||
summedProducts.value = [];
|
||||
for(const product of productsMap.values()) {
|
||||
if(product.SummedQuantity > 0) {
|
||||
summedProducts.value.push(product);
|
||||
@@ -143,7 +143,7 @@
|
||||
</template>
|
||||
</Column>
|
||||
</DataTable>
|
||||
<div v-else class="is-flex is-justify-content-center is-flex-direction-row">
|
||||
<div v-else class="is-flex is-justify-content-center is-flex-direction-row" style="height: 100%">
|
||||
<p class="title is-1 has-text-centered" style="height: min-content; align-self: center;">Brak zamówień</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -152,7 +152,7 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
<style scoped>
|
||||
@media screen and (min-width: 500px) {
|
||||
.box {
|
||||
--bulma-box-padding: 1.5rem;
|
||||
|
||||
@@ -57,6 +57,7 @@ export const useSiteControlStore = defineStore('siteControl', () => {
|
||||
await orderStore.loadOrder(uuid, false, contractor, contractors, categories, route, routes);
|
||||
isLoading.value=false;
|
||||
await router.push("/");
|
||||
window.scrollTo(0,0);
|
||||
}
|
||||
|
||||
async function newOrder(redirect : boolean) {
|
||||
@@ -64,7 +65,7 @@ export const useSiteControlStore = defineStore('siteControl', () => {
|
||||
const contractorsStore = useContractorsStore();
|
||||
const categoriesStore = useCategoriesStore();
|
||||
const routeStore = useRoutesStore();
|
||||
const { order, uuid, deliveryDate, orderDate } = storeToRefs(ordersStore);
|
||||
const { order, uuid, deliveryDate, orderDate, additionalNotes } = storeToRefs(ordersStore);
|
||||
const { contractor } = storeToRefs(contractorsStore);
|
||||
const { route } = storeToRefs(routeStore);
|
||||
contractor.value = undefined;
|
||||
@@ -73,9 +74,11 @@ export const useSiteControlStore = defineStore('siteControl', () => {
|
||||
deliveryDate.value = undefined;
|
||||
orderDate.value = undefined;
|
||||
route.value = undefined;
|
||||
additionalNotes.value = undefined;
|
||||
await categoriesStore.fetchCategories();
|
||||
if (redirect) {
|
||||
await router.push("/");
|
||||
window.scrollTo(0,0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
v-if="order == undefined || order.MZN_Bufor==1"
|
||||
/>
|
||||
<ConfirmedForm v-else-if="order.MZN_Bufor==0"/>
|
||||
|
||||
</div>
|
||||
<ConfirmationModal v-show="showConfirmationModal" @close="showConfirmationModal = false"></ConfirmationModal>
|
||||
<CancelationModal v-show="showCancellationModal" @close="showCancellationModal = false"></CancelationModal>
|
||||
|
||||
Reference in New Issue
Block a user