Lista Amici
Richieste di Fiducia Accettati Rifiutati
This commit is contained in:
@@ -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,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -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}
|
||||
]"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<q-list bordered>
|
||||
<q-item v-for="(contact, index) in listfriendsfiltered" :key="index" class="q-my-sm" clickable v-ripple>
|
||||
<q-item-section avatar>
|
||||
<q-avatar>
|
||||
<img :src="getImgUser(contact)" :alt="contact.username">
|
||||
<q-list>
|
||||
<q-item v-for="(contact, index) in listfriendsfiltered" :key="index" class="q-my-sm" clickable>
|
||||
<q-item-section avatar @click="naviga(`/my/` + contact.username)">
|
||||
<q-avatar size="60px">
|
||||
<q-img :src="getImgUser(contact)" :alt="contact.username" img-class="imgprofile" height="60px" />
|
||||
</q-avatar>
|
||||
</q-item-section>
|
||||
|
||||
<q-item-section>
|
||||
<q-item-label>{{ contact.name }} {{ contact.surname }}</q-item-label>
|
||||
<q-item-section @click="naviga(`/my/` + contact.username)">
|
||||
<q-item-label><strong>{{ contact.name }} {{ contact.surname }}</strong> ({{ contact.username }})
|
||||
</q-item-label>
|
||||
<q-item-label caption lines="1">{{ contact.email }}</q-item-label>
|
||||
</q-item-section>
|
||||
|
||||
<q-item-section side>
|
||||
<q-icon name="chat_bubble" color="green" />
|
||||
|
||||
<q-item-section side v-if="filter === costanti.FRIENDS">
|
||||
<q-item-label>
|
||||
<q-btn rounded icon="fas fa-ellipsis-h">
|
||||
<q-menu>
|
||||
<q-list style="min-width: 150px">
|
||||
<q-item clickable icon="fas fa-user-minus" v-close-popup @click="removeFromMyFriends(contact.username)">
|
||||
<q-item-section>{{$t('friends.remove_from_myfriends')}}</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
<q-list style="min-width: 150px">
|
||||
<q-item clickable icon="fas fa-ban" v-close-popup @click="blockUser(contact.username)">
|
||||
<q-item-section>{{$t('friends.block_user')}}</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
<q-item-section side v-if="filter === costanti.ASK_TRUST">
|
||||
<q-item-label>
|
||||
<q-btn color="positive" :label="$t('friends.accept')" @click="setRequestTrust(contact.username, true)"/>
|
||||
</q-item-label>
|
||||
<q-item-label>
|
||||
<q-btn color="negative" :label="$t('friends.reject')" @click="setRequestTrust(contact.username, false)"/>
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
<q-item-section side v-if="filter === costanti.TRUSTED">
|
||||
<q-item-label>
|
||||
<q-btn rounded icon="fas fa-ellipsis-h">
|
||||
<q-menu>
|
||||
<q-list style="min-width: 200px">
|
||||
<q-item clickable v-close-popup @click="removeFromMyFriends(contact.username)">
|
||||
<q-item-section>{{$t('friends.reject')}}</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
<q-item-section side v-if="filter === costanti.REEJECTED">
|
||||
<q-item-label>
|
||||
<q-btn rounded icon="fas fa-ellipsis-h">
|
||||
<q-menu>
|
||||
<q-list style="min-width: 200px">
|
||||
<q-item clickable icon="fas fa-user-minus" v-close-popup @click="setRequestTrust(contact.username, false)">
|
||||
<q-item-section>{{$t('friends.accept')}}</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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(<any[]>[])
|
||||
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,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<div class="">
|
||||
<q-avatar size="140px">
|
||||
<img :src="getImgUser()" :alt="username" class="imgprofile" @click="showPic = true">
|
||||
<q-img :src="getImgUser()" :alt="username" img-class="imgprofile" height="140px" @click="showPic = true" />
|
||||
</q-avatar>
|
||||
</div>
|
||||
|
||||
@@ -18,13 +18,21 @@
|
||||
{{ myuser.username }}
|
||||
</div>
|
||||
<div class="col-12 text-h7">
|
||||
{{ myuser.profile.born_city }} ({{ myuser.profile.nationality }})
|
||||
<span v-if="myuser.profile.born_city">{{ myuser.profile.born_city }}</span> <span v-if="myuser.profile.nationality">({{ myuser.profile.nationality }})</span>
|
||||
</div>
|
||||
|
||||
<div class="col-12 text-h8 q-mt-sm">
|
||||
{{ myuser.profile.biografia }}
|
||||
</div>
|
||||
|
||||
<q-btn
|
||||
v-if="myuser.username === myusername()" icon="fas fa-pencil-alt"
|
||||
color="blue"
|
||||
size="md"
|
||||
:label="$t('otherpages.modifprof')"
|
||||
to="/editprofile">
|
||||
</q-btn>
|
||||
|
||||
<div class="col-12 row justify-evenly q-mt-md">
|
||||
<q-btn
|
||||
v-if="getLinkUserTelegram()" icon="fab fa-telegram"
|
||||
@@ -34,14 +42,6 @@
|
||||
:label="$t('msgs.message')"
|
||||
:href="getLinkUserTelegram()" target="__blank">
|
||||
</q-btn>
|
||||
<q-btn
|
||||
v-if="false"
|
||||
icon="fab fa-telegram"
|
||||
color="white"
|
||||
text-color="black"
|
||||
size="md"
|
||||
rounded>
|
||||
</q-btn>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -54,16 +54,12 @@
|
||||
|
||||
<div class="col-6 text-h6">
|
||||
<CDateTime
|
||||
v-if="checkifShow('profile.dateofbirth')"
|
||||
v-if="checkifShow('profile.dateofbirth') && !!myuser.profile.dateofbirth"
|
||||
v-model:value="myuser.profile.dateofbirth"
|
||||
:label="$t('reg.dateofbirth')"
|
||||
:canEdit="false">
|
||||
</CDateTime>
|
||||
|
||||
<div v-if="myuser.profile.born_city"
|
||||
class="col-6 text-h7">
|
||||
{{ myuser.profile.born_city }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -71,7 +67,7 @@
|
||||
</CTitleBanner>
|
||||
|
||||
<CTitleBanner
|
||||
class="" title="Competenze e Talenti" bgcolor="bg-primary" clcolor="text-white"
|
||||
class="" title="Competenze e Talenti" bgcolor="bg-positive" clcolor="text-white"
|
||||
myclass="myshad" :canopen="true">
|
||||
|
||||
<CSkill
|
||||
|
||||
Reference in New Issue
Block a user