- preordinabili corretti + altro

This commit is contained in:
Surya Paolo
2023-12-29 21:17:25 +01:00
parent c0998753c2
commit 632d05bbfb
13 changed files with 192 additions and 67 deletions

View File

@@ -41,7 +41,9 @@ function getRecordProductEmpty() {
},
storehouses: [], scontisticas: [],
price: 0, stockQty: 0, bookableQty: 0, gasordines: [],
stockBloccatiQty: 0, bookableBloccatiQty: 0,
idGasordines: [], minBuyQty: 1, maxBookableQty: 0,
minStepQty: 1,
}
}
@@ -303,10 +305,12 @@ export const useProducts = defineStore('Products', {
quantityAvailable: 0,
bookableAvailableQty: 0,
stockQty: 0,
stockBloccatiQty: 0,
minBuyQty: 1,
minStepQty: 1,
maxBookableQty: 0,
bookableQty: 0,
bookableBloccatiQty: 0,
canBeShipped: false,
QuantitaOrdinateInAttesa: 0,
QuantitaPrenotateInAttesa: 0,
@@ -821,6 +825,16 @@ export const useProducts = defineStore('Products', {
return qty
},
getQtyBloccataAvailable(myproduct: IProduct): number {
let qty = myproduct.stockBloccatiQty
return qty
},
getQtyBloccataBookableAvailable(myproduct: IProduct): number {
let qty = myproduct.bookableBloccatiQty
return qty
},
enableSubQty(myorder: IOrder): boolean {
let qty = myorder.quantity + myorder.quantitypreordered
return qty ? qty > 0 : false
@@ -846,21 +860,21 @@ export const useProducts = defineStore('Products', {
},
qtaNextAdd(myorder: IOrder, myproduct: IProduct): number {
let step = 1
let step = myproduct.minStepQty
if (this.getQtyAvailable(myproduct) > 0) {
if (myorder.quantity === 0)
step = myproduct.minBuyQty | 1
step = myproduct.minBuyQty
} else {
if (myorder.quantitypreordered === 0)
step = myproduct.minBuyQty | 1
step = myproduct.minBuyQty
}
return step
},
qtaNextSub(myorder: IOrder, myproduct: IProduct) {
let step = 1
let minqta = myproduct.minBuyQty | 1
let step = myproduct.minStepQty
let minqta = myproduct.minBuyQty
if (this.getQtyAvailable(myproduct) > 0) {
if (myorder.quantity === minqta)
step = minqta