FILTRO CITTA Sopra ogni pagina !

This commit is contained in:
Surya Paolo
2022-12-01 16:55:22 +01:00
parent 9010c0ff37
commit bf1e9fc982
26 changed files with 900 additions and 74 deletions

View File

@@ -0,0 +1,72 @@
.colmodif {
cursor: pointer;
}
.coldate {
max-width: 250px;
min-width: 200px;
}
.tdclass, .trclass{
min-height: 20px !important;
margin-top: 5px;
}
.q-table td {
padding-left: 1px;
padding-right: 2px;
padding-top: 0;
padding-bottom: 0;
&__title {
font-size: 1rem;
}
}
.q-table {
&__col {
font-size: 1rem;
color: gray;
}
}
.newrec_fields{
display: flex;
padding: 2px;
margin: 2px;
align-items: center;
justify-content: center;
}
.riduci_pad {
min-height: 30px;
padding: 4px 8px !important;
}
.q-table__top{
padding-top: 0 !important;
}
.barselection {
display: flex;
align-items: center;
justify-content: space-around;
}
.myitem {
padding: 0px 6px 0px 6px !important;
}
.myitem-0 {
flex-grow: 0;
padding-left: 2px;
}
.myitem-1 {
flex-grow: 0;
}
.myitem-2 {
flex-grow: 1;
}

View File

@@ -0,0 +1,334 @@
import { inject, defineComponent, PropType, ref, watch, toRef, onMounted, toRefs, computed } from 'vue'
import { useI18n } from '@src/boot/i18n'
import { tools } from '../../store/Modules/tools'
import { fieldsTable } from '@store/Modules/fieldsTable'
import { shared_consts } from '@/common/shared_vuejs'
import {
IColGridTable,
IFilter,
ITableRec,
ISearchList,
IPagination,
IParamDialog,
IMySkill
} from 'model'
import { lists } from '@store/Modules/lists'
import { IParamsQuery } from 'model'
import { CMyPopupEdit } from '../CMyPopupEdit'
import { CMyFriends } from '../CMyFriends'
import { CMyUser } from '../CMyUser'
import { CMyGroups } from '../CMyGroups'
import { CMyFieldDb } from '../CMyFieldDb'
import { CMyRecCard } from '../CMyRecCard'
import { CMyRecGrpCard } from '../CMyRecGrpCard'
import { CMyRecCircuitCard } from '../CMyRecCircuitCard'
import { CMySelect } from '../CMySelect'
import { CTitleBanner } from '../CTitleBanner'
import { useUserStore } from '@store/UserStore'
import { useGlobalStore } from '@store/globalStore'
import { useQuasar, exportFile } from 'quasar'
import { costanti } from '@costanti'
import translate from '@/globalroutines/util'
import { toolsext } from '@store/Modules/toolsext'
import { CMyCardPopup } from '@/components/CMyCardPopup'
import { CMyCardGrpPopup } from '@/components/CMyCardGrpPopup'
import { CMyCardCircuitPopup } from '@/components/CMyCardCircuitPopup'
import { useRouter } from 'vue-router'
export default defineComponent({
name: 'CBarSelection',
props: {
table: {
type: String,
required: true,
},
prop_search: {
type: Boolean,
required: false,
default: true,
},
mytitle: {
type: String,
required: false,
default: '',
},
myicon: {
type: String,
required: false,
default: '',
},
mycolor: {
type: String,
required: false,
default: '',
},
hint: {
type: String,
required: false,
default: 'Cerca',
},
},
components: {
CMyPopupEdit, CTitleBanner, CMyFieldDb, CMySelect, CMyFriends, CMyGroups,
CMyUser, CMyRecCard, CMyCardPopup, CMyRecGrpCard, CMyCardGrpPopup, CMyCardCircuitPopup,
CMyRecCircuitCard
},
setup(props, { emit }) {
const $q = useQuasar()
const { t } = useI18n()
const userStore = useUserStore()
const globalStore = useGlobalStore()
const isfinishLoading = computed(() => globalStore.finishLoading)
const $router = useRouter()
const search = ref('')
const loading = ref(false)
const visupagedialog = ref(false)
const myrecdialog = ref(null)
const myinfscroll = ref(null)
const serverData: any = ref([])
const numRecLoaded = ref(0)
const changetable = ref(false)
const searchList = ref([] as ISearchList[])
const actual = ''
const tablesel = ref('')
const myfilter = ref('')
const myfilterand: any = ref([])
let rowsel: any = {}
const dark = true
const canEdit = ref(false)
const optionsMainCards = ref()
let returnedCount = 0
const colVisib: any = ref([])
const colExtra: any = ref([])
const actualDate: any = ref(null as any)
const rowclicksel = ref(null as any)
const colclicksel = ref(null)
const selector = inject('selector', {})
const showfilter = ref(false) // filtri avanzati
const filter = ref(0)
const filtergrp = ref(costanti.MY_GROUPS)
const mycolumns = ref([])
const valoriopt = computed(() => (item: any, addall: boolean, addnone: boolean) => {
// console.log('valoriopt', item.table)
return globalStore.getTableJoinByName(item.table, addall, addnone, item.filter)
})
watch(() => props.table, (newval, oldval) => {
tablesel.value = props.table
})
const labelcombo = computed(() => (item: any) => {
let lab = item.label
if (item.showcount)
lab += ' (' + valoriopt.value(item, false, false).length + ')'
return lab
})
const myselector = computed({
get: () => globalStore.myselector,
set: val => {
globalStore.myselector = val
},
})
function refresh() {
//
// emit('updatesearch', )
}
function setProvinceByRegion(tableprov: string, tabregion: string, newval: any) {
const recRegion = searchList.value.find((rec) => rec.table === tabregion)
if (recRegion)
tools.setCookie(tools.COOK_SEARCH + tabregion, newval)
for (const item of searchList.value) {
if (item.table === tableprov) {
const valsaved = tools.getCookie(tools.COOK_SEARCH + tableprov + '_' + newval, costanti.FILTER_TUTTI)
const rec = searchList.value.find((myrec) => myrec.table === tableprov) // check if exist
let trovato = false
let arrvalues = []
if (rec) {
arrvalues = valoriopt.value(rec.value, false, false)
if (arrvalues)
trovato = arrvalues.find((myrec: any) => myrec[myrec.key] === valsaved)
}
if (valsaved && trovato)
item.value = valsaved
else {
if (arrvalues) {
item.value = costanti.FILTER_TUTTI
}
}
} else if (item.table === toolsext.TABCITIES) {
const valsaved = tools.getCookie(tools.COOK_SEARCH + toolsext.TABCITIES + '_' + newval, costanti.FILTER_TUTTI)
const rec = searchList.value.find((myrec) => myrec.table === toolsext.TABCITIES) // check if exist
let trovato = false
let arrvalues = []
if (rec) {
arrvalues = valoriopt.value(rec.value, false, false)
if (arrvalues)
trovato = arrvalues.find((myrec: any) => myrec[myrec.key] === valsaved)
}
if (valsaved && trovato)
item.value = valsaved
else {
if (arrvalues) {
item.value = costanti.FILTER_TUTTI
}
}
}
}
}
function searchval(newval: any, table: any) {
// console.log('REFRR searchval', newval, table)
globalStore.myselector = { table, data: newval }
// console.log('globalStore.myselector', globalStore.myselector)
tools.setCookie(tools.COOK_SEARCH + table, newval)
if (table === toolsext.TABREGIONS) {
setProvinceByRegion(toolsext.TABPROVINCE, table, newval)
} else if (table === toolsext.TABGOODS) {
const recSector = searchList.value.find((rec) => rec.table === toolsext.TABSECTORGOODS)
if (recSector) {
tools.setCookie(tools.COOK_SEARCH + table + '_' + recSector.value, newval)
}
// setCategBySector('sectorgoods', table, newval)
}
refresh()
}
function getRowsNumberCount() {
return returnedCount
}
function created() {
//
}
function doSearch() {
// console.log('REFRR - doSearch')
refresh()
}
function mounted() {
optionsMainCards.value = []
let obj = { label: '', value: '', icon: '' }
for (let i = 0; i < costanti.MAINCARDS.length - 1; i++) {
let rec: any = costanti.MAINCARDS[i]
if (rec.table) {
obj.label = rec.title
obj.value = rec.table
obj.icon = rec.icon
optionsMainCards.value.push({...obj})
}
}
tablesel.value = props.table
console.log(' . TABLE =', props.table)
mycolumns.value = fieldsTable.getArrColsByTable(props.table)
searchList.value = [
{
label: 'Comune',
table: 'cities',
key: 'idCity',
type: costanti.FieldType.select_by_server,
value: tools.getCookie(tools.COOK_SEARCH + 'cities', costanti.FILTER_TUTTI),
addall: true,
arrvalue: [],
useinput: true,
filter: null,
tablesel: 'cities',
},
]
}
function visButtRow() {
return false
}
function gotoPageSel() {
const rec = costanti.MAINCARDS.find((rec: any) => rec.table === tablesel.value)
if (rec) {
$router.push(rec.to)
}
}
created()
onMounted(mounted)
return {
isfinishLoading,
search,
canEdit,
rowclicksel,
colVisib,
colExtra,
colclicksel,
loading,
serverData,
myfilter,
lists,
myfilterand,
tools,
costanti,
toolsext,
fieldsTable,
globalStore,
searchList,
searchval,
valoriopt,
labelcombo,
filter,
filtergrp,
shared_consts,
showfilter,
visupagedialog,
myrecdialog,
actualDate,
actual,
numRecLoaded,
myinfscroll,
t,
mycolumns,
visButtRow,
doSearch,
myselector,
optionsMainCards,
tablesel,
gotoPageSel,
}
}
})

View File

@@ -0,0 +1,250 @@
<template>
<div
:class="$q.screen.lt.sm ? `` : `q-pa-xs`"
v-if="isfinishLoading && mycolumns"
>
<div
class="centermydiv q-mx-sm"
:style="`text-align: center; background-color: ${mycolor}`"
>
<q-btn
v-if="table && visButtRow()"
rounded
dense
color="primary"
size="lg"
:label="getlabelAddRow()"
@click="createNewRecordDialog"
></q-btn>
</div>
<div>
<div v-if="prop_search || canEdit" class="q-my-xs text-right">
<q-btn
size="sm"
dense
icon="fas fa-filter"
:label="!showfilter ? $t('grid.showfilters') : $t('grid.hidefilters')"
@click="showfilter = !showfilter"
></q-btn>
</div>
<q-slide-transition>
<div v-show="true">
<div v-show="searchList" class="barselection">
<div class="myitem myitem-0">
<q-icon :name="myicon" size="xs" />
</div>
<div class="myitem myitem-1 mybanner">
<q-select
filled
v-model="tablesel"
:options="optionsMainCards"
emit-value
borderless
map-options
behavior="menu"
@update:model-value="gotoPageSel"
>
<template v-slot:option="scope">
<q-item v-bind="scope.itemProps">
<q-item-section avatar>
<q-icon :name="scope.opt.icon" />
</q-item-section>
<q-item-section>
<q-item-label>{{ scope.opt.label }}</q-item-label>
<!--<q-item-label caption>{{
scope.opt.description
}}</q-item-label>-->
</q-item-section>
</q-item>
</template>
</q-select>
</div>
<div
class="myitem myitem-2"
v-for="(item, index) in searchList"
:key="index"
>
<CMySelect
:col="fieldsTable.getColByColumns(mycolumns, item.key)"
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="item.addall"
:addnone="item.addnone"
:addlast="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"
:icon_alternative="item.icon"
:optval="fieldsTable.getKeyByTable(item.table)"
:optlab="fieldsTable.getLabelByTable(item.table)"
:options="valoriopt(item, false)"
:filter="item.filter"
:filter_extra="item.filter_extra"
: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"
:col="fieldsTable.getColByColumns(mycolumns, item.key)"
:multiselect_by_server="true"
:label="labelcombo(item)"
v-model:arrvalue="item.arrvalue"
@update:arrvalue="searchval(item.arrvalue, item.table)"
:addall="item.addall"
:addnone="item.addnone"
:addlast="true"
:tablesel="item.tablesel"
:pickup="true"
:param1="item.param1"
label-color="primary"
class="combowidth"
color="primary"
:icon_alternative="item.icon"
:optval="fieldsTable.getKeyByTable(item.table)"
:optlab="fieldsTable.getLabelByTable(item.table)"
:filter="item.filter"
:filter_extra="item.filter_extra"
:options="valoriopt(item, false)"
:useinput="true"
>
</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
options-dense
emit-value
map-options
stack-label
:useinput="item.useinput"
:options="valoriopt(item, item.addall, item.addnone)"
:filter="item.filter"
class="combowidth"
:option-value="fieldsTable.getKeyByTable(item.table)"
>
<template v-if="item.icon" v-slot:prepend>
<q-icon :name="item.icon" />
</template>
<template
v-if="item.arrvalue.length >= 1"
v-slot:selected-item="scope"
>
<div
v-if="
scope.opt[fieldsTable.getLabelByTable(item.table)] ||
(scope.opt && checkIfShowRec(scope.opt))
"
>
<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)] ||
scope.opt
}}
</q-chip>
</div>
</template>
<template
v-slot:option="{ itemProps, opt, selected, toggleOption }"
>
<q-item v-bind="itemProps">
<q-item-section>
<q-item-label>{{
opt[fieldsTable.getLabelByTable(item.table)]
}}</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>
</div>
</q-slide-transition>
<div
v-if="prop_search || canEdit"
class="row justify-center vertical-middle"
>
<div v-if="prop_search" class="q-mr-sm full-width">
<q-input
v-model="search"
filled
dense
type="search"
debounce="500"
:hint="hint"
label="Cerca"
v-on:keyup.enter="doSearch"
>
<template v-slot:prepend>
<q-icon name="search" />
</template>
<template v-if="searchList" v-slot:after>
<q-btn
dense
label=""
color="primary"
@click="showfilter = !showfilter"
icon="fas fa-filter"
></q-btn>
</template>
</q-input>
</div>
<q-space></q-space>
</div>
</div>
</div>
</template>
<script lang="ts" src="./CBarSelection.ts">
</script>
<style lang="scss">
@import './CBarSelection.scss';
</style>

View File

@@ -0,0 +1 @@
export {default as CBarSelection} from './CBarSelection.vue'

View File

@@ -1,6 +1,6 @@
import {
computed,
defineComponent, onBeforeMount, onBeforeUnmount, onMounted, ref, toRef, toRefs, watch,
provide, defineComponent, onBeforeMount, onBeforeUnmount, onMounted, ref, toRef, toRefs, watch,
} from 'vue'
import { tools } from '@store/Modules/tools'
@@ -9,6 +9,7 @@ import { costanti } from '@costanti'
import { useGlobalStore } from '@store/globalStore'
import { useUserStore } from '@store/UserStore'
import { CTitlePage } from '@/components/CTitlePage'
import { CGridTableRec } from '@/components/CGridTableRec'
import { IColGridTable, IMyBacheca, IMySkill, ISearchList, ISkill } from 'model'
import { shared_consts } from '@/common/shared_vuejs'
@@ -27,13 +28,18 @@ export default defineComponent({
showFilterPersonal: {
type: Boolean,
required: false,
default: true,
default: false,
},
noButtAdd: {
type: Boolean,
required: false,
default: false,
},
selector: {
type: Object,
required: false,
default: null,
},
ind: {
type: Number,
required: false,
@@ -41,7 +47,7 @@ export default defineComponent({
}
},
components: {
CMyFieldDb, CGridTableRec,
CMyFieldDb, CGridTableRec, CTitlePage,
},
setup(props, { attrs, slots, emit }) {
const { t } = useI18n()
@@ -49,6 +55,10 @@ export default defineComponent({
const globalStore = useGlobalStore()
const userStore = useUserStore()
const myselector = ref({})
provide('myselector', myselector)
const arrfilterand: any = ref([])
const filtercustom: any = ref([])
const searchList_Servizi = ref(<ISearchList[]>[])
@@ -245,11 +255,13 @@ export default defineComponent({
]
} else {
/*
myoptions.value = [
{ label: '🌎 Tutti', value: tools.FILTER_ALL },
{ label: '👤 Personali', value: tools.FILTER_MYREC },
// {label: 'Seguo', value: tools.FILTER_MYFOLLOW},
]
*/
}
function getFilterSkills(recSkill: any, index: number, arr: any) {

View File

@@ -1,9 +1,8 @@
<template>
<CTitlePage :ind="ind" :table="table"/>
<div class="bi-border-all">
<div class="q-ma-xs q-gutter-xs q-pa-xs">
<div v-if="showFilterPersonal"
class="text-center">
<div class="q-ma-xs q-gutter-xs">
<div v-if="showFilterPersonal" class="text-center">
<q-btn-toggle
v-model="myrecfiltertoggle"
push
@@ -14,15 +13,26 @@
</div>
<div v-if="false" class="q-mr-sm">
<q-input
v-model="search" filled dense type="search" debounce="500" :hint="t('finder.search_skill')"
v-on:keyup.enter="doSearch">
v-model="search"
filled
dense
type="search"
debounce="500"
:hint="t('finder.search_skill')"
v-on:keyup.enter="doSearch"
>
<template v-slot:after>
<q-btn dense label="" color="primary" @click="doSearch" icon="search"></q-btn>
<q-btn
dense
label=""
color="primary"
@click="doSearch"
icon="search"
></q-btn>
</template>
</q-input>
</div>
<CGridTableRec
v-if="searchList.length > 0"
:prop_mytable="table"
@@ -47,17 +57,21 @@
:filtercustom="filtercustom"
:prop_searchList="searchList"
:defaultnewrec="getdefaultnewrec"
:extraparams="extraparams()">
:selector="selector"
:extraparams="extraparams()"
>
</CGridTableRec>
</div>
<q-page-scroller position="bottom-right" :scroll-offset="850" :offset="[18, 18]" style="opacity: 0.3">
<q-btn fab icon="keyboard_arrow_up" color="accent"/>
<q-page-scroller
position="bottom-right"
:scroll-offset="850"
:offset="[18, 18]"
style="opacity: 0.3"
>
<q-btn fab icon="keyboard_arrow_up" color="accent" />
</q-page-scroller>
</div>
</template>
<script lang="ts" src="./CFinder.ts">

View File

@@ -1,4 +1,4 @@
import { defineComponent, PropType, ref, watch, toRef, onMounted, toRefs, computed } from 'vue'
import { defineComponent, PropType, ref, watch, toRef, onMounted, toRefs, computed, inject } from 'vue'
import { useI18n } from '@src/boot/i18n'
import { tools } from '../../store/Modules/tools'
@@ -326,6 +326,9 @@ export default defineComponent({
const myvertical = ref(props.vertical)
//const myselector = inject('myselector', {})
const myselector = computed(() => globalStore.myselector)
const valoriopt = computed(() => (item: any, addall: boolean, addnone: boolean) => {
// console.log('valoriopt', item.table)
return globalStore.getTableJoinByName(item.table, addall, addnone, item.filter)
@@ -338,6 +341,21 @@ export default defineComponent({
return lab
})
watch(() => globalStore.myselector, (value: any, oldval: any) => {
console.log('******* CGRIDTABLEREC : globalStore.myselector', globalStore.myselector)
console.log(' . value', value)
const rec = searchList.value.find((myrec) => myrec.table === globalStore.myselector.table) // check if exist
if (rec) {
rec.value = globalStore.myselector.data
}
if (value) {
refresh()
}
},
)
watch(() => searchList.value, (to: any, from: any) => {
// console.log('watch searchlist', to)
if (searchList.value && !changetable.value) {
@@ -353,14 +371,6 @@ export default defineComponent({
}
})
watch(() => props.prop_mycolumns, (to: any, from: any) => {
// console.log('watch searchlist', to)
if (myvertical.value !== props.vertical) {
myvertical.value = props.vertical
refresh()
}
})
watch(() => showfilter.value, (newval: any, from: any) => {
tools.setCookie('s_adv', newval ? '1' : '0')
})
@@ -2098,6 +2108,7 @@ export default defineComponent({
myinfscroll,
t,
exportTable,
myselector,
}
}
})

View File

@@ -499,7 +499,7 @@
<div v-else-if="myel.type === shared_consts.ELEMTYPE.CHECKTESTENV">
<div v-if="editOn" class="elemEdit">Check Sito di Test</div>
<q-banner
v-if="tools.isTest()"
v-if="tools.isTest() && false"
rounded
dense
class="bg-negative text-white"
@@ -514,9 +514,8 @@
/>
</template>
<span class="mybanner"
>Questo è l'AMBIENTE DI TEST !<br />
Solo per prove.</span
>
TEST !</span>
</q-banner>
</div>
<div v-else-if="myel.type === shared_consts.ELEMTYPE.CHECKNEWVERSION">

View File

@@ -102,6 +102,11 @@ export default defineComponent({
required: false,
default: false
},
addlast: {
type: Boolean,
required: false,
default: false
},
dense: {
type: Boolean,
required: false,
@@ -182,6 +187,7 @@ export default defineComponent({
)
function saveOptInCookie(arrval: any) {
console.log('saveOptInCookie')
if (arrval) {
for (const id of arrval) {
@@ -208,7 +214,10 @@ export default defineComponent({
// console.log('----------- arrtempOpt.value', arrtempOpt.value)
tools.localStSetItem(props.tablesel + num + props.optval, id)
tools.localStSetItem(props.tablesel + num + props.optlab, tools.getValueByFunzOrVal(rec, props.optlab))
let mysaved = tools.getValueByFunzOrVal(rec, props.optlab)
tools.localStSetItem(props.tablesel + num + props.optlab, mysaved)
console.log(' SAVED: ', props.tablesel + num + props.optlab, '=', mysaved)
num += 1
tools.localStSetItem(props.tablesel + 'NUM', num.toString())
@@ -220,7 +229,7 @@ export default defineComponent({
function changeval(newval: any) {
// console.log(' ½½½½½½½ changeval', newval)
console.log(' ½½½½½½½ changeval', newval)
if (props.multiple || props.multiselect_by_server) {
// tools.localStSetItem(props.tablesel + '_' + newval, valori.value[newval])
@@ -248,6 +257,7 @@ export default defineComponent({
} else {
if (props.tablesel === shared_consts.TAB_COUNTRY)
myvalue.value = newval && newval['value'] ? newval['value'] : newval
else if (props.tablesel === shared_consts.TAB_CITIES)
@@ -257,11 +267,45 @@ export default defineComponent({
else
myvalue.value = newval
// console.log('Myselect changeval', myvalue.value)
if (myvalue.value && JSON.stringify(myvalue.value)) {
saveLastOpt(props.optval, JSON.stringify(myvalue.value))
}
emit('update:value', myvalue.value)
emit('changeval', myvalue.value)
}
}
function saveLastOpt(key: string, myval: any) {
let ind = 9
// get free number
for (let i = 0; i < 10; i++) {
let myoldval = tools.getItemLS(props.tablesel + 'last_VAL' + i.toString())
myoldval = tools.strToObj(myoldval)
if (myoldval && myoldval[key]) {
if (myoldval[key] === myval) {
// already exist
return
}
// if (myoldval[key] !== myval) {
if (!myoldval[key]) {
ind = i
break
}
} else {
ind = i
break
}
}
// console.log('saveLastOpt', ind, 'key', key, 'myval', myval)
tools.localStSetItem(props.tablesel + 'last_OPT' + ind.toString(), key)
tools.localStSetItem(props.tablesel + 'last_VAL' + ind.toString(), myval)
}
function mounted() {
optionsreal.value = props.options
update()
@@ -320,7 +364,7 @@ export default defineComponent({
for (const myrec of myarrremote) {
let myidkey = myrec[props.col.remote_key]
if (!arrtempOpt.value.includes(myidkey)){
if (!arrtempOpt.value.includes(myidkey)) {
let myobj: any = {}
myobj[props.col.remote_key] = myidkey
if (props.col.remote_field === 'comune' && !!myrec['prov']) {
@@ -333,7 +377,7 @@ export default defineComponent({
}
}
}catch (e){}
} catch (e) { }
}
}
@@ -467,10 +511,35 @@ export default defineComponent({
myarr = [myobj, ...myarr]
}
if (props.addlast) {
myarr = getLastInserted(myarr)
}
// console.log(' myarr: ', myarr)
return myarr
}
function getLastInserted(myarr: any) {
for (let ind = 0; ind < 10; ind++) {
let optlab = tools.getItemLS(props.tablesel + 'last_OPT' + ind.toString())
let optval = tools.getItemLS(props.tablesel + 'last_VAL' + ind.toString())
if (optval)
optval = JSON.parse(optval)
// console.log(ind, '¶¶¶¶¶¶¶¶¶¶ optlab', optlab, 'optval', optval)
let myobj2: any = {}
if (typeof props.optlab === 'string') {
if (optval && !!optval['comune']) {
myobj2[props.optlab] = optval['comune']
myobj2[props.optval] = optval[optlab]
myarr = [...myarr, myobj2]
}
}
}
return myarr
}
function filterFn(val: any, update: any, abort: any) {
update(
async () => {
@@ -505,7 +574,7 @@ export default defineComponent({
}
if (val.length <= 1 && !(fieldsTable.tableRemotePickup.includes(props.tablesel) && props.filter_extra )) {
if (val.length <= 1 && !(fieldsTable.tableRemotePickup.includes(props.tablesel) && props.filter_extra)) {
console.log('@@@ LENGTH <= 1')
abort()
return
@@ -527,9 +596,7 @@ export default defineComponent({
myarr.push({ _id: 1, comune: 'PROVA 2', prov: 'AL' })
myarr.push({ _id: 2, comune: 'PROVA 2B', prov: 'AL' })
}*/
{ // @ts-ignore
}*/ { // @ts-ignore
myarr = await globalStore.loadPickup({ table: props.tablesel, search: mystr.trim(), filter: props.filter_extra })
}
@@ -563,6 +630,10 @@ export default defineComponent({
myarr = [myobj, ...myarr]
}
if (props.addlast) {
myarr = getLastInserted(myarr)
}
}
if (myarr && myarr.length > 0) {

View File

@@ -1,9 +1,11 @@
import { computed, defineComponent, onMounted, PropType, ref } from 'vue'
import { computed, provide, defineComponent, onMounted, PropType, ref } from 'vue'
import { costanti } from '@costanti'
import { tools } from '@store/Modules/tools'
import { CBarSelection } from '../CBarSelection'
export default defineComponent({
name: 'CTitlePage',
components: {CBarSelection},
props: {
ind: {
type: Number,
@@ -23,18 +25,21 @@ export default defineComponent({
required: false
},
},
setup(props) {
setup(props, { emit }) {
const mytitle = ref('')
const myicon = ref('')
const mycolor = ref('')
const table = ref('myhosps')
function mount() {
if (props.ind === -1) {
mytitle.value = props.title!
myicon.value = props.icon!
mycolor.value = props.color!
} else {
table.value = costanti.MAINCARDS[props.ind].table
mytitle.value = costanti.MAINCARDS[props.ind].title
myicon.value = costanti.MAINCARDS[props.ind].icon
mycolor.value = tools.colourNameToHex(costanti.MAINCARDS[props.ind].color)
@@ -47,6 +52,7 @@ export default defineComponent({
mytitle,
myicon,
mycolor,
table,
}
},
})

View File

@@ -1,14 +1,29 @@
<template>
<div v-if="!table">
<q-banner
rounded
dense
class="text-white"
:style="`text-align: center; background-color: ${mycolor}`">
<template v-slot:avatar>
class="text-white row"
:style="`text-align: center; background-color: ${mycolor}`"
>
<template v-if="!table" v-slot:avatar>
<q-icon :name="myicon" size="xs" />
</template>
<span class="mybanner">{{mytitle}}</span>
<span v-if="!table" class="mybanner">{{ mytitle }}</span>
</q-banner>
</div>
<div
v-else
>
<CBarSelection
:myicon="myicon"
:mytitle="mytitle"
:mycolor="mycolor"
:prop_search="false"
:table="table"
>
</CBarSelection>
</div>
</template>
<script lang="ts" src="./CTitlePage.ts">

View File

@@ -24,6 +24,7 @@ import { useUserStore } from '@store/UserStore'
import MixinUsers from '../../mixins/mixin-users'
import { CMyCart, CSigninNoreg } from '@/components'
import { costanti } from '@costanti'
import { useNotifStore } from '@src/store/NotifStore'
export default defineComponent({
name: 'MyHeader',
@@ -63,6 +64,7 @@ export default defineComponent({
const userStore = useUserStore()
const globalStore = useGlobalStore()
const testStore = useTestStore()
const notifStore = useNotifStore()
const site = computed(() => globalStore.site)
const isfinishLoading = computed(() => globalStore.finishLoading)

View File

@@ -14,6 +14,7 @@ export * from './CImgTitle'
export * from './CMyAvatar'
export * from './CMyCart'
export * from './CMyFieldDb'
export * from './CBarSelection'
export * from './CMyFieldRec'
export * from './CImgPoster'
export * from './CSelectImage'

View File

@@ -1500,3 +1500,4 @@ h3 {
.buttreg {
font-weight: bold;
}

View File

@@ -72,7 +72,15 @@ export default defineComponent({
}
})
const { getNumNotifUnread, getNumNotif, getUsernameChatByNotif, getImgByNotif, getNotifText, getTypeDirNotif, getTypeIdNotif } = MixinUsers()
const { getnumCoinsUnread, Username, getNumNotif, getUsernameChatByNotif, getImgByNotif, getNotifText, getTypeDirNotif, getTypeIdNotif } = MixinUsers()
watch(() => open.value, (newval: any, oldval: any) => {
if (getnumCoinsUnread()) {
if (open.value)
notifStore.setAllRead(Username(), shared_consts.QualiNotifs.CIRCUITS)
}
})
// function getlasts_coins (state: IUserState) => IMessage[] {
//
@@ -168,7 +176,7 @@ export default defineComponent({
getlasts_coins,
num_notifs_unread,
clickNotif,
getNumNotifUnread,
getnumCoinsUnread,
getNumNotif,
getUsernameChatByNotif,
getImgByNotif,

View File

@@ -73,7 +73,14 @@ export default defineComponent({
}
})
const { getNumNotifUnread, getNumNotif, getUsernameChatByNotif, getImgByNotif, getNotifText, getTypeDirNotif, getTypeIdNotif } = MixinUsers()
const { getNumNotifUnread, Username, getNumNotif, getUsernameChatByNotif, getImgByNotif, getNotifText, getTypeDirNotif, getTypeIdNotif } = MixinUsers()
watch(() => open.value, (newval: any, oldval: any) => {
if (getNumNotifUnread()) {
if (open.value)
notifStore.setAllRead(Username(), shared_consts.QualiNotifs.OTHERS)
}
})
// function lasts_notifs (state: IUserState) => IMessage[] {
//

View File

@@ -207,6 +207,11 @@ export default function () {
return notifStore.getnumNotifUnread
}
function getnumCoinsUnread() {
const notifStore = useNotifStore()
return notifStore.getnumCoinsUnread
}
function getUsernameChatByNotif(msg: INotif) {
if (msg) {
@@ -263,5 +268,6 @@ export default function () {
getTypeIdNotif,
getImgByNotif,
getNotifText,
getnumCoinsUnread,
}
}

View File

@@ -373,6 +373,10 @@ export interface ICircuitState {
listcircuits: ICircuit[]
}
export interface ISelector {
data: object
table: string
}
export interface IGlobalState {
finishLoading: boolean
conta: number
@@ -444,6 +448,7 @@ export interface IGlobalState {
mygroups: IMyGroup[],
selElem?: IMyElem,
editOn?: boolean,
myselector: ISelector,
}
export interface IMenuList {

View File

@@ -4,8 +4,6 @@
<div v-if="tools.isLogged()">
<div v-if="tools.isUserOk()">
<CTitlePage :ind="4" />
<CFinder
:ind="4"
:table="toolsext.TABMYBACHECAS">

View File

@@ -5,7 +5,6 @@
<CNotifAtTop />
<div v-if="tools.isUserOk()">
<CTitlePage :ind="0" />
<CFinder
:ind="0"

View File

@@ -5,7 +5,6 @@
<CNotifAtTop />
<div v-if="tools.isUserOk()">
<CTitlePage :ind="2" />
<CFinder
:ind="2"

View File

@@ -1,7 +1,5 @@
<template>
<q-page class="">
<CTitlePage :ind="1" />
<div v-if="tools.isLogged()">
<div v-if="tools.isUserOk()">

View File

@@ -1,7 +1,5 @@
<template>
<q-page class="">
<CTitlePage :ind="1" />
<div v-if="tools.isLogged()">
<CNotifAtTop />
@@ -10,6 +8,7 @@
<CFinder
:ind="1"
:table="toolsext.TABMYSKILLS"
:selector="myselector"
/>
<!--<CDashboard></CDashboard>-->

View File

@@ -111,6 +111,7 @@ export const costanti = {
hint: '',
disable: true,
small: false,
table: '',
},
{
visible: true,
@@ -135,6 +136,7 @@ export const costanti = {
hint: '',
disable: true,
small: false,
table: '',
},
{
visible: false,
@@ -147,6 +149,7 @@ export const costanti = {
hint: '',
disable: true,
small: true,
table: '',
},
{
visible: true,
@@ -158,6 +161,7 @@ export const costanti = {
disable: false,
small: false,
link: true,
table: '',
},
{
visible: true,
@@ -169,6 +173,7 @@ export const costanti = {
disable: false,
small: true,
link: true,
table: '',
},
{
visible: false,
@@ -179,6 +184,7 @@ export const costanti = {
hint: '',
disable: true,
small: true,
table: '',
},
{
visible: false,

View File

@@ -2055,6 +2055,17 @@ export const tools = {
return ris
},
strToObj(mystr: string): any {
if (mystr)
return JSON.parse(mystr)
else
return null
},
objToStr(myobj: any): string {
return JSON.stringify(myobj)
},
notifyarraychanged(array: any) {
if (array.length > 0) {
array.splice(array.length - 1, 1, array[array.length - 1])

View File

@@ -178,6 +178,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
mygroups: [],
selElem: {},
editOn: false,
myselector: { data: {}, table: ''}
}),
getters: {