Aggiunta del Bottone "Aggiungi"

This commit is contained in:
Surya Paolo
2022-12-01 21:44:33 +01:00
parent bf1e9fc982
commit 07f5f1c4c9
14 changed files with 864 additions and 550 deletions

View File

@@ -8,8 +8,6 @@
<!--<CPreloadImages :arrimg="static_data.preLoadImages"> <!--<CPreloadImages :arrimg="static_data.preLoadImages">
</CPreloadImages>--> </CPreloadImages>-->
<app-footer></app-footer>
<q-page-container id="mypage" :class="(darkcookie && !finishLoading) ? `bg-black`: ``"> <q-page-container id="mypage" :class="(darkcookie && !finishLoading) ? `bg-black`: ``">
<div v-if="finishLoading"> <div v-if="finishLoading">
<CFirstPageApp></CFirstPageApp> <CFirstPageApp></CFirstPageApp>
@@ -22,6 +20,9 @@
</q-spinner-tail> </q-spinner-tail>
</q-inner-loading> </q-inner-loading>
</q-page-container> </q-page-container>
<app-footer></app-footer>
</q-layout> </q-layout>
</div> </div>
<BannerCookies urlInfo="/policy"></BannerCookies> <BannerCookies urlInfo="/policy"></BannerCookies>

View File

@@ -49,13 +49,15 @@
.barselection { .barselection {
padding: 0;
flex-wrap: nowrap;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-around; justify-content: space-between;
} }
.myitem { .myitem {
padding: 0px 6px 0px 6px !important; padding: 0px 0px 0px 0px !important;
} }
.myitem-0 { .myitem-0 {
@@ -68,5 +70,9 @@
} }
.myitem-2 { .myitem-2 {
flex-grow: 0;
}
.myitem-3 {
flex-grow: 1; flex-grow: 1;
} }

View File

@@ -39,6 +39,7 @@ import { CMyCardPopup } from '@/components/CMyCardPopup'
import { CMyCardGrpPopup } from '@/components/CMyCardGrpPopup' import { CMyCardGrpPopup } from '@/components/CMyCardGrpPopup'
import { CMyCardCircuitPopup } from '@/components/CMyCardCircuitPopup' import { CMyCardCircuitPopup } from '@/components/CMyCardCircuitPopup'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { table } from 'console'
export default defineComponent({ export default defineComponent({
name: 'CBarSelection', name: 'CBarSelection',
@@ -276,7 +277,7 @@ export default defineComponent({
} }
function visButtRow() { function visButtRow() {
return false return true
} }
function gotoPageSel() { function gotoPageSel() {
@@ -286,6 +287,10 @@ export default defineComponent({
} }
} }
function createNewRecordDialog() {
globalStore.addNewRecord = tablesel.value
}
created() created()
onMounted(mounted) onMounted(mounted)
@@ -329,6 +334,7 @@ export default defineComponent({
optionsMainCards, optionsMainCards,
tablesel, tablesel,
gotoPageSel, gotoPageSel,
createNewRecordDialog,
} }
} }
}) })

View File

@@ -6,204 +6,195 @@
<div <div
class="centermydiv q-mx-sm" class="centermydiv q-mx-sm"
:style="`text-align: center; background-color: ${mycolor}`" :style="`text-align: center; background-color: ${mycolor}`"
> ></div>
<q-btn
v-if="table && visButtRow()"
rounded
dense
color="primary"
size="lg"
:label="getlabelAddRow()"
@click="createNewRecordDialog"
></q-btn>
</div>
<div> <div>
<div v-if="prop_search || canEdit" class="q-my-xs text-right"> <div v-if="prop_search || canEdit" class="q-my-xs text-right">
<q-btn <q-btn
size="sm" size="sm"
dense dense
icon="fas fa-filter" icon="fas fa-filter"
:label="!showfilter ? $t('grid.showfilters') : $t('grid.hidefilters')" :label="$t('grid.showfilters')"
@click="showfilter = !showfilter" @click="showfilter = !showfilter"
></q-btn> ></q-btn>
</div> </div>
<q-slide-transition> <q-slide-transition>
<div v-show="true"> <div class="row no-wrap shadow-1">
<div v-show="searchList" class="barselection"> <q-header elevated>
<div class="myitem myitem-0"> <q-toolbar class="glossy" style="">
<q-icon :name="myicon" size="xs" /> <div class="col-3">
</div> <q-select
<div class="myitem myitem-1 mybanner"> v-model="tablesel"
<q-select :options="optionsMainCards"
filled emit-value
v-model="tablesel" borderless
:options="optionsMainCards" map-options
emit-value behavior="menu"
borderless @update:model-value="gotoPageSel"
map-options >
behavior="menu" <template v-slot:option="scope">
@update:model-value="gotoPageSel" <q-item v-bind="scope.itemProps">
> <q-item-section avatar>
<template v-slot:option="scope"> <q-icon :name="scope.opt.icon" />
<q-item v-bind="scope.itemProps"> </q-item-section>
<q-item-section avatar> <q-item-section>
<q-icon :name="scope.opt.icon" /> <q-item-label>{{ scope.opt.label }}</q-item-label>
</q-item-section> <!--<q-item-label caption>{{
<q-item-section>
<q-item-label>{{ scope.opt.label }}</q-item-label>
<!--<q-item-label caption>{{
scope.opt.description scope.opt.description
}}</q-item-label>--> }}</q-item-label>-->
</q-item-section> </q-item-section>
</q-item> </q-item>
</template> </template>
</q-select> </q-select>
</div> </div>
<q-space />
<q-btn
<div size="sm"
class="myitem myitem-2" class="col-1 q-mx-xs"
v-for="(item, index) in searchList" icon="fas fa-plus"
:key="index" @click="createNewRecordDialog"
>
<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> </q-btn>
<div class="col" 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="item.value ? '' : 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="white"
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"> <!--<div v-if="item.type === costanti.FieldType.multiselect_by_server">
item: {{ item}} item: {{ item}}
</div>--> </div>-->
<CMySelect <CMySelect
v-if="item.type === costanti.FieldType.multiselect_by_server" v-if="item.type === costanti.FieldType.multiselect_by_server"
:col="fieldsTable.getColByColumns(mycolumns, item.key)" :col="fieldsTable.getColByColumns(mycolumns, item.key)"
:multiselect_by_server="true" :multiselect_by_server="true"
:label="labelcombo(item)" :label="labelcombo(item)"
v-model:arrvalue="item.arrvalue" v-model:arrvalue="item.arrvalue"
@update:arrvalue="searchval(item.arrvalue, item.table)" @update:arrvalue="searchval(item.arrvalue, item.table)"
:addall="item.addall" :addall="item.addall"
:addnone="item.addnone" :addnone="item.addnone"
:addlast="true" :addlast="true"
:tablesel="item.tablesel" :tablesel="item.tablesel"
:pickup="true" :pickup="true"
:param1="item.param1" :param1="item.param1"
label-color="primary" label-color="primary"
class="combowidth" class="combowidth"
color="primary" color="primary"
:icon_alternative="item.icon" :icon_alternative="item.icon"
:optval="fieldsTable.getKeyByTable(item.table)" :optval="fieldsTable.getKeyByTable(item.table)"
:optlab="fieldsTable.getLabelByTable(item.table)" :optlab="fieldsTable.getLabelByTable(item.table)"
:filter="item.filter" :filter="item.filter"
:filter_extra="item.filter_extra" :filter_extra="item.filter_extra"
:options="valoriopt(item, false)" :options="valoriopt(item, false)"
:useinput="true" :useinput="true"
> >
</CMySelect> </CMySelect>
<q-select <q-select
v-if="item.type === costanti.FieldType.multiselect" v-if="item.type === costanti.FieldType.multiselect"
v-model="item.arrvalue" v-model="item.arrvalue"
label-color="primary" label-color="primary"
:label="labelcombo(item)" :label="labelcombo(item)"
@update:model-value="searchval(item.arrvalue, item.table)" @update:model-value="searchval(item.arrvalue, item.table)"
rounded rounded
dense dense
outlined outlined
multiple multiple
options-dense options-dense
emit-value emit-value
map-options map-options
stack-label :useinput="item.useinput"
:useinput="item.useinput" :options="valoriopt(item, item.addall, item.addnone)"
:options="valoriopt(item, item.addall, item.addnone)" :filter="item.filter"
:filter="item.filter" class="combowidth"
class="combowidth" :option-value="fieldsTable.getKeyByTable(item.table)"
: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 <template v-if="item.icon" v-slot:prepend>
v-if=" <q-icon :name="item.icon" />
scope.opt[fieldsTable.getLabelByTable(item.table)] || </template>
(scope.opt && checkIfShowRec(scope.opt)) <template
" v-if="item.arrvalue.length >= 1"
v-slot:selected-item="scope"
> >
<q-chip <div
removable v-if="
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[fieldsTable.getLabelByTable(item.table)] ||
scope.opt (scope.opt && checkIfShowRec(scope.opt))
}} "
</q-chip> >
</div> <q-chip
</template> removable
<template dense
v-slot:option="{ itemProps, opt, selected, toggleOption }" @remove="scope.removeAtIndex(scope.index)"
> v-if="checkIfShowRec(scope.opt)"
<q-item v-bind="itemProps"> color="white"
<q-item-section> text-color="mycol"
<q-item-label>{{ class="q-my-none q-ml-xs q-mr-none"
opt[fieldsTable.getLabelByTable(item.table)] >
}}</q-item-label> <q-avatar
</q-item-section> color="primary"
<q-item-section side> text-color="white"
<q-toggle :icon="item.icon"
:model-value="selected" size="12px"
@update:model-value="toggleOption(opt)" />
/> {{
</q-item-section> scope.opt[fieldsTable.getLabelByTable(item.table)] ||
</q-item> scope.opt
</template> }}
</q-select> </q-chip>
</div> </div>
</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>
</q-toolbar>
</q-header>
</div> </div>
</q-slide-transition> </q-slide-transition>

View File

@@ -55,10 +55,6 @@ export default defineComponent({
const globalStore = useGlobalStore() const globalStore = useGlobalStore()
const userStore = useUserStore() const userStore = useUserStore()
const myselector = ref({})
provide('myselector', myselector)
const arrfilterand: any = ref([]) const arrfilterand: any = ref([])
const filtercustom: any = ref([]) const filtercustom: any = ref([])
const searchList_Servizi = ref(<ISearchList[]>[]) const searchList_Servizi = ref(<ISearchList[]>[])

View File

@@ -49,7 +49,6 @@
:nodataLabel="noMsgRecord" :nodataLabel="noMsgRecord"
:prop_search="true" :prop_search="true"
:finder="true" :finder="true"
:labelBtnAddExtra="noButtAdd ? `` : `Aggiungi ${strextra}`"
:choose_visutype="visuType" :choose_visutype="visuType"
:butt_modif_new="true && !noButtAdd" :butt_modif_new="true && !noButtAdd"
noresultLabel="Il filtro selezionato non ha trovato nessun risultato" noresultLabel="Il filtro selezionato non ha trovato nessun risultato"
@@ -58,11 +57,14 @@
:prop_searchList="searchList" :prop_searchList="searchList"
:defaultnewrec="getdefaultnewrec" :defaultnewrec="getdefaultnewrec"
:selector="selector" :selector="selector"
labelBtnAddRow="NONE"
:labelBtnAddExtra="noButtAdd ? `` : ``"
:extraparams="extraparams()" :extraparams="extraparams()"
> >
</CGridTableRec> </CGridTableRec>
</div> </div>
<q-page-scroller <q-page-scroller
position="bottom-right" position="bottom-right"
:scroll-offset="850" :scroll-offset="850"

View File

@@ -326,8 +326,6 @@ export default defineComponent({
const myvertical = ref(props.vertical) const myvertical = ref(props.vertical)
//const myselector = inject('myselector', {})
const myselector = computed(() => globalStore.myselector)
const valoriopt = computed(() => (item: any, addall: boolean, addnone: boolean) => { const valoriopt = computed(() => (item: any, addall: boolean, addnone: boolean) => {
// console.log('valoriopt', item.table) // console.log('valoriopt', item.table)
@@ -341,9 +339,16 @@ export default defineComponent({
return lab return lab
}) })
watch(() => globalStore.addNewRecord, (value: any, oldval: any) => {
if (globalStore.addNewRecord === props.prop_mytable) {
createNewRecordDialog()
globalStore.addNewRecord = ''
}
})
watch(() => globalStore.myselector, (value: any, oldval: any) => { watch(() => globalStore.myselector, (value: any, oldval: any) => {
console.log('******* CGRIDTABLEREC : globalStore.myselector', globalStore.myselector) // console.log('******* CGRIDTABLEREC : globalStore.myselector', globalStore.myselector)
console.log(' . value', value) // console.log(' . value', value)
const rec = searchList.value.find((myrec) => myrec.table === globalStore.myselector.table) // check if exist const rec = searchList.value.find((myrec) => myrec.table === globalStore.myselector.table) // check if exist
if (rec) { if (rec) {
rec.value = globalStore.myselector.data rec.value = globalStore.myselector.data
@@ -1854,7 +1859,7 @@ export default defineComponent({
} }
function visButtRow() { function visButtRow() {
return props.labelBtnAddRow !== addRow.value return (props.labelBtnAddRow !== addRow.value) && props.labelBtnAddRow !== 'NONE'
} }
function checkIfShowRec(rec: any) { function checkIfShowRec(rec: any) {
@@ -2108,7 +2113,6 @@ export default defineComponent({
myinfscroll, myinfscroll,
t, t,
exportTable, exportTable,
myselector,
} }
} }
}) })

File diff suppressed because it is too large Load Diff

View File

@@ -15,7 +15,7 @@
multiple multiple
options-dense options-dense
map-options map-options
stack-label :stack-label="label ? true : false"
emit-value emit-value
:readonly="sola_lettura" :readonly="sola_lettura"
:use-input="useinput" :use-input="useinput"

View File

@@ -1,61 +1,67 @@
<template> <template>
<q-footer <q-footer
v-if="tools.isUserOk() && site && site.confpages" v-if="tools.isUserOk() && site && site.confpages" :class="($q.dark.isActive
:class="($q.dark.isActive ? `bg-black` : `bg-white`) + ` small-screen-only`" ? `bg-black` : `bg-white`) + ` small-screen-only`" bordered >
bordered <q-toolbar>
> <q-toolbar-title>
<q-tabs <q-tabs
dense dense
:class="($q.dark.isActive ? `text-white bg-black` : `text-grey-10 bg-white`) + ` mylabfooter mysmalltabs`" :class="
style="padding: 0px !important;" ($q.dark.isActive
content-class="mysmalltabs" ? `text-white bg-black`
:active-color="$q.dark.isActive ? `primary`: `primary`" : `text-grey-10 bg-white`) + ` mylabfooter mysmalltabs`
no-caps "
indicator-color="transparent" style="padding: 0px !important"
> content-class="mysmalltabs"
<q-route-tab :active-color="$q.dark.isActive ? `primary` : `primary`"
v-if="site.confpages.showButtHome" no-caps
to="/" indicator-color="transparent"
class="mylabfooter" >
:label="$t('tabdown.home')" <q-route-tab
icon="fas fa-home" v-if="site.confpages.showButtHome"
/> to="/"
<q-route-tab class="mylabfooter"
v-if="site.confpages.showViewGroups" :label="$t('tabdown.home')"
class="mylabfooter" icon="fas fa-home"
:label="$t('tabdown.groups')" />
to="/groups" <q-route-tab
icon="fas fa-users" v-if="site.confpages.showViewGroups"
/> class="mylabfooter"
<q-route-tab :label="$t('tabdown.groups')"
v-if="site.confpages.showViewCircuits" to="/groups"
class="mylabfooter" icon="fas fa-users"
:label="$t('tabdown.circuits')" />
to="/circuits" <q-route-tab
icon="fas fa-coins" v-if="site.confpages.showViewCircuits"
/> class="mylabfooter"
<q-route-tab :label="$t('tabdown.circuits')"
v-if="site.confpages.showViewUsers" to="/circuits"
class="mylabfooter" icon="fas fa-coins"
:label="$t('tabdown.friends')" />
to="/friends" <q-route-tab
icon="fas fa-user-friends" v-if="site.confpages.showViewUsers"
/> class="mylabfooter"
<q-route-tab :label="$t('tabdown.friends')"
v-if="site.confpages.showViewBooking" to="/friends"
class="mylabfooter" icon="fas fa-user-friends"
:label="$t('tabdown.bookings')" />
to="/admin/eventlist" <q-route-tab
icon="fas fa-calendar-plus" v-if="site.confpages.showViewBooking"
/> class="mylabfooter"
<q-route-tab :label="$t('tabdown.bookings')"
v-if="site.confpages.showViewProfile" to="/admin/eventlist"
class="mylabfooter" icon="fas fa-calendar-plus"
:label="$t('tabdown.profile')" />
:to="`/my/`+getMyUsername()" <q-route-tab
icon="person" v-if="site.confpages.showViewProfile"
/> class="mylabfooter"
</q-tabs> :label="$t('tabdown.profile')"
:to="`/my/` + getMyUsername()"
icon="person"
/>
</q-tabs>
</q-toolbar-title>
</q-toolbar>
</q-footer> </q-footer>
</template> </template>

View File

@@ -449,6 +449,7 @@ export interface IGlobalState {
selElem?: IMyElem, selElem?: IMyElem,
editOn?: boolean, editOn?: boolean,
myselector: ISelector, myselector: ISelector,
addNewRecord: string,
} }
export interface IMenuList { export interface IMenuList {

View File

@@ -8,7 +8,6 @@
<CFinder <CFinder
:ind="1" :ind="1"
:table="toolsext.TABMYSKILLS" :table="toolsext.TABMYSKILLS"
:selector="myselector"
/> />
<!--<CDashboard></CDashboard>--> <!--<CDashboard></CDashboard>-->

View File

@@ -20,7 +20,7 @@ const msg_it = {
columns: 'Colonne', columns: 'Colonne',
tableslist: 'Tabelle', tableslist: 'Tabelle',
nodata: 'Nessun Dato', nodata: 'Nessun Dato',
showfilters: 'Mostra Filtri', showfilters: 'Filtri',
hidefilters: 'Nascondi Filtri', hidefilters: 'Nascondi Filtri',
}, },
gallery: { gallery: {

View File

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