ver. 0.2.12

Sistemare i Gruppi : cardGruppo
This commit is contained in:
paoloar77
2022-02-25 19:20:51 +01:00
parent f63fdbb175
commit bdfeb714d7
23 changed files with 667 additions and 93 deletions

View File

@@ -24,6 +24,7 @@ import { CMyUser } from '../CMyUser'
import { CMyGroups } from '../CMyGroups'
import { CMyFieldDb } from '../CMyFieldDb'
import { CMyRecCard } from '../CMyRecCard'
import { CMyRecGrpCard } from '../CMyRecGrpCard'
import { CMySelect } from '../CMySelect'
import { CTitleBanner } from '../CTitleBanner'
@@ -34,6 +35,7 @@ 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'
export default defineComponent({
name: 'CGridTableRec',
@@ -208,7 +210,7 @@ export default defineComponent({
default: '',
},
},
components: { CMyPopupEdit, CTitleBanner, CMyFieldDb, CMySelect, CMyFriends, CMyGroups, CMyUser, CMyRecCard, CMyCardPopup },
components: { CMyPopupEdit, CTitleBanner, CMyFieldDb, CMySelect, CMyFriends, CMyGroups, CMyUser, CMyRecCard, CMyCardPopup, CMyRecGrpCard, CMyCardGrpPopup },
setup(props, { emit }) {
const $q = useQuasar()
const { t } = useI18n()
@@ -341,33 +343,6 @@ export default defineComponent({
refresh()
}
function canModifyThisRec(rec: any) {
// console.log('rec', rec)
if (tablesel.value === 'mygroups') {
// is Admin ?
if (rec.admins) {
const trovato = rec.admins.find((myuser: any) => myuser.username === userStore.my.username)
if (trovato) {
return !!trovato
}
}
}
if (rec.hasOwnProperty('userId')) {
let userId = rec.userId
if (userId === userStore.my._id) {
// E' il mio, quindi modificalo
return true
} else {
return false
}
} else {
return false
}
if (userStore.isAdmin || userStore.isManager)
return true
}
// emulate 'SELECT count(*) FROM ...WHERE...'
function getRowsNumberCount(myfilter?: any) {
@@ -1628,7 +1603,6 @@ export default defineComponent({
globalStore,
searchList,
searchval,
canModifyThisRec,
checkIfShowRec,
valoriopt,
labelcombo,

View File

@@ -35,8 +35,8 @@
<q-spinner-tail size="2em" color="primary"/>
</q-inner-loading>
<q-table
:grid="(myvertical === costanti.VISUTABLE_SCHEDA_USER || myvertical === 2 || myvertical === costanti.VISUTABLE_SCHEDA_GROUP)"
:grid-header="(myvertical === costanti.VISUTABLE_SCHEDA_USER || myvertical === 2 || myvertical === costanti.VISUTABLE_SCHEDA_GROUP) && shared_consts.TABLES_WITH_SORTING.includes(mytable)"
:grid="shared_consts.VERTIC_SHOW_GRID.includes(myvertical)"
:grid-header="shared_consts.VERTIC_SHOW_GRID.includes(myvertical) && shared_consts.TABLES_WITH_SORTING.includes(mytable)"
flat
bordered
class="my-sticky-header-table"
@@ -321,7 +321,7 @@
<CMyPopupEdit
:table="mytable"
:canEdit="canEdit"
:canModify="canModifyThisRec(props.row)"
:canModify="tools.canModifyThisRec(props.row, tablesel)"
:disable="disabilita()"
:mycol="col"
v-model:row="props.row"
@@ -354,7 +354,7 @@
<template v-slot:item="props">
<div
v-if="showType === costanti.SHOW_MYCARD || (myvertical === costanti.VISUTABLE_LISTA && shared_consts.TABLES_VISU_CMYSRECCARD.includes(tablesel)) ">
v-if="showType === costanti.SHOW_MYCARD || (myvertical !== costanti.VISUTABLE_USER_TABGROUP && myvertical === costanti.VISUTABLE_LISTA && shared_consts.TABLES_VISU_CMYSRECCARD.includes(tablesel)) ">
<div v-if="props.row && shared_consts.TABLES_WITH_DATE.includes(tablesel)">
@@ -364,7 +364,15 @@
</div>
</div>
<CMyRecGrpCard
v-if="tablesel === toolsext.TABMYGROUPS"
:table="tablesel"
:prop_myrec="props.row"
@cmdext="cmdExt"
>
</CMyRecGrpCard>
<CMyRecCard
v-else
:table="tablesel"
:prop_myrec="props.row"
@cmdext="cmdExt"
@@ -376,6 +384,7 @@
v-else-if="((showType === costanti.SHOW_USERINFO) && myvertical !== costanti.VISUTABLE_SCHEDA_USER) || ((myvertical === 2) && (shared_consts.TABLES_VISU_LISTA_USER.includes(tablesel)))"
class="fill-all-width">
<div>
<CMyUser
:mycontact="props.row"
:visu="visufind"
@@ -385,16 +394,6 @@
>
</CMyUser>
<!--
<CMyFriends
v-model="filter"
:finder="false"
:mycontact="props.row"
:visu="visufind"
:groupname="extrafield"
:labelextra="props.row[col_title]"
/>
-->
<q-separator></q-separator>
</div>
@@ -421,7 +420,7 @@
<q-card :class="props.selected ? 'bg-grey-2 my-card-withshadow no-padding' : 'my-card-withshadow no-padding'"
style="background: radial-gradient(circle, #ffffff 0%, #bbddff 100%)">
<q-bar v-if="!visuinpage && canModifyThisRec(props.row)" dense class="bg-primary text-white full-height">
<q-bar v-if="!visuinpage && tools.canModifyThisRec(props.row, tablesel)" dense class="bg-primary text-white full-height">
<q-badge v-if="props.row['adType']" :color="fieldsTable.getColByAdType(props.row['adType'])">
{{ fieldsTable.getValByTabAndId(tablesel, 'adType', props.row['adType']) }}
<q-icon :name="fieldsTable.getIconByAdType(props.row['adType'])" color="white" class="q-ml-xs"/>
@@ -430,11 +429,11 @@
<q-space/>
<q-btn
v-if="canModifyThisRec(props.row)"
v-if="tools.canModifyThisRec(props.row, tablesel)"
flat round color="white" icon="fas fa-pencil-alt" size="sm"
@click="clickFunz(props.row, prop_mycolumns.find((rec) => rec.action === lists.MenuAction.CAN_EDIT_TABLE))"></q-btn>
<q-btn
v-if="canModifyThisRec(props.row)"
v-if="tools.canModifyThisRec(props.row, tablesel)"
flat round color="white" icon="fas fa-trash-alt" size="sm"
@click="clickFunz(props.row, prop_mycolumns.find((rec) => rec.action === lists.MenuAction.DELETE_RECTABLE))"></q-btn>
</q-bar>
@@ -467,7 +466,7 @@
<CMyPopupEdit
:table="mytable"
:canEdit="canEdit"
:canModify="canModifyThisRec(props.row)"
:canModify="tools.canModifyThisRec(props.row, tablesel)"
:disable="disabilita()"
:mycol="col"
v-model:row="props.row"
@@ -492,7 +491,14 @@
</q-table>
<q-dialog v-model="visupagedialog" @hide="hidewindow" :maximized="$q.screen.lt.sm">
<CMyCardGrpPopup
v-if="mytable === toolsext.TABMYGROUPS"
:table="mytable"
:prop_myrec="myrecdialog">
</CMyCardGrpPopup>
<CMyCardPopup
v-else
:table="mytable"
:prop_myrec="myrecdialog">
@@ -522,7 +528,7 @@
<CMyPopupEdit
:table="mytable"
:canEdit="true"
:canModify="canModifyThisRec(rowclicksel)"
:canModify="tools.canModifyThisRec(rowclicksel, tablesel)"
:disable="disabilita()"
view="field"
:mycol="mycol"
@@ -609,7 +615,7 @@
<CMyPopupEdit
:table="mytable"
:canEdit="true"
:canModify="canModifyThisRec(recModif)"
:canModify="tools.canModifyThisRec(recModif, tablesel)"
:tablesel="col.tablesel"
:mycol="col"
:isInModif="true"