- aggiornamento con proj RISO. postcss, pwa.
This commit is contained in:
@@ -36,8 +36,6 @@ import MixinBase from '@src/mixins/mixin-base'
|
||||
|
||||
import { fieldsTable } from '@store/Modules/fieldsTable'
|
||||
|
||||
import { addToDate } from '@quasar/quasar-ui-qcalendar'
|
||||
|
||||
import { lists } from '@store/Modules/lists'
|
||||
import { costanti } from '@store/Modules/costanti'
|
||||
import { copyToClipboard, date, Screen, useQuasar, colors, Cookies, scroll } from 'quasar'
|
||||
@@ -64,7 +62,8 @@ import type { AxiosResponse } from 'axios';
|
||||
import { default as Axios } from 'axios'
|
||||
import { PayloadMessageTypes } from '@src/common'
|
||||
import { useNotifStore } from '@store/NotifStore'
|
||||
import { isDimensionToken } from 'html2canvas/dist/types/css/syntax/parser'
|
||||
|
||||
const { t } = i18n.global;
|
||||
|
||||
export interface INotify {
|
||||
color?: string
|
||||
@@ -72,7 +71,6 @@ export interface INotify {
|
||||
icon?: string
|
||||
}
|
||||
|
||||
const { t } = i18n.global;
|
||||
|
||||
export const tools = {
|
||||
CAN_EDIT: 'q-ce',
|
||||
@@ -89,6 +87,12 @@ export const tools = {
|
||||
COOK_SEARCH: 'SEARCH_',
|
||||
COOK_SELCART: 'SELCART_',
|
||||
COOK_SELGAS: 'SELGAS',
|
||||
COOK_TABORD: 'TABORD',
|
||||
COOK_TABPAGES: 'TABPAGES',
|
||||
COOK_SHOWCODICE: 'SHOWCOD',
|
||||
COOK_SHOWCAT: 'SHOWCAT',
|
||||
COOK_SHOWCODE: 'SHOW_WC',
|
||||
COOK_SHOWORDPROD: 'SHOWORDPROD',
|
||||
COOK_TAB_CIRCUIT: 'TAB_CIRC',
|
||||
COOK_COSA_PRODOTTI: 'PROD_N',
|
||||
COOK_MAP_CENTER_LAT: 'MAP_LAT',
|
||||
@@ -4121,7 +4125,6 @@ export const tools = {
|
||||
|
||||
SignIncheckErrors(mythisq: any, $router: Router, route: any, riscode: any, ispageLogin?: boolean) {
|
||||
console.log('SignIncheckErrors: ', riscode)
|
||||
const $q = useQuasar()
|
||||
//T_TOLTO
|
||||
|
||||
|
||||
@@ -4245,6 +4248,7 @@ export const tools = {
|
||||
const msg2 = t('fetch.errore_generico') + userStore.getMsgError(riscode)
|
||||
this.showNotif(mythisq, msg2)
|
||||
} else if (riscode === this.OK) {
|
||||
console.log('VAI A SIGNIN:')
|
||||
$router.replace('/signin')
|
||||
/*this.showNotif(mythisq, t('components.authentication.email_verification.link_sent', { botname: t('ws.botname') }), {
|
||||
color: 'green',
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import type { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine, IAuthor, ISubCatProd, IText, IOptCatalogo, ICatPrTotali } from 'model';
|
||||
import { ICatalog } from 'model'
|
||||
import { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine, IAuthor, ISubCatProd, IText, IOptCatalogo, ICatalog, ICatPrTotali, ISingleProductOrdered, ISchedaSingola, IMyScheda } 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 '@tools'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { defineStore } from 'pinia'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
@@ -120,7 +119,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.BOTTEGA)
|
||||
else if (cosa === shared_consts.PROD.GAS)
|
||||
return state.catprods
|
||||
else
|
||||
return [...state.catprods, ...state.catprods_gas]
|
||||
@@ -163,6 +162,42 @@ export const useProducts = defineStore('Products', {
|
||||
return mystr
|
||||
},
|
||||
|
||||
getSubCatProdsStrBySubCatProds: (state: IProductsState) => (idSubCatProds: string[]): string => {
|
||||
let mystr = '';
|
||||
if (Array.isArray(idSubCatProds) && idSubCatProds.length > 0) {
|
||||
const names = idSubCatProds.map(id => {
|
||||
const subCatProd = state.subcatprods.find((rec: ISubCatProd) => rec._id === id);
|
||||
return subCatProd ? subCatProd.name : '';
|
||||
}).filter(name => name !== '');
|
||||
|
||||
mystr = names.join(' - ');
|
||||
}
|
||||
return mystr;
|
||||
},
|
||||
|
||||
getTotaleOrdineByOrdId: (state: IProductsState) => (idOrdine: string, idGasordine: string, mostra_solo_ordini_produttore: boolean): number => {
|
||||
|
||||
const arrprod = state.orders.filter((rec: IOrderCart) => {
|
||||
if (idGasordine && !rec.items?.some(item => item.order && item.order.idGasordine === idGasordine) || (rec._id !== idOrdine)) {
|
||||
return false; // Skip records not matching gasordine condition
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
let subtotalPrice = 0
|
||||
|
||||
arrprod.forEach((rec: IOrderCart) => {
|
||||
rec.items?.forEach(item => {
|
||||
if (item.order && ((mostra_solo_ordini_produttore && (item.order.idGasordine === idGasordine)) || !mostra_solo_ordini_produttore)) {
|
||||
const qtyparz = item.order.quantity + item.order.quantitypreordered
|
||||
subtotalPrice += item.order.price * qtyparz
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return subtotalPrice;
|
||||
},
|
||||
|
||||
getCatProdDescrStrByIdCatProd: (state: IProductsState) => (idCatProd: string): string => {
|
||||
const myfirstcat = state.catprods.find((rec: ICatProd) => rec._id === idCatProd)
|
||||
|
||||
@@ -180,6 +215,7 @@ export const useProducts = defineStore('Products', {
|
||||
return 0
|
||||
},
|
||||
|
||||
|
||||
getSubCatProdsByGas: (state: IProductsState) => (idGasOrdine: string, idCatProd: string): ISubCatProd[] => {
|
||||
let arrcat = state.subcatprods
|
||||
|
||||
@@ -469,7 +505,7 @@ export const useProducts = defineStore('Products', {
|
||||
const userStore = useUserStore()
|
||||
const myorder: IOrder = {
|
||||
userId: this.userActive._id,
|
||||
idapp: tools.getEnv('VITE_APP_ID'),
|
||||
idapp: import.meta.env.VITE_APP_ID,
|
||||
status: shared_consts.OrderStatus.IN_CART,
|
||||
TotalPriceProduct: 0,
|
||||
TotalPriceProductCalc: 0,
|
||||
@@ -563,9 +599,6 @@ export const useProducts = defineStore('Products', {
|
||||
this.orders = []
|
||||
}
|
||||
|
||||
if (import.meta.env.VITE_DEBUG === '1') {
|
||||
}
|
||||
|
||||
return res
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -1049,7 +1082,7 @@ export const useProducts = defineStore('Products', {
|
||||
mystr += ' + '
|
||||
}
|
||||
if (order.quantitypreordered > 0) {
|
||||
mystr += ' ' + order.quantitypreordered + ' ' + $t('ecomm.preord');
|
||||
mystr += ' ' + order.quantitypreordered + ' ';
|
||||
}
|
||||
return mystr
|
||||
},
|
||||
@@ -1249,6 +1282,14 @@ export const useProducts = defineStore('Products', {
|
||||
return mystr
|
||||
},
|
||||
|
||||
getGasordineNameById(idGasordine: string) {
|
||||
|
||||
const globalStore = useGlobalStore()
|
||||
const rec = globalStore.gasordines.find((gasordine: IGasordine) => gasordine._id === idGasordine)
|
||||
return rec ? rec.name : ''
|
||||
|
||||
},
|
||||
|
||||
getGasordines() {
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
@@ -1258,16 +1299,22 @@ export const useProducts = defineStore('Products', {
|
||||
value: ''
|
||||
}]
|
||||
let ind = 1
|
||||
globalStore.gasordines.forEach((gasordine: IGasordine) => {
|
||||
myarr.push(
|
||||
{
|
||||
id: ind,
|
||||
label: gasordine.name,
|
||||
value: gasordine._id
|
||||
})
|
||||
|
||||
ind++
|
||||
})
|
||||
if (globalStore.gasordines) {
|
||||
globalStore.gasordines.forEach((gasordine: IGasordine) => {
|
||||
if (gasordine) {
|
||||
myarr.push(
|
||||
{
|
||||
id: ind,
|
||||
label: gasordine.name
|
||||
+ (gasordine.dataora_chiusura_ordini ? (' - chiusura: ' + tools.getstrDateShort(gasordine.dataora_chiusura_ordini)) : '')
|
||||
+ (gasordine.dataora_ritiro ? (' - consegna ' + tools.getstrDateShort(gasordine.dataora_ritiro)) : '')
|
||||
,
|
||||
value: gasordine._id
|
||||
})
|
||||
ind++
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return myarr
|
||||
},
|
||||
@@ -1419,6 +1466,82 @@ export const useProducts = defineStore('Products', {
|
||||
return result.trim()
|
||||
},
|
||||
|
||||
getSubCatStrByProduct(myproductInfo: IProductInfo): string {
|
||||
return this.getSubCatProdsStrBySubCatProds(myproductInfo.idSubCatProds || [])
|
||||
},
|
||||
|
||||
getListProductBySumQuantity(idGasordine: string): ISingleProductOrdered[] {
|
||||
|
||||
const arrprod = this.orders.filter((rec: IOrderCart) => {
|
||||
if (idGasordine && !rec.items?.some(item => item.order && item.order.idGasordine === idGasordine)) {
|
||||
return false; // Skip records not matching gasordine condition
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
const productMap = new Map<string, ISingleProductOrdered>();
|
||||
|
||||
arrprod.forEach((rec: IOrderCart) => {
|
||||
rec.items?.forEach(item => {
|
||||
if (item.order && item.order.idGasordine === idGasordine) {
|
||||
const productId: string = item.order.idProduct!;
|
||||
const qtyparz = item.order.quantity + item.order.quantitypreordered
|
||||
if (productMap.has(productId)) {
|
||||
const existingProduct: ISingleProductOrdered = productMap.get(productId)!
|
||||
existingProduct.qty += qtyparz
|
||||
existingProduct.subtotalPrice += item.order.price * qtyparz
|
||||
existingProduct.subtotalPrice = Number((existingProduct.subtotalPrice).toFixed(2))
|
||||
} else {
|
||||
|
||||
const sottocategoria = item.order.product?.productInfo.subcatprods && item.order.product?.productInfo.subcatprods.length > 0 ? item.order.product?.productInfo.subcatprods[0].name! : ''
|
||||
productMap.set(productId, {
|
||||
subCat: sottocategoria,
|
||||
strSubCatProds: this.getSubCatProdsStrBySubCatProds(item.order.product?.productInfo.idSubCatProds!),
|
||||
index: productMap.size + 1,
|
||||
idProduct: productId,
|
||||
code: item.order.product?.productInfo.code!,
|
||||
codice_interno: item.order.product?.productInfo.codice!,
|
||||
qty: qtyparz,
|
||||
singlePrice: item.order.price,
|
||||
subtotalPrice: Number((item.order.price * qtyparz).toFixed(2)),
|
||||
productName: item.order.product?.productInfo.name!,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return Array.from(productMap.values());
|
||||
|
||||
},
|
||||
|
||||
getSchedeOpt(arrschede: IMyScheda[]): any[] {
|
||||
|
||||
let arr: any = []
|
||||
|
||||
arr.push({ label: '[Nessuna]', value: '' })
|
||||
|
||||
if (arrschede) {
|
||||
arrschede.forEach((recscheda: ISchedaSingola) => {
|
||||
let pagename = ''
|
||||
if (recscheda.scheda) {
|
||||
if (recscheda.idPageOrig) {
|
||||
const page = this.mypage.find((page) => (`${page._id}`) === recscheda.idPageOrig)
|
||||
pagename = page ? page.title! : ''
|
||||
}
|
||||
if (pagename)
|
||||
pagename = '[Pag: ' + pagename + '] '
|
||||
|
||||
const mylabel = pagename + (recscheda.scheda ? recscheda.scheda!.name : '')
|
||||
arr.push({ label: mylabel, value: recscheda.scheda!._id })
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return arr
|
||||
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ import { useCatalogStore } from './CatalogStore'
|
||||
|
||||
const stateConnDefault = 'online'
|
||||
|
||||
|
||||
async function getConfig(id: any) {
|
||||
return globalroutines('read', 'config', null, id)
|
||||
}
|
||||
@@ -257,6 +258,12 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
return false
|
||||
},
|
||||
|
||||
getSchedeOpt: (state: IGlobalState) => {
|
||||
const Products = useProducts()
|
||||
|
||||
return Products.getSchedeOpt(state.myschedas)
|
||||
},
|
||||
|
||||
isMyLang: (state: IGlobalState) => (rec: any) => {
|
||||
if (!rec.lang) return true
|
||||
|
||||
@@ -344,34 +351,6 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
return !!rec ? rec.name + ' ' + rec.surname : ''
|
||||
},
|
||||
|
||||
getSchedeOpt(): any[] {
|
||||
const arrschede: ISchedaSingola[] = this.myschedas
|
||||
|
||||
let arr: any = []
|
||||
|
||||
arr.push({ label: '[Nessuna]', value: '' })
|
||||
|
||||
if (arrschede) {
|
||||
arrschede.forEach((recscheda: ISchedaSingola) => {
|
||||
let pagename = ''
|
||||
if (recscheda.scheda) {
|
||||
if (recscheda.idPageOrig) {
|
||||
const page = this.mypage.find((page) => (`${page._id}`) === recscheda.idPageOrig)
|
||||
pagename = page ? page.title! : ''
|
||||
}
|
||||
if (pagename)
|
||||
pagename = '[Pag: ' + pagename + '] '
|
||||
|
||||
const mylabel = pagename + (recscheda.scheda ? recscheda.scheda!.name : '')
|
||||
arr.push({ label: mylabel, value: recscheda.scheda!._id })
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return arr
|
||||
|
||||
},
|
||||
|
||||
getListByTable: (state: IGlobalState) => (table: string, value2?: any): any => {
|
||||
let ris: any = []
|
||||
|
||||
@@ -474,7 +453,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
else if (table === 'collanas')
|
||||
return Products.collane
|
||||
else if (table === 'schedeopt')
|
||||
return state.getSchedeOpt
|
||||
return Products.getSchedeOpt(state.myschedas)
|
||||
else if (table === 'provinces')
|
||||
return state.provinces.filter((rec: IProvince) => (!rec.card) && (rec.prov !== 'ITA') && (rec.prov !== 'EST'))
|
||||
else if (table === 'cards') {
|
||||
@@ -1868,6 +1847,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
this.rightDrawerOpen = true
|
||||
return false
|
||||
} else {
|
||||
console.log('NON SONO LOGGATO... MYUSER NON TORNATO dal SRV',)
|
||||
console.log('Sbianca cmq i dati')
|
||||
// Sbianca cmq i dati
|
||||
const token = localStorage.getItem(toolsext.localStorage.token)
|
||||
|
||||
Reference in New Issue
Block a user