Lista Città (prese dal server: pickup)

This commit is contained in:
paoloar77
2022-01-20 00:38:49 +01:00
parent 2d3eff1065
commit d442aa75e8
35 changed files with 1427 additions and 143 deletions

View File

@@ -51,6 +51,10 @@ export default defineComponent({
}
}
function getFilterCities(recSkill: any, index: number, arr: any) {
return true
}
function getFilterSubSkills(recSubSkill: any, index: number, arr: any) {
const recskills:any = searchList.value.find((rec) => rec.table === 'skills')
// console.log('recSubSkill', recSubSkill, 'recskills', recskills)
@@ -73,6 +77,7 @@ export default defineComponent({
filter: null,
addall: true,
notinsearch: true,
useinput: false,
},
{
label: 'Competenza',
@@ -84,6 +89,7 @@ export default defineComponent({
addall: true,
filter: getFilterSkills,
showcount: true,
useinput: true,
},
{
label: 'Specializz.',
@@ -95,15 +101,28 @@ export default defineComponent({
addall: true,
filter: getFilterSubSkills,
showcount: true,
useinput: false,
},
{
label: 'Regione',
table: 'regions',
key: 'idReg',
value: 0,
type: costanti.FieldType.select,
arrvalue: tools.getCookie(tools.COOK_SEARCH + 'regions', [costanti.FILTER_TUTTI]),
filter: null,
useinput: true,
},
{
label: 'Citta',
table: 'cities',
key: 'idCity',
type: costanti.FieldType.multiselect_by_server,
value: 0,
type: costanti.FieldType.multiselect,
arrvalue: tools.getCookie(tools.COOK_SEARCH + 'cities', [costanti.FILTER_TUTTI]),
filter: null,
useinput: true,
tablesel: 'cities',
},
{
label: 'Livello',
@@ -113,6 +132,7 @@ export default defineComponent({
arrvalue: [],
type: costanti.FieldType.select,
filter: null,
useinput: false,
},
{
label: 'Stato',
@@ -122,6 +142,7 @@ export default defineComponent({
arrvalue: tools.getCookie(tools.COOK_SEARCH + 'statusSkills', [costanti.FILTER_TUTTI]),
type: costanti.FieldType.multiselect,
filter: null,
useinput: false,
},
{
label: 'Contributo',
@@ -131,6 +152,7 @@ export default defineComponent({
arrvalue: tools.getCookie(tools.COOK_SEARCH + 'contribtypes', [costanti.FILTER_TUTTI]),
type: costanti.FieldType.multiselect,
filter: null,
useinput: false,
},
]
@@ -208,7 +230,10 @@ export default defineComponent({
userId: 1,
username: 1,
name: 1,
surname: 1
surname: 1,
comune: 1,
'profile.img': 1,
'profile.qualifica': 1,
}
},
lookup3: {
@@ -225,6 +250,13 @@ export default defineComponent({
lk_as: 'myskill',
af_objId_tab: '',
},
lookup5: {
lk_tab: 'cities',
lk_LF: 'idCity',
lk_FF: '_id',
lk_as: 'comune',
af_objId_tab: '',
},
}
}

View File

@@ -227,6 +227,8 @@ export default defineComponent({
const mycodeid = toRef(props, 'prop_codeId')
const myvertical = ref(0)
const valoriopt = computed(() => (item: any, addall: boolean) => {
// console.log('valoriopt', item.table)
return globalStore.getTableJoinByName(item.table, addall, item.filter)
@@ -730,7 +732,9 @@ export default defineComponent({
const mysub = elem.subfield ? elem.subfield : ''
if (elem) {
if (elem.field !== costanti.NOFIELD) {
colVisib.value.push(elem.field + mysub)
if (checkIfColShow(elem.field)) {
colVisib.value.push(elem.field + mysub)
}
}
if (elem.visible && elem.field === costanti.NOFIELD) {
@@ -792,6 +796,11 @@ export default defineComponent({
mycolumns.value = props.prop_mycolumns
colkey.value = props.prop_colkey
pagination.value = props.prop_pagination
myvertical.value = props.vertical ? -1 : 0
if (props.finder) {
myvertical.value = tools.getCookie('myv', 0)
}
}
function mounted() {
@@ -799,10 +808,12 @@ export default defineComponent({
console.log('props.filtercustom', props.filtercustom)
if (!!props.tablesList) {
canEdit.value = tools.getCookie(tools.CAN_EDIT, canEdit) === 'true'
tablesel.value = tools.getCookie('tablesel', tablesel.value)
}
myfilterand.value = props.filterdef
// myfiltercustom.value = props.filtercustom
// console.log('tablesel', tablesel)
@@ -926,6 +937,16 @@ export default defineComponent({
}
}
function checkIfColShow(field: string|undefined) {
let vis = true
if (props.prop_mytable === 'myskills' && !props.prop_search) {
if (field === 'username') {
vis = false
}
}
return vis
}
function changeCol(newval: any) {
// console.log('changecol', mytable.value)
if (!!mytable.value) {
@@ -993,8 +1014,11 @@ export default defineComponent({
colVisib.value = myselcol.split('|')
} else {
mycolumns.value.forEach((elem: any) => {
if (elem.field !== costanti.NOFIELD)
colVisib.value.push(elem.field + elem.subfield)
if (elem.field !== costanti.NOFIELD) {
if (checkIfColShow(elem.field)) {
colVisib.value.push(elem.field + elem.subfield)
}
}
})
}
}
@@ -1163,7 +1187,6 @@ export default defineComponent({
return (rec._id > 0 && typeof rec._id === 'number') || rec._id !== 'number'
}
// onMounted(mounted)
created()
@@ -1236,6 +1259,7 @@ export default defineComponent({
valoriopt,
labelcombo,
filter,
myvertical,
}
}
})

View File

@@ -32,7 +32,7 @@
<q-spinner-tail size="2em" color="primary"/>
</q-inner-loading>
<q-table
:grid="vertical"
:grid="myvertical === -1 || myvertical === 2"
flat
bordered
class="my-sticky-header-table"
@@ -102,22 +102,46 @@
: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"
v-if="(item.type === costanti.FieldType.select) || (item.type === costanti.FieldType.select_by_server)"
:label="labelcombo(item)"
v-model:value="item.value"
@update:value="searchval(item.value, item.table)"
:addall="true"
:tablesel="item.type === costanti.FieldType.select_by_server ? item.tablesel : ''"
:pickup="item.type === costanti.FieldType.select_by_server"
label-color="primary"
class="combowidth"
color="primary"
:optval="fieldsTable.getKeyByTable(item.table)"
:optlab="fieldsTable.getLabelByTable(item.table)"
:options="valoriopt(item, false)"
:useinput="false">
:useinput="item.useinput && item.type !== costanti.FieldType.select_by_server">
</CMySelect>
<!--<div v-if="item.type === costanti.FieldType.multiselect_by_server">
item: {{ item}}
</div>-->
<CMySelect
v-if="item.type === costanti.FieldType.multiselect_by_server"
:multiselect_by_server="true"
:label="labelcombo(item)"
v-model:arrvalue="item.arrvalue"
@update:arrvalue="searchval(item.arrvalue, item.table)"
:addall="false"
:tablesel="item.tablesel"
:pickup="true"
label-color="primary"
class="combowidth"
color="primary"
:optval="fieldsTable.getKeyByTable(item.table)"
:optlab="fieldsTable.getLabelByTable(item.table)"
:options="valoriopt(item, false)"
:useinput="true">
</CMySelect>
<q-select
v-if="item.type === costanti.FieldType.multiselect"
v-if="(item.type === costanti.FieldType.multiselect)"
v-model="item.arrvalue"
label-color="primary"
:label="labelcombo(item)"
@@ -130,6 +154,7 @@
emit-value
map-options
stack-label
:useinput="item.useinput"
:options="valoriopt(item, item.addall)"
class="combowidth"
:option-value="fieldsTable.getKeyByTable(item.table)"
@@ -202,7 +227,14 @@
</div>
<div v-if="pagination.rowsNumber > 0 && prop_search">{{ pagination.rowsNumber }} elementi trovati</div>
<div v-if="pagination.rowsNumber === 1 && prop_search">{{ pagination.rowsNumber }} elemento trovato</div>
<div v-if="pagination.rowsNumber > 1 && prop_search">{{ pagination.rowsNumber }} elementi trovati</div>
<div v-if="finder" class="">
<q-radio v-model="myvertical" :val="2" label="Lista" @update:model-value="tools.setCookie('myv', myvertical) "/>
<q-radio v-model="myvertical" :val="-1" label="Scheda" @update:model-value="tools.setCookie('myv', myvertical) "/>
<q-radio v-model="myvertical" :val="0" label="Tabella" @update:model-value="tools.setCookie('myv', myvertical) "/>
</div>
</template>
<template v-slot:body="props">
@@ -251,7 +283,7 @@
<template v-slot:item="props">
<div v-if="showType === costanti.SHOW_USERINFO" class="fill-all-width">
<div v-if="(showType === costanti.SHOW_USERINFO) || (myvertical === 2)" class="fill-all-width">
<div>
<CMyFriends
v-model="filter"
@@ -267,7 +299,7 @@
class="q-pa-xs col-xs-12 col-sm-6 col-md-4 col-lg-3 grid-style-transition"
:style="props.selected ? 'transform: scale(0.95);' : ''"
>
<q-card :class="props.selected ? 'bg-grey-2' : ''">
<q-card :class="props.selected ? 'bg-grey-2' : ''" style="min-width: 200px;">
<q-bar dense class="bg-primary text-white">
<span class="ellipsis"> {{ props.row[col_title] }} </span>
<q-space/>
@@ -352,6 +384,7 @@
:mycol="mycol"
:showall="true"
:row="rowclicksel"
:tablesel="col.tablesel"
:field="mycol.field"
:subfield="mycol.subfield"
@save="SaveValdb"
@@ -378,7 +411,6 @@
<div
v-if="colVisib.includes(col.field + col.subfield) && col.foredit">
<div class="">
<CMyPopupEdit
:table="mytable"
:canEdit="true"
@@ -387,6 +419,7 @@
v-model:row="newRecord"
:field="col.field"
:subfield="col.subfield"
:tablesel="col.tablesel"
:isInModif="true"
minuteinterval="1"
:visulabel="true"
@@ -424,6 +457,7 @@
:table="mytable"
:canEdit="true"
:canModify="canModifyThisRec(recModif)"
:tablesel="col.tablesel"
:mycol="col"
:isInModif="true"
v-model:row="recModif"

View File

@@ -228,22 +228,6 @@ export default defineComponent({
})
}
function cancelReqFriends(usernameDest: string) {
$q.dialog({
message: t('db.domanda_cancel_req_friend', { username: usernameDest }),
ok: { label: t('dialog.yes'), push: true },
cancel: { label: t('dialog.cancel') },
title: t('db.domanda')
}).onOk(() => {
userStore.setFriendsCmd($q, t, username.value, usernameDest, shared_consts.FRIENDSCMD.CANCEL_REQ_FRIEND, null).then((res) => {
if (res) {
userStore.my.profile.asked_friends = userStore.my.profile.asked_friends.filter((rec: IUserFields) => rec.username !== usernameDest)
tools.showPositiveNotif($q, t('db.cancel_req_friend'))
}
})
})
}
function blockUser(usernameDest: string) {
$q.dialog({
@@ -269,13 +253,13 @@ export default defineComponent({
} else if (cmd === shared_consts.FRIENDSCMD.BLOCK_USER) {
blockUser(usernameDest)
} else if (cmd === shared_consts.FRIENDSCMD.SETFRIEND) {
tools.addToMyFriends($q, t, username.value, usernameDest)
tools.addToMyFriends($q, username.value, usernameDest)
} else if (cmd === shared_consts.FRIENDSCMD.REQFRIEND) {
tools.setRequestFriendship($q, t, username.value, usernameDest, value)
tools.setRequestFriendship($q, username.value, usernameDest, value)
} else if (cmd === shared_consts.FRIENDSCMD.REFUSE_REQ_FRIEND) {
refuseReqFriends(usernameDest)
} else if (cmd === shared_consts.FRIENDSCMD.CANCEL_REQ_FRIEND) {
cancelReqFriends(usernameDest)
tools.cancelReqFriends($q, username.value, usernameDest)
}
}

View File

@@ -158,7 +158,7 @@ export default defineComponent({
const userStore = useUserStore()
const globalStore = useGlobalStore()
const myvalue = ref(<any>'')
const myvalue = ref(<any>null)
const myvalueprec = ref('false')
const countryname = ref('')
const visueditor = ref(false)
@@ -445,7 +445,7 @@ export default defineComponent({
return '[---]'
else
return globalStore.getValueByTable(col, val)
} else if (col.fieldtype === costanti.FieldType.nationality) {
} else if ((col.fieldtype === costanti.FieldType.nationality) || (col.fieldtype === costanti.FieldType.select_by_server) || (col.fieldtype === costanti.FieldType.multiselect_by_server)) {
if (!val)
return '[---]'
else

View File

@@ -2,7 +2,7 @@
<div :class="getclassCol(col)">
<div v-if="(visInNewRec(col) && visulabel) || !visulabel " style="flex-grow: 1;">
<div
:class="{ flex: true, 'justify-center': true }">
:class="{ flex: !isInModif, 'justify-center': true }">
<div>
<!-- Edit Value -->
<div v-if="col.fieldtype === costanti.FieldType.boolean">
@@ -31,11 +31,12 @@
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.string">
<div v-if="visulabel || isInModif" class="flex">
<div v-if="visulabel || isInModif" :class="{ flex: !isInModif }">
<q-input
v-bind="$attrs"
v-model="myvalue"
autogrow
counter
:disable="disable"
:readonly="disable"
@keyup.enter.stop
@@ -50,6 +51,10 @@
color="white" text-color="blue" icon="person" :to="col.link.replace(col.name, myvalue)">
<span :class="{disabled: disable }">{{ myvalue }}</span>
</q-btn>
<q-avatar v-else-if="col.tipovisu === costanti.TipoVisu.LINKIMG && myvalue" size="60px">
<q-img :src="getImgUser(contact)" :alt="myvalue" img-class="imgprofile" height="60px"/>
</q-avatar>
<q-btn v-else-if="col.tipovisu === costanti.TipoVisu.BUTTON && myvalue" rounded dense size="sm"
color="primary" icon="person" :to="col.link.replace(col.name, myvalue)">{{ myvalue }}
</q-btn>
@@ -279,11 +284,13 @@
:opticon="fieldsTable.getIconByTable(col.jointable)"></CMyChipList>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.select">
<div v-else-if="(col.fieldtype === costanti.FieldType.select) || (col.fieldtype === costanti.FieldType.select_by_server)">
<div v-if="isInModif">
<CMySelect
:label="col.label"
v-model:value="myvalue"
:pickup="col.fieldtype === costanti.FieldType.select_by_server"
:tablesel="col.type === costanti.FieldType.select_by_server ? tablesel : ''"
@update:value="changevalRec"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
@@ -303,6 +310,27 @@
:opticon="fieldsTable.getIconByTable(col.jointable)"></CMyChipList>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect_by_server">
tablesel: {{tablesel}}
myvalue: {{ myvalue}}
<CMySelect
:isarray="true"
:multiselect_by_server="true"
:label="col.label"
v-model:arrvalue="myvalue"
@update:arrvalue="changevalRec"
:addall="true"
:tablesel="tablesel"
:pickup="true"
label-color="primary"
class="combowidth"
color="primary"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
:options="globalStore.getTableJoinByName(col.jointable)"
:useinput="true">
</CMySelect>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.star5">
<div v-if="isInModif">
<CMySelect
@@ -330,6 +358,9 @@
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.html">
<div v-if="isInModif">
<div v-if="insertMode">
</div>
<div v-if="!isFieldDb()">
<CMyEditor
v-model:value="myvalue" :title="col.title" @keyup.enter.stop
@@ -414,6 +445,7 @@
<div v-else-if="col.fieldtype === costanti.FieldType.string">
<q-input
v-bind="$attrs"
counter
v-model="scope.value"
autogrow
@keyup.enter.stop
@@ -464,16 +496,66 @@
</q-input>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.select">
<div v-else-if="(col.fieldtype === costanti.FieldType.select) || (col.fieldtype === costanti.FieldType.select_by_server)">
<CMySelect
:label="col.label"
v-model:value="scope.value"
:pickup="col.fieldtype === costanti.FieldType.select_by_server"
:tablesel="col.type === costanti.FieldType.select_by_server ? tablesel : ''"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
:options="globalStore.getTableJoinByName(col.jointable)"
:useinput="false">
</CMySelect>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect_by_server">
<CMySelect
:multiselect_by_server="true"
:label="col.label"
v-model:arrvalue="scope.value"
@update:arrvalue="changevalRec"
:addall="false"
:tablesel="tablesel"
:pickup="true"
label-color="primary"
class="combowidth"
color="primary"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
:options="globalStore.getTableJoinByName(col.jointable)"
:useinput="true">
</CMySelect>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect">
<q-select
v-model="scope.value"
rounded
outlined
multiple
dense
options-dense
:display-value="fieldsTable.getTitleByTable(col.jointable)"
emit-value
map-options
:options="globalStore.getTableJoinByName(col.jointable)"
class="combowidth"
:option-value="fieldsTable.getKeyByTable(col.jointable)"
@update:model-value="changeval">
<template v-slot:option="{ itemProps, opt, selected, toggleOption }">
<q-item v-bind="itemProps">
<q-item-section>
<q-item-label>{{ opt[fieldsTable.getLabelByTable(col.jointable)] }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-toggle :model-value="selected" @update:model-value="toggleOption(opt)"/>
</q-item-section>
</q-item>
</template>
</q-select>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.nationality">
<div class="justify-center q-gutter-sm clgutter q-mt-sm">
<CMySelect
@@ -514,37 +596,6 @@
:optlab="fieldsTable.getLabelByTable(col.jointable)">
</CMyToggleList>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect">
<q-select
v-model="scope.value"
rounded
outlined
multiple
dense
options-dense
:display-value="fieldsTable.getTitleByTable(col.jointable)"
emit-value
map-options
:options="globalStore.getTableJoinByName(col.jointable)"
class="combowidth"
:option-value="fieldsTable.getKeyByTable(col.jointable)"
@update:model-value="changeval">
<template v-slot:option="{ itemProps, opt, selected, toggleOption }">
<q-item v-bind="itemProps">
<q-item-section>
<q-item-label>{{ opt[fieldsTable.getLabelByTable(col.jointable)] }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-toggle :model-value="selected" @update:model-value="toggleOption(opt)"/>
</q-item-section>
</q-item>
</template>
</q-select>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.star5">
<CMySelect
:label="col.label"

View File

@@ -9,12 +9,19 @@ import { shared_consts } from '@/common/shared_vuejs'
export default defineComponent({
name: 'CMySelect',
emits: ['update:value', 'changeval'],
emits: ['update:value', 'update:arrvalue', 'changeval'],
props: {
options: {
type: Array,
required: true,
},
arrvalue: {
type: Array,
required: false,
default: () => {
return []
}
},
value: [String, Number],
label: {
type: String,
@@ -68,6 +75,10 @@ export default defineComponent({
type: Function,
required: false,
},
multiselect_by_server: {
type: Boolean,
default: false,
}
},
components: {},
setup(props, { emit }) {
@@ -80,6 +91,8 @@ export default defineComponent({
const valori = ref(<any>[])
const myvalue = ref(<string | number>'')
const myarrvalue = ref(<any[]>[])
const arrtempOpt = ref(<any[]>[])
const valoriload = computed(() => {
let myarr = props.options
@@ -97,78 +110,167 @@ export default defineComponent({
})
watch(() => props.options, (value: any, oldval: any) => {
valori.value = valoriload.value
if (!props.multiselect_by_server) {
valori.value = valoriload.value
// console.log('@@@ VALORI CHANGED (1)', valori.value)
}
},
)
watch(() => props.value, (value: any, oldval: any) => {
mounted()
mounted()
},
)
watch(() => props.arrvalue, (value: any, oldval: any) => {
console.log(' MODIF props.arrvalue', props.arrvalue)
// mounted()
},
)
function changeval(newval: any) {
if (props.tablesel === shared_consts.TAB_COUNTRY)
myvalue.value = newval && newval['value'] ? newval['value'] : newval
else if (props.tablesel === shared_consts.TAB_PHONES)
myvalue.value = newval && newval['code'] ? newval['code'] : newval
else
myvalue.value = newval
console.log('Myselect changeval', myvalue.value)
emit('update:value', myvalue.value)
emit('changeval', myvalue.value)
}
function saveOptInCookie(arrval: any) {
function mounted() {
// console.log('mounted myselect', props.options)
if (props.options) {
const rec: any = props.options.find((myrec: any) => myrec[`${props.optval}`] === props.value)
if (arrval) {
for (const id of arrval) {
let trovato = arrtempOpt.value.find((rec) => rec._id === id)
if (!trovato) {
const rec = valori.value.find((rec: any) => rec._id === id)
if (rec) {
console.log('SAVE OPT rec', rec)
arrtempOpt.value.push({ _id: id, comune: rec.comune })
let num = localStorage.getItem(props.tablesel + 'NUM') || 0
try {
if (!num) {
num = 0
} else {
num = parseInt(num.toString())
}
} catch (e) {
num = 0
}
console.log('----------- valori.value', valori.value)
console.log('----------- arrtempOpt.value', arrtempOpt.value)
if (rec) {
if (props.funcgetvaluebyid)
myvalue.value = props.funcgetvaluebyid(rec[`${props.optval}`])
else
myvalue.value = rec[`${props.optlab}`]
} else {
if (!props.useinput) {
if (props.value) {
myvalue.value = props.value
localStorage.setItem(props.tablesel + num + 'ID', rec._id)
localStorage.setItem(props.tablesel + num + 'COMUNE', rec.comune)
num += 1
localStorage.setItem(props.tablesel + 'NUM', num.toString())
}
}
}
}
}
function changeval(newval: any) {
console.log(' ½½½½½½½ changeval', newval)
if (props.multiselect_by_server) {
// localStorage.setItem(props.tablesel + '_' + newval, valori.value[newval])
myarrvalue.value = newval && newval['arrvalue'] ? newval['arrvalue'] : newval
saveOptInCookie(newval)
console.log(' ----- Myselect changeval Arrvalue', myarrvalue.value)
emit('update:arrvalue', myarrvalue.value)
emit('changeval', myarrvalue.value)
} else {
if (props.tablesel === shared_consts.TAB_COUNTRY)
myvalue.value = newval && newval['value'] ? newval['value'] : newval
else if (props.tablesel === shared_consts.TAB_CITIES)
myvalue.value = newval && newval['value'] ? newval['value'] : newval
else if (props.tablesel === shared_consts.TAB_PHONES)
myvalue.value = newval && newval['code'] ? newval['code'] : newval
else
myvalue.value = newval
console.log('Myselect changeval', myvalue.value)
emit('update:value', myvalue.value)
emit('changeval', myvalue.value)
}
}
function mounted() {
console.log(' #### mounted myselect', props.options, 'arrvalue', myarrvalue.value)
let rec: any
if (props.options) {
if (!props.multiselect_by_server) {
rec = props.options.find((myrec: any) => myrec[`${props.optval}`] === props.value)
}
}
if (props.multiselect_by_server) {
const num = parseInt(localStorage.getItem(props.tablesel + 'NUM')!)
console.log('num LOADED ', num)
for (let i = 0; i < num; i++) {
const itemId = parseInt(localStorage.getItem(props.tablesel + i + 'ID')!)
const itemcomune = localStorage.getItem(props.tablesel + i + 'COMUNE')
if (itemId) {
arrtempOpt.value.push({ _id: itemId, comune: itemcomune })
}
}
myarrvalue.value = []
for (const val of props.arrvalue) {
rec = arrtempOpt.value.find((myrec: any) => val === (myrec[`${props.optval}`]))
if (rec) {
myarrvalue.value.push(rec[`${props.optval}`])
}
}
}
if (rec) {
if (props.funcgetvaluebyid)
myvalue.value = props.funcgetvaluebyid(rec[`${props.optval}`])
else
myvalue.value = rec[`${props.optlab}`]
} else {
// if (!props.useinput) {
if (props.value) {
myvalue.value = props.value
}
// }
}
// console.log('cmyselect: myvalue.value', myvalue.value)
}
function filterFn(val: any, update: any, abort: any) {
update(
async () => {
() => {
console.log('Filter val', val, val.length)
let myarr: any = []
if (val.length < 1) {
abort()
if (val.length <= 1) {
valori.value = arrtempOpt.value
return
}
let mystr = val.toLocaleLowerCase()
console.log('props.tablesel', props.tablesel)
if (fieldsTable.tableRemotePickup.includes(props.tablesel)) {
// if (myvalue.value.length > 1) {
try {
if (mystr !== '')
myarr = await globalStore.loadPickup({ table: props.tablesel, search: mystr })
return globalStore.loadPickup({ table: props.tablesel, search: mystr })
.then((ris) => {
myarr = props.options
if (ris) {
valori.value = ris
if (props.multiselect_by_server) {
console.log('@@@ VALORI CHANGED (2)', valori.value)
}
}
if (myarr === null){
abort()
})
if (myarr === null) {
valori.value = arrtempOpt.value
return
}
}catch (e) {
abort()
} catch (e) {
valori.value = arrtempOpt.value
return
}
// const needle = val.toLocaleLowerCase()
// optFiltered.value = optFiltered.value.filter((v: any) => v.toLocaleLowerCase().indexOf(needle) > -1)
// }
} else {
myarr = props.options
}
@@ -183,9 +285,14 @@ export default defineComponent({
myarr = [myobj, ...myarr]
}
valori.value = myarr
if (myarr.length > 0) {
valori.value = myarr
if (props.multiselect_by_server) {
console.log('@@@ VALORI CHANGED (3)', valori.value)
}
}
console.log('tablesel', props.tablesel, 'filterFn', myarr)
console.log('*** OUT: tablesel', props.tablesel, 'filterFn', myarr)
},
// "ref" is the Vue reference to the QSelect
(ref: any) => {
@@ -197,15 +304,32 @@ export default defineComponent({
)
}
function abortFilterFn() {
console.log('delayed filter aborted')
}
function checkIfShowRec(rec: any) {
return (rec._id > 0 && typeof rec._id === 'number') || rec._id !== 'number'
}
onMounted(mounted)
valori.value = valoriload.value
if (!props.multiselect_by_server) {
valori.value = valoriload.value
console.log('@@@ VALORI CHANGED (4)', valori.value)
} else {
valori.value = arrtempOpt.value
}
return {
changeval,
myvalue,
myarrvalue,
valori,
filterFn,
fieldsTable,
checkIfShowRec,
abortFilterFn,
}
}
})

View File

@@ -1,6 +1,69 @@
<template>
<div class="text-center">
<div v-if="useinput">
<div v-if="multiselect_by_server">
<q-select
:model-value="myarrvalue"
label-color="primary"
:label="label"
@filter="filterFn"
@filter-abort="abortFilterFn"
@update:model-value="changeval"
input-debounce="300"
rounded
outlined
fill-input
multiple
options-dense
map-options
stack-label
emit-value
:use-input="true"
:dense="dense"
:input-class="myclass"
:options="valori"
:option-value="optval"
class="combowidth"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
No results
</q-item-section>
</q-item>
</template>
<template v-slot:option="{ itemProps, opt, selected, toggleOption }">
<q-item v-bind="itemProps">
<q-item-section>
<q-item-label>{{ opt[fieldsTable.getLabelByTable(tablesel)] }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-toggle :model-value="selected" @update:model-value="toggleOption(opt)"/>
</q-item-section>
</q-item>
</template>
<template v-slot:selected-item="scope">
<div v-if="scope.opt[fieldsTable.getLabelByTable(tablesel)]">
<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="" size="12px"/>
{{ scope.opt[fieldsTable.getLabelByTable(tablesel)] }}
</q-chip>
</div>
</template>
</q-select>
</div>
<div v-else-if="useinput">
<q-select
:multiple="multiple"
rounded
@@ -9,6 +72,7 @@
:input-class="myclass"
:model-value="myvalue"
:use-input="useinput"
@filter="filterFn"
input-debounce="0"
@new-value="newvaluefunc"
new-value-mode="add-unique"
@@ -52,11 +116,8 @@
</template>
<template v-slot:option="scope">
<q-item v-bind="scope.itemProps">
<q-item-section avatar>
{{ scope.opt.flag }}
</q-item-section>
<q-item-section>
<q-item-label> {{ scope.opt.value }}</q-item-label>
<q-item-label> {{ scope.opt[optlab] }}</q-item-label>
</q-item-section>
</q-item>
</template>

View File

@@ -10,7 +10,7 @@
<q-item-section @click="naviga(`/my/` + contact.username)">
<q-item-label><strong>{{ contact.name }} {{ contact.surname }}</strong> ({{ contact.username }})
</q-item-label>
<q-item-label caption lines="1">{{ contact.email }}</q-item-label>
<q-item-label caption lines="1"><em>{{ contact.profile.qualifica }}</em></q-item-label>
</q-item-section>
<q-item-section side v-if="visu === costanti.FRIENDS">

View File

@@ -97,18 +97,47 @@ export default defineComponent({
lk_proj: {
idSkill: 1,
idSubSkill: 1,
idCity: 1,
numLevel: 1,
photos: 1,
note: 1,
subTitle: 1,
date_created: 1,
date_updated: 1,
comune: 1,
userId: 1,
username: 1,
name: 1,
surname: 1
surname: 1,
'profile.img': 1,
'profile.qualifica': 1,
}
}
},
lookup2: {
lk_tab: 'cities',
lk_LF: 'idCity',
lk_FF: '_id',
lk_as: 'comune',
af_objId_tab: '',
lk_proj: {
idSkill: 1,
idSubSkill: 1,
idCity: 1,
numLevel: 1,
photos: 1,
note: 1,
subTitle: 1,
date_created: 1,
date_updated: 1,
comune: 1,
userId: 1,
username: 1,
name: 1,
surname: 1,
'profile.img': 1,
'profile.qualifica': 1,
}
},
}
}

View File

@@ -124,13 +124,22 @@
</q-badge>
</q-btn>
<q-btn
class="q-mx-xs" v-if="static_data.functionality.SHOW_USER_MENU && isLogged()" round dense flat
<!--<q-avatar v-if="static_data.functionality.SHOW_USER_MENU && isLogged()"
size="30px"
@click="rightDrawerOpen = !rightDrawerOpen" :color="getcolormenu()">
<q-img :src="getMyImgforIcon()" :alt="Username()" img-class=""/>
</q-avatar>-->
<q-avatar v-if="static_data.functionality.SHOW_USER_MENU && isLogged()"
size="36px" class="center_img cursor-pointer"
@click="rightDrawerOpen = !rightDrawerOpen">
<q-img ratio="1" fit="conver" :src="getMyImg()" :alt="Username()" img-class="imgprofile_small" stretch="false" />
</q-avatar>
<!--<q-btn
class="q-mx-xs iconprofile_small" v-if="static_data.functionality.SHOW_USER_MENU && isLogged()" round dense flat
@click="rightDrawerOpen = !rightDrawerOpen" :icon="getMyImgforIcon()" :color="getcolormenu()">
<!--<q-badge v-if="isSocio" color="green" floating transparent>
s
</q-badge>-->
</q-btn>
</q-btn>-->
</q-toolbar>
@@ -169,7 +178,11 @@
<div class="absolute-top bg-transparent text-black center_img" style="margin-top: 10px;">
<div class="text-center q-ma-xs boldhigh text-white text-h7">Area Personale</div>
<CMyAvatar :myimg="getMyImg()"></CMyAvatar>
<q-avatar size="80px" class="center_img q-ma-md">
<q-img fit="cover" :src="getMyImg()" :alt="Username()" img-class="imgprofile" height="80px"/>
</q-avatar>
<!--<CMyAvatar :myimg="getMyImg()"></CMyAvatar>-->
<q-btn
class="absolute-top-right" style="margin-right: 10px; color: white;"