- Gruppi (3) - lista degli utenti del gruppo
This commit is contained in:
@@ -16,6 +16,7 @@ export const costanti = {
|
||||
RISERVATO_PASSWORD: 1,
|
||||
NASCOSTO_CERCA: 2,
|
||||
|
||||
VISUTABLE_LISTA: 2,
|
||||
VISUTABLE_SCHEDA_USER: -1,
|
||||
VISUTABLE_SCHEDA_GROUP: -3,
|
||||
|
||||
@@ -36,10 +37,15 @@ export const costanti = {
|
||||
FIND_GROUP: 20,
|
||||
MY_GROUPS: 21,
|
||||
CREATE_GROUP: 30,
|
||||
MANAGE_GROUPS: 31,
|
||||
|
||||
REQ_ADD_USER_TO_GROUP: 40,
|
||||
REQ_REMOVE_USER_TO_GROUP: 41,
|
||||
|
||||
FILTER_TUTTI: -100,
|
||||
TABLES_ARRAY: ['mygroups'],
|
||||
TABLES_USERNAME_DATE: ['friends', 'friendsandme'],
|
||||
TABLES_IMG_USERNAME: ['friends', 'friendsandme'],
|
||||
|
||||
FuncDialog: {
|
||||
CANCEL_BOOKING: 1,
|
||||
|
||||
@@ -446,7 +446,7 @@ export const colmyUserPeople = [
|
||||
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 + costanti.showWhen.InView_OnlyifExist,
|
||||
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit,
|
||||
}),
|
||||
// AddCol({ name: 'sospeso', label_trans: 'reg.sospeso', fieldtype: costanti.FieldType.boolean }),
|
||||
// AddCol({ name: 'deleted', label_trans: 'reg.deleted', fieldtype: costanti.FieldType.boolean }),
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
ITodo,
|
||||
IUserFields,
|
||||
Privacy,
|
||||
TipoVisu,
|
||||
TipoVisu, IGroup,
|
||||
} from '@model'
|
||||
|
||||
import { lists } from '@store/Modules/lists'
|
||||
@@ -4437,12 +4437,37 @@ export const tools = {
|
||||
userStore.setGroupsCmd($q, t, username, groupnameDest, shared_consts.GROUPSCMD.SETGROUP, null)
|
||||
.then((res: any) => {
|
||||
if (res) {
|
||||
userStore.my.profile.mygroups = [...userStore.my.profile.mygroups, res]
|
||||
if (userStore.my.profile.mygroups)
|
||||
userStore.my.profile.mygroups = [...userStore.my.profile.mygroups, res]
|
||||
else
|
||||
userStore.my.profile.mygroups = [res]
|
||||
tools.showPositiveNotif($q, t('db.addedgroup'))
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
removeFromMyGroups($q: any, username: string, groupnameDest: string) {
|
||||
const userStore = useUserStore()
|
||||
|
||||
$q.dialog({
|
||||
message: t('db.domanda_removegroup', { username }),
|
||||
ok: { label: t('dialog.yes'), push: true },
|
||||
cancel: { label: t('dialog.cancel') },
|
||||
title: t('db.domanda')
|
||||
}).onOk(() => {
|
||||
|
||||
userStore.setGroupsCmd($q, t, username, groupnameDest, shared_consts.GROUPSCMD.REMOVE_FROM_MYGROUP, null).then((res) => {
|
||||
if (res) {
|
||||
if (userStore.my.profile.mygroups) {
|
||||
userStore.my.profile.mygroups = userStore.my.profile.mygroups.filter((rec: IMyGroup) => rec.groupname !== groupnameDest)
|
||||
tools.showPositiveNotif($q, t('db.removedgroup'))
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
setRequestFriendship($q: any, username: string, usernameDest: string, value: boolean) {
|
||||
|
||||
const userStore = useUserStore()
|
||||
@@ -4544,10 +4569,10 @@ export const tools = {
|
||||
})
|
||||
})
|
||||
},
|
||||
cancelReqGroups($q: any, username: string, groupnameDest: string) {
|
||||
cancelReqGroups($q: any, username: string, groupnameDest: string) {
|
||||
const userStore = useUserStore()
|
||||
$q.dialog({
|
||||
message: t('db.domanda_cancel_req_group', { groupname: groupnameDest }),
|
||||
message: t('db.domanda_cancel_req_group', { username, groupname: groupnameDest }),
|
||||
ok: { label: t('dialog.yes'), push: true },
|
||||
cancel: { label: t('dialog.cancel') },
|
||||
title: t('db.domanda')
|
||||
@@ -4695,6 +4720,29 @@ export const tools = {
|
||||
// (!visulabel && !col.showOnlyNewRec && !col.noShowView)
|
||||
},
|
||||
|
||||
iAmAdminGroup(groupname: string) {
|
||||
const userStore = useUserStore()
|
||||
|
||||
let risultato = false
|
||||
|
||||
if (userStore.my.profile.manage_mygroups) {
|
||||
const ris = userStore.my.profile.manage_mygroups.find((grp: IMyGroup) => {
|
||||
if (grp.groupname === groupname) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
// console.log('ris', ris)
|
||||
if (ris && ris.admins) {
|
||||
const isadmin = ris.admins.find((user: IFriends) => user.username === userStore.my.username)
|
||||
risultato = !!isadmin
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return risultato
|
||||
|
||||
},
|
||||
|
||||
// getLocale() {
|
||||
// if (navigator.languages && navigator.languages.length > 0) {
|
||||
// return navigator.languages[0]
|
||||
|
||||
Reference in New Issue
Block a user