- Categorie

- ProductInfo
This commit is contained in:
Surya Paolo
2023-12-27 02:58:23 +01:00
parent c27c293fbf
commit 6be8ccc906
30 changed files with 612 additions and 198 deletions

View File

@@ -8,7 +8,7 @@ import { useI18n } from '@/boot/i18n'
import { toolsext } from '@store/Modules/toolsext'
import { useQuasar } from 'quasar'
import { costanti } from '@costanti'
import { ICart, IOrder, IOrderCart, IShareWithUs } from '@src/model/Products'
import { ICart, IOrder, IOrderCart, IProduct, IShareWithUs } from '@src/model/Products'
import { shared_consts } from '@src/common/shared_vuejs'
@@ -178,13 +178,39 @@ export default defineComponent({
})
}
function getActualIdStorehouse(myprod: IProduct) {
// Ottieni il negozio attualmente selezionato:
// Se ce n'è solo 1 allora prendi quello !
if (myprod.storehouses.length === 1) {
return myprod.storehouses[0]._id
} else {
// Ottieni il negozio attualmente scelto !
return ''
}
}
function getActualGasordine(myprod: IProduct) {
// Ottieni il negozio attualmente selezionato:
// Se ce n'è solo 1 allora prendi quello !
if (myprod.gasordines.length === 1) {
return myprod.gasordines[0]._id
} else {
// Ottieni il gasordine attualmente scelto !
return ''
}
}
async function insertArticolo() {
let lowerSearchText = search.value.trim();
const myprod = productStore.getProductByCode(lowerSearchText);
if (myprod && myprod.active) {
let myorder: IOrder = { quantity: 1, quantitypreordered: 0, price: 0, TotalPriceProduct: 0 }
await productStore.addtoCartBase({ $q, t, code: myprod.code!, order: myorder, addqty: true })
let myorder: IOrder = { quantity: 1, quantitypreordered: 0,
TotalPriceProduct: 0, price: 0,
idStorehouse: getActualIdStorehouse(myprod),
idGasordine: getActualGasordine(myprod),
}
await productStore.addtoCartBase({ $q, t, id: myprod._id, order: myorder, addqty: true })
search.value = ''
load()
}