- Aggiunto bottone Aggiungi al Carrello sulla lista dei libri dei cataloghi
This commit is contained in:
@@ -244,7 +244,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
|
||||
sovrascriviPaginaDefaultFromTemplate:
|
||||
(state: IGlobalState) => (idTemplate: string, origDimensioni: IDimensioni) => {
|
||||
const myfindelem = state.myelems.find((myelem: IMyElem) => myelem._id === idTemplate);
|
||||
const myfindelem = state.myelems.find(
|
||||
(myelem: IMyElem) => myelem._id === idTemplate
|
||||
);
|
||||
|
||||
const precname = origDimensioni.name;
|
||||
|
||||
@@ -255,7 +257,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
// myelemtocopy.scheda._id = origScheda.scheda?._id;
|
||||
myelemtocopy.catalogo.dimensioni_def.isTemplate = false;
|
||||
myelemtocopy.catalogo.dimensioni_def.name = precname;
|
||||
myelemtocopy.catalogo.dimensioni_def.linkIdTemplate = origDimensioni.linkIdTemplate;
|
||||
myelemtocopy.catalogo.dimensioni_def.linkIdTemplate =
|
||||
origDimensioni.linkIdTemplate;
|
||||
|
||||
return myelemtocopy.catalogo;
|
||||
}
|
||||
@@ -266,13 +269,15 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
|
||||
sovrascriviAreadistampaFromTemplate:
|
||||
(state: IGlobalState) => (idTemplate: string, optCatalogo: IOptCatalogo) => {
|
||||
const myfindelem = state.myelems.find((myelem: IMyElem) => myelem._id === idTemplate);
|
||||
const myfindelem = state.myelems.find(
|
||||
(myelem: IMyElem) => myelem._id === idTemplate
|
||||
);
|
||||
|
||||
if (myfindelem) {
|
||||
const myelemtocopy = tools.jsonCopy(myfindelem);
|
||||
|
||||
if (myelemtocopy) {
|
||||
const linkIdTemplate = myelemtocopy.catalogo.print_linkIdTemplate
|
||||
const linkIdTemplate = myelemtocopy.catalogo.print_linkIdTemplate;
|
||||
myelemtocopy.catalogo.print_isTemplate = false;
|
||||
myelemtocopy.catalogo.print_linkIdTemplate = linkIdTemplate;
|
||||
|
||||
@@ -304,24 +309,31 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
},
|
||||
|
||||
getColByStatusSkills: (state: IGlobalState) => (id: number) => {
|
||||
const ctrec = state.statusSkills.find((mystatus: IStatusSkill) => mystatus._id === id);
|
||||
const ctrec = state.statusSkills.find(
|
||||
(mystatus: IStatusSkill) => mystatus._id === id
|
||||
);
|
||||
return ctrec && ctrec.color ? ctrec.color : 'green';
|
||||
},
|
||||
|
||||
getStatusSkillById: (state: IGlobalState) => (id: number) => {
|
||||
const ctrec = state.statusSkills.find((mystatus: IStatusSkill) => mystatus._id === id);
|
||||
const ctrec = state.statusSkills.find(
|
||||
(mystatus: IStatusSkill) => mystatus._id === id
|
||||
);
|
||||
return ctrec ? ctrec.descr : '';
|
||||
},
|
||||
|
||||
getStatusSkillIconById: (state: IGlobalState) => (id: number) => {
|
||||
const ctrec = state.statusSkills.find((mystatus: IStatusSkill) => mystatus._id === id);
|
||||
const ctrec = state.statusSkills.find(
|
||||
(mystatus: IStatusSkill) => mystatus._id === id
|
||||
);
|
||||
return ctrec ? ctrec.icon : '';
|
||||
},
|
||||
|
||||
isNewVersionAvailable: (state: IGlobalState) => {
|
||||
// console.log('cfgServer', cfgServer)
|
||||
const serversrec = state.cfgServer.find(
|
||||
(x) => x.chiave === toolsext.SERVKEY_VERS && x.idapp === tools.getEnv('VITE_APP_ID')
|
||||
(x) =>
|
||||
x.chiave === toolsext.SERVKEY_VERS && x.idapp === tools.getEnv('VITE_APP_ID')
|
||||
);
|
||||
// console.log('Record ', serversrec)
|
||||
if (serversrec) {
|
||||
@@ -499,7 +511,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
else if (table === 'mypages_id') ris = state.mypage;
|
||||
else if (table === toolsext.TABMYELEMS) ris = state.myelems;
|
||||
else if (table === toolsext.TABCATALOGS) ris = catalogStore.catalogs!;
|
||||
else if (table === toolsext.TABRACCOLTA_CATALOGHI) ris = catalogStore.raccoltacataloghis!;
|
||||
else if (table === toolsext.TABRACCOLTA_CATALOGHI)
|
||||
ris = catalogStore.raccoltacataloghis!;
|
||||
else if (table === toolsext.TABCALZOOM) ris = state.calzoom;
|
||||
else if (table === 'producers') ris = state.producers;
|
||||
else if (table === 'storehouses') ris = state.storehouses;
|
||||
@@ -522,6 +535,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
else if (table === 'authors') ris = Products.authors;
|
||||
else if (table === 'publishers') ris = Products.publishers;
|
||||
else if (table === 'publishers_totali') ris = Products.publishers;
|
||||
else if (table === 'publishers_totali_sort_qty')
|
||||
ris = Products.publishers_sort_qty;
|
||||
else if (table === 't_web_statiprodottos') ris = Products.stati_prodotto;
|
||||
else if (table === 't_web_tipologies') ris = Products.tipologie;
|
||||
else if (table === 't_web_tipiformatos') ris = Products.tipoformato;
|
||||
@@ -556,7 +571,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
else if (table === toolsext.TABSECTORS) return state.sectors;
|
||||
else if (table === 'sectorgoods') return state.sectorgoods;
|
||||
else if (table === 'catgrps') return state.catgrps;
|
||||
else if (table === 'schedeopt') return Products.getSchedeOptByArrSchede(state.myschedas);
|
||||
else if (table === 'schedeopt')
|
||||
return Products.getSchedeOptByArrSchede(state.myschedas);
|
||||
else if (table === 'provinces')
|
||||
return state.provinces.filter(
|
||||
(rec: IProvince) => !rec.card && rec.prov !== 'ITA' && rec.prov !== 'EST'
|
||||
@@ -567,10 +583,12 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
);
|
||||
if (arrprov) {
|
||||
// const idCardArray: { _id: number, card: string }[] = arrprov.map(({ _id, card }) => ({ _id, card }));
|
||||
const idCardArray: { card: string; label: string }[] = arrprov.map(({ card }) => ({
|
||||
card,
|
||||
label: card,
|
||||
}));
|
||||
const idCardArray: { card: string; label: string }[] = arrprov.map(
|
||||
({ card }) => ({
|
||||
card,
|
||||
label: card,
|
||||
})
|
||||
);
|
||||
return idCardArray;
|
||||
}
|
||||
return [];
|
||||
@@ -601,7 +619,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
getdestnewsletterbyId:
|
||||
(mystate: IGlobalState) =>
|
||||
(id: string): string => {
|
||||
const myrec = mystate.destnewsletter.find((rec: IDestNewsletter) => rec._id === id);
|
||||
const myrec = mystate.destnewsletter.find(
|
||||
(rec: IDestNewsletter) => rec._id === id
|
||||
);
|
||||
return !!myrec ? myrec.descr! : '';
|
||||
},
|
||||
},
|
||||
@@ -624,7 +644,15 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
return [];
|
||||
},
|
||||
|
||||
setValueSettingsByKey({ key, value, serv }: { key: string; value: any; serv: boolean }): any {
|
||||
setValueSettingsByKey({
|
||||
key,
|
||||
value,
|
||||
serv,
|
||||
}: {
|
||||
key: string;
|
||||
value: any;
|
||||
serv: boolean;
|
||||
}): any {
|
||||
// Update the Server
|
||||
|
||||
// Update in Memory
|
||||
@@ -633,7 +661,10 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
else myrec = this.settings.find((rec: any) => rec.key === key);
|
||||
|
||||
if (myrec) {
|
||||
if (myrec.type === costanti.FieldType.date || myrec.type === costanti.FieldType.onlydate)
|
||||
if (
|
||||
myrec.type === costanti.FieldType.date ||
|
||||
myrec.type === costanti.FieldType.onlydate
|
||||
)
|
||||
myrec.value_date = value;
|
||||
else if (
|
||||
myrec.type === costanti.FieldType.number ||
|
||||
@@ -651,9 +682,15 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
const myrec = this.getrecSettingsByKey(key, serv);
|
||||
// console.log('getValueSettingsByKey', myrec, 'key=', key, 'srv=', serv)
|
||||
if (myrec) {
|
||||
if (myrec.type === costanti.FieldType.date || myrec.type === costanti.FieldType.onlydate)
|
||||
if (
|
||||
myrec.type === costanti.FieldType.date ||
|
||||
myrec.type === costanti.FieldType.onlydate
|
||||
)
|
||||
return myrec.value_date;
|
||||
if (myrec.type === costanti.FieldType.number || myrec.type === costanti.FieldType.hours)
|
||||
if (
|
||||
myrec.type === costanti.FieldType.number ||
|
||||
myrec.type === costanti.FieldType.hours
|
||||
)
|
||||
return myrec.value_num;
|
||||
if (myrec.type === costanti.FieldType.boolean) return myrec.value_bool;
|
||||
else if (myrec.type === costanti.FieldType.crypted) return '***********';
|
||||
@@ -1496,9 +1533,20 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
|
||||
const obj = { test: 'OK! Versione Client: ' + tools.getvers(), timeout };
|
||||
|
||||
return Api.SendReq('/api/test-lungo', 'POST', obj, false, false, 0, 5000, null, null, {
|
||||
timeout,
|
||||
})
|
||||
return Api.SendReq(
|
||||
'/api/test-lungo',
|
||||
'POST',
|
||||
obj,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
5000,
|
||||
null,
|
||||
null,
|
||||
{
|
||||
timeout,
|
||||
}
|
||||
)
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
@@ -1851,7 +1899,13 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
});
|
||||
},
|
||||
|
||||
async GetArrDoniNavi({ ricalcola, showall }: { ricalcola: boolean; showall: boolean }) {
|
||||
async GetArrDoniNavi({
|
||||
ricalcola,
|
||||
showall,
|
||||
}: {
|
||||
ricalcola: boolean;
|
||||
showall: boolean;
|
||||
}) {
|
||||
console.log('GetArrDoniNavi');
|
||||
|
||||
const mydata = {
|
||||
@@ -1933,7 +1987,11 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
},
|
||||
|
||||
async loadTest(ind: number, numval: number) {
|
||||
const restest = await Api.SendReq(`/testpao/?numval=${numval}&ind=${ind}`, 'GET', null);
|
||||
const restest = await Api.SendReq(
|
||||
`/testpao/?numval=${numval}&ind=${ind}`,
|
||||
'GET',
|
||||
null
|
||||
);
|
||||
return restest;
|
||||
},
|
||||
|
||||
@@ -1968,12 +2026,18 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
calendarStore.bookedevent = res.data.bookedevent ? res.data.bookedevent : [];
|
||||
calendarStore.eventlist = res.data.eventlist ? res.data.eventlist : [];
|
||||
calendarStore.operators = res.data.operators ? res.data.operators : [];
|
||||
calendarStore.internalpages = res.data.internalpages ? res.data.internalpages : [];
|
||||
calendarStore.internalpages = res.data.internalpages
|
||||
? res.data.internalpages
|
||||
: [];
|
||||
calendarStore.wheres = res.data.wheres ? res.data.wheres : [];
|
||||
calendarStore.contribtype = res.data.contribtype ? res.data.contribtype : [];
|
||||
|
||||
circuitStore.listcircuits = res.data.listcircuits ? res.data.listcircuits : [];
|
||||
circuitStore.listaccounts = res.data.listaccounts ? res.data.listaccounts : [];
|
||||
circuitStore.listcircuits = res.data.listcircuits
|
||||
? res.data.listcircuits
|
||||
: [];
|
||||
circuitStore.listaccounts = res.data.listaccounts
|
||||
? res.data.listaccounts
|
||||
: [];
|
||||
|
||||
catalogStore.catalogs = res.data.catalogs;
|
||||
catalogStore.raccoltacataloghis = res.data.raccoltacataloghis;
|
||||
@@ -1984,7 +2048,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
this.gallery = res.data.gallery ? [...res.data.gallery] : [];
|
||||
this.calzoom = res.data.calzoom ? [...res.data.calzoom] : [];
|
||||
Products.products = res.data.products ? [...res.data.products] : [];
|
||||
Products.productInfos = res.data.productInfos ? [...res.data.productInfos] : [];
|
||||
Products.productInfos = res.data.productInfos
|
||||
? [...res.data.productInfos]
|
||||
: [];
|
||||
this.producers = res.data.producers ? [...res.data.producers] : [];
|
||||
this.storehouses = res.data.storehouses ? [...res.data.storehouses] : [];
|
||||
this.providers = res.data.providers ? [...res.data.providers] : [];
|
||||
@@ -1993,13 +2059,23 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
Products.catprtotali = res.data.catprtotali ? [...res.data.catprtotali] : [];
|
||||
Products.collane = res.data.collane ? [...res.data.collane] : [];
|
||||
Products.subcatprods = res.data.subcatprods ? [...res.data.subcatprods] : [];
|
||||
Products.stati_prodotto = res.data.stati_prodotto ? [...res.data.stati_prodotto] : [];
|
||||
Products.stati_prodotto = res.data.stati_prodotto
|
||||
? [...res.data.stati_prodotto]
|
||||
: [];
|
||||
Products.tipologie = res.data.tipologie ? [...res.data.tipologie] : [];
|
||||
Products.tipoformato = res.data.tipoformato ? [...res.data.tipoformato] : [];
|
||||
Products.catprods_gas = res.data.catprods_gas ? [...res.data.catprods_gas] : [];
|
||||
Products.catprods_gas = res.data.catprods_gas
|
||||
? [...res.data.catprods_gas]
|
||||
: [];
|
||||
Products.authors = res.data.authors ? [...res.data.authors] : [];
|
||||
Products.publishers = res.data.publishers ? [...res.data.publishers] : [];
|
||||
|
||||
Products.publishers_sort_qty = [...res.data.publishers];
|
||||
Products.publishers_sort_qty.sort((a, b) => b.quanti - a.quanti);
|
||||
|
||||
// console.table(Products.publishers)
|
||||
// console.table(Products.publishers_sort_qty)
|
||||
|
||||
this.gasordines = res.data.gasordines ? [...res.data.gasordines] : [];
|
||||
this.scontisticas = res.data.scontisticas ? [...res.data.scontisticas] : [];
|
||||
this.groups = res.data.groups ? [...res.data.groups] : [];
|
||||
@@ -2372,7 +2448,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
else if (table === 'confpages_lang') myarr = costanti.ArrLang;
|
||||
else if (table === 'bottype') myarr = shared_consts.BotType;
|
||||
else if (table === 'visibility') myarr = shared_consts.Visibility;
|
||||
else if (table === 'cat_interesse_arcadei') myarr = shared_consts.Cat_Interesse_Arcadei;
|
||||
else if (table === 'cat_interesse_arcadei')
|
||||
myarr = shared_consts.Cat_Interesse_Arcadei;
|
||||
else if (table === 'pub_to_share') myarr = shared_consts.Pub_to_Share;
|
||||
else if (table === 'visibilGroup') myarr = shared_consts.VisibilGroup;
|
||||
else if (table === 'statuscircuit') myarr = shared_consts.StatusCircuit;
|
||||
@@ -2391,7 +2468,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
else if (table === toolsext.TABTYPEACCOM) myarr = shared_consts.TypeAccom;
|
||||
else if (table === toolsext.TABLOCACCOM) myarr = shared_consts.LocationAccom;
|
||||
else if (table === toolsext.TABPREF) myarr = shared_consts.Preferences;
|
||||
else if (table === toolsext.TABUNITS) myarr = shared_consts.Units_Of_Measure_ListBox;
|
||||
else if (table === toolsext.TABUNITS)
|
||||
myarr = shared_consts.Units_Of_Measure_ListBox;
|
||||
else if (table === toolsext.TABTYPECASH) myarr = shared_consts.TypeCashStr;
|
||||
else if (table === 'usernotifs') myarr = shared_consts.UsersNotif_Adv_List;
|
||||
else if (table === 'typenotifs') myarr = shared_consts.TypeNotifs_Arr;
|
||||
@@ -2478,7 +2556,12 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
getTableJoinLabelValueByName(col: IColGridTable) {
|
||||
let myarrrec: any = [];
|
||||
if (col.jointable) {
|
||||
let myarrtab = this.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter);
|
||||
let myarrtab = this.getTableJoinByName(
|
||||
col.jointable,
|
||||
col.addall,
|
||||
col.addnone,
|
||||
col.filter
|
||||
);
|
||||
|
||||
const key = fieldsTable.getKeyByTable(col.jointable);
|
||||
const collab = fieldsTable.getLabelByTable(col.jointable);
|
||||
@@ -2523,20 +2606,22 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
async delMyElem($q: any, t: any, myelem: IMyElem) {
|
||||
if (!myelem._id) return false;
|
||||
|
||||
return await this.DeleteRec({ table: 'myelems', id: myelem._id }).then(async (ris) => {
|
||||
if (ris) {
|
||||
this.myelems = this.myelems.filter((rec) => rec._id !== myelem._id);
|
||||
return await this.DeleteRec({ table: 'myelems', id: myelem._id }).then(
|
||||
async (ris) => {
|
||||
if (ris) {
|
||||
this.myelems = this.myelems.filter((rec) => rec._id !== myelem._id);
|
||||
|
||||
// Aggiorna anche tutto il sito...
|
||||
// await this.loadSite()
|
||||
// Aggiorna anche tutto il sito...
|
||||
// await this.loadSite()
|
||||
|
||||
tools.showPositiveNotif($q, t('db.deletedrecord'));
|
||||
return true;
|
||||
} else {
|
||||
tools.showNegativeNotif($q, t('db.recdelfailed'));
|
||||
return false;
|
||||
tools.showPositiveNotif($q, t('db.deletedrecord'));
|
||||
return true;
|
||||
} else {
|
||||
tools.showNegativeNotif($q, t('db.recdelfailed'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
},
|
||||
|
||||
async saveMyElem($q: any, t: any, myelem: IMyElem) {
|
||||
@@ -2748,7 +2833,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
dir_out: string = '',
|
||||
file_out: string = '',
|
||||
print: boolean = false,
|
||||
optcatalogo: IOptCatalogo | null = null,
|
||||
optcatalogo: IOptCatalogo | null = null
|
||||
) {
|
||||
try {
|
||||
if (!pdfFile) {
|
||||
@@ -2756,7 +2841,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
return;
|
||||
}
|
||||
|
||||
const filenameToDownload = tools.removeFileExtension(pdfFile.name) + '-compresso.pdf';
|
||||
const filenameToDownload =
|
||||
tools.removeFileExtension(pdfFile.name) + '-compresso.pdf';
|
||||
|
||||
const formData = new FormData();
|
||||
if (pdfFile instanceof File) {
|
||||
@@ -2775,8 +2861,10 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
formData.append('print_right', optcatalogo.areadistampa.margini.right);
|
||||
formData.append('print_bottom', optcatalogo.areadistampa.margini.bottom); // 7 mm 0,275"
|
||||
}
|
||||
formData.append('salvasufiledascaricare', salvasufiledascaricare ? 'true' : 'false');
|
||||
|
||||
formData.append(
|
||||
'salvasufiledascaricare',
|
||||
salvasufiledascaricare ? 'true' : 'false'
|
||||
);
|
||||
|
||||
console.log('2) Invia le immagini al convertitore/compressione di PDF...');
|
||||
|
||||
@@ -2877,7 +2965,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
numrec: 1,
|
||||
query: '',
|
||||
where:
|
||||
'T.IdArticolo =' + sku + ' AND T.DataPubblicazione IS NOT NULL ORDER BY T.DataOra DESC;',
|
||||
'T.IdArticolo =' +
|
||||
sku +
|
||||
' AND T.DataPubblicazione IS NOT NULL ORDER BY T.DataOra DESC;',
|
||||
fieldGM: field,
|
||||
showQtaDisponibile: false,
|
||||
outhtml: false,
|
||||
@@ -2913,7 +3003,11 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
return valueris;
|
||||
},
|
||||
|
||||
async setGM_FieldOf_T_Web_Articoli(sku: string, data: Record<string, any>, cmd: number) {
|
||||
async setGM_FieldOf_T_Web_Articoli(
|
||||
sku: string,
|
||||
data: Record<string, any>,
|
||||
cmd: number
|
||||
) {
|
||||
try {
|
||||
// Verifica se i campi specificati sono validi
|
||||
if (!data || Object.keys(data).length === 0) {
|
||||
@@ -3051,7 +3145,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
|
||||
if (mytablerec && resdata && resdata.rec) {
|
||||
// Trova l'indice del record da aggiornare
|
||||
const index = mytablerec.findIndex((item: any) => item._id === resdata.rec._id);
|
||||
const index = mytablerec.findIndex(
|
||||
(item: any) => item._id === resdata.rec._id
|
||||
);
|
||||
|
||||
if (index !== -1 && index !== undefined) {
|
||||
// Aggiorna il record mantenendo reattività
|
||||
@@ -3075,8 +3171,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
} catch (e) {}
|
||||
},
|
||||
setshowHeader(value: boolean) {
|
||||
this.showHeader = value
|
||||
}
|
||||
|
||||
this.showHeader = value;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user