- Corretto campo "Comune di Residenza".

- Aggiornato Completamento Profilo: Comune di Residenza.
- Registrazione
This commit is contained in:
Surya Paolo
2025-11-26 18:32:05 +01:00
parent b37204f543
commit 145327a6ca
53 changed files with 4122 additions and 1203 deletions

View File

@@ -494,6 +494,7 @@ export const costanti = {
pickcolor: 22000,
username_telegram: 23000,
date2startend: 23050,
comune: 24000,
},
TypeMov: {

View File

@@ -3650,6 +3650,11 @@ export const colTableSites = [
label_trans: 'sites.telegram_support_chat',
fieldtype: costanti.FieldType.string,
}),
AddCol({
name: 'telegram_gruppi_territoriali_senzainvito',
label_trans: 'sites.telegram_gruppi_territoriali_senzainvito',
fieldtype: costanti.FieldType.string,
}),
AddCol({
name: 'telegram_key_test',
label_trans: 'sites.telegram_key_test',
@@ -5131,6 +5136,20 @@ export const colTableUsers = [
label_trans: 'reg.resid_province',
fieldtype: costanti.FieldType.string,
}),
AddCol({
name: 'profile.resid_comune',
field: 'profile',
subfield: 'resid_comune',
label_trans: 'reg.resid_comune',
fieldtype: costanti.FieldType.string,
}),
AddCol({
name: 'profile.resid_str_comune',
field: 'profile',
subfield: 'resid_str_comune',
label_trans: 'reg.resid_str_comune',
fieldtype: costanti.FieldType.string,
}),
AddCol({
name: 'profile.resid_card',
field: 'profile',
@@ -5768,6 +5787,20 @@ export const colTableUsersISP = [
label_trans: 'reg.born_country',
fieldtype: costanti.FieldType.string,
}),
AddCol({
name: 'profile.resid_comune',
field: 'profile',
subfield: 'resid_comune',
label_trans: 'reg.resid_comune',
fieldtype: costanti.FieldType.string,
}),
AddCol({
name: 'profile.resid_str_comune',
field: 'profile',
subfield: 'resid_str_comune',
label_trans: 'reg.resid_str_comune',
fieldtype: costanti.FieldType.string,
}),
AddCol({
name: 'profile.resid_province',
field: 'profile',

View File

@@ -5636,6 +5636,14 @@ export const tools = {
return globalStore.getProvinceByProv(prov);
},
getComune() {
const userStore = useUserStore();
const globalStore = useGlobalStore();
const comune = userStore.my.profile.resid_str_comune;
//return globalStore.getProvinceByProv(prov);
return comune;
},
visualizzaHomeApp() {
return tools.getProvincia() !== '';
@@ -5665,6 +5673,18 @@ export const tools = {
return mylink + add;
},
getLinkGruppiTerritorialiTelegram() {
try {
const globalStore = useGlobalStore();
const site = globalStore.site;
return site && site.telegram_gruppi_territoriali_senzainvito
? site.telegram_gruppi_territoriali_senzainvito
: '';
} catch (e) {
return '';
}
},
getBotName(): string {
if (tools.isTest() && !import.meta.env.DEV) {
return tools.getValDb('TELEG_BOT_NAME', false);
@@ -8631,6 +8651,9 @@ export const tools = {
if (tablejoin === 'provinces') {
ris = 'profile.resid_province';
}
if (tablejoin === 'cities') {
ris = 'profile.resid_comune';
}
if (tablejoin === 'cards') {
ris = 'profile.resid_card';
}
@@ -11435,6 +11458,10 @@ export const tools = {
return Array.from(array, (byte) => byte.toString(16).padStart(2, '0')).join('');
},
isGruppoMacro() {
return this.getIdApp() === this.IDAPP_MACRO
},
// FINE !
// getLocale() {

View File

@@ -121,6 +121,8 @@ export const DefaultUser: IUserFields = {
manage_mycircuits: [],
useraccounts: [],
calc: { numGoodsAndServices: 0 },
resid_str_comune: '',
resid_comune: '',
resid_province: '',
resid_card: '',
total_transactions: 0,
@@ -196,6 +198,8 @@ export const DefaultProfile: IUserProfile = {
manage_mycircuits: [],
useraccounts: [],
calc: { numGoodsAndServices: 0 },
resid_str_comune: '',
resid_comune: '',
resid_province: '',
resid_card: '',
total_transactions: 0,
@@ -933,6 +937,18 @@ export const useUserStore = defineStore('UserStore', {
return mystr;
},
getComuneByUser(user: IUserFields, html: boolean = false) {
let mystr = '';
if (user && user.profile && user.profile.resid_str_comune)
mystr = `(${user.profile.resid_str_comune})`;
if (html) {
mystr = `<span style='text-align: right'>${mystr}</span>`;
}
return mystr;
},
getUserNameOnlyIfToShow(user: any, col: any = null, options: any = {}): string {
let myrec = this.getRecByCol(user, col);
@@ -994,7 +1010,7 @@ export const useUserStore = defineStore('UserStore', {
this.isLogged = false;
this.x_auth_token = '';
this.refreshToken = '';
this.browser_random = '';
// this.browser_random = '';
console.log('SBIANCA VUOTO ------------ x_auth_token');
return true;
@@ -1777,6 +1793,8 @@ export const useUserStore = defineStore('UserStore', {
tools.checkApp();
this.clearAuthData()
return await Api.SendReq('/users/me/token', 'DELETE', null)
.then((res) => {
console.log(res);

View File

@@ -995,7 +995,11 @@ export const useGlobalStore = defineStore('GlobalStore', {
const { table } = mydata;
try {
if (shared_consts.TABLES_NON_AGGIORNARE_IN_MEMORIA_PERCHE_DIVERSA_STRUTTURA.includes(table))
if (
shared_consts.TABLES_NON_AGGIORNARE_IN_MEMORIA_PERCHE_DIVERSA_STRUTTURA.includes(
table
)
)
return;
const mylist = this.getListByTable(table!);
@@ -1158,7 +1162,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
others: {
userId: userStore.my._id,
access: userStore.my.tokens![0].access,
browser_random: userStore.getBrowserRandom()
browser_random: userStore.getBrowserRandom(),
},
};
@@ -1186,7 +1190,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
const userStore = useUserStore();
try {
return Api.SendReq('/subscribe/del', 'DELETE', {browser_random: userStore.getBrowserRandom()});
return Api.SendReq('/subscribe/del', 'DELETE', {
browser_random: userStore.getBrowserRandom(),
});
} catch (e) {
console.error('deleteSubscriptionToServer');
}
@@ -1484,7 +1490,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
if (res && res.data && res.data.mypage) {
let index = this.mypage.findIndex((rec) => rec._id === res.data.mypage._id);
if (index < 0)
index = this.mypage.findIndex((rec) => rec.path === res.data.mypage.path);
index = this.mypage.findIndex((rec) => rec.path === res.data.mypage.path);
if (index >= 0) {
this.mypage[index] = res.data.mypage;
} else {
@@ -1692,6 +1698,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
if (res) {
// if (mydata.aggiornainmem) this.UpdateValuesInMemory(mydata);
this.UpdateValuesInMemory(mydata);
this.UpdateExtraFields(res.data);
return res.data.code === serv_constants.RIS_CODE_OK;
}
return false;
@@ -1699,6 +1706,30 @@ export const useGlobalStore = defineStore('GlobalStore', {
.catch((error) => false);
},
UpdateExtraFields(data: any) {
const userStore = useUserStore();
if (data?.profileData && typeof data.profileData === 'object') {
const profileData = data.profileData;
if (userStore.my._id === profileData._id) {
for (const [key, value] of Object.entries(profileData)) {
if (key !== '_id') {
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
// Merge oggetti nested
(userStore.my as any)[key] = {
...((userStore.my as any)[key] || {}),
...value,
};
} else {
(userStore.my as any)[key] = value;
}
}
}
}
}
},
async callFunz({ mydata }: { mydata: any }) {
// console.log('saveFieldValue', mydata)
@@ -2452,7 +2483,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
username: userStore.my.username,
};
console.log('getStatSite')
console.log('getStatSite');
return Api.SendReq('/site/load', 'POST', paramquery)
.then((res) => {
@@ -2675,14 +2706,18 @@ export const useGlobalStore = defineStore('GlobalStore', {
try {
if (this.serverError) {
if (this.serverMsgError) {
let mymsg = this.serverMsgError!.msgerr || this.serverMsgError.data!.msgerr || this.serverMsgError.msgerr!.message || this.serverMsgError
let mymsg =
this.serverMsgError!.msgerr ||
this.serverMsgError.data!.msgerr ||
this.serverMsgError.msgerr!.message ||
this.serverMsgError;
if (this.serverMsgError.status === 500) {
return 'Errore Interno del Server';
} else if (mymsg === '') {
return 'Codice Errore ' + this.serverMsgError.status;
}
try {
return mymsg
return mymsg;
} catch (e) {
return this.serverMsgError.msgerr;
}
@@ -2919,7 +2954,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
) {
switch (true) {
case myelemOrig.type === shared_consts.ELEMTYPE.SECTION &&
myelemDest && myelemDest.type === shared_consts.ELEMTYPE.ROW:
myelemDest &&
myelemDest.type === shared_consts.ELEMTYPE.ROW:
return await this.addRowToSection.call(
this,
$q,
@@ -2929,7 +2965,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
);
case myelemOrig.type === shared_consts.ELEMTYPE.ROW &&
myelemDest && myelemDest.type === shared_consts.ELEMTYPE.COLUMN:
myelemDest &&
myelemDest.type === shared_consts.ELEMTYPE.COLUMN:
return await this.addColumnToRow.call(this, $q, t, myelemOrig._id!, myelemDest);
case myelemOrig.type === shared_consts.ELEMTYPE.COLUMN:
@@ -3092,20 +3129,20 @@ export const useGlobalStore = defineStore('GlobalStore', {
} else if (newrec.type === shared_consts.ELEMTYPE.RACCOLTA) {
newrec.catalogo = this.createRaccoltaCataloghiVuoto();
} else if (newrec.type === shared_consts.ELEMTYPE.TEXT) {
newrec.container = "Inserisci qui il testo"
newrec.align = shared_consts.ALIGNTYPE.CENTER
newrec.container = 'Inserisci qui il testo';
newrec.align = shared_consts.ALIGNTYPE.CENTER;
} else if (newrec.type === shared_consts.ELEMTYPE.HTML) {
newrec.containerHtml = "Inserisci qui il testo"
newrec.align = shared_consts.ALIGNTYPE.CENTER
newrec.containerHtml = 'Inserisci qui il testo';
newrec.align = shared_consts.ALIGNTYPE.CENTER;
} else if (newrec.type === shared_consts.ELEMTYPE.IMAGEUPLOAD) {
newrec.align = shared_consts.ALIGNTYPE.CENTER
newrec.align = shared_consts.ALIGNTYPE.CENTER;
} else if (newrec.type === shared_consts.ELEMTYPE.BUTTON) {
newrec.container = "Bottone 1"
newrec.containerHtml = "primary"
newrec.container2 = "fas fa-home"
newrec.align = shared_consts.ALIGNTYPE.CENTER
newrec.link = "https://www.pippo.it"
newrec.container3 = "_blank"
newrec.container = 'Bottone 1';
newrec.containerHtml = 'primary';
newrec.container2 = 'fas fa-home';
newrec.align = shared_consts.ALIGNTYPE.CENTER;
newrec.link = 'https://www.pippo.it';
newrec.container3 = '_blank';
}
// Aggiungi il nuovo elemento alla struttura
@@ -3533,6 +3570,6 @@ export const useGlobalStore = defineStore('GlobalStore', {
async sendInviteEmail(email: string) {
// ...
}
},
},
});