- Uscita PRIMA VERSIONE PiuCheBuono.app
This commit is contained in:
@@ -32,18 +32,45 @@ function getRecordProductInfoEmpty(): IProductInfo {
|
||||
}
|
||||
}
|
||||
|
||||
function getRecordProductEmpty() {
|
||||
return {
|
||||
active: false,
|
||||
productInfo: {
|
||||
img: '', code: '', name: '',
|
||||
function getRecordProductEmpty(): IProduct {
|
||||
|
||||
},
|
||||
storehouses: [], scontisticas: [],
|
||||
price: 0, stockQty: 0, bookableQty: 0, gasordines: [],
|
||||
stockBloccatiQty: 0, bookableBloccatiQty: 0,
|
||||
idGasordines: [], minBuyQty: 1, maxBookableQty: 0,
|
||||
const tomorrow = tools.getDateNow()
|
||||
tomorrow.setDate(tomorrow.getDate() + 1)
|
||||
|
||||
return {
|
||||
productInfo: getRecordProductInfoEmpty(),
|
||||
// _id: tools.getDateNow().toISOString(), // Create NEW
|
||||
active: false,
|
||||
idProducer: '',
|
||||
idStorehouses: [],
|
||||
idGasordines: [],
|
||||
idScontisticas: [],
|
||||
scontisticas: [],
|
||||
gasordines: [],
|
||||
idProvider: '',
|
||||
producer: {},
|
||||
storehouses: [],
|
||||
provider: {},
|
||||
price: 0.0,
|
||||
quantityAvailable: 0,
|
||||
bookableAvailableQty: 0,
|
||||
minBuyQty: 1,
|
||||
minStepQty: 1,
|
||||
maxBookableSinglePersQty: 0,
|
||||
|
||||
stockQty: 0,
|
||||
stockBloccatiQty: 0,
|
||||
bookedQtyConfirmed: 0,
|
||||
|
||||
qtyToReachForGas: 0,
|
||||
maxbookableGASQty: 0,
|
||||
bookedGASQtyOrdered: 0,
|
||||
bookableGASBloccatiQty: 0,
|
||||
|
||||
canBeShipped: false,
|
||||
QuantitaOrdinateInAttesa: 0,
|
||||
QuantitaPrenotateInAttesa: 0,
|
||||
canBeBuyOnline: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,39 +310,7 @@ export const useProducts = defineStore('Products', {
|
||||
|
||||
|
||||
getRecordEmpty: (state: IProductsState) => (): IProduct => {
|
||||
|
||||
const tomorrow = tools.getDateNow()
|
||||
tomorrow.setDate(tomorrow.getDate() + 1)
|
||||
|
||||
return {
|
||||
productInfo: getRecordProductInfoEmpty(),
|
||||
// _id: tools.getDateNow().toISOString(), // Create NEW
|
||||
active: false,
|
||||
idProducer: '',
|
||||
idStorehouses: [],
|
||||
idGasordines: [],
|
||||
idScontisticas: [],
|
||||
scontisticas: [],
|
||||
gasordines: [],
|
||||
idProvider: '',
|
||||
producer: {},
|
||||
storehouses: [],
|
||||
provider: {},
|
||||
price: 0.0,
|
||||
quantityAvailable: 0,
|
||||
bookableAvailableQty: 0,
|
||||
stockQty: 0,
|
||||
stockBloccatiQty: 0,
|
||||
minBuyQty: 1,
|
||||
minStepQty: 1,
|
||||
maxBookableQty: 0,
|
||||
bookableQty: 0,
|
||||
bookableBloccatiQty: 0,
|
||||
canBeShipped: false,
|
||||
QuantitaOrdinateInAttesa: 0,
|
||||
QuantitaPrenotateInAttesa: 0,
|
||||
canBeBuyOnline: false,
|
||||
}
|
||||
return getRecordProductEmpty()
|
||||
},
|
||||
|
||||
},
|
||||
@@ -380,12 +375,15 @@ export const useProducts = defineStore('Products', {
|
||||
ris = await Api.SendReq('/products', 'POST', { userId: userStore.my._id })
|
||||
.then((res) => {
|
||||
if (res.data.products) {
|
||||
console.log('aggiorna prodotti')
|
||||
this.products = []
|
||||
this.products = res.data.products
|
||||
} else {
|
||||
this.products = []
|
||||
}
|
||||
|
||||
if (res.data.orders) {
|
||||
this.orders = []
|
||||
this.orders = res.data.orders
|
||||
} else {
|
||||
this.orders = []
|
||||
@@ -831,7 +829,7 @@ export const useProducts = defineStore('Products', {
|
||||
},
|
||||
|
||||
getQtyBloccataBookableAvailable(myproduct: IProduct): number {
|
||||
let qty = myproduct.bookableBloccatiQty
|
||||
let qty = myproduct.bookableGASBloccatiQty
|
||||
return qty
|
||||
},
|
||||
|
||||
@@ -844,17 +842,17 @@ export const useProducts = defineStore('Products', {
|
||||
const globalStore = useGlobalStore()
|
||||
if (globalStore.site.ecomm && globalStore.site.ecomm.enablePreOrders) {
|
||||
return (this.getQtyBookableAvailable(myproduct) > 0
|
||||
&& (myproduct.maxBookableQty === 0
|
||||
|| (myorder.quantitypreordered + 1 < myproduct.maxBookableQty))
|
||||
&& (myproduct.maxBookableSinglePersQty === 0
|
||||
|| (myorder.quantitypreordered + 1 < myproduct.maxBookableSinglePersQty))
|
||||
)
|
||||
|| (this.getQtyAvailable(myproduct) > 0)
|
||||
&& (myproduct.maxBookableQty === 0
|
||||
|| (myorder.quantity + 1 < myproduct.maxBookableQty))
|
||||
&& (myproduct.maxBookableSinglePersQty === 0
|
||||
|| (myorder.quantity + 1 < myproduct.maxBookableSinglePersQty))
|
||||
|
||||
} else {
|
||||
return (this.getQtyAvailable(myproduct) > 0)
|
||||
&& (myproduct.maxBookableQty === 0
|
||||
|| (myorder.quantity + 1 < myproduct.maxBookableQty))
|
||||
&& (myproduct.maxBookableSinglePersQty === 0
|
||||
|| (myorder.quantity + 1 < myproduct.maxBookableSinglePersQty))
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user