- Entri in Circuito Italia solo se hai il fido nel circuito provinciale

- Aggiunta Zona, oltre alla provincia, per visualizzare i vari circuiti della prov
This commit is contained in:
Surya Paolo
2023-12-06 00:42:02 +01:00
parent 7f716b82b6
commit a0fbddde39
19 changed files with 273 additions and 106 deletions

View File

@@ -107,7 +107,24 @@ export const useCircuitStore = defineStore('CircuitStore', {
},
SonoDentroAdAlmeno1CircuitoConFido() {
SonoDentroAdAlmeno1CircuitoConFido(): boolean {
const userStore = useUserStore()
if (userStore.my.profile.useraccounts) {
const accountsConFido = userStore.my.profile.useraccounts.filter((rec: IAccount) => rec.fidoConcesso > 0)
for (const account of accountsConFido) {
const mycircuit = this.listcircuits.find((circ: ICircuit) => circ._id === account.circuitId)
if (mycircuit && !mycircuit.showAlways) {
return true
}
}
}
return false
},
get1CircuitoConFido() {
const userStore = useUserStore()
if (userStore.my.profile.useraccounts) {
@@ -157,9 +174,13 @@ export const useCircuitStore = defineStore('CircuitStore', {
getCircuitsNameByProvince(prov: string): ICircuit[] {
const filterarr = this.listcircuits.filter((rec: ICircuit) => rec.strProv === prov)
return filterarr.map((subArray: any) => {
let arrcirc = filterarr.map((subArray: any) => {
return subArray.name;
})
if (arrcirc.length > 1)
return ['[Nessuno]', ...arrcirc]
else
return arrcirc
},
getCircuitByCircuitId(circuitId: string): ICircuit | null | undefined {

View File

@@ -325,6 +325,11 @@ const colTableWhere = [
AddCol({ name: 'whereicon', label_trans: 'where.whereicon' }),
AddCol(DeleteRec),
]
const colTableCard = [
AddCol({ name: 'label', label_trans: 'label' }),
AddCol({ name: 'card', label_trans: 'card' }),
AddCol(DeleteRec),
]
export const colTableProducer = [
AddCol({ name: 'name', label_trans: 'producer.name' }),
@@ -3944,6 +3949,13 @@ export const fieldsTable = {
collabel: 'descr',
remote: true,
},
{
value: 'cards',
label: 'Zone',
columns: colTableCard,
colkey: 'card',
collabel: 'label',
},
{
value: 'countries',
label: 'Nazione',

View File

@@ -3055,6 +3055,11 @@ export const tools = {
if (mytimestamp) return date.formatDate(mytimestamp, 'DD/MM/YYYY')
return ''
},
getstrDateShort(mytimestamp: Date | number | string | undefined) {
// console.log('getstrDate', mytimestamp)
if (mytimestamp) return date.formatDate(mytimestamp, 'DD/MM/YY')
return ''
},
getstrMonth(mytimestamp: Date | number | string | undefined) {
// console.log('getstrDate', mytimestamp)
if (mytimestamp) return date.formatDate(mytimestamp, 'MMMM YYYY')
@@ -5585,9 +5590,9 @@ export const tools = {
userStore.my.profile.userstoverify = userStore.my.profile.userstoverify.filter((rec: any) => rec.username !== usernameDest)
if (value)
tools.showPositiveNotif($q, t('db.trusted', {username: usernameDest}))
tools.showPositiveNotif($q, t('db.enabled_to_app', {username: usernameDest}))
else
tools.showNegativeNotif($q, t('db.rejected', {username: usernameDest}))
tools.showNegativeNotif($q, t('db.rejected_to_app', {username: usernameDest}))
}
})
})
@@ -7334,6 +7339,9 @@ export const tools = {
if (tablejoin === 'provinces') {
ris = 'profile.resid_province'
}
if (tablejoin === 'cards') {
ris = 'profile.resid_card'
}
if (tablejoin === 'regions') {
ris = 'mycities.reg'
}

View File

@@ -1,6 +1,6 @@
import { defineStore } from 'pinia'
import {
ICfgServer, ICity,
ICfgServer, ICity, IProvince,
IColGridTable,
IConfig,
IDataToSet,
@@ -263,12 +263,17 @@ export const useGlobalStore = defineStore('GlobalStore', {
},
isPresenteCardsByProv: (state: IGlobalState) => (myprov: string) => {
const arrprov: any[] = state.provinces.filter((prov: IProvince) => prov.prov === myprov && (!!prov.card))
return arrprov && arrprov.length > 0
},
getRespByUsername: (state: IGlobalState) => (username: string) => {
const rec = state.resps.find((recin: any) => recin.username === username)
return !!rec ? rec.name + ' ' + rec.surname : ''
},
getListByTable: (state: IGlobalState) => (table: string): any => {
getListByTable: (state: IGlobalState) => (table: string, value2?: any): any => {
let ris: any = []
const calendarStore = useCalendarStore()
@@ -345,7 +350,17 @@ export const useGlobalStore = defineStore('GlobalStore', {
else if (table === 'catgrps')
return state.catgrps
else if (table === 'provinces')
return state.provinces
return state.provinces.filter((prov: IProvince) => (!prov.card))
else if (table === 'cards') {
const arrprov: any[] = state.provinces.filter((prov: IProvince) => prov.prov === value2 && (!!prov.card))
if (arrprov) {
// const idCardArray: { _id: number, card: string }[] = arrprov.map(({ _id, card }) => ({ _id, card }));
const idCardArray: { card: string, label: string }[] = arrprov.map(({ card }) => ({ card, label: card }));
return idCardArray
}
return []
}
else {
return ris
}
@@ -1607,6 +1622,17 @@ export const useGlobalStore = defineStore('GlobalStore', {
return recprov ? recprov.descr : ''
},
getArrCardByProv(provstr: string): string[] {
const recprov = this.provinces.filter((rec: any) => rec.prov === provstr)
const cardArray: string[] = recprov.map((prov: IProvince) => prov.card);
return cardArray
},
async sendEmailTest({ previewonly }: { previewonly: any }) {
@@ -1770,7 +1796,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
return arr
},
getTableJoinByName(table: string, addall?: boolean, addnone?: boolean, filter?: any) {
getTableJoinByName(table: string, addall?: boolean, addnone?: boolean, filter?: any, value2?: any) {
let myarr: any = []
if (table === 'permissions') myarr = [shared_consts.Permissions.Admin, shared_consts.Permissions.Manager, shared_consts.Permissions.Teacher, shared_consts.Permissions.Facilitatore, shared_consts.Permissions.Editor, shared_consts.Permissions.Zoomeri, shared_consts.Permissions.Department]
@@ -1801,7 +1827,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
else if (table === toolsext.TABUNITS) myarr = shared_consts.Units_Of_Measure_ListBox
else if (table === 'usernotifs') myarr = shared_consts.UsersNotif_Adv_List
else if (table === 'typenotifs') myarr = shared_consts.TypeNotifs_Arr
else myarr = this.getListByTable(table)
else myarr = this.getListByTable(table, value2)
if (costanti.TABLES_ARRAY.includes(table)) {
const newarr = []
@@ -1825,7 +1851,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
if (addnone) {
const mykey = fieldsTable.getKeyByTable(table)
const collab = fieldsTable.getLabelByTable(table)
const obj: any = {}
let obj: any = {}
obj[mykey] = costanti.FILTER_NESSUNO
obj[collab] = '[Nessuno]'
@@ -1835,6 +1861,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
obj.idSector = []
}
if (table === 'cards') {
obj = {card: '', label: '[Nessuna]'}
}
myarr = [obj, ...myarr]
}