Ora cambiando Settore, la Categoria viene sbiancata su "Nessuno" (anche se ancora rimane visivamente selezionato)

i campi obbligatori non funziona il controllo? (Erano i campi di tipo Array)
Aggiunta Categoria Ecovillaggi / Comunità + AutoProduzione
Aggiunte consulenza, affrancamento, supporto.. su temi di LAVORO
Quando inserisci un nuovo annuncio, prendi di default tutti i filtri visualizzati
Aggiungere bottone "Condividi Pagina" sui gruppi
This commit is contained in:
paoloar77
2022-02-28 03:33:21 +01:00
parent ab7650193a
commit a31d10ceb8
20 changed files with 268 additions and 104 deletions

View File

@@ -128,6 +128,7 @@ export const costanti = {
REQ_ADD_USER_TO_GROUP: 40,
REQ_REMOVE_USER_TO_GROUP: 41,
FILTER_NESSUNO: 0,
FILTER_TUTTI: -100,
TABLES_ARRAY: ['mygroups'],
TABLES_USERNAME_DATE: ['friends', 'friendsandme'],

View File

@@ -77,6 +77,7 @@ function AddCol(params: IColGridTable) {
tablesel: (params.tablesel === undefined) ? '' : params.tablesel,
jointable: (params.jointable === undefined) ? '' : params.jointable,
addall: (params.addall === undefined) ? false : params.addall,
addnone: (params.addnone === undefined) ? false : params.addnone,
filter: (params.filter === undefined) ? null : params.filter,
allowchar: (params.allowchar === undefined) ? null : params.allowchar,
showWhen: (params.showWhen === undefined) ? costanti.showWhen.NewRec + costanti.showWhen.InEdit + costanti.showWhen.InView : params.showWhen,
@@ -342,7 +343,7 @@ export const colSectors = [
name: 'idSector',
label_trans: 'sectors.name',
fieldtype: costanti.FieldType.select,
jointable: 'sectors',
jointable: toolsext.TABSECTORS,
}),
AddCol({ name: 'main', label_trans: 'store.main', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'color', label_trans: 'products.color' }),
@@ -458,7 +459,7 @@ export const colSkills = [
name: 'idSector',
label_trans: 'sectors.name',
fieldtype: costanti.FieldType.multiselect,
jointable: 'sectors',
jointable: toolsext.TABSECTORS,
}),
AddCol({ name: 'color', label_trans: 'products.color' }),
AddCol({ name: 'theme', label_trans: 'products.theme' }),
@@ -663,6 +664,7 @@ export const colmyGoods = [
fieldtype: costanti.FieldType.select,
required: false,
jointable: 'goods',
addnone: true,
filter_table: 'sectorgoods',
filter_field: 'idSectorGood',
noshowlabel: true,
@@ -818,7 +820,7 @@ export const colmySkills = [
label_trans: 'sectors.name',
fieldtype: costanti.FieldType.select,
required: true,
jointable: 'sectors',
jointable: toolsext.TABSECTORS,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
visible: true,
icon: 'category',
@@ -828,9 +830,10 @@ export const colmySkills = [
label_trans: 'skill.name',
fieldtype: costanti.FieldType.select,
jointable: 'skills',
filter_table: 'sectors',
filter_table: toolsext.TABSECTORS,
filter_field: 'idSector',
noshowlabel: true,
addnone: true,
icon: 'engineering',
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView,
allowNewValue: false,
@@ -1001,7 +1004,7 @@ export const colmyBachecas = [
label_trans: 'sectors.name',
fieldtype: costanti.FieldType.select,
required: true,
jointable: 'sectors',
jointable: toolsext.TABSECTORS,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
visible: true,
icon: 'category',
@@ -1012,7 +1015,8 @@ export const colmyBachecas = [
label_trans: 'skill.name',
fieldtype: costanti.FieldType.select,
jointable: 'skills',
filter_table: 'sectors',
addnone: true,
filter_table: toolsext.TABSECTORS,
filter_field: 'idSector',
noshowlabel: true,
icon: 'engineering',
@@ -2580,7 +2584,7 @@ export const fieldsTable = {
collabel: 'descr',
},
{
value: 'sectors',
value: toolsext.TABSECTORS,
label: 'Settori',
columns: colSectors,
colkey: '_id',
@@ -2595,7 +2599,7 @@ export const fieldsTable = {
},
{
value: 'catgrps',
label: 'Categorie',
label: 'Categorie Gruppi',
columns: colCatGrps,
colkey: '_id',
collabel: 'descr',

View File

@@ -4958,16 +4958,50 @@ export const tools = {
},
getCitySel() {
const objcity = tools.getCookie(tools.COOK_SEARCH + 'cities', {_id: 0})
let defcity: any = []
if (objcity && objcity._id > 0) {
defcity = [objcity._id]
} else {
return []
}
return defcity
},
getSelectionByTable(table: string, mydef: any) {
const arrtable = ['sectors', 'statusSkills', 'contribtypes', 'adtypes', 'sectorgoods', 'otherfilters', 'shippings']
const arrmultisel_tab = ['skills', 'goods']
const arrmultisel = [
{ table: 'skills', join: 'sectors'},
{ table: 'goods', join: 'sectorgoods'}
]
if (arrtable.includes(table)) {
return tools.getCookie(tools.COOK_SEARCH + table, mydef)
} else if (arrmultisel_tab.includes(table)){
const rec = arrmultisel.find((rec) => rec.table === table)
if (rec) {
return tools.getCookie(tools.COOK_SEARCH + table + '_' + tools.getCookie(tools.COOK_SEARCH + rec.join, 0), mydef)
}
}
return mydef
},
getdefaultnewrec_MySkill(): any {
return {
_id: 0,
idSector: 0,
idSkill: 0,
idStatusSkill: [],
idContribType: [],
idCity: [],
idSector: tools.getSelectionByTable('sectors', 0),
idSkill: tools.getSelectionByTable('skills', 0),
idStatusSkill: tools.getSelectionByTable('statusSkills', []),
idContribType: tools.getSelectionByTable('contribtypes', []),
idCity: this.getCitySel(),
NumLevel: 0,
adType: 0,
adType: tools.getSelectionByTable('adtypes', costanti.FILTER_TUTTI),
photos: [],
note: '',
//**ADDFIELD_MYSKILL
@@ -4979,15 +5013,25 @@ export const tools = {
getdefaultnewrec_MyGoods(): any {
return {
_id: 0,
idSectorGood: 0,
idGood: 0,
idShipping: [],
otherfilters: [],
idStatusSkill: [],
idContribType: [],
idCity: [],
// idSectorGood: 0,
// idGood: 0,
// idStatusSkill: [],
// idContribType: [],
// idCity: [],
// adType: 0
// idShipping: [],
// otherfilters: [],
idSectorGood: tools.getSelectionByTable('sectorgoods', 0),
idGood: tools.getSelectionByTable('goods', 0),
idStatusSkill: tools.getSelectionByTable('statusSkills', []),
idContribType: tools.getSelectionByTable('contribtypes', []),
idCity: this.getCitySel(),
NumLevel: 0,
adType: 0,
adType: tools.getSelectionByTable('adtypes', costanti.FILTER_TUTTI),
idShipping: [tools.getSelectionByTable('shippings', [])],
otherfilters: tools.getSelectionByTable('otherfilters', []),
photos: [],
note: '',
//**ADDFIELD_MYSKILL
@@ -5014,15 +5058,15 @@ export const tools = {
getdefaultnewrec_MyBacheca(): any {
return {
_id: 0,
idSector: 0,
idSkill: 0,
idStatusSkill: [],
idContribType: [],
idSector: tools.getSelectionByTable('sectors', 0),
idSkill: tools.getSelectionByTable('skills', 0),
idStatusSkill: tools.getSelectionByTable('statusSkills', []),
idContribType: tools.getSelectionByTable('contribtypes', []),
dateTimeStart: new Date(),
dateTimeEnd: new Date(),
idCity: [],
idCity: this.getCitySel(),
NumLevel: 0,
adType: 0,
adType: tools.getSelectionByTable('adtypes', costanti.FILTER_TUTTI),
photos: [],
note: '',
//**ADDFIELD_MYBACHECAS
@@ -5097,6 +5141,10 @@ export const tools = {
return ''
},
getPathByGroup(grp: any, table: string) {
return '/' + tools.getDirectoryByTable(table) + '/' + grp.groupname
},
// getLocale() {
// if (navigator.languages && navigator.languages.length > 0) {

View File

@@ -60,6 +60,8 @@ export const toolsext = {
TABUSER: 'users',
TABFRIENDS: 'friends',
TABMYGROUPS: 'mygroups',
TABSKILLS: 'skills',
TABSECTORS: 'sectors',
TABMYSKILLS: 'myskills',
TABMYGOODS: 'mygoods',
TABMYBACHECAS: 'mybachecas',

View File

@@ -250,7 +250,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
// return state.subSkills
else if (table === 'statusSkills')
return state.statusSkills
else if (table === 'sectors')
else if (table === toolsext.TABSECTORS)
return state.sectors
else if (table === 'sectorgoods')
return state.sectorgoods
@@ -1509,7 +1509,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
return arr
},
getTableJoinByName(table: string, addall?: boolean, filter?: any) {
getTableJoinByName(table: string, addall?: boolean, addnone?: boolean, filter?: any) {
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]
@@ -1541,6 +1541,19 @@ export const useGlobalStore = defineStore('GlobalStore', {
if (addall)
myarr = [costanti.FILTER_TUTTI, ...myarr]
if (addnone) {
const mykey = fieldsTable.getKeyByTable(table)
const collab = fieldsTable.getLabelByTable(table)
let obj: any = {}
obj[mykey] = costanti.FILTER_NESSUNO
obj[collab] = '[Nessuno]'
obj['idSector'] = []
myarr = [obj, ...myarr]
}
if (filter) {
// console.log('table', table, 'filter', filter, 'arrprima', myarr)
myarr = myarr.filter(filter)