- Finalmente risolto il calcolo e l'impaginazione del PDF, per WEb e per Stampa (300 dpi) !
- corretto altre cose sulla lista cataloghi.
This commit is contained in:
@@ -215,17 +215,12 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
getters: {
|
||||
sovrascriviSchedaFromTemplate:
|
||||
(state: IGlobalState) =>
|
||||
(
|
||||
idTemplate: string,
|
||||
origScheda: ISchedaSingola,
|
||||
optcatalogo: IOptCatalogo
|
||||
) => {
|
||||
(idTemplate: string, origScheda: ISchedaSingola, optcatalogo: IOptCatalogo) => {
|
||||
const arrschede: ISchedaSingola[] = state.myschedas;
|
||||
const myfindscheda = arrschede.find(
|
||||
(recscheda: ISchedaSingola) => recscheda.scheda?._id === idTemplate
|
||||
);
|
||||
|
||||
const linkIdTemplate = origScheda.scheda?.linkIdTemplate;
|
||||
const precname = origScheda.scheda?.name;
|
||||
|
||||
if (myfindscheda) {
|
||||
@@ -235,7 +230,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
myschedatocopy.scheda._id = origScheda.scheda?._id;
|
||||
myschedatocopy.scheda.isTemplate = false;
|
||||
myschedatocopy.scheda.name = precname;
|
||||
myschedatocopy.scheda.linkIdTemplate = linkIdTemplate;
|
||||
myschedatocopy.scheda.linkIdTemplatePerStampa =
|
||||
origScheda.scheda?.linkIdTemplatePerStampa;
|
||||
myschedatocopy.scheda.linkIdTemplate = origScheda.scheda?.linkIdTemplate;
|
||||
|
||||
return myschedatocopy.scheda;
|
||||
}
|
||||
@@ -245,13 +242,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
},
|
||||
|
||||
sovrascriviPaginaDefaultFromTemplate:
|
||||
(state: IGlobalState) =>
|
||||
(idTemplate: string, origDimensioni: IDimensioni) => {
|
||||
const myfindelem = state.myelems.find(
|
||||
(myelem: IMyElem) => myelem._id === idTemplate
|
||||
);
|
||||
(state: IGlobalState) => (idTemplate: string, origDimensioni: IDimensioni) => {
|
||||
const myfindelem = state.myelems.find((myelem: IMyElem) => myelem._id === idTemplate);
|
||||
|
||||
const linkIdTemplate = origDimensioni.linkIdTemplate;
|
||||
const precname = origDimensioni.name;
|
||||
|
||||
if (myfindelem) {
|
||||
@@ -261,8 +254,9 @@ 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 =
|
||||
linkIdTemplate;
|
||||
myelemtocopy.catalogo.dimensioni_def.linkIdTemplatePerStampa =
|
||||
origDimensioni.linkIdTemplatePerStampa;
|
||||
myelemtocopy.catalogo.dimensioni_def.linkIdTemplate = origDimensioni.linkIdTemplate;
|
||||
|
||||
return myelemtocopy.catalogo;
|
||||
}
|
||||
@@ -272,21 +266,26 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
},
|
||||
|
||||
sovrascriviAreadistampaFromTemplate:
|
||||
(state: IGlobalState) =>
|
||||
(idTemplate: string, optCatalogo: IOptCatalogo) => {
|
||||
const myfindelem = state.myelems.find(
|
||||
(myelem: IMyElem) => myelem._id === idTemplate
|
||||
);
|
||||
|
||||
const linkIdTemplate = optCatalogo.print_linkIdTemplate;
|
||||
(state: IGlobalState) => (idTemplate: string, optCatalogo: IOptCatalogo) => {
|
||||
const myfindelem = state.myelems.find((myelem: IMyElem) => myelem._id === idTemplate);
|
||||
|
||||
if (myfindelem) {
|
||||
const myelemtocopy = tools.jsonCopy(myfindelem);
|
||||
|
||||
if (myelemtocopy) {
|
||||
const linkIdTemplate =
|
||||
myelemtocopy.catalogo.selectedVersionStampabile === shared_consts.PREPARA_PDF.STAMPA
|
||||
? myelemtocopy.catalogo.print_linkIdTemplate
|
||||
: myelemtocopy.catalogo.print_linkIdTemplatePerStampa;
|
||||
// myelemtocopy.scheda._id = origScheda.scheda?._id;
|
||||
myelemtocopy.catalogo.print_isTemplate = false;
|
||||
myelemtocopy.catalogo.print_linkIdTemplate = linkIdTemplate;
|
||||
if (
|
||||
myelemtocopy.catalogo.selectedVersionStampabile === shared_consts.PREPARA_PDF.STAMPA
|
||||
)
|
||||
myelemtocopy.catalogo.print_linkIdTemplatePerStampa = linkIdTemplate;
|
||||
else {
|
||||
myelemtocopy.catalogo.print_linkIdTemplate = linkIdTemplate;
|
||||
}
|
||||
|
||||
return myelemtocopy.catalogo;
|
||||
}
|
||||
@@ -316,32 +315,24 @@ 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) {
|
||||
@@ -383,9 +374,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
isMyLang: (state: IGlobalState) => (rec: any) => {
|
||||
if (!rec.lang) return true;
|
||||
|
||||
return (
|
||||
rec.lang === toolsext.getLocale(false) || toolsext.getLocale() === ''
|
||||
);
|
||||
return rec.lang === toolsext.getLocale(false) || toolsext.getLocale() === '';
|
||||
},
|
||||
|
||||
getPage:
|
||||
@@ -429,9 +418,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
.sort((a: any, b: any) => a.order - b.order);
|
||||
|
||||
// Trova l'indice dell'elemento con _id = idelem
|
||||
const index = sortedElems.findIndex(
|
||||
(elem: IMyElem) => elem._id === idelem
|
||||
);
|
||||
const index = sortedElems.findIndex((elem: IMyElem) => elem._id === idelem);
|
||||
|
||||
// ritorna l'elemento precedente
|
||||
if (index > 0) {
|
||||
@@ -450,9 +437,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
.sort((a: any, b: any) => a.order - b.order);
|
||||
|
||||
// Trova l'indice dell'elemento con _id = idelem
|
||||
const index = sortedElems.findIndex(
|
||||
(elem: IMyElem) => elem._id === idelem
|
||||
);
|
||||
const index = sortedElems.findIndex((elem: IMyElem) => elem._id === idelem);
|
||||
|
||||
// ritorna l'elemento successivo
|
||||
if (index < sortedElems.length - 1) {
|
||||
@@ -518,16 +503,14 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
else if (table === toolsext.TABNEWSLETTER) ris = state.newstosent;
|
||||
else if (table === toolsext.TABGALLERY) ris = state.gallery;
|
||||
else if (table === toolsext.TABTEMPLEMAIL) ris = state.templemail;
|
||||
else if (table === toolsext.TABDESTNEWSLETTER)
|
||||
ris = state.destnewsletter;
|
||||
else if (table === toolsext.TABDESTNEWSLETTER) ris = state.destnewsletter;
|
||||
else if (table === toolsext.TABOPZEMAIL) ris = state.opzemail;
|
||||
else if (table === toolsext.TABMAILINGLIST) ris = state.mailinglist;
|
||||
else if (table === toolsext.TABMYPAGE) ris = state.mypage;
|
||||
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;
|
||||
@@ -550,8 +533,7 @@ 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 === 't_web_statiprodottos')
|
||||
ris = Products.stati_prodotto;
|
||||
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;
|
||||
else if (table === 'catais') ris = state.catAI;
|
||||
@@ -559,20 +541,15 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
else if (table === 'sharewithus') ris = state.sharewithus;
|
||||
else if (table === 'paymenttypes') ris = state.paymenttypes;
|
||||
else if (table === 'circuits') ris = circuitStore.listcircuits;
|
||||
else if (table === 'listcircuits')
|
||||
ris = circuitStore.getCircuitsLabelValue();
|
||||
else if (table === 'listaccounts')
|
||||
ris = circuitStore.getAccountsListNameValue();
|
||||
else if (table === 'listcircuits') ris = circuitStore.getCircuitsLabelValue();
|
||||
else if (table === 'listaccounts') ris = circuitStore.getAccountsListNameValue();
|
||||
else if (table === 'bookings') return calendarStore.bookedevent;
|
||||
else if (table === 'users') return userStore.usersList;
|
||||
else if (table === 'friends') return userStore.my.profile.friends;
|
||||
else if (table === 'lista_editori') {
|
||||
ris = userStore.listaEditori;
|
||||
} else if (table === 'friendsandme')
|
||||
return [
|
||||
{ username: userStore.my.username },
|
||||
...userStore.my.profile.friends,
|
||||
];
|
||||
return [{ username: userStore.my.username }, ...userStore.my.profile.friends];
|
||||
// else if (table === 'mygroups')
|
||||
// return userStore.groups
|
||||
else if (table === 'mygroups') return state.mygroups;
|
||||
@@ -590,12 +567,10 @@ 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.getSchedeOpt(state.myschedas);
|
||||
else if (table === 'schedeopt') return Products.getSchedeOpt(state.myschedas);
|
||||
else if (table === 'provinces')
|
||||
return state.provinces.filter(
|
||||
(rec: IProvince) =>
|
||||
!rec.card && rec.prov !== 'ITA' && rec.prov !== 'EST'
|
||||
(rec: IProvince) => !rec.card && rec.prov !== 'ITA' && rec.prov !== 'EST'
|
||||
);
|
||||
else if (table === 'cards') {
|
||||
const arrprov: any[] = state.provinces.filter(
|
||||
@@ -603,9 +578,10 @@ 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 [];
|
||||
@@ -625,8 +601,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
return ris;
|
||||
},
|
||||
|
||||
getCmdClick: (state: IGlobalState): string =>
|
||||
state.clickcmd ? state.clickcmd : '',
|
||||
getCmdClick: (state: IGlobalState): string => (state.clickcmd ? state.clickcmd : ''),
|
||||
|
||||
gettemplemailbyId:
|
||||
(mystate: IGlobalState) =>
|
||||
@@ -637,9 +612,7 @@ 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! : '';
|
||||
},
|
||||
},
|
||||
@@ -662,15 +635,7 @@ 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
|
||||
@@ -679,18 +644,14 @@ 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 ||
|
||||
myrec.type === costanti.FieldType.hours
|
||||
)
|
||||
myrec.value_num = value;
|
||||
else if (myrec.type === costanti.FieldType.boolean)
|
||||
myrec.value_bool = value;
|
||||
else if (myrec.type === costanti.FieldType.boolean) myrec.value_bool = value;
|
||||
else myrec.value_str = value;
|
||||
|
||||
// console.log('setValueSettingsByKey value', value, 'myrec', myrec)
|
||||
@@ -701,19 +662,12 @@ 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 '***********';
|
||||
else if (myrec.type === costanti.FieldType.crypted) return '***********';
|
||||
else if (myrec.value_str === undefined) {
|
||||
return '';
|
||||
} else {
|
||||
@@ -880,9 +834,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
}*/
|
||||
|
||||
// Sort array
|
||||
static_data.routes = static_data.routes.sort(
|
||||
(a, myb) => a.order - myb.order
|
||||
);
|
||||
static_data.routes = static_data.routes.sort((a, myb) => a.order - myb.order);
|
||||
|
||||
// console.log('static_data.routes', static_data.routes)
|
||||
|
||||
@@ -943,10 +895,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
|
||||
setleftDrawerOpen(bool: boolean) {
|
||||
this.leftDrawerOpen = bool;
|
||||
tools.localStSetItem(
|
||||
toolsext.localStorage.leftDrawerOpen,
|
||||
bool.toString()
|
||||
);
|
||||
tools.localStSetItem(toolsext.localStorage.leftDrawerOpen, bool.toString());
|
||||
},
|
||||
|
||||
setCategorySel(cat: string | null) {
|
||||
@@ -1558,18 +1507,9 @@ 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;
|
||||
})
|
||||
@@ -1922,13 +1862,7 @@ 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 = {
|
||||
@@ -1952,13 +1886,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
});
|
||||
},
|
||||
|
||||
async GetFlotte({
|
||||
ricalcola,
|
||||
showall,
|
||||
}: {
|
||||
ricalcola: boolean;
|
||||
showall: boolean;
|
||||
}) {
|
||||
async GetFlotte({ ricalcola, showall }: { ricalcola: boolean; showall: boolean }) {
|
||||
console.log('GetFlotte');
|
||||
|
||||
const mydata = {
|
||||
@@ -2016,11 +1944,7 @@ 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;
|
||||
},
|
||||
|
||||
@@ -2052,103 +1976,55 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
console.log('____________________________ res', res);
|
||||
this.serverError = false;
|
||||
if (res.status === 200) {
|
||||
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.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.wheres = res.data.wheres ? res.data.wheres : [];
|
||||
calendarStore.contribtype = res.data.contribtype
|
||||
? res.data.contribtype
|
||||
: [];
|
||||
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;
|
||||
|
||||
this.settings = res.data.settings ? [...res.data.settings] : [];
|
||||
this.disciplines = res.data.disciplines
|
||||
? [...res.data.disciplines]
|
||||
: [];
|
||||
this.paymenttypes = res.data.paymenttypes
|
||||
? [...res.data.paymenttypes]
|
||||
: [];
|
||||
this.disciplines = res.data.disciplines ? [...res.data.disciplines] : [];
|
||||
this.paymenttypes = res.data.paymenttypes ? [...res.data.paymenttypes] : [];
|
||||
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.storehouses = res.data.storehouses ? [...res.data.storehouses] : [];
|
||||
this.providers = res.data.providers ? [...res.data.providers] : [];
|
||||
|
||||
Products.catprods = res.data.catprods ? [...res.data.catprods] : [];
|
||||
Products.catprtotali = res.data.catprtotali
|
||||
? [...res.data.catprtotali]
|
||||
: [];
|
||||
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.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.subcatprods = res.data.subcatprods ? [...res.data.subcatprods] : [];
|
||||
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.authors = res.data.authors ? [...res.data.authors] : [];
|
||||
Products.publishers = res.data.publishers
|
||||
? [...res.data.publishers]
|
||||
: [];
|
||||
Products.publishers = res.data.publishers ? [...res.data.publishers] : [];
|
||||
|
||||
this.gasordines = res.data.gasordines
|
||||
? [...res.data.gasordines]
|
||||
: [];
|
||||
this.scontisticas = res.data.scontisticas
|
||||
? [...res.data.scontisticas]
|
||||
: [];
|
||||
this.gasordines = res.data.gasordines ? [...res.data.gasordines] : [];
|
||||
this.scontisticas = res.data.scontisticas ? [...res.data.scontisticas] : [];
|
||||
this.groups = res.data.groups ? [...res.data.groups] : [];
|
||||
this.resps = res.data.resps ? [...res.data.resps] : [];
|
||||
this.workers = res.data.workers ? [...res.data.workers] : [];
|
||||
this.departments = res.data.departments
|
||||
? [...res.data.departments]
|
||||
: [];
|
||||
this.categories = res.data.categories
|
||||
? [...res.data.categories]
|
||||
: [];
|
||||
this.departments = res.data.departments ? [...res.data.departments] : [];
|
||||
this.categories = res.data.categories ? [...res.data.categories] : [];
|
||||
this.levels = res.data.levels ? [...res.data.levels] : [];
|
||||
this.skills = res.data.skills ? [...res.data.skills] : [];
|
||||
this.goods = res.data.goods ? [...res.data.goods] : [];
|
||||
// this.subSkills = (res.data.subSkills) ? [...res.data.subSkills] : []
|
||||
this.statusSkills = res.data.statusSkills
|
||||
? [...res.data.statusSkills]
|
||||
: [];
|
||||
this.statusSkills = res.data.statusSkills ? [...res.data.statusSkills] : [];
|
||||
this.sectors = res.data.sectors ? [...res.data.sectors] : [];
|
||||
this.sectorgoods = res.data.sectorgoods
|
||||
? [...res.data.sectorgoods]
|
||||
: [];
|
||||
this.sectorgoods = res.data.sectorgoods ? [...res.data.sectorgoods] : [];
|
||||
this.provinces = res.data.provinces ? [...res.data.provinces] : [];
|
||||
this.catgrps = res.data.catgrps ? [...res.data.catgrps] : [];
|
||||
this.catAI = res.data.catAI ? [...res.data.catAI] : [];
|
||||
@@ -2156,14 +2032,11 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
this.site = res.data.site ? res.data.site : {};
|
||||
this.mygroups = res.data.mygroups ? [...res.data.mygroups] : [];
|
||||
this.adtypes = res.data.adtypes ? [...res.data.adtypes] : [];
|
||||
this.adtypegoods = res.data.adtypegoods
|
||||
? [...res.data.adtypegoods]
|
||||
: [];
|
||||
this.adtypegoods = res.data.adtypegoods ? [...res.data.adtypegoods] : [];
|
||||
|
||||
// console.log('res.data.cart', res.data.cart)
|
||||
|
||||
if (res.data.cart)
|
||||
Products.cart = res.data.cart ? { ...res.data.cart } : {};
|
||||
if (res.data.cart) Products.cart = res.data.cart ? { ...res.data.cart } : {};
|
||||
else
|
||||
Products.cart = {
|
||||
items: [],
|
||||
@@ -2175,12 +2048,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
Products.orders = res.data.orders ? [...res.data.orders] : [];
|
||||
|
||||
if (showall) {
|
||||
this.newstosent = res.data.newstosent
|
||||
? [...res.data.newstosent]
|
||||
: [];
|
||||
this.mailinglist = res.data.mailinglist
|
||||
? [...res.data.mailinglist]
|
||||
: [];
|
||||
this.newstosent = res.data.newstosent ? [...res.data.newstosent] : [];
|
||||
this.mailinglist = res.data.mailinglist ? [...res.data.mailinglist] : [];
|
||||
}
|
||||
this.mypage = res.data.mypage ? [...res.data.mypage] : [];
|
||||
for (const page of this.mypage) {
|
||||
@@ -2245,10 +2114,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
if (error.status === toolsext.ERR_RETRY_LOGIN) {
|
||||
} else {
|
||||
if (
|
||||
error.status ===
|
||||
serv_constants.RIS_CODE__HTTP_FORBIDDEN_TOKEN_EXPIRED ||
|
||||
error.status ===
|
||||
serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN
|
||||
error.status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_TOKEN_EXPIRED ||
|
||||
error.status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN
|
||||
) {
|
||||
} else {
|
||||
this.serverError = true;
|
||||
@@ -2304,8 +2171,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
const key = fieldsTable.getKeyByTable(col.jointable);
|
||||
const myres: any = [];
|
||||
mylist.forEach((myrec: any) => {
|
||||
if (tools.isBitActive(val, myrec[key]))
|
||||
myres.push(mythis.t(myrec.label));
|
||||
if (tools.isBitActive(val, myrec[key])) myres.push(mythis.t(myrec.label));
|
||||
});
|
||||
|
||||
return myres;
|
||||
@@ -2333,9 +2199,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
let risultato = '';
|
||||
|
||||
if (tools.isObject(collab)) {
|
||||
risultato = mylist
|
||||
.filter((myrec: any) => myrec.username === val)
|
||||
.map(collab);
|
||||
risultato = mylist.filter((myrec: any) => myrec.username === val).map(collab);
|
||||
} else {
|
||||
const myris = mylist.find((myrec: any) => myrec[key] === val);
|
||||
if (myris) risultato = myris[collab];
|
||||
@@ -2365,9 +2229,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
// console.table(mylist)
|
||||
// console.log('key=', key, 'collab', collab, 'val', collab)
|
||||
|
||||
const myris = mylist.filter((myrec: any) =>
|
||||
arrval.includes(myrec[key])
|
||||
);
|
||||
const myris = mylist.filter((myrec: any) => arrval.includes(myrec[key]));
|
||||
// console.log('myris', myris)
|
||||
if (myris) {
|
||||
console.log('collab', collab);
|
||||
@@ -2514,44 +2376,35 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
shared_consts.Accepted.CHECK_SEE_VIDEO_PRINCIPI,
|
||||
];
|
||||
else if (table === 'fieldstype') myarr = costanti.FieldTypeArr;
|
||||
else if (table === 'metodo_pagamento')
|
||||
myarr = tools.SelectMetodiPagamento;
|
||||
else if (table === 'metodo_pagamento') myarr = tools.SelectMetodiPagamento;
|
||||
else if (table === 'confsite_opt') myarr = tools.ConfSiteOpt;
|
||||
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;
|
||||
else if (table === 'elemtypes') myarr = shared_consts.TypesElem;
|
||||
else if (table === 'fonts_installed')
|
||||
myarr = shared_consts.FontsInstalled;
|
||||
else if (table === 'fonts_installed') myarr = shared_consts.FontsInstalled;
|
||||
else if (table === 'lang') myarr = shared_consts.Lang;
|
||||
else if (table === 'regions') myarr = shared_consts.Regions;
|
||||
else if (table === 'shippings') myarr = shared_consts.Shippings;
|
||||
else if (table === 'otherfilters') myarr = shared_consts.OtherFilters;
|
||||
else if (table === toolsext.TABCALDATE) myarr = this.getArrDateEvent();
|
||||
else if (table === toolsext.TABCALALLDATE)
|
||||
myarr = this.getArrAllDateEvent();
|
||||
else if (table === toolsext.TABCALALLDATE) myarr = this.getArrAllDateEvent();
|
||||
else if (table === toolsext.TABTYPEHOSP) myarr = shared_consts.TypeHosps;
|
||||
else if (table === 'tipodest') myarr = shared_consts.DESTNEWSLETTER_ARRAY;
|
||||
else if (table === 'versions') myarr = shared_consts.VERSIONI_PRODOTTO;
|
||||
else if (table === toolsext.TABPEOPLE) myarr = shared_consts.People;
|
||||
else if (table === toolsext.TABTYPEACCOM) myarr = shared_consts.TypeAccom;
|
||||
else if (table === toolsext.TABLOCACCOM)
|
||||
myarr = shared_consts.LocationAccom;
|
||||
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.TABTYPECASH)
|
||||
myarr = shared_consts.TypeCashStr;
|
||||
else if (table === 'usernotifs')
|
||||
myarr = shared_consts.UsersNotif_Adv_List;
|
||||
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;
|
||||
else if (table === toolsext.TABTIPODIATTIVITA)
|
||||
myarr = shared_consts.TipoDiAttivita;
|
||||
else if (table === toolsext.TABTIPODIATTIVITA) myarr = shared_consts.TipoDiAttivita;
|
||||
else myarr = this.getListByTable(table, value2);
|
||||
|
||||
if (costanti.TABLES_ARRAY.includes(table)) {
|
||||
@@ -2634,12 +2487,7 @@ 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);
|
||||
@@ -2684,22 +2532,20 @@ 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) {
|
||||
@@ -2779,12 +2625,14 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
dimensioni_def: {
|
||||
isTemplate: false,
|
||||
linkIdTemplate: '',
|
||||
linkIdTemplatePerStampa: '',
|
||||
name: '',
|
||||
pagina: tools.resetRecIDimensioni(null),
|
||||
},
|
||||
areadistampa: tools.resetRecIAreaDiStampa(null),
|
||||
print_isTemplate: false,
|
||||
print_linkIdTemplate: '',
|
||||
print_linkIdTemplatePerStampa: '',
|
||||
};
|
||||
},
|
||||
createRaccoltaCataloghiVuoto(): IOptCatalogo {
|
||||
@@ -2799,22 +2647,18 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
dimensioni_def: {
|
||||
isTemplate: false,
|
||||
linkIdTemplate: '',
|
||||
linkIdTemplatePerStampa: '',
|
||||
name: '',
|
||||
pagina: tools.resetRecIDimensioni(null),
|
||||
},
|
||||
areadistampa: tools.resetRecIAreaDiStampa(null),
|
||||
print_isTemplate: false,
|
||||
print_linkIdTemplate: '',
|
||||
print_linkIdTemplatePerStampa: '',
|
||||
};
|
||||
},
|
||||
|
||||
async prepareAddNewElem(
|
||||
order: any,
|
||||
$q: any,
|
||||
t: any,
|
||||
myelem: any,
|
||||
newtype: any
|
||||
) {
|
||||
async prepareAddNewElem(order: any, $q: any, t: any, myelem: any, newtype: any) {
|
||||
const newrec: IMyElem = {
|
||||
_id: undefined,
|
||||
type: newtype,
|
||||
@@ -2863,10 +2707,10 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
});
|
||||
},
|
||||
|
||||
async execConvertPDF(paramquery: any) {
|
||||
async execConvertPDF(paramquery: any, blob = false) {
|
||||
// console.log('paramquery', paramquery)
|
||||
let responseopt = {};
|
||||
if (paramquery.blob) {
|
||||
if (blob) {
|
||||
responseopt.responseType = 'blob';
|
||||
}
|
||||
return Api.SendReq(
|
||||
@@ -2908,14 +2752,15 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
|
||||
async convertPdf(
|
||||
pdfFile: any,
|
||||
salvasufiledascaricare,
|
||||
width: string,
|
||||
height: string,
|
||||
compressione: string,
|
||||
stampa: boolean,
|
||||
dir_out: string = '',
|
||||
file_out: string = '',
|
||||
print: boolean = false,
|
||||
optcatalogo: IOptCatalogo | null = null,
|
||||
salvasufiledascaricare
|
||||
) {
|
||||
try {
|
||||
if (!pdfFile) {
|
||||
@@ -2923,8 +2768,7 @@ 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) {
|
||||
@@ -2934,22 +2778,21 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
formData.append('height', height); // Dimensione del PDF in cm
|
||||
formData.append('compressione', compressione);
|
||||
formData.append('dir_out', dir_out);
|
||||
formData.append('stampa', stampa ? '1' : '0');
|
||||
formData.append('file_out', file_out);
|
||||
formData.append('idapp', tools.getEnv('VITE_APP_ID'));
|
||||
if (print && optcatalogo) {
|
||||
formData.append('print_left', optcatalogo.areadistampa.margini.left); // 15, 0.59"
|
||||
formData.append('print_top', optcatalogo.areadistampa.margini.top);
|
||||
formData.append(
|
||||
'print_right',
|
||||
optcatalogo.areadistampa.margini.right
|
||||
);
|
||||
formData.append(
|
||||
'print_bottom',
|
||||
optcatalogo.areadistampa.margini.bottom
|
||||
); // 7 mm 0,275"
|
||||
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');
|
||||
|
||||
const response = await this.execConvertPDF(formData);
|
||||
|
||||
console.log('2) Invia le immagini al convertitore/compressione di PDF...');
|
||||
|
||||
const response = await this.execConvertPDF(formData, salvasufiledascaricare);
|
||||
|
||||
if (response) {
|
||||
if (salvasufiledascaricare) {
|
||||
@@ -2966,6 +2809,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
} else {
|
||||
return response;
|
||||
}
|
||||
|
||||
console.log('3) Generazione PDF completata !', response);
|
||||
} else {
|
||||
console.error('No data returned from the server.');
|
||||
}
|
||||
@@ -3037,20 +2882,14 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
return arrrec;
|
||||
},
|
||||
|
||||
async getGM_FieldOf_T_Web_Articoli(
|
||||
sku: string,
|
||||
field: string,
|
||||
cmd: number
|
||||
) {
|
||||
async getGM_FieldOf_T_Web_Articoli(sku: string, field: string, cmd: number) {
|
||||
const options: IOptQueryGM = {
|
||||
nameTable: 'T_Web_Articoli',
|
||||
campispeciali: !field,
|
||||
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,
|
||||
@@ -3086,11 +2925,7 @@ 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) {
|
||||
@@ -3112,10 +2947,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
// Restituiamo il risultato dell'operazione
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
"Errore durante l'aggiornamento dei campi:",
|
||||
error.message
|
||||
);
|
||||
console.error("Errore durante l'aggiornamento dei campi:", error.message);
|
||||
throw new Error(
|
||||
`Errore durante l'aggiornamento dei campi per lo SKU ${sku}: ${error.message}`
|
||||
);
|
||||
@@ -3151,13 +2983,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
if (table === 'products') {
|
||||
await productStore.loadProductById(id, true);
|
||||
} else if (table === 'productinfos') {
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(
|
||||
"Errore durante l'aggiornamento della tabella in memoria:",
|
||||
error
|
||||
);
|
||||
console.error("Errore durante l'aggiornamento della tabella in memoria:", error);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -3235,9 +3063,7 @@ 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à
|
||||
|
||||
Reference in New Issue
Block a user