Files
myprojplanet_vite/src/views/user/myprofile/myprofile.vue

595 lines
18 KiB
Vue
Raw Normal View History

2022-01-03 21:53:41 +01:00
<template>
<div v-if="isDebugOn" class="bg-red text-white">
2023-01-08 02:17:15 +01:00
<span v-if="!!tools.isLogged()">Logged: {{ tools.isLogged() }}</span> -
<span v-if="!!tools.isUserOk()">UserOk: {{ tools.isUserOk() }}</span> -
<span v-if="caricato">caricato: {{ caricato }}</span> -
<span v-if="myuser">myuser: {{ myuser.username }}</span>
</div>
2022-12-10 02:23:56 +01:00
<div
v-if="!caricato"
class="fit column no-wrap justify-evenly items-center content-start"
>
<q-skeleton type="QAvatar" size="140px" height="140px" animation="fade" />
<q-card flat bordered style="width: 250px">
<div class="text-h6">
2022-12-10 02:23:56 +01:00
<q-skeleton :animation="animation" />
</div>
<div class="col-12 text-h7 text-grey text-center">
{{ username }}
</div>
<div class="col-12 text-h7">
2022-12-10 02:23:56 +01:00
<q-skeleton :animation="animation" />
</div>
<div class="col-12 text-h8 q-mt-sm">
2022-12-10 02:23:56 +01:00
<q-skeleton :animation="animation" />
</div>
<div class="col-12 text-h8 q-mt-sm">
2022-12-10 02:23:56 +01:00
<q-skeleton :animation="animation" />
</div>
</q-card>
</div>
<div v-else-if="!tools.isLogged()">
<div class="q-gutter-sm q-pa-sm q-pb-md">
<div
v-if="myuser && myuser.date_reg"
class="fit column no-wrap justify-evenly items-center content-start"
>
<div class="">
<q-avatar size="140px">
<q-img
:src="myuser.profile ? getImgUser(myuser.profile) : ''"
:alt="username"
img-class="imgprofile"
height="140px"
@click="showPic = true"
/>
<q-badge
v-if="tools.isUserOnline(myuser)"
align="top"
floating
color="green"
>online</q-badge
>
2023-01-06 15:51:58 +01:00
<q-badge
v-if="userStore.IsHandShakeByUsername(myuser.username)"
align="bottom"
floating
color="red"
><q-icon name="fas fa-handshake"></q-icon
></q-badge>
</q-avatar>
</div>
<div class="last_access">
2023-01-06 15:51:58 +01:00
OnLine:
<CTimeAgo :datetime="myuser.lasttimeonline" />
</div>
<div v-if="myuser.reported">
<CTitleBanner
title="⚠️ L'utente è stato Segnalato per comportamento non idoneo."
bgcolor="bg-red"
clcolor="text-white"
>
</CTitleBanner>
</div>
<div v-if="site && site.confpages && site.confpages.showNameSurname">
<div class="text-h6">
<span v-if="checkifShow('name') && myuser.name">
{{ myuser.name }}</span
>
<span v-if="checkifShow('surname') && myuser.surname"
>&nbsp;{{ myuser.surname }}</span
>
</div>
</div>
<div class="col-12 text-h7 text-blue text-shadow-2">
{{ myuser.username }}
</div>
<div class="col-12 text-h7">
<span v-if="myuser.profile && myuser.profile.born_city_id">
<CMyFieldRec
title=""
table="users"
tablesel="cities"
:id="myuser._id"
:rec="myuser"
field="profile.born_city_id"
:canEdit="false"
:canModify="false"
>
</CMyFieldRec>
{{ myuser.profile.born_city_str }}</span
>
<span
v-if="
myuser.profile &&
myuser.profile.nationality &&
myuser.profile.nationality !== 'Italia'
"
>({{ myuser.profile.nationality }})</span
>
</div>
<div v-if="myuser._id" class="col-12 text-h8 q-mt-sm">
<span v-if="myuser.profile.qualifica">
<em
><span class="qualifica">{{ myuser.profile.qualifica }}</span></em
>
</span>
</div>
<div v-if="myuser._id" class="col-12 text-h8 q-mt-sm">
{{ myuser.profile.biografia }}
</div>
</div>
</div>
<CCheckIfIsLogged></CCheckIfIsLogged>
</div>
2022-12-10 02:23:56 +01:00
<div v-else-if="tools.isUserOk() || tools.isLogged()">
<div v-if="myuser">
2022-09-14 11:31:48 +02:00
<CNotifAtTop />
<div class="q-gutter-sm q-pa-sm q-pb-md">
2022-12-10 02:23:56 +01:00
<div
v-if="myuser && myuser.date_reg"
class="fit column no-wrap justify-evenly items-center content-start"
>
<div class="">
<q-avatar size="140px">
2022-12-10 02:23:56 +01:00
<q-img
2022-12-10 02:42:07 +01:00
:src="myuser.profile ? getImgUser(myuser.profile) : ''"
2022-12-10 02:23:56 +01:00
:alt="username"
img-class="imgprofile"
height="140px"
@click="showPic = true"
/>
<q-badge
v-if="tools.isUserOnline(myuser)"
align="top"
floating
color="green"
>online</q-badge
>
</q-avatar>
</div>
<div class="last_access">
2023-01-06 15:51:58 +01:00
OnLine: <CTimeAgo :datetime="myuser.lasttimeonline" />
</div>
2022-12-10 02:23:56 +01:00
<div v-if="myuser.reported">
2022-12-10 02:23:56 +01:00
<CTitleBanner
title="⚠️ L'utente è stato Segnalato per comportamento non idoneo."
bgcolor="bg-red"
clcolor="text-white"
>
</CTitleBanner>
</div>
2022-12-15 18:09:50 +01:00
<div v-if="site && site.confpages && site.confpages.showNameSurname">
<div class="text-h6">
<span v-if="checkifShow('name') && myuser.name">
{{ myuser.name }}</span
>
<span v-if="checkifShow('surname') && myuser.surname"
>&nbsp;{{ myuser.surname }}</span
>
</div>
</div>
<div class="col-12 text-h7 text-blue text-shadow-2">
{{ myuser.username }}
</div>
<div class="col-12 text-h7">
2022-12-10 02:23:56 +01:00
<span v-if="myuser.profile && myuser.profile.born_city_id">
<CMyFieldRec
title=""
table="users"
tablesel="cities"
:id="myuser._id"
:rec="myuser"
field="profile.born_city_id"
:canEdit="false"
2022-12-10 02:23:56 +01:00
:canModify="false"
>
</CMyFieldRec>
2022-12-10 02:23:56 +01:00
{{ myuser.profile.born_city_str }}</span
>
<span
v-if="
myuser.profile &&
myuser.profile.nationality &&
myuser.profile.nationality !== 'Italia'
"
>({{ myuser.profile.nationality }})</span
>
</div>
<div v-if="myuser._id" class="col-12 text-h8 q-mt-sm">
2022-12-10 02:23:56 +01:00
<span v-if="myuser.profile.qualifica">
<em
><span class="qualifica">{{
myuser.profile.qualifica
}}</span></em
>
</span>
</div>
<div v-if="myuser._id" class="col-12 text-h8 q-mt-sm">
{{ myuser.profile.biografia }}
</div>
2023-01-08 19:20:25 +01:00
<div v-if="userStore.IsHandShakeByUsername(myuser.username)">
<q-chip
color="green"
dense
class="cltexth4 chipbooked shadow-5 q-pa-sm2"
size="md"
2023-01-06 15:51:58 +01:00
icon="fas fa-handshake"
>
2023-01-08 19:20:25 +01:00
<span
>&nbsp;<em class="q-pa-xxs text-white rounded-borders shadow-2">
{{ $t('db.addtohandshake', { username: myuser.username }) }}
</em></span
2023-01-06 15:51:58 +01:00
>
2023-01-08 19:20:25 +01:00
</q-chip>
</div>
<q-btn
v-if="
myuser.profile &&
myuser.profile.handshake &&
myuser.profile.handshake.length > 0
"
:label="quantiHandShake"
class="q-my-sm"
:text-color="$q.dark.isActive ? 'black' : 'black'"
rounded
icon="fas fa-handshake"
@click="
usersList.show = true;
usersList.title = 'Lista Strette di mano';
usersList.list = myuser.profile.handshake;
"
>
</q-btn>
<q-btn
v-if="
myuser.username !== myusername() &&
handshake_inCommon &&
handshake_inCommon.length > 0
"
:label="quanteHandShakeInCommon"
class="q-my-sm"
:text-color="$q.dark.isActive ? 'black' : 'black'"
rounded
icon="fas fa-handshake"
@click="
usersList.show = true;
usersList.title = 'Strette di mano in Comune';
usersList.list = handshake_inCommon;
"
>
</q-btn>
2023-01-06 15:51:58 +01:00
2023-01-08 19:20:25 +01:00
<!--HANDSHAKE-->
<div v-if="!isMyRecord(myuser.username)">
<div
class="row centeritems q-ma-sm q-pa-sm"
v-if="userStore.IsReqHandShakeByUsername(myuser.username)"
>
2023-01-06 15:51:58 +01:00
<q-btn
2023-01-08 19:20:25 +01:00
icon="fas fa-handshake"
color="positive"
:label="$t('handshake.accept_handshake')"
@click="
tools.addToMyHandShake(
$q,
myuser.username,
userStore.my.username
)
2023-01-06 15:51:58 +01:00
"
2023-01-08 19:20:25 +01:00
/>
<q-btn
2023-01-06 15:51:58 +01:00
icon="fas fa-handshake-alt-slash"
2023-01-08 19:20:25 +01:00
color="negative"
:label="$t('handshake.reject_ask_handshake')"
2023-01-06 15:51:58 +01:00
@click="
2023-01-08 19:20:25 +01:00
tools.refuseReqHandShake(
$q,
myuser.username,
userStore.my.username
)
"
/>
</div>
<div v-else>
<q-btn
v-if="
!userStore.IsHandShakeByUsername(myuser.username) &&
!userStore.IsAskedHandShakeByUsername(myuser.username)
"
icon="fas fa-handshake"
color="primary"
:label="$t('handshake.ask_handshake')"
@click="
tools.setRequestHandShake(
2023-01-06 15:51:58 +01:00
$q,
userStore.my.username,
2023-01-08 19:20:25 +01:00
myuser.username,
true
2023-01-06 15:51:58 +01:00
)
"
/>
</div>
2023-01-08 19:20:25 +01:00
<q-btn
v-if="
userStore.IsAskedHandShakeByUsername(myuser.username) &&
!userStore.IsHandShakeByUsername(myuser.username)
"
icon="fas fa-handshake-alt-slash"
:text-color="$q.dark.isActive ? 'black' : 'black'"
:label="$t('handshake.cancel_ask_handshake_short')"
@click="
tools.cancelReqHandShake(
$q,
userStore.my.username,
myuser.username
)
"
/>
</div>
<div v-if="!isMyRecord(myuser.username)" class="q-ma-sm">
2022-12-10 02:23:56 +01:00
<div
class="row centeritems q-ma-sm q-pa-sm"
v-if="userStore.IsReqFriendByUsername(myuser.username)"
>
<q-btn
icon="fas fa-user-plus"
2022-12-10 02:23:56 +01:00
color="positive"
:label="$t('friends.accept_friend')"
@click="
tools.addToMyFriends(
$q,
userStore.my.username,
myuser.username
)
"
/>
<q-btn
icon="fas fa-user-minus"
2022-12-10 02:23:56 +01:00
color="negative"
:label="$t('friends.reject_ask_friend')"
@click="
tools.refuseReqFriends(
$q,
userStore.my.username,
myuser.username
)
"
/>
</div>
<div v-else>
<q-btn
2022-12-10 02:23:56 +01:00
v-if="
!userStore.IsMyFriendByUsername(myuser.username) &&
!userStore.IsAskedFriendByUsername(myuser.username)
"
icon="fas fa-user-plus"
2022-12-10 02:23:56 +01:00
color="primary"
:label="$t('friends.ask_friend')"
@click="
tools.setRequestFriendship(
$q,
userStore.my.username,
myuser.username,
true
)
"
/>
</div>
2022-12-10 02:23:56 +01:00
<q-btn
v-if="userStore.IsMyFriendByUsername(myuser.username)"
rounded
icon="fas fa-ellipsis-h"
>
<q-menu>
<q-list v-if="true" style="min-width: 150px">
2022-12-10 02:23:56 +01:00
<q-item
clickable
icon="fas fa-user-minus"
v-close-popup
@click="
tools.removeFromMyFriends(
$q,
userStore.my.username,
myuser.username
)
"
>
<q-item-section>{{
$t('friends.remove_from_myfriends')
}}</q-item-section>
</q-item>
2022-12-10 02:23:56 +01:00
<q-item
clickable
icon="fas fa-ban"
v-close-popup
@click="
tools.blockUser(
$q,
userStore.my.username,
myuser.username
)
"
>
<q-item-section>{{
$t('friends.block_user')
}}</q-item-section>
</q-item>
2022-12-10 02:23:56 +01:00
<q-item
clickable
v-close-popup
@click="
tools.reportUser(
$q,
userStore.my.username,
myuser.username
)
"
>
<q-item-section avatar>
2022-12-10 02:23:56 +01:00
<q-icon color="negative" name="fas fa-user-minus" />
</q-item-section>
2022-12-10 02:23:56 +01:00
<q-item-section>{{
$t('friends.report_user')
}}</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
<q-btn
2022-12-10 02:23:56 +01:00
v-if="
userStore.IsAskedFriendByUsername(myuser.username) &&
!userStore.IsMyFriendByUsername(myuser.username)
"
icon="fas fa-user-minus"
:label="$t('friends.cancel_ask_friend_short')"
2022-12-10 02:23:56 +01:00
@click="
tools.cancelReqFriends(
$q,
userStore.my.username,
myuser.username
)
"
/>
</div>
2022-02-03 00:33:05 +01:00
2023-01-08 19:20:25 +01:00
<CContactUser :myuser="myuser" :showBtnActivities="true" />
</div>
2022-12-10 02:23:56 +01:00
<div
v-if="
myuser &&
myuser._id &&
(userStore.IsMyFriendByUsername(myuser.username) ||
isMyRecord(myuser.username))
"
>
<CTitleBanner
2022-12-10 02:23:56 +01:00
class=""
:title="$t('dashboard.info')"
bgcolor="bg-primary"
clcolor="text-white"
myclass="myshad"
:canopen="true"
>
<div
v-if="myuser.profile"
class="fit column no-wrap justify-evenly content-start"
>
<div class="col-md-6 col-sm-6 q-ma-xs col-xs-12">
<CDateTime
2022-12-10 02:23:56 +01:00
v-if="
checkifShow('profile.dateofbirth') &&
!!myuser.profile.dateofbirth
"
v-model:value="myuser.profile.dateofbirth"
:label="$t('reg.dateofbirth')"
2022-12-10 02:23:56 +01:00
:canEdit="false"
>
</CDateTime>
<CLabel
v-if="!!myuser.profile.cell"
v-bind="$attrs"
:copy="true"
:value="myuser.profile.intcode_cell + myuser.profile.cell"
label="Cellulare"
/>
<!--
<CMyFieldRec
table="users"
:id="myuser._id"
:rec="myuser"
field="profile.cell"
class="cursor-pointer"
:canEdit="false"
:disable="true"
:canModify="false">
</CMyFieldRec>
-->
</div>
</div>
</CTitleBanner>
</div>
2022-10-21 21:25:54 +02:00
<div class="col-md-6 col-sm-6 q-ma-xs col-xs-12">
2022-12-10 02:23:56 +01:00
<CLabel v-if="!!myuser.useraport" :label="t('profile.aportador_him')">
2022-10-21 21:25:54 +02:00
<CMyUser
:mycontact="myuser.useraport"
:visu="costanti.FIND_PEOPLE"
@setCmd="tools.setCmd"
>
</CMyUser>
</CLabel>
</div>
</div>
2022-12-10 02:23:56 +01:00
<q-dialog v-model="showPic" full-height full-width>
<img :src="getImgUser()" :alt="username" class="full-width" />
</q-dialog>
<q-page-sticky
v-if="myuser.username === myusername()"
position="top-right"
:offset="[18, 18]"
>
<q-btn
fab
glossy
class="semi-transparent"
icon="fas fa-pencil-alt"
color="primary"
to="/editprofile"
/>
</q-page-sticky>
</div>
<div v-else-if="caricato">
<h2>Utente {{ username }} non trovato</h2>
2022-12-10 02:23:56 +01:00
({{ filtroutente }})
</div>
</div>
<div v-else>
<CUserNonVerif></CUserNonVerif>
2022-01-03 21:53:41 +01:00
</div>
2023-01-06 15:51:58 +01:00
<q-dialog v-model="usersList.show">
<q-card class="dialog_card">
<q-toolbar class="bg-primary text-white">
<q-toolbar-title>
{{ usersList.title }}
</q-toolbar-title>
<q-btn flat round color="white" icon="close" v-close-popup></q-btn>
</q-toolbar>
<q-card-section class="inset-shadow">
<div v-for="(rec, i) in usersList.list" :key="i">
<CMyUser
:mycontact="rec"
:visu="costanti.FIND_PEOPLE"
@setCmd="tools.setCmd"
>
</CMyUser>
</div>
</q-card-section>
</q-card>
</q-dialog>
2022-01-03 21:53:41 +01:00
</template>
<script lang="ts" src="./myprofile.ts">
</script>
<style lang="scss" scoped>
@import './myprofile.scss';
</style>