- Categorie
- ProductInfo
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user