diff --git a/_ALL_SITES/freeplanet.app/db/lang/ws_it.js b/_ALL_SITES/freeplanet.app/db/lang/ws_it.js
index 85224b26..f9058a31 100755
--- a/_ALL_SITES/freeplanet.app/db/lang/ws_it.js
+++ b/_ALL_SITES/freeplanet.app/db/lang/ws_it.js
@@ -24,6 +24,7 @@ const msg_website_it = {
home: 'Home',
profile: 'Profilo',
profile2: 'ProfiloU',
+ profile3: 'Profilo3',
test: 'Test',
projects: 'Progetti',
report: 'Report Ore',
diff --git a/_ALL_SITES/freeplanet.app/db/static_data.ts b/_ALL_SITES/freeplanet.app/db/static_data.ts
index fd316cb5..ebdac002 100755
--- a/_ALL_SITES/freeplanet.app/db/static_data.ts
+++ b/_ALL_SITES/freeplanet.app/db/static_data.ts
@@ -379,10 +379,10 @@ const baseroutes: IListRoutes[] = [
{
active: true,
order: 120,
- path: '/profile',
+ path: '/myprofile',
materialIcon: 'fas fa-user',
name: 'pages.profile',
- component: () => import('@/views/user/editprofile/editprofile.vue'),
+ component: () => import('@/views/user/myprofile/myprofile.vue'),
meta: { requiresAuth: true },
inmenu: true,
infooter: true,
diff --git a/docs/bozza.txt b/docs/bozza.txt
new file mode 100644
index 00000000..87564049
--- /dev/null
+++ b/docs/bozza.txt
@@ -0,0 +1,5 @@
+ellipsis-h
+caret-square-down
+caret-down
+
+user-minus
diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts
index ab74a4fe..0c997848 100755
--- a/src/common/shared_vuejs.ts
+++ b/src/common/shared_vuejs.ts
@@ -41,6 +41,13 @@ export const shared_consts = {
FILTER_MYSKILL_SKILL: 1,
+ FRIENDSCMD: {
+ SETTRUST: 121,
+ SETFRIEND: 132,
+ REMOVE_FROM_MYFRIENDS: 144,
+ BLOCK_USER: 155,
+ },
+
REPORT_FILT_RESP: 1,
REPORT_FILT_ATTIVITA: 2,
diff --git a/src/components/Header/Header.vue b/src/components/Header/Header.vue
index 6202f31e..acdc19ea 100755
--- a/src/components/Header/Header.vue
+++ b/src/components/Header/Header.vue
@@ -203,7 +203,7 @@
- {{ t('pages.profile') }}
+ {{ t('pages.profile') }}
{{ t('login.esci') }}
diff --git a/src/css/app.scss b/src/css/app.scss
index 102413e7..182f3ea7 100755
--- a/src/css/app.scss
+++ b/src/css/app.scss
@@ -895,3 +895,10 @@ $heightBtn: 100%;
.wrap_anywhere {
overflow-wrap: anywhere;
}
+
+.imgprofile{
+ border: 0px solid rgb(29, 118, 13);
+ border-radius: 16px;
+ box-shadow: 0 0 45px rgba(246, 246, 246, 0.2);
+ margin: 1px;
+}
diff --git a/src/db/static_data.ts b/src/db/static_data.ts
index 2fc31fce..4cfb12da 100755
--- a/src/db/static_data.ts
+++ b/src/db/static_data.ts
@@ -379,14 +379,25 @@ const baseroutes: IListRoutes[] = [
{
active: true,
order: 120,
- path: '/profile',
+ path: '/myprofile',
materialIcon: 'fas fa-user',
name: 'pages.profile',
- component: () => import('@/views/user/editprofile/editprofile.vue'),
+ component: () => import('@/views/user/myprofile/myprofile.vue'),
meta: { requiresAuth: true },
inmenu: true,
infooter: true,
},
+ {
+ active: true,
+ order: 120,
+ path: '/editprofile',
+ materialIcon: 'fas fa-user',
+ name: 'pages.profile3',
+ component: () => import('@/views/user/editprofile/editprofile.vue'),
+ meta: { requiresAuth: true },
+ inmenu: false,
+ infooter: false,
+ },
{
active: true,
order: 130,
diff --git a/src/statics/lang/it.js b/src/statics/lang/it.js
index 7b9329eb..3f70c93c 100755
--- a/src/statics/lang/it.js
+++ b/src/statics/lang/it.js
@@ -177,6 +177,11 @@ const msg_it = {
recdelfailed: 'Errore durante la cancellazione del Record',
duplicatedrecord: 'Vuoi Duplicare il record',
recdupfailed: 'Errore durante la duplicazione del Record',
+ friendsadded: 'Aggiunto alla lista di Amici',
+ blockedfriend: 'Utente Bloccato',
+ removedfriend: 'Rimosso dalla lista di Amici',
+ trusted: 'Accettato la Fiducia',
+ rejected: 'Rifiutato la Fiducia',
},
components: {
authentication: {
@@ -360,6 +365,8 @@ const msg_it = {
legenda: 'Legenda',
aportador_solidario: 'Chi ti ha Invitato',
verified_by_aportador: 'Verificato dall\'Invitante',
+ blocked: 'Bloccato',
+ username_who_block: 'Bloccato da',
username_regala_invitato: 'Username del Destinatario del regalo',
aportador_solidario_nome_completo: 'Nominativo Invitante',
aportador_solidario_nome_completo_orig: 'Invitante Originario',
@@ -815,6 +822,13 @@ const msg_it = {
friends: 'Amici',
request_trust: 'Richieste di Fiducia',
trusted: 'Accettati',
+ rejected: 'Rifiutati',
+ },
+ friends: {
+ accept: 'Accetta',
+ reject: 'Rifiuta',
+ remove_from_myfriends: 'Rimuovi dagli Amici',
+ block_user: 'Blocca Utente',
}
},
diff --git a/src/store/Modules/costanti.ts b/src/store/Modules/costanti.ts
index 6293ec91..6550136b 100755
--- a/src/store/Modules/costanti.ts
+++ b/src/store/Modules/costanti.ts
@@ -11,6 +11,7 @@ export const costanti = {
FRIENDS: 1,
ASK_TRUST: 2,
TRUSTED: 3,
+ REEJECTED: 4,
FILTER_TUTTI: -100,
diff --git a/src/store/Modules/fieldsTable.ts b/src/store/Modules/fieldsTable.ts
index 79ebc16c..657acc62 100755
--- a/src/store/Modules/fieldsTable.ts
+++ b/src/store/Modules/fieldsTable.ts
@@ -1288,6 +1288,8 @@ export const fieldsTable = {
AddCol({ name: 'note', label_trans: 'reg.note' }),
AddCol({ name: 'aportador_solidario', label_trans: 'reg.aportador_solidario' }),
AddCol({ name: 'verified_by_aportador', label_trans: 'reg.verified_by_aportador', fieldtype: costanti.FieldType.boolean }),
+ AddCol({ name: 'blocked', label_trans: 'reg.blocked', fieldtype: costanti.FieldType.boolean }),
+ AddCol({ name: 'username_who_block', label_trans: 'reg.username_who_block' }),
AddCol({
name: 'profile.resplist',
field: 'profile',
diff --git a/src/store/UserStore.ts b/src/store/UserStore.ts
index 984286c8..f4224336 100755
--- a/src/store/UserStore.ts
+++ b/src/store/UserStore.ts
@@ -838,6 +838,17 @@ export const useUserStore = defineStore('UserStore', {
return {}
})
+ },
+
+ async setFriendsCmd($q: any, t: any, usernameOrig: string, usernameDest: string, cmd: number, value: any) {
+ return Api.SendReq('/users/friends/cmd', 'POST', {usernameOrig, usernameDest, cmd, value})
+ .then((res) => {
+ return !!res
+ }).catch((error) => {
+ tools.showNegativeNotif($q, t('db.recfailed'))
+ return {}
+ })
+
}
},
})
diff --git a/src/views/user/myfriends/myfriends.ts b/src/views/user/myfriends/myfriends.ts
index dec5a892..e404c3a0 100755
--- a/src/views/user/myfriends/myfriends.ts
+++ b/src/views/user/myfriends/myfriends.ts
@@ -13,6 +13,7 @@ import { toolsext } from '@store/Modules/toolsext'
import { useQuasar } from 'quasar'
import { costanti } from '@costanti'
import { IUserFields, IUserProfile } from 'model'
+import { shared_consts } from '@/common/shared_vuejs'
export default defineComponent({
@@ -21,7 +22,9 @@ export default defineComponent({
props: {},
setup() {
const userStore = useUserStore()
+ const $router = useRouter()
const $route = useRoute()
+ const $q = useQuasar()
const { t } = useI18n()
const username = ref('')
@@ -36,9 +39,11 @@ export default defineComponent({
if (filter.value === costanti.FRIENDS) {
arr = listFriends.value
}else if (filter.value === costanti.ASK_TRUST) {
- arr = listTrusted.value.filter((user: IUserFields) => !user.verified_by_aportador)
+ arr = listTrusted.value.filter((user: IUserFields) => user.verified_by_aportador === undefined)
}else if (filter.value === costanti.TRUSTED) {
- arr = listTrusted.value.filter((user: IUserFields) => !user.verified_by_aportador)
+ arr = listTrusted.value.filter((user: IUserFields) => user.verified_by_aportador)
+ }else if (filter.value === costanti.REEJECTED) {
+ arr = listTrusted.value.filter((user: IUserFields) => user.verified_by_aportador === false)
}
return arr
@@ -50,15 +55,20 @@ export default defineComponent({
})
const numAskTrust = computed(() => {
- const arr = listTrusted.value.filter((user: IUserFields) => !user.verified_by_aportador)
+ const arr = listTrusted.value.filter((user: IUserFields) => user.verified_by_aportador === undefined)
return (arr) ? arr.length : 0
})
- const numAskTrusted = computed(() => {
+ const numTrusted = computed(() => {
const arr = listTrusted.value.filter((user: IUserFields) => user.verified_by_aportador)
return (arr) ? arr.length : 0
})
+ const numRejected = computed(() => {
+ const arr = listTrusted.value.filter((user: IUserFields) => user.verified_by_aportador === false)
+ return (arr) ? arr.length : 0
+ })
+
function loadFriends() {
// Carica il profilo di quest'utente
if (username.value) {
@@ -83,6 +93,44 @@ export default defineComponent({
return userStore.getImgByProfile(profile)
}
+ function setRequestTrust(usernameDest: string, value: any) {
+ userStore.setFriendsCmd($q, t, username.value, usernameDest, shared_consts.FRIENDSCMD.SETTRUST, value).then((res) => {
+ if (res) {
+ const myuser: IUserFields|undefined = listTrusted.value.find((rec: IUserFields) => rec.username === usernameDest )
+ if (myuser) {
+ listFriends.value.push(myuser)
+ listTrusted.value = listTrusted.value.filter((rec: IUserFields) => rec.username !== usernameDest)
+ }
+ tools.showPositiveNotif($q, t('db.trusted'))
+
+ } else {
+ tools.showNegativeNotif($q, t('db.recfailed'))
+ }
+ })
+ }
+
+ function removeFromMyFriends(usernameDest: string) {
+ userStore.setFriendsCmd($q, t, username.value, usernameDest, shared_consts.FRIENDSCMD.REMOVE_FROM_MYFRIENDS, null).then((res) => {
+ if (res) {
+ listFriends.value = listFriends.value.filter((rec: IUserFields) => rec.username !== usernameDest)
+ tools.showPositiveNotif($q, t('db.removedfriend'))
+ }
+ })
+ }
+
+ function blockUser(usernameDest: string) {
+ userStore.setFriendsCmd($q, t, username.value, usernameDest, shared_consts.FRIENDSCMD.REMOVE_FROM_MYFRIENDS, null).then((res) => {
+ if (res) {
+ listFriends.value = listFriends.value.filter((rec: IUserFields) => rec.username !== usernameDest)
+ tools.showPositiveNotif($q, t('db.blockedfriend'))
+ }
+ })
+ }
+
+ function naviga(path: string) {
+ $router.push(path)
+ }
+
onMounted(mounted)
return {
@@ -95,7 +143,12 @@ export default defineComponent({
listfriendsfiltered,
numFriends,
numAskTrust,
- numAskTrusted,
+ numTrusted,
+ numRejected,
+ setRequestTrust,
+ removeFromMyFriends,
+ blockUser,
+ naviga,
}
}
})
diff --git a/src/views/user/myfriends/myfriends.vue b/src/views/user/myfriends/myfriends.vue
index 1a6d7995..f90def74 100755
--- a/src/views/user/myfriends/myfriends.vue
+++ b/src/views/user/myfriends/myfriends.vue
@@ -7,32 +7,85 @@
no-caps
rounded
unelevated
+ push
toggle-color="primary"
color="white"
text-color="primary"
:options="[
{label: $t('mypages.friends') + ' (' + numFriends + ')', value: costanti.FRIENDS},
{label: $t('mypages.request_trust') + ' (' + numAskTrust + ')', value: costanti.ASK_TRUST},
- {label: $t('mypages.trusted') + ' (' + numAskTrusted + ')', value: costanti.TRUSTED}
+ {label: $t('mypages.trusted') + ' (' + numTrusted + ')', value: costanti.TRUSTED},
+ {label: $t('mypages.rejected') + ' (' + numRejected + ')', value: costanti.REEJECTED}
]"
/>
-
-
-
-
-
+
+
+
+
+
-
- {{ contact.name }} {{ contact.surname }}
+
+ {{ contact.name }} {{ contact.surname }} ({{ contact.username }})
+
{{ contact.email }}
-
-
+
+
+
+
+
+
+
+ {{$t('friends.remove_from_myfriends')}}
+
+
+
+
+ {{$t('friends.block_user')}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{$t('friends.reject')}}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{$t('friends.accept')}}
+
+
+
+
+
diff --git a/src/views/user/myprofile/myprofile.scss b/src/views/user/myprofile/myprofile.scss
index e2710649..1572733a 100755
--- a/src/views/user/myprofile/myprofile.scss
+++ b/src/views/user/myprofile/myprofile.scss
@@ -11,8 +11,3 @@
}
}
-.imgprofile{
- border: 4px solid rgb(29, 118, 13);
- border-radius: 16px;
- box-shadow: 0 0 45px rgba(246, 246, 246, 0.2);
-}
diff --git a/src/views/user/myprofile/myprofile.ts b/src/views/user/myprofile/myprofile.ts
index 6963f71a..244ffe15 100755
--- a/src/views/user/myprofile/myprofile.ts
+++ b/src/views/user/myprofile/myprofile.ts
@@ -24,7 +24,7 @@ export default defineComponent({
const $route = useRoute()
const { t } = useI18n()
- const username = computed(() => $route.params.username.toString())
+ const username = computed(() => $route.params.username ? $route.params.username.toString() : userStore.my.username)
const filtroutente = ref([])
const showPic = ref(false)
@@ -35,6 +35,10 @@ export default defineComponent({
return userStore.my.profile
}
+ function myusername() {
+ return userStore.my.username
+ }
+
function loadProfile() {
// Carica il profilo di quest'utente
if (username.value) {
@@ -46,7 +50,7 @@ export default defineComponent({
}
}
- watch(() => username, (to: any, from: any) => {
+ watch(() => username.value, (to: any, from: any) => {
loadProfile()
})
@@ -83,6 +87,7 @@ export default defineComponent({
getLinkUserTelegram,
filtroutente,
showPic,
+ myusername,
}
}
})
diff --git a/src/views/user/myprofile/myprofile.vue b/src/views/user/myprofile/myprofile.vue
index f4df25f0..28793c42 100755
--- a/src/views/user/myprofile/myprofile.vue
+++ b/src/views/user/myprofile/myprofile.vue
@@ -5,7 +5,7 @@
-
+
@@ -18,13 +18,21 @@
{{ myuser.username }}
- {{ myuser.profile.born_city }} ({{ myuser.profile.nationality }})
+ {{ myuser.profile.born_city }} ({{ myuser.profile.nationality }})
{{ myuser.profile.biografia }}
+
+
+
-
-
@@ -54,16 +54,12 @@
-
- {{ myuser.profile.born_city }}
-
@@ -71,7 +67,7 @@