PASSAGGIO A VITE !
AGG. 1.1.23
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine, IAuthor, ISubCatProd, IText, IOptCatalogo, ICatalog, ICatPrTotali } from 'model'
|
||||
import type { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine, IAuthor, ISubCatProd, IText, IOptCatalogo, ICatPrTotali } from 'model';
|
||||
import { ICatalog } from 'model'
|
||||
|
||||
import { Api } from '@api'
|
||||
import { serv_constants } from '@src/store/Modules/serv_constants'
|
||||
import * as Types from '@src/store/Api/ApiTypes'
|
||||
import { static_data } from '@src/db/static_data'
|
||||
import { shared_consts } from '@src/common/shared_vuejs'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { tools } from '@tools'
|
||||
import { defineStore } from 'pinia'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
@@ -119,7 +120,7 @@ export const useProducts = defineStore('Products', {
|
||||
getCatProds: (state: IProductsState) => (cosa: number): ICatProd[] => {
|
||||
if (cosa === shared_consts.PROD.GAS)
|
||||
return state.catprods_gas
|
||||
else if (cosa === shared_consts.PROD.GAS)
|
||||
else if (cosa === shared_consts.PROD.BOTTEGA)
|
||||
return state.catprods
|
||||
else
|
||||
return [...state.catprods, ...state.catprods_gas]
|
||||
@@ -468,12 +469,12 @@ export const useProducts = defineStore('Products', {
|
||||
const userStore = useUserStore()
|
||||
const myorder: IOrder = {
|
||||
userId: this.userActive._id,
|
||||
idapp: process.env.APP_ID,
|
||||
idapp: tools.getEnv('VITE_APP_ID'),
|
||||
status: shared_consts.OrderStatus.IN_CART,
|
||||
TotalPriceProduct: 0,
|
||||
TotalPriceProductCalc: 0,
|
||||
idProduct: product._id,
|
||||
product, // Copia tutto l'oggetto Product !
|
||||
product, // Copia tutto l'oggetto Product !
|
||||
|
||||
// Ordine:
|
||||
price: product.price,
|
||||
@@ -562,7 +563,7 @@ export const useProducts = defineStore('Products', {
|
||||
this.orders = []
|
||||
}
|
||||
|
||||
if (process.env.DEBUG === '1') {
|
||||
if (import.meta.env.VITE_DEBUG === '1') {
|
||||
}
|
||||
|
||||
return res
|
||||
@@ -817,14 +818,18 @@ export const useProducts = defineStore('Products', {
|
||||
if (product.storehouses.length === 1) {
|
||||
order.idStorehouse = product.storehouses[0]._id
|
||||
} else {
|
||||
order.idStorehouse = globalStore.storehouses ? globalStore.storehouses[0]._id : ''
|
||||
try {
|
||||
order.idStorehouse = globalStore.storehouses?.length ? globalStore.storehouses[0]._id : ''
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!order.idGasordine && order.quantitypreordered > 0) {
|
||||
if (product.gasordine && product.gasordine._id) {
|
||||
order.idGasordine = product.gasordine._id
|
||||
} else {
|
||||
order.idGasordine = globalStore.gasordines ? globalStore.gasordines[0]._id : ''
|
||||
order.idGasordine = globalStore.gasordines?.length ? globalStore.gasordines[0]._id : ''
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1374,7 +1379,7 @@ export const useProducts = defineStore('Products', {
|
||||
const descr_categoria = myproduct.productInfo.catprods && myproduct.productInfo.catprods.length > 0 ? this.getCatProdDescrStrByIdCatProd(myproduct.productInfo.catprods![0].name) : ''
|
||||
const misure = myproduct.arrvariazioni![0].misure || ''
|
||||
const formato = myproduct.arrvariazioni![0].formato || ''
|
||||
const pagine = myproduct.arrvariazioni![0].pagine || ''
|
||||
const pagine = myproduct.arrvariazioni![0].pagine || ''
|
||||
|
||||
const scale = optcatalogo.printable ? optcatalogo.areadistampa?.scale : 1
|
||||
// Crea una mappa di sostituzioni
|
||||
|
||||
Reference in New Issue
Block a user