From 1f414e19eaa33a2c9113f197b5d3e22bd0c9cee0 Mon Sep 17 00:00:00 2001 From: paoloar77 Date: Tue, 30 Aug 2022 17:00:32 +0200 Subject: [PATCH] Circuit go on... --- src/common/shared_vuejs.ts | 12 +- src/components/CFinder/CFinder.ts | 10 ++ src/components/CGridTableRec/CGridTableRec.ts | 1 + .../CGridTableRec/CGridTableRec.vue | 3 +- .../CMyCardCircuitPopup.ts | 2 +- .../CMyCardCircuitPopup.vue | 11 ++ src/components/CMyCircuit/CMyCircuit.vue | 12 +- src/components/CMyGroup/CMyGroup.vue | 12 +- src/components/CMyPopupEdit/CMyPopupEdit.ts | 3 +- src/components/CMyUser/CMyUser.vue | 41 ++++- src/db/static_data.ts | 2 +- src/model/GlobalStore.ts | 1 + src/model/UserStore.ts | 2 - src/statics/lang/enUs.js | 11 +- src/statics/lang/es.js | 6 +- src/statics/lang/it.js | 48 ++++-- src/store/CircuitStore.ts | 1 - src/store/Modules/costanti.ts | 6 +- src/store/Modules/fieldsTable.ts | 2 + src/store/Modules/tools.ts | 157 ++++++++++++++++-- src/store/UserStore.ts | 52 ++++-- src/views/user/mycircuit/mycircuit.ts | 26 +-- src/views/user/mycircuit/mycircuit.vue | 112 +++---------- src/views/user/mygroup/mygroup.vue | 10 +- 24 files changed, 360 insertions(+), 183 deletions(-) diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index 04773af9..ae0859cb 100755 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -19,6 +19,7 @@ export const shared_consts = { QUERYTYPE_REFUSED_USER_GRP: 2, ALL_SAW_AND_ACCEPTED: 3, QUERYTYPE_CIRCUIT: 10, + QUERYTYPE_REFUSED_USER_CIRCUIT: 12, FILTER_EXTRALIST_NOT_REGISTERED: 1, FILTER_EXTRALIST_NOT_CONTACTED: 2, @@ -75,6 +76,13 @@ export const shared_consts = { REMOVEADMIN_OFMYGROUP: 1185, }, + CIRCUITCMD: { + REQ: 2000, + SET: 2001, + REMOVE_FROM_MYLIST: 2144, + DELETE: 2170, + }, + PUBTOSHARE: { ALL: 0, ONLY_GROUPS_FOLLOW: 1, @@ -113,8 +121,8 @@ export const shared_consts = { TABLES_WITH_SORTING: ['mybachecas', 'myhosps'], TABLES_REC_ID: ['skills', 'goods', 'subskills', 'myskills', 'mybachecas', 'myhosps', 'mygoods'], - // costanti.VISUTABLE_SCHEDA_USER, VISUTABLE_SCHEDA_GROUP, VISUTABLE_USER_TABGROUP - VERTIC_SHOW_GRID: [-1, 2, -3, -4], + // costanti.VISUTABLE_SCHEDA_USER, VISUTABLE_SCHEDA_GROUP, VISUTABLE_USER_TABGROUP, VISUTABLE_USER_TABCIRCUIT + VERTIC_SHOW_GRID: [-1, 2, -3, -4, -5], TABLES_UPDATE_LASTIFIED: ['myskills', 'mybachecas', 'myhosps', 'mygoods', 'bots'], TABLES_FINDER: ['myskills', 'mybachecas', 'myhosps', 'mygoods', 'mygroups'], diff --git a/src/components/CFinder/CFinder.ts b/src/components/CFinder/CFinder.ts index 60dbe5e1..258159af 100755 --- a/src/components/CFinder/CFinder.ts +++ b/src/components/CFinder/CFinder.ts @@ -1014,6 +1014,16 @@ export default defineComponent({ }, } + } else if (props.table === toolsext.TABCIRCUITS) { + + let lk_tab = 'circuits' + let lk_LF = 'idapp' + let lk_FF = 'idapp' + let lk_as = 'circuit' + let af_objId_tab = 'myId' + + return {} + } else if (props.table === toolsext.TABMYGOODS) { return { lookup1: { diff --git a/src/components/CGridTableRec/CGridTableRec.ts b/src/components/CGridTableRec/CGridTableRec.ts index 7c260655..dc4e279e 100755 --- a/src/components/CGridTableRec/CGridTableRec.ts +++ b/src/components/CGridTableRec/CGridTableRec.ts @@ -980,6 +980,7 @@ export default defineComponent({ watch(() => userStore.updateTables, (newval, oldval) => { if (newval && (myvertical.value === costanti.VISUTABLE_USER_TABGROUP || + myvertical.value === costanti.VISUTABLE_USER_TABCIRCUIT || myvertical.value === costanti.VISUTABLE_SCHEDA_GROUP || myvertical.value === costanti.VISUTABLE_SCHEDA_USER || (props.showType === costanti.SHOW_USERINFO))) { diff --git a/src/components/CGridTableRec/CGridTableRec.vue b/src/components/CGridTableRec/CGridTableRec.vue index 5af8bbd6..51b89d09 100755 --- a/src/components/CGridTableRec/CGridTableRec.vue +++ b/src/components/CGridTableRec/CGridTableRec.vue @@ -211,7 +211,8 @@
+ v-if="showType === costanti.SHOW_MYCARD || (myvertical !== costanti.VISUTABLE_USER_TABGROUP && + myvertical !== costanti.VISUTABLE_USER_TABCIRCUIT && myvertical === costanti.VISUTABLE_LISTA && shared_consts.TABLES_VISU_CMYSRECCARD.includes(tablesel)) ">
diff --git a/src/components/CMyCardCircuitPopup/CMyCardCircuitPopup.ts b/src/components/CMyCardCircuitPopup/CMyCardCircuitPopup.ts index 0e32a7fa..f3438e5d 100644 --- a/src/components/CMyCardCircuitPopup/CMyCardCircuitPopup.ts +++ b/src/components/CMyCardCircuitPopup/CMyCardCircuitPopup.ts @@ -83,7 +83,7 @@ export default defineComponent({ } function condividipag() { - const msg = self.location.host + tools.getPathByCircuit(myrec.value, props.table) + const msg = self.location.host + tools.getPathByTableAndRec(props.table, myrec.value) return tools.copyStringToClipboard($q, msg, true) } diff --git a/src/components/CMyCardCircuitPopup/CMyCardCircuitPopup.vue b/src/components/CMyCardCircuitPopup/CMyCardCircuitPopup.vue index 79e11ebd..888d7a49 100644 --- a/src/components/CMyCardCircuitPopup/CMyCardCircuitPopup.vue +++ b/src/components/CMyCardCircuitPopup/CMyCardCircuitPopup.vue @@ -38,6 +38,17 @@
+
+ +
+
+ +
+ Simbolo: + {{ tools.getValue(myrec, mycol.field, mycol.subfield) }} +
+ +
{{ tools.getValue(myrec, mycol.field, mycol.subfield) }} diff --git a/src/components/CMyCircuit/CMyCircuit.vue b/src/components/CMyCircuit/CMyCircuit.vue index d44dbfa1..7f43bde6 100755 --- a/src/components/CMyCircuit/CMyCircuit.vue +++ b/src/components/CMyCircuit/CMyCircuit.vue @@ -2,13 +2,13 @@
- + - + {{ circuit.name }} ({{ circuit.subname }}) {{ circuit.longdescr }} @@ -49,10 +49,10 @@ - {{ $t('groups.refuse_ask_group') }} + {{ $t('shared.refuse_ask') }} - {{ $t('groups.cancel_ask_group') }} + {{ $t('shared.cancel_ask') }} @@ -90,11 +90,11 @@ - {{ $t('groups.refuse_ask_group') }} + {{ $t('shared.refuse_ask') }} - {{ $t('groups.cancel_ask_group') }} + {{ $t('shared.cancel_ask') }} diff --git a/src/components/CMyGroup/CMyGroup.vue b/src/components/CMyGroup/CMyGroup.vue index c617c107..d2fb54d3 100755 --- a/src/components/CMyGroup/CMyGroup.vue +++ b/src/components/CMyGroup/CMyGroup.vue @@ -49,10 +49,10 @@ - {{ $t('groups.refuse_ask_group') }} + {{ $t('shared.refuse_ask') }} - {{ $t('groups.cancel_ask_group') }} + {{ $t('shared.cancel_ask') }} @@ -90,11 +90,11 @@ - {{ $t('groups.refuse_ask_group') }} + {{ $t('shared.refuse_ask') }} - {{ $t('groups.cancel_ask_group') }} + {{ $t('shared.cancel_ask') }} @@ -112,10 +112,10 @@ - {{ $t('groups.refuse_ask_group') }} + {{ $t('shared.refuse_ask') }} - {{ $t('groups.cancel_ask_group') }} + {{ $t('shared.cancel_ask') }} diff --git a/src/components/CMyPopupEdit/CMyPopupEdit.ts b/src/components/CMyPopupEdit/CMyPopupEdit.ts index 6fbc8d66..69a6b987 100755 --- a/src/components/CMyPopupEdit/CMyPopupEdit.ts +++ b/src/components/CMyPopupEdit/CMyPopupEdit.ts @@ -322,7 +322,8 @@ export default defineComponent({ if (col.value && col.value.allowchar === costanti.ALLOWCHAR_CODE) { myvalue.value = tools.removespaces(newval) } - console.log('popypedit: changevalRec', newval) + // console.log('popypedit: changevalRec', newval) + // console.log('row', props.row, 'col', props.mycol, 'newval', newval) // console.log('row[col.value.name]', props.row[col.value.name]) if (props.type === costanti.FieldType.image) { diff --git a/src/components/CMyUser/CMyUser.vue b/src/components/CMyUser/CMyUser.vue index 015efc39..5bbb308a 100755 --- a/src/components/CMyUser/CMyUser.vue +++ b/src/components/CMyUser/CMyUser.vue @@ -78,7 +78,7 @@ - {{ $t('groups.refuse_ask_group') }} + {{ $t('shared.refuse_ask') }} @@ -86,7 +86,44 @@ - {{ $t('groups.cancel_ask_group_short') }} + {{ $t('shared.cancel_ask_short') }} + + + + + + + + + + + + + + + + + + {{ $t('groups.accept_circuit') }} + + + + + + + + + + {{ $t('shared.refuse_ask') }} + + + + + + + {{ $t('shared.cancel_ask_short') }} diff --git a/src/db/static_data.ts b/src/db/static_data.ts index df30667d..87322b60 100755 --- a/src/db/static_data.ts +++ b/src/db/static_data.ts @@ -624,7 +624,7 @@ const baseroutes: IListRoutes[] = [ },{ active: true, order: 137, - path: '/circuit/:name', + path: '/circuit/:path', materialIcon: 'fas fa-user', name: 'proj.circuit2', component: () => import('@/views/user/mycircuit/mycircuit.vue'), diff --git a/src/model/GlobalStore.ts b/src/model/GlobalStore.ts index c855da39..cde269f8 100755 --- a/src/model/GlobalStore.ts +++ b/src/model/GlobalStore.ts @@ -894,6 +894,7 @@ export interface ICircuit { _id: number groupnameId: string name: string + path: string subname: string longdescr: string systemUserDescr: string diff --git a/src/model/UserStore.ts b/src/model/UserStore.ts index e9e6ce8c..5db95bf7 100755 --- a/src/model/UserStore.ts +++ b/src/model/UserStore.ts @@ -105,7 +105,6 @@ export interface IUserProfile { refused_circuits: any[] listUserAccounts: IAccount[] manage_mycircuits?: ICircuit[] - } export interface IPaymentType { @@ -118,7 +117,6 @@ export interface IUserAport { profile?: IUserProfile } - export interface IUserFields { _id: string ind_order?: number diff --git a/src/statics/lang/enUs.js b/src/statics/lang/enUs.js index a967c961..d8167785 100755 --- a/src/statics/lang/enUs.js +++ b/src/statics/lang/enUs.js @@ -197,11 +197,9 @@ const msg_enUs = { domanda_ask_friend: 'Chiedere l\'Amicizia a {username}?', domanda_ask_group: 'Chiedere l\'invito al Gruppo {groupname}?', askedtofriend: 'Chiesto l\'Amicizia a {username}', - askedtogroup: 'Chiesto l\'invito al Gruppo {groupname}', domanda_revoke_friend: 'Revocare la richiesta di Amicizia a {username}?', domanda_revoke_group: 'Revocare la richiesta al gruppo {groupname}?', 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 di {username} al gruppo {groupname}?', cancel_req_friend: 'Annullata la richiesta di Amicizia a {username}', @@ -213,7 +211,8 @@ const msg_enUs = { domanda_blockgroup: 'Bloccare il gruppo {groupname}?', blockedfriend: 'Utente Bloccato', domanda: 'Domanda', - + askedtogroup: 'Chiesto l\'invito al Gruppo {groupname}', + revoketogroup: 'Revocato la richiesta d\'invito al gruppo {groupname}', }, components: { authentication: { @@ -913,9 +912,9 @@ const msg_enUs = { 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', + cancel_ask: 'Annulla la richiesta', + cancel_ask_short: 'Annulla richiesta', + refuse_ask_short: 'Rifiuta la richiesta', pwd: 'Password per accedere', }, finder: { diff --git a/src/statics/lang/es.js b/src/statics/lang/es.js index e40b9b79..337698bb 100755 --- a/src/statics/lang/es.js +++ b/src/statics/lang/es.js @@ -836,9 +836,9 @@ const msg_es = { 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', + cancel_ask: 'Annulla la richiesta', + cancel_ask_short: 'Annulla richiesta', + refuse_ask_short: 'Rifiuta la richiesta', pwd: 'Password per accedere', }, finder: { diff --git a/src/statics/lang/it.js b/src/statics/lang/it.js index 40e3427d..bf6bf854 100755 --- a/src/statics/lang/it.js +++ b/src/statics/lang/it.js @@ -201,32 +201,30 @@ 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} ?', domanda_addadminofmygroup: 'Aggiungere {username} come Amministratore del Gruppo {groupname} ?', domanda_removeadminofmygroup: 'Rimuovere {username} dall\' incarico di Amministratore del Gruppo {groupname} ?', removedfriend: 'Rimosso dalla lista di Amici', - removedgroup: 'Rimosso dal Gruppo', addedtoadmin: 'Aggiunto {username} come amministratore', removedtoadmin: 'Rimosso {username} come amministratore', refusedgroup: 'Rifiutato a {username} la richiesta di entrare nel Gruppo', youarerefusedgroup: 'Ti è stato rifiutata la richiesta di entrare in questo Gruppo (per info chiedi all\'amministratore del gruppo)', + youarerefusedcircuit: 'Ti è stato rifiutata la richiesta di entrare in questo Circuito (per info chiedi all\'amministratore del gruppo)', deletedgroup: 'Gruppo Eliminato', domanda_addtofriend: 'Aggiungere agli amici {username}?', domanda_addtogroup: 'Aggiungi {username} al gruppo {groupname}?', + domanda_addtocircuit: 'Aggiungi {username} al Circuito {name}?', addedfriend: 'Aggiunto alla lista di Amici', addedgroup: 'Aggiunto al Gruppo', + addedcircuit: 'Aggiunto al Circuito {name}', domanda_trusted: 'Accettare la Fiducia a {username}?', trusted: 'Accettato la Fiducia', domanda_ask_friend: 'Chiedere l\'Amicizia a {username}?', domanda_ask_group: 'Chiedere l\'invito al Gruppo {groupname}?', askedtofriend: 'Chiesto l\'Amicizia a {username}', - askedtogroup: 'Chiesto l\'invito al Gruppo {groupname}', domanda_revoke_friend: 'Revocare la richiesta di Amicizia a {username}?', domanda_revoke_group: 'Revocare la richiesta al gruppo {groupname}?', domanda_refuse_group: 'Rifiutare la richiesta di {username} per entrare nel gruppo {groupname}?', 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 di {username} al gruppo {groupname}?', cancel_req_friend: 'Annullata la richiesta di Amicizia a {username}', @@ -241,6 +239,11 @@ const msg_it = { blockedfriend: 'Utente Bloccato', unblockedfriend: 'Utente Sbloccato', domanda: 'Domanda', + askedtogroup: 'Chiesto l\'invito al Gruppo {groupname}', + revoketogroup: 'Revocato la richiesta d\'invito al gruppo {groupname}', + domanda_removegroup: 'Rimuovere dal Gruppo {username} ?', + removedgroup: 'Rimosso dal Gruppo', + domanda_remove_group: 'Sicuro di voler Eliminare il Gruppo {groupname} ?', }, components: { authentication: { @@ -1018,33 +1021,36 @@ const msg_it = { reject_ask_friend: 'Rifiuta l\'Amicizia', report_user: 'Segnala Utente', }, - groups: { + shared: { info1: 'Info', + subscribes: 'Membri', + cancel_ask: 'Annulla la richiesta', + refuse_ask: 'Rifiuta la richiesta (con avviso)', + cancel_ask_short: 'Annulla richiesta', + refuse_ask_short: 'Rifiuta la richiesta', + members: 'membri', + admin: 'amministratore', + admins: 'Amministratori', + }, + groups: { info: 'Informazioni su questo gruppo', member: 'membro', - members: 'membri', accepted: 'Ingresso Accettato', refused: 'Ingresso Rifiutato', deleted: 'Cancellato', blocked: 'Bloccato', removed: 'Rimosso', - admin: 'amministratore', - admins: 'Amministratori', createdby: 'Creato da {username} in data {date}', lastmodify: 'Ultima modifica {date}', - subscribes: 'Membri', ask_group: 'Chiedi di entrare nel Gruppo', exit_group: 'Esci dal Gruppo', delete_group: 'Elimina il Gruppo', accept_group: 'Accetta la richiesta', + accept_circuit: 'Accetta la richiesta', addasadmin: 'Aggiungi come Admin del Gruppo', remove_as_admin: 'Rimuovi come Admin del Gruppo', remove_from_mygroups: 'Rimuovi dal Gruppo', block_group: 'Blocca Gruppo', - cancel_ask_group: 'Annulla la richiesta', - refuse_ask_group: 'Rifiuta la richiesta (con avviso)', - cancel_ask_group_short: 'Annulla richiesta', - refuse_ask_group_short: 'Rifiuta la richiesta', pwd: 'Password per accedere', private: 'Privato', hidden: 'Nascosto', @@ -1089,6 +1095,7 @@ const msg_it = { }, circuit: { name: 'Nome Circuito', + path: 'Nome Pagina', subname: 'SottoNome', descr: 'Descrizione', systemUserDescr: 'Descr Utente di Sistema', @@ -1114,6 +1121,19 @@ const msg_it = { durata_deper: 'Durata Dep.', img_logo: 'NomeFile Logo', regulation: 'Regolamento', + + domanda_ask: 'Chiedere l\'invito al Circuito {name}?', + domanda_revoke: 'Revocare la richiesta al Circuito {name}?', + askedto: 'Chiesto l\'invito al Circuito {name}', + revoketo: 'Revocato la richiesta d\'invito al Circuito {name}', + domanda_remove: 'Rimuovere dal Circuito {username} ?', + removed: 'Rimosso dal Circuito', + domanda_removerecord: 'Sicuro di voler Eliminare il Circuito {name} ?', + deleted: 'Circuito {name} Eliminato', + delete: 'Elimina il Circuito', + ask: 'Chiedi di entrare nel Circuito', + exit: 'Esci dal Circuito', + accept: 'Accetta la richiesta', }, account: { diff --git a/src/store/CircuitStore.ts b/src/store/CircuitStore.ts index 041a65e9..3dbf586b 100755 --- a/src/store/CircuitStore.ts +++ b/src/store/CircuitStore.ts @@ -26,7 +26,6 @@ export const useCircuitStore = defineStore('CircuitStore', { getters: { - }, actions: { diff --git a/src/store/Modules/costanti.ts b/src/store/Modules/costanti.ts index 7b61f3b6..1740d129 100755 --- a/src/store/Modules/costanti.ts +++ b/src/store/Modules/costanti.ts @@ -168,6 +168,7 @@ export const costanti = { VISUTABLE_SCHEDA_USER: -1, VISUTABLE_SCHEDA_GROUP: -3, VISUTABLE_USER_TABGROUP: -4, + VISUTABLE_USER_TABCIRCUIT: -5, DIR_UPLOAD: 'upload/', // upload/ @@ -203,8 +204,9 @@ export const costanti = { SHOW_ALL: 50, - REQ_ADD_USER_TO_GROUP: 40, - REQ_REMOVE_USER_TO_GROUP: 41, + REQ_ADD_USER_TO_GROUP: 100, + REQ_REMOVE_USER_TO_GROUP: 101, + REQ_ADD_USER_TO_CIRCUIT: 110, FILTER_NESSUNO: 0, FILTER_TUTTI: -100, diff --git a/src/store/Modules/fieldsTable.ts b/src/store/Modules/fieldsTable.ts index b8c50153..4bba9ee0 100755 --- a/src/store/Modules/fieldsTable.ts +++ b/src/store/Modules/fieldsTable.ts @@ -2384,6 +2384,7 @@ export const colTableCircuitComplete = [ AddCol({ name: 'Num', label_trans: 'circuit.num', fieldtype: costanti.FieldType.number }), AddCol({ name: 'groupnameId', label_trans: 'circuit.groupnameId' }), // da togliere poi AddCol({ name: 'name', label_trans: 'circuit.name' }), + AddCol({ name: 'path', label_trans: 'circuit.path' }), AddCol({ name: 'subname', label_trans: 'circuit.subname' }), AddCol({ name: 'longdescr', label_trans: 'circuit.descr', fieldtype: costanti.FieldType.html }), AddCol({ name: 'regulation', label_trans: 'circuit.regulation', fieldtype: costanti.FieldType.html }), @@ -2438,6 +2439,7 @@ export const colTableCircuitComplete = [ export const colTableCircuit = [ AddCol({ name: 'groupnameId', label_trans: 'circuit.groupnameId' }), // da togliere poi AddCol({ name: 'name', label_trans: 'circuit.name' }), + AddCol({ name: 'path', label_trans: 'circuit.path' }), AddCol({ name: 'subname', label_trans: 'circuit.subname' }), AddCol({ name: 'longdescr', label_trans: 'circuit.descr', fieldtype: costanti.FieldType.html }), AddCol({ name: 'systemUserId', label_trans: 'circuit.systemUserId', fieldtype: costanti.FieldType.select, jointable: 'users', }), diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts index 8240f160..8b5b1ab6 100644 --- a/src/store/Modules/tools.ts +++ b/src/store/Modules/tools.ts @@ -12,7 +12,7 @@ import { ITodo, IUserFields, Privacy, - TipoVisu, IGroup, IMySkill, IMyBacheca, IImgGallery, IMsgGlobParam, IUserExport, ISpecialField, + TipoVisu, IGroup, IMySkill, IMyBacheca, IImgGallery, IMsgGlobParam, IUserExport, ISpecialField, IAccount, } from '@model' import { addToDate } from '@quasar/quasar-ui-qcalendar' @@ -4734,6 +4734,31 @@ export const tools = { }, + addToMyCircuits($q: any, username: string, name: string) { + + const userStore = useUserStore() + const notifStore = useNotifStore() + $q.dialog({ + message: t('db.domanda_addtocircuit', { username, name }), + ok: { label: t('dialog.yes'), push: true }, + cancel: { label: t('dialog.cancel') }, + title: t('db.domanda') + }).onOk(() => { + + userStore.setCircuitCmd($q, t, username, name, shared_consts.CIRCUITCMD.SET, true) + .then((res: any) => { + if (res) { + notifStore.updateNotification = true + if (userStore.my.profile.listUserAccounts) + userStore.my.profile.listUserAccounts = [...userStore.my.profile.listUserAccounts, res] + else + userStore.my.profile.listUserAccounts = [res] + tools.showPositiveNotif($q, t('db.addedcircuit', { name })) + } + }) + }) + }, + addToMyGroups($q: any, username: string, groupnameDest: string) { const userStore = useUserStore() @@ -4871,7 +4896,7 @@ export const tools = { const userStore = useUserStore() $q.dialog({ - message: domanda ? domanda : t('db.domanda_remove_group', { username }), + message: domanda ? domanda : t('db.domanda_remove_group', { groupname: groupnameDest }), ok: { label: t('dialog.yes'), push: true }, cancel: { label: t('dialog.cancel') }, title: t('db.domanda') @@ -5162,6 +5187,103 @@ export const tools = { return risultato }, + setRequestCircuit($q: any, username: string, name: string, value: boolean) { + + const userStore = useUserStore() + + let msg = '' + if (value) { + msg = t('circuit.domanda_ask', { name }) + } else { + msg = t('circuit.domanda_revoke', { name }) + } + + $q.dialog({ + message: msg, + ok: { + label: t('dialog.yes'), + push: true + }, + cancel: { + label: t('dialog.cancel') + }, + title: t('db.domanda') + }).onOk(() => { + + userStore.setCircuitCmd($q, t, username, name, shared_consts.CIRCUITCMD.REQ, value) + .then((res: any) => { + if (res) { + if (value) { + // ADD to req + userStore.my.profile.asked_circuits.push(res) + tools.showPositiveNotif($q, t('circuit.askedto', { name })) + } else { + // REMOVE to req + userStore.my.profile.asked_circuits = userStore.my.profile.asked_circuits.filter((rec: ICircuit) => rec.name !== name) + tools.showPositiveNotif($q, t('circuit.revoketo', { name })) + } + + } else { + tools.showNegativeNotif($q, t('db.recfailed')) + } + }) + }) + }, + + removeFromMyCircuits($q: any, username: string, name: string, domanda: any = '') { + const userStore = useUserStore() + + $q.dialog({ + message: domanda ? domanda : t('circuit.domanda_remove', { username }), + ok: { label: t('dialog.yes'), push: true }, + cancel: { label: t('dialog.cancel') }, + title: t('db.domanda') + }).onOk(() => { + + userStore.setCircuitCmd($q, t, username, name, shared_consts.CIRCUITCMD.REMOVE_FROM_MYLIST, null).then((res) => { + if (res) { + if (userStore.my.profile.listUserAccounts) { + userStore.my.profile.listUserAccounts = userStore.my.profile.listUserAccounts.filter((rec: IAccount) => rec.name !== name) + tools.showPositiveNotif($q, t('circuit.removed')) + } + } + }) + }) + }, + + DeleteCircuit($q: any, username: string, name: string, domanda: any = '') { + const userStore = useUserStore() + + $q.dialog({ + message: domanda ? domanda : t('db.domanda_removerecord', { name }), + ok: { label: t('dialog.yes'), push: true }, + cancel: { label: t('dialog.cancel') }, + title: t('db.domanda') + }).onOk(() => { + + userStore.setCircuitCmd($q, t, username, name, shared_consts.CIRCUITCMD.DELETE, null).then((res) => { + if (res) { + if (userStore.my.profile.manage_mycircuits) { + userStore.my.profile.manage_mycircuits = userStore.my.profile.manage_mycircuits.filter((rec: ICircuit) => rec.name !== name) + tools.showPositiveNotif($q, t('circuit.deleted', { name } )) + } + } + }) + }) + }, + + + iCanShowCircuitsMember(circuit: ICircuit) { + + /* if (grp && grp.visibility!.includes(shared_consts.Visibility_Group.PRIVATE)) { + // Only if I am part of this group + return this.iAmPartOfThisGroup(grp) + } */ + + return true + + }, + iAmAdminCircuit(name: string) { const userStore = useUserStore() @@ -5358,6 +5480,12 @@ export const tools = { tools.refuseReqFriends($q, username, dest) } else if (cmd === shared_consts.FRIENDSCMD.CANCEL_REQ_FRIEND) { tools.cancelReqFriends($q, username, dest) + } else if (cmd === shared_consts.CIRCUITCMD.SET) { + tools.addToMyCircuits($q, username, dest) + } else if (cmd === shared_consts.CIRCUITCMD.REQ) { + tools.setRequestCircuit($q, username, dest, value) + } else if (cmd === shared_consts.CIRCUITCMD.DELETE) { + tools.DeleteCircuit($q, username, dest) } }, isCallable(anything: any) { @@ -5656,29 +5784,32 @@ export const tools = { }, getToByCol(col: IColGridTable, table: string, rec: any) { - if (shared_consts.TABLES_REC_ID.includes(table)) { - return '/' + tools.getDirectoryByTable(table) + '/' + rec['_id'] - } else if (table === toolsext.TABMYGROUPS) { - return '/grp/' + rec.groupname - } else if (table === toolsext.TABCIRCUITS) { - return '/circuit/' + rec.name - } - - return '' + return this.getPathByTableAndRec(table, rec) }, getPathByGroup(grp: any, table: string) { return '/' + tools.getDirectoryByTable(table) + '/' + grp.groupname }, - getPathByCircuit(grp: any, table: string) { - return '/' + tools.getDirectoryByTable(table) + '/' + grp.name + getPathByCircuit(circuit: any, table: string) { + return '/' + tools.getDirectoryByTable(table) + '/' + circuit.path }, getPathByTable(table: string, pagename: string) { return '/' + tools.getDirectoryByTable(table) + '/' + pagename }, + getPathByTableAndRec(table: string, rec: any) { + if (shared_consts.TABLES_REC_ID.includes(table)) { + return '/' + tools.getDirectoryByTable(table) + '/' + rec['_id'] + } else if (table === toolsext.TABMYGROUPS) { + return this.getPathByGroup(rec, table) + } else if (table === toolsext.TABCIRCUITS) { + return this.getPathByCircuit(rec, table) + } + return '' + }, + getAportadorSolidario() { const userStore = useUserStore() return userStore.my ? userStore.my.aportador_solidario : '' diff --git a/src/store/UserStore.ts b/src/store/UserStore.ts index 8db81120..f38143b6 100755 --- a/src/store/UserStore.ts +++ b/src/store/UserStore.ts @@ -212,16 +212,6 @@ export const useUserStore = defineStore('UserStore', { return false }, - IsMyCircuitByGroupname(mycircuit: string): boolean { - - /*if (this.my.profile.mycircuit) - return this.my.profile.mycircuit.findIndex((rec) => rec.name === name) >= 0 - else - return false - - */ - }, - IsAskedFriendByUsername(username: string): boolean { if (this.my.profile.asked_friends) return this.my.profile.asked_friends.findIndex((rec) => rec.username === username) >= 0 @@ -297,6 +287,32 @@ export const useUserStore = defineStore('UserStore', { return '' }, + + IsAskedCircuitByName(groupname: string): boolean { + if (this.my.profile.asked_circuits) + return this.my.profile.asked_circuits.findIndex((rec: IMyGroup) => rec.groupname === groupname) >= 0 + else + return false + }, + + + IsMyCircuitByName(name: string): boolean { + + if (this.my.profile.manage_mycircuits) + return this.my.profile.manage_mycircuits.findIndex((rec: ICircuit) => rec.name === name) >= 0 + else + return false + + }, + + IsRefusedCircuitByName(name: string): boolean { + if (this.my.profile.refused_circuits) + return this.my.profile.refused_circuits.findIndex((rec: ICircuit) => rec.name === name) >= 0 + else + return false + }, + + getImgByCircuit(circ: ICircuit): string { try { @@ -1092,9 +1108,9 @@ export const useUserStore = defineStore('UserStore', { }, - async loadCIrcuit(name: string, idnotif: string) { + async loadCIrcuit(path: string, idnotif: string) { const data = { - name, + path, idnotif, } @@ -1194,6 +1210,18 @@ export const useUserStore = defineStore('UserStore', { }, + async setCircuitCmd($q: any, t: any, usernameOrig: string, name: string, cmd: number, value: any) { + return Api.SendReq('/users/circuits/cmd', 'POST', { usernameOrig, name, cmd, value }) + .then((res) => { + this.updateTables = true + return res.data + }).catch((error) => { + tools.showNegativeNotif($q, t('db.recfailed')) + return {} + }) + + }, + async sendMsgToBotTelegram($q: any, t: any, mydata: IMsgGlobParam, showmsgsent: boolean) { return Api.SendReq('/users/mgt', 'POST', { mydata }) .then((res) => { diff --git a/src/views/user/mycircuit/mycircuit.ts b/src/views/user/mycircuit/mycircuit.ts index 90528618..6ccaf430 100755 --- a/src/views/user/mycircuit/mycircuit.ts +++ b/src/views/user/mycircuit/mycircuit.ts @@ -35,7 +35,7 @@ export default defineComponent({ const animation = ref('fade') - const name = computed(() => $route.params.name ? $route.params.name.toString() : '') + const path = computed(() => $route.params.path ? $route.params.path.toString() : '') const idnotif = computed(() => $route.query.idnotif ? $route.query.idnotif.toString() : '') const filtroutente = ref([]) @@ -58,6 +58,11 @@ export default defineComponent({ const cities = ref([]) + watch(() => path.value, (to: any, from: any) => { + loadCircuit() + }) + + function profile() { return userStore.my.profile } @@ -68,12 +73,11 @@ export default defineComponent({ async function loadCircuit() { // Carica il profilo di quest'utente - if (name.value) { - await userStore.loadCIrcuit(name.value, idnotif.value).then(({ data, status }: {data: any, status: number}) => { + if (path.value) { + await userStore.loadCIrcuit(path.value, idnotif.value).then(({ data, status }: {data: any, status: number}) => { console.log('data', data) if (data) { circuit.value = data.circuit - cities.value = data.cities notifStore.setAsRead(idnotif.value) users_in_circuit.value = data.users_in_circuit } else { @@ -90,23 +94,18 @@ export default defineComponent({ } } - watch(() => name.value, (to: any, from: any) => { - loadCircuit() - }) - async function mounted() { loading.value = true await loadCircuit() searchList.value = [] - filtercustom.value = [{ 'profile.mycircuits': { $elemMatch: {name: {$eq: name.value }} } } ] + filtercustom.value = [{ 'profile.listUserAccounts': { $elemMatch: {circuitId: {$eq: path.value }} } } ] arrfilterand.value = [] filtercustom_rich.value = [] - //++TODO: sistemare la filtercustom ... richieste... } - function getImgGrp() { + function getImgCircuit() { if (circuit.value) return userStore.getImgByCircuit(circuit.value) else @@ -157,7 +156,8 @@ export default defineComponent({ function extraparams_refused() { return { - + querytype: shared_consts.QUERYTYPE_REFUSED_USER_CIRCUIT, + myid: circuit.value ? circuit.value._id : '', } } @@ -181,7 +181,7 @@ export default defineComponent({ costanti, circuit, shared_consts, - getImgGrp, + getImgCircuit, checkifShow, filtroutente, diff --git a/src/views/user/mycircuit/mycircuit.vue b/src/views/user/mycircuit/mycircuit.vue index 5abc5e3c..ace4be7f 100755 --- a/src/views/user/mycircuit/mycircuit.vue +++ b/src/views/user/mycircuit/mycircuit.vue @@ -8,7 +8,7 @@ Occorre prima registrarsi alla App
-

Gruppo non Esistente

+

Circuito non Esistente

@@ -18,19 +18,16 @@
-
+
- +
- {{ circuit.title }} -
-
- {{ circuit.name }} + {{ circuit.name }}
- {{ $t('circuits.exit_circuit') }} + {{ $t('circuit.exit_circuit') }} - + - {{ $t('circuits.delete_circuit') }} + {{ $t('circuit.delete') }} @@ -80,13 +77,13 @@
-
+
- - + + - + :label="t('shared.subscribes')" name="members" icon="fas fa-users"> @@ -112,66 +108,33 @@
-
{{ t('circuits.info') }}
+
{{ t('circuit.info') }}
-
+
- {{ $t('circuits.createdby', { + {{ $t('circuit.createdby', { username: circuit.createdBy, date: tools.getstrDateYY(circuit.date_created), }) }}
- {{ $t('circuits.lastmodify', { + {{ $t('circuit.lastmodify', { date: tools.getstrDateYY(circuit.date_updated), }) }}
-
-
- -
-
-
{{ $t('circuits.private') }}
- {{ $t('circuits.private_descr') }} -
-
- -
-
- -
-
-
{{ $t('circuits.hidden') }}
- {{ $t('circuits.hidden_descr') }} -
-
- -
-
- -
-
-
-
- {{ city.comune }} ({{ city.prov }}) -
-
-
-
-
- {{ numUsers() }} {{ numUsers() === 1 ? t('circuits.member') : t('circuits.members') }} + {{ numUsers() }} {{ numUsers() === 1 ? t('circuit.member') : t('shared.members') }}
- {{ numAdmins() }} {{ numAdmins() === 1 ? t('circuits.admin') : t('circuits.admins') }} + {{ numAdmins() }} {{ numAdmins() === 1 ? t('circuit.admin') : t('shared.admins') }}
- +
Descrizione:
@@ -196,30 +159,6 @@
{{ circuit.longdescr }}
- -
- - - - -
-
- - -
-
@@ -235,17 +174,6 @@
- - Scegli il Circuito - - circuit.circuits_list {{circuit.circuits_list}} - - Mostra la lista dei Circuiti Esistenti - (come la lista gruppi, in formato scheda) - con possibilità di aggiungerli ai gruppi in cui sei Admin - - -
@@ -100,10 +100,10 @@ --> - + + :label="t('shared.subscribes')" name="members" icon="fas fa-users"> @@ -167,11 +167,11 @@
- {{ numUsers() }} {{ numUsers() === 1 ? t('groups.member') : t('groups.members') }} + {{ numUsers() }} {{ numUsers() === 1 ? t('groups.member') : t('shared.members') }}
- {{ numAdmins() }} {{ numAdmins() === 1 ? t('groups.admin') : t('groups.admins') }} + {{ numAdmins() }} {{ numAdmins() === 1 ? t('groups.admin') : t('shared.admins') }}