- corretto cancellazione ordine
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user