From 865e1ad7383fc47920b341cd61a50eaf0d095d97 Mon Sep 17 00:00:00 2001 From: Surya Paolo Date: Fri, 6 Jan 2023 15:51:58 +0100 Subject: [PATCH] strette di mano --- .env.development | 2 +- .env.example.production | 2 +- _ALL_SITES/riso.app/.env.development | 2 +- _ALL_SITES/riso.app/.env.production | 2 +- .../terradellavisione.app/.env.development | 2 +- package.json | 1 + quasar.conf.js | 21 +- src/boot/timeago.ts | 7 + src/common/shared_vuejs.ts | 14 ++ .../CGridTableRec/CGridTableRec.vue | 2 +- src/components/CMyActivities/CMyActivities.ts | 4 +- .../CMyActivities/CMyActivities.vue | 2 +- src/components/CMyCircuit/CMyCircuit.ts | 2 +- src/components/CMyFriends/CMyFriends.ts | 25 +++ src/components/CMyUser/CMyUser.vue | 51 ++++- src/components/CStatusReg/CStatusReg.ts | 3 +- src/components/CStatusReg/CStatusReg.vue | 46 +++-- src/components/CTimeAgo/CTimeAgo.scss | 0 src/components/CTimeAgo/CTimeAgo.ts | 41 ++++ src/components/CTimeAgo/CTimeAgo.vue | 19 ++ src/components/CTimeAgo/index.ts | 1 + .../toolbar/coinsPopover/coinsPopover.ts | 3 +- .../toolbar/coinsPopover/coinsPopover.vue | 3 +- .../toolbar/notifPopover/notifPopover.ts | 3 +- .../toolbar/notifPopover/notifPopover.vue | 22 ++- src/mixins/mixin-users.ts | 13 ++ src/model/GlobalStore.ts | 2 + src/model/UserStore.ts | 3 + src/rootgen/admin/confsite/confsite.vue | 20 ++ src/statics/lang/it.js | 31 ++- src/store/Modules/costanti.ts | 4 + src/store/Modules/tools.ts | 184 ++++++++++++++---- src/store/UserStore.ts | 33 ++++ src/store/globalStore.ts | 2 + src/views/user/myprofile/myprofile.ts | 12 +- src/views/user/myprofile/myprofile.vue | 127 +++++++++++- yarn.lock | 9 +- 37 files changed, 644 insertions(+), 76 deletions(-) create mode 100755 src/boot/timeago.ts create mode 100755 src/components/CTimeAgo/CTimeAgo.scss create mode 100755 src/components/CTimeAgo/CTimeAgo.ts create mode 100755 src/components/CTimeAgo/CTimeAgo.vue create mode 100755 src/components/CTimeAgo/index.ts diff --git a/.env.development b/.env.development index aa728c17..c9a03654 100755 --- a/.env.development +++ b/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="0.5.51" +APP_VERSION="0.5.53" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL="newfreeplanet" diff --git a/.env.example.production b/.env.example.production index 4944e77a..862f4f6c 100755 --- a/.env.example.production +++ b/.env.example.production @@ -1,4 +1,4 @@ -APP_VERSION="0.5.51" +APP_VERSION="0.5.53" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL=newfreeplanet diff --git a/_ALL_SITES/riso.app/.env.development b/_ALL_SITES/riso.app/.env.development index aa728c17..c9a03654 100755 --- a/_ALL_SITES/riso.app/.env.development +++ b/_ALL_SITES/riso.app/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="0.5.51" +APP_VERSION="0.5.53" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL="newfreeplanet" diff --git a/_ALL_SITES/riso.app/.env.production b/_ALL_SITES/riso.app/.env.production index 27566e35..589bee93 100644 --- a/_ALL_SITES/riso.app/.env.production +++ b/_ALL_SITES/riso.app/.env.production @@ -1,4 +1,4 @@ -APP_VERSION="0.5.51" +APP_VERSION="0.5.53" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL=newfreeplanet diff --git a/_ALL_SITES/terradellavisione.app/.env.development b/_ALL_SITES/terradellavisione.app/.env.development index f17cd9e9..37ae5648 100755 --- a/_ALL_SITES/terradellavisione.app/.env.development +++ b/_ALL_SITES/terradellavisione.app/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="0.5.51" +APP_VERSION="0.5.53" SERVICE_WORKER_FILE="service-worker.js" APP_ID="14" DIRECTORY_LOCAL="newfreeplanet" diff --git a/package.json b/package.json index bc87fc54..e1feeb46 100755 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "vue-scroll-reveal": "^1.0.11", "vue-social-sharing": "^4.0.0-alpha4", "vue-svgicon": "^4.0.0-alpha.3", + "vue-timeago3": "^2.3.0", "vue2-dragula": "^2.5.5", "vuex": "^4.1.0", "vuex-router-sync": "^6.0.0-rc.1" diff --git a/quasar.conf.js b/quasar.conf.js index 274ad772..939c6cdd 100755 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -37,7 +37,7 @@ module.exports = configure((ctx) => ({ // --> boot files are part of "main.js" // https://v2.quasar.dev/quasar-cli/boot-files // boot: ['vue-i18n', 'vue-meta', 'axios', 'vee-validate', 'myconfig', 'local-storage', 'error-handler', 'globalroutines', 'vue-idb', 'dragula', 'guard'], - boot: ['i18n', 'axios', 'vee-validate', 'myconfig', 'local-storage', 'error-handler', 'globalroutines', 'calendar', 'social-sharing'], + boot: ['i18n', 'axios', 'vee-validate', 'myconfig', 'local-storage', 'error-handler', 'globalroutines', 'calendar', 'social-sharing', 'timeago'], // https://v2.quasar.dev/quasar-cli/quasar-conf-js#Property%3A-css css: [ @@ -238,8 +238,7 @@ module.exports = configure((ctx) => ({ 'Ripple', 'ClosePopup', ], - // Quasar plugins - plugins: [ + _plugins: [ 'Meta', 'Dialog', 'Notify', @@ -247,13 +246,25 @@ module.exports = configure((ctx) => ({ 'Loading', 'AppVisibility', ], + get plugins_1() { + return this._plugins; + }, + set plugins_1(value) { + this._plugins = value; + }, + get plugins() { + return this._plugins; + }, + set plugins(value) { + this._plugins = value; + }, iconSet: 'fontawesome-v5', lang: 'it', // Quasar language }, - // animations: 'all', // --- includes all animations + animations: 'all', // --- includes all animations // https://v2.quasar.dev/options/animations - animations: [], + // animations: [], // https://v2.quasar.dev/quasar-cli/developing-ssr/configuring-ssr ssr: { diff --git a/src/boot/timeago.ts b/src/boot/timeago.ts new file mode 100755 index 00000000..6f7ab976 --- /dev/null +++ b/src/boot/timeago.ts @@ -0,0 +1,7 @@ +//@ts-ignore +import timeago from 'vue-timeago3' +import { boot } from 'quasar/wrappers' + +export default boot(({ app }) => { + app.use(timeago) +}) diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index fddd26cd..aa7c4e49 100755 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -96,10 +96,15 @@ export const shared_consts = { FRIENDSCMD: { SETTRUST: 121, REQFRIEND: 125, + REQHANDSHAKE: 128, SETFRIEND: 132, + SETHANDSHAKE: 133, REMOVE_FROM_MYFRIENDS: 144, REFUSE_REQ_FRIEND: 145, CANCEL_REQ_FRIEND: 146, + REMOVE_FROM_MYHANDSHAKE: 147, + REFUSE_REQ_HANDSHAKE: 148, + CANCEL_REQ_HANDSHAKE: 149, BLOCK_USER: 155, UNBLOCK_USER: 156, REPORT_USER: 158, @@ -997,6 +1002,9 @@ export const shared_consts = { StatusNotifs: { STATUS_FRIENDS_ACCEPTED: 1, STATUS_FRIENDS_REFUSED: 2, + STATUS_FRIENDS_REPORTED: 3, + STATUS_HANDSHAKE_ACCEPTED: 10, + STATUS_HANDSHAKE_REFUSED: 11, }, GroupsNotifs: { @@ -1063,6 +1071,12 @@ export const shared_consts = { TYPEDIR_MSGS: 7, ID_MSGS_NEW_REC: 1, + TYPEDIR_HANDSHAKE: 10, + ID_HANDSHAKE_NEW_REC: 1, + ID_HANDSHAKE_ACCEPTED: 2, + ID_HANDSHAKE_REFUSED: 4, + ID_HANDSHAKE_ACCEPTED_MY_REQUEST: 8, + TYPEDIR_TEST: 444, ID_TEST_NEW_REC: 1, }, diff --git a/src/components/CGridTableRec/CGridTableRec.vue b/src/components/CGridTableRec/CGridTableRec.vue index 2679088a..5b432b56 100755 --- a/src/components/CGridTableRec/CGridTableRec.vue +++ b/src/components/CGridTableRec/CGridTableRec.vue @@ -1044,7 +1044,7 @@ diff --git a/src/components/CMyActivities/CMyActivities.ts b/src/components/CMyActivities/CMyActivities.ts index 172f14c4..030e1f43 100755 --- a/src/components/CMyActivities/CMyActivities.ts +++ b/src/components/CMyActivities/CMyActivities.ts @@ -9,6 +9,7 @@ import { CDateTime } from '@/components/CDateTime' import { CMyGroup } from '@/components/CMyGroup' import { CMyCircuit } from '@/components/CMyCircuit' import { CNotifAtTop } from '@src/components/CNotifAtTop' +import { CTimeAgo } from '@src/components/CTimeAgo' import { CSendCoins } from '@/components/CSendCoins' import { CMyUser } from '@/components/CMyUser' import { CCheckIfIsLogged } from '@/components/CCheckIfIsLogged' @@ -34,7 +35,8 @@ export default defineComponent({ name: 'CMyActivities', components: { CProfile, CTitleBanner, CMyFieldDb, CSkill, CDateTime, CCopyBtn, CUserNonVerif, CMyFieldRec, CMyUser, - CMyGroup, CLabel, CMyCircuit, CSendCoins, CNotifAtTop, CCheckIfIsLogged + CMyGroup, CLabel, CMyCircuit, CSendCoins, CNotifAtTop, CCheckIfIsLogged, + CTimeAgo }, props: { }, diff --git a/src/components/CMyActivities/CMyActivities.vue b/src/components/CMyActivities/CMyActivities.vue index e91d7204..2f8466a3 100755 --- a/src/components/CMyActivities/CMyActivities.vue +++ b/src/components/CMyActivities/CMyActivities.vue @@ -53,7 +53,7 @@
- OnLine: {{ tools.timeAgo(myuser.lasttimeonline) }} + OnLine:
diff --git a/src/components/CMyCircuit/CMyCircuit.ts b/src/components/CMyCircuit/CMyCircuit.ts index 7a21ca12..91d5c172 100755 --- a/src/components/CMyCircuit/CMyCircuit.ts +++ b/src/components/CMyCircuit/CMyCircuit.ts @@ -79,7 +79,7 @@ export default defineComponent({ // @ts-ignore const rectofind = circuitStore.listcircuits.find((circ: ICircuit) => circ.name === circuit.value.circuitname!) if (rectofind) { - console.log('rectofind', rectofind) + // console.log('rectofind', rectofind) circuit.value = rectofind } } diff --git a/src/components/CMyFriends/CMyFriends.ts b/src/components/CMyFriends/CMyFriends.ts index c4cf7a08..0f77649c 100755 --- a/src/components/CMyFriends/CMyFriends.ts +++ b/src/components/CMyFriends/CMyFriends.ts @@ -73,8 +73,14 @@ export default defineComponent({ arr = userStore.my.profile.friends } else if (props.modelValue === costanti.REQ_FRIENDS) { arr = userStore.my.profile.req_friends + } else if (props.modelValue === costanti.HANDSHAKE) { + arr = userStore.my.profile.handshake + } else if (props.modelValue === costanti.REQ_HANDSHAKE) { + arr = userStore.my.profile.req_handshake } else if (props.modelValue === costanti.ASK_SENT_FRIENDS) { arr = userStore.my.profile.asked_friends + } else if (props.modelValue === costanti.ASK_SENT_HANDSHAKE) { + arr = userStore.my.profile.asked_handshake } else if (props.modelValue === costanti.ASK_TRUST) { arr = listTrusted.value.filter((user: IUserFields) => user.verified_by_aportador === undefined) } else if (props.modelValue === costanti.TRUSTED) { @@ -101,6 +107,15 @@ export default defineComponent({ label: t('mypages.request_friends') + ' (' + numReqFriends.value + ')', value: costanti.REQ_FRIENDS }) + if (numHandShake.value > 0 || props.modelValue === costanti.HANDSHAKE) + mybutt.push({ label: t('mypages.handshake') + ' (' + numHandShake.value + ')', value: costanti.HANDSHAKE }) + + if (numReqHandShake.value > 0 || props.modelValue === costanti.REQ_HANDSHAKE) + mybutt.push({ + label: t('mypages.requesthandshake') + ' (' + numReqHandShake.value + ')', + value: costanti.REQ_HANDSHAKE + }) + if (numAskSentFriends.value > 0 || props.modelValue === costanti.ASK_SENT_FRIENDS) mybutt.push({ label: t('mypages.request_sent') + ' (' + numAskSentFriends.value + ')', @@ -121,11 +136,21 @@ export default defineComponent({ return (arr) ? arr.length : 0 }) + const numHandShake = computed(() => { + const arr = userStore.my.profile.handshake + return (arr) ? arr.length : 0 + }) + const numReqFriends = computed(() => { const arr = userStore.my.profile.req_friends return (arr) ? arr.length : 0 }) + const numReqHandShake = computed(() => { + const arr = userStore.my.profile.req_handshake + return (arr) ? arr.length : 0 + }) + const numAskSentFriends = computed(() => { const arr = userStore.my.profile.asked_friends return (arr) ? arr.length : 0 diff --git a/src/components/CMyUser/CMyUser.vue b/src/components/CMyUser/CMyUser.vue index d225efb0..8c94772c 100755 --- a/src/components/CMyUser/CMyUser.vue +++ b/src/components/CMyUser/CMyUser.vue @@ -83,6 +83,25 @@ + + + + + + + {{ $t('friends.accept_handshake') }} + + + + + {{ $t('friends.reject_ask_handshake') }} + + + + + + @@ -253,11 +272,15 @@ - - + {{ $t('friends.ask_friend') }} + + {{ $t('handshake.ask_handshake') }} + {{ $t('friends.remove_from_myfriends') }} + + + + + + {{ $t('handshake.ask_handshake') }} + + + + + + {{ $t('handshake.cancel_ask_handshake') }} + + + + + + {{ $t('handshake.remove_from_myhandshake') }} + + diff --git a/src/components/CStatusReg/CStatusReg.ts b/src/components/CStatusReg/CStatusReg.ts index c9ae1a37..a2dcd7f9 100755 --- a/src/components/CStatusReg/CStatusReg.ts +++ b/src/components/CStatusReg/CStatusReg.ts @@ -6,6 +6,7 @@ import { import { INotData } from '../../model/index' import MixinBase from '@src/mixins/mixin-base' import { CTitleBanner } from '@/components/CTitleBanner' +import { CTimeAgo } from '@/components/CTimeAgo' import { CCardState } from '../CCardState' import { CMyFieldRec } from '../CMyFieldRec' import { CElemStat } from '../CElemStat' @@ -28,7 +29,7 @@ export default defineComponent({ name: 'CStatusReg', props: {}, components: { CTitleBanner, CElemStat, - CCardState, CCardStat, CLineChart, CMyFieldRec }, + CCardState, CCardStat, CLineChart, CMyFieldRec, CTimeAgo }, setup(props, { attrs, slots, emit }) { const { t } = useI18n() const $q = useQuasar() diff --git a/src/components/CStatusReg/CStatusReg.vue b/src/components/CStatusReg/CStatusReg.vue index 1cb6a5a7..f8b76abb 100755 --- a/src/components/CStatusReg/CStatusReg.vue +++ b/src/components/CStatusReg/CStatusReg.vue @@ -147,9 +147,17 @@ tools.getUserNameOnlyIfToShow(user) }} - {{ - tools.timeAgo(user.lasttimeonline) - }} + +
+ +
+
@@ -157,9 +165,13 @@
-
Aiuta RISO a crescere
-
Condividi il tuo link d'invito, alimentando nuovi ingressi alla RETE Solidale di RISO. -
+
+ Aiuta RISO a crescere +
+
+ Condividi il tuo link d'invito, alimentando nuovi ingressi + alla RETE Solidale di RISO. +
{{ - user.count - }}
{{ user.count }} +
@@ -211,9 +226,12 @@
-
Registrati con questi invitanti:
-
Cliccare sulla persona per procedere alla registrazione -
+
+ Registrati con questi invitanti: +
+
+ Cliccare sulla persona per procedere alla registrazione +
+ > diff --git a/src/components/CTimeAgo/CTimeAgo.scss b/src/components/CTimeAgo/CTimeAgo.scss new file mode 100755 index 00000000..e69de29b diff --git a/src/components/CTimeAgo/CTimeAgo.ts b/src/components/CTimeAgo/CTimeAgo.ts new file mode 100755 index 00000000..4527bce0 --- /dev/null +++ b/src/components/CTimeAgo/CTimeAgo.ts @@ -0,0 +1,41 @@ +import { defineComponent, ref, computed, PropType, toRef, onMounted } from 'vue' +import { useUserStore } from '@store/UserStore' +import { useRouter } from 'vue-router' +import { useGlobalStore } from '@store/globalStore' +import { useI18n } from '@/boot/i18n' +import { tools } from '@store/Modules/tools' +import { toolsext } from '@store/Modules/toolsext' + +import { es, it, enUS } from 'date-fns/locale' // import custom locale + +export default defineComponent({ + name: 'CTimeAgo', + components: {}, + props: { + datetime: { + type: String, + required: true + }, + }, + + setup(props, { emit }) { + + const mylocale = ref(null) + + function mounted() { + mylocale.value = enUS + if (toolsext.getLocale() === 'it') + mylocale.value = it + else if (toolsext.getLocale() === 'es') + mylocale.value = es + } + + mounted() + + return { + tools, + toolsext, + mylocale, + } + } +}) diff --git a/src/components/CTimeAgo/CTimeAgo.vue b/src/components/CTimeAgo/CTimeAgo.vue new file mode 100755 index 00000000..4a759ae0 --- /dev/null +++ b/src/components/CTimeAgo/CTimeAgo.vue @@ -0,0 +1,19 @@ + + + + + diff --git a/src/components/CTimeAgo/index.ts b/src/components/CTimeAgo/index.ts new file mode 100755 index 00000000..7ccaa8e3 --- /dev/null +++ b/src/components/CTimeAgo/index.ts @@ -0,0 +1 @@ +export {default as CTimeAgo} from './CTimeAgo.vue' diff --git a/src/layouts/toolbar/coinsPopover/coinsPopover.ts b/src/layouts/toolbar/coinsPopover/coinsPopover.ts index 26890a12..bb0aeef4 100755 --- a/src/layouts/toolbar/coinsPopover/coinsPopover.ts +++ b/src/layouts/toolbar/coinsPopover/coinsPopover.ts @@ -16,6 +16,7 @@ import { useUserStore } from '@store/UserStore' import { CTitleBanner } from '@/components/CTitleBanner' import { CMyFieldRec } from '@/components/CMyFieldRec' +import { CTimeAgo } from '@/components/CTimeAgo' import { CMyFieldDb } from '@/components/CMyFieldDb' import { CMyCircuits } from '@/components/CMyCircuits' import { CFinder } from '@/components/CFinder' @@ -28,7 +29,7 @@ import { useGlobalStore } from '@store/globalStore' export default defineComponent({ name: 'coinsPopover', - components: { CTitleBanner, CMyFieldRec, CMyFieldDb, CMyCircuits, CFinder }, + components: { CTitleBanner, CMyFieldRec, CTimeAgo, CMyFieldDb, CMyCircuits, CFinder }, emits: ['update:modelValue'], props: { modelValue: { diff --git a/src/layouts/toolbar/coinsPopover/coinsPopover.vue b/src/layouts/toolbar/coinsPopover/coinsPopover.vue index 8b730493..3a29529a 100755 --- a/src/layouts/toolbar/coinsPopover/coinsPopover.vue +++ b/src/layouts/toolbar/coinsPopover/coinsPopover.vue @@ -151,7 +151,8 @@ - {{ tools.timeAgo(notif.datenotif) }} + + diff --git a/src/layouts/toolbar/notifPopover/notifPopover.ts b/src/layouts/toolbar/notifPopover/notifPopover.ts index 8e83225f..686d9174 100755 --- a/src/layouts/toolbar/notifPopover/notifPopover.ts +++ b/src/layouts/toolbar/notifPopover/notifPopover.ts @@ -16,6 +16,7 @@ import { useGlobalStore } from '@store/globalStore' import { useUserStore } from '@store/UserStore' import { CTitleBanner } from '@/components/CTitleBanner' +import { CTimeAgo } from '@/components/CTimeAgo' import { CMyFieldRec } from '@/components/CMyFieldRec' import { CMyFieldDb } from '@/components/CMyFieldDb' import { shared_consts } from '@/common/shared_vuejs' @@ -26,7 +27,7 @@ import { waitAndcheckPendingNotif } from '../../../store/Modules/ApiTables' export default defineComponent({ name: 'notifPopover', - components: { CTitleBanner, CMyFieldRec, CMyFieldDb }, + components: { CTitleBanner, CMyFieldRec, CMyFieldDb, CTimeAgo }, emits: ['update:modelValue'], props: { modelValue: { diff --git a/src/layouts/toolbar/notifPopover/notifPopover.vue b/src/layouts/toolbar/notifPopover/notifPopover.vue index 0428f0ca..5d6c0d59 100755 --- a/src/layouts/toolbar/notifPopover/notifPopover.vue +++ b/src/layouts/toolbar/notifPopover/notifPopover.vue @@ -113,6 +113,26 @@ />
+ +
+ + +
+
@@ -137,7 +157,7 @@ - {{ tools.timeAgo(notif.datenotif) }} + diff --git a/src/mixins/mixin-users.ts b/src/mixins/mixin-users.ts index 5f4d82fb..69602323 100755 --- a/src/mixins/mixin-users.ts +++ b/src/mixins/mixin-users.ts @@ -174,6 +174,19 @@ export default function () { descr += '( ' + $t('movement.causal') + ': ' + notif.extrarec.causal + ')' } } + } else if (notif.typedir === shared_consts.TypeNotifs.TYPEDIR_HANDSHAKE) { + if (notif.status === shared_consts.StatusNotifs.STATUS_HANDSHAKE_ACCEPTED) { + descr += '
' + $t('handshake.accepted') + '' + } else if (notif.status === shared_consts.StatusNotifs.STATUS_HANDSHAKE_REFUSED) { + descr += '
' + $t('handshake.refused') + '' + } + } else if (notif.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS) { + if (notif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ) { + // console.log('notif.extrarec', notif.extrarec) + if (notif.extrarec && notif.extrarec.hasOwnProperty('causal') && notif.extrarec.causal) { + descr += '( ' + $t('movement.causal') + ': ' + notif.extrarec.causal + ')' + } + } } else if (notif.typedir === shared_consts.TypeNotifs.TYPEDIR_GROUPS) { if (notif.status === shared_consts.GroupsNotifs.STATUS_GROUPS_ACCEPTED) { descr += '
' + $t('groups.accepted') + '' diff --git a/src/model/GlobalStore.ts b/src/model/GlobalStore.ts index 119fd00d..413dda10 100755 --- a/src/model/GlobalStore.ts +++ b/src/model/GlobalStore.ts @@ -248,6 +248,8 @@ export interface IConfPages { showViewProfile: boolean enablePwa: boolean lang: number + videoPromo: string + PDFPromo: string } export interface IContacts { facebook: string diff --git a/src/model/UserStore.ts b/src/model/UserStore.ts index ea0b84b9..62e14b52 100755 --- a/src/model/UserStore.ts +++ b/src/model/UserStore.ts @@ -96,6 +96,8 @@ export interface IUserProfile { myshares: IShareWithUs[] friends: IFriends[] req_friends: IFriends[] + handshake: IFriends[] + req_handshake: IFriends[] mygroups: IMyGroup[] mycircuits: IMyCircuit[] manage_mygroups: IMyGroup[] @@ -108,6 +110,7 @@ export interface IUserProfile { // in memory asked_friends: any[] + asked_handshake: any[] asked_groups: IGroupShort[] refused_groups: IGroupShort[] list_usersgroup?: IFriends[] diff --git a/src/rootgen/admin/confsite/confsite.vue b/src/rootgen/admin/confsite/confsite.vue index 3cd5b1bb..f396590e 100755 --- a/src/rootgen/admin/confsite/confsite.vue +++ b/src/rootgen/admin/confsite/confsite.vue @@ -664,6 +664,16 @@ :type="costanti.FieldType.boolean" > + +
+ +
diff --git a/src/statics/lang/it.js b/src/statics/lang/it.js index 49bf466a..5f2b642b 100755 --- a/src/statics/lang/it.js +++ b/src/statics/lang/it.js @@ -209,11 +209,14 @@ const msg_it = { duplicatedrecord: 'Vuoi Duplicare il record', recdupfailed: 'Errore durante la duplicazione del Record', friendsadded: 'Aggiunto alla lista di Amici', + handshakesadded: 'Aggiunto alla lista Strette di Mano', domanda_removefriend: 'Rimuovi dagli Amici {username}?', + domanda_removehandshake: 'Rimuovi dalla lista Strette di Mano {username}?', domanda_exit_fromgroup: 'Uscire dal Gruppo {groupname} ?', 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', + removedhandshake: 'Rimosso dalla lista Strette di Mano', addedtoadmin: 'Aggiunto {username} come amministratore', removedtoadmin: 'Rimosso {username} come amministratore', refusedgroup: 'Rifiutato a {username} la richiesta di entrare nel Gruppo', @@ -223,23 +226,32 @@ const msg_it = { insertgoodorservices_to_enter_circuit: 'Per poter entrare nel Circuito è necessario aggiungere almeno un Bene, Servizio o offrire Ospitalità', deletedgroup: 'Gruppo Eliminato', domanda_addtofriend: 'Aggiungere agli amici {username}?', + domanda_addtohandshake: 'Hai stretto la mano a {username}?', + addtohandshake: 'Hai stretto la mano a {username}', domanda_addtogroup: 'Aggiungi {username} al gruppo {groupname}?', domanda_addtocircuit: 'Aggiungi {username} al Circuito {circuitname}?', addedfriend: 'Aggiunto alla lista di Amici', + addedhandshake: 'Aggiunto alla lista Strette di Mano', addedgroup: 'Aggiunto al Gruppo', addedcircuit: 'Aggiunto al Circuito {circuitname}', domanda_trusted: 'Accettare la Fiducia a {username}?', trusted: 'Accettato la Fiducia', domanda_ask_friend: 'Chiedere l\'Amicizia a {username}?', + domanda_ask_handshake: 'Chiedere di confermare la vostra Stretta di mano a {username}?', domanda_ask_group: 'Chiedere l\'invito al Gruppo {groupname}?', askedtofriend: 'Chiesto l\'Amicizia a {username}', + askedtohandshake: 'Chiesto la Stretta di mano a {username}', domanda_revoke_friend: 'Revocare la richiesta di Amicizia a {username}?', + domanda_revoke_handshake: 'Revocare la richiesta di Stretta di mano 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}', + revoketohandshake: 'Revocato la richiesta di Stretta di mano a {username}', domanda_cancel_req_friend: 'Annullare la richiesta di Amicizia a {username}?', + domanda_cancel_req_handshake: 'Annullare la richiesta di Stretta di mano 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}', + cancel_req_handshake: 'Annullata la richiesta di Stretta di mano a {username}', cancel_req_group: 'Annullata la richiesta al gruppo {groupname}', domanda_rejectedtrust: 'Rifiutare la Fiducia a {username}?', rejected: 'Rifiutato la Fiducia', @@ -1067,10 +1079,25 @@ const msg_it = { block_user: 'Blocca Utente', ask_friend: 'Chiedi l\'Amicizia', cancel_ask_friend: 'Annulla la richiesta di Amicizia', - cancel_ask_friend_short: 'Annulla richiesta', + cancel_ask_friend_short: 'Annulla rich. Amicizia', reject_ask_friend: 'Rifiuta l\'Amicizia', report_user: 'Segnala Utente', }, + handshake: { + strettedimano: 'Strette di mano', + received: 'Ricevute', + accept_trust: 'Accetta la Stretta di mano', + accepted: 'Stretta di mano Accettata', + refused: 'Stretta di mano Rifiutata', + accept: 'Accetta', + refuse: 'Rifiuta', + accept_handshake: 'Accetta la Stretta di mano', + remove_from_myhandshake: 'Rimuovi dalle Strette di mano', + ask_handshake: 'Chiedi', + cancel_ask_handshake: 'Annulla la richiesta di Stretta di mano', + cancel_ask_handshake_short: 'Annulla', + reject_ask_handshake: 'Rifiuta la Stretta di mano', + }, shared: { info1: 'Info', subscribes: 'Membri', @@ -1351,9 +1378,11 @@ const msg_it = { showViewGroups: 'Bott. Gruppi', showViewUsers: 'Bott. Users', showViewCircuits: 'Bott. Circuiti', + videoPromo: 'Video Presentazione', showViewBooking: 'Bott. Prenotaz.', showViewProfile: 'Bott. Profile', enablePwa: 'PWA', + PDFPromo: 'PDF Presentazione', }, diff --git a/src/store/Modules/costanti.ts b/src/store/Modules/costanti.ts index 751ac3dd..b820aef1 100755 --- a/src/store/Modules/costanti.ts +++ b/src/store/Modules/costanti.ts @@ -243,6 +243,10 @@ export const costanti = { FIND_GROUP: 20, MY_GROUPS: 21, USER_GROUPS: 22, + HANDSHAKE: 23, + REQ_HANDSHAKE: 24, + ASK_SENT_HANDSHAKE: 25, + CREATE_GROUP: 30, MANAGE_GROUPS: 31, ADMIN_GROUPS: 40, diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts index 5f0e7b95..2e0427df 100644 --- a/src/store/Modules/tools.ts +++ b/src/store/Modules/tools.ts @@ -3030,23 +3030,28 @@ export const tools = { }, getstrShortDate(mydate: Date | number | string | undefined) { - const DateFormatter = new Intl.DateTimeFormat(toolsext.getLocale() || void 0, { - weekday: 'long', - day: 'numeric', - month: 'short', - year: 'numeric', - // timeZone: 'UTC' - }) try { - if (DateFormatter) { - // @ts-ignore - const date1 = new Date(mydate) - return DateFormatter.format(date1) + const DateFormatter = new Intl.DateTimeFormat(toolsext.getLocale() || void 0, { + weekday: 'long', + day: 'numeric', + month: 'short', + year: 'numeric', + // timeZone: 'UTC' + }) + try { + if (DateFormatter) { + // @ts-ignore + const date1 = new Date(mydate) + return DateFormatter.format(date1) + } + return mydate + } catch (e) { + return '' } - return mydate } catch (e) { return '' } + }, getstrVeryShortDate(mydate: Date | number | string | undefined) { const DateFormatter = new Intl.DateTimeFormat(toolsext.getLocale() || void 0, { @@ -5455,6 +5460,48 @@ export const tools = { }) }, + addToMyHandShake($q: any, username: string, usernameDest: string) { + + const userStore = useUserStore() + const notifStore = useNotifStore() + $q.dialog({ + message: t('db.domanda_addtohandshake', { username: usernameDest }), + ok: { label: t('dialog.yes'), push: true }, + cancel: { label: t('dialog.cancel') }, + title: t('db.domanda') + }).onOk(() => { + + userStore.setFriendsCmd($q, t, username, usernameDest, shared_consts.FRIENDSCMD.SETHANDSHAKE, null) + .then((res: any) => { + if (res) { + notifStore.updateNotification = true + userStore.my.profile.handshake = [...userStore.my.profile.handshake, res] + userStore.my.profile.req_handshake = userStore.my.profile.req_handshake.filter((rec: IFriends) => rec.username !== usernameDest) + tools.showPositiveNotif($q, t('db.addedhandshake')) + } + }) + }) + }, + + removeFromMyHandShake($q: any, username: string, usernameDest: string) { + const userStore = useUserStore() + + $q.dialog({ + message: t('db.domanda_removehandshake', { username: usernameDest }), + ok: { label: t('dialog.yes'), push: true }, + cancel: { label: t('dialog.cancel') }, + title: t('db.domanda') + }).onOk(() => { + + userStore.setFriendsCmd($q, t, username, usernameDest, shared_consts.FRIENDSCMD.REMOVE_FROM_MYHANDSHAKE, null).then((res) => { + if (res) { + userStore.my.profile.handshake = userStore.my.profile.handshake.filter((rec: IFriends) => rec.username !== usernameDest) + tools.showPositiveNotif($q, t('db.removedhandshake')) + } + }) + }) + }, + blockUser($q: any, username: string, usernameDest: string) { const userStore = useUserStore() $q.dialog({ @@ -5525,6 +5572,27 @@ export const tools = { }) }, + refuseReqHandShake($q: any, username: string, usernameDest: string) { + + const userStore = useUserStore() + const notifStore = useNotifStore() + $q.dialog({ + message: t('db.domanda_revoke_handshake', { username: usernameDest }), + ok: { label: t('dialog.yes'), push: true }, + cancel: { label: t('dialog.cancel') }, + title: t('db.domanda') + }).onOk(() => { + + userStore.setFriendsCmd($q, t, username, usernameDest, shared_consts.FRIENDSCMD.REMOVE_FROM_MYHANDSHAKE, null).then((res) => { + if (res) { + notifStore.updateNotification = true + userStore.my.profile.req_handshake = userStore.my.profile.req_handshake.filter((user: IFriends) => user.username !== usernameDest) + tools.showPositiveNotif($q, t('db.removedhandshake')) + } + }) + }) + }, + updateMyData(res: any) { const userStore = useUserStore() const circuitStore = useCircuitStore() @@ -5805,6 +5873,49 @@ export const tools = { }) }) }, + + setRequestHandShake($q: any, username: string, usernameDest: string, value: boolean) { + + const userStore = useUserStore() + + let msg = '' + if (value) { + msg = t('db.domanda_ask_handshake', { username: usernameDest }) + } else { + msg = t('db.domanda_revoke_handshake', { username: usernameDest }) + } + + $q.dialog({ + message: msg, + ok: { + label: t('dialog.yes'), + push: true + }, + cancel: { + label: t('dialog.cancel') + }, + title: t('db.domanda') + }).onOk(() => { + + userStore.setFriendsCmd($q, t, username, usernameDest, shared_consts.FRIENDSCMD.REQHANDSHAKE, value) + .then((res: any) => { + if (res) { + if (value) { + // ADD to req HandShake + userStore.my.profile.asked_handshake.push(res) + tools.showPositiveNotif($q, t('db.askedtohandshake', { username: usernameDest })) + } else { + // REMOVE to req HandShake + userStore.my.profile.asked_handshake = userStore.my.profile.asked_handshake.filter((rec: IUserFields) => rec.username !== usernameDest) + tools.showPositiveNotif($q, t('db.revoketohandshake', { username: usernameDest })) + } + + } else { + tools.showNegativeNotif($q, t('db.recfailed')) + } + }) + }) + }, setRequestGroup($q: any, username: string, groupnameDest: string, value: boolean) { const userStore = useUserStore() @@ -5864,6 +5975,23 @@ export const tools = { }) }) }, + cancelReqHandShake($q: any, username: string, usernameDest: string) { + const userStore = useUserStore() + $q.dialog({ + message: t('db.domanda_cancel_req_handshake', { username: usernameDest }), + ok: { label: t('dialog.yes'), push: true }, + cancel: { label: t('dialog.cancel') }, + title: t('db.domanda') + }).onOk(() => { + + userStore.setFriendsCmd($q, t, username, usernameDest, shared_consts.FRIENDSCMD.CANCEL_REQ_HANDSHAKE, null).then((res) => { + if (res) { + userStore.my.profile.asked_handshake = userStore.my.profile.asked_handshake.filter((rec: IUserFields) => rec.username !== usernameDest) + tools.showPositiveNotif($q, t('db.cancel_req_handshake')) + } + }) + }) + }, cancelReqGroups($q: any, username: string, groupnameDest: string) { const userStore = useUserStore() $q.dialog({ @@ -6479,10 +6607,18 @@ export const tools = { tools.addToMyFriends($q, username, dest) } else if (cmd === shared_consts.FRIENDSCMD.REQFRIEND) { tools.setRequestFriendship($q, username, dest, value) + } else if (cmd === shared_consts.FRIENDSCMD.SETHANDSHAKE) { + tools.addToMyHandShake($q, username, dest) + } else if (cmd === shared_consts.FRIENDSCMD.REQHANDSHAKE) { + tools.setRequestHandShake($q, username, dest, value) } else if (cmd === shared_consts.FRIENDSCMD.REFUSE_REQ_FRIEND) { tools.refuseReqFriends($q, username, dest) + } else if (cmd === shared_consts.FRIENDSCMD.REFUSE_REQ_HANDSHAKE) { + tools.refuseReqHandShake($q, username, dest) } else if (cmd === shared_consts.FRIENDSCMD.CANCEL_REQ_FRIEND) { tools.cancelReqFriends($q, username, dest) + } else if (cmd === shared_consts.FRIENDSCMD.CANCEL_REQ_HANDSHAKE) { + tools.cancelReqHandShake($q, username, dest) } else if (cmd === shared_consts.CIRCUITCMD.SET) { tools.addToMyCircuits($q, username, dest) } else if (cmd === shared_consts.CIRCUITCMD.REQ) { @@ -7079,30 +7215,6 @@ export const tools = { } }, - timeAgo(input: any) { - const date = (input instanceof Date) ? input : new Date(input) - const formatter = new Intl.RelativeTimeFormat(toolsext.getLocale() || 'it') - const ranges: any = { - years: 3600 * 24 * 365, - months: 3600 * 24 * 30, - weeks: 3600 * 24 * 7, - days: 3600 * 24, - hours: 3600, - minutes: 60, - seconds: 1 - } - const secondsElapsed = (date.getTime() - Date.now()) / 1000 - let key: any - for (key in ranges) { - if (ranges[key] < Math.abs(secondsElapsed)) { - // @ts-ignore - const delta = secondsElapsed / ranges[key] - // @ts-ignore - return formatter.format(Math.round(delta), key) - } - } - }, - getEnv(name: string) { const config: any = { // @ts-ignore diff --git a/src/store/UserStore.ts b/src/store/UserStore.ts index 9c4f49be..0408a29f 100755 --- a/src/store/UserStore.ts +++ b/src/store/UserStore.ts @@ -65,6 +65,9 @@ export const DefaultUser: IUserFields = { myshares: [], friends: [], req_friends: [], + handshake: [], + req_handshake: [], + asked_handshake: [], mygroups: [], mycircuits: [], manage_mygroups: [], @@ -123,6 +126,9 @@ export const DefaultProfile: IUserProfile = { myshares: [], friends: [], req_friends: [], + handshake: [], + req_handshake: [], + asked_handshake: [], mygroups: [], mycircuits: [], manage_mygroups: [], @@ -220,6 +226,12 @@ export const useUserStore = defineStore('UserStore', { else return false }, + IsHandShakeByUsername(username: string): boolean { + if (this.my.profile.handshake) + return this.my.profile.handshake.findIndex((rec) => rec.username === username) >= 0 + else + return false + }, IsMyGroupByGroupname(groupname: string): boolean { if (this.my.profile.mygroups) @@ -251,6 +263,13 @@ export const useUserStore = defineStore('UserStore', { return false }, + IsAskedHandShakeByUsername(username: string): boolean { + if (this.my.profile.asked_handshake) + return this.my.profile.asked_handshake.findIndex((rec) => rec.username === username) >= 0 + else + return false + }, + IsReqFriendByUsername(username: string): boolean { if (this.my.profile.req_friends) return this.my.profile.req_friends.findIndex((rec) => rec.username === username) >= 0 @@ -258,6 +277,13 @@ export const useUserStore = defineStore('UserStore', { return false }, + IsReqHandShakeByUsername(username: string): boolean { + if (this.my.profile.req_handshake) + return this.my.profile.req_handshake.findIndex((rec) => rec.username === username) >= 0 + else + return false + }, + IsAskedGroupByGroupname(groupname: string): boolean { if (this.my.profile.asked_groups) return this.my.profile.asked_groups.findIndex((rec: IGroupShort) => rec.groupname === groupname) >= 0 @@ -733,6 +759,7 @@ export const useUserStore = defineStore('UserStore', { // Memory this.my.profile.manage_mygroups = [] this.my.profile.asked_friends = [] + this.my.profile.asked_handshake = [] this.my.profile.asked_groups = [] this.my.profile.refused_groups = [] } @@ -1151,7 +1178,10 @@ export const useUserStore = defineStore('UserStore', { .then((ris) => { this.my.profile.friends = ris.data.friends.listFriends ? ris.data.friends.listFriends : [] this.my.profile.req_friends = ris.data.friends.listRequestFriends ? ris.data.friends.listRequestFriends : [] + this.my.profile.handshake = ris.data.friends.listHandShake ? ris.data.friends.listHandShake : [] + this.my.profile.req_handshake = ris.data.friends.listRequestHandShake ? ris.data.friends.listRequestHandShake : [] this.my.profile.asked_friends = ris.data.friends.listSentRequestFriends ? ris.data.friends.listSentRequestFriends : [] + this.my.profile.asked_handshake = ris.data.friends.listSentRequestHandShake ? ris.data.friends.listSentRequestHandShake : [] return ris.data.user }).catch((error) => { @@ -1255,7 +1285,10 @@ export const useUserStore = defineStore('UserStore', { .then((ris) => { this.my.profile.friends = ris.data.listFriends ? ris.data.listFriends : [] this.my.profile.req_friends = ris.data.listRequestFriends ? ris.data.listRequestFriends : [] + this.my.profile.handshake = ris.data.friends.listHandShake ? ris.data.friends.listHandShake : [] + this.my.profile.req_handshake = ris.data.friends.listRequestHandShake ? ris.data.friends.listRequestHandShake : [] this.my.profile.asked_friends = ris.data.listSentRequestFriends ? ris.data.listSentRequestFriends : [] + this.my.profile.asked_handshake = ris.data.friends.listSentRequestHandShake ? ris.data.friends.listSentRequestHandShake : [] return ris.data }).catch((error) => { return {} diff --git a/src/store/globalStore.ts b/src/store/globalStore.ts index 759222f6..2410b8a0 100644 --- a/src/store/globalStore.ts +++ b/src/store/globalStore.ts @@ -174,6 +174,8 @@ export const useGlobalStore = defineStore('GlobalStore', { showViewProfile: false, enablePwa: false, lang: costanti.Lang.IT, + videoPromo: '', + PDFPromo: '', }, }, provinces: [], diff --git a/src/views/user/myprofile/myprofile.ts b/src/views/user/myprofile/myprofile.ts index fc36e024..d69b898e 100755 --- a/src/views/user/myprofile/myprofile.ts +++ b/src/views/user/myprofile/myprofile.ts @@ -10,6 +10,7 @@ import { CMyGroup } from '@/components/CMyGroup' import { CMyCircuit } from '@/components/CMyCircuit' import { CNotifAtTop } from '@src/components/CNotifAtTop' import { CSendCoins } from '@/components/CSendCoins' +import { CTimeAgo } from '@/components/CTimeAgo' import { CMyUser } from '@/components/CMyUser' import { CUserNonVerif } from '@/components/CUserNonVerif' import { CCheckIfIsLogged } from '@/components/CCheckIfIsLogged' @@ -35,7 +36,7 @@ export default defineComponent({ components: { CProfile, CTitleBanner, CMyFieldDb, CSkill, CDateTime, CCopyBtn, CUserNonVerif, CMyFieldRec, CMyUser, CMyGroup, CLabel, CMyCircuit, CSendCoins, CNotifAtTop, - CCheckIfIsLogged + CCheckIfIsLogged, CTimeAgo }, props: {}, setup() { @@ -50,6 +51,8 @@ export default defineComponent({ const { getRefLink } = MixinUsers() const animation = ref('fade') + const quantiHandShake = ref('') + const usersList = ref({show: false, title: '', list: []}) const username = computed(() => $route.params.username ? $route.params.username.toString() : userStore.my.username) const idnotif = computed(() => $route.query.idnotif ? $route.query.idnotif.toString() : '') @@ -59,6 +62,7 @@ export default defineComponent({ const showPic = ref(false) const caricato = ref(false) const showsendCoinTo = ref(false) + const showinghand = ref(false) const myuser = ref(null) @@ -94,6 +98,8 @@ export default defineComponent({ filtroutente.value = [{ userId: myuser.value._id }] notifStore.setAsRead(idnotif.value) + quantiHandShake.value = (myuser.value.profile.handshake ? myuser.value.profile.handshake.length : 0) + ' ' + t('handshake.received') + try { listgroupsfiltered.value = globalStore.mygroups.filter((grp: IMyGroup) => myuser.value!.profile.mygroups.findIndex((rec: IMyGroup) => rec.groupname === grp.groupname) >= 0) } catch (e) { @@ -175,6 +181,7 @@ export default defineComponent({ username, profile, tools, + toolsext, costanti, myuser, shared_consts, @@ -201,6 +208,9 @@ export default defineComponent({ site, listcircuitsfiltered, isDebugOn, + showinghand, + quantiHandShake, + usersList, } } }) diff --git a/src/views/user/myprofile/myprofile.vue b/src/views/user/myprofile/myprofile.vue index a388ac90..671c7c7e 100755 --- a/src/views/user/myprofile/myprofile.vue +++ b/src/views/user/myprofile/myprofile.vue @@ -51,11 +51,19 @@ color="green" >online +
- OnLine: {{ tools.timeAgo(myuser.lasttimeonline) }} + OnLine: +
@@ -147,7 +155,7 @@
- OnLine: {{ tools.timeAgo(myuser.lasttimeonline) }} + OnLine:
@@ -210,6 +218,100 @@
{{ myuser.profile.biografia }}
+ +
{{ $t('handshake.strettedimano')}}:
+
+ {{ $t('db.addtohandshake', { username: myuser.username }) }} +
+ + + + + +
+
+ + +
+
+ +
+ + +
+
+ + + + + {{ usersList.title }} + + + + + +
+ + +
+
+
+