- corretto cancellazione ordine

This commit is contained in:
Surya Paolo
2024-02-15 18:59:13 +01:00
parent c6e0caa3f4
commit a82e07b4ce
5 changed files with 58 additions and 8 deletions

View File

@@ -3,7 +3,6 @@
v-if="order && order.product && order.product.productInfo"
class="q-pa-xs q-gutter-xs"
>
order: {{order}}
<div v-if="order.product">
<q-item>
<q-item-section top thumbnail class="q-ml-none">
@@ -65,7 +64,16 @@
</div>
<div class="row q-mb-xs no-wrap items-center centeritems">
<q-btn
v-if="showall && !nomodif"
v-if="showall && !nomodif && products.CanDeleteIfSub(order)"
icon="fas fa-trash"
color="negative"
round
size="xs"
@click="removeFromCard"
>
</q-btn>
<q-btn
v-else-if="showall && !nomodif"
:disable="!products.enableSubQty(order)"
size="sm"
icon="fas fa-cart-arrow-down"
@@ -167,7 +175,8 @@
<span
v-if="
tools.isManager() &&
order.TotalPriceProduct.toFixed(2) !== order.TotalPriceProductCalc.toFixed(2)
order.TotalPriceProduct.toFixed(2) !==
order.TotalPriceProductCalc.toFixed(2)
"
:class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''"
>

View File

@@ -197,7 +197,7 @@ export const useProducts = defineStore('Products', {
getOrdersAllCart: (state: IProductsState) => (idGasordine: string): IOrderCart[] => {
return state.orders.filter((rec: IOrderCart) => {
if ((idGasordine && !rec.items?.some(item => item.order.idGasordine === idGasordine))) {
if ((idGasordine && !rec.items?.some(item => item.order && item.order.idGasordine === idGasordine))) {
return false; // Skip records not matching gasordine condition
}
return true
@@ -210,11 +210,11 @@ export const useProducts = defineStore('Products', {
getOrdersCart: (state: IProductsState) => (tipoord: number, hasGasordine: any, idGasordine: string): IOrderCart[] | undefined => {
return state.orders.filter((rec: IOrderCart) => {
if (idGasordine && !rec.items?.some(item => item.order.idGasordine === idGasordine)) {
if (idGasordine && !rec.items?.some(item => item.order && item.order.idGasordine === idGasordine)) {
return false; // Skip records not matching gasordine condition
}
if (hasGasordine && !rec.items?.some(item => item.order.idGasordine)) {
if (hasGasordine && !rec.items?.some(item => item.order && item.order.idGasordine)) {
return false; // Skip records not matching gasordine condition
}
@@ -1013,6 +1013,13 @@ export const useProducts = defineStore('Products', {
return qty ? qty > 0 : false
},
CanDeleteIfSub(myorder: IOrder): boolean {
let qty = myorder.quantity + myorder.quantitypreordered
qty = qty - this.qtaNextSub(myorder, myorder.product!)
return qty === 0
},
enableAddQty(myorder: IOrder, myproduct: IProduct): boolean {
const globalStore = useGlobalStore()
if (globalStore.site.ecomm && globalStore.site.ecomm.enablePreOrders) {

View File

@@ -650,6 +650,14 @@
></q-btn>
<br />
</div>
<div class="row">
<q-btn
label="Remove DeletedOrders InOrderscart"
color="primary"
@click="EseguiFunz('RemoveDeletedOrdersInOrderscart')"
></q-btn>
<br />
</div>
</template>
<script lang="ts" src="./dbop.ts">
</script>

View File

@@ -55,6 +55,14 @@ export default defineComponent({
const statusnow = ref(0)
const arrnumstatus = ref(<any[]>[])
const columns = ref(<any>[
{
name: 'ind',
required: true,
align: 'left',
label: 'Ind',
field: 'ind',
sortable: true
},
{
name: 'apri',
align: 'center',
@@ -104,6 +112,14 @@ export default defineComponent({
])
const columns_Admin = ref(<any>[
{
name: 'ind',
required: true,
align: 'left',
label: 'Ind',
field: 'ind',
sortable: true
},
{
name: 'apri',
align: 'center',
@@ -220,6 +236,11 @@ export default defineComponent({
rowsWithTotals.push(totals);
}
// Supponendo che rowsWithTotals sia il tuo array di record
rowsWithTotals.forEach((record: any, index: number) => {
record.ind = index;
});
return rowsWithTotals;
} else {
return []

View File

@@ -198,6 +198,11 @@
</template>
<template v-else v-slot:body="props">
<q-tr :props="props">
<q-td key="ind" :props="props">
<div class="q-pa-sm">
{{index}}
</div>
</q-td>
<q-td key="apri" :props="props">
<div class="q-pa-sm">
<q-btn