- select specializz.

This commit is contained in:
paoloar77
2021-12-31 01:44:16 +01:00
parent 664b469d99
commit f31eb0ea99
18 changed files with 293 additions and 260 deletions

View File

@@ -1,5 +1,6 @@
// @ts-ignore
import { createI18n } from 'vue-i18n/dist/vue-i18n.esm-bundler'
// import { createI18n } from 'vue-i18n/index'
import { createI18n } from 'vue-i18n/dist/vue-i18n.esm-bundler.js'
import messages from '../statics/i18n'
import { boot } from 'quasar/wrappers'
// you'll need to create the src/i18n/index.js file too

View File

@@ -43,6 +43,7 @@ export default defineComponent({
function getFilterSkills(recSkill: any, index: number, arr: any) {
const recsectors:any = searchList.value.find((rec) => rec.table === 'sectors')
// console.log('getFilterSkills', recSkill.idSector, recsectors.value)
if (recsectors) {
return recSkill.idSector.includes(recsectors.value)
} else {
@@ -50,6 +51,16 @@ export default defineComponent({
}
}
function getFilterSubSkills(recSubSkill: any, index: number, arr: any) {
const recskills:any = searchList.value.find((rec) => rec.table === 'skills')
// console.log('recSubSkill', recSubSkill, 'recskills', recskills)
if (recskills) {
return recSubSkill.idSkill === recskills.value
} else {
return true
}
}
searchList.value = [
{
@@ -60,16 +71,30 @@ export default defineComponent({
arrvalue: [],
type: costanti.FieldType.select,
filter: null,
addall: true,
notinsearch: true,
},
{
label: 'Competenza',
table: 'skills',
key: 'idSkill',
value: tools.getCookie(tools.COOK_SEARCH + 'skills', costanti.FILTER_TUTTI),
value: tools.getCookie(tools.COOK_SEARCH + 'skills' + '_' + tools.getCookie(tools.COOK_SEARCH + 'sectors', costanti.FILTER_TUTTI), costanti.FILTER_TUTTI),
arrvalue: [],
type: costanti.FieldType.select,
addall: true,
filter: getFilterSkills,
showcount: true,
},
{
label: 'Specializz.',
table: 'subskills',
key: 'idSubSkill',
value: 0,
type: costanti.FieldType.multiselect,
arrvalue: [costanti.FILTER_TUTTI],
addall: true,
filter: getFilterSubSkills,
showcount: true,
},
{
label: 'Citta',
@@ -139,6 +164,7 @@ export default defineComponent({
return {
_id: 0,
idSkill: 0,
idSubSkill: [],
idStatusSkill: [],
idContribType: [],
idCity: [],
@@ -169,6 +195,7 @@ export default defineComponent({
recSkill: 1,
sector: 1,
idSkill: 1,
idSubSkill: 1,
idStatusSkill: 1,
idContribType: 1,
idCity: 1,
@@ -191,6 +218,13 @@ export default defineComponent({
lk_as: 'sector',
af_objId_tab: '',
},
lookup4: {
lk_tab: 'subskills',
lk_LF: 'idSubSkill',
lk_FF: '_id',
lk_as: 'myskill',
af_objId_tab: '',
},
}
}

View File

@@ -35,3 +35,9 @@
align-items: center;
justify-content: center;
}
.riduci_pad {
min-height: 30px;
padding: 4px 8px !important;
}

View File

@@ -204,6 +204,18 @@ export default defineComponent({
const mycodeid = toRef(props, 'prop_codeId')
const valoriopt = computed(() => (item: any, addall: boolean) => {
// console.log('valoriopt', item.table)
return globalStore.getTableJoinByName(item.table, addall, item.filter)
})
const labelcombo = computed(() => (item: any) => {
let lab = item.label
if (item.showcount)
lab += ' (' + valoriopt.value(item, false).length + ')'
return lab
})
watch(searchList.value, (to: any, from: any) => {
console.log('watch searchlist', to)
refresh()
@@ -212,6 +224,37 @@ export default defineComponent({
function searchval(newval: any, table: any) {
console.log('searchval', newval, table)
tools.setCookie(tools.COOK_SEARCH + table, newval)
if (table === 'skills') {
const recSector = searchList.value.find((rec) => rec.table === 'sectors')
if (recSector)
tools.setCookie(tools.COOK_SEARCH + table + '_' + recSector.value, newval)
}
if (table === 'sectors') {
for (const item of searchList.value) {
if ((item.table === 'subskills')) {
// item.arrvalue = [costanti.FILTER_TUTTI]
}
if (item.table === 'skills') {
// console.log('---PRIMA ', item.value)
const valsaved = tools.getCookie(tools.COOK_SEARCH + 'skills' + '_' + newval, costanti.FILTER_TUTTI)
if (valsaved)
item.value = valsaved
else
item.value = costanti.FILTER_TUTTI
// console.log('---DOPO ', item.value)
}
}
}
/*if (table === 'skills') {
for (const item of searchList.value) {
if (item.table === 'subskills') {
item.arrvalue = [costanti.FILTER_TUTTI]
}
}
} */
refresh()
}
@@ -267,16 +310,24 @@ export default defineComponent({
let filtersearch2: any[] = []
let recSector = null;
let recSkill = null;
let idSector = 0;
let idSkill = 0;
if (searchList.value) {
recSector = searchList.value.find((item: ISearchList) => item.table === 'sectors')
idSector = recSector ? recSector.value : 0
}
if (searchList.value) {
recSkill = searchList.value.find((item: ISearchList) => item.table === 'skills')
idSkill = recSkill ? recSkill.value : 0
}
// console.table(searchList.value)
if (searchList.value) {
searchList.value.forEach((item: ISearchList) => {
for (const item of searchList.value) {
//searchList.value.forEach((item: ISearchList) => {
if (!item.notinsearch) {
let objitem: any = {}
if (item.value > 0) {
@@ -304,15 +355,22 @@ export default defineComponent({
if (arr2.length > 0)
filtersearch.push(obj2)
} else {
if (item.table === 'skills' && item.value === costanti.FILTER_TUTTI) {
if ((item.table === 'skills') && item.value === costanti.FILTER_TUTTI) {
let obj2: any = {}
// idSector
obj2['sector._id'] = idSector
filtersearch2.push(obj2)
}
if ((item.table === 'subskills') && item.value === costanti.FILTER_TUTTI) {
let obj2: any = {}
// idSector
obj2['myskill._id'] = idSkill
filtersearch2.push(obj2)
}
}
}
})
}
}
console.log('filtersearch', filtersearch)
@@ -1146,6 +1204,8 @@ export default defineComponent({
searchval,
canModifyThisRec,
checkIfShowRec,
valoriopt,
labelcombo,
}
}
})

View File

@@ -1,5 +1,5 @@
<template>
<div class="q-pa-xs" v-if="isfinishLoading">
<div :class="$q.screen.lt.sm ? `` : `q-pa-xs`" v-if="isfinishLoading">
<div class="centermydiv q-ma-sm" style="text-align: center">
<q-btn
v-if="mytable && visButtRow()" rounded dense color="primary"
@@ -8,39 +8,7 @@
@click="createNewRecordDialog"></q-btn>
</div>
<div
v-if="prop_search"
class="row justify-center vertical-middle">
<q-input
v-model="search" filled dense type="search" debounce="500" hint="Cerca"
v-on:keyup.enter="doSearch">
<template v-slot:after>
<q-btn v-if="mytable" dense label="" color="primary" @click="refresh" icon="search"></q-btn>
</template>
</q-input>
<q-space></q-space>
<q-select
v-if="mytable"
v-model="colVisib"
rounded
outlined
multiple
dense
options-dense
:display-value="$t('grid.columns')"
emit-value
map-options
:options="mycolumns"
option-value="name"
@update:model-value="changeCol">
</q-select>
</div>
<div class="q-gutter-md q-ma-xs row">
<div :class="$q.screen.lt.sm ? `` : `q-gutter-md q-ma-xs` + ` row`">
<div class="q-table__title" style="min-width: 150px;">{{ mytitle }}</div>
<q-space></q-space>
<div v-if="butt_modif_new">
@@ -128,60 +96,61 @@
</div>
</template>
<template v-slot:top-left>
<template v-slot:top-left v-if="searchList">
<div class="row text-blue">
<div v-for="(item, index) in searchList" :key="index">
<div v-if="searchList"
:class="$q.screen.lt.sm ? `` : `row` + ` text-blue`">
<span v-for="(item, index) in searchList" :key="index">
<CMySelect
v-if="item.type === costanti.FieldType.select"
:label="item.label"
:label="labelcombo(item)"
v-model:value="item.value"
@update:value="searchval(item.value, item.table)"
:addall="true"
label-color="primary"
class="combowidth"
color="primary"
:optval="fieldsTable.getKeyByTable(item.table)"
:optlab="fieldsTable.getLabelByTable(item.table)"
:options="globalStore.getTableJoinByName(item.table, true, item.filter)"
:useinput="false"
>
:options="valoriopt(item, false)"
:useinput="false">
</CMySelect>
<q-select
v-if="item.type === costanti.FieldType.multiselect"
v-model="item.arrvalue"
label-color="primary"
:label="labelcombo(item)"
@update:model-value="searchval(item.arrvalue, item.table)"
rounded
dense
outlined
multiple
dense
options-dense
:display-value="fieldsTable.getTitleByTable(item.table)"
emit-value
map-options
stack-label
:options="globalStore.getTableJoinByName(item.table, item.filter)"
style="min-width: 150px"
:options="valoriopt(item, item.addall)"
class="combowidth"
:option-value="fieldsTable.getKeyByTable(item.table)"
>
<template
v-if="item.arrvalue.length >= 1"
v-slot:selected-item="scope">
<q-chip
removable
dense
@remove="scope.removeAtIndex(scope.index)"
v-if="checkIfShowRec(scope.opt)"
color="white"
text-color="mycol"
class="q-my-none q-ml-xs q-mr-none"
>
<q-avatar color="primary" text-color="white" :icon="item.icon" size="12px"/>
{{ scope.opt[fieldsTable.getLabelByTable(item.table)] }}
</q-chip>
<div v-if="scope.opt === -100 && item.arrvalue.length === 1">
{{ fieldsTable.getTitleByTable(item.table) }}
<div v-if="scope.opt[fieldsTable.getLabelByTable(item.table)]">
<q-chip
removable
dense
@remove="scope.removeAtIndex(scope.index)"
v-if="checkIfShowRec(scope.opt)"
color="white"
text-color="mycol"
class="q-my-none q-ml-xs q-mr-none"
>
<q-avatar color="primary" text-color="white" :icon="item.icon" size="12px"/>
{{ scope.opt[fieldsTable.getLabelByTable(item.table)] }}
</q-chip>
</div>
</template>
<template v-slot:option="{ itemProps, opt, selected, toggleOption }">
@@ -197,8 +166,43 @@
</template>
</q-select>
</div>
</span>
</div>
<div
class="row justify-center vertical-middle">
<div v-if="prop_search" class="q-mr-sm">
<q-input
v-model="search" filled dense type="search" debounce="500" hint="Cerca"
v-on:keyup.enter="doSearch">
<template v-slot:after>
<q-btn v-if="mytable" dense label="" color="primary" @click="refresh" icon="search"></q-btn>
</template>
</q-input>
</div>
<q-space></q-space>
<q-select
v-if="mytable"
v-model="colVisib"
rounded
outlined
multiple
dense
options-dense
:display-value="$t('grid.columns')"
emit-value
map-options
:options="mycolumns"
option-value="name"
@update:model-value="changeCol">
</q-select>
</div>
<div v-if="pagination.rowsNumber > 0">{{ pagination.rowsNumber }} elementi trovati</div>
</template>
<template v-slot:body="props">
@@ -245,6 +249,7 @@
<br>
</template>
<template v-slot:item="props">
<div
class="q-pa-xs col-xs-12 col-sm-6 col-md-4 col-lg-3 grid-style-transition"
@@ -271,7 +276,7 @@
<q-card-section class="inset-shadow">
<q-list dense>
<div v-for="col in mycolumns" :key="col.name">
<q-item v-if="colVisib.includes(col.field + col.subfield)" :class="clByCol(col)">
<q-item v-if="colVisib.includes(col.field + col.subfield)" :class="clByCol(col)" class="riduci_pad">
<q-item-section avatar v-if="visuIntestazCol(col)">
<q-item-label class="q-table__col">{{ col.label }}</q-item-label>
</q-item-section>

View File

@@ -42,7 +42,6 @@ export default defineComponent({
},
components: {},
setup(props, { emit }) {
const $q = useQuasar()
const { t } = useI18n()
const myval = toRef(props, 'value')

View File

@@ -224,7 +224,7 @@
emit-value
map-options
:options="globalStore.getTableJoinByName(col.jointable)"
style="min-width: 150px"
class="combowidth"
:option-value="fieldsTable.getKeyByTable(col.jointable)"
@update:model-value="changevalRec">
@@ -482,7 +482,7 @@
emit-value
map-options
:options="globalStore.getTableJoinByName(col.jointable)"
style="min-width: 150px"
class="combowidth"
:option-value="fieldsTable.getKeyByTable(col.jointable)"
@update:model-value="changeval">

View File

@@ -1,4 +1,4 @@
import { computed, defineComponent, onMounted, ref } from 'vue'
import { computed, defineComponent, onMounted, ref, watch } from 'vue'
import { useI18n } from '@src/boot/i18n'
import { useUserStore } from '@store/UserStore'
import { useGlobalStore } from '@store/globalStore'
@@ -96,6 +96,16 @@ export default defineComponent({
return myarr
})
watch(() => props.options, (value: any, oldval: any) => {
valori.value = valoriload.value
},
)
watch(() => props.value, (value: any, oldval: any) => {
mounted()
},
)
function changeval(newval: any) {
if (props.tablesel === shared_consts.TAB_COUNTRY)
myvalue.value = newval && newval['value'] ? newval['value'] : newval
@@ -113,19 +123,11 @@ export default defineComponent({
if (props.options) {
const rec: any = props.options.find((myrec: any) => myrec[`${props.optval}`] === props.value)
/*console.log('rec', rec, 'props.useinput', props.useinput)
console.log('props.value', props.value)
console.log('options', props.options)
console.log('optval', props.optval)
console.log('optlab', props.optlab)*/
if (rec) {
if (props.funcgetvaluebyid)
myvalue.value = props.funcgetvaluebyid(rec[`${props.optval}`])
else
myvalue.value = rec[`${props.optlab}`]
// console.log('myvalue', myvalue, 'optval', props.optval, 'rec', rec[`${props.optval}`])
} else {
if (!props.useinput) {
if (props.value) {

View File

@@ -78,7 +78,8 @@
options-selected-class="text-deep-orange"
map-options
v-bind="$attrs"
style="min-width: 170px; max-width: 400px;">
class="combowidth"
>
<template v-slot:option="scope">
<q-item v-bind="scope.itemProps">
<q-item-section avatar>

View File

@@ -20,7 +20,7 @@ import { email, minLength, required, sameAs } from '@vuelidate/validators'
// import { ValidationRuleset } from 'vuelidate'
import { complexity, registeredemail, registereduser, aportadorexist } from '../../validation'
import 'vue3-tel-input/dist/vue3-tel-input.css'
// import 'vue3-tel-input/dist/vue3-tel-input.css'
import { useRoute, useRouter } from 'vue-router'
// import {Loading, QSpinnerFacebook, QSpinnerGears} from 'quasar'

View File

@@ -59,6 +59,7 @@ export default defineComponent({
return {
_id: 0,
idSkill: 0,
idSubSkill: [],
idStatusSkill: [],
idContribType: [],
idCity: [],
@@ -80,6 +81,7 @@ export default defineComponent({
af_objId_tab: 'myId',
lk_proj: {
idSkill: 1,
idSubSkill: 1,
numLevel: 1,
photos: 1,
note: 1,

View File

@@ -866,3 +866,10 @@ $heightBtn: 100%;
.centeritems{
place-content: center;
}
.combowidth {
min-width: 150px;
@media (max-width: 400px) {
min-width: 300px;
}
}

View File

@@ -255,6 +255,7 @@ export interface IGlobalState {
URL_RESTORE: string
levels: ILevel[],
skills: ISkill[],
subSkills: ISubSkill[],
statusSkills: IStatusSkill[],
sectors: ISector[],
cities: ICity[],
@@ -470,6 +471,7 @@ export interface IParamsQuery {
lookup1?: IParLookup
lookup2?: IParLookup
lookup3?: IParLookup
lookup4?: IParLookup
}
export interface IColGridTable {
@@ -516,6 +518,8 @@ export interface ISearchList {
type: number
filter: any
notinsearch?: boolean
addall?: boolean
showcount?: boolean
}
export interface IFilter {
@@ -581,6 +585,14 @@ export interface ISkill {
img?: string
}
export interface ISubSkill {
_id: number
descr: string
idSkill: number
icon?: string
img?: string
}
export interface IStatusSkill {
_id: number
descr: string
@@ -616,6 +628,7 @@ export interface ICity {
export interface IMySkill {
_id: number
idSkill: number
idSubSkill: number[]
idStatusSkill: number[]
idContribType: string[]
idCity: number[]

View File

@@ -772,6 +772,8 @@ const msg_it = {
name: 'Competenza',
city: 'Città',
photos: 'Foto',
note: 'Note',
subskill: 'Specializz.',
},
level: {
name: 'Livello',

View File

@@ -365,6 +365,23 @@ export const colSkills = [
AddCol(DeleteRec),
]
export const colSubSkills = [
// AddCol({ name: '_id', label_trans: 'index', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'descr', label_trans: 'store.description' }),
AddCol({ name: 'img', label_trans: 'store.img' }),
AddCol({ name: 'icon', label_trans: 'store.icon' }),
AddCol({
name: 'idSkill',
label_trans: 'skill.name',
fieldtype: costanti.FieldType.select,
jointable: 'skills',
}),
AddCol({ name: 'color', label_trans: 'products.color' }),
AddCol({ name: 'theme', label_trans: 'products.theme' }),
AddCol(DuplicateRec),
AddCol(DeleteRec),
]
export const colmySkills = [
/*AddCol({
name: 'userId', label_trans: 'order.users', fieldtype: costanti.FieldType.string, jointable: 'users',
@@ -380,6 +397,13 @@ export const colmySkills = [
required: true,
jointable: 'skills',
}),
AddCol({
name: 'idSubSkill',
label_trans: 'skill.subskill',
fieldtype: costanti.FieldType.multiselect,
required: true,
jointable: 'subskills',
}),
AddCol({
name: 'numLevel',
label_trans: 'level.name',
@@ -411,7 +435,7 @@ export const colmySkills = [
fieldtype: costanti.FieldType.listimages,
jointable: '',
}),
AddCol({ name: 'subTitle', label_trans: 'event.title' }),
AddCol({ name: 'subTitle', label_trans: 'skill.note' }),
AddCol({ name: 'note', label_trans: 'proj.longdescr', fieldtype: costanti.FieldType.html }),
AddCol(DuplicateRec),
AddCol(ModifRec),
@@ -1673,6 +1697,13 @@ export const fieldsTable = {
colkey: '_id',
collabel: 'descr',
},
{
value: 'subskills',
label: 'Specializz',
columns: colSubSkills,
colkey: '_id',
collabel: 'descr',
},
{
value: 'statusSkills',
label: 'Stato Attuale',

View File

@@ -118,6 +118,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
URL_RESTORE: '',
levels: [],
skills: [],
subSkills: [],
statusSkills: [],
sectors: [],
cities: [],
@@ -226,6 +227,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
return state.levels
else if (table === 'skills')
return state.skills
else if (table === 'subskills')
return state.subSkills
else if (table === 'statusSkills')
return state.statusSkills
else if (table === 'sectors')
@@ -1149,6 +1152,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
this.departments = (res.data.departments) ? [...res.data.departments] : []
this.levels = (res.data.levels) ? [...res.data.levels] : []
this.skills = (res.data.skills) ? [...res.data.skills] : []
this.subSkills = (res.data.subSkills) ? [...res.data.subSkills] : []
this.statusSkills = (res.data.statusSkills) ? [...res.data.statusSkills] : []
this.sectors = (res.data.sectors) ? [...res.data.sectors] : []
this.cities = (res.data.cities) ? [...res.data.cities] : []
@@ -1294,8 +1298,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
let myarr = this.getListByTable(table)
// if (addall)
// myarr = [costanti.FILTER_TUTTI, ...myarr]
if (addall)
myarr = [costanti.FILTER_TUTTI, ...myarr]
if (!addall) {
/*if (table === 'skills') {