Group Page : visibility, some info, members views.

This commit is contained in:
paoloar77
2022-08-10 17:06:46 +02:00
parent 0c25bed597
commit a8c7c3e443
14 changed files with 144 additions and 49 deletions

View File

@@ -131,6 +131,12 @@ export const shared_consts = {
VISIB_ONLY_MANAGER: 2,
VISIB_ONLY_ADMIN: 4,
Visibility_Group: {
PRIVATE: 1,
HIDDEN: 2,
// PASSWORD: 4,
},
BOTTYPE_NONE: 0,
BOTTYPE_PAGE: 1,
BOTTYPE_LINK: 2,
@@ -593,8 +599,8 @@ export const shared_consts = {
VisibilGroup: [
{
value: 1,
label: 'Riservato',
hint: 'Per accedere al gruppo, verrà richiesto la password'
label: 'Privato',
hint: 'Solo i membri possono vedere chi fa parte del gruppo'
},
{
value: 2,

View File

@@ -61,6 +61,7 @@ export default defineComponent({
const col_tabfooter = ref('mycities')
const strextra = ref('')
const myoptions = ref(<any>[])
const col = ref(<IColGridTable>{})
@@ -195,6 +196,20 @@ export default defineComponent({
col_footer.value = obj.col_footer
col_tabfooter.value = obj.col_tabfooter
if (props.table === toolsext.TABMYGROUPS) {
myoptions.value = [
{ label: '🌎 Tutti', value: tools.FILTER_ALL },
{ label: '👤 Gruppi che Gestisci', value: tools.FILTER_MYREC },
// {label: 'Seguo', value: tools.FILTER_MYFOLLOW},
]
} 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) {
const recsectors: any = searchList.value.find((rec) => rec.table === toolsext.TABSECTORS)
@@ -843,7 +858,7 @@ export default defineComponent({
},
{
label: 'Visiblità',
table: 'visibility',
table: 'visibilGroup',
key: 'visibility',
type: costanti.FieldType.multiselect,
value: tools.getCookie(tools.COOK_SEARCH + 'visibility', costanti.FILTER_TUTTI),
@@ -1257,6 +1272,7 @@ export default defineComponent({
visuType,
hint,
strextra,
myoptions,
}
},
})

View File

@@ -9,11 +9,7 @@
push
glossy
toggle-color="primary"
:options="[
{label: '🌎 Tutti', value: tools.FILTER_ALL},
{label: '👤 Personali', value: tools.FILTER_MYREC},
// {label: 'Seguo', value: tools.FILTER_MYFOLLOW},
]"
:options="myoptions"
/>
</div>
<div v-if="false" class="q-mr-sm">

View File

@@ -7,10 +7,9 @@
</q-avatar>
</q-item-section>
<q-item-section @click="naviga(`/my/` + contact.username)">
<q-item-label v-if="labelextra"><strong>{{ labelextra }}</strong></q-item-label>
<q-item-label v-if="contact.name || contact.surname">{{ contact.username }} <span v-if="contact.name">({{ contact.name }} {{ contact.surname }})</span>
<q-item-label v-if="labelextra && (labelextra !== contact.username)"><strong>{{ labelextra }}</strong></q-item-label>
<q-item-label><span class="username">{{ contact.username }}</span> <span v-if="contact.name">({{ contact.name }} {{ contact.surname }})</span>
</q-item-label>
<q-item-label v-if="contact.reported" caption lines="1"><em style="color: red; font-weight: bold">{{ $t('db.reporteduser', {date_report: tools.getstrDateTimeShort(contact.date_report)}) }}</em></q-item-label>
<q-item-label v-if="contact.profile" caption lines="1"><em>{{ contact.profile.qualifica }}</em></q-item-label>

View File

@@ -1052,3 +1052,16 @@ $heightBtn: 100%;
background-position: 50% center !important;
background-repeat: no-repeat !important;
}
.username{
font-weight: bold;
text-shadow: .25 .25rem .5rem $grayshadow;
letter-spacing: 0.025rem;
font-style: italic;
}
.q-card__section{
@media (max-width: 600px) {
padding: 8px !important;
}
}

View File

@@ -19,7 +19,7 @@ export interface IMyGroup {
title?: string
descr?: string
photos: IImgGallery[]
visibility?: number
visibility?: number[]
date_created?: Date
admins?: IFriends[]
req_users?: IFriends[]

View File

@@ -1009,6 +1009,7 @@ const msg_it = {
report_user: 'Segnala Utente',
},
groups: {
info: 'Informazioni su questo gruppo',
member: 'membro',
members: 'membri',
accepted: 'Ingresso Accettato',
@@ -1019,7 +1020,7 @@ const msg_it = {
admin: 'amministratore',
admins: 'Amministratori',
createdby: 'Creato da {username} in data {date}',
subscribes: 'Iscritti',
subscribes: 'Membri',
ask_group: 'Chiedi di entrare nel Gruppo',
exit_group: 'Esci dal Gruppo',
delete_group: 'Elimina il Gruppo',
@@ -1033,6 +1034,10 @@ const msg_it = {
cancel_ask_group_short: 'Annulla richiesta',
refuse_ask_group_short: 'Rifiuta la richiesta',
pwd: 'Password per accedere',
private: 'Privato',
hidden: 'Nascosto',
private_descr: 'Solo i membri possono vedere chi fa parte del gruppo',
hidden_descr: 'il Gruppo non sarà visibile nella ricerca',
},
finder: {
search_skill: 'Cerca una specializzazione'

View File

@@ -164,9 +164,6 @@ export const costanti = {
BINARY_CHECK: 1,
RISERVATO_PASSWORD: 1,
NASCOSTO_CERCA: 2,
VISUTABLE_LISTA: 2,
VISUTABLE_SCHEDA_USER: -1,
VISUTABLE_SCHEDA_GROUP: -3,

View File

@@ -520,13 +520,13 @@ export const colSubSkills = [
export const colmyUserPeople = [
// AddCol({ name: '_id', label_trans: 'reg.id' }),
AddCol({ name: 'username', label_trans: 'reg.username_short' }),
AddCol({ name: 'name', label_trans: 'reg.name' }),
// AddCol({ name: 'name', label_trans: 'reg.name' }),
AddCol({
name: 'profile.img', field: 'profile', subfield: 'img', label_trans: 'reg.img', sortable: false,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit,
}),
AddCol({ name: 'reported', label_trans: 'reg.reported', fieldtype: costanti.FieldType.boolean }),
AddCol({
// AddCol({ name: 'reported', label_trans: 'reg.reported', fieldtype: costanti.FieldType.boolean }),
/* AddCol({
name: 'profile.born_city_id', label_trans: 'reg.born_city', fieldtype: costanti.FieldType.select_by_server,
jointable: 'cities',
tablesel: 'cities',
@@ -535,6 +535,8 @@ export const colmyUserPeople = [
remote_field: 'comune',
noshowlabel: true,
}),
*/
// AddCol({ name: 'sospeso', label_trans: 'reg.sospeso', fieldtype: costanti.FieldType.boolean }),
// AddCol({ name: 'deleted', label_trans: 'reg.deleted', fieldtype: costanti.FieldType.boolean }),
]
@@ -585,11 +587,11 @@ export const colmyUserGroup = [
jointable: 'visibilGroup',
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
}),
AddCol({
/*AddCol({
name: 'pwd', label_trans: 'groups.pwd', fieldtype: costanti.FieldType.crypted,
visibleif: costanti.BINARY_CHECK, visib_field: 'visibility', visib_value: costanti.RISERVATO_PASSWORD,
visibleif: costanti.BINARY_CHECK, visib_field: 'visibility', visib_value: shared_consts.Visibility_Group.PASSWORD,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InEdit,
}),
}),*/
AddCol({
name: 'admins',
label_trans: 'groups.admins',

View File

@@ -5155,6 +5155,22 @@ export const tools = {
},
iAmPartOfThisGroup(grp: IMyGroup) {
const userStore = useUserStore()
return userStore.my.profile.mygroups.findIndex((rec: IMyGroup) => rec.groupname === grp.groupname) >= 0
},
iCanShowGroupsMember(grp: IMyGroup) {
if (grp && grp.visibility!.includes(shared_consts.Visibility_Group.PRIVATE)) {
// Only if I am part of this group
return this.iAmPartOfThisGroup(grp)
}
return true
},
iAmTheCreatorOfTheGroup(groupname: string) {
const userStore = useUserStore()

View File

@@ -1056,9 +1056,9 @@ export const useUserStore = defineStore('UserStore', {
return Api.SendReq('/mygroup/load', 'POST', data)
.then((res) => {
return res.data
return {data: res.data, status: res.status}
}).catch((error) => {
return {}
return {data: null, status: error.status}
})
},

View File

@@ -24,3 +24,6 @@
}
.title_param{
font-size: 1.25rem;
}

View File

@@ -16,7 +16,7 @@ import { useI18n } from '@/boot/i18n'
import { toolsext } from '@store/Modules/toolsext'
import { useQuasar } from 'quasar'
import { costanti } from '@costanti'
import { IFriends, IMyGroup, ISearchList, IUserFields } from 'model'
import { ICity, IFriends, IMyGroup, ISearchList, IUserFields } from 'model'
import { shared_consts } from '@/common/shared_vuejs'
import { colmyUserPeople, colmyUserGroup } from '@store/Modules/fieldsTable'
import { useNotifStore } from '@store/NotifStore'
@@ -42,6 +42,7 @@ export default defineComponent({
const showPic = ref(false)
const mygrp = ref(<IMyGroup|null>{})
const mystatus = ref(<number>0)
const users_in_group = ref(<IFriends[]>[])
const loading = ref(false)
@@ -54,6 +55,8 @@ export default defineComponent({
const filtercustom_rich: any = ref([])
const searchList = ref(<ISearchList[]>[])
const cities = ref(<ICity[]>[])
function profile() {
return userStore.my.profile
}
@@ -65,16 +68,20 @@ export default defineComponent({
async function loadGroup() {
// Carica il profilo di quest'utente
if (groupname.value) {
await userStore.loadGroup(groupname.value, idnotif.value).then((ris) => {
if (ris) {
mygrp.value = ris.mygroup
await userStore.loadGroup(groupname.value, idnotif.value).then(({ data, status }: {data: any, status: number}) => {
console.log('data', data)
if (data) {
mygrp.value = data.mygroup
cities.value = data.cities
notifStore.setAsRead(idnotif.value)
users_in_group.value = ris.users_in_group
users_in_group.value = data.users_in_group
} else {
mygrp.value = null
users_in_group.value = []
}
mystatus.value = status
loading.value = false
// filtroutente.value = [{ userId: userStore.my._id }]
})
@@ -223,6 +230,8 @@ export default defineComponent({
listaAdmins,
users_in_group,
loading,
mystatus,
cities,
}
}
})

View File

@@ -2,8 +2,15 @@
<div class="q-gutter-sm q-pa-sm q-pb-md">
<div v-if="!mygrp && !loading">
<div v-if="mystatus === 403">
<h3>Non hai i permessi per accedere al Gruppo.<br>
Occorre prima registrarsi alla App </h3>
</div>
<div v-else>
<h3>Gruppo non Esistente</h3>
</div>
</div>
<div v-else>
<div v-if="!tools.isLogged()">
@@ -22,7 +29,7 @@
<div class="text-h6">
<span v-if="checkifShow('name')"> {{ mygrp.title }}</span>
</div>
<div class="col-12 text-h7 text-blue text-shadow-2">
<div v-if="mygrp.title !== mygrp.groupname" class="col-12 text-h7 text-blue text-shadow-2">
{{ mygrp.groupname }}
</div>
@@ -95,7 +102,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" label="Pagina" name="page" icon="fas fa-file-word"></q-tab>
<q-tab v-if="userStore.IsMyGroupByGroupname(mygrp.groupname) || tools.iAmAdminGroup(groupname)"
<q-tab v-if="tools.iCanShowGroupsMember(mygrp) || tools.iAmAdminGroup(groupname)"
:label="t('groups.subscribes')" 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-tab v-if="tools.iAmAdminGroup(groupname)" label="Rifiutati" name="refused" icon="fas fa-user-minus"></q-tab>
@@ -104,21 +111,9 @@
<q-tab-panels v-model="tabgrp" animated>
<q-tab-panel name="info">
<div>
<q-card>
<CMyFieldRec
title="Visibilità"
table="mygroups"
:id="mygrp._id"
:columns="colmyUserGroup"
:rec="mygrp"
field="visibility"
:canEdit="false"
:canModify="false">
</CMyFieldRec>
</q-card>
<q-card>
<q-card-section>
<div class="text-h6">Attività:</div>
<div class="text-h6">{{ t('groups.info') }}</div>
</q-card-section>
<q-separator/>
@@ -126,8 +121,46 @@
<q-card-section>
<div class="creator">
<q-icon name="fas fa-lightbulb"></q-icon>
{{ $t('groups.createdby', {username: mygrp.createdBy, date: tools.getstrDateLong(mygrp.date_created) }) }}
{{ $t('groups.createdby', {
username: mygrp.createdBy,
date: tools.getstrDateLong(mygrp.date_created),
})
}}
</div>
<div v-if="mygrp.visibility.includes(shared_consts.Visibility_Group.PRIVATE)" class="row">
<div class="q-pa-xs">
<q-icon name="fas fa-eye"></q-icon>
</div>
<div>
<div class="title_param"> {{ $t('groups.private') }}</div>
{{ $t('groups.private_descr') }}
</div>
</div>
<div v-if="mygrp.visibility.includes(shared_consts.Visibility_Group.HIDDEN)" class="row">
<div class="q-pa-xs">
<q-icon name="fas fa-search"></q-icon>
</div>
<div>
<div class="title_param"> {{ $t('groups.hidden') }}</div>
{{ $t('groups.hidden_descr') }}
</div>
</div>
<div v-if="cities.length > 0" class="row">
<div class="q-pa-xs">
<q-icon name="fas fa-map-marker-alt"></q-icon>
</div>
<div>
<div class="title_param">
<div v-for="(city, index) of cities" :key="index">
{{ city.comune }} ({{ city.prov }})
</div>
</div>
</div>
</div>
<div class="members">
<q-icon name="fas fa-users"></q-icon>
{{ numUsers() }} {{ numUsers() === 1 ? t('groups.member') : t('groups.members') }}
@@ -197,7 +230,7 @@
</div>
</q-tab-panel>
<q-tab-panel name="membri" style="max-width: 400px;">
<q-tab-panel name="membri" style="max-width: 400px;" v-if="tools.iCanShowGroupsMember(mygrp)">
<CGridTableRec
ref="tabMembri"
prop_mytable="users"