aggiornamento...

This commit is contained in:
Surya Paolo
2023-12-17 19:19:10 +01:00
parent a941592c21
commit c2af144c05
4 changed files with 45 additions and 22 deletions

View File

@@ -57,15 +57,19 @@ export default defineComponent({
const openlistorders = ref(false)
const endload = ref(false)
const myproduct = ref(<IProduct>{})
const valoriopt = computed(() => (item: any, addall: boolean, addnone: boolean) => {
// console.log('valoriopt', item.table)
return globalStore.getTableJoinByName(item.table, addall, addnone, item.filter)
})
const myproduct = computed((): IProduct => {
return products.getProduct(props.code)
})
/*const myproduct = computed((): IProduct => {
console.log('getproduct computed')
const ris = products.getProduct(props.code)
console.log(' received', ris)
return ris
})*/
function iconWhishlist(order: IProduct) {
@@ -103,6 +107,8 @@ export default defineComponent({
}
updateproduct()
if (ris === null || myorder.quantity === 0)
tools.showNotif($q, msg)
else
@@ -130,6 +136,10 @@ export default defineComponent({
}
}
function updateproduct() {
myproduct.value = products.getProduct(props.code)
}
function getStorehouses() {
const myarr: any = []
@@ -154,15 +164,8 @@ export default defineComponent({
return false
}
function updateQtyAvailable() {
myproduct.value.quantityAvailable = myproduct.value.stockQty
if (myproduct.value.QuantitaOrdinateInAttesa! > 0) {
myproduct.value.quantityAvailable! -= myproduct.value.QuantitaOrdinateInAttesa!
}
}
function getQtyAvailable() {
updateQtyAvailable()
products.updateQuantityAvailable(myproduct.value._id)
let qty = myproduct.value.quantityAvailable!
return qty
}
@@ -184,6 +187,8 @@ export default defineComponent({
})
function load() {
updateproduct()
console.log('Load', myproduct.value.name)
// console.log('created Cproductcard', code)
arrordersCart.value = products.getOrdersCartByIdProduct(myproduct.value._id)
@@ -199,7 +204,7 @@ export default defineComponent({
}
}
console.log('°°° ENDLOAD °°°')
endload.value = true
}
@@ -218,8 +223,8 @@ export default defineComponent({
function enableAddQty() {
if (site.value.ecomm!.enablePreOrders) {
return true
} else {
return getQtyAvailable() > 0
} else {
return getQtyAvailable() > 0
}
}