- 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

@@ -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]
}