diff --git a/.prettierrc b/.prettierrc
index 258a7233..9786113d 100644
--- a/.prettierrc
+++ b/.prettierrc
@@ -1,6 +1,6 @@
{
"singleAttributePerLine": true,
- "printWidth": 100,
+ "printWidth": 90,
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
diff --git a/src/App.vue b/src/App.vue
index b49e6b0f..68de55f7 100755
--- a/src/App.vue
+++ b/src/App.vue
@@ -29,7 +29,7 @@
-
+
diff --git a/src/components/CCatalogo/CCatalogo.vue b/src/components/CCatalogo/CCatalogo.vue
index d815b243..aa5d8d43 100755
--- a/src/components/CCatalogo/CCatalogo.vue
+++ b/src/components/CCatalogo/CCatalogo.vue
@@ -1,9 +1,7 @@
-
-
+
-
-
+
+
diff --git a/src/components/CMySlideNumber/CMySlideNumber.scss b/src/components/CMySlideNumber/CMySlideNumber.scss
new file mode 100755
index 00000000..e69de29b
diff --git a/src/components/CMySlideNumber/CMySlideNumber.ts b/src/components/CMySlideNumber/CMySlideNumber.ts
new file mode 100755
index 00000000..f02a727b
--- /dev/null
+++ b/src/components/CMySlideNumber/CMySlideNumber.ts
@@ -0,0 +1,76 @@
+import type { PropType } from 'vue';
+import { defineComponent, ref, computed, toRef, reactive, watch, onMounted } from 'vue';
+import type { ISize } from 'model';
+import { IOperators } from 'model';
+
+import { useI18n } from 'vue-i18n';
+import { useQuasar } from 'quasar';
+
+import { tools } from '@tools';
+
+import { CMySlider } from '@src/components/CMySlider';
+
+import { shared_consts } from '@src/common/shared_vuejs';
+
+export default defineComponent({
+ name: 'CMySlideNumber',
+ emits: ['update:modelValue'],
+ components: { CMySlider },
+ props: {
+ modelValue: {
+ type: Number,
+ required: true,
+ default: 0,
+ },
+ label: {
+ type: String,
+ required: true,
+ },
+ min: {
+ type: Number,
+ required: false,
+ default: 0,
+ },
+ max: {
+ type: Number,
+ required: false,
+ default: 100,
+ },
+ disable: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
+ addstr: {
+ type: Boolean,
+ required: false,
+ default: true,
+ },
+ },
+ setup(props, { emit }) {
+ const $q = useQuasar();
+ const { t } = useI18n();
+ const internalModel = reactive({ value: props.modelValue ?? 0 });
+
+ function modifValue(value: number) {
+ emit('update:modelValue', value);
+ }
+
+ // Sincronizzare i cambiamenti esterni con internalModel quando props cambiano
+ watch(
+ () => props.modelValue,
+ (newModel: number) => {
+ internalModel.value = newModel;
+ },
+ { immediate: true }
+ );
+
+ return {
+ t,
+ shared_consts,
+ modifValue,
+ internalModel,
+ tools,
+ };
+ },
+});
diff --git a/src/components/CMySlideNumber/CMySlideNumber.vue b/src/components/CMySlideNumber/CMySlideNumber.vue
new file mode 100755
index 00000000..c6da55e3
--- /dev/null
+++ b/src/components/CMySlideNumber/CMySlideNumber.vue
@@ -0,0 +1,32 @@
+
+
+
+ {{ label }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/CMySlideNumber/index.ts b/src/components/CMySlideNumber/index.ts
new file mode 100755
index 00000000..ac0d3be8
--- /dev/null
+++ b/src/components/CMySlideNumber/index.ts
@@ -0,0 +1 @@
+export {default as CMySlideNumber} from './CMySlideNumber.vue'
diff --git a/src/components/CText/CText.vue b/src/components/CText/CText.vue
index 1522d93a..295bf651 100755
--- a/src/components/CText/CText.vue
+++ b/src/components/CText/CText.vue
@@ -9,7 +9,8 @@
width: rectext.font?.perc_text ?? '50%',
...( rectext.size && rectext.size.height ? { height: tools.adjustSize(optcatalogo, rectext.size.height) } : {}),
marginTop: '0',
- '--scalecatalog': tools.getScale(optcatalogo),
+ '--scalecatalogx': tools.getScaleX(optcatalogo, scheda),
+ '--scalecatalogy': tools.getScaleY(optcatalogo, scheda),
'line-height': rectext.font?.line_height,
}"
>
@@ -25,11 +26,12 @@
:class="{ 'flex-details_and_barcode' : show_at_right }"
:style="{
width: rectext.font?.perc_text ?? '50%',
- ...( rectext.size && rectext.size.height ? { height: tools.adjustSize(optcatalogo, rectext.size.height) } : {}),
+ ...( rectext.size && rectext.size.height ? { height: tools.adjustSize(optcatalogo, rectext.size.height, scheda, false) } : {}),
marginTop: '0rem',
- '--scalecatalog': tools.getScale(optcatalogo),
+ '--scalecatalogx': tools.getScaleX(optcatalogo, scheda),
+ '--scalecatalogy': tools.getScaleY(optcatalogo, scheda),
'line-height': rectext.font?.line_height,
- 'gap': show_at_right && scheda.barcode.size?.gap ? tools.adjustSize(optcatalogo, scheda.barcode.size?.gap) : ''
+ 'gap': show_at_right && scheda.barcode.size?.gap ? tools.adjustSize(optcatalogo, scheda.barcode.size?.gap, scheda, false) : ''
}"
>
diff --git a/src/components/MyHeader/MyHeader.ts b/src/components/MyHeader/MyHeader.ts
index f353c362..d27abc3d 100755
--- a/src/components/MyHeader/MyHeader.ts
+++ b/src/components/MyHeader/MyHeader.ts
@@ -581,6 +581,7 @@ export default defineComponent({
tools.setCookie('menu3oriz', globalStore.leftDrawerOpen ? '1' : '0');
}
+
onBeforeMount(BeforeMount);
onMounted(mounted);
diff --git a/src/components/MyHeader/MyHeader.vue b/src/components/MyHeader/MyHeader.vue
index 7e46d7ac..8b2a91b8 100755
--- a/src/components/MyHeader/MyHeader.vue
+++ b/src/components/MyHeader/MyHeader.vue
@@ -1,5 +1,5 @@
-
+
@@ -228,7 +228,7 @@
-
+
diff --git a/src/model/GlobalStore.ts b/src/model/GlobalStore.ts
index 2cc07545..fd00723e 100755
--- a/src/model/GlobalStore.ts
+++ b/src/model/GlobalStore.ts
@@ -246,6 +246,7 @@ export interface IMyPage {
showFooter?: boolean
mainMenu?: boolean
sottoMenu?: string[]
+ hideHeader?: boolean
//Memory
loaded?: boolean
@@ -476,6 +477,7 @@ export interface ISelector {
}
export interface IGlobalState {
finishLoading: boolean
+ showHeader?: boolean
conta: number
wasAlreadySubOnDb: boolean
wasAlreadySubscribed: boolean
@@ -786,15 +788,18 @@ export interface IAreaDiStampa {
format?: number[]
orientation?: string
compress?: boolean
- scale?: number
- scale_printable?: number
+ scalex?: number
+ scaley?: number
+ scale_printablex?: number
+ scale_printabley?: number
scalecanvas?: number
}
export interface IElementiPagina {
isTemplate?: boolean,
linkIdTemplate?: string,
- linkIdTemplatePerStampa?: string,
+ scalexscheda?: number
+ scaleyscheda?: number
name?: string,
pagina: IDimensioni
}
@@ -819,7 +824,6 @@ export interface IMyScheda {
isTemplate?: boolean,
isPagIntro?: boolean,
linkIdTemplate?: string,
- linkIdTemplatePerStampa?: string,
name?: string,
numschede_perRiga?: number
numschede_perCol?: number
@@ -881,6 +885,7 @@ export interface IOptRigenera {
export interface IOptCatalogo {
//++AddCATALOGO_FIELDS
+ idCatalogSel?: string
productTypes?: number[]
excludeproductTypes?: number[]
formato?: string[]
@@ -899,6 +904,7 @@ export interface IOptCatalogo {
maxnumlibri?: number
showListaArgomenti?: boolean
showListaCollane?: boolean
+ showOnlyCatalogoPDF?: boolean
generazionePDFInCorso?: boolean
first_page?: IDimensioni
@@ -907,7 +913,6 @@ export interface IOptCatalogo {
print_isTemplate?: boolean
print_linkIdTemplate?: string
- print_linkIdTemplatePerStampa?: string
dimensioni_def?: IElementiPagina
diff --git a/src/rootgen/admin/convertPDF/convertPDF.ts b/src/rootgen/admin/convertPDF/convertPDF.ts
index 720b948b..904ddee8 100755
--- a/src/rootgen/admin/convertPDF/convertPDF.ts
+++ b/src/rootgen/admin/convertPDF/convertPDF.ts
@@ -48,7 +48,7 @@ export default defineComponent({
const pdfFile = ref(
null);
- const compressione = ref('prepress')
+ const compressione = ref('printer')
const ListaCmd = ref(
[
@@ -76,10 +76,6 @@ export default defineComponent({
label: '[Printer - Ottimizza il PDF per la stampa di qualità; migliora la risoluzione rispetto a /ebook.]',
value: 'printer',
},
- {
- label: '[Prepress - Ottimizza per la stampa di alta qualità; ideale per progetti di stampa professionali.]',
- value: 'prepress',
- },
{
label: '[Default - Usa impostazioni predefinite; generalmente fornisce un buon equilibrio tra qualità e dimensione]',
value: 'default',
diff --git a/src/store/CatalogStore.ts b/src/store/CatalogStore.ts
index 60b18e77..f065e9d8 100755
--- a/src/store/CatalogStore.ts
+++ b/src/store/CatalogStore.ts
@@ -29,6 +29,12 @@ export const useCatalogStore = defineStore('CatalogStore', {
getCatalogById: (state) => (id: string): ICatalog => {
return state.catalogs.find((cat: ICatalog) => cat._id === id) || null;
},
+
+ getCatalogsList: (state) => (): {label: string, value: string}[] => {
+ return state.catalogs.map((cat: ICatalog) => {
+ return {label: cat.title, value: cat._id};
+ });
+ },
getCatalogByIdPageAssigned: (state) => (idPage: string): ICatalog => {
return state.catalogs.find((cat: ICatalog) => cat.idPageAssigned === idPage) || null;
},
diff --git a/src/store/Modules/fieldsTable.ts b/src/store/Modules/fieldsTable.ts
index c46ca252..099415d9 100755
--- a/src/store/Modules/fieldsTable.ts
+++ b/src/store/Modules/fieldsTable.ts
@@ -366,7 +366,6 @@ export const colmyScheda = [
AddCol({ name: 'isTemplate', label_trans: 'scheda.isTemplate', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'isPagIntro', label_trans: 'scheda.isPagIntro', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'linkIdTemplate', label_trans: 'scheda.linkIdTemplate', fieldtype: costanti.FieldType.string }),
- AddCol({ name: 'linkIdTemplatePerStampa', label_trans: 'scheda.linkIdTemplatePerStampa', fieldtype: costanti.FieldType.string }),
AddCol({ name: 'widthscheda', label_trans: 'scheda.widthscheda', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'widthpag', label_trans: 'scheda.widthpag', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'widthimg', label_trans: 'scheda.widthimg', fieldtype: costanti.FieldType.number }),
@@ -581,6 +580,7 @@ export const colmypage = [
AddCol({ name: 'internalpage', label_trans: 'pages.internalpage', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'loadFirst', label_trans: 'pages.loadFirst', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'showFooter', label_trans: 'pages.showFooter', fieldtype: costanti.FieldType.boolean }),
+ AddCol({ name: 'hideHeader', label_trans: 'pages.hideHeader', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'iconsize', label_trans: 'pages.iconsize', fieldtype: costanti.FieldType.string }),
AddCol({ name: 'extraclass', label_trans: 'pages.extraclass', fieldtype: costanti.FieldType.string }),
AddCol(DeleteRec),
diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts
index 5079bcb4..03885987 100644
--- a/src/store/Modules/tools.ts
+++ b/src/store/Modules/tools.ts
@@ -410,7 +410,8 @@ export const tools = {
SelectListFormatPDF: [
{ label: 'a4 (210x297) (mm) 793x1121 px', value: [210, 297] },
- { label: 'STAMPA con Bordi: 22.53 x 31.25 96 DPI (in mm) 852x1181 px', value: [225.3, 312.5] },
+ { label: 'STAMPA con Bordi: 22.53 x 31.26 96 DPI (in mm) 852x1181 px', value: [225.3, 312.6] },
+ { label: 'STAMPA MODIF: 22.533 x 31.23 96 DPI (in mm) 852x1181 px', value: [225.33, 312.23] },
],
SelectListScalePDF: [
@@ -10112,7 +10113,8 @@ export const tools = {
compress: false,
orientation: 'portrait',
format: [210, 297],
- scale: 1,
+ scalex: 1,
+ scaley: 1,
scalecanvas: 2,
};
} else {
@@ -10124,7 +10126,64 @@ export const tools = {
return myrec;
},
- adjustSize(optcatalogo: IOptCatalogo, mysize: any, add: number = 0) {
+ getScaleX(optcatalogo: IOptCatalogo, scheda?: ISchedaSingola, options?: any): number | undefined {
+ let scalex = 1;
+ if (
+ optcatalogo.printable &&
+ optcatalogo.generazionePDFInCorso &&
+ optcatalogo.selectedVersionStampabile === shared_consts.PREPARA_PDF.STAMPA
+ ) {
+ scalex = optcatalogo.areadistampa?.scale_printablex || 1;
+
+ let scaledifftrawebeStampax =
+ optcatalogo.areadistampa.format[0] / optcatalogo.areadistampa.format_printable[0];
+
+ if (!options?.parteesternafissa) scalex *= 1;
+ else scalex *= 1 / scaledifftrawebeStampax;
+ } else {
+ scalex = optcatalogo.areadistampa!.scalex || 1;
+ }
+
+ if (scheda) {
+ scalex *= scheda.scalex || 1;
+ }
+
+ return scalex;
+ },
+
+ getScaleY(optcatalogo: IOptCatalogo, scheda?: ISchedaSingola, options?: any): number | undefined {
+ let scaley = 1;
+ if (
+ optcatalogo.printable &&
+ optcatalogo.generazionePDFInCorso &&
+ optcatalogo.selectedVersionStampabile === shared_consts.PREPARA_PDF.STAMPA
+ ) {
+ scaley = optcatalogo.areadistampa?.scale_printabley || 1;
+
+ let scaledifftrawebeStampay =
+ optcatalogo.areadistampa.format[1] / optcatalogo.areadistampa.format_printable[1];
+
+ if (!options?.parteesternafissa) scaley *= 1;
+ else scaley *= 1 / scaledifftrawebeStampay;
+ } else {
+ scaley = optcatalogo.areadistampa!.scaley || 1;
+ }
+
+ if (scheda) {
+ scaley *= scheda?.scaley || 1;
+ }
+
+ return scaley;
+ },
+
+ adjustSize(
+ optcatalogo: IOptCatalogo,
+ mysize: any,
+ scheda: ISchedaSingola,
+ isX: boolean,
+ options: any,
+ add: number = 0
+ ) {
if (!mysize) {
return '';
}
@@ -10140,12 +10199,43 @@ export const tools = {
size += add;
}
+ let myscale = 1;
+
+ if (isX) myscale = this.getScaleX(optcatalogo, scheda, options);
+ else myscale = this.getScaleY(optcatalogo, scheda, options);
+
+ // Applica lo scale della Scheda
+ size = size * myscale;
+
if (
optcatalogo.printable &&
- optcatalogo.areadistampa?.scale &&
- optcatalogo.areadistampa?.scale > 0
+ optcatalogo.generazionePDFInCorso &&
+ optcatalogo.selectedVersionStampabile === shared_consts.PREPARA_PDF.STAMPA
) {
- size = size * optcatalogo.areadistampa?.scale; // Applicare la scala se necessaria
+ let scaledifftrawebeStampax =
+ optcatalogo.areadistampa.format[0] / optcatalogo.areadistampa.format_printable[0];
+ let scaledifftrawebeStampay =
+ optcatalogo.areadistampa.format[1] / optcatalogo.areadistampa.format_printable[1];
+
+
+ const myPaddingPag = optcatalogo.dimensioni_def.pagina.size;
+ const numwidth = parseFloat(myPaddingPag.width) || 0;
+ const numheight = parseFloat(myPaddingPag.height) || 0;
+ const margineX = (((numwidth) * (1/scaledifftrawebeStampax)) - numwidth) / 2;
+ const marginey = (((numheight) * (1/scaledifftrawebeStampay)) - numheight) / 2;
+
+ if (options?.paddingLeft) {
+ size += marginex;
+ }
+ if (options?.paddingRight) {
+ size -= marginex;
+ }
+ if (options?.paddingTop) {
+ size += marginey;
+ }
+ if (options?.paddingBottom) {
+ size -= marginey;
+ }
}
const strfinale = `${size}${unit}`;
@@ -10222,12 +10312,6 @@ export const tools = {
return jsonResult;
},
- getScale(optcatalogo: IOptCatalogo, instampa: boolean = false): number | undefined {
- if ((optcatalogo.printable && optcatalogo.generazionePDFInCorso) || instampa)
- return optcatalogo.areadistampa?.scale_printable;
- else return optcatalogo.areadistampa!.scale;
- },
-
getMainLink(url: string): string {
try {
// Se l'URL non ha un protocollo, aggiunge "https://"
@@ -10591,7 +10675,7 @@ export const tools = {
getFileCompresso(filename: string) {
return this.removeFileExtension(filename) + `_compressed.pdf`;
- }
+ },
// FINE !
diff --git a/src/store/Products.ts b/src/store/Products.ts
index 232e5a16..17811dec 100755
--- a/src/store/Products.ts
+++ b/src/store/Products.ts
@@ -1890,7 +1890,8 @@ export const useProducts = defineStore('Products', {
'{formato}',
'{tipologia}',
'{stato}',
- '{scale}',
+ '{scalex}',
+ '{scaley}',
'{descr_trafiletto_catalogo}',
'{link_macro}',
'{qta}',
@@ -1973,8 +1974,11 @@ export const useProducts = defineStore('Products', {
myproduct.productInfo?.idStatoProdotto || ''
)
break
- case '{scale}':
- replacements[key] = optcatalogo.printable ? optcatalogo.areadistampa?.scale : '1'
+ case '{scalex}':
+ replacements[key] = optcatalogo.printable ? optcatalogo.areadistampa?.scalex : '1'
+ break
+ case '{scaley}':
+ replacements[key] = optcatalogo.printable ? optcatalogo.areadistampa?.scaley : '1'
break
case '{link_macro}':
replacements[key] = myproduct.productInfo.link_macro || ''
@@ -2362,10 +2366,7 @@ export const useProducts = defineStore('Products', {
if (optcatalogo) {
try {
// LINK PAGINA
- let idLinkTempl =
- optcatalogo.selectedVersionStampabile === shared_consts.PREPARA_PDF.STAMPA
- ? optcatalogo.dimensioni_def.linkIdTemplatePerStampa
- : optcatalogo.dimensioni_def.linkIdTemplate
+ let idLinkTempl =optcatalogo.dimensioni_def.linkIdTemplate
if (idLinkTempl) {
const reccatalog = globalStore.sovrascriviPaginaDefaultFromTemplate(
idLinkTempl,
@@ -2378,10 +2379,7 @@ export const useProducts = defineStore('Products', {
}
}
- let idLinkPr =
- optcatalogo.selectedVersionStampabile === shared_consts.PREPARA_PDF.STAMPA
- ? optcatalogo.print_linkIdTemplatePerStampa
- : optcatalogo.print_linkIdTemplate
+ let idLinkPr = optcatalogo.print_linkIdTemplate
if (idLinkPr) {
const reccat2 = globalStore.sovrascriviAreadistampaFromTemplate(idLinkPr, optcatalogo)
@@ -2390,10 +2388,13 @@ export const useProducts = defineStore('Products', {
// optcatalogo2.areadistampa = { ...reccat2.areadistampa};
optcatalogo2.areadistampa.margini = reccat2.areadistampa.margini
optcatalogo2.areadistampa.unit = reccat2.areadistampa.unit
- optcatalogo2.areadistampa.scale = reccat2.areadistampa.scale
+ optcatalogo2.areadistampa.scalex = reccat2.areadistampa.scalex
+ optcatalogo2.areadistampa.scaley = reccat2.areadistampa.scaley
optcatalogo2.areadistampa.scalecanvas = reccat2.areadistampa.scalecanvas
- optcatalogo2.areadistampa.scale_printable = reccat2.areadistampa.scale_printable
+ optcatalogo2.areadistampa.scale_printablex = reccat2.areadistampa.scale_printablex
+ optcatalogo2.areadistampa.scale_printabley = reccat2.areadistampa.scale_printabley
optcatalogo2.areadistampa.format = reccat2.areadistampa.format
+ optcatalogo2.areadistampa.format_printable = reccat2.areadistampa.format_printable
optcatalogo2.areadistampa.orientation = reccat2.areadistampa.orientation
optcatalogo2.areadistampa.compress = reccat2.areadistampa.compress
@@ -2404,11 +2405,7 @@ export const useProducts = defineStore('Products', {
}
for (const recscheda of optcatalogo.arrSchede!) {
- let idtempl =
- optcatalogo.selectedVersionStampabile === shared_consts.PREPARA_PDF.STAMPA &&
- recscheda.scheda?.linkIdTemplatePerStampa
- ? recscheda.scheda?.linkIdTemplatePerStampa
- : recscheda.scheda?.linkIdTemplate
+ let idtempl =recscheda.scheda?.linkIdTemplate
if (idtempl) {
// ricopia da Template:
let myscheda = globalStore.sovrascriviSchedaFromTemplate(
diff --git a/src/store/UserStore.ts b/src/store/UserStore.ts
index 05dc8a1b..ff80cb84 100755
--- a/src/store/UserStore.ts
+++ b/src/store/UserStore.ts
@@ -1,4 +1,4 @@
-import { defineStore } from 'pinia'
+import { defineStore } from 'pinia';
import type {
ICircuit,
@@ -14,48 +14,51 @@ import type {
IColGridTable,
ISignupIscrizioneConacreisOptions,
ISignupIscrizioneArcadeiOptions,
- IMovQuery
+ IMovQuery,
} from '@src/model';
-import {
- IFriends,
- ISettings
-} from '@src/model'
-import { tools } from '@tools'
-import translate from '@src/globalroutines/util'
+import { IFriends, ISettings } from '@src/model';
+import { tools } from '@tools';
+import translate from '@src/globalroutines/util';
import type { ILinkReg, IToken } from '@model/other';
-import { ICallResult, IResult } from '@model/other'
+import { ICallResult, IResult } from '@model/other';
-import objectId from '@src/js/objectId'
+import objectId from '@src/js/objectId';
-import type * as Types from '@src/store/Api/ApiTypes'
-import { useGlobalStore } from '@store/globalStore'
-import { serv_constants } from '@store/Modules/serv_constants'
-import { Api } from '@api'
-import { toolsext } from '@store/Modules/toolsext'
-import { static_data } from '@src/db/static_data'
+import type * as Types from '@src/store/Api/ApiTypes';
+import { useGlobalStore } from '@store/globalStore';
+import { serv_constants } from '@store/Modules/serv_constants';
+import { Api } from '@api';
+import { toolsext } from '@store/Modules/toolsext';
+import { static_data } from '@src/db/static_data';
+import bcrypt from 'bcryptjs';
-import bcrypt from 'bcryptjs'
-
-import { useTodoStore } from '@store/Todos'
-import type { Router } from 'vue-router'
-import { useProjectStore } from '@store/Projects'
-import { shared_consts } from '@src/common/shared_vuejs'
-import { costanti } from '@costanti'
+import { useTodoStore } from '@store/Todos';
+import type { Router } from 'vue-router';
+import { useProjectStore } from '@store/Projects';
+import { shared_consts } from '@src/common/shared_vuejs';
+import { costanti } from '@costanti';
import type { IReaction, IGroupShort, IMyGroup } from '@model/UserStore';
-import { IBookmark, ISeen, IFavBook, IAttend, IFavorite, IUserAdmins, IUserShort } from '@model/UserStore'
+import {
+ IBookmark,
+ ISeen,
+ IFavBook,
+ IAttend,
+ IFavorite,
+ IUserAdmins,
+ IUserShort,
+} from '@model/UserStore';
-import globalroutines from '../globalroutines/index'
-import { useNotifStore } from '@store/NotifStore'
-import { useCircuitStore } from './CircuitStore'
+import globalroutines from '../globalroutines/index';
+import { useNotifStore } from '@store/NotifStore';
+import { useCircuitStore } from './CircuitStore';
export const CMD_REACTION = {
SET_FAVORITE: 1,
SET_BOOKMARK: 2,
SET_SEEN: 3,
SET_ATTEND: 4,
-}
-
+};
export const DefaultUser: IUserFields = {
_id: '',
@@ -128,7 +131,7 @@ export const DefaultUser: IUserFields = {
totalQty: 0,
note: '',
},
-}
+};
export const DefaultProfile: IUserProfile = {
img: '',
@@ -192,7 +195,7 @@ export const DefaultProfile: IUserProfile = {
calc: { numGoodsAndServices: 0 },
resid_province: '',
resid_card: '',
-}
+};
export const useUserStore = defineStore('UserStore', {
state: () => ({
@@ -224,712 +227,793 @@ export const useUserStore = defineStore('UserStore', {
}),
getters: {
-
isServerError(): boolean {
- return (this.servercode === toolsext.ERR_SERVERFETCH)
+ return this.servercode === toolsext.ERR_SERVERFETCH;
},
listaEditori: (state: IUserState): any => {
- return state.lista_editori
+ return state.lista_editori;
},
- getServerCode: (state: IUserState): number => (state.servercode ? state.servercode : 0),
+ getServerCode: (state: IUserState): number =>
+ state.servercode ? state.servercode : 0,
getMsg: (state: IUserState): string => (state.msg ? state.msg : ''),
getUsersList: (mystate: IUserState) => {
- return mystate.usersList
+ return mystate.usersList;
},
- IsMyFriend: (mystate: IUserState) => (userIdOwner: string): boolean => {
- // ++TODO Check if userIdOwner is my friend
- // userIdOwner is my friend ?
- return true
- },
-
-
- IsMyGroup: (mystate: IUserState) => (userIdOwner: string): boolean => {
- // ++TODO Check if userIdOwner is on my groups
- // userIdOwner is on my groups ?
- return true
- },
+ IsMyFriend:
+ (mystate: IUserState) =>
+ (userIdOwner: string): boolean => {
+ // ++TODO Check if userIdOwner is my friend
+ // userIdOwner is my friend ?
+ return true;
+ },
+ IsMyGroup:
+ (mystate: IUserState) =>
+ (userIdOwner: string): boolean => {
+ // ++TODO Check if userIdOwner is on my groups
+ // userIdOwner is on my groups ?
+ return true;
+ },
isTokenInvalid: (state: IUserState) => {
try {
- return (state.my.tokens!.length <= 0)
+ return state.my.tokens!.length <= 0;
} catch (e) {
- return true
+ return true;
}
},
isUserInvalid: (state: IUserState): boolean => {
try {
- return (state.my._id === undefined) || (state.my._id.trim() === '')
+ return state.my._id === undefined || state.my._id.trim() === '';
} catch (e) {
- return true
+ return true;
}
},
-
},
actions: {
-
getMypaginationMembers(): any {
- return { sortBy: 'namecomplete', descending: false, page: 1, rowsNumber: 0, rowsPerPage: 15 }
+ return {
+ sortBy: 'namecomplete',
+ descending: false,
+ page: 1,
+ rowsNumber: 0,
+ rowsPerPage: 15,
+ };
},
getSortFieldsAvailable(): any[] {
return [
- { label: 'Nome e Username', value: { 'namecomplete': 1 } },
- { label: 'Ultimi entrati', value: { 'date_reg': -1 } },
+ { label: 'Nome e Username', value: { namecomplete: 1 } },
+ { label: 'Ultimi entrati', value: { date_reg: -1 } },
{ label: 'Pieno di RIS', value: { 'account.saldo': -1 } },
{ label: 'Carente di RIS', value: { 'account.saldo': 1 } },
- ]
+ ];
},
IsMyFriendByUsername(username: string): boolean {
if (this.my.profile.friends)
- return this.my.profile.friends.findIndex((rec) => rec.username === username) >= 0
- else
- return false
+ return this.my.profile.friends.findIndex((rec) => rec.username === username) >= 0;
+ else return false;
},
IsHandShakeByUsername(username: string): boolean {
if (this.my.profile.handshake)
- return this.my.profile.handshake.findIndex((rec) => rec.username === username) >= 0
- else
- return false
+ return (
+ this.my.profile.handshake.findIndex((rec) => rec.username === username) >= 0
+ );
+ else return false;
},
IsHandShakeByMe(user: IUserFields): boolean {
if (user && user.profile && user.profile.handshake)
- return user.profile.handshake.findIndex((rec) => rec.username === this.my.username) >= 0
- else
- return false
+ return (
+ user.profile.handshake.findIndex((rec) => rec.username === this.my.username) >=
+ 0
+ );
+ else return false;
},
IsMyGroupByGroupname(groupname: string): boolean {
try {
if (this.my.profile?.mygroups)
- return this.my.profile.mygroups.findIndex((rec) => rec.groupname === groupname) >= 0
- else
- return false
+ return (
+ this.my.profile.mygroups.findIndex((rec) => rec.groupname === groupname) >= 0
+ );
+ else return false;
} catch (e) {
- return false
+ return false;
}
},
getMyGroupByGroupname(groupname: string): IMyGroup | null {
if (this.my.profile.mygroups) {
- const ris = this.my.profile.mygroups.find((rec) => rec.groupname === groupname)
- return ris ? ris : null
+ const ris = this.my.profile.mygroups.find((rec) => rec.groupname === groupname);
+ return ris ? ris : null;
} else {
- return null
+ return null;
}
},
GroupsListWhereIAmAdmin(): any {
try {
- return this.my.profile.manage_mygroups
+ return this.my.profile.manage_mygroups;
} catch (e) {
- return []
+ return [];
}
},
GroupsListWhereIAmAdminInTheCircuit(circuitname: string): any {
try {
- const arr: any = this.my.profile.manage_mygroups.filter((group: IMyGroup) => (group.mycircuits!.findIndex((circ: IMyCircuit) => circ.circuitname === circuitname) >= 0))
+ const arr: any = this.my.profile.manage_mygroups.filter(
+ (group: IMyGroup) =>
+ group.mycircuits!.findIndex(
+ (circ: IMyCircuit) => circ.circuitname === circuitname
+ ) >= 0
+ );
// console.log('arr', arr)
- return arr
+ return arr;
} catch (e) {
- return []
+ return [];
}
},
getUsersToVerify(): any[] {
try {
- const arr: any = this.my.profile.userstoverify
- return arr
+ const arr: any = this.my.profile.userstoverify;
+ return arr;
} catch (e) {
- return []
+ return [];
}
-
},
hoContiComunitariDaAmministrare(): boolean {
try {
- const arr: any = this.my.profile.manage_mygroups.filter((group: IMyGroup) => (group.mycircuits!.length > 0))
- return !!arr
+ const arr: any = this.my.profile.manage_mygroups.filter(
+ (group: IMyGroup) => group.mycircuits!.length > 0
+ );
+ return !!arr;
} catch (e) {
- return false
+ return false;
}
},
hoContiCollettiviDaAmministrare(): boolean {
- const arr = this.my.profile.manage_mygroups.find((group: IMyGroup) => group.account)
- return arr ? true : false
+ const arr = this.my.profile.manage_mygroups.find(
+ (group: IMyGroup) => group.account
+ );
+ return arr ? true : false;
},
IsAskedFriendByUsername(username: string): boolean {
if (this.my.profile.asked_friends)
- return this.my.profile.asked_friends.findIndex((rec) => rec.username === username) >= 0
- else
- return false
+ return (
+ this.my.profile.asked_friends.findIndex((rec) => rec.username === username) >= 0
+ );
+ else return false;
},
IsReqFriendByUsername(username: string): boolean {
if (this.my.profile.req_friends)
- return this.my.profile.req_friends.findIndex((rec) => rec.username === username) >= 0
- else
- return false
+ return (
+ this.my.profile.req_friends.findIndex((rec) => rec.username === username) >= 0
+ );
+ else return false;
},
IsAskedGroupByGroupname(groupname: string): boolean {
if (this.my.profile.asked_groups)
- return this.my.profile.asked_groups.findIndex((rec: IGroupShort) => rec.groupname === groupname) >= 0
- else
- return false
+ return (
+ this.my.profile.asked_groups.findIndex(
+ (rec: IGroupShort) => rec.groupname === groupname
+ ) >= 0
+ );
+ else return false;
},
IsRefusedGroupByGroupname(groupname: string): boolean {
if (this.my.profile.refused_groups)
- return this.my.profile.refused_groups.findIndex((rec: IGroupShort) => rec.groupname === groupname) >= 0
- else
- return false
+ return (
+ this.my.profile.refused_groups.findIndex(
+ (rec: IGroupShort) => rec.groupname === groupname
+ ) >= 0
+ );
+ else return false;
},
getUserByUsername(username: string): IUserFields | null {
// Check if is this User!
- if (this.my.username === username) return this.my
+ if (this.my.username === username) return this.my;
- let trovato: any = null
- if (this.usersList) trovato = this.usersList.find((item: any) => item.username === username)
+ let trovato: any = null;
+ if (this.usersList)
+ trovato = this.usersList.find((item: any) => item.username === username);
if (trovato) {
- if (trovato.surname === 'undefined')
- trovato.surname = ''
- if (trovato.name === 'undefined')
- trovato.name = ''
+ if (trovato.surname === 'undefined') trovato.surname = '';
+ if (trovato.name === 'undefined') trovato.name = '';
}
- return (trovato) || null
+ return trovato || null;
},
getImgByUsername(username: string): string {
- if (username === '') return ''
+ if (username === '') return '';
// Check if is this User!
- const myrec = this.getUserByUsername(username)
- if (myrec && myrec.profile && !!myrec.profile.img && myrec.profile.img !== '' && myrec.profile.img !== 'undefined') {
- return tools.getDirUpload() + 'profile/' + this.my.username + '/' + myrec.profile.img
+ const myrec = this.getUserByUsername(username);
+ if (
+ myrec &&
+ myrec.profile &&
+ !!myrec.profile.img &&
+ myrec.profile.img !== '' &&
+ myrec.profile.img !== 'undefined'
+ ) {
+ return (
+ tools.getDirUpload() + 'profile/' + this.my.username + '/' + myrec.profile.img
+ );
}
- return ''
+ return '';
},
getImgUserByUsername(username: string): string {
- const img = this.getImgByUsername(username)
- return img ? img : '/images/noimg-user.svg'
+ const img = this.getImgByUsername(username);
+ return img ? img : '/images/noimg-user.svg';
},
getImgUserByRow(row: any, col: IColGridTable): string {
- let value = ''
+ let value = '';
if (tools.existProp(row, col.name)) {
- value = row[col.name]
+ value = row[col.name];
}
- let tipoconto = shared_consts.AccountType.USER
+ let tipoconto = shared_consts.AccountType.USER;
if (tools.existProp(col, 'tipoconto') && col.tipoconto) {
- tipoconto = col.tipoconto
+ tipoconto = col.tipoconto;
}
- let img = ''
+ let img = '';
if (tipoconto === shared_consts.AccountType.USER) {
- img = this.getImgByUsername(value)
+ img = this.getImgByUsername(value);
} else if (tipoconto === shared_consts.AccountType.CONTO_DI_GRUPPO) {
- img = this.getImgByGroupname(value)
+ img = this.getImgByGroupname(value);
} else if (tipoconto === shared_consts.AccountType.COMMUNITY_ACCOUNT) {
- img = this.getImgByCircuitpath(value)
+ img = this.getImgByCircuitpath(value);
}
if (row) {
- const mycol = col.name + '.img'
+ const mycol = col.name + '.img';
if (tools.existProp(row, mycol)) {
- img = row[mycol]
+ img = row[mycol];
}
}
- return img ? img : '/images/noimg-user.svg'
+ return img ? img : '/images/noimg-user.svg';
},
getImgByProfile(userparam: any, reale: any = false, col: any = null): string {
try {
- let myrec = this.getRecByCol(userparam, col)
- let img = ''
- if (!reale)
- img = '/images/noimg-user.svg'
+ let myrec = this.getRecByCol(userparam, col);
+ let img = '';
+ if (!reale) img = '/images/noimg-user.svg';
- let tipoconto = shared_consts.AccountType.USER
+ let tipoconto = shared_consts.AccountType.USER;
if (col && tools.existProp(col, 'tipoconto') && col.tipoconto) {
- tipoconto = col.tipoconto
+ tipoconto = col.tipoconto;
}
if (tipoconto === shared_consts.AccountType.CONTO_DI_GRUPPO) {
- img = this.getImgByGroupname(myrec.groupname)
+ img = this.getImgByGroupname(myrec.groupname);
} else if (tipoconto === shared_consts.AccountType.COMMUNITY_ACCOUNT) {
- img = this.getImgByCircuitpath(myrec.path)
+ img = this.getImgByCircuitpath(myrec.path);
} else {
if (myrec.profile && myrec.profile.img) {
- img = tools.getDirUpload() + 'profile/' + myrec.username + '/' + myrec.profile.img
+ img =
+ tools.getDirUpload() +
+ 'profile/' +
+ myrec.username +
+ '/' +
+ myrec.profile.img;
}
}
- return img
+ return img;
} catch (e) {
//
}
- if (!reale)
- return '/images/noimg-user.svg'
- else
- return ''
+ if (!reale) return '/images/noimg-user.svg';
+ else return '';
},
- getImgByMov(mov: IMovQuery, tipoconto: number, from: boolean, reale: boolean): string {
+ getImgByMov(
+ mov: IMovQuery,
+ tipoconto: number,
+ from: boolean,
+ reale: boolean
+ ): string {
try {
-
- let img = ''
- if (!reale)
- img = '/images/noimg-user.svg'
+ let img = '';
+ if (!reale) img = '/images/noimg-user.svg';
if (tipoconto === shared_consts.AccountType.CONTO_DI_GRUPPO) {
- img = this.getImgByGroup(from ? mov.groupfrom : mov.groupto)
+ img = this.getImgByGroup(from ? mov.groupfrom : mov.groupto);
// img = this.getImgByGroupname(from ? mov.groupfrom.groupname : mov.groupto.groupname)
} else if (tipoconto === shared_consts.AccountType.COMMUNITY_ACCOUNT) {
- img = this.getImgByCircuitpath(from ? mov.contocomfrom.path : mov.contocomto.path)
+ img = this.getImgByCircuitpath(
+ from ? mov.contocomfrom.path : mov.contocomto.path
+ );
} else {
- let myuser = from ? mov.userfrom : mov.userto
+ let myuser = from ? mov.userfrom : mov.userto;
if (myuser && myuser.profile.img) {
- img = tools.getDirUpload() + 'profile/' + myuser.username + '/' + myuser.profile.img
+ img =
+ tools.getDirUpload() +
+ 'profile/' +
+ myuser.username +
+ '/' +
+ myuser.profile.img;
}
}
- return img
+ return img;
} catch (e) {
//
}
- if (!reale)
- return '/images/noimg-user.svg'
- else
- return ''
+ if (!reale) return '/images/noimg-user.svg';
+ else return '';
},
-
IsAskedCircuitByName(name: string): boolean {
if (this.my.profile.asked_circuits && this.my.profile.asked_circuits.length > 0)
- return this.my.profile.asked_circuits.findIndex((rec: ICircuit) => rec.name === name) >= 0
- else
- return false
+ return (
+ this.my.profile.asked_circuits.findIndex(
+ (rec: ICircuit) => rec.name === name
+ ) >= 0
+ );
+ else return false;
},
-
-
IsMyCircuitByName(circuitname: string): boolean {
-
if (this.my.profile.mycircuits && this.my.profile.mycircuits.length > 0)
- return this.my.profile.mycircuits.findIndex((rec: IMyCircuit) => rec.circuitname === circuitname) >= 0
- else
- return false
-
+ return (
+ this.my.profile.mycircuits.findIndex(
+ (rec: IMyCircuit) => rec.circuitname === circuitname
+ ) >= 0
+ );
+ else return false;
},
IsMyCircuitByNameAndGroup(circuitname: string, groupname: string): boolean {
- const globalStore = useGlobalStore()
+ const globalStore = useGlobalStore();
if (globalStore.mygroups) {
- const group: IMyGroup | undefined = globalStore.mygroups.find((rec: IMyGroup) => rec.groupname === groupname)
+ const group: IMyGroup | undefined = globalStore.mygroups.find(
+ (rec: IMyGroup) => rec.groupname === groupname
+ );
if (group && group.mycircuits) {
- return group.mycircuits.findIndex((rec: any) => rec.circuitname === circuitname) >= 0
+ return (
+ group.mycircuits.findIndex((rec: any) => rec.circuitname === circuitname) >= 0
+ );
}
- return false
- } else
- return false
-
+ return false;
+ } else return false;
},
addarrfinale(arrout: any): any[] {
- let arrfinale = []
- const circuitStore = useCircuitStore()
+ let arrfinale = [];
+ const circuitStore = useCircuitStore();
// controlla che il circuito sia Abilitato e Territoriale !
for (const circuitname of arrout) {
- const circuit = circuitStore.getCircuitByName(circuitname)
+ const circuit = circuitStore.getCircuitByName(circuitname);
if (circuit && circuit.transactionsEnabled && !circuit.showAlways) {
- arrfinale.push(circuitname)
+ arrfinale.push(circuitname);
}
}
// Poi aggiungi i Circuiti ITALIA
for (const circuitname of arrout) {
- const circuit = circuitStore.getCircuitByName(circuitname)
+ const circuit = circuitStore.getCircuitByName(circuitname);
if (circuit && circuit.transactionsEnabled && circuit.showAlways) {
- arrfinale.push(circuitname)
+ arrfinale.push(circuitname);
}
}
- return arrfinale
-
+ return arrfinale;
},
getMyCircuitsInCommonByUser(user: IUserFields): any[] {
- let arrout = []
- let vuoto = false
+ let arrout = [];
+ let vuoto = false;
- if (!this.my.profile.mycircuits || (!user || !user.profile || !user.profile.mycircuits))
- vuoto = true // ok
+ if (
+ !this.my.profile.mycircuits ||
+ !user ||
+ !user.profile ||
+ !user.profile.mycircuits
+ )
+ vuoto = true; // ok
else
- arrout = tools.getCommon([...this.my.profile.mycircuits], [...user.profile.mycircuits], 'circuitname', 'circuitname')
+ arrout = tools.getCommon(
+ [...this.my.profile.mycircuits],
+ [...user.profile.mycircuits],
+ 'circuitname',
+ 'circuitname'
+ );
- return this.addarrfinale(arrout)
+ return this.addarrfinale(arrout);
},
getMyCircuitsInCommonByGroup(group: IMyGroup): any[] {
- console.log('this.my.profile.mycircuits', this.my.profile.mycircuits)
+ console.log('this.my.profile.mycircuits', this.my.profile.mycircuits);
- if (!this.my.profile.mycircuits || (!group || !group.mycircuits))
- return []
- const arrout = tools.getCommon([...this.my.profile.mycircuits], [...group.mycircuits], 'circuitname', 'name')
+ if (!this.my.profile.mycircuits || !group || !group.mycircuits) return [];
+ const arrout = tools.getCommon(
+ [...this.my.profile.mycircuits],
+ [...group.mycircuits],
+ 'circuitname',
+ 'name'
+ );
- return this.addarrfinale(arrout)
+ return this.addarrfinale(arrout);
},
getMyCircuits(): any[] {
-
- if (!this.my.profile.mycircuits)
- return []
- return this.my.profile.mycircuits.map(item => item.circuitname)
+ if (!this.my.profile.mycircuits) return [];
+ return this.my.profile.mycircuits.map((item) => item.circuitname);
},
-
getMyHandshakeInCommon(myuser: IUserFields): any[] {
-
- if (!this.my.profile.handshake || (!myuser || !myuser.profile.handshake))
- return []
- return tools.getCommonAllRecord([...this.my.profile.handshake], [...myuser.profile.handshake], 'username')
+ if (!this.my.profile.handshake || !myuser || !myuser.profile.handshake) return [];
+ return tools.getCommonAllRecord(
+ [...this.my.profile.handshake],
+ [...myuser.profile.handshake],
+ 'username'
+ );
},
getAccountByCircuitId(circuitId: string): any {
if (this.my.profile.useraccounts) {
- return this.my.profile.useraccounts.find((rec: IAccount) => rec.circuitId === circuitId)
+ return this.my.profile.useraccounts.find(
+ (rec: IAccount) => rec.circuitId === circuitId
+ );
}
- return null
+ return null;
},
getGroupByGroupname(groupname: string): any {
- return this.my.profile.manage_mygroups.find((rec: IMyGroup) => rec.groupname === groupname)
+ return this.my.profile.manage_mygroups.find(
+ (rec: IMyGroup) => rec.groupname === groupname
+ );
},
getAccountsListNameValue(): any[] {
- let arr = []
- const circuitStore = useCircuitStore()
+ let arr = [];
+ const circuitStore = useCircuitStore();
if (this.my.profile.useraccounts) {
for (const acc of this.my.profile.useraccounts) {
- let chi = acc.username ? acc.username : (acc.groupname ? acc.groupname : acc.contocom)
+ let chi = acc.username
+ ? acc.username
+ : acc.groupname
+ ? acc.groupname
+ : acc.contocom;
if (acc.circuit) {
- chi += ' (' + circuitStore.getNameByCircuitId(acc.circuitId) + ')'
+ chi += ' (' + circuitStore.getNameByCircuitId(acc.circuitId) + ')';
}
- arr.push({ label: chi, value: acc._id })
+ arr.push({ label: chi, value: acc._id });
}
}
- return arr
+ return arr;
},
IsRefusedCircuitByName(circuitname: string): boolean {
if (this.my.profile.refused_circuits)
- return this.my.profile.refused_circuits.findIndex((rec: ICircuit) => rec.name === circuitname) >= 0
- else
- return false
+ return (
+ this.my.profile.refused_circuits.findIndex(
+ (rec: ICircuit) => rec.name === circuitname
+ ) >= 0
+ );
+ else return false;
},
getImgByCircuit(circ: ICircuit | null): string {
-
try {
if (circ && circ.photos && circ.photos.length > 0)
- return tools.getDirUpload() + 'circuits/' + circ.path + '/' + circ.photos[0].imagefile
- } catch (e) {
- }
- return '/images/noimg.png'
+ return (
+ tools.getDirUpload() +
+ 'circuits/' +
+ circ.path +
+ '/' +
+ circ.photos[0].imagefile
+ );
+ } catch (e) {}
+ return '/images/noimg.png';
},
getImgByCircuitpath(circuitpath: string): string {
- const circuitStore = useCircuitStore()
+ const circuitStore = useCircuitStore();
- const mycirc = circuitStore.getCircuitByPath(circuitpath)
- return this.getImgByCircuit(mycirc)
+ const mycirc = circuitStore.getCircuitByPath(circuitpath);
+ return this.getImgByCircuit(mycirc);
},
getImgByGroup(group: any): string {
-
try {
// ++Todo: Sistemare!
if (group) {
- return tools.getDirUpload() + 'mygroups/' + group.groupname + '/' + group.photos[0].imagefile
+ return (
+ tools.getDirUpload() +
+ 'mygroups/' +
+ group.groupname +
+ '/' +
+ group.photos[0].imagefile
+ );
}
- } catch (e) {
- }
- return '/images/noimg.png'
+ } catch (e) {}
+ return '/images/noimg.png';
},
getImgByGroupname(groupname: string): string {
- const mygroup = this.getMyGroupByGroupname(groupname)
- return this.getImgByGroup(mygroup)
+ const mygroup = this.getMyGroupByGroupname(groupname);
+ return this.getImgByGroup(mygroup);
},
getRefLink(username: string): string {
- if (username === '')
- username = this.my.username
- return tools.getUrlSite() + '/registrati/' + username
+ if (username === '') username = this.my.username;
+ return tools.getUrlSite() + '/registrati/' + username;
},
getLinkProfile(username: string): string {
- if (username === '')
- username = this.my.username
- return tools.getUrlSite() + '/my/' + username
+ if (username === '') username = this.my.username;
+ return tools.getUrlSite() + '/my/' + username;
},
getLinkProfileAndRIS(username: string, qtyris: string, causale: string = ''): string {
+ let myparams = '';
+ if (username === '') username = this.my.username;
+ let mylink = tools.getUrlSite() + '/my/' + username;
- let myparams = ''
- if (username === '')
- username = this.my.username
- let mylink = tools.getUrlSite() + '/my/' + username
-
- let myval = tools.strToVal(qtyris, true)
+ let myval = tools.strToVal(qtyris, true);
if (myval !== null) {
- if (myparams)
- myparams += `&`
- myparams += `sr=${myval}`
+ if (myparams) myparams += `&`;
+ myparams += `sr=${myval}`;
}
if (causale) {
- if (myparams)
- myparams += `&`
- myparams += `cd=${tools.convertStringToUrl(causale)}`
+ if (myparams) myparams += `&`;
+ myparams += `cd=${tools.convertStringToUrl(causale)}`;
}
- return mylink + (myparams ? '?' + myparams : '')
+ return mylink + (myparams ? '?' + myparams : '');
},
isTelegIdOk(): boolean {
- return (this.my.profile.teleg_id! > 0 || this.my.profile.teleg_id_old! > 0)
+ return this.my.profile.teleg_id! > 0 || this.my.profile.teleg_id_old! > 0;
},
isUserOk(): boolean {
- const globalStore = useGlobalStore()
+ const globalStore = useGlobalStore();
- if (globalStore.site.confpages && globalStore.site.confpages?.enableRegMultiChoice) {
- return ((this.isTelegIdOk() && this.isUsernameTelegOk()) || this.my.verified_email!) && this.my.verified_by_aportador!
+ if (
+ globalStore.site.confpages &&
+ globalStore.site.confpages?.enableRegMultiChoice
+ ) {
+ return (
+ ((this.isTelegIdOk() && this.isUsernameTelegOk()) || this.my.verified_email!) &&
+ this.my.verified_by_aportador!
+ );
} else {
//if (tools.getAskToVerifyReg()) {
- if (globalStore.site.confpages && globalStore.site.confpages?.enabledRegNeedTelegram) {
- return this.isTelegIdOk() && this.my.verified_by_aportador! && this.isUsernameTelegOk()
+ if (
+ globalStore.site.confpages &&
+ globalStore.site.confpages?.enabledRegNeedTelegram
+ ) {
+ return (
+ this.isTelegIdOk() &&
+ this.my.verified_by_aportador! &&
+ this.isUsernameTelegOk()
+ );
} else {
- return this.my.verified_email!
+ return this.my.verified_email!;
}
}
// return this.my.verified_email! && this.isTelegIdOk() && this.my.verified_by_aportador!
},
isUserWaitingVerifAportador(): boolean {
- return tools.isLogged() && !this.my.verified_by_aportador && !!tools.getAportadorSolidario()
+ return (
+ tools.isLogged() &&
+ !this.my.verified_by_aportador &&
+ !!tools.getAportadorSolidario()
+ );
},
isOldRegNotFinished(): boolean {
- return tools.isLogged() && ((!this.my.profile.teleg_id || this.my.profile.teleg_id <= 0) || !this.isUsernameTelegOk())
+ return (
+ tools.isLogged() &&
+ (!this.my.profile.teleg_id ||
+ this.my.profile.teleg_id <= 0 ||
+ !this.isUsernameTelegOk())
+ );
// return this.my.verified_email! && this.isTelegIdOk() && this.my.verified_by_aportador!
},
isTelegOk(): boolean {
- return this.isTelegIdOk()
+ return this.isTelegIdOk();
// return this.my.verified_email! && this.isTelegIdOk() && this.my.verified_by_aportador!
},
isUsernameTelegOk(): boolean {
- return !!this.my.profile.username_telegram
+ return !!this.my.profile.username_telegram;
// return this.my.verified_email! && this.isTelegIdOk() && this.my.verified_by_aportador!
},
getNameSurnameByUserId(userId: string): string {
-
- const user = this.getUserByUserId(userId)
- if (user) return `${user.name} ` + !!user.surname ? user.surname : ''
- return `(${userId})`
+ const user = this.getUserByUserId(userId);
+ if (user) return `${user.name} ` + !!user.surname ? user.surname : '';
+ return `(${userId})`;
},
getNameSurnameByUsername(username: string): string {
- const user = this.getUserByUsername(username)
- if (user) return `${user.name} ` + !!user.surname ? user.surname : ''
- return `(${username})`
+ const user = this.getUserByUsername(username);
+ if (user) return `${user.name} ` + !!user.surname ? user.surname : '';
+ return `(${username})`;
},
getRecByCol(user: any, col: any = null) {
- let myrec = user
- if (col && col.field === 'userto')
- myrec = user.userto
- else if (col && col.field === 'groupto')
- myrec = user.groupto
- else if (col && col.field === 'userfrom')
- myrec = user.userfrom
- else if (col && col.field === 'groupfrom')
- myrec = user.groupfrom
- else if (col && col.field === 'contocomfrom')
- myrec = user.contocomfrom
- else if (col && col.field === 'contocomto')
- myrec = user.contocomto
+ let myrec = user;
+ if (col && col.field === 'userto') myrec = user.userto;
+ else if (col && col.field === 'groupto') myrec = user.groupto;
+ else if (col && col.field === 'userfrom') myrec = user.userfrom;
+ else if (col && col.field === 'groupfrom') myrec = user.groupfrom;
+ else if (col && col.field === 'contocomfrom') myrec = user.contocomfrom;
+ else if (col && col.field === 'contocomto') myrec = user.contocomto;
- return myrec
+ return myrec;
},
getNameToShow(user: any, col: any = null, options: any = {}): string {
- let name = ''
- let myrec = this.getRecByCol(user, col)
+ let name = '';
+ let myrec = this.getRecByCol(user, col);
- let tipoconto = shared_consts.AccountType.USER
+ let tipoconto = shared_consts.AccountType.USER;
if (col && tools.existProp(col, 'tipoconto')) {
- tipoconto = col.tipoconto
+ tipoconto = col.tipoconto;
}
if (tipoconto === shared_consts.AccountType.USER) {
- if (!!myrec.name)
- name = myrec.name + ' '
- if (!!myrec.surname)
- name += myrec.surname + ' '
+ if (!!myrec.name) name = myrec.name + ' ';
+ if (!!myrec.surname) name += myrec.surname + ' ';
if (!name && myrec.username) {
- name += myrec.username + ' '
+ name += myrec.username + ' ';
}
if (col && col.field === 'extrarec' && !name) {
- name = myrec.dest
+ name = myrec.dest;
}
} else if (tipoconto === shared_consts.AccountType.CONTO_DI_GRUPPO) {
- if (tools.existProp(myrec, 'descr'))
- return myrec.descr
- else if (tools.existProp(myrec, 'groupname'))
- return myrec.groupname
- else if (tools.existProp(myrec, 'grouporig'))
- return myrec.grouporig
+ if (tools.existProp(myrec, 'descr')) return myrec.descr;
+ else if (tools.existProp(myrec, 'groupname')) return myrec.groupname;
+ else if (tools.existProp(myrec, 'grouporig')) return myrec.grouporig;
} else if (tipoconto === shared_consts.AccountType.COMMUNITY_ACCOUNT) {
- if (tools.existProp(myrec, 'name'))
- return myrec.name
- else if (tools.existProp(myrec, 'contocom'))
- return myrec.contocom
- else if (tools.existProp(myrec, 'contoComDest'))
- return myrec.contoComDest
+ if (tools.existProp(myrec, 'name')) return myrec.name;
+ else if (tools.existProp(myrec, 'contocom')) return myrec.contocom;
+ else if (tools.existProp(myrec, 'contoComDest')) return myrec.contoComDest;
}
if (!name && tools.existProp(myrec.extrarec, 'contoComDest'))
- return myrec.extrarec.contoComDest
-
- return name + (options && options.showprov ? this.getProvinceByUser(myrec, options ? options.html : false) : '')
+ return myrec.extrarec.contoComDest;
+ return (
+ name +
+ (options && options.showprov
+ ? this.getProvinceByUser(myrec, options ? options.html : false)
+ : '')
+ );
},
getProvinceByUser(user: IUserFields, html: boolean = false) {
- let mystr = ''
+ let mystr = '';
if (user && user.profile && user.profile.resid_province)
- mystr = `(${user.profile.resid_province})`
+ mystr = `(${user.profile.resid_province})`;
if (html) {
- mystr = `${mystr}`
+ mystr = `${mystr}`;
}
- return mystr
+ return mystr;
},
getUserNameOnlyIfToShow(user: any, col: any = null, options: any = {}): string {
- let myrec = this.getRecByCol(user, col)
+ let myrec = this.getRecByCol(user, col);
if (myrec.name || myrec.surname) {
- return myrec.username + ((options && options.showprov) ? this.getProvinceByUser(myrec, options.html) : '')
+ return (
+ myrec.username +
+ (options && options.showprov ? this.getProvinceByUser(myrec, options.html) : '')
+ );
}
- return ''
+ return '';
},
getUserByUserId(userId: string): IUserFields | null {
// Check if is this User!
- if (this.my._id === userId) return this.my
+ if (this.my._id === userId) return this.my;
- let trovato: any = null
+ let trovato: any = null;
- if (this.usersList) trovato = this.usersList.find((item: any) => item._id === userId)
+ if (this.usersList)
+ trovato = this.usersList.find((item: any) => item._id === userId);
if (trovato) {
- if (trovato.surname === undefined)
- trovato.surname = ''
- if (trovato.name === undefined)
- trovato.name = ''
+ if (trovato.surname === undefined) trovato.surname = '';
+ if (trovato.name === undefined) trovato.name = '';
}
- return (trovato) || null
+ return trovato || null;
},
getMsgError(err: number): string {
- let msgerrore = ''
+ let msgerrore = '';
if (err !== tools.OK) {
- msgerrore = `Error [${this.servercode}]: `
+ msgerrore = `Error [${this.servercode}]: `;
if (this.servercode === toolsext.ERR_SERVERFETCH) {
- msgerrore = translate('fetch.errore_server')
+ msgerrore = translate('fetch.errore_server');
} else {
- msgerrore = translate('fetch.errore_generico')
+ msgerrore = translate('fetch.errore_generico');
}
if (import.meta.env.DEV) {
- console.log('ERROREEEEEEEEE: ', msgerrore, ' (', err, ')')
+ console.log('ERROREEEEEEEEE: ', msgerrore, ' (', err, ')');
}
}
// return { code: this.servercode, msg: msgerrore }
- return msgerrore
+ return msgerrore;
},
-
clearAuthData() {
- console.log('clearAuthData')
- this.my = DefaultUser
+ console.log('clearAuthData');
+ this.my = DefaultUser;
// resetArrToken(mystate.my.tokens)
- this.categorySel = 'personal'
+ this.categorySel = 'personal';
- this.servercode = 0
- this.resStatus = 0
- this.isLogged = false
- this.x_auth_token = ''
- this.refreshToken = ''
+ this.servercode = 0;
+ this.resStatus = 0;
+ this.isLogged = false;
+ this.x_auth_token = '';
+ this.refreshToken = '';
- return true
+ return true;
},
async resetpwd(paramquery: any) {
+ const mydata = { ...paramquery };
- const mydata = { ...paramquery }
-
- return bcrypt.hash(mydata.password, bcrypt.genSaltSync(12))
+ return bcrypt
+ .hash(mydata.password, bcrypt.genSaltSync(12))
.then((hashedPassword: string) => {
- mydata.repeatPassword = ''
- mydata.password = String(hashedPassword)
+ mydata.repeatPassword = '';
+ mydata.password = String(hashedPassword);
return Api.SendReq('/updatepwd', 'POST', mydata, true, false, 1)
.then((res) => {
- return { code: res.data.code, msg: res.data.msg }
+ return { code: res.data.code, msg: res.data.msg };
})
.catch((error: Types.AxiosError) => {
- this.setErrorCatch(error)
- return { code: this.getServerCode, msg: error.getMsgError() }
- })
- })
-
+ this.setErrorCatch(error);
+ return { code: this.getServerCode, msg: error.getMsgError() };
+ });
+ });
},
setErrorCatch(axerr: Types.AxiosError) {
try {
if (this.servercode !== toolsext.ERR_SERVERFETCH) {
- this.servercode = axerr.getCode()
+ this.servercode = axerr.getCode();
}
// this.msg = axerr.getMsg()
- console.log('Err catch: (servercode:', axerr.getCode(), axerr.getMsgError(), ')')
+ console.log('Err catch: (servercode:', axerr.getCode(), axerr.getMsgError(), ')');
} catch (e) {
- console.log('Err catch:', axerr)
+ console.log('Err catch:', axerr);
}
},
@@ -937,75 +1021,82 @@ export const useUserStore = defineStore('UserStore', {
const mydata = {
username: this.my.username,
lang: this.lang,
- }
+ };
return Api.SendReq('/setlang', 'PATCH', { data: mydata })
.then((res) => {
if (res) {
- return (res.data.code === serv_constants.RIS_CODE_OK)
+ return res.data.code === serv_constants.RIS_CODE_OK;
}
- return false
+ return false;
})
- .catch((error: any) => false)
+ .catch((error: any) => false);
},
async requestpwd(paramquery: any) {
const usertosend = {
email: paramquery.email,
codetocheck: paramquery.tokenforgot_code,
- }
- console.log(usertosend)
+ };
+ console.log(usertosend);
- this.setServerCode(tools.CALLING)
+ this.setServerCode(tools.CALLING);
return Api.SendReq('/requestnewpwd', 'POST', usertosend)
- .then((res) => ({ code: res.data.code, msg: res.data.msg, link: res.data.link })).catch((error) => {
- this.setErrorCatch(error)
- return this.getServerCode
- })
+ .then((res) => ({ code: res.data.code, msg: res.data.msg, link: res.data.link }))
+ .catch((error) => {
+ this.setErrorCatch(error);
+ return this.getServerCode;
+ });
},
async addNewSite(paramquery: any) {
- console.log(paramquery)
+ console.log(paramquery);
- this.setServerCode(tools.CALLING)
+ this.setServerCode(tools.CALLING);
- return bcrypt.hash(paramquery.password, bcrypt.genSaltSync(12))
+ return bcrypt
+ .hash(paramquery.password, bcrypt.genSaltSync(12))
.then((hashedPassword: string) => {
- paramquery.password = String(hashedPassword)
+ paramquery.password = String(hashedPassword);
return Api.SendReq('/addNewSite', 'POST', paramquery)
- .then((res) => ({ code: res.data.code, msg: res.data.msg, idapp: res.data.idapp }))
+ .then((res) => ({
+ code: res.data.code,
+ msg: res.data.msg,
+ idapp: res.data.idapp,
+ }))
.catch((error) => {
- this.setErrorCatch(error)
- return this.getServerCode
- })
- })
+ this.setErrorCatch(error);
+ return this.getServerCode;
+ });
+ });
},
async vreg(paramquery: ILinkReg) {
const usertosend = {
idlink: paramquery.idlink,
- }
- console.log(usertosend)
+ };
+ console.log(usertosend);
- this.setServerCode(tools.CALLING)
+ this.setServerCode(tools.CALLING);
return Api.SendReq('/vreg', 'POST', usertosend)
.then((res) => {
// console.log("RITORNO 2 ");
// mutations.setServerCode(myres);
if (res.data.code === serv_constants.RIS_CODE_EMAIL_VERIFIED) {
- console.log('VERIFICATO !!')
- tools.localStSetItem(toolsext.localStorage.verified_email, String(true))
+ console.log('VERIFICATO !!');
+ tools.localStSetItem(toolsext.localStorage.verified_email, String(true));
} else {
- console.log('Risultato di vreg: ', res.data.code)
+ console.log('Risultato di vreg: ', res.data.code);
}
- return { code: res.data.code, msg: res.data.msg }
- }).catch((error) => {
- this.setErrorCatch(error)
- return { code: this.getServerCode, msg: error.getMsgError() }
+ return { code: res.data.code, msg: res.data.msg };
})
+ .catch((error) => {
+ this.setErrorCatch(error);
+ return { code: this.getServerCode, msg: error.getMsgError() };
+ });
},
async unsubscribe(paramquery: any) {
@@ -1014,63 +1105,76 @@ export const useUserStore = defineStore('UserStore', {
// console.log("RITORNO 2 ");
// mutations.setServerCode(myres);
if (res.data.code === serv_constants.RIS_UNSUBSCRIBED_OK) {
- console.log('DESOTTOSCRITTO ALLA NEWSLETTER !!')
+ console.log('DESOTTOSCRITTO ALLA NEWSLETTER !!');
} else {
- console.log('Risultato di unsubscribe: ', res.data.code)
+ console.log('Risultato di unsubscribe: ', res.data.code);
}
- return { code: res.data.code, msg: res.data.msg }
- }).catch((error) => this.getServerCode)
+ return { code: res.data.code, msg: res.data.msg };
+ })
+ .catch((error) => this.getServerCode);
},
async unsubscribe_news_on_fielduser(paramquery: any) {
return Api.SendReq('/news/unsubscribe_user', 'POST', paramquery)
.then((res) => {
if (res.data.code === serv_constants.RIS_UNSUBSCRIBED_OK) {
- console.log('DESOTTOSCRITTO ALLA NEWSLETTER !!')
+ console.log('DESOTTOSCRITTO ALLA NEWSLETTER !!');
} else {
- console.log('Risultato di unsubscribe: ', res.data.code)
+ console.log('Risultato di unsubscribe: ', res.data.code);
}
- return { code: res.data.code, msg: res.data.msg }
- }).catch((error) => this.getServerCode)
+ return { code: res.data.code, msg: res.data.msg };
+ })
+ .catch((error) => this.getServerCode);
},
async importemail(paramquery: any) {
return Api.SendReq('/news/import', 'POST', paramquery)
- .then((res) => res).catch((error) => ({ numtot: 0, numadded: 0, numalreadyexisted: 0 }))
+ .then((res) => res)
+ .catch((error) => ({ numtot: 0, numadded: 0, numalreadyexisted: 0 }));
},
async importExtraList(paramquery: any) {
-
return Api.SendReq('/users/import_extralist', 'POST', paramquery)
.then((res) => {
- return res
- }).catch((error) => {
- return { numtot: 0, numadded: 0, numalreadyexisted: 0 }
+ return res;
})
+ .catch((error) => {
+ return { numtot: 0, numadded: 0, numalreadyexisted: 0 };
+ });
},
async execDbOp(paramquery: any) {
// come faccio a ricevere un file da node.js ?
- return Api.SendReq('/users/dbop', 'POST', paramquery, false, false, 0, 5000, null, null, {timeout: 300000})
+ return Api.SendReq(
+ '/users/dbop',
+ 'POST',
+ paramquery,
+ false,
+ false,
+ 0,
+ 5000,
+ null,
+ null,
+ { timeout: 300000 }
+ )
.then((res) => {
-
-
- return res.data
- }).catch((error) => {
- return false
+ return res.data;
})
+ .catch((error) => {
+ return false;
+ });
},
async execDbOpUser(paramquery: any) {
return Api.SendReq('/users/dbopuser', 'POST', paramquery)
.then((res) => {
+ tools.updateMyData(res.data.ris);
- tools.updateMyData(res.data.ris)
-
- return res.data
- }).catch((error) => {
- return false
+ return res.data;
})
+ .catch((error) => {
+ return false;
+ });
},
async saveStepTutorial(step: number) {
@@ -1078,21 +1182,21 @@ export const useUserStore = defineStore('UserStore', {
_id: this.my._id,
dbop: 'saveStepTut',
value: step,
- }
- this.my.profile.stepTutorial = step
- const ris = await this.execDbOpUser({ mydata })
+ };
+ this.my.profile.stepTutorial = step;
+ const ris = await this.execDbOpUser({ mydata });
- return ris
+ return ris;
},
async savenoNameSurname(val: boolean) {
const mydata = {
_id: this.my._id,
dbop: 'noNameSurname',
value: val,
- }
+ };
if (this.my.profile.noNameSurname !== val) {
- this.my.profile.noNameSurname = val
- return await this.execDbOpUser({ mydata })
+ this.my.profile.noNameSurname = val;
+ return await this.execDbOpUser({ mydata });
}
},
async savenoCircuit(val: boolean) {
@@ -1100,10 +1204,10 @@ export const useUserStore = defineStore('UserStore', {
_id: this.my._id,
dbop: 'noCircuit',
value: val,
- }
+ };
if (this.my.profile.noCircuit !== val) {
- this.my.profile.noCircuit = val
- return await this.execDbOpUser({ mydata })
+ this.my.profile.noCircuit = val;
+ return await this.execDbOpUser({ mydata });
}
},
async savenoCircIta(val: boolean) {
@@ -1111,10 +1215,10 @@ export const useUserStore = defineStore('UserStore', {
_id: this.my._id,
dbop: 'noCircIta',
value: val,
- }
+ };
if (this.my.profile.noCircIta !== val) {
- this.my.profile.noCircIta = val
- return await this.execDbOpUser({ mydata })
+ this.my.profile.noCircIta = val;
+ return await this.execDbOpUser({ mydata });
}
},
async savenoFoto(val: boolean) {
@@ -1122,418 +1226,480 @@ export const useUserStore = defineStore('UserStore', {
_id: this.my._id,
dbop: 'noFoto',
value: val,
- }
+ };
if (this.my.profile.noFoto !== val) {
- this.my.profile.noFoto = val
- return await this.execDbOpUser({ mydata })
+ this.my.profile.noFoto = val;
+ return await this.execDbOpUser({ mydata });
}
},
async getProvincesForMap() {
return Api.SendReq('/users/infomap', 'POST', null)
.then((res) => {
- return res ? res.data.ris : []
- }).catch((error) => {
- return null
+ return res ? res.data.ris : [];
})
+ .catch((error) => {
+ return null;
+ });
},
async newsletterload(force: boolean) {
-
- const globalStore = useGlobalStore()
+ const globalStore = useGlobalStore();
const mydata = {
- locale: tools.getLocale()
- }
+ locale: tools.getLocale(),
+ };
- if ((globalStore.serv_settings.length > 0) && !force)
- return null;
+ if (globalStore.serv_settings.length > 0 && !force) return null;
return Api.SendReq('/news/load', 'POST', mydata)
.then((res: any) => {
// console.log('res', res)
if (res.data) {
- globalStore.serv_settings = res.data.serv_settings
- globalStore.templemail = res.data.templemail
- globalStore.destnewsletter = res.data.destnewsletter
- globalStore.opzemail = res.data.opzemail
+ globalStore.serv_settings = res.data.serv_settings;
+ globalStore.templemail = res.data.templemail;
+ globalStore.destnewsletter = res.data.destnewsletter;
+ globalStore.opzemail = res.data.opzemail;
}
- return res.data
- }).catch((error) => {
- return null
+ return res.data;
})
+ .catch((error) => {
+ return null;
+ });
},
async reportload(paramquery: any) {
-
return Api.SendReq('/report/load', 'POST', paramquery)
.then((res) => {
// console.log('res', res)
- return res.data
- }).catch((error) => {
- return null
+ return res.data;
})
+ .catch((error) => {
+ return null;
+ });
},
async newsletter_setactivate(paramquery: any) {
-
return Api.SendReq('/news/setactivate', 'POST', paramquery)
.then((res) => {
// console.log('res', res)
- return res.data
- }).catch((error) => {
- return null
+ return res.data;
})
+ .catch((error) => {
+ return null;
+ });
},
authUser(data: IUserFields) {
try {
- this.my = { ...data }
+ this.my = { ...data };
// console.log('**** my', this.my)
if (!this.my.profile) {
- this.my.profile = DefaultProfile
+ this.my.profile = DefaultProfile;
// Memory
- this.my.profile.manage_mygroups = []
- this.my.profile.asked_friends = []
- this.my.profile.asked_groups = []
- this.my.profile.refused_groups = []
+ this.my.profile.manage_mygroups = [];
+ this.my.profile.asked_friends = [];
+ this.my.profile.asked_groups = [];
+ this.my.profile.refused_groups = [];
}
- this.isAdmin = tools.isBitActive(this.my.perm, shared_consts.Permissions.Admin.value)
- this.isManager = tools.isBitActive(this.my.perm, shared_consts.Permissions.Manager.value)
- this.isFacilitatore = tools.isBitActive(this.my.perm, shared_consts.Permissions.Facilitatore.value)
- this.isZoomeri = tools.isBitActive(this.my.perm, shared_consts.Permissions.Zoomeri.value)
- this.isDepartment = tools.isBitActive(this.my.perm, shared_consts.Permissions.Department.value)
- this.isTeacher = tools.isBitActive(this.my.perm, shared_consts.Permissions.Teacher.value)
- this.isEditor = tools.isBitActive(this.my.perm, shared_consts.Permissions.Editor.value)
- this.isCommerciale = tools.isBitActive(this.my.perm, shared_consts.Permissions.Commerciale.value)
- this.isGrafico = tools.isBitActive(this.my.perm, shared_consts.Permissions.Grafico.value)
-
- this.my.tokens = []
- this.resetArrToken(this.my.tokens)
- this.my.tokens.push({ access: 'auth', token: this.x_auth_token, refreshToken: this.refreshToken, data_login: tools.getDateNow() })
+ this.isAdmin = tools.isBitActive(
+ this.my.perm,
+ shared_consts.Permissions.Admin.value
+ );
+ this.isManager = tools.isBitActive(
+ this.my.perm,
+ shared_consts.Permissions.Manager.value
+ );
+ this.isFacilitatore = tools.isBitActive(
+ this.my.perm,
+ shared_consts.Permissions.Facilitatore.value
+ );
+ this.isZoomeri = tools.isBitActive(
+ this.my.perm,
+ shared_consts.Permissions.Zoomeri.value
+ );
+ this.isDepartment = tools.isBitActive(
+ this.my.perm,
+ shared_consts.Permissions.Department.value
+ );
+ this.isTeacher = tools.isBitActive(
+ this.my.perm,
+ shared_consts.Permissions.Teacher.value
+ );
+ this.isEditor = tools.isBitActive(
+ this.my.perm,
+ shared_consts.Permissions.Editor.value
+ );
+ this.isCommerciale = tools.isBitActive(
+ this.my.perm,
+ shared_consts.Permissions.Commerciale.value
+ );
+ this.isGrafico = tools.isBitActive(
+ this.my.perm,
+ shared_consts.Permissions.Grafico.value
+ );
+ this.my.tokens = [];
+ this.resetArrToken(this.my.tokens);
+ this.my.tokens.push({
+ access: 'auth',
+ token: this.x_auth_token,
+ refreshToken: this.refreshToken,
+ data_login: tools.getDateNow(),
+ });
} catch (e) {
- console.log('Error authUser: ' + e)
+ console.log('Error authUser: ' + e);
}
-
},
updateLocalStorage(myuser: IUserFields) {
try {
- const globalStore = useGlobalStore()
+ const globalStore = useGlobalStore();
- const now = tools.getDateNow()
+ const now = tools.getDateNow();
// const expirationDate = new Date(now.getTime() + myres.data.expiresIn * 1000);
- const expirationDate = new Date(now.getTime() * 1000)
- tools.localStSetItem(toolsext.localStorage.lang, this.lang)
- tools.localStSetItem(toolsext.localStorage.userId, myuser._id)
- tools.localStSetItem(toolsext.localStorage.username, myuser.username)
- tools.localStSetItem(toolsext.localStorage.name, myuser.name)
- tools.localStSetItem(toolsext.localStorage.surname, myuser.surname)
- tools.localStSetItem(toolsext.localStorage.perm, String(myuser.perm) || '')
- if (myuser.profile !== undefined) tools.localStSetItem(toolsext.localStorage.img, (myuser.profile.img) ? String(myuser.profile.img) || '' : '')
- else tools.localStSetItem(toolsext.localStorage.img, '')
- localStorage.setItem(toolsext.localStorage.token, this.x_auth_token)
+ const expirationDate = new Date(now.getTime() * 1000);
+ tools.localStSetItem(toolsext.localStorage.lang, this.lang);
+ tools.localStSetItem(toolsext.localStorage.userId, myuser._id);
+ tools.localStSetItem(toolsext.localStorage.username, myuser.username);
+ tools.localStSetItem(toolsext.localStorage.name, myuser.name);
+ tools.localStSetItem(toolsext.localStorage.surname, myuser.surname);
+ tools.localStSetItem(toolsext.localStorage.perm, String(myuser.perm) || '');
+ if (myuser.profile !== undefined)
+ tools.localStSetItem(
+ toolsext.localStorage.img,
+ myuser.profile.img ? String(myuser.profile.img) || '' : ''
+ );
+ else tools.localStSetItem(toolsext.localStorage.img, '');
+ localStorage.setItem(toolsext.localStorage.token, this.x_auth_token);
// console.log('updateLocalStorage: salva refreshtoken', this.refreshToken)
- localStorage.setItem(toolsext.localStorage.refreshToken, this.refreshToken)
- localStorage.setItem(toolsext.localStorage.expirationDate, expirationDate.toString())
- tools.localStSetItem(toolsext.localStorage.isLogged, String(true))
- tools.localStSetItem(toolsext.localStorage.verified_email, String(myuser.verified_email))
- tools.localStSetItem(toolsext.localStorage.verified_by_aportador, String(myuser.verified_by_aportador))
- tools.localStSetItem(toolsext.localStorage.teleg_id, String(myuser.profile.teleg_id))
- tools.localStSetItem(toolsext.localStorage.made_gift, String(myuser.made_gift))
- tools.localStSetItem(toolsext.localStorage.wasAlreadySubOnDb, String(globalStore.wasAlreadySubOnDb))
+ localStorage.setItem(toolsext.localStorage.refreshToken, this.refreshToken);
+ localStorage.setItem(
+ toolsext.localStorage.expirationDate,
+ expirationDate.toString()
+ );
+ tools.localStSetItem(toolsext.localStorage.isLogged, String(true));
+ tools.localStSetItem(
+ toolsext.localStorage.verified_email,
+ String(myuser.verified_email)
+ );
+ tools.localStSetItem(
+ toolsext.localStorage.verified_by_aportador,
+ String(myuser.verified_by_aportador)
+ );
+ tools.localStSetItem(
+ toolsext.localStorage.teleg_id,
+ String(myuser.profile.teleg_id)
+ );
+ tools.localStSetItem(toolsext.localStorage.made_gift, String(myuser.made_gift));
+ tools.localStSetItem(
+ toolsext.localStorage.wasAlreadySubOnDb,
+ String(globalStore.wasAlreadySubOnDb)
+ );
} catch (e) {
- console.error('updateLocalStorage', e)
+ console.error('updateLocalStorage', e);
}
},
setusersList(usersList: IUserFields[]) {
// console.log('setusersList', usersList)
// @ts-ignore
- this.usersList = [...usersList]
+ this.usersList = [...usersList];
},
setlang($q: any, router: Router, newstr: string) {
// console.log('SETLANG', newstr)
- this.lang = newstr
- tools.setLangAtt($q, router, newstr)
- tools.setLangAtt($q, router, newstr)
- tools.localStSetItem(toolsext.localStorage.lang, this.lang)
+ this.lang = newstr;
+ tools.setLangAtt($q, router, newstr);
+ tools.setLangAtt($q, router, newstr);
+ tools.localStSetItem(toolsext.localStorage.lang, this.lang);
},
signup(authData: ISignupOptions) {
- console.log('SIGNUP')
- const mylang = this.lang
- console.log('MYLANG: ' + mylang)
+ console.log('SIGNUP');
+ const mylang = this.lang;
+ console.log('MYLANG: ' + mylang);
- return bcrypt.hash(authData.password!, bcrypt.genSaltSync(12))
+ return bcrypt
+ .hash(authData.password!, bcrypt.genSaltSync(12))
.then((hashedPassword: string) => {
- authData.lang = mylang
- authData.password = String(hashedPassword)
+ authData.lang = mylang;
+ authData.password = String(hashedPassword);
- this.setServerCode(tools.CALLING)
+ this.setServerCode(tools.CALLING);
return Api.SendReq('/users', 'POST', authData)
.then((res) => {
-
- const newuser = res.data
+ const newuser = res.data;
// console.log('newuser', newuser)
- this.setServerCode(res.status)
+ this.setServerCode(res.status);
if (res.status === 200) {
if (import.meta.env.DEV) {
- console.log('USERNAME = ' + newuser.username)
- console.log('IDUSER= ' + newuser._id)
+ console.log('USERNAME = ' + newuser.username);
+ console.log('IDUSER= ' + newuser._id);
}
- this.authUser(newuser)
+ this.authUser(newuser);
- const now = tools.getDateNow()
+ const now = tools.getDateNow();
// const expirationDate = new Date(now.getTime() + myres.data.expiresIn * 1000);
- const expirationDate = new Date(now.getTime() * 1000)
- tools.localStSetItem(toolsext.localStorage.lang, this.lang)
- tools.localStSetItem(toolsext.localStorage.userId, newuser._id)
- tools.localStSetItem(toolsext.localStorage.username, newuser.username)
- tools.localStSetItem(toolsext.localStorage.name, newuser.name)
- tools.localStSetItem(toolsext.localStorage.surname, newuser.surname)
- localStorage.setItem(toolsext.localStorage.token, this.x_auth_token)
- localStorage.setItem(toolsext.localStorage.refreshToken, this.refreshToken)
- localStorage.setItem(toolsext.localStorage.expirationDate, expirationDate.toString())
- tools.localStSetItem(toolsext.localStorage.verified_email, String(false))
- tools.localStSetItem(toolsext.localStorage.verified_by_aportador, String(false))
+ const expirationDate = new Date(now.getTime() * 1000);
+ tools.localStSetItem(toolsext.localStorage.lang, this.lang);
+ tools.localStSetItem(toolsext.localStorage.userId, newuser._id);
+ tools.localStSetItem(toolsext.localStorage.username, newuser.username);
+ tools.localStSetItem(toolsext.localStorage.name, newuser.name);
+ tools.localStSetItem(toolsext.localStorage.surname, newuser.surname);
+ localStorage.setItem(toolsext.localStorage.token, this.x_auth_token);
+ localStorage.setItem(
+ toolsext.localStorage.refreshToken,
+ this.refreshToken
+ );
+ localStorage.setItem(
+ toolsext.localStorage.expirationDate,
+ expirationDate.toString()
+ );
+ tools.localStSetItem(toolsext.localStorage.verified_email, String(false));
+ tools.localStSetItem(
+ toolsext.localStorage.verified_by_aportador,
+ String(false)
+ );
// Even if you has registered, you have to SignIn first
- this.isLogged = false
+ this.isLogged = false;
// dispatch('storeUser', authData);
// dispatch('setLogoutTimer', myres.data.expiresIn);
- console.log('OK')
- return { code: tools.OK, msg: '' }
+ console.log('OK');
+ return { code: tools.OK, msg: '' };
} else {
- console.log('ERR GENERICO')
- return { code: toolsext.ERR_GENERICO, msg: '' }
+ console.log('ERR GENERICO');
+ return { code: toolsext.ERR_GENERICO, msg: '' };
}
})
.catch((error) => {
- console.log('Err', error)
- this.setErrorCatch(error)
- return { code: this.getServerCode, msg: this.getMsg }
- })
- })
+ console.log('Err', error);
+ this.setErrorCatch(error);
+ return { code: this.getServerCode, msg: this.getMsg };
+ });
+ });
},
UpdatePwd(x_auth_token: string, refreshToken: string) {
- this.x_auth_token = x_auth_token
- this.refreshToken = refreshToken
+ this.x_auth_token = x_auth_token;
+ this.refreshToken = refreshToken;
if (!this.my.tokens) {
- this.my.tokens = []
+ this.my.tokens = [];
}
- this.my.tokens.push({ access: 'auth', token: x_auth_token, refreshToken, data_login: tools.getDateNow() })
+ this.my.tokens.push({
+ access: 'auth',
+ token: x_auth_token,
+ refreshToken,
+ data_login: tools.getDateNow(),
+ });
},
setServerCode(num: number) {
- this.servercode = num
+ this.servercode = num;
},
setResStatus(status: number) {
- this.resStatus = status
+ this.resStatus = status;
},
setRefreshToken(refreshToken: string) {
- this.refreshToken = refreshToken
- localStorage.setItem(toolsext.localStorage.refreshToken, refreshToken)
+ this.refreshToken = refreshToken;
+ localStorage.setItem(toolsext.localStorage.refreshToken, refreshToken);
// console.log('setRefreshToken', refreshToken)
},
setAuth(x_auth_token: string, refreshToken: string) {
- this.x_auth_token = x_auth_token
- this.setRefreshToken(refreshToken)
+ this.x_auth_token = x_auth_token;
+ this.setRefreshToken(refreshToken);
},
resetArrToken(arrtokens: IToken[]) {
if (!arrtokens) {
- arrtokens = []
+ arrtokens = [];
}
// Take only the others access (from others Browser)
- return arrtokens.filter((token: IToken) => token.access !== 'auth')
+ return arrtokens.filter((token: IToken) => token.access !== 'auth');
},
async iscrivitiConacreis(authData: ISignupIscrizioneConacreisOptions) {
- console.log('iscrivitiConacreis')
+ console.log('iscrivitiConacreis');
- this.setServerCode(tools.CALLING)
+ this.setServerCode(tools.CALLING);
- authData.userId = this.my._id
+ authData.userId = this.my._id;
return Api.SendReq('/iscritti_conacreis', 'POST', authData)
.then((res) => {
if (res.status === 200) {
- return { code: serv_constants.RIS_ISCRIZIONE_OK, msg: '' }
+ return { code: serv_constants.RIS_ISCRIZIONE_OK, msg: '' };
} else {
- return { code: toolsext.ERR_GENERICO, msg: '' }
+ return { code: toolsext.ERR_GENERICO, msg: '' };
}
- }).catch((error) => {
- console.log('Err', error)
- this.setErrorCatch(error)
- return { code: this.getServerCode, msg: this.getMsg }
})
-
+ .catch((error) => {
+ console.log('Err', error);
+ this.setErrorCatch(error);
+ return { code: this.getServerCode, msg: this.getMsg };
+ });
},
async iscrivitiArcadei(authData: ISignupIscrizioneArcadeiOptions) {
- console.log('iscrivitiArcadei')
+ console.log('iscrivitiArcadei');
- this.setServerCode(tools.CALLING)
+ this.setServerCode(tools.CALLING);
- authData.userId = this.my._id
+ authData.userId = this.my._id;
return Api.SendReq('/iscritti_arcadei', 'POST', authData)
.then((res) => {
if (res.status === 200) {
- return { code: serv_constants.RIS_ISCRIZIONE_OK, msg: '' }
+ return { code: serv_constants.RIS_ISCRIZIONE_OK, msg: '' };
} else {
- return { code: toolsext.ERR_GENERICO, msg: '' }
+ return { code: toolsext.ERR_GENERICO, msg: '' };
}
- }).catch((error) => {
- console.log('Err', error)
- this.setErrorCatch(error)
- return { code: this.getServerCode, msg: this.getMsg }
})
-
+ .catch((error) => {
+ console.log('Err', error);
+ this.setErrorCatch(error);
+ return { code: this.getServerCode, msg: this.getMsg };
+ });
},
async signin(router: Router, authData: ISigninOptions) {
// console.log('LOGIN signin')
- const globalStore = useGlobalStore()
+ const globalStore = useGlobalStore();
const options = {
- title: tools.translate('notification.title_subscribed', [{
- strin: 'sitename',
- strout: translate('ws.sitename'),
- }]),
+ title: tools.translate('notification.title_subscribed', [
+ {
+ strin: 'sitename',
+ strout: translate('ws.sitename'),
+ },
+ ]),
content: translate('notification.subscribed'),
openUrl: '/',
- }
+ };
const usertosend = {
username: tools.rimuoviAtInizio(authData.username.trim()),
password: authData.password.trim(),
lang: this.lang,
options,
- }
+ };
if (import.meta.env.VITE_DEBUG === '1') {
- console.log(usertosend)
+ console.log(usertosend);
}
- this.setServerCode(tools.CALLING)
+ this.setServerCode(tools.CALLING);
- let myres: any
+ let myres: any;
// console.log('executing login...')
return await Api.SendReq('/users/login', 'POST', usertosend, true, false, 0)
.then((res) => {
-
- myres = res
+ myres = res;
if (myres.status !== 200) {
- return Promise.reject(toolsext.ERR_GENERICO)
+ return Promise.reject(toolsext.ERR_GENERICO);
}
- return myres
-
- }).then((res) => {
- console.log(' Login res', res)
+ return myres;
+ })
+ .then((res) => {
+ console.log(' Login res', res);
if (res.success) {
- globalStore.SetwasAlreadySubOnDb(res.data.subsExistonDb)
+ globalStore.SetwasAlreadySubOnDb(res.data.subsExistonDb);
- const myuser: IUserFields = res.data.usertosend
+ const myuser: IUserFields = res.data.usertosend;
if (myuser) {
// console.table(myuser)
- this.authUser(myuser)
+ this.authUser(myuser);
- this.updateLocalStorage(myuser)
+ this.updateLocalStorage(myuser);
// globalStore.loadSite()
-
}
}
- return tools.OK
-
- }).then((code) => {
+ return tools.OK;
+ })
+ .then((code) => {
if (code === tools.OK) {
- return this.setGlobal(router, true)
- .then(() => {
- return code
- })
+ return this.setGlobal(router, true).then(() => {
+ return code;
+ });
} else {
- return code
+ return code;
}
})
.catch((error) => {
- console.log('error', error)
- this.setErrorCatch(error)
- return this.getServerCode
- })
+ console.log('error', error);
+ this.setErrorCatch(error);
+ return this.getServerCode;
+ });
},
async logout() {
- const globalStore = useGlobalStore()
+ const globalStore = useGlobalStore();
+ console.log('logout');
- console.log('logout')
-
- localStorage.removeItem(toolsext.localStorage.expirationDate)
- localStorage.removeItem(toolsext.localStorage.token)
- localStorage.removeItem(toolsext.localStorage.userId)
- localStorage.removeItem(toolsext.localStorage.username)
- localStorage.removeItem(toolsext.localStorage.name)
- localStorage.removeItem(toolsext.localStorage.surname)
- localStorage.removeItem(toolsext.localStorage.img)
- localStorage.removeItem(toolsext.localStorage.perm)
- localStorage.removeItem(toolsext.localStorage.isLogged)
+ localStorage.removeItem(toolsext.localStorage.expirationDate);
+ localStorage.removeItem(toolsext.localStorage.token);
+ localStorage.removeItem(toolsext.localStorage.userId);
+ localStorage.removeItem(toolsext.localStorage.username);
+ localStorage.removeItem(toolsext.localStorage.name);
+ localStorage.removeItem(toolsext.localStorage.surname);
+ localStorage.removeItem(toolsext.localStorage.img);
+ localStorage.removeItem(toolsext.localStorage.perm);
+ localStorage.removeItem(toolsext.localStorage.isLogged);
// localStorage.removeItem(rescodes.localStorage.leftDrawerOpen)
- localStorage.removeItem(toolsext.localStorage.verified_email)
- localStorage.removeItem(toolsext.localStorage.verified_by_aportador)
- localStorage.removeItem(toolsext.localStorage.teleg_id)
- localStorage.removeItem(toolsext.localStorage.made_gift)
- localStorage.removeItem(toolsext.localStorage.categorySel)
- localStorage.removeItem(toolsext.localStorage.wasAlreadySubOnDb)
+ localStorage.removeItem(toolsext.localStorage.verified_email);
+ localStorage.removeItem(toolsext.localStorage.verified_by_aportador);
+ localStorage.removeItem(toolsext.localStorage.teleg_id);
+ localStorage.removeItem(toolsext.localStorage.made_gift);
+ localStorage.removeItem(toolsext.localStorage.categorySel);
+ localStorage.removeItem(toolsext.localStorage.wasAlreadySubOnDb);
- this.isLogged = false
- this.my = { ...DefaultUser }
+ this.isLogged = false;
+ this.my = { ...DefaultUser };
- await globalStore.clearDataAfterLogout()
+ await globalStore.clearDataAfterLogout();
- tools.checkApp()
+ tools.checkApp();
return Api.SendReq('/users/me/token', 'DELETE', null)
.then((res) => {
- console.log(res)
- }).then(() => this.clearAuthData()).catch((error) => {
- this.setErrorCatch(error)
- return this.getServerCode
+ console.log(res);
})
+ .then(() => this.clearAuthData())
+ .catch((error) => {
+ this.setErrorCatch(error);
+ return this.getServerCode;
+ });
},
async setGlobal(router: Router, isLogged: boolean) {
+ const globalStore = useGlobalStore();
- const globalStore = useGlobalStore()
+ console.log('setGlobal (logged=', isLogged, ')', globalStore.getServerHost());
- console.log('setGlobal (logged=', isLogged, ')', globalStore.getServerHost())
-
- const todos = useTodoStore()
- const projects = useProjectStore()
+ const todos = useTodoStore();
+ const projects = useProjectStore();
try {
// this.isLogged = true
@@ -1542,111 +1708,107 @@ export const useUserStore = defineStore('UserStore', {
//if (!tools.isMobile)
// globalStore.setleftDrawerOpen(localStorage.getItem(toolsext.localStorage.leftDrawerOpen) === 'true')
- globalStore.setCategorySel(localStorage.getItem(toolsext.localStorage.categorySel))
+ globalStore.setCategorySel(
+ localStorage.getItem(toolsext.localStorage.categorySel)
+ );
- await globalStore.checkUpdates()
+ await globalStore.checkUpdates();
}
- const { isok, stop, code } = await globalStore.loadLoginSite(router)
+ const { isok, stop, code } = await globalStore.loadLoginSite(router);
- this.isLogged = isok && isLogged && !stop
+ this.isLogged = isok && isLogged && !stop;
if (!stop) {
-
-
- await globalStore.loadAfterLogin()
+ await globalStore.loadAfterLogin();
// console.log('this.isLogged', this.isLogged, 'isok', isok, 'isLogged', isLogged)
if (globalStore.site.confpages && globalStore.site.confpages.enableTodos)
- await todos.dbLoad({ checkPending: true })
+ await todos.dbLoad({ checkPending: true });
if (globalStore.site.confpages?.enableProj)
- await projects.dbLoad({ checkPending: true, onlyiffirsttime: true })
+ await projects.dbLoad({ checkPending: true, onlyiffirsttime: true });
- globalStore.addDynamicPages(router)
+ globalStore.addDynamicPages(router);
- static_data.lang_available = globalStore.getLangAvailable()
+ static_data.lang_available = globalStore.getLangAvailable();
- static_data.arrLangUsed = tools.getLangUsed()
+ static_data.arrLangUsed = tools.getLangUsed();
// console.log('$router', $router)
// document.dispatchEvent(new Event('custom-post-render-event'))
}
- globalStore.finishLoading = true
- if (tools.isDebug()) console.log('finishLoading', globalStore.finishLoading)
-
- return { code }
+ globalStore.finishLoading = true;
+ if (tools.isDebug()) console.log('finishLoading', globalStore.finishLoading);
+ return { code };
} catch (e) {
- console.error('Error', e)
- globalStore.finishLoading = true
+ console.error('Error', e);
+ globalStore.finishLoading = true;
}
- return true
+ return true;
// console.log('setGlobal: END')
},
async autologin_FromLocalStorage(router: Router, $q: any) {
try {
- const globalStore = useGlobalStore()
+ const globalStore = useGlobalStore();
// console.log('*** autologin_FromLocalStorage ***')
// INIT
- let isLogged = false
+ let isLogged = false;
- this.lang = tools.getItemLS(toolsext.localStorage.lang)
+ this.lang = tools.getItemLS(toolsext.localStorage.lang);
- const token = localStorage.getItem(toolsext.localStorage.token)
- let refreshToken = localStorage.getItem(toolsext.localStorage.refreshToken)
- if (!refreshToken)
- refreshToken = ''
+ const token = localStorage.getItem(toolsext.localStorage.token);
+ let refreshToken = localStorage.getItem(toolsext.localStorage.refreshToken);
+ if (!refreshToken) refreshToken = '';
if (token) {
- this.setAuth(token, refreshToken)
+ this.setAuth(token, refreshToken);
if (globalStore.site.confpages?.enableTokenExpired) {
if (token && refreshToken) {
- isLogged = true
+ isLogged = true;
} else {
if (token) {
- isLogged = true
+ isLogged = true;
}
}
} else {
if (token) {
- isLogged = true
+ isLogged = true;
}
}
} else {
- isLogged = tools.isLogged()
+ isLogged = tools.isLogged();
}
- return await this.setGlobal(router, isLogged)
- .then((loadstorage: any) => {
- // console.log('RISULT setGlobal:', loadstorage)
- if (loadstorage.code === 200) {
- globalroutines('loadapp', '')
-
- // Create Subscription to Push Notification
- globalStore.createPushSubscription()
- }
- return loadstorage
- })
+ return await this.setGlobal(router, isLogged).then((loadstorage: any) => {
+ // console.log('RISULT setGlobal:', loadstorage)
+ if (loadstorage.code === 200) {
+ globalroutines('loadapp', '');
+ // Create Subscription to Push Notification
+ globalStore.createPushSubscription();
+ }
+ return loadstorage;
+ });
} catch (e: any) {
- console.error('ERR autologin ', e.message)
- return false
+ console.error('ERR autologin ', e.message);
+ return false;
}
},
- async loadUserProfile({ username, idnotif }: { username: string, idnotif?: string }) {
+ async loadUserProfile({ username, idnotif }: { username: string; idnotif?: string }) {
const data = {
username,
- idnotif
- }
+ idnotif,
+ };
return await Api.SendReq('/users/profile', 'POST', data)
.then((ris) => {
@@ -1654,18 +1816,24 @@ export const useUserStore = defineStore('UserStore', {
// this.updateDataFr(ris.data.friends)
}
- return ris.data.user
- }).catch((error) => {
- return {}
+ return ris.data.user;
})
-
+ .catch((error) => {
+ return {};
+ });
},
- async loadUserActivities({ username, idnotif }: { username: string, idnotif?: string }) {
+ async loadUserActivities({
+ username,
+ idnotif,
+ }: {
+ username: string;
+ idnotif?: string;
+ }) {
const data = {
username,
- idnotif
- }
+ idnotif,
+ };
return await Api.SendReq('/users/activities', 'POST', data)
.then((ris) => {
@@ -1673,568 +1841,681 @@ export const useUserStore = defineStore('UserStore', {
// this.updateDataFr(ris.data.friends)
}
- return ris.data.user
- }).catch((error) => {
- return {}
+ return ris.data.user;
})
-
+ .catch((error) => {
+ return {};
+ });
},
async setUserNotifs(notifs: IUserNotifType[]) {
const data = {
- notifs
- }
+ notifs,
+ };
return Api.SendReq('/users/notifs', 'POST', data)
.then((ris) => {
- return ris.data
- }).catch((error) => {
- return {}
+ return ris.data;
})
-
-
+ .catch((error) => {
+ return {};
+ });
},
async loadUserPanel(username: string) {
const data = {
- username
- }
+ username,
+ };
return Api.SendReq('/users/panel', 'POST', data)
.then((ris) => {
- console.log('out:', ris)
- return ris.data
- }).catch((error) => {
- return {}
+ console.log('out:', ris);
+ return ris.data;
})
-
+ .catch((error) => {
+ return {};
+ });
},
async setUserReceiveRIS(username: string, groupname: string) {
const data = {
username,
groupname,
- }
+ };
return Api.SendReq('/users/receiveris', 'POST', data)
.then((ris) => {
- console.log('out:', ris)
- return ris.data
- }).catch((error) => {
- return {}
+ console.log('out:', ris);
+ return ris.data;
})
-
+ .catch((error) => {
+ return {};
+ });
},
async seListLinkReg(username: string, groupname: string) {
const data = {
username,
groupname,
- }
+ };
return Api.SendReq('/users/listlinkreg', 'POST', data)
.then((ris) => {
- console.log('out:', ris)
- return ris.data
- }).catch((error) => {
- return {}
+ console.log('out:', ris);
+ return ris.data;
})
-
+ .catch((error) => {
+ return {};
+ });
},
async loadGroup(groupname: string, idnotif: string) {
const data = {
groupname,
idnotif,
- }
+ };
return Api.SendReq('/mygroup/load', 'POST', data)
.then((res) => {
- return { data: res.data, status: res.status }
- }).catch((error) => {
- return { data: null, status: error.status }
+ return { data: res.data, status: res.status };
})
-
+ .catch((error) => {
+ return { data: null, status: error.status };
+ });
},
async loadCircuit(path: string, idnotif: string) {
- const notifStore = useNotifStore()
+ const notifStore = useNotifStore();
const data = {
path,
idnotif,
lastdr: notifStore.getLastDataRead(this.my.username),
- }
+ };
return Api.SendReq('/circuit/load', 'POST', data)
.then((res) => {
- this.my.profile.last_circuitpath = path
+ this.my.profile.last_circuitpath = path;
if (res && res.data.arrrecnotif) {
- notifStore.updateArrRecNotifFromServer(res.data.arrrecnotif)
+ notifStore.updateArrRecNotifFromServer(res.data.arrrecnotif);
}
if (res && res.data.arrrecnotifcoins) {
- notifStore.updateArrRecNotifCoinsFromServer(res.data.arrrecnotifcoins)
+ notifStore.updateArrRecNotifCoinsFromServer(res.data.arrrecnotifcoins);
}
if (res.data.useraccounts && res.data.useraccounts.length > 0) {
- this.my.profile.useraccounts = res.data.useraccounts
+ this.my.profile.useraccounts = res.data.useraccounts;
}
- return { data: res.data, status: res.status }
- }).catch((error) => {
- return { data: null, status: error.status }
+ return { data: res.data, status: res.status };
})
-
+ .catch((error) => {
+ return { data: null, status: error.status };
+ });
},
async loadSkill(idSkill: string) {
const data = {
- idSkill
- }
+ idSkill,
+ };
return Api.SendReq('/myskills/page', 'POST', data)
.then((res) => {
- console.log('res.data', res)
- return res.data
- }).catch((error) => {
- return {}
+ console.log('res.data', res);
+ return res.data;
})
-
+ .catch((error) => {
+ return {};
+ });
},
async loadGeneric(table: string, id: any, idnotif: string) {
const data = {
table,
id,
- idnotif
- }
+ idnotif,
+ };
return Api.SendReq('/mygen/page', 'POST', data)
.then((res) => {
- return res.data
- }).catch((error) => {
- console.error('err', error)
- return null
+ return res.data;
})
-
+ .catch((error) => {
+ console.error('err', error);
+ return null;
+ });
},
updateDataFr(data: any) {
// console.log('updateDataFr', data)
- this.my.profile.friends = data.listFriends ? data.listFriends : []
- this.my.profile.req_friends = data.listRequestFriends ? data.listRequestFriends : []
- this.my.profile.asked_friends = data.listSentRequestFriends ? data.listSentRequestFriends : []
+ this.my.profile.friends = data.listFriends ? data.listFriends : [];
+ this.my.profile.req_friends = data.listRequestFriends
+ ? data.listRequestFriends
+ : [];
+ this.my.profile.asked_friends = data.listSentRequestFriends
+ ? data.listSentRequestFriends
+ : [];
- this.my.profile.handshake = data.listHandShake ? data.listHandShake : []
+ this.my.profile.handshake = data.listHandShake ? data.listHandShake : [];
},
async loadFriends() {
return Api.SendReq('/users/friends', 'POST', null)
.then((ris) => {
- this.updateDataFr(ris.data)
- return ris.data
- }).catch((error) => {
- return {}
+ this.updateDataFr(ris.data);
+ return ris.data;
})
-
+ .catch((error) => {
+ return {};
+ });
},
async loadGroups(username: string) {
return Api.SendReq('/users/groups', 'POST', null)
.then((res) => {
- return res.data
- }).catch((error) => {
- return {}
+ return res.data;
})
-
+ .catch((error) => {
+ return {};
+ });
},
async loadCircuits(nummovTodownload: number) {
return Api.SendReq('/users/circuits', 'POST', { nummovTodownload })
.then((res) => {
- return res.data
- }).catch((error) => {
- return {}
+ return res.data;
})
-
+ .catch((error) => {
+ return {};
+ });
},
async loadAllAccounts() {
return Api.SendReq('/account/loadall', 'POST', null)
.then((res) => {
- return res.data
- }).catch((error) => {
- return {}
+ return res.data;
})
-
+ .catch((error) => {
+ return {};
+ });
},
- async setFriendsCmd($q: any, t: any, usernameOrig: string, usernameDest: string, cmd: number, value: any) {
- return Api.SendReq('/users/friends/cmd', 'POST', { usernameOrig, usernameDest, cmd, value })
+ async setFriendsCmd(
+ $q: any,
+ t: any,
+ usernameOrig: string,
+ usernameDest: string,
+ cmd: number,
+ value: any
+ ) {
+ return Api.SendReq('/users/friends/cmd', 'POST', {
+ usernameOrig,
+ usernameDest,
+ cmd,
+ value,
+ })
.then((res) => {
- this.updateTables = true
- return res.data
- }).catch((error) => {
- tools.showNegativeNotif($q, t('db.recfailed'))
- return {}
+ this.updateTables = true;
+ return res.data;
})
-
+ .catch((error) => {
+ tools.showNegativeNotif($q, t('db.recfailed'));
+ return {};
+ });
},
- async setGroupsCmd($q: any, t: any, usernameOrig: string, groupnameDest: string, cmd: number, value: any) {
- return Api.SendReq('/users/groups/cmd', 'POST', { usernameOrig, groupnameDest, cmd, value })
+ async setGroupsCmd(
+ $q: any,
+ t: any,
+ usernameOrig: string,
+ groupnameDest: string,
+ cmd: number,
+ value: any
+ ) {
+ return Api.SendReq('/users/groups/cmd', 'POST', {
+ usernameOrig,
+ groupnameDest,
+ cmd,
+ value,
+ })
.then((res) => {
- this.updateTables = true
- return res.data
- }).catch((error) => {
- tools.showNegativeNotif($q, t('db.recfailed'))
- return {}
+ this.updateTables = true;
+ return res.data;
})
-
+ .catch((error) => {
+ tools.showNegativeNotif($q, t('db.recfailed'));
+ return {};
+ });
},
- async setSendCmd($q: any, t: any, usernameOrig: string, usernameDest: string, cmd: number, value: any) {
- return Api.SendReq('/users/sendcmd', 'POST', { usernameOrig, usernameDest, cmd, value })
+ async setSendCmd(
+ $q: any,
+ t: any,
+ usernameOrig: string,
+ usernameDest: string,
+ cmd: number,
+ value: any
+ ) {
+ return Api.SendReq('/users/sendcmd', 'POST', {
+ usernameOrig,
+ usernameDest,
+ cmd,
+ value,
+ })
.then((res) => {
- this.updateTables = true
+ this.updateTables = true;
// const notifStore = useNotifStore()
// notifStore.updateNotification = true
- return res.data
- }).catch((error) => {
- tools.showNegativeNotif($q, t('db.recfailed'))
- return {}
+ return res.data;
})
-
+ .catch((error) => {
+ tools.showNegativeNotif($q, t('db.recfailed'));
+ return {};
+ });
},
- async setCircuitCmd($q: any, t: any, usernameOrig: string, circuitname: string, cmd: number, value: any, extrarec?: any) {
- return await Api.SendReq('/users/circuits/cmd', 'POST', { usernameOrig, circuitname, cmd, value, extrarec }, false, false, 0)
+ async setCircuitCmd(
+ $q: any,
+ t: any,
+ usernameOrig: string,
+ circuitname: string,
+ cmd: number,
+ value: any,
+ extrarec?: any
+ ) {
+ return await Api.SendReq(
+ '/users/circuits/cmd',
+ 'POST',
+ { usernameOrig, circuitname, cmd, value, extrarec },
+ false,
+ false,
+ 0
+ )
.then((res) => {
- this.updateTables = true
- const notifStore = useNotifStore()
+ this.updateTables = true;
+ const notifStore = useNotifStore();
if (res.data.recnotif) {
if (res.data.recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS) {
- notifStore.updateRecNotifCoins(res.data.recnotif)
- notifStore.updateArrRecNotifCoinsFromServer(res.data.arrrecnotifcoins)
+ notifStore.updateRecNotifCoins(res.data.recnotif);
+ notifStore.updateArrRecNotifCoinsFromServer(res.data.arrrecnotifcoins);
} else {
- notifStore.updateRecNotif(res.data.recnotif)
- notifStore.updateArrRecNotifFromServer(res.data.arrrecnotif)
+ notifStore.updateRecNotif(res.data.recnotif);
+ notifStore.updateArrRecNotifFromServer(res.data.arrrecnotif);
}
}
- return res.data
- }).catch((error) => {
- tools.showNegativeNotif($q, t('db.recfailed'))
- return {}
+ return res.data;
})
-
+ .catch((error) => {
+ tools.showNegativeNotif($q, t('db.recfailed'));
+ return {};
+ });
},
- async sendMsgToBotTelegram($q: any, t: any, mydata: IMsgGlobParam, showmsgsent: boolean) {
- const globalStore = useGlobalStore()
+ async sendMsgToBotTelegram(
+ $q: any,
+ t: any,
+ mydata: IMsgGlobParam,
+ showmsgsent: boolean
+ ) {
+ const globalStore = useGlobalStore();
return Api.SendReq('/users/mgt', 'POST', { mydata })
.then((res) => {
- console.log('res', res)
+ console.log('res', res);
- let msgok = (res.data.nummsgsent === 1) ? res.data.nummsgsent + ' ' + t('cal.sendmsg_sent') : res.data.nummsgsent + ' ' + t('cal.sendmsgs_sent')
+ let msgok =
+ res.data.nummsgsent === 1
+ ? res.data.nummsgsent + ' ' + t('cal.sendmsg_sent')
+ : res.data.nummsgsent + ' ' + t('cal.sendmsgs_sent');
if (mydata.cmd === shared_consts.MsgTeleg.SHARE_MSGREG) {
if (tools.isTelegOk()) {
- msgok = t('cal.sendmsg_sent_sharedlink') + ' ' + tools.getBotName()
+ msgok = t('cal.sendmsg_sent_sharedlink') + ' ' + tools.getBotName();
} else {
- msgok = t('cal.sendmsg_sent_sharedlink_copied')
+ msgok = t('cal.sendmsg_sent_sharedlink_copied');
}
- showmsgsent = true
+ showmsgsent = true;
}
if (showmsgsent && res.data.nummsgsent >= 0) {
- tools.showPositiveNotif($q, msgok)
+ tools.showPositiveNotif($q, msgok);
if (mydata.cmd === shared_consts.MsgTeleg.SHARE_MSGREG) {
if (!tools.isTelegOk()) {
// console.log('text', res.data.text)
- tools.copyStringToClipboardSilent(res.data.text)
+ tools.copyStringToClipboardSilent(res.data.text);
}
if (res.data.textsent) {
- return res.data.textsent
+ return res.data.textsent;
}
}
- return true
+ return true;
}
- return false
- }).catch((error) => {
- tools.showNegativeNotif($q, t('cal.err_sendmsg'))
- return {}
+ return false;
})
+ .catch((error) => {
+ tools.showNegativeNotif($q, t('cal.err_sendmsg'));
+ return {};
+ });
},
- async importToServerCmd($q: any, t: any, cmd: number, data: any, recorddaimportare: boolean = false) {
+ async importToServerCmd(
+ $q: any,
+ t: any,
+ cmd: number,
+ data: any,
+ recorddaimportare: boolean = false
+ ) {
$q.loading.show({
- message: 'Importazione in corso, attendere ...'
- })
+ message: 'Importazione in corso, attendere ...',
+ });
return Api.SendReq('/admin/import', 'POST', { cmd, data })
.then((res: any) => {
if (res) {
- let msg = ''
+ let msg = '';
if (res.data.imported) {
- msg += ' ' + t('db.records_imported', { num: res.data.imported })
+ msg += ' ' + t('db.records_imported', { num: res.data.imported });
}
if (res.data.errors) {
- msg += ' ' + t('db.records_errors', { num: res.data.errors })
+ msg += ' ' + t('db.records_errors', { num: res.data.errors });
}
if (res.data.updated) {
- msg += ' ' + t('db.records_updated', { num: res.data.updated })
+ msg += ' ' + t('db.records_updated', { num: res.data.updated });
}
if (!msg) {
if (recorddaimportare) {
- msg += ' ' + t('db.records_imported', { num: 0 })
- tools.showNegativeNotif($q, msg)
+ msg += ' ' + t('db.records_imported', { num: 0 });
+ tools.showNegativeNotif($q, msg);
} else {
- msg = t('db.recupdated')
- tools.showPositiveNotif($q, msg)
+ msg = t('db.recupdated');
+ tools.showPositiveNotif($q, msg);
}
} else {
- tools.showPositiveNotif($q, msg)
+ tools.showPositiveNotif($q, msg);
}
-
}
- $q.loading.hide()
- }).catch((error) => {
- $q.loading.hide()
- tools.showNegativeNotif($q, t('db.recfailed'))
- return {}
+ $q.loading.hide();
})
-
+ .catch((error) => {
+ $q.loading.hide();
+ tools.showNegativeNotif($q, t('db.recfailed'));
+ return {};
+ });
},
async setFavorite($q: any, t: any, id: any, table: string, myrec: any) {
- let value = false
+ let value = false;
- console.log('table', table)
- const tab = tools.getNumTabByTable(table)
+ console.log('table', table);
+ const tab = tools.getNumTabByTable(table);
- const recreaction = this.getRecReaction(id, table)
- value = this.isFavorite(id, table) ? false : true
+ const recreaction = this.getRecReaction(id, table);
+ value = this.isFavorite(id, table) ? false : true;
- return await Api.SendReq('/reactions/cmd', 'POST', { cmd: CMD_REACTION.SET_FAVORITE, id, tab, value })
+ return await Api.SendReq('/reactions/cmd', 'POST', {
+ cmd: CMD_REACTION.SET_FAVORITE,
+ id,
+ tab,
+ value,
+ })
.then((res) => {
if (res && res.data.state === 1) {
if (myrec) {
if (!myrec.numfav) {
- myrec.numfav = 0
+ myrec.numfav = 0;
}
if (!recreaction)
- this.my.profile.reaction.push({ id: objectId(), idrec: id, tab, username: this.my.username, fav: true })
- else
- recreaction.fav = true;
+ this.my.profile.reaction.push({
+ id: objectId(),
+ idrec: id,
+ tab,
+ username: this.my.username,
+ fav: true,
+ });
+ else recreaction.fav = true;
- myrec.numfav++
+ myrec.numfav++;
}
- tools.showPositiveNotif($q, t('cmd.favorite_set'))
+ tools.showPositiveNotif($q, t('cmd.favorite_set'));
} else if (res && res.data.state === -1) {
// this.my.profile.favorite = tools.removeIObjectOnce(this.my.profile.favorite, { id, tab })
if (myrec && myrec.numfav) {
- myrec.numfav--
+ myrec.numfav--;
//this.my.profile.reaction = this.my.profile.reaction.filter((rec: IReaction) => !((rec.idrec === id) && (rec.tab === tab) && (rec.username === this.my.username) && (rec.fav === true)))
- if (recreaction)
- recreaction.fav = false
+ if (recreaction) recreaction.fav = false;
}
- tools.showNegativeNotif($q, t('cmd.favorite_unset'))
+ tools.showNegativeNotif($q, t('cmd.favorite_unset'));
}
- }).catch((error) => {
- tools.showNegativeNotif($q, t('db.recfailed'))
- return {}
})
-
+ .catch((error) => {
+ tools.showNegativeNotif($q, t('db.recfailed'));
+ return {};
+ });
},
async setAttend($q: any, t: any, id: any, table: string, num: number, myrec: any) {
- let value = false
+ let value = false;
- console.log('table', table)
- const tab = tools.getNumTabByTable(table)
+ console.log('table', table);
+ const tab = tools.getNumTabByTable(table);
- const recreaction = this.getRecReaction(id, table)
- value = this.isAttend(id, table) ? false : true
+ const recreaction = this.getRecReaction(id, table);
+ value = this.isAttend(id, table) ? false : true;
- return await Api.SendReq('/reactions/cmd', 'POST', { cmd: CMD_REACTION.SET_ATTEND, id, tab, value })
+ return await Api.SendReq('/reactions/cmd', 'POST', {
+ cmd: CMD_REACTION.SET_ATTEND,
+ id,
+ tab,
+ value,
+ })
.then((res) => {
if (res && res.data.state === 1) {
if (!myrec.numattend) {
- myrec.numattend = 0
+ myrec.numattend = 0;
}
- if (!myrec.myreact.attend)
- myrec.myreact.attend = false
+ if (!myrec.myreact.attend) myrec.myreact.attend = false;
// create a record
//++ this.my.profile.reaction.push({ id, tab, attend: true })
if (myrec) {
if (!recreaction)
- this.my.profile.reaction.push({ id: objectId(), idrec: id, tab, username: this.my.username, attend: true })
- else
- recreaction.attend = true
+ this.my.profile.reaction.push({
+ id: objectId(),
+ idrec: id,
+ tab,
+ username: this.my.username,
+ attend: true,
+ });
+ else recreaction.attend = true;
}
- tools.showPositiveNotif($q, t('cmd.attend_set'))
+ tools.showPositiveNotif($q, t('cmd.attend_set'));
} else if (res && res.data.state === -1) {
//++ this.my.profile.attend = tools.removeIObjectOnce(this.my.profile.attend, { id, tab })
- if (myrec && myrec.myattend && recreaction)
- recreaction.attend = false
- tools.showNegativeNotif($q, t('cmd.attend_unset'))
+ if (myrec && myrec.myattend && recreaction) recreaction.attend = false;
+ tools.showNegativeNotif($q, t('cmd.attend_unset'));
}
- }).catch((error) => {
- tools.showNegativeNotif($q, t('db.recfailed'))
- return {}
})
-
+ .catch((error) => {
+ tools.showNegativeNotif($q, t('db.recfailed'));
+ return {};
+ });
},
getRecReaction(id: string, table: string) {
- const tab = tools.getNumTabByTable(table)
- const myrec = this.my.profile.reaction.find((rec: IReaction) => ((rec.idrec === id) && (rec.tab === tab)))
- return myrec
+ const tab = tools.getNumTabByTable(table);
+ const myrec = this.my.profile.reaction.find(
+ (rec: IReaction) => rec.idrec === id && rec.tab === tab
+ );
+ return myrec;
},
isSeen(id: string, table: string) {
- const myrec = this.getRecReaction(id, table)
- return myrec ? myrec.seen : false
+ const myrec = this.getRecReaction(id, table);
+ return myrec ? myrec.seen : false;
},
isBookmarked(id: string, table: string) {
- const myrec = this.getRecReaction(id, table)
- return myrec ? myrec.book : false
+ const myrec = this.getRecReaction(id, table);
+ return myrec ? myrec.book : false;
},
isFavorite(id: string, table: string) {
- const myrec = this.getRecReaction(id, table)
- return myrec ? myrec.fav : false
+ const myrec = this.getRecReaction(id, table);
+ return myrec ? myrec.fav : false;
},
isAttend(id: string, table: string) {
- const myrec = this.getRecReaction(id, table)
- return myrec ? myrec.attend : false
+ const myrec = this.getRecReaction(id, table);
+ return myrec ? myrec.attend : false;
},
async setBookmark($q: any, t: any, id: any, table: string, myrec: any) {
- let value = false
+ let value = false;
- const tab = tools.getNumTabByTable(table)
+ const tab = tools.getNumTabByTable(table);
- const recreaction = this.getRecReaction(id, table)
- value = this.isBookmarked(id, table) ? false : true
+ const recreaction = this.getRecReaction(id, table);
+ value = this.isBookmarked(id, table) ? false : true;
- return await Api.SendReq('/reactions/cmd', 'POST', { cmd: CMD_REACTION.SET_BOOKMARK, id, tab, value })
+ return await Api.SendReq('/reactions/cmd', 'POST', {
+ cmd: CMD_REACTION.SET_BOOKMARK,
+ id,
+ tab,
+ value,
+ })
.then((res) => {
if (res && res.data.state === 1) {
if (!myrec.numbook) {
- myrec.numbook = 0
+ myrec.numbook = 0;
}
- if (!myrec.mybook)
- myrec.mybook = []
+ if (!myrec.mybook) myrec.mybook = [];
if (!recreaction)
- this.my.profile.reaction.push({ id: objectId(), idrec: id, tab, username: this.my.username, book: true })
- else
- recreaction.book = true
+ this.my.profile.reaction.push({
+ id: objectId(),
+ idrec: id,
+ tab,
+ username: this.my.username,
+ book: true,
+ });
+ else recreaction.book = true;
- myrec.numbook++
- tools.showPositiveNotif($q, t('cmd.bookmark_set'))
+ myrec.numbook++;
+ tools.showPositiveNotif($q, t('cmd.bookmark_set'));
} else if (res && res.data.state === -1) {
//++ this.my.profile.reaction = tools.removeIObjectOnce(this.my.profile.reaction, { id, tab, })
- if ((myrec && myrec.mybook) && recreaction)
- recreaction.book = false
- myrec.numbook--
+ if (myrec && myrec.mybook && recreaction) recreaction.book = false;
+ myrec.numbook--;
//myrec.mybook = myrec.mybook.filter((rec: IFavBook) => rec.username !== this.my.username)
- tools.showNegativeNotif($q, t('cmd.bookmark_unset'))
+ tools.showNegativeNotif($q, t('cmd.bookmark_unset'));
}
- }).catch((error) => {
- console.error('error', error)
- tools.showNegativeNotif($q, t('db.recfailed'))
- return {}
})
-
+ .catch((error) => {
+ console.error('error', error);
+ tools.showNegativeNotif($q, t('db.recfailed'));
+ return {};
+ });
},
showButtonSendCoin(myuser: IUserFields) {
- const oldway = false
+ const oldway = false;
- const globalStore = useGlobalStore()
+ const globalStore = useGlobalStore();
- if (globalStore.site && (!globalStore.site.confpages?.showCoins && !globalStore.site.confpages?.showRIS)) {
- return false
+ if (
+ globalStore.site &&
+ !globalStore.site.confpages?.showCoins &&
+ !globalStore.site.confpages?.showRIS
+ ) {
+ return false;
}
- if (oldway)
- return this.getMyCircuitsInCommonByUser(myuser).length > 0
+ if (oldway) return this.getMyCircuitsInCommonByUser(myuser).length > 0;
- let yes = true
+ let yes = true;
if (this.my.profile && this.my.profile.mycircuits) {
-
// Check if I have at least 1 Circuit
- yes = yes && (this.my.profile.mycircuits.length > 0)
+ yes = yes && this.my.profile.mycircuits.length > 0;
if (myuser && myuser.profile && myuser.profile.mycircuits) {
// Check if myuser has at least 1 Circuit
- yes = yes && (myuser.profile.mycircuits.length > 0)
+ yes = yes && myuser.profile.mycircuits.length > 0;
}
}
- return true
+ return true;
// return yes
},
async setSeen($q: any, t: any, id: any, table: string, myrec: any) {
- let value = false
+ let value = false;
- const tab = tools.getNumTabByTable(table)
+ const tab = tools.getNumTabByTable(table);
- const recreaction = this.getRecReaction(id, table)
- value = this.isSeen(id, table) ? false : true
+ const recreaction = this.getRecReaction(id, table);
+ value = this.isSeen(id, table) ? false : true;
- return await Api.SendReq('/reactions/cmd', 'POST', { cmd: CMD_REACTION.SET_SEEN, id, tab, value })
+ return await Api.SendReq('/reactions/cmd', 'POST', {
+ cmd: CMD_REACTION.SET_SEEN,
+ id,
+ tab,
+ value,
+ })
.then((res) => {
if (res && res.data.state === 1) {
if (value) {
if (!myrec) {
myrec = {
numseen: 0,
- }
+ };
}
- myrec.numseen++
+ myrec.numseen++;
if (!recreaction)
- this.my.profile.reaction.push({ id: objectId(), idrec: id, tab, username: this.my.username, seen: true })
- else
- recreaction.seen = true
+ this.my.profile.reaction.push({
+ id: objectId(),
+ idrec: id,
+ tab,
+ username: this.my.username,
+ seen: true,
+ });
+ else recreaction.seen = true;
}
}
if (res && res.data) {
if (res.data.record) {
- return res.data.record
+ return res.data.record;
}
}
- return null
- }).catch((error) => {
- console.error('error', error)
- return null
+ return null;
})
-
+ .catch((error) => {
+ console.error('error', error);
+ return null;
+ });
},
isDateRegOld() {
try {
- const dateold = tools.addDays(tools.getDateNow(), -(30 * 6))
+ const dateold = tools.addDays(tools.getDateNow(), -(30 * 6));
if (this.my)
- return this.my.date_reg! && new Date(this.my.date_reg).getTime() < dateold.getTime()
- else
- return true
+ return (
+ this.my.date_reg! && new Date(this.my.date_reg).getTime() < dateold.getTime()
+ );
+ else return true;
} catch (e) {
- return false
+ return false;
}
},
+ async eseguiFunzSulServer(mydata: {}) {
+ return await this.execDbOp({ mydata }).then((ris) => {
+ return ris?.data;
+ });
+ },
+
async loadListaEditori() {
const globalStore = useGlobalStore();
if (!this.lista_editori) {
this.lista_editori = await globalStore.getObjOnServer('lista_editori');
}
- return this.lista_editori
+ return this.lista_editori;
},
-
},
-})
+});
diff --git a/src/store/globalStore.ts b/src/store/globalStore.ts
index 68ce525b..80dc0d9b 100644
--- a/src/store/globalStore.ts
+++ b/src/store/globalStore.ts
@@ -60,6 +60,7 @@ async function getConfig(id: any) {
export const useGlobalStore = defineStore('GlobalStore', {
state: (): IGlobalState => ({
+ showHeader: true,
finishLoading: false,
conta: 0,
wasAlreadySubscribed: false,
@@ -230,9 +231,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
myschedatocopy.scheda._id = origScheda.scheda?._id;
myschedatocopy.scheda.isTemplate = false;
myschedatocopy.scheda.name = precname;
- myschedatocopy.scheda.linkIdTemplatePerStampa =
- origScheda.scheda?.linkIdTemplatePerStampa;
myschedatocopy.scheda.linkIdTemplate = origScheda.scheda?.linkIdTemplate;
+ myschedatocopy.scheda.scalexscheda = origScheda.scheda?.scalexscheda;
+ myschedatocopy.scheda.scaleyscheda = origScheda.scheda?.scaleyscheda;
return myschedatocopy.scheda;
}
@@ -254,8 +255,6 @@ 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.linkIdTemplatePerStampa =
- origDimensioni.linkIdTemplatePerStampa;
myelemtocopy.catalogo.dimensioni_def.linkIdTemplate = origDimensioni.linkIdTemplate;
return myelemtocopy.catalogo;
@@ -273,19 +272,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
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;
+ const linkIdTemplate = myelemtocopy.catalogo.print_linkIdTemplate
myelemtocopy.catalogo.print_isTemplate = false;
- if (
- myelemtocopy.catalogo.selectedVersionStampabile === shared_consts.PREPARA_PDF.STAMPA
- )
- myelemtocopy.catalogo.print_linkIdTemplatePerStampa = linkIdTemplate;
- else {
- myelemtocopy.catalogo.print_linkIdTemplate = linkIdTemplate;
- }
+ myelemtocopy.catalogo.print_linkIdTemplate = linkIdTemplate;
return myelemtocopy.catalogo;
}
@@ -2615,6 +2604,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
createCatalogoVuoto(): IOptCatalogo {
return {
+ idCatalogSel: '',
productTypes: [0],
excludeproductTypes: [],
idTipologie: [],
@@ -2625,14 +2615,12 @@ 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 {
@@ -2647,14 +2635,12 @@ 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: '',
};
},
@@ -3086,5 +3072,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
}
} catch (e) {}
},
+ setshowHeader(value: boolean) {
+ this.showHeader = value
+ }
+
},
});
diff --git a/src/views/admin/dbopmacro/dbopmacro.vue b/src/views/admin/dbopmacro/dbopmacro.vue
index 8179aded..28e09516 100755
--- a/src/views/admin/dbopmacro/dbopmacro.vue
+++ b/src/views/admin/dbopmacro/dbopmacro.vue
@@ -8,23 +8,23 @@
-
+
+
+
+ isStampa: {{ isStampa }} generazionePDFInCorso:
+ {{ optcatalogo.generazionePDFInCorso }} getScaleX:
+ {{ tools.getScaleX(optcatalogo, recscheda.scheda) }} getScaleY:
+ {{ tools.getScaleY(optcatalogo, recscheda.scheda) }}
IMG:
- {{ getImgIntroCatalogo(recscheda.scheda) }}
+
+ {{ getImgIntroCatalogo(recscheda.scheda) }}
+
+
+ {{ getSfondoImgCatalogo(recscheda.scheda) }}
+
num: {{ page.length }}
@@ -1073,7 +1208,14 @@
>
diff --git a/src/views/ecommerce/raccoltacataloghi/raccoltacataloghi.scss b/src/views/ecommerce/raccoltacataloghi/raccoltacataloghi.scss
index a85711d1..3e09cb89 100755
--- a/src/views/ecommerce/raccoltacataloghi/raccoltacataloghi.scss
+++ b/src/views/ecommerce/raccoltacataloghi/raccoltacataloghi.scss
@@ -61,71 +61,71 @@ body {
font-family: 'DINPro-Condensed-Bold', sans-serif;
color: $colore_titolo_libro;
text-transform: uppercase;
- margin-top: calc(5 * var(--scalecatalog) * 1px);
- margin-bottom: calc(5 * var(--scalecatalog) * 1px);
- font-size: calc(18 * var(--scalecatalog) * 1px);
+ margin-top: calc(5 * var(--scalecatalogy) * 1px);
+ margin-bottom: calc(5 * var(--scalecatalogy) * 1px);
+ font-size: calc(18 * var(--scalecatalogx) * 1px);
line-height: 100%;
font-weight: bold;
}
.book-author {
font-family: 'DINPro-Condensed-Regular', sans-serif;
- font-size: calc(16 * var(--scalecatalog) * 1px);
+ font-size: calc(16 * var(--scalecatalogx) * 1px);
}
.book-descr {
font-family: 'DINPro-Condensed-Bold-Italic', sans-serif;
- font-size: calc(16 * var(--scalecatalog) * 1px);
+ font-size: calc(16 * var(--scalecatalogx) * 1px);
}
.book-details {
font-family: 'DINPro-Condensed-Regular', sans-serif;
- margin-bottom: calc(5 * var(--scalecatalog) * 1px);
- font-size: calc(16 * var(--scalecatalog) * 1px);
+ margin-bottom: calc(5 * var(--scalecatalogy) * 1px);
+ font-size: calc(16 * var(--scalecatalogx) * 1px);
text-align: left !important;
&.big {
- font-size: calc(22 * var(--scalecatalog) * 1px);
+ font-size: calc(22 * var(--scalecatalogx) * 1px);
}
}
.book-descr-estesa {
font-family: 'AGaramondPro-Regular', sans-serif;
- font-size: calc(15 * var(--scalecatalog) * 1px);
+ font-size: calc(15 * var(--scalecatalogx) * 1px);
text-align: justify;
word-wrap: break-word;
}
.book-link {
font-style: italic;
- font-size: calc(14 * var(--scalecatalog) * 1px);
+ font-size: calc(14 * var(--scalecatalogx) * 1px);
}
.book-novita {
- font-size: calc(20 * var(--scalecatalog) * 1px);
+ font-size: calc(20 * var(--scalecatalogx) * 1px);
}
.book-text-up {
font-family: 'DINPro', sans-serif;
- margin-bottom: calc(5 * var(--scalecatalog) * 1px);
- font-size: calc(20 * var(--scalecatalog) * 1px);
- height: calc(380 * var(--scalecatalog) * 1px);
+ margin-bottom: calc(5 * var(--scalecatalogy) * 1px);
+ font-size: calc(20 * var(--scalecatalogx) * 1px);
+ height: calc(380 * var(--scalecatalogy) * 1px);
line-height: 130%;
}
.book-text-down {
font-family: 'DINPro', sans-serif;
- margin-bottom: calc(5 * var(--scalecatalog) * 1px);
+ margin-bottom: calc(5 * var(--scalecatalogy) * 1px);
}
.book-pagina-title {
font-family: 'DINPro', sans-serif;
- margin-top: calc(20 * var(--scalecatalog) * 1px);
- margin-bottom: calc(5 * var(--scalecatalog) * 1px);
- font-size: calc(35 * var(--scalecatalog) * 1px);
- height: calc(100 * var(--scalecatalog) * 1px);
+ margin-top: calc(20 * var(--scalecatalogy) * 1px);
+ margin-bottom: calc(5 * var(--scalecatalogy) * 1px);
+ font-size: calc(35 * var(--scalecatalogx) * 1px);
+ height: calc(100 * var(--scalecatalogy) * 1px);
}
.categories {
diff --git a/src/views/ecommerce/raccoltacataloghi/raccoltacataloghi.ts b/src/views/ecommerce/raccoltacataloghi/raccoltacataloghi.ts
index 5cf3dcac..0ab31474 100755
--- a/src/views/ecommerce/raccoltacataloghi/raccoltacataloghi.ts
+++ b/src/views/ecommerce/raccoltacataloghi/raccoltacataloghi.ts
@@ -88,7 +88,7 @@ export default defineComponent({
const widthpdf = ref('8.88');
const heightpdf = ref('12.31');
- const compressionepdf = ref('prepress');
+ const compressionepdf = ref('printer');
const optcatalogo = ref(
{ ...props.modelValue });