From a8c7c3e443d37737f4b4267a20d2ca23398ddd05 Mon Sep 17 00:00:00 2001 From: paoloar77 Date: Wed, 10 Aug 2022 17:06:46 +0200 Subject: [PATCH] Group Page : visibility, some info, members views. --- src/common/shared_vuejs.ts | 10 +++- src/components/CFinder/CFinder.ts | 18 ++++++- src/components/CFinder/CFinder.vue | 6 +-- src/components/CMyUser/CMyUser.vue | 5 +- src/css/app.scss | 13 +++++ src/model/UserStore.ts | 2 +- src/statics/lang/it.js | 7 ++- src/store/Modules/costanti.ts | 3 -- src/store/Modules/fieldsTable.ts | 14 +++--- src/store/Modules/tools.ts | 16 +++++++ src/store/UserStore.ts | 4 +- src/views/user/mygroup/mygroup.scss | 3 ++ src/views/user/mygroup/mygroup.ts | 19 ++++++-- src/views/user/mygroup/mygroup.vue | 73 +++++++++++++++++++++-------- 14 files changed, 144 insertions(+), 49 deletions(-) diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index aae4850e..ccc34275 100755 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -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, diff --git a/src/components/CFinder/CFinder.ts b/src/components/CFinder/CFinder.ts index 77ebe962..f52a222c 100755 --- a/src/components/CFinder/CFinder.ts +++ b/src/components/CFinder/CFinder.ts @@ -61,6 +61,7 @@ export default defineComponent({ const col_tabfooter = ref('mycities') const strextra = ref('') + const myoptions = ref([]) const col = ref({}) @@ -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, } }, }) diff --git a/src/components/CFinder/CFinder.vue b/src/components/CFinder/CFinder.vue index d298809b..3c6db653 100755 --- a/src/components/CFinder/CFinder.vue +++ b/src/components/CFinder/CFinder.vue @@ -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" />
diff --git a/src/components/CMyUser/CMyUser.vue b/src/components/CMyUser/CMyUser.vue index 594810c5..015efc39 100755 --- a/src/components/CMyUser/CMyUser.vue +++ b/src/components/CMyUser/CMyUser.vue @@ -7,10 +7,9 @@ - - {{ labelextra }} - {{ contact.username }} ({{ contact.name }} {{ contact.surname }}) + {{ labelextra }} + {{ contact.username }} ({{ contact.name }} {{ contact.surname }}) {{ $t('db.reporteduser', {date_report: tools.getstrDateTimeShort(contact.date_report)}) }} {{ contact.profile.qualifica }} diff --git a/src/css/app.scss b/src/css/app.scss index 155b7ead..039d0087 100755 --- a/src/css/app.scss +++ b/src/css/app.scss @@ -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; + } +} diff --git a/src/model/UserStore.ts b/src/model/UserStore.ts index 8c1f34dc..84f967d8 100755 --- a/src/model/UserStore.ts +++ b/src/model/UserStore.ts @@ -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[] diff --git a/src/statics/lang/it.js b/src/statics/lang/it.js index a603ccc4..59906f9e 100755 --- a/src/statics/lang/it.js +++ b/src/statics/lang/it.js @@ -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' diff --git a/src/store/Modules/costanti.ts b/src/store/Modules/costanti.ts index 393584ea..e2b67a0d 100755 --- a/src/store/Modules/costanti.ts +++ b/src/store/Modules/costanti.ts @@ -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, diff --git a/src/store/Modules/fieldsTable.ts b/src/store/Modules/fieldsTable.ts index 9af52368..366eb70e 100755 --- a/src/store/Modules/fieldsTable.ts +++ b/src/store/Modules/fieldsTable.ts @@ -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', diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts index f9934ed1..d3095e6b 100644 --- a/src/store/Modules/tools.ts +++ b/src/store/Modules/tools.ts @@ -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() diff --git a/src/store/UserStore.ts b/src/store/UserStore.ts index 8ef041ef..5987d627 100755 --- a/src/store/UserStore.ts +++ b/src/store/UserStore.ts @@ -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} }) }, diff --git a/src/views/user/mygroup/mygroup.scss b/src/views/user/mygroup/mygroup.scss index 92680351..1e904097 100755 --- a/src/views/user/mygroup/mygroup.scss +++ b/src/views/user/mygroup/mygroup.scss @@ -24,3 +24,6 @@ } +.title_param{ + font-size: 1.25rem; +} diff --git a/src/views/user/mygroup/mygroup.ts b/src/views/user/mygroup/mygroup.ts index ad37ba01..1d94046a 100755 --- a/src/views/user/mygroup/mygroup.ts +++ b/src/views/user/mygroup/mygroup.ts @@ -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({}) + const mystatus = ref(0) const users_in_group = ref([]) const loading = ref(false) @@ -54,6 +55,8 @@ export default defineComponent({ const filtercustom_rich: any = ref([]) const searchList = ref([]) + const cities = ref([]) + 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, } } }) diff --git a/src/views/user/mygroup/mygroup.vue b/src/views/user/mygroup/mygroup.vue index 75121003..9e223ad6 100755 --- a/src/views/user/mygroup/mygroup.vue +++ b/src/views/user/mygroup/mygroup.vue @@ -2,7 +2,14 @@
-

Gruppo non Esistente

+
+

Non hai i permessi per accedere al Gruppo.
+ + Occorre prima registrarsi alla App

+
+
+

Gruppo non Esistente

+
@@ -22,7 +29,7 @@
{{ mygrp.title }}
-
+
{{ mygrp.groupname }}
@@ -95,7 +102,7 @@ - @@ -104,30 +111,56 @@
- - - - -
Attività:
+
{{ t('groups.info') }}
- +
- {{ $t('groups.createdby', {username: mygrp.createdBy, date: tools.getstrDateLong(mygrp.date_created) }) }} + {{ $t('groups.createdby', { + username: mygrp.createdBy, + date: tools.getstrDateLong(mygrp.date_created), + }) + }}
+ +
+
+ +
+
+
{{ $t('groups.private') }}
+ {{ $t('groups.private_descr') }} +
+
+ +
+
+ +
+
+
{{ $t('groups.hidden') }}
+ {{ $t('groups.hidden_descr') }} +
+
+ +
+
+ +
+
+
+
+ {{ city.comune }} ({{ city.prov }}) +
+
+
+
+
{{ numUsers() }} {{ numUsers() === 1 ? t('groups.member') : t('groups.members') }} @@ -152,7 +185,7 @@
Descrizione:
- +
@@ -197,7 +230,7 @@
- +