@@ -305,7 +304,8 @@
v-model="filter"
:finder="false"
:mycontact="props.row"
- :visu="costanti.FIND_PEOPLE"
+ :visu="visufind"
+ :groupname="extrafield"
/>
diff --git a/src/components/CMyFieldDb/CMyFieldDb.ts b/src/components/CMyFieldDb/CMyFieldDb.ts
index 5a08e837..1f5f3bf1 100755
--- a/src/components/CMyFieldDb/CMyFieldDb.ts
+++ b/src/components/CMyFieldDb/CMyFieldDb.ts
@@ -1,4 +1,4 @@
-import { defineComponent, PropType, ref, watch } from 'vue'
+import { defineComponent, onMounted, PropType, ref, watch } from 'vue'
import { useQuasar } from 'quasar'
import { useI18n } from '@/boot/i18n'
import { useGlobalStore } from '@store/globalStore'
@@ -75,6 +75,18 @@ export default defineComponent({
required: false,
default: '',
},
+ rec: {
+ type: Object,
+ required: false,
+ default: null,
+ },
+ mycol: {
+ type: Object as PropType
,
+ required: false,
+ default: () => {
+ return { name: '' }
+ },
+ },
id: {
type: String,
required: false,
@@ -118,6 +130,17 @@ export default defineComponent({
return col.value.fieldtype !== costanti.FieldType.onlydate && col.value.fieldtype !== costanti.FieldType.date
}
+ function mounted() {
+ if (props.rec) {
+ row.value = props.rec
+ }
+ if (props.mycol.name !== '') {
+ col.value = props.mycol
+ }
+ }
+
+ onMounted(mounted)
+
return {
tools,
costanti,
diff --git a/src/components/CMyFieldRec/CMyFieldRec.scss b/src/components/CMyFieldRec/CMyFieldRec.scss
new file mode 100755
index 00000000..e69de29b
diff --git a/src/components/CMyFieldRec/CMyFieldRec.ts b/src/components/CMyFieldRec/CMyFieldRec.ts
new file mode 100755
index 00000000..318a972e
--- /dev/null
+++ b/src/components/CMyFieldRec/CMyFieldRec.ts
@@ -0,0 +1,185 @@
+import { defineComponent, onMounted, PropType, ref, watch } from 'vue'
+import { useQuasar } from 'quasar'
+import { useI18n } from '@/boot/i18n'
+import { useGlobalStore } from '@store/globalStore'
+import { fieldsTable } from '@store/Modules/fieldsTable'
+import { tools } from '@store/Modules/tools'
+import { costanti } from '@costanti'
+import { CMyPopupEdit } from '@/components/CMyPopupEdit'
+import { IColGridTable } from 'model'
+import MixinBase from '@/mixins/mixin-base'
+
+
+export default defineComponent({
+ name: 'CMyFieldRec',
+ props: {
+ table: {
+ type: String,
+ required: true,
+ },
+ title: {
+ type: String,
+ required: false,
+ default: '',
+ },
+ rec: {
+ type: Object,
+ required: true,
+ },
+ field: {
+ type: String,
+ required: false,
+ default: '',
+ },
+ myimg: {
+ type: String,
+ required: false,
+ default: '',
+ },
+ canModify: {
+ type: Boolean,
+ required: false,
+ default: true,
+ },
+ canEdit: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
+ columns: {
+ type: Object,
+ required: false,
+ default: null,
+ },
+ disable: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
+ id: {
+ type: String,
+ required: false,
+ default: '',
+ },
+ idmain: {
+ type: String,
+ required: false,
+ default: '',
+ },
+ indrec: {
+ type: Number,
+ required: false,
+ default: -1,
+ },
+ },
+ components: { CMyPopupEdit },
+ setup(props, { emit }) {
+ const $q = useQuasar()
+ const { t } = useI18n()
+ const globalStore = useGlobalStore()
+
+ const mytitle = ref('')
+ const col = ref({})
+ const keytab = ref('')
+ const optlab = ref('')
+
+ const pickup = ref(false)
+ const tablesel = ref('')
+ const jointable = ref('')
+ const recordCol = ref({})
+
+ const mykey = ref('')
+ const mysubkey = ref('')
+ const mysubsubkey = ref('')
+
+ const { setValDb, getValDb } = MixinBase()
+
+ function mounted() {
+ mytitle.value = props.title
+ keytab.value = fieldsTable.getKeyByTable(props.table)
+ optlab.value = fieldsTable.getLabelByTable(props.table)
+ // recordCol.value = fieldsTable.getrecTableList(props.table)
+ if (props.columns) {
+ col.value = props.columns.find((col: any) => col.name === props.field)
+ } else {
+ col.value = fieldsTable.getColByTable(props.table, props.field)
+ }
+
+ if (col.value) {
+ jointable.value = col.value.jointable!
+ }
+
+ const arrk = props.field.split('.')
+ if (arrk) {
+ if (arrk.length >= 0)
+ mykey.value = arrk[0]
+ if (arrk.length > 1)
+ mysubkey.value = arrk[1]
+ if (arrk.length > 2)
+ mysubsubkey.value = arrk[2]
+ }
+
+ }
+
+ function showandsel(row: any, col: any, newval: any, valinitial: any) {
+ console.log('showandsel CMyFieldDb', row, col, newval)
+
+ if (newval !== valinitial)
+ setValDb($q, mykey.value, newval, col.value.fieldtype, false, props.table, mysubkey.value, props.id, props.indrec, mysubsubkey.value)
+ }
+
+ function withBorder() {
+ return col.value.fieldtype !== costanti.FieldType.onlydate && col.value.fieldtype !== costanti.FieldType.date
+ }
+
+ function getValue() {
+ let myvalue = ''
+
+ if (mysubkey.value !== '') {
+ if (props.rec[mykey.value] === undefined) {
+ myvalue = ''
+ } else {
+ myvalue = props.rec[mykey.value][mysubkey.value]
+ }
+ } else {
+ if (mykey.value !== '') {
+ myvalue = props.rec[mykey.value]
+ }
+ }
+
+ if (Array.isArray(myvalue)) {
+ if (myvalue.length === 0)
+ return null
+ }
+ return myvalue
+ }
+
+ function visuElem() {
+ return !!col.value.name && (props.canEdit || (!props.canEdit && getValue()))
+ }
+
+ onMounted(mounted)
+
+ return {
+ tools,
+ withBorder,
+ costanti,
+ fieldsTable,
+ globalStore,
+ mytitle,
+ col,
+ keytab,
+ optlab,
+ recordCol,
+ pickup,
+ tablesel,
+ jointable,
+ showandsel,
+ mykey,
+ mysubkey,
+ mysubsubkey,
+ visuElem,
+ }
+ },
+})
+
diff --git a/src/components/CMyFieldRec/CMyFieldRec.vue b/src/components/CMyFieldRec/CMyFieldRec.vue
new file mode 100755
index 00000000..2345bc87
--- /dev/null
+++ b/src/components/CMyFieldRec/CMyFieldRec.vue
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ mytitle }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/CMyFieldRec/index.ts b/src/components/CMyFieldRec/index.ts
new file mode 100755
index 00000000..6f0cbd9d
--- /dev/null
+++ b/src/components/CMyFieldRec/index.ts
@@ -0,0 +1 @@
+export {default as CMyFieldRec} from './CMyFieldRec.vue'
diff --git a/src/components/CMyFriends/CMyFriends.ts b/src/components/CMyFriends/CMyFriends.ts
index 2a4828af..37069b13 100755
--- a/src/components/CMyFriends/CMyFriends.ts
+++ b/src/components/CMyFriends/CMyFriends.ts
@@ -38,6 +38,11 @@ export default defineComponent({
required: false,
default: 0,
},
+ groupname: {
+ type: String,
+ required: false,
+ default: '',
+ }
},
setup(props, { emit }) {
const userStore = useUserStore()
@@ -218,7 +223,7 @@ export default defineComponent({
function refuseReqFriends(usernameDest: string) {
$q.dialog({
- message: t('db.domanda_removefriend', { username: usernameDest }),
+ message: t('db.domanda_revoke_friend', { username: usernameDest }),
ok: { label: t('dialog.yes'), push: true },
cancel: { label: t('dialog.cancel') },
title: t('db.domanda')
diff --git a/src/components/CMyFriends/CMyFriends.vue b/src/components/CMyFriends/CMyFriends.vue
index 28ce735d..4fa06a88 100755
--- a/src/components/CMyFriends/CMyFriends.vue
+++ b/src/components/CMyFriends/CMyFriends.vue
@@ -37,7 +37,8 @@
+ :visu="visu"
+ :groupname="groupname">
diff --git a/src/components/CMyGroup/CMyGroup.vue b/src/components/CMyGroup/CMyGroup.vue
index cc75ae24..6db31eef 100755
--- a/src/components/CMyGroup/CMyGroup.vue
+++ b/src/components/CMyGroup/CMyGroup.vue
@@ -36,11 +36,6 @@
-
-
- {{ $t('groups.accept_group') }}
-
-
@@ -67,37 +62,14 @@
-
+
{{ $t('groups.ask_group') }}
-
-
- {{ $t('groups.cancel_ask_group') }}
-
-
-
-
- {{ $t('groups.remove_from_mygroups') }}
-
-
-
-
-
-
-
-
-
-
-
-
- {{ $t('groups.ask_group') }}
-
-
-
+
{{ $t('groups.cancel_ask_group') }}
diff --git a/src/components/CMyGroups/CMyGroups.ts b/src/components/CMyGroups/CMyGroups.ts
index 1366575b..25a1b1b0 100755
--- a/src/components/CMyGroups/CMyGroups.ts
+++ b/src/components/CMyGroups/CMyGroups.ts
@@ -55,8 +55,8 @@ export default defineComponent({
arr = userStore.my.profile.mygroups
} else if (props.modelValue === costanti.MY_GROUPS) {
arr = userStore.my.profile.mygroups
- // } else if (props.modelValue === costanti.REQ_GROUP) {
- // arr = userStore.my.profile.req_groups
+ } else if (props.modelValue === costanti.MANAGE_GROUPS) {
+ arr = userStore.my.profile.manage_mygroups
} else if (props.modelValue === costanti.ASK_SENT_GROUP) {
arr = userStore.my.profile.asked_groups
}
@@ -70,7 +70,8 @@ export default defineComponent({
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 })
+ mybutt.push({ label: t('mypages.manage_my_groups') + ' (' + numManageGroups.value + ')', value: costanti.MANAGE_GROUPS })
+ mybutt.push({ label: t('mypages.follow_groups') + ' (' + numMyGroups.value + ')', value: costanti.MY_GROUPS })
if (numAskSentGroups.value > 0 || props.modelValue === costanti.ASK_SENT_GROUP)
mybutt.push({
@@ -81,7 +82,12 @@ export default defineComponent({
return mybutt
})
- const numGroups = computed(() => {
+ const numManageGroups = computed(() => {
+ const arr = userStore.my.profile.manage_mygroups
+ return (arr) ? arr.length : 0
+ })
+
+ const numMyGroups = computed(() => {
const arr = userStore.my.profile.mygroups
return (arr) ? arr.length : 0
})
@@ -107,23 +113,6 @@ export default defineComponent({
}
}
- 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.mygroups = userStore.my.profile.mygroups.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 }),
@@ -142,7 +131,7 @@ export default defineComponent({
function setCmd(cmd: number, groupnameDest: string, value: any = '') {
if (cmd === shared_consts.GROUPSCMD.REMOVE_FROM_MYGROUP) {
- removeFromMyGroups(groupnameDest)
+ tools.removeFromMyGroups($q, username.value, groupnameDest)
} else if (cmd === shared_consts.GROUPSCMD.BLOCK_GROUP) {
blockGroup(groupnameDest)
} else if (cmd === shared_consts.GROUPSCMD.SETGROUP) {
diff --git a/src/components/CMyPopupEdit/CMyPopupEdit.ts b/src/components/CMyPopupEdit/CMyPopupEdit.ts
index 4293ab2c..a88d6308 100755
--- a/src/components/CMyPopupEdit/CMyPopupEdit.ts
+++ b/src/components/CMyPopupEdit/CMyPopupEdit.ts
@@ -36,6 +36,11 @@ export default defineComponent({
type: Object,
required: true,
},
+ isrec: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
mycol: {
type: Object as PropType,
required: true,
@@ -191,36 +196,43 @@ export default defineComponent({
function crea() {
// console.log('crea', isFieldDb())
- if (isFieldDb()) {
- // mykey -> field
- // mysubkey -> subfield
- // table -> table
- // serv -> serv
- // id -> id
- // idmain -> idmain
+ if (props.isrec) {
+ col.value = props.mycol
- // console.table(props)
-
- myvalue.value = getValDb(props.field, props.serv, '', props.table, props.subfield, props.id, props.idmain)
- // console.log('myvalue.value', myvalue.value)
- col.value.jointable = props.jointable
- col.value.fieldtype = props.type
- col.value.label = props.title
-
- if (props.type === costanti.FieldType.image) {
- myImgGall.value = [{
- _id: '',
- imagefile: myvalue.value,
- // order: 1,
- alt: 'img',
- }]
- }
-
- // console.log('col', col.value);
} else {
- col.value = {...props.mycol}
+ if (isFieldDb()) {
+ // mykey -> field
+ // mysubkey -> subfield
+ // table -> table
+ // serv -> serv
+ // id -> id
+ // idmain -> idmain
+
+ // console.table(props)
+
+ myvalue.value = getValDb(props.field, props.serv, '', props.table, props.subfield, props.id, props.idmain)
+ // console.log('myvalue.value', myvalue.value)
+ col.value.jointable = props.jointable
+ col.value.fieldtype = props.type
+ col.value.label = props.title
+
+ if (props.type === costanti.FieldType.image) {
+ myImgGall.value = [{
+ _id: '',
+ imagefile: myvalue.value,
+ // order: 1,
+ alt: 'img',
+ }]
+ }
+
+ // console.log('col', col.value);
+ } else {
+ col.value = { ...props.mycol }
+ }
}
+ console.log('col.value', col.value)
+
// console.log('CMyFieldDb crea', myvalue)
}
@@ -307,7 +319,7 @@ export default defineComponent({
try {
// console.log('mounted', 'isFieldDb()', isFieldDb())
- if (isFieldDb()) {
+ if (isFieldDb() && !props.isrec) {
} else {
if (props.subfield !== '') {
diff --git a/src/components/CMyUser/CMyUser.ts b/src/components/CMyUser/CMyUser.ts
index 55cee941..c6fc66d8 100755
--- a/src/components/CMyUser/CMyUser.ts
+++ b/src/components/CMyUser/CMyUser.ts
@@ -25,6 +25,11 @@ export default defineComponent({
visu: {
type: Number,
required: true,
+ },
+ groupname: {
+ type: String,
+ required: false,
+ default: '',
}
},
@@ -82,6 +87,7 @@ export default defineComponent({
setCmd,
shared_consts,
userStore,
+ tools,
}
},
})
diff --git a/src/components/CMyUser/CMyUser.vue b/src/components/CMyUser/CMyUser.vue
index 4671ded5..31c5b0d1 100755
--- a/src/components/CMyUser/CMyUser.vue
+++ b/src/components/CMyUser/CMyUser.vue
@@ -51,6 +51,50 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('groups.accept_group') }}
+
+
+
+
+
+
+
+
+ {{ $t('groups.refuse_ask_group_short') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('groups.remove_from_mygroups') }}
+
+
+
+
+
+
diff --git a/src/components/CSkill/CSkill.vue b/src/components/CSkill/CSkill.vue
index 425ee028..58f5f3ae 100755
--- a/src/components/CSkill/CSkill.vue
+++ b/src/components/CSkill/CSkill.vue
@@ -8,7 +8,7 @@
:prop_mycolumns="colmySkills"
prop_colkey="idSkill"
col_title="subTitle"
- :vertical="true"
+ :vertical="-1"
:choose_visutype="!visuinpage"
:butt_modif_new="!visuinpage"
nodataLabel="Nessuna Competenza inserita"
diff --git a/src/components/index.ts b/src/components/index.ts
index 0005938c..43ece151 100755
--- a/src/components/index.ts
+++ b/src/components/index.ts
@@ -14,6 +14,7 @@ export * from './CImgTitle'
export * from './CMyAvatar'
export * from './CMyCart'
export * from './CMyFieldDb'
+export * from './CMyFieldRec'
export * from './CMyPage'
export * from './CMyTeacher'
export * from './CProfile'
diff --git a/src/model/UserStore.ts b/src/model/UserStore.ts
index 3fef22f1..75de5020 100755
--- a/src/model/UserStore.ts
+++ b/src/model/UserStore.ts
@@ -70,6 +70,7 @@ export interface IUserProfile {
friends: IFriends[]
req_friends: IFriends[]
mygroups: IMyGroup[]
+ manage_mygroups: IMyGroup[]
// in memory
asked_friends: any[]
diff --git a/src/statics/lang/it.js b/src/statics/lang/it.js
index 71e23b60..2cecb95a 100755
--- a/src/statics/lang/it.js
+++ b/src/statics/lang/it.js
@@ -182,6 +182,7 @@ const msg_it = {
recdupfailed: 'Errore durante la duplicazione del Record',
friendsadded: 'Aggiunto alla lista di Amici',
domanda_removefriend: 'Rimuovi dagli Amici {username}?',
+ domanda_removegroup: 'Rimuovere dal Gruppo {username} ?',
removedfriend: 'Rimosso dalla lista di Amici',
removedgroup: 'Rimosso dal Gruppo',
domanda_addtofriend: 'Aggiungere agli amici {username}?',
@@ -199,7 +200,7 @@ const msg_it = {
revoketofriend: 'Revocato la richiesta di Amicizia a {username}',
revoketogroup: 'Revocato la richiesta d\'invito al gruppo {groupname}',
domanda_cancel_req_friend: 'Annullare la richiesta di Amicizia a {username}?',
- domanda_cancel_req_group: 'Annullare la richiesta d\'invito al gruppo {groupname}?',
+ domanda_cancel_req_group: 'Annullare la richiesta d\'invito di {username} al gruppo {groupname}?',
cancel_req_friend: 'Annullata la richiesta di Amicizia a {username}',
cancel_req_group: 'Annullata la richiesta al gruppo {groupname}',
domanda_rejectedtrust: 'Rifiutare la Fiducia a {username}?',
@@ -864,12 +865,14 @@ const msg_it = {
mypages: {
find_people: 'Cerca Persone',
find_group: 'Cerca Gruppo',
- my_groups: 'Miei Gruppi',
+ manage_my_groups: 'Gruppi che Gestisco',
+ follow_groups: 'Gruppi che Seguo',
create_group: 'Crea Gruppo',
friends: 'Amici',
groups: 'Gruppi',
request_friends: 'Rich. Amicizia',
request_sent_friends: 'Rich. Inviate',
+ request_sent_groups: 'Rich. Inviate',
request_trust: 'Rich. Fiducia',
trusted: 'Fiducia Accettata',
rejected: 'Rifiutati',
@@ -889,11 +892,12 @@ const msg_it = {
groups: {
admins: 'Amministratori',
ask_group: 'Chiedi di entrare nel Gruppo',
- accept_group: 'Accetta la richiesta per entrare',
- remove_from_mygroups: 'Rimuovi dai tuoi Gruppi',
+ accept_group: 'Accetta la richiesta',
+ remove_from_mygroups: 'Rimuovi dal Gruppo',
block_group: 'Blocca Gruppo',
cancel_ask_group: 'Annulla la richiesta',
cancel_ask_group_short: 'Annulla richiesta',
+ refuse_ask_group_short: 'Rifiuta la richiesta',
pwd: 'Password per accedere',
}
},
diff --git a/src/store/Modules/costanti.ts b/src/store/Modules/costanti.ts
index 792ae7f1..272b59e4 100755
--- a/src/store/Modules/costanti.ts
+++ b/src/store/Modules/costanti.ts
@@ -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,
diff --git a/src/store/Modules/fieldsTable.ts b/src/store/Modules/fieldsTable.ts
index 35f8bb1a..67e801f6 100755
--- a/src/store/Modules/fieldsTable.ts
+++ b/src/store/Modules/fieldsTable.ts
@@ -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 }),
diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts
index bf41e974..180e8c37 100644
--- a/src/store/Modules/tools.ts
+++ b/src/store/Modules/tools.ts
@@ -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]
diff --git a/src/store/UserStore.ts b/src/store/UserStore.ts
index 0329cc77..5851decd 100755
--- a/src/store/UserStore.ts
+++ b/src/store/UserStore.ts
@@ -51,6 +51,7 @@ export const DefaultUser: IUserFields = {
friends: [],
req_friends: [],
mygroups: [],
+ manage_mygroups: [],
asked_friends: [],
asked_groups: [],
},
@@ -95,6 +96,7 @@ export const DefaultProfile: IUserProfile = {
friends: [],
req_friends: [],
mygroups: [],
+ manage_mygroups: [],
asked_friends: [],
asked_groups: [],
}
@@ -177,7 +179,7 @@ export const useUserStore = defineStore('UserStore', {
},
IsMyGroupByGroupname(groupname: string): boolean {
- if (this.my.profile.friends)
+ if (this.my.profile.mygroups)
return this.my.profile.mygroups.findIndex((rec) => rec.groupname === groupname) >= 0
else
return false
@@ -475,6 +477,7 @@ export const useUserStore = defineStore('UserStore', {
this.my.profile = DefaultProfile
// Memory
+ this.my.profile.manage_mygroups = []
this.my.profile.asked_friends = []
this.my.profile.asked_groups = []
}
@@ -856,7 +859,7 @@ export const useUserStore = defineStore('UserStore', {
verified_by_aportador,
made_gift,
perm,
- profile: { img, teleg_id, myshares: [], friends: [], req_friends: [], asked_friends: [], mygroups: [], asked_groups: [] },
+ profile: { img, teleg_id, myshares: [], friends: [], req_friends: [], asked_friends: [], mygroups: [], asked_groups: [], manage_mygroups: [] },
})
isLogged = true
diff --git a/src/views/user/myfriends/myfriends.vue b/src/views/user/myfriends/myfriends.vue
index 8309ff5c..7e818ac3 100755
--- a/src/views/user/myfriends/myfriends.vue
+++ b/src/views/user/myfriends/myfriends.vue
@@ -10,7 +10,7 @@
:prop_mycolumns="colmyUserPeople"
prop_colkey="_id"
col_title="username"
- :vertical="true"
+ :vertical="-1"
nodataLabel=" "
:prop_search="true"
hint="Username da trovare"
diff --git a/src/views/user/mygroup/mygroup.ts b/src/views/user/mygroup/mygroup.ts
index 9af882f7..1ea4df05 100755
--- a/src/views/user/mygroup/mygroup.ts
+++ b/src/views/user/mygroup/mygroup.ts
@@ -1,6 +1,8 @@
-import { CMyFieldDb } from '@/components/CMyFieldDb'
+import { CGridTableRec } from '@/components/CGridTableRec'
+import { CMyFriends } from '@/components/CMyFriends'
import { CTitleBanner } from '@/components/CTitleBanner'
import { CProfile } from '@/components/CProfile'
+import { CMyFieldRec } from '@/components/CMyFieldRec'
import { CSkill } from '@/components/CSkill'
import { CDateTime } from '@/components/CDateTime'
import { tools } from '@store/Modules/tools'
@@ -12,13 +14,14 @@ import { useI18n } from '@/boot/i18n'
import { toolsext } from '@store/Modules/toolsext'
import { useQuasar } from 'quasar'
import { costanti } from '@costanti'
-import { IMyGroup, IUserFields } from 'model'
+import { IFriends, IMyGroup, ISearchList, IUserFields } from 'model'
import { shared_consts } from '@/common/shared_vuejs'
+import { colmyUserPeople, colmyUserGroup } from '@store/Modules/fieldsTable'
export default defineComponent({
name: 'mygroup',
- components: { CProfile, CTitleBanner, CMyFieldDb, CSkill, CDateTime },
+ components: { CProfile, CTitleBanner, CMyFieldRec, CSkill, CDateTime, CMyFriends, CGridTableRec },
props: {},
setup() {
const userStore = useUserStore()
@@ -33,7 +36,15 @@ export default defineComponent({
const filtroutente = ref([])
const showPic = ref(false)
- const mygrp = ref({})
+ const mygrp = ref({})
+ const users_in_group = ref([])
+
+ const tab = ref('membri')
+
+ const arrfilterand: any = ref([])
+ const filtercustom: any = ref([])
+ const filtercustom_rich: any = ref([])
+ const searchList = ref([])
function profile() {
return userStore.my.profile
@@ -47,7 +58,13 @@ export default defineComponent({
// Carica il profilo di quest'utente
if (groupname.value) {
userStore.loadGroup(groupname.value).then((ris) => {
- mygrp.value = ris
+ if (ris) {
+ mygrp.value = ris.mygroup
+ users_in_group.value = ris.users_in_group
+ } else {
+ mygrp.value = null
+ users_in_group.value = []
+ }
// filtroutente.value = [{ userId: userStore.my._id }]
})
@@ -60,10 +77,19 @@ export default defineComponent({
function mounted() {
loadGroup()
+
+ searchList.value = []
+ filtercustom.value = [{ 'profile.mygroups': { $elemMatch: {groupname: {$eq: groupname.value }} } } ]
+ filtercustom_rich.value = [{ req_users: { $elemMatch: {username: {$eq: userStore.my.username }} } } ]
+ arrfilterand.value = []
+ //++TODO: sistemare la filtercustom ... richieste...
}
function getImgGrp() {
- return userStore.getImgByGroup(mygrp.value)
+ if (mygrp.value)
+ return userStore.getImgByGroup(mygrp.value)
+ else
+ return ''
}
function checkifShow(col: string) {
@@ -73,12 +99,20 @@ export default defineComponent({
function getLinkGrpTelegram() {
- if (!!mygrp.value.link_telegram) {
- return 'https://t.me/' + mygrp.value.link_telegram
+ if (mygrp.value) {
+ if (!!mygrp.value.link_telegram) {
+ return 'https://t.me/' + mygrp.value.link_telegram
+ }
+ } else {
+ return ''
}
+
}
function getLinkWebSite() {
+ if (!mygrp.value) {
+ return ''
+ }
let site = mygrp.value.website!
if (site) {
@@ -89,6 +123,31 @@ export default defineComponent({
return site
}
+ function extraparams() {
+ let lk_tab = 'users'
+ let lk_LF = 'userId'
+ let lk_FF = '_id'
+ let lk_as = 'user'
+ let af_objId_tab = 'myId'
+
+ return {
+ lookup1: {
+ lk_tab,
+ lk_LF,
+ lk_FF,
+ lk_as,
+ af_objId_tab,
+ lk_proj: {
+ username: 1,
+ name: 1,
+ 'profile.img': 1,
+ 'profile.qualifica': 1,
+ }
+ }
+ }
+ }
+
+
onMounted(mounted)
return {
@@ -108,6 +167,15 @@ export default defineComponent({
userStore,
t,
animation,
+ arrfilterand,
+ filtercustom,
+ filtercustom_rich,
+ searchList,
+ colmyUserPeople,
+ colmyUserGroup,
+ extraparams,
+ tab,
+ users_in_group,
}
}
})
diff --git a/src/views/user/mygroup/mygroup.vue b/src/views/user/mygroup/mygroup.vue
index 0acd3237..ada6e5a9 100755
--- a/src/views/user/mygroup/mygroup.vue
+++ b/src/views/user/mygroup/mygroup.vue
@@ -1,4 +1,5 @@
+
@@ -14,11 +15,21 @@
{{ mygrp.groupname }}
+
+
+
+
{{ mygrp.descr }}
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/user/mygroups/mygroups.vue b/src/views/user/mygroups/mygroups.vue
index 46e3e85b..649d17dd 100755
--- a/src/views/user/mygroups/mygroups.vue
+++ b/src/views/user/mygroups/mygroups.vue
@@ -10,8 +10,8 @@
:prop_mycolumns="colmyUserGroup"
prop_colkey="_id"
col_title="groupname"
- :vertical="true"
- nodataLabel=" "
+ :vertical="costanti.VISUTABLE_LISTA"
+ nodataLabel="Nessuna Richiesta in sospeso"
:prop_search="true"
hint="nome del gruppo da trovare"
:finder="true"