upgraded cancelation process
This commit is contained in:
@@ -14,13 +14,17 @@ const categoriesStore = useCategoriesStore();
|
||||
|
||||
const { uuid } = storeToRefs(ordersStore);
|
||||
const { showCancellationModal, isLoading } = storeToRefs(siteControlStore);
|
||||
const cancellationReason = ref<string>();
|
||||
const cancellationReason = ref<string>("");
|
||||
|
||||
async function cancelOrder() {
|
||||
showCancellationModal.value = false;
|
||||
// console.log(cancellationReason.value);
|
||||
axiosInstance.delete('/zamowienie/' + uuid.value);
|
||||
siteControlStore.newOrder(true);
|
||||
axiosInstance.delete('/zamowienie/' + uuid.value, {
|
||||
data: {
|
||||
MZN_AnulowanePowod: cancellationReason.value
|
||||
}
|
||||
});
|
||||
siteControlStore.newOrder("/orders");
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -35,17 +39,15 @@ async function cancelOrder() {
|
||||
</header>
|
||||
<section class="modal-card-body">
|
||||
<div>Czy napewno chcesz anulować zamówienie? Czynności tej nie można odwrócić.</div>
|
||||
<!-- <div class="pb-2">Podaj powód anulowania zamówienia: </div>-->
|
||||
<!-- <textarea-->
|
||||
<!-- class="textarea"-->
|
||||
<!-- rows="3"-->
|
||||
<!-- v-model="cancellationReason"-->
|
||||
<!-- ></textarea>-->
|
||||
<p class="control is-expanded" style="margin-top: 20px">
|
||||
<input class="input is-small" type="text" v-model="cancellationReason" placeholder="Powód anulowania" >
|
||||
</p>
|
||||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
|
||||
<div class="buttons">
|
||||
<!-- <button class="button is-success" @click="cancelOrder" v-bind:disabled="cancellationReason == undefined || cancellationReason == ''">Tak</button>-->
|
||||
<button class="button is-success" @click="cancelOrder">Tak</button>
|
||||
<button class="button is-success" :disabled="cancellationReason.length<3" @click="cancelOrder">Tak</button>
|
||||
<button class="button" @click="$emit('close')">Nie</button>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -4,7 +4,6 @@ import { useOrdersStore } from '@/stores/orders.store'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useCategoriesStore } from '@/stores/categories.store'
|
||||
import { useContractorsStore } from '@/stores/contractors.store'
|
||||
import { axiosInstance } from '@/main'
|
||||
import { useRoutesStore } from '@/stores/routes.store'
|
||||
import { useSiteControlStore } from '@/stores/siteControl.store'
|
||||
|
||||
@@ -33,18 +32,18 @@ function cancelOrder(event: Event) {
|
||||
|
||||
<template>
|
||||
<form class="box is-shadowless">
|
||||
<div class="mb-3 ">
|
||||
<div class="box" :class="{'cancelled' : order.MZN_Anulowane == 1}">
|
||||
<div class="mb-3">
|
||||
<div class="box">
|
||||
<div class="mb-3">
|
||||
<h1 class="title is-5" v-if="order != undefined"><b>ZAMÓWIENIE NR {{order.MZN_MZNID}}</b></h1>
|
||||
<h1 class="title is-5" v-if="order != undefined"><b>ZAMÓWIENIE NR {{ order.MZN_MZNID }}</b><b
|
||||
v-if="order.MZN_Anulowane == 1">, ZAMÓWIENIE ANULOWANE</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">
|
||||
<input class="input is-small is-static"
|
||||
type="text"
|
||||
:value="contractor.Knt_Nazwa1 + contractor.Knt_Nazwa2 + contractor.Knt_Nazwa3"
|
||||
readonly/>
|
||||
<p class="mb-3 is-size-7">
|
||||
{{ contractor.Knt_Nazwa1 + contractor.Knt_Nazwa2 + contractor.Knt_Nazwa3 }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field mb-3" v-if="order != undefined">
|
||||
@@ -76,23 +75,22 @@ function cancelOrder(event: Event) {
|
||||
<div class="field mb-3" v-if="route != undefined">
|
||||
<label class="label is-small">Trasa</label>
|
||||
<div class="field is-small mb-3">
|
||||
<input class="input is-small is-static"
|
||||
type="text"
|
||||
:value="route.MZT_Nazwa1"
|
||||
readonly/>
|
||||
<p class="mb-3 is-size-7">
|
||||
{{route.MZT_Nazwa1}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field mb-3" v-if="order != undefined && order.MZN_Uwagi != undefined">
|
||||
<label class="label is-small">Uwagi do zamówienia</label>
|
||||
<p class="mb-3">
|
||||
<p class="mb-3 is-size-7">
|
||||
{{ order.MZN_Uwagi }}
|
||||
</p>
|
||||
</div>
|
||||
<button class="button is-danger" @click="cancelOrder">Anuluj zamówienie</button>
|
||||
<button v-if="order.MZN_Anulowane==0" class="button is-danger" @click="cancelOrder">Anuluj zamówienie</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-for="category in categories" :key="category.Kod">
|
||||
<div class="box mb-3" v-if="category.isVisible">
|
||||
<div class="box mb-3 " :class="{'cancelled' : order.MZN_Anulowane == 1}" v-if="category.isVisible">
|
||||
<h1 class="title mb-3 is-6"><b>{{ category.Kod }}</b></h1>
|
||||
<div class="field" v-for="(product) in category.Towary" :key="product.Twr_Nazwa">
|
||||
<div v-if="Number(product.Quantity) > 0" class="mb-3">
|
||||
@@ -100,53 +98,38 @@ function cancelOrder(event: Event) {
|
||||
<div class="columns is-mobile">
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<p class="control is-expanded">
|
||||
<input class="input is-small is-static" type="text" placeholder="Ilość" :value="product.Quantity + ' ' + product.ChosenOption" readonly>
|
||||
<p class="control is-expanded is-size-7">
|
||||
{{ product.Quantity + ' ' + product.ChosenOption }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column" v-if="product.ChosenOption == product.Twr_JM">
|
||||
<div class="field">
|
||||
<input
|
||||
class="input is-small is-static"
|
||||
type="text"
|
||||
placeholder="Kwota"
|
||||
:value="product.Twr_Cena + ' PLN'"
|
||||
readonly
|
||||
/>
|
||||
<p class="mb-3 is-size-7">
|
||||
{{ product.Twr_Cena }} PLN
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column" v-else-if="product.ChosenOption == product.Twr_JMZ">
|
||||
<div class="field">
|
||||
<input
|
||||
class="input is-small is-static"
|
||||
type="text"
|
||||
placeholder="Kwota"
|
||||
:value="product.Twr_CenaZ + ' PLN'"
|
||||
readonly
|
||||
/>
|
||||
<p class="mb-3 is-size-7">
|
||||
{{ product.Twr_CenaZ }} PLN
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column" v-if="product.ChosenOption == product.Twr_JM">
|
||||
<div class="field">
|
||||
<input
|
||||
class="input is-small is-static"
|
||||
type="text"
|
||||
placeholder="Kwota"
|
||||
:value="(Number(product.Twr_Cena) * Number(product.Quantity)).toFixed(2) + ' PLN'"
|
||||
readonly
|
||||
/>
|
||||
<p class="mb-3 is-size-7">
|
||||
{{ (Number(product.Twr_Cena) * Number(product.Quantity)).toFixed(2) }} PLN
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column" v-else-if="product.ChosenOption == product.Twr_JMZ">
|
||||
<div class="field">
|
||||
<input
|
||||
class="input is-small is-static"
|
||||
type="text"
|
||||
placeholder="Kwota"
|
||||
:value="(Number(product.Twr_CenaZ) * Number(product.Quantity)).toFixed(2) + ' PLN'"
|
||||
readonly
|
||||
/>
|
||||
<p class="mb-3 is-size-7">
|
||||
{{ (Number(product.Twr_CenaZ) * Number(product.Quantity)).toFixed(2) }} PLN
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -157,3 +140,8 @@ function cancelOrder(event: Event) {
|
||||
</div>
|
||||
</form>
|
||||
</template>
|
||||
<style>
|
||||
.cancelled {
|
||||
--bulma-box-background-color: var(--bulma-danger-soft)
|
||||
}
|
||||
</style>
|
||||
@@ -80,7 +80,7 @@ function routeLogin() {
|
||||
<div class="navbar-end">
|
||||
<div class="navbar-item">
|
||||
<div class="buttons">
|
||||
<button class="button is-info" @click="siteControlStore.newOrder">
|
||||
<button class="button is-info" @click="() => siteControlStore.newOrder('/')">
|
||||
Nowe Zamówienie
|
||||
</button>
|
||||
<button class="button is-info" @click="routeLogin" >
|
||||
|
||||
@@ -166,7 +166,7 @@ onMounted(async () => {
|
||||
|
||||
onBeforeUnmount(async function() {
|
||||
const siteControlStore = useSiteControlStore();
|
||||
await siteControlStore.newOrder(false);
|
||||
await siteControlStore.newOrder(null);
|
||||
})
|
||||
|
||||
function documnetType(order : Order):string {
|
||||
|
||||
@@ -49,7 +49,8 @@ export const useCategoriesStore = defineStore('categories', () => {
|
||||
mapProduct.SummedPrice += (Number(product.MZE_TwrCena) * Number(product.MZE_TwrIlosc));
|
||||
}
|
||||
else if (product.MZE_TwrJm == mapProduct?.Twr_JMZ) {
|
||||
mapProduct.SummedQuantity += (Number(product.MZE_TwrIlosc) * Number(mapProduct.Twr_JMPrzelicznikM))/Number(mapProduct.Twr_JMPrzelicznikL);
|
||||
mapProduct.SummedQuantity += (Number(product.MZE_TwrIlosc) * Number(mapProduct.Twr_JMPrzelicznikL)/Number(mapProduct.Twr_JMPrzelicznikM));
|
||||
|
||||
mapProduct.SummedPrice += (Number(product.MZE_TwrCena) * Number(product.MZE_TwrIlosc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ export const useSiteControlStore = defineStore('siteControl', () => {
|
||||
window.scrollTo(0,0);
|
||||
}
|
||||
|
||||
async function newOrder(redirect : boolean) {
|
||||
async function newOrder(redirect : string) {
|
||||
const { order, uuid, deliveryDate, orderDate, additionalNotes } = storeToRefs(orderStore);
|
||||
const { contractor } = storeToRefs(contractorsStore);
|
||||
const { route } = storeToRefs(routeStore);
|
||||
@@ -64,7 +64,7 @@ export const useSiteControlStore = defineStore('siteControl', () => {
|
||||
await categoriesStore.fetchCategories();
|
||||
if (redirect)
|
||||
{
|
||||
await router.push("/");
|
||||
await router.push(redirect);
|
||||
window.scrollTo(0,0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ async function onSubmit(values : any, { setErrors } : any) {
|
||||
const siteControlStore = useSiteControlStore();
|
||||
const { username } = storeToRefs(userStore);
|
||||
username.value = body.data.displayName;
|
||||
await siteControlStore.newOrder(true);
|
||||
await siteControlStore.newOrder("/");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user