ver. 0.2.12
Sistemare i Gruppi : cardGruppo
This commit is contained in:
@@ -96,6 +96,9 @@ export const shared_consts = {
|
||||
TABLES_PERM_NEWREC: ['skills', 'goods', 'subskills', 'mygroups'],
|
||||
TABLES_REC_ID: ['skills', 'goods', 'subskills'],
|
||||
|
||||
// costanti.VISUTABLE_SCHEDA_USER, VISUTABLE_SCHEDA_GROUP, VISUTABLE_USER_TABGROUP
|
||||
VERTIC_SHOW_GRID: [-1, 2, -3, -4],
|
||||
|
||||
TABLES_ID_NUMBER: ['permissions', 'levels', 'adtypes', 'adtypegoods', 'statusSkills', 'sectors', 'sectorgoods', 'catgrps', 'skills', 'subskills', 'cities', 'provinces',
|
||||
'myskills', 'mybachecas', 'mygoods', 'mygroups'],
|
||||
TABLES_USER_ID: ['mygroups', 'myskills', 'mybachecas', 'mygoods'],
|
||||
@@ -107,6 +110,9 @@ export const shared_consts = {
|
||||
TABLES_PERM_CHANGE_FOR_USERS: ['myskills', 'mybachecas', 'mygoods'],
|
||||
TABLES_VISU_LISTA_USER: ['myskills', 'mybachecas', 'mygoods', 'users'],
|
||||
|
||||
TABLES_VISU_IMG: ['myskills', 'mybachecas', 'mygoods', 'mygroups'],
|
||||
TABLES_DIRECTORY_A_PARTE: ['mygroups'],
|
||||
|
||||
VISIB_ALL: 0,
|
||||
VISIB_ONLYIF_VERIFIED: 1,
|
||||
VISIB_ONLY_MANAGER: 2,
|
||||
|
||||
@@ -734,6 +734,29 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
lookup2: {
|
||||
lk_tab: 'catgrps',
|
||||
lk_LF: 'idCatGrp',
|
||||
lk_FF: '_id',
|
||||
lk_as: 'recCatGrp',
|
||||
lk_proj: {
|
||||
groupname: 1,
|
||||
title: 1,
|
||||
descr: 1,
|
||||
img: 1,
|
||||
visibility: 1,
|
||||
admins: 1,
|
||||
idCatGrp: 1,
|
||||
photos: 1,
|
||||
idCity: 1,
|
||||
note: 1,
|
||||
website: 1,
|
||||
comune: 1,
|
||||
mycities: 1,
|
||||
sector: 1,
|
||||
recCatGrp: 1,
|
||||
}
|
||||
},
|
||||
lookup3: {
|
||||
lk_tab: 'cities',
|
||||
lk_LF: 'idCity',
|
||||
lk_FF: '_id',
|
||||
@@ -753,6 +776,7 @@ export default defineComponent({
|
||||
website: 1,
|
||||
comune: 1,
|
||||
mycities: 1,
|
||||
recCatGrp: 1,
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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"
|
||||
|
||||
127
src/components/CMyCardGrpPopup/CMyCardGrpPopup.scss
Normal file
127
src/components/CMyCardGrpPopup/CMyCardGrpPopup.scss
Normal file
@@ -0,0 +1,127 @@
|
||||
.profile {
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
max-width: 450px;
|
||||
}
|
||||
|
||||
.myrow{
|
||||
display: flex;
|
||||
@media (max-width: 600px) {
|
||||
flex-flow: column;
|
||||
}
|
||||
}
|
||||
|
||||
.qualifica{
|
||||
border: solid 2px #4198ef;
|
||||
border-radius: 1rem;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
|
||||
.text-bacheca{
|
||||
margin: 10px;
|
||||
border: solid 2px #4198ef;
|
||||
border-radius: 1rem;
|
||||
padding: 10px;
|
||||
|
||||
}
|
||||
|
||||
.note-bacheca{
|
||||
border: solid 2px #C10015;
|
||||
border-radius: 1rem;
|
||||
padding: 10px;
|
||||
|
||||
}
|
||||
|
||||
.img {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
|
||||
max-height: 350px;
|
||||
max-width: 350px;
|
||||
@media (max-width: 500px) {
|
||||
max-height: 400px;
|
||||
max-width: 400px;
|
||||
}
|
||||
}
|
||||
|
||||
$graytext: #555;
|
||||
.cal {
|
||||
color: black;
|
||||
font-size: 1rem;
|
||||
font-weight: 400;
|
||||
line-height: 1.25rem;
|
||||
letter-spacing: 0.03333em;
|
||||
|
||||
&__title {
|
||||
color: white;
|
||||
font-weight: 700;
|
||||
font-size: 1rem;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
&__details {
|
||||
color: black;
|
||||
}
|
||||
|
||||
&__hours {
|
||||
color: blue;
|
||||
&-title {
|
||||
color: $graytext;
|
||||
}
|
||||
&-content {
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
|
||||
&__where {
|
||||
margin-top: 5px;
|
||||
color: blue;
|
||||
|
||||
&-title {
|
||||
color: $graytext;
|
||||
}
|
||||
&-content {
|
||||
color: darkblue !important;
|
||||
}
|
||||
}
|
||||
|
||||
&__when {
|
||||
margin-top: 5px;
|
||||
color: blue;
|
||||
|
||||
&-title {
|
||||
color: $graytext;
|
||||
}
|
||||
&-content {
|
||||
color: darkblue !important;;
|
||||
}
|
||||
}
|
||||
|
||||
&__teacher {
|
||||
margin-top: 5px;
|
||||
&-title {
|
||||
color: $graytext;
|
||||
}
|
||||
&-content {
|
||||
color: darkblue !important;;
|
||||
}
|
||||
}
|
||||
|
||||
&__quota {
|
||||
margin-top: 5px;
|
||||
&-title {
|
||||
color: $graytext;
|
||||
}
|
||||
&-content {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
&__img {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
}
|
||||
95
src/components/CMyCardGrpPopup/CMyCardGrpPopup.ts
Normal file
95
src/components/CMyCardGrpPopup/CMyCardGrpPopup.ts
Normal file
@@ -0,0 +1,95 @@
|
||||
import { computed, defineComponent, onMounted, PropType, ref, watch } from 'vue'
|
||||
|
||||
import { CMyFieldDb } from '@/components/CMyFieldDb'
|
||||
import { CTitleBanner } from '@/components/CTitleBanner'
|
||||
import { CProfile } from '@/components/CProfile'
|
||||
import { CDateTime } from '@/components/CDateTime'
|
||||
import { CMyPage } from '@/components/CMyPage'
|
||||
import { CMyFieldRec } from '@/components/CMyFieldRec'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { costanti } from '@costanti'
|
||||
import { IColGridTable, IImgGallery, IUserFields } from 'model'
|
||||
import { shared_consts } from '@/common/shared_vuejs'
|
||||
import { colCitys, fieldsTable } from '@store/Modules/fieldsTable'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CMyCardGrpPopup',
|
||||
components: { CProfile, CTitleBanner, CMyFieldDb, CDateTime, CMyPage, CMyFieldRec },
|
||||
props: {
|
||||
table: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
prop_myrec: {
|
||||
type: Object as PropType<any>,
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
idRec: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
setup(props) {
|
||||
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n()
|
||||
|
||||
const showPic = ref(false)
|
||||
|
||||
const myrec = ref({})
|
||||
const col = ref(<IColGridTable>{})
|
||||
|
||||
function profile() {
|
||||
return userStore.my.profile
|
||||
}
|
||||
|
||||
function load() {
|
||||
// Carica il profilo di quest'utente
|
||||
if (props.idRec > 0) {
|
||||
userStore.loadGeneric(props.table, props.idRec).then((ris) => {
|
||||
myrec.value = ris
|
||||
})
|
||||
|
||||
} else {
|
||||
myrec.value = props.prop_myrec
|
||||
}
|
||||
|
||||
col.value = fieldsTable.getArrColsByTable(props.table)
|
||||
}
|
||||
|
||||
watch(() => props.idRec, (to: any, from: any) => {
|
||||
load()
|
||||
})
|
||||
|
||||
function mounted() {
|
||||
load()
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
profile,
|
||||
tools,
|
||||
costanti,
|
||||
myrec,
|
||||
shared_consts,
|
||||
globalStore,
|
||||
showPic,
|
||||
userStore,
|
||||
t,
|
||||
fieldsTable,
|
||||
colCitys,
|
||||
toolsext,
|
||||
col,
|
||||
}
|
||||
}
|
||||
})
|
||||
87
src/components/CMyCardGrpPopup/CMyCardGrpPopup.vue
Normal file
87
src/components/CMyCardGrpPopup/CMyCardGrpPopup.vue
Normal file
@@ -0,0 +1,87 @@
|
||||
<template>
|
||||
|
||||
<q-card class="dialog_card q-mb-lg" v-if="myrec">
|
||||
<q-footer
|
||||
class="bg-white small-screen-only text-center"
|
||||
bordered
|
||||
>
|
||||
<q-btn push rounded color="primary" icon="close" label="Chiudi" v-close-popup></q-btn>
|
||||
|
||||
</q-footer>
|
||||
<q-bar dense class="bg-primary text-white">
|
||||
{{ myrec.title }} ({{ myrec.groupname }})
|
||||
<q-space/>
|
||||
<q-btn flat round color="white" icon="close" v-close-popup></q-btn>
|
||||
</q-bar>
|
||||
<q-card-section class="inset-shadow">
|
||||
<!-- Per ora visualizzo solo la Prima Immagine -->
|
||||
<div class="text-center">
|
||||
|
||||
<q-img
|
||||
v-if="tools.getValue(myrec, 'photos', '')"
|
||||
:src="tools.getFullFileName(tools.getValue(myrec, 'photos', ''), table, myrec.username, myrec.groupname)" class="img"
|
||||
alt="immagine del gruppo"></q-img>
|
||||
</div>
|
||||
|
||||
<!--:title="t(mycol.label_trans)"-->
|
||||
|
||||
<div v-for="(mycol, index) of col" :key="index">
|
||||
<div
|
||||
v-if="(mycol.visible && (tools.checkIfShowField(mycol, tools.TIPOVIS_SHOW_RECORD, false, tools.getValue(myrec, mycol.field, mycol.subfield))))">
|
||||
<div v-if="mycol.fieldtype === costanti.FieldType.html && tools.getValue(myrec, mycol.field, mycol.subfield)">
|
||||
<div class="note-bacheca"
|
||||
v-html="tools.getValue(myrec, mycol.field, mycol.subfield)">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="mycol.name === 'descr'">
|
||||
<div class="text-bacheca">
|
||||
{{ tools.getValue(myrec, mycol.field, mycol.subfield) }}
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="mycol.name === 'photos' && myrec.photos.length <= 1">
|
||||
</div>
|
||||
<div v-else-if="mycol.name === 'admins'">
|
||||
<CMyFieldRec
|
||||
title="Amministratori:"
|
||||
:table="table"
|
||||
:id="myrec._id"
|
||||
:rec="myrec"
|
||||
:field="mycol.field"
|
||||
:canEdit="false"
|
||||
:canModify="false">
|
||||
</CMyFieldRec>
|
||||
|
||||
</div>
|
||||
<CMyFieldRec
|
||||
v-else
|
||||
:table="table"
|
||||
:id="myrec._id"
|
||||
:rec="myrec"
|
||||
:field="mycol.field"
|
||||
:canEdit="false"
|
||||
:canModify="false">
|
||||
</CMyFieldRec>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
<q-btn
|
||||
icon="far fa-file-alt" label="Apri Pagina" color="primary" text-color="white"
|
||||
:to="tools.getToByCol(col, table, myrec)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<br><br>
|
||||
</q-card-section>
|
||||
|
||||
</q-card>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CMyCardGrpPopup.ts">
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './CMyCardGrpPopup.scss';
|
||||
</style>
|
||||
|
||||
1
src/components/CMyCardGrpPopup/index.ts
Normal file
1
src/components/CMyCardGrpPopup/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default as CMyCardGrpPopup } from './CMyCardGrpPopup.vue'
|
||||
@@ -1,4 +1,5 @@
|
||||
<template>
|
||||
|
||||
<q-card class="dialog_card q-mb-lg" v-if="myrec">
|
||||
<q-footer
|
||||
class="bg-white small-screen-only text-center"
|
||||
@@ -18,7 +19,7 @@
|
||||
|
||||
<q-img
|
||||
v-if="tools.getValue(myrec, 'photos', '')"
|
||||
:src="tools.getFullFileName(tools.getValue(myrec, 'photos', ''), table, myrec.username)" class="img"
|
||||
:src="tools.getFullFileName(tools.getValue(myrec, 'photos', ''), table, myrec.username, myrec.groupname)" class="img"
|
||||
alt="immagine bene"></q-img>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -677,15 +677,6 @@ export default defineComponent({
|
||||
|
||||
}
|
||||
|
||||
function getToByCol(col: IColGridTable){
|
||||
if (shared_consts.TABLES_REC_ID.includes(props.table)) {
|
||||
return '/' + tools.getDirectoryByTable(props.table) + '/' + props.row['_id']
|
||||
} else if (props.table === 'mygroups') {
|
||||
return '/grp/' + props.row['groupname']
|
||||
}
|
||||
|
||||
return ''
|
||||
}
|
||||
|
||||
onBeforeMount(mounted)
|
||||
|
||||
@@ -725,7 +716,6 @@ export default defineComponent({
|
||||
myImgGall,
|
||||
noPopupeditByCol,
|
||||
getTitleEditor,
|
||||
getToByCol,
|
||||
t,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,3 +24,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.text_title{
|
||||
color: blue;
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
<q-item v-if="myrec" clickable v-ripple class="shadow-2 q-btn--rounded bg-teal-1">
|
||||
|
||||
<q-item-section v-if="(table === toolsext.TABMYGOODS) && (myrec.photos.length > 0)" avatar
|
||||
<q-item-section v-if="(shared_consts.TABLES_VISU_IMG.includes(table)) && (myrec.photos.length > 0)" avatar
|
||||
@click="cmdExt(costanti.CMD_SHOW_PAGE, myrec)">
|
||||
<q-avatar size="60px">
|
||||
<q-img :src="tools.getFullFileName(myrec.photos, table, myrec.username)" :alt="myrec.descr"
|
||||
<q-img :src="tools.getFullFileName(myrec.photos, table, myrec.username, '')" :alt="myrec.descr"
|
||||
img-class="imgprofile" height="60px"/>
|
||||
</q-avatar>
|
||||
</q-item-section>
|
||||
|
||||
30
src/components/CMyRecGrpCard/CMyRecGrpCard.scss
Executable file
30
src/components/CMyRecGrpCard/CMyRecGrpCard.scss
Executable file
@@ -0,0 +1,30 @@
|
||||
.myflex{
|
||||
display: flex;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.text_user_city{
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
font-size: 0.85rem;
|
||||
color: grey;
|
||||
}
|
||||
|
||||
|
||||
.actualdate{
|
||||
|
||||
}
|
||||
|
||||
|
||||
.cardrec{
|
||||
@media (min-width: 500px) {
|
||||
margin: 1px;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.text_title{
|
||||
color: blue;
|
||||
}
|
||||
95
src/components/CMyRecGrpCard/CMyRecGrpCard.ts
Executable file
95
src/components/CMyRecGrpCard/CMyRecGrpCard.ts
Executable file
@@ -0,0 +1,95 @@
|
||||
import { defineComponent, onMounted, PropType, ref, watch } from 'vue'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { IImgGallery, IUserFields, IUserProfile } from 'model'
|
||||
import { costanti } from '@costanti'
|
||||
import { shared_consts } from '@/common/shared_vuejs'
|
||||
import { fieldsTable } from '@store/Modules/fieldsTable'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
import { CMyCardPopup } from '@/components/CMyCardPopup'
|
||||
// import { useRouter } from 'vue-router'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CMyRecGrpCard',
|
||||
components: { CMyCardPopup },
|
||||
emits: ['setCmd', 'cmdext'],
|
||||
props: {
|
||||
table: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
prop_myrec: {
|
||||
type: Object as PropType<any | null>,
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
|
||||
const userStore = useUserStore()
|
||||
// const $q = useQuasar()
|
||||
const { t } = useI18n()
|
||||
// const $router = useRouter()
|
||||
|
||||
const myrec = ref(<any | null>null)
|
||||
|
||||
const visupage = ref(false)
|
||||
|
||||
watch(() => props.prop_myrec, (newval, oldval) => {
|
||||
|
||||
mounted()
|
||||
})
|
||||
|
||||
function mounted() {
|
||||
if (props.prop_myrec) {
|
||||
myrec.value = props.prop_myrec
|
||||
}
|
||||
}
|
||||
|
||||
function showBadge() {
|
||||
if (shared_consts.TABLES_SHOW_ADTYPE.includes(props.table)) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
function getImgUser(profile: IUserFields) {
|
||||
return userStore.getImgByProfile(profile)
|
||||
}
|
||||
|
||||
/*function naviga(path: string) {
|
||||
$router.push(path)
|
||||
}*/
|
||||
|
||||
function setCmd($q: any, cmd: number, myusername: string, value: any, groupname: string) {
|
||||
emit('setCmd', $q, cmd, myusername, value, groupname)
|
||||
}
|
||||
|
||||
function cmdExt(cmd: any, val1: any, val2: any) {
|
||||
emit('cmdext', cmd, val1, val2)
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
t,
|
||||
myrec,
|
||||
costanti,
|
||||
getImgUser,
|
||||
// naviga,
|
||||
setCmd,
|
||||
shared_consts,
|
||||
userStore,
|
||||
tools,
|
||||
toolsext,
|
||||
fieldsTable,
|
||||
cmdExt,
|
||||
visupage,
|
||||
showBadge,
|
||||
}
|
||||
},
|
||||
})
|
||||
81
src/components/CMyRecGrpCard/CMyRecGrpCard.vue
Executable file
81
src/components/CMyRecGrpCard/CMyRecGrpCard.vue
Executable file
@@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<div class="q-py-xs centermydiv cardrec" :style="`max-width: `+ (tools.getwidth($q) - 20) +`px; ` + ($q.screen.lt.sm ? (`min-width: `+ (tools.getwidth($q) - 20) +`px;`) : ``)">
|
||||
|
||||
<q-item v-if="myrec" clickable v-ripple class="shadow-2 q-btn--rounded bg-teal-1">
|
||||
|
||||
<q-item-section v-if="(shared_consts.TABLES_VISU_IMG.includes(table)) && (myrec.photos && myrec.photos.length > 0)" avatar
|
||||
@click="cmdExt(costanti.CMD_SHOW_PAGE, myrec)">
|
||||
<q-avatar size="60px">
|
||||
<q-img :src="tools.getFullFileName(myrec.photos, table, myrec.username, myrec.groupname)" :alt="myrec.descr"
|
||||
img-class="imgprofile" height="60px"/>
|
||||
</q-avatar>
|
||||
</q-item-section>
|
||||
<q-item-section v-else avatar @click="naviga(`/my/` + myrec.username)">
|
||||
<q-badge v-if="showBadge" class="q-my-xs self-center" :color="fieldsTable.getColByAdType(myrec.adType)">
|
||||
{{ fieldsTable.getValByTabAndId(table, 'adType', myrec.adType) }}
|
||||
<q-icon :name="fieldsTable.getIconByAdType(myrec.adType)" color="white"
|
||||
class="q-ml-xs"/>
|
||||
</q-badge>
|
||||
<q-avatar size="60px">
|
||||
<q-img :src="getImgUser(myrec)" :alt="myrec.username" img-class="imgprofile" height="60px"/>
|
||||
</q-avatar>
|
||||
</q-item-section>
|
||||
|
||||
<q-item-section @click="cmdExt(costanti.CMD_SHOW_PAGE, myrec)">
|
||||
<q-item-label class="full-width">
|
||||
<span v-for="(rec, ind) of myrec.recCatGrp" :key="ind"> <q-chip
|
||||
dense
|
||||
class="text-center shadow-5 glossy bg-blue chipmodif">{{ rec.descr }}</q-chip></span>
|
||||
|
||||
<!--<span class="dateevent" v-if="myrec.dateTimeStart">dal <span class="datainizio">{{tools.getstrVeryShortDate(myrec.dateStart) }}</span> al <span class="datafine">{{ tools.getstrVeryShortDate(myrec.dateEnd) }}</span>
|
||||
</span>-->
|
||||
</q-item-label>
|
||||
<q-item-label v-if="myrec.title" lines="1" class="text_title">
|
||||
<span class="text-weight-bold">{{ myrec.title }}</span>
|
||||
</q-item-label>
|
||||
<q-item-label lines="3" v-if="myrec.descr">{{ myrec.descr }}<br>
|
||||
</q-item-label>
|
||||
<q-item-label lines="1" style="text-align: right" class="text_user_city">
|
||||
<span class="text-weight-bold">{{ myrec.username }}</span> -
|
||||
<span v-for="(rec, ind) of myrec.mycities" :key="ind"><span v-if="ind > 0">, </span>{{ rec.comune }}</span>
|
||||
</q-item-label>
|
||||
|
||||
</q-item-section>
|
||||
<q-item-section side v-if="tools.canModifyThisRec(myrec, table)">
|
||||
<q-item-label>
|
||||
<q-btn rounded icon="fas fa-pencil-alt">
|
||||
<q-menu>
|
||||
<q-list style="min-width: 150px">
|
||||
<q-item clickable v-close-popup
|
||||
@click="cmdExt(costanti.CMD_MODIFY, myrec._id)">
|
||||
<q-item-section side>
|
||||
<q-icon name="fas fa-pencil-alt"/>
|
||||
</q-item-section>
|
||||
<q-item-section>{{ $t('reg.edit') }}</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
<q-list style="min-width: 150px">
|
||||
<q-item clickable v-close-popup @click="cmdExt(costanti.CMD_DELETE, myrec._id)">
|
||||
<q-item-section side>
|
||||
<q-icon name="fas fa-trash-alt"/>
|
||||
</q-item-section>
|
||||
<q-item-section>{{ $t('reg.elimina') }}</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
|
||||
</q-item>
|
||||
<q-separator inset="item"/>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CMyRecGrpCard.ts">
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './CMyRecGrpCard.scss';
|
||||
</style>
|
||||
1
src/components/CMyRecGrpCard/index.ts
Executable file
1
src/components/CMyRecGrpCard/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export { default as CMyRecGrpCard } from './CMyRecGrpCard.vue'
|
||||
@@ -45,4 +45,5 @@ export * from './CMainView'
|
||||
export * from './CLabel'
|
||||
export * from './CBigBtn'
|
||||
export * from './CMyRecCard'
|
||||
export * from './CMyRecGrpCard'
|
||||
// export * from './CPreloadImages'
|
||||
|
||||
@@ -98,6 +98,7 @@ export const costanti = {
|
||||
VISUTABLE_LISTA: 2,
|
||||
VISUTABLE_SCHEDA_USER: -1,
|
||||
VISUTABLE_SCHEDA_GROUP: -3,
|
||||
VISUTABLE_USER_TABGROUP: -4,
|
||||
|
||||
DIR_UPLOAD: 'upload/', // upload/
|
||||
|
||||
|
||||
@@ -522,7 +522,20 @@ export const colmyUserGroup = [
|
||||
allowchar: costanti.ALLOWCHAR_CODE,
|
||||
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit,
|
||||
}),
|
||||
AddCol({ name: 'title', label_trans: 'reg.name', required: true, noshowlabel: true, }),
|
||||
AddCol({ name: 'title', label_trans: 'reg.name', required: true, noshowlabel: true, maxlength: 40 }),
|
||||
AddCol({
|
||||
name: 'idCity',
|
||||
label_trans: 'skill.city',
|
||||
fieldtype: costanti.FieldType.multiselect_by_server,
|
||||
jointable: 'cities',
|
||||
tablesel: 'cities',
|
||||
noshowlabel: true,
|
||||
icon: 'fas fa-map-marker-alt',
|
||||
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView,
|
||||
remote_table: 'mycities',
|
||||
remote_key: '_id',
|
||||
remote_field: 'comune',
|
||||
}),
|
||||
AddCol({
|
||||
name: 'idCatGrp',
|
||||
label_trans: 'catgrps.name',
|
||||
@@ -537,7 +550,7 @@ export const colmyUserGroup = [
|
||||
{
|
||||
name: 'descr', label_trans: 'proj.longdescr', required: true,
|
||||
noshowlabel: true,
|
||||
maxlength: 40
|
||||
maxlength: 100
|
||||
}
|
||||
),
|
||||
AddCol({
|
||||
@@ -571,25 +584,6 @@ export const colmyUserGroup = [
|
||||
jointable: '',
|
||||
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView,
|
||||
}),
|
||||
AddCol({
|
||||
name: 'idCity',
|
||||
label_trans: 'skill.city',
|
||||
fieldtype: costanti.FieldType.multiselect_by_server,
|
||||
jointable: 'cities',
|
||||
tablesel: 'cities',
|
||||
noshowlabel: true,
|
||||
icon: 'fas fa-map-marker-alt',
|
||||
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView,
|
||||
remote_table: 'mycities',
|
||||
remote_key: '_id',
|
||||
remote_field: 'comune',
|
||||
}),
|
||||
AddCol({
|
||||
name: 'date_created', label_trans: 'reg.date_created', fieldtype: costanti.FieldType.onlydate,
|
||||
showWhen: costanti.showWhen.InPage + costanti.showWhen.InView_OnlyifExist,
|
||||
visible: false,
|
||||
required: false,
|
||||
}),
|
||||
AddCol({
|
||||
name: 'note', label_trans: 'proj.longdescr', fieldtype: costanti.FieldType.html,
|
||||
titlepopupedit: 'Dettagli', field_extra1: 'groupname', subfield_extra1: ''
|
||||
|
||||
@@ -5028,13 +5028,56 @@ export const tools = {
|
||||
return ''
|
||||
},
|
||||
|
||||
getFullFileName(arrimage: IImgGallery[], table: string, username: string) {
|
||||
if (arrimage && arrimage.length > 0) {
|
||||
return 'upload/profile/' + username + '/' + table + '/' + arrimage[0].imagefile
|
||||
getFullFileName(arrimage: IImgGallery[], table: string, username: string, groupname: string) {
|
||||
if (shared_consts.TABLES_DIRECTORY_A_PARTE.includes(table)) {
|
||||
return `upload/${table}/` + groupname + '/' + arrimage[0].imagefile
|
||||
} else {
|
||||
return ''
|
||||
if (arrimage && arrimage.length > 0) {
|
||||
return 'upload/profile/' + username + '/' + table + '/' + arrimage[0].imagefile
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
},
|
||||
canModifyThisRec(rec: any, tablesel: string) {
|
||||
// console.log('rec', rec)
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
if (tablesel === toolsext.TABMYGROUPS) {
|
||||
// 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
|
||||
},
|
||||
|
||||
getToByCol(col: IColGridTable, table: string, rec: any) {
|
||||
if (shared_consts.TABLES_REC_ID.includes(table)) {
|
||||
return '/' + tools.getDirectoryByTable(table) + '/' + rec['_id']
|
||||
} else if (table === toolsext.TABMYGROUPS) {
|
||||
return '/grp/' + rec.groupname
|
||||
}
|
||||
|
||||
return ''
|
||||
},
|
||||
|
||||
|
||||
// getLocale() {
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
<q-tabs v-model="tabgrp" class="text-blue">
|
||||
<q-tab label="Info" name="info" icon="fas fa-info"></q-tab>
|
||||
<q-tab v-if="!!mygrp.note && userStore.IsMyGroupByGroupname(mygrp.groupname) || tools.iAmAdminGroup(groupname)" label="Pagina" name="page" icon="fas fa-file-word"></q-tab>
|
||||
<q-tab v-if="!!mygrp.note" label="Pagina" name="page" icon="fas fa-file-word"></q-tab>
|
||||
<q-tab v-if="userStore.IsMyGroupByGroupname(mygrp.groupname) || tools.iAmAdminGroup(groupname)" label="Iscritti" name="membri" icon="fas fa-users"></q-tab>
|
||||
<q-tab v-if="tools.iAmAdminGroup(groupname)" label="Richieste" name="rich" icon="fas fa-user-plus"></q-tab>
|
||||
</q-tabs>
|
||||
@@ -50,8 +50,8 @@
|
||||
:columns="colmyUserGroup"
|
||||
:rec="mygrp"
|
||||
field="visibility"
|
||||
:canEdit="true"
|
||||
:canModify="true">
|
||||
:canEdit="false"
|
||||
:canModify="false">
|
||||
</CMyFieldRec>
|
||||
</q-card>
|
||||
<q-card>
|
||||
@@ -157,8 +157,8 @@
|
||||
prop_mytitle=""
|
||||
:prop_mycolumns="colmyUserPeople"
|
||||
prop_colkey="_id"
|
||||
col_title="username"
|
||||
:vertical="costanti.VISUTABLE_LISTA"
|
||||
col_title=""
|
||||
:vertical="costanti.VISUTABLE_USER_TABGROUP"
|
||||
nodataLabel="Nessuna Richiesta in sospeso"
|
||||
:prop_search="false"
|
||||
hint="Username da trovare"
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
<template>
|
||||
<div class="">
|
||||
<q-banner
|
||||
rounded
|
||||
dense
|
||||
class="bg-warning text-white"
|
||||
color="primary q-title"
|
||||
style="text-align: center;">
|
||||
<template v-slot:avatar>
|
||||
<q-icon name="fas fa-exclamation-triangle" color="yellow" size="xs" />
|
||||
</template>
|
||||
<span class="mybanner">Questa sezione è ancora in fase di test.</span>
|
||||
|
||||
</q-banner>
|
||||
|
||||
<CMyGroups
|
||||
v-model="filter"
|
||||
:finder="true"
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
</CTitleBanner>
|
||||
-->
|
||||
|
||||
<div v-if="myuser._id">
|
||||
<div v-if="myuser._id && (userStore.IsMyFriendByUsername(myuser.username) || isMyRecord(myuser.username))">
|
||||
<CTitleBanner
|
||||
class="" :title="$t('dashboard.info')" bgcolor="bg-primary" clcolor="text-white"
|
||||
myclass="myshad" :canopen="true">
|
||||
|
||||
Reference in New Issue
Block a user