Aggiungere Filtro Regione

This commit is contained in:
paoloar77
2022-02-25 12:01:15 +01:00
parent d797221430
commit c8dd9b7d4f
7 changed files with 371 additions and 457 deletions

View File

@@ -1,4 +1,3 @@
export const shared_consts = { export const shared_consts = {
Accepted: { Accepted: {
@@ -168,451 +167,282 @@ export const shared_consts = {
], ],
Provinces: [ Provinces: [
{ { _id: 1, reg: 'SIC', value: 'AG', label: 'Agrigento', }, {
label: 'Agrigento', _id: 2,
value: 'AG', reg: 'PIE',
},
{
label: 'Alessandria',
value: 'AL', value: 'AL',
}, label: 'Alessandria',
{ }, { _id: 3, reg: 'MAR', value: 'AN', label: 'Ancona', }, {
label: 'Ancona', _id: 4,
value: 'AN', reg: 'VDA',
},
{
label: 'Aosta',
value: 'AO', value: 'AO',
}, label: 'Aosta',
{ }, { _id: 5, reg: 'TOS', value: 'AR', label: 'Arezzo', }, {
label: 'Arezzo', _id: 6,
value: 'AR', reg: 'MAR',
},
{
label: 'Ascoli Piceno',
value: 'AP', value: 'AP',
}, label: 'Ascoli Piceno',
{ }, { _id: 7, reg: 'PIE', value: 'AT', label: 'Asti', }, {
label: 'Asti', _id: 8,
value: 'AT', reg: 'CAM',
},
{
label: 'Avellino',
value: 'AV', value: 'AV',
}, label: 'Avellino',
{ }, { _id: 9, reg: 'PUG', value: 'BA', label: 'Bari', }, {
label: 'Bari', _id: 10,
value: 'BA', reg: 'PUG',
},
{
label: 'Barletta-Andria-Trani',
value: 'BT', value: 'BT',
}, label: 'Barletta-Andria-Trani',
{ }, { _id: 11, reg: 'VEN', value: 'BL', label: 'Belluno', }, {
label: 'Belluno', _id: 12,
value: 'BL', reg: 'CAM',
},
{
label: 'Benevento',
value: 'BN', value: 'BN',
}, label: 'Benevento',
{ }, { _id: 13, reg: 'LOM', value: 'BG', label: 'Bergamo', }, {
label: 'Bergamo', _id: 14,
value: 'BG', reg: 'PIE',
},
{
label: 'Biella',
value: 'BI', value: 'BI',
}, label: 'Biella',
{ }, { _id: 15, reg: 'EMR', value: 'BO', label: 'Bologna', }, {
label: 'Bologna', _id: 16,
value: 'BO', reg: 'TAA',
},
{
label: 'Bolzano',
value: 'BZ', value: 'BZ',
}, label: 'Bolzano',
{ }, { _id: 17, reg: 'LOM', value: 'BS', label: 'Brescia', }, {
label: 'Brescia', _id: 18,
value: 'BS', reg: 'PUG',
},
{
label: 'Brindisi',
value: 'BR', value: 'BR',
}, label: 'Brindisi',
{ }, { _id: 19, reg: 'SAR', value: 'CA', label: 'Cagliari', }, {
label: 'Cagliari', _id: 20,
value: 'CA', reg: 'SIC',
},
{
label: 'Caltanissetta',
value: 'CL', value: 'CL',
}, label: 'Caltanissetta',
{ }, { _id: 21, reg: 'MOL', value: 'CB', label: 'Campobasso', }, {
label: 'Campobasso', _id: 22,
value: 'CB', reg: 'SAR',
},
{
label: 'Carbonia-Iglesias',
value: 'CI', value: 'CI',
}, label: 'Carbonia-Iglesias',
{ }, { _id: 23, reg: 'CAM', value: 'CE', label: 'Caserta', }, {
label: 'Caserta', _id: 24,
value: 'CE', reg: 'SIC',
},
{
label: 'Catania',
value: 'CT', value: 'CT',
}, label: 'Catania',
{ }, { _id: 25, reg: 'CAL', value: 'CZ', label: 'Catanzaro', }, {
label: 'Catanzaro', _id: 26,
value: 'CZ', reg: 'ABR',
},
{
label: 'Chieti',
value: 'CH', value: 'CH',
}, label: 'Chieti',
{ }, { _id: 27, reg: 'LOM', value: 'CO', label: 'Como', }, {
label: 'Como', _id: 28,
value: 'CO', reg: 'CAL',
},
{
label: 'Cosenza',
value: 'CS', value: 'CS',
}, label: 'Cosenza',
{ }, { _id: 29, reg: 'LOM', value: 'CR', label: 'Cremona', }, {
label: 'Cremona', _id: 30,
value: 'CR', reg: 'CAL',
},
{
label: 'Crotone',
value: 'KR', value: 'KR',
}, label: 'Crotone',
{ }, { _id: 31, reg: 'PIE', value: 'CN', label: 'Cuneo', }, {
label: 'Cuneo', _id: 32,
value: 'CN', reg: 'SIC',
},
{
label: 'Enna',
value: 'EN', value: 'EN',
}, label: 'Enna',
{ }, { _id: 33, reg: 'MAR', value: 'FM', label: 'Fermo', }, {
label: 'Fermo', _id: 34,
value: 'FM', reg: 'EMR',
},
{
label: 'Ferrara',
value: 'FE', value: 'FE',
}, label: 'Ferrara',
{ }, { _id: 35, reg: 'TOS', value: 'FI', label: 'Firenze', }, {
label: 'Firenze', _id: 36,
value: 'FI', reg: 'PUG',
},
{
label: 'Foggia',
value: 'FG', value: 'FG',
}, label: 'Foggia',
{ }, { _id: 37, reg: 'EMR', value: 'FC', label: 'Forli-Cesena', }, {
label: 'Forli-Cesena', _id: 38,
value: 'FC', reg: 'LAZ',
},
{
label: 'Frosinone',
value: 'FR', value: 'FR',
}, label: 'Frosinone',
{ }, { _id: 39, reg: 'LIG', value: 'GE', label: 'Genova', }, {
label: 'Genova', _id: 40,
value: 'GE', reg: 'FVG',
},
{
label: 'Gorizia',
value: 'GO', value: 'GO',
}, label: 'Gorizia',
{ }, { _id: 41, reg: 'TOS', value: 'GR', label: 'Grosseto', }, {
label: 'Grosseto', _id: 42,
value: 'GR', reg: 'LIG',
},
{
label: 'Imperia',
value: 'IM', value: 'IM',
}, label: 'Imperia',
{ }, { _id: 43, reg: 'MOL', value: 'IS', label: 'Isernia', }, {
label: 'Isernia', _id: 44,
value: 'IS', reg: 'LIG',
},
{
label: 'La Spezia',
value: 'SP', value: 'SP',
}, label: 'La Spezia',
{ }, { _id: 45, reg: 'ABR', value: 'AQ', label: 'L\'Aquila', }, {
label: 'L\'Aquila', _id: 46,
value: 'AQ', reg: 'LAZ',
},
{
label: 'Latina',
value: 'LT', value: 'LT',
}, label: 'Latina',
{ }, { _id: 47, reg: 'PUG', value: 'LE', label: 'Lecce', }, {
label: 'Lecce', _id: 48,
value: 'LE', reg: 'LOM',
},
{
label: 'Lecco',
value: 'LC', value: 'LC',
}, label: 'Lecco',
{ }, { _id: 49, reg: 'TOS', value: 'LI', label: 'Livorno', }, {
label: 'Livorno', _id: 50,
value: 'LI', reg: 'LOM',
},
{
label: 'Lodi',
value: 'LO', value: 'LO',
}, label: 'Lodi',
{ }, { _id: 51, reg: 'TOS', value: 'LU', label: 'Lucca', }, {
label: 'Lucca', _id: 52,
value: 'LU', reg: 'MAR',
},
{
label: 'Macerata',
value: 'MC', value: 'MC',
}, label: 'Macerata',
{ }, { _id: 53, reg: 'LOM', value: 'MN', label: 'Mantova', }, {
label: 'Mantova', _id: 54,
value: 'MN', reg: 'TOS',
},
{
label: 'Massa-Carrara',
value: 'MS', value: 'MS',
}, label: 'Massa-Carrara',
{ }, { _id: 55, reg: 'BAS', value: 'MT', label: 'Matera', }, {
label: 'Matera', _id: 56,
value: 'MT', reg: 'SIC',
},
{
label: 'Messina',
value: 'ME', value: 'ME',
}, label: 'Messina',
{ }, { _id: 57, reg: 'LOM', value: 'MI', label: 'Milano', }, {
label: 'Milano', _id: 58,
value: 'MI', reg: 'EMR',
},
{
label: 'Modena',
value: 'MO', value: 'MO',
}, label: 'Modena',
{ }, { _id: 59, reg: 'LOM', value: 'MB', label: 'Monza e della Brianza', }, {
label: 'Monza e della Brianza', _id: 60,
value: 'MB', reg: 'CAM',
},
{
label: 'Napoli',
value: 'NA', value: 'NA',
}, label: 'Napoli',
{ }, { _id: 61, reg: 'PIE', value: 'NO', label: 'Novara', }, {
label: 'Novara', _id: 62,
value: 'NO', reg: 'SAR',
},
{
label: 'Nuoro',
value: 'NU', value: 'NU',
}, label: 'Nuoro',
{ }, { _id: 63, reg: 'SAR', value: 'OT', label: 'Olbia-Tempio', }, {
label: 'Olbia-Tempio', _id: 64,
value: 'OT', reg: 'SAR',
},
{
label: 'Oristano',
value: 'OR', value: 'OR',
}, label: 'Oristano',
{ }, { _id: 65, reg: 'VEN', value: 'PD', label: 'Padova', }, {
label: 'Padova', _id: 66,
value: 'PD', reg: 'SIC',
},
{
label: 'Palermo',
value: 'PA', value: 'PA',
}, label: 'Palermo',
{ }, { _id: 67, reg: 'EMR', value: 'PR', label: 'Parma', }, {
label: 'Parma', _id: 68,
value: 'PR', reg: 'LOM',
},
{
label: 'Pavia',
value: 'PV', value: 'PV',
}, label: 'Pavia',
{ }, { _id: 69, reg: 'UMB', value: 'PG', label: 'Perugia', }, {
label: 'Perugia', _id: 70,
value: 'PG', reg: 'MAR',
},
{
label: 'Pesaro e Urbino',
value: 'PU', value: 'PU',
}, label: 'Pesaro e Urbino',
{ }, { _id: 71, reg: 'ABR', value: 'PE', label: 'Pescara', }, {
label: 'Pescara', _id: 72,
value: 'PE', reg: 'EMR',
},
{
label: 'Piacenza',
value: 'PC', value: 'PC',
}, label: 'Piacenza',
{ }, { _id: 73, reg: 'TOS', value: 'PI', label: 'Pisa', }, {
label: 'Pisa', _id: 74,
value: 'PI', reg: 'TOS',
},
{
label: 'Pistoia',
value: 'PT', value: 'PT',
}, label: 'Pistoia',
{ }, { _id: 75, reg: 'FVG', value: 'PN', label: 'Pordenone', }, {
label: 'Pordenone', _id: 76,
value: 'PN', reg: 'BAS',
},
{
label: 'Potenza',
value: 'PZ', value: 'PZ',
}, label: 'Potenza',
{ }, { _id: 77, reg: 'TOS', value: 'PO', label: 'Prato', }, {
label: 'Prato', _id: 78,
value: 'PO', reg: 'SIC',
},
{
label: 'Ragusa',
value: 'RG', value: 'RG',
}, label: 'Ragusa',
{ }, { _id: 79, reg: 'EMR', value: 'RA', label: 'Ravenna', }, {
label: 'Ravenna', _id: 80,
value: 'RA', reg: 'CAL',
},
{
label: 'Reggio Calabria',
value: 'RC', value: 'RC',
}, label: 'Reggio CAL',
{ }, { _id: 81, reg: 'EMR', value: 'RE', label: 'Reggio Emilia', }, {
label: 'Reggio Emilia', _id: 82,
value: 'RE', reg: 'LAZ',
},
{
label: 'Repubblica di San Marino',
value: 'RSM',
},
{
label: 'Rieti',
value: 'RI', value: 'RI',
}, label: 'Rieti',
{ }, { _id: 83, reg: 'EMR', value: 'RN', label: 'Rimini', }, {
label: 'Rimini', _id: 84,
value: 'RN', reg: 'LAZ',
},
{
label: 'Roma',
value: 'RM', value: 'RM',
}, label: 'Roma',
{ }, { _id: 85, reg: 'VEN', value: 'RO', label: 'Rovigo', }, {
label: 'Rovigo', _id: 86,
value: 'RO', reg: 'CAM',
},
{
label: 'Salerno',
value: 'SA', value: 'SA',
}, label: 'Salerno',
{ }, { _id: 87, reg: 'SAR', value: 'VS', label: 'Medio Campidano', }, {
label: 'Medio Campidano', _id: 88,
value: 'VS', reg: 'SAR',
},
{
label: 'Sassari',
value: 'SS', value: 'SS',
}, label: 'Sassari',
{ }, { _id: 89, reg: 'LIG', value: 'SV', label: 'Savona', }, {
label: 'Savona', _id: 90,
value: 'SV', reg: 'TOS',
},
{
label: 'Siena',
value: 'SI', value: 'SI',
}, label: 'Siena',
{ }, { _id: 91, reg: 'SIC', value: 'SR', label: 'Siracusa', }, {
label: 'Siracusa', _id: 92,
value: 'SR', reg: 'LOM',
},
{
label: 'Sondrio',
value: 'SO', value: 'SO',
}, label: 'Sondrio',
{ }, { _id: 93, reg: 'PUG', value: 'TA', label: 'Taranto', }, {
label: 'Taranto', _id: 94,
value: 'TA', reg: 'ABR',
},
{
label: 'Teramo',
value: 'TE', value: 'TE',
}, label: 'Teramo',
{ }, { _id: 95, reg: 'UMB', value: 'TR', label: 'Terni', }, {
label: 'Terni', _id: 96,
value: 'TR', reg: 'PIE',
},
{
label: 'Torino',
value: 'TO', value: 'TO',
}, label: 'Torino',
{ }, { _id: 97, reg: 'SAR', value: 'OG', label: 'Ogliastra', }, {
label: 'Ogliastra', _id: 98,
value: 'OG', reg: 'SIC',
},
{
label: 'Trapani',
value: 'TP', value: 'TP',
}, label: 'Trapani',
{ }, { _id: 99, reg: 'TAA', value: 'TN', label: 'Trento', }, {
label: 'Trento', _id: 100,
value: 'TN', reg: 'VEN',
},
{
label: 'Treviso',
value: 'TV', value: 'TV',
}, label: 'Treviso',
{ }, { _id: 101, reg: 'FVG', value: 'TS', label: 'Trieste', }, {
label: 'Trieste', _id: 102,
value: 'TS', reg: 'FVG',
},
{
label: 'Udine',
value: 'UD', value: 'UD',
}, label: 'Udine',
{ }, { _id: 103, reg: 'LOM', value: 'VA', label: 'Varese', }, {
label: 'Varese', _id: 104,
value: 'VA', reg: 'VEN',
},
{
label: 'Venezia',
value: 'VE', value: 'VE',
}, label: 'Venezia',
{ }, { _id: 105, reg: 'PIE', value: 'VB', label: 'Verbano-Cusio-Ossola', }, {
label: 'Verbano-Cusio-Ossola', _id: 106,
value: 'VB', reg: 'PIE',
},
{
label: 'Vercelli',
value: 'VC', value: 'VC',
}, label: 'Vercelli',
{ }, { _id: 107, reg: 'VEN', value: 'VR', label: 'Verona', }, {
label: 'Verona', _id: 108,
value: 'VR', reg: 'CAL',
},
{
label: 'Vibo Valentia',
value: 'VV', value: 'VV',
}, label: 'Vibo Valentia',
{ }, { _id: 109, reg: 'VEN', value: 'VI', label: 'Vicenza', }, {
label: 'Vicenza', _id: 110,
value: 'VI', reg: 'LAZ',
},
{
label: 'Viterbo',
value: 'VT', value: 'VT',
}, label: 'Viterbo',
], }, { _id: 111, reg: 'RSM', value: 'RSM', label: 'Repubblica di San Marino', }],
Regions: [ Regions: [
{ {
@@ -632,11 +462,11 @@ export const shared_consts = {
label: 'Campania', label: 'Campania',
}, },
{ {
value: 'EMI', value: 'EMR',
label: 'Emilia-Romagna', label: 'Emilia-Romagna',
}, },
{ {
value: 'FRI', value: 'FVG',
label: 'Friuli Venezia Giulia', label: 'Friuli Venezia Giulia',
}, },
{ {
@@ -667,6 +497,10 @@ export const shared_consts = {
value: 'PUG', value: 'PUG',
label: 'Puglia', label: 'Puglia',
}, },
{
value: 'RSM',
label: 'Repubblica di San Marino',
},
{ {
value: 'SAR', value: 'SAR',
label: 'Sardegna', label: 'Sardegna',
@@ -680,7 +514,7 @@ export const shared_consts = {
label: 'Toscana', label: 'Toscana',
}, },
{ {
value: 'TRE', value: 'TAA',
label: 'Trentino-Alto Adige', label: 'Trentino-Alto Adige',
}, },
{ {
@@ -688,7 +522,7 @@ export const shared_consts = {
label: 'Umbria', label: 'Umbria',
}, },
{ {
value: 'VAL', value: 'VDA',
label: 'Valle d\'Aosta', label: 'Valle d\'Aosta',
}, },
{ {

View File

@@ -194,7 +194,7 @@ export default defineComponent({
} }
} }
function getFilterCitiesByProvince(recCities: any, index: number, arr: any) { /*function getFilterCitiesByProvince(recCities: any, index: number, arr: any) {
const recprov: any = searchList.value.find((rec) => rec.table === 'provinces') const recprov: any = searchList.value.find((rec) => rec.table === 'provinces')
// console.log('recSubSkill', recSubSkill, 'recskills', recskills) // console.log('recSubSkill', recSubSkill, 'recskills', recskills)
if (recprov) { if (recprov) {
@@ -204,6 +204,17 @@ export default defineComponent({
} }
} }
*/
function getFilterProvinceByRegion(recProvince: any, index: number, arr: any) {
const recreg: any = searchList.value.find((rec) => rec.table === 'regions')
if (recreg) {
return recProvince.reg === recreg.value
} else {
return true
}
}
searchList_Servizi.value = [ searchList_Servizi.value = [
{ {
@@ -219,16 +230,17 @@ export default defineComponent({
icon: 'mood', icon: 'mood',
filteradv: true, filteradv: true,
}, },
/*{ {
label: 'Regione', label: 'Regione',
table: 'regions', table: 'regions',
key: 'idReg', key: 'idReg',
value: 0,
type: costanti.FieldType.select, type: costanti.FieldType.select,
arrvalue: tools.getCookie(tools.COOK_SEARCH + 'regions', [costanti.FILTER_TUTTI]), value: tools.getCookie(tools.COOK_SEARCH + 'regions', costanti.FILTER_TUTTI),
addall: true,
arrvalue: [],
filter: null, filter: null,
useinput: true, useinput: false,
},*/ },
{ {
label: 'Provincia', label: 'Provincia',
table: 'provinces', table: 'provinces',
@@ -237,9 +249,10 @@ export default defineComponent({
value: tools.getCookie(tools.COOK_SEARCH + 'provinces', costanti.FILTER_TUTTI), value: tools.getCookie(tools.COOK_SEARCH + 'provinces', costanti.FILTER_TUTTI),
addall: true, addall: true,
arrvalue: [], arrvalue: [],
filter: null, filter: getFilterProvinceByRegion,
useinput: true, useinput: true,
icon: 'flag', icon: 'flag',
tablesel: 'provinces',
}, },
{ {
label: 'Comune', label: 'Comune',
@@ -370,16 +383,28 @@ export default defineComponent({
icon: 'mood', icon: 'mood',
filteradv: true, filteradv: true,
}, },
/*{ {
label: 'Regione', label: 'Regione',
table: 'regions', table: 'regions',
key: 'idReg', key: 'idReg',
value: 0,
type: costanti.FieldType.select, type: costanti.FieldType.select,
arrvalue: tools.getCookie(tools.COOK_SEARCH + 'regions', [costanti.FILTER_TUTTI]), value: tools.getCookie(tools.COOK_SEARCH + 'regions', costanti.FILTER_TUTTI),
addall: true,
arrvalue: [],
filter: null, filter: null,
useinput: true, useinput: false,
},*/ },
{
label: 'Regione',
table: 'regions',
key: 'idReg',
type: costanti.FieldType.select,
value: tools.getCookie(tools.COOK_SEARCH + 'regions', costanti.FILTER_TUTTI),
addall: true,
arrvalue: [],
filter: null,
useinput: false,
},
{ {
label: 'Provincia', label: 'Provincia',
table: 'provinces', table: 'provinces',
@@ -388,7 +413,7 @@ export default defineComponent({
value: tools.getCookie(tools.COOK_SEARCH + 'provinces', costanti.FILTER_TUTTI), value: tools.getCookie(tools.COOK_SEARCH + 'provinces', costanti.FILTER_TUTTI),
addall: true, addall: true,
arrvalue: [], arrvalue: [],
filter: null, filter: getFilterProvinceByRegion,
useinput: true, useinput: true,
icon: 'flag', icon: 'flag',
}, },
@@ -469,16 +494,17 @@ export default defineComponent({
] ]
searchList_Beni.value = [ searchList_Beni.value = [
/*{ {
label: 'Regione', label: 'Regione',
table: 'regions', table: 'regions',
key: 'idReg', key: 'idReg',
value: 0,
type: costanti.FieldType.select, type: costanti.FieldType.select,
arrvalue: tools.getCookie(tools.COOK_SEARCH + 'regions', [costanti.FILTER_TUTTI]), value: tools.getCookie(tools.COOK_SEARCH + 'regions', costanti.FILTER_TUTTI),
addall: true,
arrvalue: [],
filter: null, filter: null,
useinput: true, useinput: false,
},*/ },
{ {
label: 'Provincia', label: 'Provincia',
table: 'provinces', table: 'provinces',
@@ -487,7 +513,7 @@ export default defineComponent({
value: tools.getCookie(tools.COOK_SEARCH + 'provinces', costanti.FILTER_TUTTI), value: tools.getCookie(tools.COOK_SEARCH + 'provinces', costanti.FILTER_TUTTI),
addall: true, addall: true,
arrvalue: [], arrvalue: [],
filter: null, filter: getFilterProvinceByRegion,
useinput: true, useinput: true,
icon: 'flag', icon: 'flag',
}, },
@@ -615,6 +641,17 @@ export default defineComponent({
] ]
searchList_MyGroups.value = [ searchList_MyGroups.value = [
{
label: 'Regione',
table: 'regions',
key: 'idReg',
type: costanti.FieldType.select,
value: tools.getCookie(tools.COOK_SEARCH + 'regions', costanti.FILTER_TUTTI),
addall: true,
arrvalue: [],
filter: null,
useinput: false,
},
{ {
label: 'Provincia', label: 'Provincia',
table: 'provinces', table: 'provinces',
@@ -623,7 +660,7 @@ export default defineComponent({
value: tools.getCookie(tools.COOK_SEARCH + 'provinces', costanti.FILTER_TUTTI), value: tools.getCookie(tools.COOK_SEARCH + 'provinces', costanti.FILTER_TUTTI),
addall: true, addall: true,
arrvalue: [], arrvalue: [],
filter: null, filter: getFilterProvinceByRegion,
useinput: true, useinput: true,
icon: 'flag', icon: 'flag',
}, },

View File

@@ -405,16 +405,19 @@ export default defineComponent({
let filtersearch: any[] = [] let filtersearch: any[] = []
let filtersearch2: any[] = [] let filtersearch2: any[] = []
let filtersearch3or: any[] = [] let filtersearch3or: any[] = []
let filtersearch3and: any[] = []
let filtercustom: any[] = [...props.filtercustom] let filtercustom: any[] = [...props.filtercustom]
let recSector = null let recSector = null
let recSectorGood = null let recSectorGood = null
let recCities = null let recCities = null
let recRegion = null
let recProvince = null let recProvince = null
let recSkill = null let recSkill = null
let idSector = 0 let idSector = 0
let idSectorGood = 0 let idSectorGood = 0
let idProvince = 0 let idProvince = 0
let idRegion = 0
let idSkill = 0 let idSkill = 0
if (searchList.value) { if (searchList.value) {
recSector = searchList.value.find((item: ISearchList) => item.table === 'sectors') recSector = searchList.value.find((item: ISearchList) => item.table === 'sectors')
@@ -428,6 +431,10 @@ export default defineComponent({
recProvince = searchList.value.find((item: ISearchList) => item.table === 'provinces') recProvince = searchList.value.find((item: ISearchList) => item.table === 'provinces')
idProvince = recProvince ? recProvince.value : 0 idProvince = recProvince ? recProvince.value : 0
} }
if (searchList.value) {
recRegion = searchList.value.find((item: ISearchList) => item.table === 'regions')
idRegion = recRegion ? recRegion.value : 0
}
if (searchList.value) { if (searchList.value) {
recCities = searchList.value.find((item: ISearchList) => item.table === 'cities') recCities = searchList.value.find((item: ISearchList) => item.table === 'cities')
} }
@@ -437,6 +444,9 @@ export default defineComponent({
idSkill = recSkill ? recSkill.value : 0 idSkill = recSkill ? recSkill.value : 0
} }
let arrfilter_cities: any = []
let arrfilter_provices: any = []
// console.table(searchList.value) // console.table(searchList.value)
if (searchList.value) { if (searchList.value) {
@@ -448,15 +458,26 @@ export default defineComponent({
// console.log(' item ', item) // console.log(' item ', item)
let obj: any = {} let obj: any = {}
if (item.table === 'provinces') { if (item.table === 'regions') {
obj['mycities.reg'] = item.value
if (item.value !== '' && item.value !== costanti.FILTER_TUTTI) {
filtersearch3and.push(obj)
}
if (item.value && recProvince && idRegion !== costanti.FILTER_TUTTI) {
arrfilter_provices.push({key: 'reg', value: idRegion })
}
} else if (item.table === 'provinces') {
obj['mycities.prov'] = item.value obj['mycities.prov'] = item.value
if (item.value !== '' && item.value !== costanti.FILTER_TUTTI) { if (item.value !== '' && item.value !== costanti.FILTER_TUTTI) {
filtersearch3or.push(obj) filtersearch3and.push(obj)
} }
if (item.value && recCities && idProvince !== costanti.FILTER_TUTTI) { if (item.value && recCities && idProvince !== costanti.FILTER_TUTTI) {
recCities.filter_extra = {prov: idProvince} arrfilter_cities.push({key: 'prov', value: idProvince })
} }
} else if (item.table === 'cities') { } else if (item.table === 'cities') {
@@ -464,7 +485,7 @@ export default defineComponent({
if (item.value && item.value.hasOwnProperty('_id')) { if (item.value && item.value.hasOwnProperty('_id')) {
obj['idCity'] = item.value._id obj['idCity'] = item.value._id
if (item.value && item.value !== '' && item.value._id !== costanti.FILTER_TUTTI) { if (item.value && item.value !== '' && item.value._id !== costanti.FILTER_TUTTI) {
filtersearch3or.push(obj) filtersearch3and.push(obj)
} }
} }
} else if (shared_consts.TABLES_WITH_FILTER_FIELD.includes(item.table)) { } else if (shared_consts.TABLES_WITH_FILTER_FIELD.includes(item.table)) {
@@ -539,6 +560,23 @@ export default defineComponent({
} }
} }
if (arrfilter_cities.length > 0 && recCities) {
let myobjfilt: any = {}
for (const myrec of arrfilter_cities) {
myobjfilt[myrec.key] = myrec.value
}
recCities.filter_extra = myobjfilt
}
if (arrfilter_provices.length > 0 && recProvince) {
let myobjfilt: any = {}
for (const myrec of arrfilter_provices) {
myobjfilt[myrec.key] = myrec.value
}
recProvince.filter_extra = myobjfilt
}
// console.log('filtersearch', filtersearch) // console.log('filtersearch', filtersearch)
if (props.prop_search) { if (props.prop_search) {
@@ -579,6 +617,7 @@ export default defineComponent({
// @ts-ignore // @ts-ignore
filtersearch2: filtersearch2, filtersearch2: filtersearch2,
filtersearch3or: filtersearch3or, filtersearch3or: filtersearch3or,
filtersearch3and: filtersearch3and,
// @ts-ignore // @ts-ignore
filtercustom: filtercustom, filtercustom: filtercustom,
sortBy: myobj, sortBy: myobj,

View File

@@ -428,6 +428,8 @@ export default defineComponent({
update( update(
async () => { async () => {
console.log('Filter val', val, val.length) console.log('Filter val', val, val.length)
console.log('props.filter_extra', props.filter_extra)
let myarr: any = [] let myarr: any = []

View File

@@ -333,9 +333,12 @@ export default defineComponent({
let lab = tools.addslashes(rec[0]) let lab = tools.addslashes(rec[0])
let val = tools.addslashes(rec[1]) let val = tools.addslashes(rec[1])
if (cmd === shared_consts.Cmd.PROVINCE) { if (cmd === shared_consts.Cmd.PROVINCE) {
let reg = tools.addslashes(rec[1])
val = tools.addslashes(rec[2])
strris += '{ \n' strris += '{ \n'
strris += ' _id:' + ind + ',' strris += ' _id:' + ind + ','
strris += ' reg:\'' + reg + '\','
strris += ' prov:\'' + val + '\',' strris += ' prov:\'' + val + '\','
strris += ' descr:\'' + lab + '\',' strris += ' descr:\'' + lab + '\','
strris += '}, \n' strris += '}, \n'

View File

@@ -417,6 +417,7 @@ export const colProvinces = [
// AddCol({ name: '_id', label_trans: 'index', fieldtype: costanti.FieldType.number }), // AddCol({ name: '_id', label_trans: 'index', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'label', label_trans: 'store.description' }), AddCol({ name: 'label', label_trans: 'store.description' }),
AddCol({ name: 'value', label_trans: 'city.prov' }), AddCol({ name: 'value', label_trans: 'city.prov' }),
AddCol({ name: 'reg', label_trans: 'city.reg' }),
AddCol(DeleteRec), AddCol(DeleteRec),
AddCol(DuplicateRec), AddCol(DuplicateRec),
] ]
@@ -776,6 +777,7 @@ export const colmySkills = [
remote_table: 'mycities', remote_table: 'mycities',
remote_key: '_id', remote_key: '_id',
remote_field: 'comune', remote_field: 'comune',
required: true,
}), }),
AddCol({ AddCol({
name: 'adType', name: 'adType',
@@ -935,6 +937,7 @@ export const colmyBachecas = [
remote_key: '_id', remote_key: '_id',
remote_field: 'comune', remote_field: 'comune',
sortable: false, sortable: false,
required: true,
}), }),
AddCol({ AddCol({
name: 'adType', name: 'adType',
@@ -2023,7 +2026,7 @@ export const colTableUsersISP = [
label_trans: 'reg.consiglio', label_trans: 'reg.consiglio',
fieldtype: costanti.FieldType.boolean, fieldtype: costanti.FieldType.boolean,
}), }),
AddCol({ name: 'profile.motivazioni', field: 'profile', subfield: 'motivazioni', label_trans: 'reg.motivazioni', }), // AddCol({ name: 'profile.motivazioni', field: 'profile', subfield: 'motivazioni', label_trans: 'reg.motivazioni', }),
AddCol({ name: 'profile.biografia', field: 'profile', subfield: 'biografia', label_trans: 'reg.biografia', }), AddCol({ name: 'profile.biografia', field: 'profile', subfield: 'biografia', label_trans: 'reg.biografia', }),
AddCol({ name: 'profile.qualifica', field: 'profile', subfield: 'qualifica', label_trans: 'reg.qualifica', }), AddCol({ name: 'profile.qualifica', field: 'profile', subfield: 'qualifica', label_trans: 'reg.qualifica', }),
AddCol({ AddCol({
@@ -2588,7 +2591,7 @@ export const fieldsTable = {
{ {
value: 'provinces', value: 'provinces',
label: 'Provincia', label: 'Provincia',
columns: colTablePermission, columns: colProvinces,
colkey: 'value', colkey: 'value',
collabel: 'label', collabel: 'label',
remote: true, remote: true,

View File

@@ -229,7 +229,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
else if (table === 'friends') else if (table === 'friends')
return userStore.my.profile.friends return userStore.my.profile.friends
else if (table === 'friendsandme') else if (table === 'friendsandme')
return [{username: userStore.my.username }, ...userStore.my.profile.friends] return [{ username: userStore.my.username }, ...userStore.my.profile.friends]
else if (table === 'mygroups') else if (table === 'mygroups')
return userStore.groups return userStore.groups
else if (table === 'sendmsgs') else if (table === 'sendmsgs')
@@ -246,7 +246,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
return state.skills return state.skills
else if (table === 'goods') else if (table === 'goods')
return state.goods return state.goods
// else if (table === 'subskills') // else if (table === 'subskills')
// return state.subSkills // return state.subSkills
else if (table === 'statusSkills') else if (table === 'statusSkills')
return state.statusSkills return state.statusSkills
@@ -514,7 +514,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
} }
} }
console.log('update: ', myrec) console.log('update: ', myrec)
} }
} catch (e) { } catch (e) {
console.error(e) console.error(e)
@@ -707,7 +707,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
isok = true isok = true
} }
await globalroutines( 'readall', 'config', null) await globalroutines('readall', 'config', null)
return isok return isok
}, },
@@ -896,7 +896,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
const ris = await this.saveTable(mydata) const ris = await this.saveTable(mydata)
if (ris) { if (ris) {
this.newValueInMemoryByTable(ris, mytable); this.newValueInMemoryByTable(ris, mytable)
} }
console.log('saveNewRecord', ris) console.log('saveNewRecord', ris)
@@ -1317,7 +1317,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
}) })
}, },
async sendEmailTest({ previewonly}:{previewonly: any}) { async sendEmailTest({ previewonly }: {previewonly: any}) {
const usertosend = { const usertosend = {
locale: tools.getLocale(), locale: tools.getLocale(),
previewonly previewonly
@@ -1435,12 +1435,12 @@ export const useGlobalStore = defineStore('GlobalStore', {
}, },
getItemDate(num: number, day: number, mystr: string) { getItemDate(num: number, day: number, mystr: string) {
let mydate = tools.addDays(tools.getDateNow(), day); let mydate = tools.addDays(tools.getDateNow(), day)
let mydateend = tools.addDays(mydate, 7); let mydateend = tools.addDays(mydate, 7)
mydate = tools.getstrYYMMDDDate(mydate) mydate = tools.getstrYYMMDDDate(mydate)
mydateend = tools.getstrYYMMDDDate(mydateend) mydateend = tools.getstrYYMMDDDate(mydateend)
let filter = { dateTimeStart: {$gte: mydate, $lte: mydateend } } let filter = { dateTimeStart: { $gte: mydate, $lte: mydateend } }
let obj = {_id: num, datestr: mystr, filter } let obj = { _id: num, datestr: mystr, filter }
return obj return obj
}, },
@@ -1465,8 +1465,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
let obj = {} let obj = {}
for (let i = 0; i < 120; i++) { for (let i = 0; i < 120; i++) {
let mydate = tools.addDays(tools.getDateNow(), i - 30); let mydate = tools.addDays(tools.getDateNow(), i - 30)
obj ={_id: mydate, datestr: tools.getstrVeryShortDate(mydate) } obj = { _id: mydate, datestr: tools.getstrVeryShortDate(mydate) }
arr.push(obj) arr.push(obj)
} }
@@ -1476,45 +1476,41 @@ export const useGlobalStore = defineStore('GlobalStore', {
}, },
getTableJoinByName(table: string, addall?: boolean, filter?: any) { getTableJoinByName(table: string, addall?: boolean, filter?: any) {
if (table === 'permissions') return [shared_consts.Permissions.Admin, shared_consts.Permissions.Manager, shared_consts.Permissions.Teacher, shared_consts.Permissions.Tutor, shared_consts.Permissions.Editor, shared_consts.Permissions.Zoomeri, shared_consts.Permissions.Department]
else if (table === 'accepted') return [shared_consts.Accepted.CHECK_READ_GUIDELINES, shared_consts.Accepted.CHECK_SEE_VIDEO_PRINCIPI]
else if (table === 'fieldstype') return costanti.FieldTypeArr
else if (table === 'metodo_pagamento') return tools.SelectMetodiPagamento
else if (table === 'bottype') return shared_consts.BotType
else if (table === 'visibility') return shared_consts.Visibility
else if (table === 'visibilGroup') return shared_consts.VisibilGroup
else if (table === 'lang') return shared_consts.Lang
else if (table === 'regions') return shared_consts.Regions
else if (table === 'provinces') return shared_consts.Provinces
else if (table === 'shippings') return shared_consts.Shippings
else if (table === toolsext.TABCALDATE) return this.getArrDateEvent()
else if (table === toolsext.TABCALALLDATE) return this.getArrAllDateEvent()
let myarr = this.getListByTable(table) let myarr: any = []
if (table === 'permissions') myarr = [shared_consts.Permissions.Admin, shared_consts.Permissions.Manager, shared_consts.Permissions.Teacher, shared_consts.Permissions.Tutor, shared_consts.Permissions.Editor, shared_consts.Permissions.Zoomeri, shared_consts.Permissions.Department]
else if (table === 'accepted') myarr = [shared_consts.Accepted.CHECK_READ_GUIDELINES, shared_consts.Accepted.CHECK_SEE_VIDEO_PRINCIPI]
else if (table === 'fieldstype') myarr = costanti.FieldTypeArr
else if (table === 'metodo_pagamento') myarr = tools.SelectMetodiPagamento
else if (table === 'bottype') myarr = shared_consts.BotType
else if (table === 'visibility') myarr = shared_consts.Visibility
else if (table === 'visibilGroup') myarr = shared_consts.VisibilGroup
else if (table === 'lang') myarr = shared_consts.Lang
else if (table === 'regions') myarr = shared_consts.Regions
else if (table === 'provinces') myarr = shared_consts.Provinces
else if (table === 'shippings') myarr = shared_consts.Shippings
else if (table === toolsext.TABCALDATE) myarr = this.getArrDateEvent()
else if (table === toolsext.TABCALALLDATE) myarr = this.getArrAllDateEvent()
else myarr = this.getListByTable(table)
if (costanti.TABLES_ARRAY.includes(table)) { if (costanti.TABLES_ARRAY.includes(table)) {
const newarr = [] const newarr = []
for (const value of myarr) { for (const value of myarr) {
newarr.push({value, label:value}) newarr.push({ value, label: value })
} }
myarr = newarr myarr = newarr
} }
if (addall) if (addall)
myarr = [costanti.FILTER_TUTTI, ...myarr] myarr = [costanti.FILTER_TUTTI, ...myarr]
if (!addall) {
/*if (table === 'skills') {
myarr = myarr.filter((rec: any) => rec._id > 0)
} */
}
if (filter) { if (filter) {
// console.log('table', table, 'filter', filter, 'arrprima', myarr)
myarr = myarr.filter(filter) myarr = myarr.filter(filter)
// console.log('myarr', myarr)
} }
// console.log('myarr', table, myarr)
return myarr return myarr
}, },
@@ -1528,7 +1524,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
} }
try { try {
return this.serverMsgError.msgerr.message return this.serverMsgError.msgerr.message
}catch (e) { } catch (e) {
return this.serverMsgError.msgerr return this.serverMsgError.msgerr
} }
} }