This commit is contained in:
paoloar77
2022-02-03 00:33:05 +01:00
parent d7480fd489
commit 124cb5cc64
96 changed files with 1944 additions and 2611 deletions

View File

@@ -68,7 +68,7 @@ export default defineComponent({
// @ts-ignore
let myarr: any = props.imgGall
gallerylist.value = []
if (myarr) {
if (Array.isArray(myarr)) {
myarr.forEach((pic: any) => {
if (pic.imagefile) {
gallerylist.value.push(pic)

View File

@@ -18,6 +18,7 @@ import { lists } from '@store/Modules/lists'
import { IParamsQuery } from 'model'
import { CMyPopupEdit } from '../CMyPopupEdit'
import { CMyFriends } from '../CMyFriends'
import { CMyGroups } from '../CMyGroups'
import { CMyFieldDb } from '../CMyFieldDb'
import { CMySelect } from '../CMySelect'
import { CTitleBanner } from '../CTitleBanner'
@@ -27,6 +28,7 @@ import { useGlobalStore } from '@store/globalStore'
import { useQuasar } from 'quasar'
import { costanti } from '@costanti'
import translate from '@/globalroutines/util'
import { toolsext } from '@store/Modules/toolsext'
export default defineComponent({
name: 'CGridTableRec',
@@ -179,7 +181,7 @@ export default defineComponent({
default: false
}
},
components: { CMyPopupEdit, CTitleBanner, CMyFieldDb, CMySelect, CMyFriends },
components: { CMyPopupEdit, CTitleBanner, CMyFieldDb, CMySelect, CMyFriends, CMyGroups },
setup(props, { emit }) {
const $q = useQuasar()
const { t } = useI18n()
@@ -234,6 +236,7 @@ export default defineComponent({
const selected: any = ref([])
const filter = ref(0)
const filtergrp = ref(costanti.MY_GROUPS)
const mycodeid = toRef(props, 'prop_codeId')
@@ -1320,6 +1323,7 @@ export default defineComponent({
myfilterand,
tools,
costanti,
toolsext,
fieldsTable,
globalStore,
searchList,
@@ -1329,6 +1333,7 @@ export default defineComponent({
valoriopt,
labelcombo,
filter,
filtergrp,
myvertical,
showColCheck,
getValueExtra,

View File

@@ -35,7 +35,7 @@
<q-spinner-tail size="2em" color="primary"/>
</q-inner-loading>
<q-table
:grid="myvertical === -1 || myvertical === 2"
:grid="myvertical === costanti.VISUTABLE_SCHEDA_USER || myvertical === 2 || myvertical === costanti.VISUTABLE_SCHEDA_GROUP"
flat
bordered
class="my-sticky-header-table"
@@ -89,11 +89,11 @@
<div class="row">
<q-toggle
v-for="(filter, index) of arrfilters"
v-for="(filt, index) of arrfilters"
:key="index"
v-model="myfilterand" :disable="filter.hide"
:val="filter.value"
:label="filter.label">
v-model="myfilterand" :disable="filt.hide"
:val="filt.value"
:label="filt.label">
</q-toggle>
</div>
@@ -244,7 +244,9 @@
<div v-if="choose_visutype" 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"
<q-radio v-if="mytable === toolsext.TABMYGROUPS" v-model="myvertical" :val="costanti.VISUTABLE_SCHEDA_GROUP" label="Scheda"
@update:model-value="tools.setCookie('myv', myvertical) "/>
<q-radio v-else v-model="myvertical" :val="costanti.VISUTABLE_SCHEDA_USER" 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) "/>
@@ -297,7 +299,7 @@
<template v-slot:item="props">
<div v-if="(showType === costanti.SHOW_USERINFO) || (myvertical === 2)" class="fill-all-width">
<div v-if="((showType === costanti.SHOW_USERINFO) && myvertical !== costanti.VISUTABLE_SCHEDA_USER) || ((myvertical === 2) && (tablesel === 'users' || tablesel === 'myskills'))" class="fill-all-width">
<div>
<CMyFriends
v-model="filter"
@@ -307,6 +309,18 @@
/>
</div>
</div>
<div v-else-if="((showType === costanti.SHOW_GROUPINFO) && myvertical !== costanti.VISUTABLE_SCHEDA_GROUP) || ((myvertical === 2) && (tablesel === 'mygroups'))" class="fill-all-width">
<div>
<CMyGroups
v-model="filtergrp"
:finder="false"
:mygrp="props.row"
:visu="costanti.FIND_GROUP"
/>
</div>
</div>
<div
v-else

View File

@@ -114,6 +114,11 @@ export default defineComponent({
return (arr) ? arr.length : 0
})
const numAskSentGroups = computed(() => {
const arr = userStore.my.profile.asked_groups
return (arr) ? arr.length : 0
})
const numAskTrust = computed(() => {
if (!listTrusted.value)
return 0

View File

@@ -0,0 +1,4 @@
.myflex{
display: flex;
flex: 1;
}

View File

@@ -0,0 +1,86 @@
import { defineComponent, onMounted, PropType, ref, watch } from 'vue'
import { useUserStore } from '@store/UserStore'
import { IMyGroup, IImgGallery, IUserFields, IUserProfile } from 'model'
import { costanti } from '@costanti'
import { shared_consts } from '@/common/shared_vuejs'
import { tools } from '@store/Modules/tools'
import { useQuasar } from 'quasar'
import { useI18n } from '@/boot/i18n'
import { useRoute, useRouter } from 'vue-router'
export default defineComponent({
name: 'CMyGroup',
emits: ['setCmd'],
props: {
mygrp: {
type: Object as PropType<IMyGroup | null>,
required: false,
default: null,
},
mygroupname: {
type: String,
required: false,
default: null,
},
visu: {
type: Number,
required: true,
}
},
setup(props, { emit }) {
const userStore = useUserStore()
const $q = useQuasar()
const { t } = useI18n()
const $router = useRouter()
const $route = useRoute()
const groupname = ref('')
const grp = ref(<IMyGroup | null>null)
watch(() => props.mygrp, (newval, oldval) => {
mounted()
})
function mounted() {
if (!props.mygrp) {
if (props.mygroupname) {
groupname.value = props.mygroupname
//++Todo: carica contact
grp.value = null
}
} else {
if (props.mygrp) {
grp.value = props.mygrp
groupname.value = props.mygrp.groupname
}
}
}
function getImgGroup(group: IMyGroup) {
return userStore.getImgByGroup(group)
}
function naviga(path: string) {
$router.push(path)
}
function setCmd(cmd: number, myusername: string, value: any = '') {
emit('setCmd', cmd, myusername, value)
}
onMounted(mounted)
return {
grp,
costanti,
getImgGroup,
naviga,
setCmd,
shared_consts,
userStore,
}
},
})

View File

@@ -0,0 +1,123 @@
<template>
<div v-if="grp">
<q-item class="q-my-sm" clickable>
<q-item-section avatar @click="naviga(`/grp/` + grp.groupname)">
<q-avatar size="60px">
<q-img :src="getImgGroup(grp)" :alt="grp.groupname" img-class="imgprofile" height="60px"/>
</q-avatar>
</q-item-section>
<q-item-section @click="naviga(`/grp/` + grp.groupname)">
<q-item-label><strong>{{ grp.name }} {{ grp.surname }}</strong> ({{ grp.groupname }})
</q-item-label>
<q-item-label v-if="grp.profile" caption lines="1"><em>{{ grp.profile.qualifica }}</em></q-item-label>
</q-item-section>
<q-item-section side v-if="visu === costanti.MY_GROUPS">
<q-item-label>
<q-btn rounded icon="fas fa-ellipsis-h">
<q-menu>
<q-list style="min-width: 150px">
<q-item clickable icon="fas fa-user-minus" v-close-popup
@click="setCmd(shared_consts.GROUPSCMD.REMOVE_FROM_MYGROUP, grp.groupname)">
<q-item-section>{{ $t('groups.remove_from_mygroups') }}</q-item-section>
</q-item>
</q-list>
<q-list style="min-width: 150px">
<q-item clickable icon="fas fa-ban" v-close-popup @click="setCmd(shared_consts.GROUPSCMD.BLOCK_GROUP, grp.groupname)">
<q-item-section>{{ $t('groups.block_group') }}</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
</q-item-label>
</q-item-section>
<q-item-section side v-if="visu === costanti.REQ_GROUP">
<q-item-label>
<q-btn rounded icon="fas fa-ellipsis-h">
<q-menu>
<q-list v-if="true" style="min-width: 150px">
<q-item clickable v-close-popup @click="setCmd(shared_consts.GROUPSCMD.SETGROUP, grp.groupname)">
<q-item-section>{{ $t('groups.accept_group') }}</q-item-section>
</q-item>
</q-list>
<q-list style="min-width: 150px">
<q-item clickable icon="fas fa-user-minus" v-close-popup
@click="setCmd(shared_consts.GROUPSCMD.REQGROUP, grp.groupname, false)">
<q-item-section>{{ $t('groups.reject_ask_group') }}</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
</q-item-label>
</q-item-section>
<q-item-section side v-if="visu === costanti.ASK_SENT_GROUPS">
<q-item-label>
<q-btn rounded icon="fas fa-ellipsis-h">
<q-menu>
<q-list style="min-width: 150px">
<q-item clickable icon="fas fa-user-minus" v-close-popup
@click="setCmd(shared_consts.GROUPSCMD.CANCEL_REQ_GROUP, grp.groupname)">
<q-item-section>{{ $t('groups.cancel_ask_group') }}</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
</q-item-label>
</q-item-section>
<q-item-section side v-if="visu === costanti.FIND_GROUP">
<q-item-label>
<q-btn v-if="grp.admins && grp.admins.includes(userStore.my.username)" rounded :icon="userStore.IsMyGroupByGroupname(grp.groupname) ? `fas fa-ellipsis-h` : `fas fa-user`">
<q-menu>
<q-list v-if="(!userStore.IsMyGroupByGroupname(grp.groupname) && !userStore.IsAskedGroupByGroupname(grp.groupname))" style="min-width: 200px">
<q-item clickable v-close-popup @click="setCmd(shared_consts.GROUPSCMD.REQGROUP, grp.groupname, true)">
<q-item-section>{{ $t('groups.ask_group') }}</q-item-section>
</q-item>
</q-list>
<q-list v-else-if="(!userStore.IsMyGroupByGroupname(grp.groupname) && userStore.IsAskedGroupByUsername(grp.groupname))" style="min-width: 200px">
<q-item clickable v-close-popup @click="setCmd(shared_consts.GROUPSCMD.REQGROUP, grp.groupname, false)">
<q-item-section>{{ $t('groups.cancel_ask_group') }}</q-item-section>
</q-item>
</q-list>
<q-list v-else-if="userStore.IsMyGroupByGroupname(grp.groupname)" style="min-width: 200px">
<q-item clickable v-close-popup @click="setCmd(shared_consts.GROUPSCMD.REMOVE_FROM_MYGROUPS, grp.groupname)">
<q-item-section>{{ $t('groups.remove_from_mygroups') }}</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
</q-item-label>
</q-item-section>
<q-item-section side v-if="visu === costanti.FIND_GROUP">
<q-item-label>
<q-btn v-if="grp.admins && grp.admins.includes(userStore.my.username)" rounded :icon="userStore.IsMyGroupByGroupname(grp.groupname) ? `fas fa-ellipsis-h` : `fas fa-user`">
<q-menu>
<q-list v-if="(!userStore.IsMyGroupByGroupname(grp.groupname) && !userStore.IsAskedGroupByGroupname(grp.groupname))" style="min-width: 200px">
<q-item clickable v-close-popup @click="setCmd(shared_consts.GROUPSCMD.REQGROUP, grp.groupname, true)">
<q-item-section>{{ $t('groups.ask_group') }}</q-item-section>
</q-item>
</q-list>
<q-list v-else-if="(!userStore.IsMyGroupByGroupname(grp.groupname) && userStore.IsAskedGroupByUsername(grp.groupname))" style="min-width: 200px">
<q-item clickable v-close-popup @click="setCmd(shared_consts.GROUPSCMD.REQGROUP, grp.groupname, false)">
<q-item-section>{{ $t('groups.cancel_ask_group') }}</q-item-section>
</q-item>
</q-list>
<q-list v-else-if="userStore.IsMyGroupByGroupname(grp.groupname)" style="min-width: 200px">
<q-item clickable v-close-popup @click="setCmd(shared_consts.GROUPSCMD.REMOVE_FROM_MYGROUPS, grp.groupname)">
<q-item-section>{{ $t('groups.remove_from_mygroups') }}</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
</q-item-label>
</q-item-section>
</q-item>
</div>
</template>
<script lang="ts" src="./CMyGroup.ts">
</script>
<style lang="scss" scoped>
@import './CMyGroup.scss';
</style>

View File

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

View File

View File

@@ -0,0 +1,180 @@
import { CMyGroup } from '@/components/CMyGroup'
import { computed, defineComponent, onMounted, PropType, ref, toRef } from 'vue'
import { useUserStore } from '@store/UserStore'
import { useI18n } from '@/boot/i18n'
import { useQuasar } from 'quasar'
import { costanti } from '@costanti'
import { IMyGroup, ISearchList, IUserFields } from 'model'
import { shared_consts } from '@/common/shared_vuejs'
import { tools } from '@store/Modules/tools'
export default defineComponent({
name: 'CMyGroups',
components: { CMyGroup },
emits: ['update:modelValue'],
props: {
modelValue: {
type: Number,
required: false,
default: 0,
},
finder: {
type: Boolean,
required: true,
},
mygrp: {
type: Object as PropType<IMyGroup | null>,
required: false,
default: null,
},
mygroupname: {
type: String,
required: false,
default: null,
},
visu: {
type: Number,
required: false,
default: 0,
},
},
setup(props, { emit }) {
const userStore = useUserStore()
const $q = useQuasar()
const { t } = useI18n()
const username = ref('')
const filtroutente = ref(<any[]>[])
const listgroupsfiltered = computed(() => {
let arr: any[] = []
try {
if (props.modelValue === costanti.GROUPS) {
arr = userStore.my.profile.groups
} else if (props.modelValue === costanti.MY_GROUPS) {
arr = userStore.my.profile.groups
// } else if (props.modelValue === costanti.REQ_GROUP) {
// arr = userStore.my.profile.req_groups
} else if (props.modelValue === costanti.ASK_SENT_GROUP) {
arr = userStore.my.profile.asked_groups
}
} catch (e) {
arr = []
}
return arr
})
const myoptions = computed(() => {
const mybutt = []
mybutt.push({ label: t('mypages.find_group'), value: costanti.FIND_GROUP })
mybutt.push({ label: t('mypages.my_groups') + ' (' + numGroups.value + ')', value: costanti.MY_GROUPS })
if (numAskSentGroups.value > 0 || props.modelValue === costanti.ASK_SENT_GROUP)
mybutt.push({
label: t('mypages.request_sent_groups') + ' (' + numAskSentGroups.value + ')',
value: costanti.ASK_SENT_GROUP
})
return mybutt
})
const numGroups = computed(() => {
const arr = userStore.my.profile.groups
return (arr) ? arr.length : 0
})
const numAskSentGroups = computed(() => {
const arr = userStore.my.profile.asked_groups
return (arr) ? arr.length : 0
})
function loadGroups() {
// Carica il profilo di quest'utente
if (username.value) {
userStore.loadGroups(username.value).then((ris) => {
// console.log('ris', ris)
if (ris) {
userStore.my.profile.groups = ris.listUsersGroup ? ris.listUsersGroup : []
userStore.groups = ris.listgroups ? ris.listgroups : []
userStore.my.profile.asked_groups = ris.listSentRequestGroups ? ris.listSentRequestGroups : []
filtroutente.value = [{ userId: userStore.my._id }]
}
})
}
}
function removeFromMyGroups(groupnameDest: string) {
$q.dialog({
message: t('db.domanda_removegroup', { username: groupnameDest }),
ok: { label: t('dialog.yes'), push: true },
cancel: { label: t('dialog.cancel') },
title: t('db.domanda')
}).onOk(() => {
userStore.setGroupsCmd($q, t, username.value, groupnameDest, shared_consts.GROUPSCMD.REMOVE_FROM_MYGROUP, null).then((res) => {
if (res) {
userStore.my.profile.groups = userStore.my.profile.groups.filter((rec: IMyGroup) => rec.groupname !== groupnameDest)
tools.showPositiveNotif($q, t('db.removedgroup'))
}
})
})
}
function blockGroup(usernameDest: string) {
$q.dialog({
message: t('db.domanda_blockgroup', { groupname: usernameDest }),
ok: { label: t('dialog.yes'), push: true },
cancel: { label: t('dialog.cancel') },
title: t('db.domanda')
}).onOk(() => {
userStore.setGroupsCmd($q, t, username.value, usernameDest, shared_consts.GROUPSCMD.BLOCK_GROUP, null).then((res) => {
if (res) {
userStore.my.profile.groups = userStore.my.profile.groups.filter((rec: IMyGroup) => rec.groupname !== usernameDest)
tools.showPositiveNotif($q, t('db.blockedgroup'))
}
})
})
}
function setCmd(cmd: number, groupnameDest: string, value: any = '') {
if (cmd === shared_consts.GROUPSCMD.REMOVE_FROM_MYGROUP) {
removeFromMyGroups(groupnameDest)
} else if (cmd === shared_consts.GROUPSCMD.BLOCK_GROUP) {
blockGroup(groupnameDest)
} else if (cmd === shared_consts.GROUPSCMD.SETGROUP) {
tools.addToMyGroups($q, username.value, groupnameDest)
} else if (cmd === shared_consts.GROUPSCMD.REQGROUP) {
tools.setRequestGroup($q, username.value, groupnameDest, value)
} else if (cmd === shared_consts.GROUPSCMD.CANCEL_REQ_GROUP) {
tools.cancelReqGroups($q, username.value, groupnameDest)
}
}
function mounted() {
username.value = userStore.my.username
loadGroups()
}
function updateValue(val: number) {
emit('update:modelValue', val)
}
onMounted(mounted)
return {
tools,
costanti,
shared_consts,
filtroutente,
listgroupsfiltered,
setCmd,
updateValue,
myoptions,
}
}
})

View File

@@ -0,0 +1,53 @@
<template>
<div v-if="finder" class="q-gutter-sm q-pa-sm q-pb-sm">
<q-btn-toggle
:model-value="modelValue"
@update:model-value="updateValue"
class="my-custom-toggle"
no-caps
rounded
unelevated
push
toggle-color="primary"
color="white"
text-color="primary"
:options="myoptions"
/>
</div>
<div v-if="finder" class="">
<div v-if="modelValue === costanti.FIND_GROUP">
<slot></slot>
</div>
<div v-else>
<q-list>
<span v-for="(grp, index) in listgroupsfiltered" :key="index" class="q-my-sm" clickable>
<CMyGroup
:mygrp="grp"
@setCmd="setCmd"
:visu="modelValue">
</CMyGroup>
</span>
</q-list>
</div>
</div>
<div v-else>
<q-list class="width-container">
<span class="q-my-sm" clickable>
<CMyGroup
:mygrp="mygrp"
@setCmd="setCmd"
:visu="visu">
</CMyGroup>
</span>
</q-list>
</div>
</template>
<script lang="ts" src="./CMyGroups.ts">
</script>
<style lang="scss" scoped>
@import './CMyGroups';
</style>

View File

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

View File

@@ -399,9 +399,6 @@
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.html">
<div v-if="isInModif">
<div v-if="insertMode">
</div>
<p v-if="isInModif" class="text-center">
{{ $t('event.testo_di_spiegazione') }}:
</p>
@@ -692,7 +689,17 @@
</q-input>
</div>
</q-popup-edit>
<div v-else-if="col.fieldtype === costanti.FieldType.html">
<div v-if="!isFieldDb()">
<CMyEditor
v-model:value="myvalue" :title="!isInModif ? getTitleEditor(col, row) : ''" @keyup.enter.stop
:showButtons="false"
:canModify="canModify"
@update:value="changevalRec"
@showandsave="Savedb">
</CMyEditor>
</div>
</div> </q-popup-edit>
</div>
</div>
</div>

View File

@@ -37,4 +37,5 @@ export * from './CVerifyEmail'
export * from './CMyUser'
export * from './CVerifyTelegram'
export * from './CMyFriends'
export * from './CMyGroups'
// export * from './CPreloadImages'