- Poter impostare per ogni Provincia un Circuito RIS specifico, anziché quello provinciale:
Esempio: Napoli: (Circuito RIS Campania) e Sud Sardegna: Cagliari.
This commit is contained in:
@@ -195,15 +195,32 @@ export const useCircuitStore = defineStore('CircuitStore', {
|
||||
},
|
||||
|
||||
getCircuitByProvinceAndCard(prov: string, card: string): ICircuit | undefined | null {
|
||||
return this.listcircuits.find((rec: ICircuit) => rec.strProv === prov && ((rec.card === card) || (!card)))
|
||||
// Controlla se questa provincia ha un circuito specifico
|
||||
const globalStore = useGlobalStore();
|
||||
|
||||
const idCircuit = globalStore.getIdCircuitToAssignByProv(prov);
|
||||
if (idCircuit) {
|
||||
return this.getCircuitByCircuitId(idCircuit)
|
||||
} else {
|
||||
return this.listcircuits.find((rec: ICircuit) => rec.strProv === prov && ((rec.card === card) || (!card)))
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
getCircuitsByProvince(prov: string): ICircuit[] {
|
||||
return this.listcircuits.filter((rec: ICircuit) => rec.strProv === prov)
|
||||
const globalStore = useGlobalStore();
|
||||
|
||||
const idCircuit = globalStore.getIdCircuitToAssignByProv(prov);
|
||||
if (idCircuit) {
|
||||
return this.listcircuits.filter((rec: ICircuit) => rec._id === idCircuit)
|
||||
} else {
|
||||
return this.listcircuits.filter((rec: ICircuit) => rec.strProv === prov)
|
||||
}
|
||||
},
|
||||
|
||||
getCircuitsNameByProvince(prov: string): ICircuit[] {
|
||||
const filterarr = this.listcircuits.filter((rec: ICircuit) => rec.strProv === prov)
|
||||
const filterarr = this.getCircuitsByProvince(prov);
|
||||
|
||||
let arrcirc = filterarr.map((subArray: any) => {
|
||||
return subArray.name;
|
||||
})
|
||||
|
||||
@@ -1011,6 +1011,12 @@ export const colProvinces = [
|
||||
AddCol({ name: 'reg', label_trans: 'city.reg' }),
|
||||
AddCol({ name: 'prov', label_trans: 'city.prov' }),
|
||||
AddCol({ name: 'card', label_trans: 'city.card' }),
|
||||
AddCol({
|
||||
name: 'idCircuitToAssign', label_trans: 'city.idCircuitToAssign',
|
||||
fieldtype: costanti.FieldType.select,
|
||||
jointable: 'listcircuits',
|
||||
|
||||
}),
|
||||
AddCol({ name: 'descr', label_trans: 'store.description' }),
|
||||
AddCol({ name: 'lat', label_trans: 'city.lat' }),
|
||||
AddCol({ name: 'long', label_trans: 'city.long' }),
|
||||
|
||||
@@ -6122,10 +6122,11 @@ export const tools = {
|
||||
$q.dialog({
|
||||
message: t(value ? 'db.domanda_trusted' : 'db.domanda_reject', {
|
||||
username: usernameDest,
|
||||
sitename: t('ws.sitename'),
|
||||
}),
|
||||
ok: { label: t('dialog.yes'), push: true },
|
||||
cancel: { label: t('dialog.cancel') },
|
||||
title: t('db.domanda'),
|
||||
title: t('db.ammissione_nuovo_ingresso'),
|
||||
}).onOk(() => {
|
||||
userStore
|
||||
.setFriendsCmd(
|
||||
|
||||
@@ -483,6 +483,13 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
return arrprov && arrprov.length > 0;
|
||||
},
|
||||
|
||||
getIdCircuitToAssignByProv: (state: IGlobalState) => (myprov: string): string => {
|
||||
const arrprov: any[] = state.provinces.filter(
|
||||
(recprov: IProvince) => recprov.prov === myprov && !!recprov.idCircuitToAssign
|
||||
);
|
||||
return arrprov && arrprov.length > 0 ? arrprov[0].idCircuitToAssign : '';
|
||||
},
|
||||
|
||||
getRespByUsername: (state: IGlobalState) => (username: string) => {
|
||||
const rec = state.resps.find((recin: any) => recin.username === username);
|
||||
return !!rec ? rec.name + ' ' + rec.surname : '';
|
||||
|
||||
Reference in New Issue
Block a user