From 9e6acfdb0150a9235b5b9bcbed004959ccf8721e Mon Sep 17 00:00:00 2001 From: Paolo Arena Date: Fri, 17 Jun 2022 12:28:43 +0200 Subject: [PATCH] =?UTF-8?q?Nella=20pagina=20profilo,=20i=20"Gruppi"=20pers?= =?UTF-8?q?onali=20non=20si=20vedevano=20!=20Cancellazione=20di=20un=20Gru?= =?UTF-8?q?ppo=20corretto=20filtro=20di=20visiblit=C3=A0=20dei=20Gruppi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- .env.example.production | 2 +- _ALL_SITES/insiemesipuo.app/.env.development | 2 +- .../popolodelnuovomondo.app/.env.development | 2 +- _ALL_SITES/riso.app/.env.development | 2 +- _ALL_SITES/riso.app/.env.test | 2 +- _ALL_SITES/riso.app/package.json | 2 +- .../terradellavisione.app/.env.development | 2 +- _ALL_SITES/terradellavisione.app/.env.test | 2 +- _ALL_SITES/terradellavisione.app/package.json | 2 +- grp.js | 312 +++++++++++ package.json | 2 +- src/common/shared_vuejs.ts | 1 + src/components/CMyGroup/CMyGroup.ts | 2 +- src/components/CMyGroup/CMyGroup.vue | 17 +- src/statics/lang/it.js | 3 + src/store/Modules/tools.ts | 23 + src/views/user/mygroup/mygroup.ts | 6 + src/views/user/mygroup/mygroup.vue | 488 +++++++++--------- src/views/user/mygroups/mygroups.ts | 3 +- 20 files changed, 627 insertions(+), 250 deletions(-) create mode 100644 grp.js diff --git a/.env.development b/.env.development index 7a665402..4497e2bc 100755 --- a/.env.development +++ b/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="0.3.22" +APP_VERSION="0.3.23" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL="newfreeplanet" diff --git a/.env.example.production b/.env.example.production index 31ff8a20..16b7807a 100755 --- a/.env.example.production +++ b/.env.example.production @@ -1,4 +1,4 @@ -APP_VERSION="0.3.22" +APP_VERSION="0.3.23" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL=newfreeplanet diff --git a/_ALL_SITES/insiemesipuo.app/.env.development b/_ALL_SITES/insiemesipuo.app/.env.development index 30d9322c..1c1dab96 100755 --- a/_ALL_SITES/insiemesipuo.app/.env.development +++ b/_ALL_SITES/insiemesipuo.app/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="0.3.22" +APP_VERSION="0.3.23" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL="newfreeplanet" diff --git a/_ALL_SITES/popolodelnuovomondo.app/.env.development b/_ALL_SITES/popolodelnuovomondo.app/.env.development index c061d80c..ec475d70 100755 --- a/_ALL_SITES/popolodelnuovomondo.app/.env.development +++ b/_ALL_SITES/popolodelnuovomondo.app/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="0.3.22" +APP_VERSION="0.3.23" SERVICE_WORKER_FILE="service-worker.js" APP_ID="12" DIRECTORY_LOCAL="newfreeplanet" diff --git a/_ALL_SITES/riso.app/.env.development b/_ALL_SITES/riso.app/.env.development index 7a665402..4497e2bc 100755 --- a/_ALL_SITES/riso.app/.env.development +++ b/_ALL_SITES/riso.app/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="0.3.22" +APP_VERSION="0.3.23" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL="newfreeplanet" diff --git a/_ALL_SITES/riso.app/.env.test b/_ALL_SITES/riso.app/.env.test index 09800f65..82ce32c0 100755 --- a/_ALL_SITES/riso.app/.env.test +++ b/_ALL_SITES/riso.app/.env.test @@ -1,4 +1,4 @@ -APP_VERSION="0.3.22" +APP_VERSION="0.3.23" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL=newfreeplanet diff --git a/_ALL_SITES/riso.app/package.json b/_ALL_SITES/riso.app/package.json index 691de380..0f36279a 100755 --- a/_ALL_SITES/riso.app/package.json +++ b/_ALL_SITES/riso.app/package.json @@ -1,6 +1,6 @@ { "name": "riso", - "version": "0.3.22", + "version": "0.3.23", "description": "Siamo la Rete Italiana di Scambio Orizzontale, abbiamo creato questa piattaforma per metterla al servizio di chi vuole riscoprire il valore della condivisione e della cooperazione. Valori semplici e profondi che ci aiutano a ritrovare il Senso della Vita, perduto in questa società consumista, e riporti quei Sani Pricìpi Naturali ed Umani di Fratellanza che intere popolazioni antiche conoscevano bene.", "productName": "Riso", "author": "Paolo Arena", diff --git a/_ALL_SITES/terradellavisione.app/.env.development b/_ALL_SITES/terradellavisione.app/.env.development index 6b2ade8b..c2d3567a 100755 --- a/_ALL_SITES/terradellavisione.app/.env.development +++ b/_ALL_SITES/terradellavisione.app/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="0.3.22" +APP_VERSION="0.3.23" SERVICE_WORKER_FILE="service-worker.js" APP_ID="14" DIRECTORY_LOCAL="newfreeplanet" diff --git a/_ALL_SITES/terradellavisione.app/.env.test b/_ALL_SITES/terradellavisione.app/.env.test index bb223e21..6e00e650 100755 --- a/_ALL_SITES/terradellavisione.app/.env.test +++ b/_ALL_SITES/terradellavisione.app/.env.test @@ -1,4 +1,4 @@ -APP_VERSION="0.3.22" +APP_VERSION="0.3.23" SERVICE_WORKER_FILE="service-worker.js" APP_ID="14" DIRECTORY_LOCAL=newfreeplanet diff --git a/_ALL_SITES/terradellavisione.app/package.json b/_ALL_SITES/terradellavisione.app/package.json index 8f29ee7c..cbcd285c 100755 --- a/_ALL_SITES/terradellavisione.app/package.json +++ b/_ALL_SITES/terradellavisione.app/package.json @@ -1,6 +1,6 @@ { "name": "terradellavisione", - "version": "0.3.22", + "version": "0.3.23", "description": "TerraDellaVisione", "productName": "TerraDellaVisione", "author": "Paolo Arena", diff --git a/grp.js b/grp.js new file mode 100644 index 00000000..1e85be41 --- /dev/null +++ b/grp.js @@ -0,0 +1,312 @@ +db.getCollection('mygoods').aggregate( +[ + { + "$match": { + "$and": [ + { + "$or": [ + { + "idContribType": "515a353c002c8298f4495bf7" + } + ] + } + ] + } + }, + { + "$match": { + "idapp": "13" + } + }, + { + "$sort": { + "date_created": -1 + } + }, + { + "$addFields": { + "myId1": { + "$toObjectId": "$userId" + } + } + }, + { + "$lookup": { + "from": "users", + "localField": "myId1", + "foreignField": "_id", + "as": "user" + } + }, + { + "$replaceRoot": { + "newRoot": { + "$mergeObjects": [ + { + "$arrayElemAt": [ + "$user", + 0 + ] + }, + "$$ROOT" + ] + } + } + }, + { + "$project": { + "recGood": 1, + "sectorGood": 1, + "idSectorGood": 1, + "idGood": 1, + "mygood": 1, + "idStatusSkill": 1, + "idContribType": 1, + "idCity": 1, + "pub_to_share": 1, + "numLevel": 1, + "adType": 1, + "photos": 1, + "note": 1, + "website": 1, + "descr": 1, + "date_created": 1, + "date_updated": 1, + "userId": 1, + "username": 1, + "name": 1, + "surname": 1, + "comune": 1, + "mycities": 1, + "profile.img": 1, + "profile.mygroups": 1, + "profile.qualifica": 1 + } + }, + { + "$lookup": { + "from": "goods", + "localField": "idGood", + "foreignField": "_id", + "as": "recGood" + } + }, + { + "$replaceRoot": { + "newRoot": { + "$mergeObjects": [ + { + "$arrayElemAt": [ + "$recGood", + 0 + ] + }, + "$$ROOT" + ] + } + } + }, + { + "$project": { + "recGood": 1, + "sectorGood": 1, + "idSectorGood": 1, + "idGood": 1, + "mygood": 1, + "idStatusSkill": 1, + "idContribType": 1, + "idCity": 1, + "pub_to_share": 1, + "numLevel": 1, + "adType": 1, + "photos": 1, + "note": 1, + "website": 1, + "descr": 1, + "date_created": 1, + "date_updated": 1, + "userId": 1, + "username": 1, + "name": 1, + "surname": 1, + "comune": 1, + "mycities": 1, + "profile.img": 1, + "profile.mygroups": 1, + "profile.qualifica": 1 + } + }, + { + "$lookup": { + "from": "sectorgoods", + "localField": "recGood.idSectorGood", + "foreignField": "_id", + "as": "sectorgood" + } + }, + { + "$replaceRoot": { + "newRoot": { + "$mergeObjects": [ + { + "$arrayElemAt": [ + "$sectorgood", + 0 + ] + }, + "$$ROOT" + ] + } + } + }, + { + "$project": { + "recGood": 1, + "sectorGood": 1, + "idSectorGood": 1, + "idGood": 1, + "mygood": 1, + "idStatusSkill": 1, + "idContribType": 1, + "idCity": 1, + "pub_to_share": 1, + "numLevel": 1, + "adType": 1, + "photos": 1, + "note": 1, + "website": 1, + "descr": 1, + "date_created": 1, + "date_updated": 1, + "userId": 1, + "username": 1, + "name": 1, + "surname": 1, + "comune": 1, + "mycities": 1, + "profile.img": 1, + "profile.mygroups": 1, + "profile.qualifica": 1 + } + }, + { + "$lookup": { + "from": "cities", + "localField": "idCity", + "foreignField": "_id", + "as": "mycities" + } + }, + { + "$replaceRoot": { + "newRoot": { + "$mergeObjects": [ + { + "$arrayElemAt": [ + "$mycities", + 0 + ] + }, + "$$ROOT" + ] + } + } + }, + { + "$project": { + "recGood": 1, + "sectorGood": 1, + "idSectorGood": 1, + "idGood": 1, + "mygood": 1, + "idStatusSkill": 1, + "idContribType": 1, + "idCity": 1, + "pub_to_share": 1, + "numLevel": 1, + "adType": 1, + "photos": 1, + "note": 1, + "website": 1, + "descr": 1, + "date_created": 1, + "date_updated": 1, + "userId": 1, + "username": 1, + "name": 1, + "surname": 1, + "comune": 1, + "mycities": 1, + "profile.img": 1, + "profile.mygroups": 1, + "profile.qualifica": 1 + } + }, + { + "$match": { + "$or": [ + { + "$and": [ + { + "profile.mygroups": { + "$elemMatch": { + "groupname": { + "$in": [ + "000017", + "VillaggiamoItalia", + "Terraw", + "RisoBenevento", + "111" + ] + } + } + } + }, + { + "pub_to_share": 1, + } + ] + }, + { + "pub_to_share": 0, + } + ] + } + }, + { + "$match": { + "$and": [ + { + "mycities.reg": "EMR" + }, + { + "mycities.prov": "RN" + } + ] + } + }, + { + "$group": { + "_id": null, + "count": { + "$sum": 1 + }, + "results": { + "$push": "$$ROOT" + } + } + }, + { + "$project": { + "count": 1, + "rows": { + "$slice": [ + "$results", + 0, + 20 + ] + } + } + } +] +) \ No newline at end of file diff --git a/package.json b/package.json index 691de380..0f36279a 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "riso", - "version": "0.3.22", + "version": "0.3.23", "description": "Siamo la Rete Italiana di Scambio Orizzontale, abbiamo creato questa piattaforma per metterla al servizio di chi vuole riscoprire il valore della condivisione e della cooperazione. Valori semplici e profondi che ci aiutano a ritrovare il Senso della Vita, perduto in questa società consumista, e riporti quei Sani Pricìpi Naturali ed Umani di Fratellanza che intere popolazioni antiche conoscevano bene.", "productName": "Riso", "author": "Paolo Arena", diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index dfd259ce..a941ef1e 100755 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -67,6 +67,7 @@ export const shared_consts = { CANCEL_REQ_GROUP: 1146, BLOCK_GROUP: 1155, FIND_GROUP: 1166, + DELETE_GROUP: 1170, }, PUBTOSHARE: { diff --git a/src/components/CMyGroup/CMyGroup.ts b/src/components/CMyGroup/CMyGroup.ts index 0e626134..e68c5894 100755 --- a/src/components/CMyGroup/CMyGroup.ts +++ b/src/components/CMyGroup/CMyGroup.ts @@ -1,6 +1,6 @@ import { defineComponent, onMounted, PropType, ref, watch } from 'vue' import { useUserStore } from '@store/UserStore' -import { IMyGroup, IImgGallery, IUserFields, IUserProfile } from 'model' +import { IMyGroup, IImgGallery, IUserFields, IUserProfile, IFriends } from 'model' import { costanti } from '@costanti' import { shared_consts } from '@/common/shared_vuejs' import { tools } from '@store/Modules/tools' diff --git a/src/components/CMyGroup/CMyGroup.vue b/src/components/CMyGroup/CMyGroup.vue index 3dac893d..08936de9 100755 --- a/src/components/CMyGroup/CMyGroup.vue +++ b/src/components/CMyGroup/CMyGroup.vue @@ -24,8 +24,13 @@ {{ $t('groups.remove_from_mygroups') }} + + + {{ $t('groups.delete_group') }} + + - + {{ $t('groups.block_group') }} @@ -52,6 +57,11 @@ {{ $t('groups.exit_group') }} + + + {{ $t('groups.delete_group') }} + + @@ -103,6 +113,11 @@ {{ $t('groups.exit_group') }} + + + {{ $t('groups.delete_group') }} + + diff --git a/src/statics/lang/it.js b/src/statics/lang/it.js index c0d2df25..02f93c78 100755 --- a/src/statics/lang/it.js +++ b/src/statics/lang/it.js @@ -195,9 +195,11 @@ const msg_it = { friendsadded: 'Aggiunto alla lista di Amici', domanda_removefriend: 'Rimuovi dagli Amici {username}?', domanda_exit_fromgroup: 'Uscire dal Gruppo {groupname} ?', + domanda_remove_group: 'Sicuro di voler Eliminare il Gruppo {groupname} ?', domanda_removegroup: 'Rimuovere dal Gruppo {username} ?', removedfriend: 'Rimosso dalla lista di Amici', removedgroup: 'Rimosso dal Gruppo', + deletedgroup: 'Gruppo Eliminato', domanda_addtofriend: 'Aggiungere agli amici {username}?', domanda_addtogroup: 'Aggiungi {username} al gruppo {groupname}?', addedfriend: 'Aggiunto alla lista di Amici', @@ -945,6 +947,7 @@ const msg_it = { admins: 'Amministratori', ask_group: 'Chiedi di entrare nel Gruppo', exit_group: 'Esci dal Gruppo', + delete_group: 'Elimina il Gruppo', accept_group: 'Accetta la richiesta', remove_from_mygroups: 'Rimuovi dal Gruppo', block_group: 'Blocca Gruppo', diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts index 8cc9b700..0577bdfb 100644 --- a/src/store/Modules/tools.ts +++ b/src/store/Modules/tools.ts @@ -4749,6 +4749,27 @@ export const tools = { }) }, + DeleteGroup($q: any, username: string, groupnameDest: string, domanda: any = '') { + const userStore = useUserStore() + + $q.dialog({ + message: domanda ? domanda : t('db.domanda_remove_group', { 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.DELETE_GROUP, 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.deletedgroup')) + } + } + }) + }) + }, + setRequestFriendship($q: any, username: string, usernameDest: string, value: boolean) { const userStore = useUserStore() @@ -5028,6 +5049,8 @@ export const tools = { console.log('setcmd', cmd) if (cmd === shared_consts.GROUPSCMD.REMOVE_FROM_MYGROUP) { tools.removeFromMyGroups($q, username, dest, t('db.domanda_exit_fromgroup', { username })) + } else if (cmd === shared_consts.GROUPSCMD.DELETE_GROUP) { + tools.DeleteGroup($q, username, dest) } else if (cmd === shared_consts.GROUPSCMD.BLOCK_GROUP) { tools.blockGroup($q, username, dest) } else if (cmd === shared_consts.GROUPSCMD.SETGROUP) { diff --git a/src/views/user/mygroup/mygroup.ts b/src/views/user/mygroup/mygroup.ts index 99b1036c..31f3d602 100755 --- a/src/views/user/mygroup/mygroup.ts +++ b/src/views/user/mygroup/mygroup.ts @@ -41,6 +41,8 @@ export default defineComponent({ const mygrp = ref({}) const users_in_group = ref([]) + const loading = ref(false) + const tabgrp = ref('info') const tab = ref('membri') @@ -68,6 +70,8 @@ export default defineComponent({ mygrp.value = null users_in_group.value = [] } + + loading.value = false // filtroutente.value = [{ userId: userStore.my._id }] }) @@ -79,6 +83,7 @@ export default defineComponent({ }) async function mounted() { + loading.value = true await loadGroup() searchList.value = [] @@ -202,6 +207,7 @@ export default defineComponent({ numAdmins, listaAdmins, users_in_group, + loading, } } }) diff --git a/src/views/user/mygroup/mygroup.vue b/src/views/user/mygroup/mygroup.vue index 51864a71..42dfdccf 100755 --- a/src/views/user/mygroup/mygroup.vue +++ b/src/views/user/mygroup/mygroup.vue @@ -1,253 +1,269 @@ diff --git a/src/views/user/mygroups/mygroups.ts b/src/views/user/mygroups/mygroups.ts index d1326847..7e7dc0e4 100755 --- a/src/views/user/mygroups/mygroups.ts +++ b/src/views/user/mygroups/mygroups.ts @@ -24,7 +24,8 @@ export default defineComponent({ function mounted() { - const filt_loaded = tools.getCookie(tools.COOK_SEARCH + tools.GROUP_SEARCH) + const filt_loaded = tools.getCookie(tools.COOK_SEARCH + tools.GROUP_SEARCH, costanti.FIND_GROUP, true) + console.log('filt_loaded', filt_loaded) filter.value = filt_loaded ? filt_loaded : costanti.FIND_GROUP }