- Creazione pagina Home logout
- Nuovo Gasordine - Visualizzazione GAS / BOTTEGA
This commit is contained in:
@@ -20,8 +20,18 @@ export const useProducts = defineStore('Products', {
|
||||
}),
|
||||
|
||||
getters: {
|
||||
getProducts: (state: IProductsState) => (): IProduct[] => {
|
||||
return state.products
|
||||
getProducts: (state: IProductsState) => (cosa?: number): IProduct[] => {
|
||||
if (!!cosa) {
|
||||
let ris = null
|
||||
if (cosa === shared_consts.PROD.GAS) {
|
||||
ris = state.products.filter((rec) => (rec.idGasordines && rec.idGasordines.length > 0))
|
||||
} else if (cosa === shared_consts.PROD.BOTTEGA) {
|
||||
ris = state.products.filter((rec) => (!rec.idGasordines || (rec.idGasordines && rec.idGasordines.length === 0)))
|
||||
}
|
||||
return ris ? ris : []
|
||||
} else {
|
||||
return state.products
|
||||
}
|
||||
},
|
||||
|
||||
updateDataProduct: (state: IProductsState) => (res: any) => {
|
||||
@@ -55,14 +65,15 @@ export const useProducts = defineStore('Products', {
|
||||
|
||||
getProductById: (state: IProductsState) => (id: string): IProduct => {
|
||||
const prod = state.products.find((prod: IProduct) => prod._id === id)
|
||||
return prod ? prod : { active: false, img: '', code: '', name: '', storehouses: [], scontisticas: [], price: 0, stockQty: 0, bookableQty: 0 }
|
||||
return prod ? prod : { active: false, img: '', code: '', name: '', storehouses: [], scontisticas: [], price: 0, stockQty: 0, bookableQty: 0, gasordines: [], idGasordines: [], minBuyQty: 1 }
|
||||
},
|
||||
|
||||
getProductByCode: (state: IProductsState) => (code: string): IProduct => {
|
||||
const prod = state.products.find((prod: IProduct) => prod.code === code)
|
||||
return prod ? prod : {
|
||||
active: false, img: '', code: '', name: '', storehouses: [], scontisticas: [], price: 0,
|
||||
stockQty: 0, bookableQty: 0
|
||||
gasordines: [], idGasordines: [],
|
||||
stockQty: 0, bookableQty: 0, minBuyQty: 1
|
||||
}
|
||||
},
|
||||
|
||||
@@ -215,8 +226,10 @@ export const useProducts = defineStore('Products', {
|
||||
active: false,
|
||||
idProducer: '',
|
||||
idStorehouses: [],
|
||||
idGasordines: [],
|
||||
idScontisticas: [],
|
||||
scontisticas: [],
|
||||
gasordines: [],
|
||||
idProvider: '',
|
||||
producer: {},
|
||||
storehouses: [],
|
||||
@@ -232,6 +245,7 @@ export const useProducts = defineStore('Products', {
|
||||
quantityAvailable: 0,
|
||||
bookableAvailableQty: 0,
|
||||
stockQty: 0,
|
||||
minBuyQty: 1,
|
||||
bookableQty: 0,
|
||||
canBeShipped: false,
|
||||
QuantitaOrdinateInAttesa: 0,
|
||||
@@ -645,7 +659,7 @@ export const useProducts = defineStore('Products', {
|
||||
if (ris && ris.myord == null) {
|
||||
msg = t('ecomm.prodotto_tolto')
|
||||
tools.showNotif($q, msg)
|
||||
return
|
||||
return
|
||||
}
|
||||
if (ris === null || ris.myord == null) {
|
||||
msg = t('ecomm.error_cart')
|
||||
|
||||
Reference in New Issue
Block a user