diff --git a/src/server/populate/sectorgoods.js b/src/server/populate/sectorgoods.js index 6de6068..27a6f40 100644 --- a/src/server/populate/sectorgoods.js +++ b/src/server/populate/sectorgoods.js @@ -1,23 +1,24 @@ module.exports = { list: [ - {_id: 1, descr: 'Abbigliamento'}, - {_id: 2, descr: 'Arredamento'}, - {_id: 3, descr: 'Auto e Moto'}, - {_id: 4, descr: 'Artigianato'}, - {_id: 5, descr: 'Bellezza e Igiene'}, - {_id: 6, descr: 'Bimbi'}, + {_id: 1, descr: 'Abbigliamento', icon: 'fas fa-tshirt', color: 'blue-7'}, + {_id: 2, descr: 'Arredamento', icon: 'fas fa-chair', color: 'green-7'}, + {_id: 3, descr: 'Auto e Moto', icon: 'fas fa-car', color: 'orange-7'}, + {_id: 4, descr: 'Artigianato', icon: 'fas fa-screwdriver', color: 'red-7'}, + {_id: 5, descr: 'Bellezza e Igiene', icon: 'fas fa-spa', color: 'purple-7'}, + {_id: 6, descr: 'Bimbi', icon: 'fas fa-child', color: 'cyan-7'}, {_id: 7, descr: 'Cibo'}, {_id: 8, descr: 'Collezionismo e Antiquariato'}, {_id: 9, descr: 'Elettronica'}, - {_id: 10, descr: 'Giochi'}, - {_id: 11, descr: 'Hobby'}, - {_id: 12, descr: 'Libri'}, - {_id: 13, descr: 'Musica e Film'}, - {_id: 14, descr: 'Scuola e Ufficio'}, - {_id: 15, descr: 'Sport'}, - {_id: 16, descr: 'Un po\' di Tutto'}, - {_id: 17, descr: 'Attrezzature'}, - {_id: 18, descr: 'Animali'}, + {_id: 10, descr: 'Giochi', icon: 'fas fa-gamepad', color: 'purple-7'}, + {_id: 11, descr: 'Hobby', icon: 'fas fa-guitar', color: 'cyan-7'}, + {_id: 12, descr: 'Libri', icon: 'fas fa-book', color: 'indigo-7'}, + {_id: 13, descr: 'Musica e Film', icon: 'fas fa-music', color: 'brown-7'}, + {_id: 14, descr: 'Scuola e Ufficio', icon: 'fas fa-graduation-cap', color: 'pink-7'}, + {_id: 15, descr: 'Sport', icon: 'fas fa-futbol', color: 'orange-7'}, + {_id: 16, descr: 'Un po\' di Tutto', icon: 'fas fa-globe-europe', color: 'red-7'}, + {_id: 17, descr: 'Attrezzature', icon: 'fas fa-tools', color: 'blue-7'}, + {_id: 18, descr: 'Animali', icon: 'fas fa-paw', color: 'green-7'}, + {_id: 19, descr: 'Arte / Decorazioni', icon: 'fas fa-palette', color: 'purple-7'}, ], }; diff --git a/src/server/populate/sectors.js b/src/server/populate/sectors.js index eeadae2..3a8fc35 100644 --- a/src/server/populate/sectors.js +++ b/src/server/populate/sectors.js @@ -12,6 +12,6 @@ module.exports = { {_id: 11, descr: 'Progetti di Gruppo'}, {_id: 12, descr: 'Salute'}, {_id: 13, descr: 'Tecnologie'}, - {_id: 14, descr: 'Servizi'}, + {_id: 14, descr: 'Servizi'}, ], }; diff --git a/src/server/tools/general.js b/src/server/tools/general.js index 616168e..651d5c4 100755 --- a/src/server/tools/general.js +++ b/src/server/tools/general.js @@ -4548,9 +4548,12 @@ module.exports = { async getInCambioDiByRec(myrec) { const { Contribtype } = require('../models/contribtype'); - const contribtype = await Contribtype.findAllIdApp(idapp); - try { + const idapp = myrec.idapp; + if (!idapp) + return ''; + const contribtype = await Contribtype.findAllIdApp(idapp); + let mystr = ''; for (const contribId of myrec.idContribType) { const reccontr = contribtype.find((rec) => rec._id.toString() === contribId); @@ -4570,9 +4573,12 @@ module.exports = { async getStatusSkillByRec(myrec, onlyifNoDiPersona) { const { StatusSkill } = require('../models/statusSkill'); - const statusskill = await StatusSkill.findAllIdApp(idapp); - try { + const idapp = myrec.idapp; + if (!idapp) + return ''; + const statusskill = await StatusSkill.findAllIdApp(idapp); + let mystr = ''; if (onlyifNoDiPersona) { if ((myrec.idStatusSkill.length === 1) && (myrec.idStatusSkill[0] === shared_consts.STATUSSKILL_DI_PERSONA)) @@ -4606,10 +4612,16 @@ module.exports = { const { Skill } = require('../models/skill'); const { Sector } = require('../models/sector'); - const skillrec = await Skill.findAllIdApp(idapp); - const sectorrec = await Sector.findAllIdApp(idapp); try { + // console.log('myrec', myrec); + const idapp = myrec.idapp; + if (!idapp) + return ''; + + const skillrec = await Skill.findAllIdApp(idapp); + const sectorrec = await Sector.findAllIdApp(idapp); + let mystr = ''; const recsec = sectorrec.find((rec) => rec._id === myrec.idSector); if (recsec) { @@ -4629,9 +4641,13 @@ module.exports = { // const { Good } = require('../models/good'); // const goodrec = await Good.findAllIdApp(idapp); - const secgoodrec = await SectorGood.findAllIdApp(idapp); try { + const idapp = myrec.idapp; + if (!idapp) + return ''; + const secgoodrec = await SectorGood.findAllIdApp(idapp); + let mystr = ''; const rec = secgoodrec.find((rec) => rec._id === myrec.idSectorGood); // const rec = goodrec.find((rec) => rec._id === myrec.idSectorGood);