Aggiornamento modifiche preOrdini
This commit is contained in:
@@ -79,48 +79,15 @@ export default defineComponent({
|
||||
return 'fas fa-heart'
|
||||
}
|
||||
}
|
||||
function addtoCart(add: boolean) {
|
||||
async function addtoCart(add: boolean) {
|
||||
|
||||
if (!userStore.isLogged) {
|
||||
tools.showNeutralNotif($q, t('ecomm.area_personale'))
|
||||
globalStore.rightDrawerOpen = true
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
if (myproduct.value) {
|
||||
products.addToCart({ product: myproduct.value, order: myorder, addqty: add }).then((ris: any) => {
|
||||
let strprod = t('ecomm.prodotto')
|
||||
|
||||
let msg = ''
|
||||
console.log('ris', ris)
|
||||
if (ris === null || ris.myord == null) {
|
||||
msg = t('ecomm.error_cart')
|
||||
tools.showNegativeNotif($q, msg)
|
||||
return
|
||||
} else {
|
||||
|
||||
let qta = ris.myord.quantity + ris.myord.quantitypreordered
|
||||
if (qta > 1 || qta === 0)
|
||||
strprod = t('ecomm.prodotti')
|
||||
|
||||
if (qta === 0) {
|
||||
msg = t('ecomm.prodotto_tolto')
|
||||
} else {
|
||||
msg = t('ecomm.prod_sul_carrello', { strprod, qty: qta })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
updateproduct()
|
||||
|
||||
if (ris === null || ris.myord.quantity === 0)
|
||||
tools.showNotif($q, msg)
|
||||
else
|
||||
tools.showPositiveNotif($q, msg)
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
await products.addtoCartBase({ $q, t, code: myproduct.value.code!, order: myorder, addqty: add })
|
||||
}
|
||||
|
||||
function getnumstore() {
|
||||
@@ -146,7 +113,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function updateproduct() {
|
||||
myproduct.value = products.getProduct(props.code)
|
||||
myproduct.value = products.getProductByCode(props.code)
|
||||
// products.updateQuantityAvailable(myproduct.value._id)
|
||||
}
|
||||
|
||||
@@ -214,7 +181,7 @@ export default defineComponent({
|
||||
// console.log('Load', myproduct.value.name)
|
||||
// console.log('created Cproductcard', code)
|
||||
|
||||
arrordersCart.value = products.getOrdersCartByIdProduct(myproduct.value._id)
|
||||
arrordersCart.value = products.getOrdersCartInAttesaByIdProduct(myproduct.value._id)
|
||||
|
||||
if (!!myproduct.value) {
|
||||
if (myproduct.value.storehouses && myproduct.value.storehouses.length === 1) {
|
||||
@@ -246,7 +213,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function enableAddQty() {
|
||||
if (site.value.ecomm!.enablePreOrders) {
|
||||
if (site.value.ecomm && site.value.ecomm.enablePreOrders) {
|
||||
return true
|
||||
} else {
|
||||
return getQtyAvailable() > 0
|
||||
|
||||
Reference in New Issue
Block a user