diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index 1f7b39ca..9c0cd091 100755 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -1,4 +1,3 @@ - export const shared_consts = { Accepted: { @@ -168,451 +167,282 @@ export const shared_consts = { ], Provinces: [ - { - label: 'Agrigento', - value: 'AG', - }, - { - label: 'Alessandria', + { _id: 1, reg: 'SIC', value: 'AG', label: 'Agrigento', }, { + _id: 2, + reg: 'PIE', value: 'AL', - }, - { - label: 'Ancona', - value: 'AN', - }, - { - label: 'Aosta', + label: 'Alessandria', + }, { _id: 3, reg: 'MAR', value: 'AN', label: 'Ancona', }, { + _id: 4, + reg: 'VDA', value: 'AO', - }, - { - label: 'Arezzo', - value: 'AR', - }, - { - label: 'Ascoli Piceno', + label: 'Aosta', + }, { _id: 5, reg: 'TOS', value: 'AR', label: 'Arezzo', }, { + _id: 6, + reg: 'MAR', value: 'AP', - }, - { - label: 'Asti', - value: 'AT', - }, - { - label: 'Avellino', + label: 'Ascoli Piceno', + }, { _id: 7, reg: 'PIE', value: 'AT', label: 'Asti', }, { + _id: 8, + reg: 'CAM', value: 'AV', - }, - { - label: 'Bari', - value: 'BA', - }, - { - label: 'Barletta-Andria-Trani', + label: 'Avellino', + }, { _id: 9, reg: 'PUG', value: 'BA', label: 'Bari', }, { + _id: 10, + reg: 'PUG', value: 'BT', - }, - { - label: 'Belluno', - value: 'BL', - }, - { - label: 'Benevento', + label: 'Barletta-Andria-Trani', + }, { _id: 11, reg: 'VEN', value: 'BL', label: 'Belluno', }, { + _id: 12, + reg: 'CAM', value: 'BN', - }, - { - label: 'Bergamo', - value: 'BG', - }, - { - label: 'Biella', + label: 'Benevento', + }, { _id: 13, reg: 'LOM', value: 'BG', label: 'Bergamo', }, { + _id: 14, + reg: 'PIE', value: 'BI', - }, - { - label: 'Bologna', - value: 'BO', - }, - { - label: 'Bolzano', + label: 'Biella', + }, { _id: 15, reg: 'EMR', value: 'BO', label: 'Bologna', }, { + _id: 16, + reg: 'TAA', value: 'BZ', - }, - { - label: 'Brescia', - value: 'BS', - }, - { - label: 'Brindisi', + label: 'Bolzano', + }, { _id: 17, reg: 'LOM', value: 'BS', label: 'Brescia', }, { + _id: 18, + reg: 'PUG', value: 'BR', - }, - { - label: 'Cagliari', - value: 'CA', - }, - { - label: 'Caltanissetta', + label: 'Brindisi', + }, { _id: 19, reg: 'SAR', value: 'CA', label: 'Cagliari', }, { + _id: 20, + reg: 'SIC', value: 'CL', - }, - { - label: 'Campobasso', - value: 'CB', - }, - { - label: 'Carbonia-Iglesias', + label: 'Caltanissetta', + }, { _id: 21, reg: 'MOL', value: 'CB', label: 'Campobasso', }, { + _id: 22, + reg: 'SAR', value: 'CI', - }, - { - label: 'Caserta', - value: 'CE', - }, - { - label: 'Catania', + label: 'Carbonia-Iglesias', + }, { _id: 23, reg: 'CAM', value: 'CE', label: 'Caserta', }, { + _id: 24, + reg: 'SIC', value: 'CT', - }, - { - label: 'Catanzaro', - value: 'CZ', - }, - { - label: 'Chieti', + label: 'Catania', + }, { _id: 25, reg: 'CAL', value: 'CZ', label: 'Catanzaro', }, { + _id: 26, + reg: 'ABR', value: 'CH', - }, - { - label: 'Como', - value: 'CO', - }, - { - label: 'Cosenza', + label: 'Chieti', + }, { _id: 27, reg: 'LOM', value: 'CO', label: 'Como', }, { + _id: 28, + reg: 'CAL', value: 'CS', - }, - { - label: 'Cremona', - value: 'CR', - }, - { - label: 'Crotone', + label: 'Cosenza', + }, { _id: 29, reg: 'LOM', value: 'CR', label: 'Cremona', }, { + _id: 30, + reg: 'CAL', value: 'KR', - }, - { - label: 'Cuneo', - value: 'CN', - }, - { - label: 'Enna', + label: 'Crotone', + }, { _id: 31, reg: 'PIE', value: 'CN', label: 'Cuneo', }, { + _id: 32, + reg: 'SIC', value: 'EN', - }, - { - label: 'Fermo', - value: 'FM', - }, - { - label: 'Ferrara', + label: 'Enna', + }, { _id: 33, reg: 'MAR', value: 'FM', label: 'Fermo', }, { + _id: 34, + reg: 'EMR', value: 'FE', - }, - { - label: 'Firenze', - value: 'FI', - }, - { - label: 'Foggia', + label: 'Ferrara', + }, { _id: 35, reg: 'TOS', value: 'FI', label: 'Firenze', }, { + _id: 36, + reg: 'PUG', value: 'FG', - }, - { - label: 'Forli-Cesena', - value: 'FC', - }, - { - label: 'Frosinone', + label: 'Foggia', + }, { _id: 37, reg: 'EMR', value: 'FC', label: 'Forli-Cesena', }, { + _id: 38, + reg: 'LAZ', value: 'FR', - }, - { - label: 'Genova', - value: 'GE', - }, - { - label: 'Gorizia', + label: 'Frosinone', + }, { _id: 39, reg: 'LIG', value: 'GE', label: 'Genova', }, { + _id: 40, + reg: 'FVG', value: 'GO', - }, - { - label: 'Grosseto', - value: 'GR', - }, - { - label: 'Imperia', + label: 'Gorizia', + }, { _id: 41, reg: 'TOS', value: 'GR', label: 'Grosseto', }, { + _id: 42, + reg: 'LIG', value: 'IM', - }, - { - label: 'Isernia', - value: 'IS', - }, - { - label: 'La Spezia', + label: 'Imperia', + }, { _id: 43, reg: 'MOL', value: 'IS', label: 'Isernia', }, { + _id: 44, + reg: 'LIG', value: 'SP', - }, - { - label: 'L\'Aquila', - value: 'AQ', - }, - { - label: 'Latina', + label: 'La Spezia', + }, { _id: 45, reg: 'ABR', value: 'AQ', label: 'L\'Aquila', }, { + _id: 46, + reg: 'LAZ', value: 'LT', - }, - { - label: 'Lecce', - value: 'LE', - }, - { - label: 'Lecco', + label: 'Latina', + }, { _id: 47, reg: 'PUG', value: 'LE', label: 'Lecce', }, { + _id: 48, + reg: 'LOM', value: 'LC', - }, - { - label: 'Livorno', - value: 'LI', - }, - { - label: 'Lodi', + label: 'Lecco', + }, { _id: 49, reg: 'TOS', value: 'LI', label: 'Livorno', }, { + _id: 50, + reg: 'LOM', value: 'LO', - }, - { - label: 'Lucca', - value: 'LU', - }, - { - label: 'Macerata', + label: 'Lodi', + }, { _id: 51, reg: 'TOS', value: 'LU', label: 'Lucca', }, { + _id: 52, + reg: 'MAR', value: 'MC', - }, - { - label: 'Mantova', - value: 'MN', - }, - { - label: 'Massa-Carrara', + label: 'Macerata', + }, { _id: 53, reg: 'LOM', value: 'MN', label: 'Mantova', }, { + _id: 54, + reg: 'TOS', value: 'MS', - }, - { - label: 'Matera', - value: 'MT', - }, - { - label: 'Messina', + label: 'Massa-Carrara', + }, { _id: 55, reg: 'BAS', value: 'MT', label: 'Matera', }, { + _id: 56, + reg: 'SIC', value: 'ME', - }, - { - label: 'Milano', - value: 'MI', - }, - { - label: 'Modena', + label: 'Messina', + }, { _id: 57, reg: 'LOM', value: 'MI', label: 'Milano', }, { + _id: 58, + reg: 'EMR', value: 'MO', - }, - { - label: 'Monza e della Brianza', - value: 'MB', - }, - { - label: 'Napoli', + label: 'Modena', + }, { _id: 59, reg: 'LOM', value: 'MB', label: 'Monza e della Brianza', }, { + _id: 60, + reg: 'CAM', value: 'NA', - }, - { - label: 'Novara', - value: 'NO', - }, - { - label: 'Nuoro', + label: 'Napoli', + }, { _id: 61, reg: 'PIE', value: 'NO', label: 'Novara', }, { + _id: 62, + reg: 'SAR', value: 'NU', - }, - { - label: 'Olbia-Tempio', - value: 'OT', - }, - { - label: 'Oristano', + label: 'Nuoro', + }, { _id: 63, reg: 'SAR', value: 'OT', label: 'Olbia-Tempio', }, { + _id: 64, + reg: 'SAR', value: 'OR', - }, - { - label: 'Padova', - value: 'PD', - }, - { - label: 'Palermo', + label: 'Oristano', + }, { _id: 65, reg: 'VEN', value: 'PD', label: 'Padova', }, { + _id: 66, + reg: 'SIC', value: 'PA', - }, - { - label: 'Parma', - value: 'PR', - }, - { - label: 'Pavia', + label: 'Palermo', + }, { _id: 67, reg: 'EMR', value: 'PR', label: 'Parma', }, { + _id: 68, + reg: 'LOM', value: 'PV', - }, - { - label: 'Perugia', - value: 'PG', - }, - { - label: 'Pesaro e Urbino', + label: 'Pavia', + }, { _id: 69, reg: 'UMB', value: 'PG', label: 'Perugia', }, { + _id: 70, + reg: 'MAR', value: 'PU', - }, - { - label: 'Pescara', - value: 'PE', - }, - { - label: 'Piacenza', + label: 'Pesaro e Urbino', + }, { _id: 71, reg: 'ABR', value: 'PE', label: 'Pescara', }, { + _id: 72, + reg: 'EMR', value: 'PC', - }, - { - label: 'Pisa', - value: 'PI', - }, - { - label: 'Pistoia', + label: 'Piacenza', + }, { _id: 73, reg: 'TOS', value: 'PI', label: 'Pisa', }, { + _id: 74, + reg: 'TOS', value: 'PT', - }, - { - label: 'Pordenone', - value: 'PN', - }, - { - label: 'Potenza', + label: 'Pistoia', + }, { _id: 75, reg: 'FVG', value: 'PN', label: 'Pordenone', }, { + _id: 76, + reg: 'BAS', value: 'PZ', - }, - { - label: 'Prato', - value: 'PO', - }, - { - label: 'Ragusa', + label: 'Potenza', + }, { _id: 77, reg: 'TOS', value: 'PO', label: 'Prato', }, { + _id: 78, + reg: 'SIC', value: 'RG', - }, - { - label: 'Ravenna', - value: 'RA', - }, - { - label: 'Reggio Calabria', + label: 'Ragusa', + }, { _id: 79, reg: 'EMR', value: 'RA', label: 'Ravenna', }, { + _id: 80, + reg: 'CAL', value: 'RC', - }, - { - label: 'Reggio Emilia', - value: 'RE', - }, - { - label: 'Repubblica di San Marino', - value: 'RSM', - }, - { - label: 'Rieti', + label: 'Reggio CAL', + }, { _id: 81, reg: 'EMR', value: 'RE', label: 'Reggio Emilia', }, { + _id: 82, + reg: 'LAZ', value: 'RI', - }, - { - label: 'Rimini', - value: 'RN', - }, - { - label: 'Roma', + label: 'Rieti', + }, { _id: 83, reg: 'EMR', value: 'RN', label: 'Rimini', }, { + _id: 84, + reg: 'LAZ', value: 'RM', - }, - { - label: 'Rovigo', - value: 'RO', - }, - { - label: 'Salerno', + label: 'Roma', + }, { _id: 85, reg: 'VEN', value: 'RO', label: 'Rovigo', }, { + _id: 86, + reg: 'CAM', value: 'SA', - }, - { - label: 'Medio Campidano', - value: 'VS', - }, - { - label: 'Sassari', + label: 'Salerno', + }, { _id: 87, reg: 'SAR', value: 'VS', label: 'Medio Campidano', }, { + _id: 88, + reg: 'SAR', value: 'SS', - }, - { - label: 'Savona', - value: 'SV', - }, - { - label: 'Siena', + label: 'Sassari', + }, { _id: 89, reg: 'LIG', value: 'SV', label: 'Savona', }, { + _id: 90, + reg: 'TOS', value: 'SI', - }, - { - label: 'Siracusa', - value: 'SR', - }, - { - label: 'Sondrio', + label: 'Siena', + }, { _id: 91, reg: 'SIC', value: 'SR', label: 'Siracusa', }, { + _id: 92, + reg: 'LOM', value: 'SO', - }, - { - label: 'Taranto', - value: 'TA', - }, - { - label: 'Teramo', + label: 'Sondrio', + }, { _id: 93, reg: 'PUG', value: 'TA', label: 'Taranto', }, { + _id: 94, + reg: 'ABR', value: 'TE', - }, - { - label: 'Terni', - value: 'TR', - }, - { - label: 'Torino', + label: 'Teramo', + }, { _id: 95, reg: 'UMB', value: 'TR', label: 'Terni', }, { + _id: 96, + reg: 'PIE', value: 'TO', - }, - { - label: 'Ogliastra', - value: 'OG', - }, - { - label: 'Trapani', + label: 'Torino', + }, { _id: 97, reg: 'SAR', value: 'OG', label: 'Ogliastra', }, { + _id: 98, + reg: 'SIC', value: 'TP', - }, - { - label: 'Trento', - value: 'TN', - }, - { - label: 'Treviso', + label: 'Trapani', + }, { _id: 99, reg: 'TAA', value: 'TN', label: 'Trento', }, { + _id: 100, + reg: 'VEN', value: 'TV', - }, - { - label: 'Trieste', - value: 'TS', - }, - { - label: 'Udine', + label: 'Treviso', + }, { _id: 101, reg: 'FVG', value: 'TS', label: 'Trieste', }, { + _id: 102, + reg: 'FVG', value: 'UD', - }, - { - label: 'Varese', - value: 'VA', - }, - { - label: 'Venezia', + label: 'Udine', + }, { _id: 103, reg: 'LOM', value: 'VA', label: 'Varese', }, { + _id: 104, + reg: 'VEN', value: 'VE', - }, - { - label: 'Verbano-Cusio-Ossola', - value: 'VB', - }, - { - label: 'Vercelli', + label: 'Venezia', + }, { _id: 105, reg: 'PIE', value: 'VB', label: 'Verbano-Cusio-Ossola', }, { + _id: 106, + reg: 'PIE', value: 'VC', - }, - { - label: 'Verona', - value: 'VR', - }, - { - label: 'Vibo Valentia', + label: 'Vercelli', + }, { _id: 107, reg: 'VEN', value: 'VR', label: 'Verona', }, { + _id: 108, + reg: 'CAL', value: 'VV', - }, - { - label: 'Vicenza', - value: 'VI', - }, - { - label: 'Viterbo', + label: 'Vibo Valentia', + }, { _id: 109, reg: 'VEN', value: 'VI', label: 'Vicenza', }, { + _id: 110, + reg: 'LAZ', value: 'VT', - }, - ], + label: 'Viterbo', + }, { _id: 111, reg: 'RSM', value: 'RSM', label: 'Repubblica di San Marino', }], Regions: [ { @@ -632,11 +462,11 @@ export const shared_consts = { label: 'Campania', }, { - value: 'EMI', + value: 'EMR', label: 'Emilia-Romagna', }, { - value: 'FRI', + value: 'FVG', label: 'Friuli Venezia Giulia', }, { @@ -667,6 +497,10 @@ export const shared_consts = { value: 'PUG', label: 'Puglia', }, + { + value: 'RSM', + label: 'Repubblica di San Marino', + }, { value: 'SAR', label: 'Sardegna', @@ -680,7 +514,7 @@ export const shared_consts = { label: 'Toscana', }, { - value: 'TRE', + value: 'TAA', label: 'Trentino-Alto Adige', }, { @@ -688,7 +522,7 @@ export const shared_consts = { label: 'Umbria', }, { - value: 'VAL', + value: 'VDA', label: 'Valle d\'Aosta', }, { diff --git a/src/components/CFinder/CFinder.ts b/src/components/CFinder/CFinder.ts index 72a362d3..f63767e8 100755 --- a/src/components/CFinder/CFinder.ts +++ b/src/components/CFinder/CFinder.ts @@ -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') // console.log('recSubSkill', recSubSkill, 'recskills', recskills) 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 = [ { @@ -219,16 +230,17 @@ export default defineComponent({ icon: 'mood', filteradv: true, }, - /*{ + { label: 'Regione', table: 'regions', key: 'idReg', - value: 0, 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, - useinput: true, - },*/ + useinput: false, + }, { label: 'Provincia', table: 'provinces', @@ -237,9 +249,10 @@ export default defineComponent({ value: tools.getCookie(tools.COOK_SEARCH + 'provinces', costanti.FILTER_TUTTI), addall: true, arrvalue: [], - filter: null, + filter: getFilterProvinceByRegion, useinput: true, icon: 'flag', + tablesel: 'provinces', }, { label: 'Comune', @@ -370,16 +383,28 @@ export default defineComponent({ icon: 'mood', filteradv: true, }, - /*{ + { label: 'Regione', table: 'regions', key: 'idReg', - value: 0, 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, - 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', table: 'provinces', @@ -388,7 +413,7 @@ export default defineComponent({ value: tools.getCookie(tools.COOK_SEARCH + 'provinces', costanti.FILTER_TUTTI), addall: true, arrvalue: [], - filter: null, + filter: getFilterProvinceByRegion, useinput: true, icon: 'flag', }, @@ -469,16 +494,17 @@ export default defineComponent({ ] searchList_Beni.value = [ - /*{ + { label: 'Regione', table: 'regions', key: 'idReg', - value: 0, 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, - useinput: true, - },*/ + useinput: false, + }, { label: 'Provincia', table: 'provinces', @@ -487,7 +513,7 @@ export default defineComponent({ value: tools.getCookie(tools.COOK_SEARCH + 'provinces', costanti.FILTER_TUTTI), addall: true, arrvalue: [], - filter: null, + filter: getFilterProvinceByRegion, useinput: true, icon: 'flag', }, @@ -615,6 +641,17 @@ export default defineComponent({ ] 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', table: 'provinces', @@ -623,7 +660,7 @@ export default defineComponent({ value: tools.getCookie(tools.COOK_SEARCH + 'provinces', costanti.FILTER_TUTTI), addall: true, arrvalue: [], - filter: null, + filter: getFilterProvinceByRegion, useinput: true, icon: 'flag', }, diff --git a/src/components/CGridTableRec/CGridTableRec.ts b/src/components/CGridTableRec/CGridTableRec.ts index 4711a6ae..1e2e5f7e 100755 --- a/src/components/CGridTableRec/CGridTableRec.ts +++ b/src/components/CGridTableRec/CGridTableRec.ts @@ -405,16 +405,19 @@ export default defineComponent({ let filtersearch: any[] = [] let filtersearch2: any[] = [] let filtersearch3or: any[] = [] + let filtersearch3and: any[] = [] let filtercustom: any[] = [...props.filtercustom] let recSector = null let recSectorGood = null let recCities = null + let recRegion = null let recProvince = null let recSkill = null let idSector = 0 let idSectorGood = 0 let idProvince = 0 + let idRegion = 0 let idSkill = 0 if (searchList.value) { 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') 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) { recCities = searchList.value.find((item: ISearchList) => item.table === 'cities') } @@ -437,6 +444,9 @@ export default defineComponent({ idSkill = recSkill ? recSkill.value : 0 } + let arrfilter_cities: any = [] + let arrfilter_provices: any = [] + // console.table(searchList.value) if (searchList.value) { @@ -448,15 +458,26 @@ export default defineComponent({ // console.log(' item ', item) 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 if (item.value !== '' && item.value !== costanti.FILTER_TUTTI) { - filtersearch3or.push(obj) + filtersearch3and.push(obj) } 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') { @@ -464,7 +485,7 @@ export default defineComponent({ if (item.value && item.value.hasOwnProperty('_id')) { obj['idCity'] = item.value._id 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)) { @@ -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) if (props.prop_search) { @@ -579,6 +617,7 @@ export default defineComponent({ // @ts-ignore filtersearch2: filtersearch2, filtersearch3or: filtersearch3or, + filtersearch3and: filtersearch3and, // @ts-ignore filtercustom: filtercustom, sortBy: myobj, diff --git a/src/components/CMySelect/CMySelect.ts b/src/components/CMySelect/CMySelect.ts index 7ae8a365..60bdc371 100755 --- a/src/components/CMySelect/CMySelect.ts +++ b/src/components/CMySelect/CMySelect.ts @@ -428,6 +428,8 @@ export default defineComponent({ update( async () => { console.log('Filter val', val, val.length) + console.log('props.filter_extra', props.filter_extra) + let myarr: any = [] diff --git a/src/rootgen/admin/importdata/importdata.ts b/src/rootgen/admin/importdata/importdata.ts index 85e2c78d..09619cbc 100755 --- a/src/rootgen/admin/importdata/importdata.ts +++ b/src/rootgen/admin/importdata/importdata.ts @@ -333,9 +333,12 @@ export default defineComponent({ let lab = tools.addslashes(rec[0]) let val = tools.addslashes(rec[1]) if (cmd === shared_consts.Cmd.PROVINCE) { + let reg = tools.addslashes(rec[1]) + val = tools.addslashes(rec[2]) strris += '{ \n' strris += ' _id:' + ind + ',' + strris += ' reg:\'' + reg + '\',' strris += ' prov:\'' + val + '\',' strris += ' descr:\'' + lab + '\',' strris += '}, \n' diff --git a/src/store/Modules/fieldsTable.ts b/src/store/Modules/fieldsTable.ts index abc48a0a..243aa29a 100755 --- a/src/store/Modules/fieldsTable.ts +++ b/src/store/Modules/fieldsTable.ts @@ -417,6 +417,7 @@ export const colProvinces = [ // AddCol({ name: '_id', label_trans: 'index', fieldtype: costanti.FieldType.number }), AddCol({ name: 'label', label_trans: 'store.description' }), AddCol({ name: 'value', label_trans: 'city.prov' }), + AddCol({ name: 'reg', label_trans: 'city.reg' }), AddCol(DeleteRec), AddCol(DuplicateRec), ] @@ -776,6 +777,7 @@ export const colmySkills = [ remote_table: 'mycities', remote_key: '_id', remote_field: 'comune', + required: true, }), AddCol({ name: 'adType', @@ -935,6 +937,7 @@ export const colmyBachecas = [ remote_key: '_id', remote_field: 'comune', sortable: false, + required: true, }), AddCol({ name: 'adType', @@ -2023,7 +2026,7 @@ export const colTableUsersISP = [ label_trans: 'reg.consiglio', 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.qualifica', field: 'profile', subfield: 'qualifica', label_trans: 'reg.qualifica', }), AddCol({ @@ -2588,7 +2591,7 @@ export const fieldsTable = { { value: 'provinces', label: 'Provincia', - columns: colTablePermission, + columns: colProvinces, colkey: 'value', collabel: 'label', remote: true, diff --git a/src/store/globalStore.ts b/src/store/globalStore.ts index e337c524..3e897676 100644 --- a/src/store/globalStore.ts +++ b/src/store/globalStore.ts @@ -229,7 +229,7 @@ export const useGlobalStore = defineStore('GlobalStore', { else if (table === 'friends') return userStore.my.profile.friends 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') return userStore.groups else if (table === 'sendmsgs') @@ -246,7 +246,7 @@ export const useGlobalStore = defineStore('GlobalStore', { return state.skills else if (table === 'goods') return state.goods - // else if (table === 'subskills') + // else if (table === 'subskills') // return state.subSkills else if (table === 'statusSkills') return state.statusSkills @@ -514,7 +514,7 @@ export const useGlobalStore = defineStore('GlobalStore', { } } - console.log('update: ', myrec) + console.log('update: ', myrec) } } catch (e) { console.error(e) @@ -707,7 +707,7 @@ export const useGlobalStore = defineStore('GlobalStore', { isok = true } - await globalroutines( 'readall', 'config', null) + await globalroutines('readall', 'config', null) return isok }, @@ -896,7 +896,7 @@ export const useGlobalStore = defineStore('GlobalStore', { const ris = await this.saveTable(mydata) if (ris) { - this.newValueInMemoryByTable(ris, mytable); + this.newValueInMemoryByTable(ris, mytable) } 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 = { locale: tools.getLocale(), previewonly @@ -1435,12 +1435,12 @@ export const useGlobalStore = defineStore('GlobalStore', { }, getItemDate(num: number, day: number, mystr: string) { - let mydate = tools.addDays(tools.getDateNow(), day); - let mydateend = tools.addDays(mydate, 7); + let mydate = tools.addDays(tools.getDateNow(), day) + let mydateend = tools.addDays(mydate, 7) mydate = tools.getstrYYMMDDDate(mydate) mydateend = tools.getstrYYMMDDDate(mydateend) - let filter = { dateTimeStart: {$gte: mydate, $lte: mydateend } } - let obj = {_id: num, datestr: mystr, filter } + let filter = { dateTimeStart: { $gte: mydate, $lte: mydateend } } + let obj = { _id: num, datestr: mystr, filter } return obj }, @@ -1465,8 +1465,8 @@ export const useGlobalStore = defineStore('GlobalStore', { let obj = {} for (let i = 0; i < 120; i++) { - let mydate = tools.addDays(tools.getDateNow(), i - 30); - obj ={_id: mydate, datestr: tools.getstrVeryShortDate(mydate) } + let mydate = tools.addDays(tools.getDateNow(), i - 30) + obj = { _id: mydate, datestr: tools.getstrVeryShortDate(mydate) } arr.push(obj) } @@ -1476,45 +1476,41 @@ export const useGlobalStore = defineStore('GlobalStore', { }, 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)) { const newarr = [] for (const value of myarr) { - newarr.push({value, label:value}) + newarr.push({ value, label: value }) } myarr = newarr } 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) { + // console.log('table', table, 'filter', filter, 'arrprima', myarr) myarr = myarr.filter(filter) + // console.log('myarr', myarr) } - // console.log('myarr', table, myarr) - return myarr }, @@ -1528,7 +1524,7 @@ export const useGlobalStore = defineStore('GlobalStore', { } try { return this.serverMsgError.msgerr.message - }catch (e) { + } catch (e) { return this.serverMsgError.msgerr } }