Friends, search
This commit is contained in:
@@ -11,7 +11,7 @@ PROVA_PAOLO="PROVA ENV FUNZIONA!"
|
||||
LANG_DEFAULT="it"
|
||||
PAO_APP_ID="KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF"
|
||||
MASTER_KEY="KKPPSS5KJK435J3KSS9F9D8S9F8SD3CR3T"
|
||||
MONGODB_HOST="http://192.168.1.8:3000"
|
||||
MONGODB_HOST="http://192.168.0.200:3000"
|
||||
LOGO_REG="freeplanet-logo-full.svg"
|
||||
TEST_NAME="Paolo"
|
||||
TEST_SURNAME="Arena"
|
||||
|
||||
@@ -148,6 +148,7 @@ module.exports = configure((ctx) => ({
|
||||
https: false,
|
||||
port: 8083,
|
||||
open: false, // opens browser window automatically
|
||||
liveReload: false,
|
||||
},
|
||||
|
||||
// https://v2.quasar.dev/quasar-cli/quasar-conf-js#Property%3A-framework
|
||||
|
||||
@@ -94,7 +94,7 @@ if (workbox) {
|
||||
registerRoute(
|
||||
new RegExp(/\.(?:png|gif|jpg|jpeg)$/),
|
||||
new CacheFirst({
|
||||
cacheName: 'images',
|
||||
cacheName: 'images-upload',
|
||||
plugins: [
|
||||
// Ensure that only requests that result in a 200 status are cached
|
||||
new CacheableResponsePlugin({
|
||||
@@ -314,9 +314,9 @@ if (workbox) {
|
||||
)
|
||||
|
||||
registerRoute(
|
||||
new RegExp(/.*\/(?:statics).*$/),
|
||||
new RegExp(/.*\/(?:public).*$/),
|
||||
new CacheFirst({
|
||||
cacheName: 'statics',
|
||||
cacheName: 'public',
|
||||
plugins: [
|
||||
// Ensure that only requests that result in a 200 status are cached
|
||||
new CacheableResponsePlugin({
|
||||
|
||||
@@ -21,6 +21,9 @@ register(process.env.SERVICE_WORKER_FILE ? process.env.SERVICE_WORKER_FILE : '',
|
||||
// $('#newvers').addClass('btnNewVersShow').removeClass("btnNewVersHide")
|
||||
},
|
||||
updated(registration) {
|
||||
document.dispatchEvent(
|
||||
new CustomEvent('swUpdated', { detail: registration })
|
||||
)
|
||||
console.log('New content is available; please refresh.')
|
||||
},
|
||||
offline() {
|
||||
|
||||
@@ -41,11 +41,14 @@ export const shared_consts = {
|
||||
|
||||
FILTER_MYSKILL_SKILL: 1,
|
||||
|
||||
OPTIONS_SEARCH_ONLY_FULL_WORDS: 1,
|
||||
|
||||
FRIENDSCMD: {
|
||||
SETTRUST: 121,
|
||||
SETFRIEND: 132,
|
||||
REMOVE_FROM_MYFRIENDS: 144,
|
||||
BLOCK_USER: 155,
|
||||
FIND_PEOPLE: 166,
|
||||
},
|
||||
|
||||
REPORT_FILT_RESP: 1,
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
<q-chip>
|
||||
<q-avatar v-if="getWhereIcon(myevent.wherecode)">
|
||||
<img
|
||||
:src="`../../public/images/avatar/` + getWhereIcon(myevent.wherecode)"
|
||||
:src="`images/avatar/` + getWhereIcon(myevent.wherecode)"
|
||||
alt="Località">
|
||||
</q-avatar>
|
||||
<q-avatar v-else color="blue" font-size="20px" text-color="white" icon="home">
|
||||
@@ -837,7 +837,7 @@
|
||||
<q-chip>
|
||||
<q-avatar v-if="getWhereIcon(event.wherecode)">
|
||||
<img
|
||||
:src="`../../public/images/avatar/` + getWhereIcon(event.wherecode)"
|
||||
:src="`images/avatar/` + getWhereIcon(event.wherecode)"
|
||||
:alt="event.wherecode">
|
||||
</q-avatar>
|
||||
<q-avatar color="blue" font-size="20px" text-color="white" icon="home">
|
||||
|
||||
@@ -6,6 +6,7 @@ import { IGallery, IImgGallery } from 'model'
|
||||
import { CMyPage } from '@/components/CMyPage'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { costanti } from '@costanti'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CGallery',
|
||||
@@ -246,7 +247,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function getfullname(rec: any) {
|
||||
return 'upload/' + props.directory + '/' + rec.imagefile
|
||||
return costanti.DIR_UPLOAD + props.directory + '/' + rec.imagefile
|
||||
}
|
||||
|
||||
function copytoclipboard(rec: any) {
|
||||
@@ -306,7 +307,7 @@ export default defineComponent({
|
||||
if (tools.getextfile(gallerylistery.imagefile) === 'pdf')
|
||||
return 'images/images/pdf.jpg'
|
||||
else
|
||||
return 'upload/' + props.directory + '/' + gallerylistery.imagefile
|
||||
return costanti.DIR_UPLOAD + props.directory + '/' + gallerylistery.imagefile
|
||||
} else {
|
||||
return 'images/noimg.png';
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
accept=".jpg, image/*, .pdf"
|
||||
:url="getUrl()"
|
||||
:headers="tools.getheaders()"
|
||||
:max-file-size="2000000"
|
||||
:max-file-size="3000000"
|
||||
multiple
|
||||
auto-upload
|
||||
hide-upload-btn
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
} from '../../model'
|
||||
import { lists } from '../../store/Modules/lists'
|
||||
import { IParamsQuery } from '../../model/GlobalStore'
|
||||
import { CMyUser } from '../CMyUser'
|
||||
import { CMyPopupEdit } from '../CMyPopupEdit'
|
||||
import { CMyFieldDb } from '../CMyFieldDb'
|
||||
import { CMySelect } from '../CMySelect'
|
||||
@@ -53,6 +54,11 @@ export default defineComponent({
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
hint: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'Cerca',
|
||||
},
|
||||
prop_search: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
@@ -68,6 +74,16 @@ export default defineComponent({
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
showType: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 0,
|
||||
},
|
||||
finder_noNull: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
vertical: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
@@ -131,6 +147,10 @@ export default defineComponent({
|
||||
required: false,
|
||||
default: {},
|
||||
},
|
||||
options: {
|
||||
required: false,
|
||||
default: 0,
|
||||
},
|
||||
prop_pagination: {
|
||||
type: Object as PropType<IPagination>,
|
||||
required: false,
|
||||
@@ -148,7 +168,7 @@ export default defineComponent({
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
components: { CMyPopupEdit, CTitleBanner, CMyFieldDb, CMySelect },
|
||||
components: { CMyPopupEdit, CTitleBanner, CMyFieldDb, CMySelect, CMyUser },
|
||||
setup(props, { emit }) {
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n()
|
||||
@@ -272,10 +292,10 @@ export default defineComponent({
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
// if (userStore.isAdmin || userStore.isManager)
|
||||
// return true
|
||||
if (userStore.isAdmin || userStore.isManager)
|
||||
return true
|
||||
}
|
||||
|
||||
// emulate 'SELECT count(*) FROM ...WHERE...'
|
||||
@@ -397,7 +417,7 @@ export default defineComponent({
|
||||
})
|
||||
}
|
||||
}
|
||||
if (false && nosearch && props.finder) {
|
||||
if ((false && nosearch && props.finder) || (props.finder_noNull && nosearch)) {
|
||||
returnedData.value = []
|
||||
returnedCount = 0
|
||||
return true
|
||||
@@ -423,6 +443,7 @@ export default defineComponent({
|
||||
descending,
|
||||
userId: userStore.my._id,
|
||||
codeId: '',
|
||||
options: props.options,
|
||||
}
|
||||
|
||||
params.codeId = mycodeid.value
|
||||
@@ -820,7 +841,7 @@ export default defineComponent({
|
||||
|
||||
|
||||
function clickFunz(item: any, col: IColGridTable) {
|
||||
if (col.action) {
|
||||
if (!!col && col.action) {
|
||||
|
||||
const table = mytable.value
|
||||
const ok = translate('dialog.yes')
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
|
||||
<div v-if="prop_search" class="q-mr-sm">
|
||||
<q-input
|
||||
v-model="search" filled dense type="search" debounce="500" hint="Cerca"
|
||||
v-model="search" filled dense type="search" debounce="500" :hint="hint"
|
||||
v-on:keyup.enter="doSearch">
|
||||
<template v-slot:after>
|
||||
<q-btn v-if="mytable" dense label="" color="primary" @click="refresh" icon="search"></q-btn>
|
||||
@@ -251,7 +251,14 @@
|
||||
|
||||
|
||||
<template v-slot:item="props">
|
||||
<div v-if="showType === costanti.SHOW_USERINFO">
|
||||
<CMyUser
|
||||
:mycontact="props.row">
|
||||
</CMyUser>
|
||||
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="q-pa-xs col-xs-12 col-sm-6 col-md-4 col-lg-3 grid-style-transition"
|
||||
:style="props.selected ? 'transform: scale(0.95);' : ''"
|
||||
>
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<!-- Se c'è un link, allora -->
|
||||
<q-btn
|
||||
class="text-center boldhigh" v-if="myevent.linkpdf" size="md" type="a"
|
||||
:href="`../../public/` + myevent.linkpdf"
|
||||
:href="myevent.linkpdf"
|
||||
target="_blank"
|
||||
ripple rounded :label="myevent.title"
|
||||
:color="myevent.bgcolor" text-color="white" glossy>
|
||||
@@ -117,7 +117,7 @@
|
||||
<q-chip>
|
||||
<q-avatar v-if="getWhereIcon(myevent.wherecode)">
|
||||
<img
|
||||
:src="`../../public/images/avatar/` + getWhereIcon(myevent.wherecode)"
|
||||
:src="`images/avatar/` + getWhereIcon(myevent.wherecode)"
|
||||
alt="località">
|
||||
</q-avatar>
|
||||
<q-avatar
|
||||
@@ -152,7 +152,7 @@
|
||||
<div class="row justify-start q-ma-md">
|
||||
<q-btn
|
||||
v-if="myevent.linkpdf"
|
||||
size="md" type="a" :href="`../../public/` + myevent.linkpdf"
|
||||
size="md" type="a" :href="myevent.linkpdf"
|
||||
target="_blank" rounded outline
|
||||
color="primary" icon="info"
|
||||
:label="$t('cal.showpdf')">
|
||||
|
||||
4
src/components/CMyUser/CMyUser.scss
Executable file
4
src/components/CMyUser/CMyUser.scss
Executable file
@@ -0,0 +1,4 @@
|
||||
.myflex{
|
||||
display: flex;
|
||||
flex: 1;
|
||||
}
|
||||
86
src/components/CMyUser/CMyUser.ts
Executable file
86
src/components/CMyUser/CMyUser.ts
Executable file
@@ -0,0 +1,86 @@
|
||||
import { defineComponent, onMounted, PropType, ref, watch } from 'vue'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { IImgGallery, IUserFields, IUserProfile } from 'model'
|
||||
import { costanti } from '@costanti'
|
||||
import { shared_consts } from '@/common/shared_vuejs'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CMyUser',
|
||||
emits: ['setCmd'],
|
||||
props: {
|
||||
mycontact: {
|
||||
type: Object as PropType<IUserFields | null>,
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
myusername: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
visu: {
|
||||
type: Number,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
|
||||
const userStore = useUserStore()
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n()
|
||||
const $router = useRouter()
|
||||
const $route = useRoute()
|
||||
|
||||
const username = ref('')
|
||||
|
||||
const contact = ref(<IUserFields | null>null)
|
||||
|
||||
watch(() => props.mycontact, (newval, oldval) => {
|
||||
console.log('watch: mycontact')
|
||||
mounted()
|
||||
})
|
||||
|
||||
function mounted() {
|
||||
if (!props.mycontact) {
|
||||
if (props.myusername) {
|
||||
username.value = props.myusername
|
||||
//++Todo: carica contact
|
||||
contact.value = null
|
||||
}
|
||||
} else {
|
||||
if (props.mycontact) {
|
||||
contact.value = props.mycontact
|
||||
username.value = props.mycontact.username
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getImgUser(profile: IUserFields) {
|
||||
return userStore.getImgByProfile(profile)
|
||||
}
|
||||
|
||||
function naviga(path: string) {
|
||||
$router.push(path)
|
||||
}
|
||||
|
||||
function setCmd(cmd: number, myusername: string, value: any = '') {
|
||||
emit('setCmd', cmd, myusername, value)
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
contact,
|
||||
costanti,
|
||||
getImgUser,
|
||||
naviga,
|
||||
setCmd,
|
||||
shared_consts,
|
||||
}
|
||||
},
|
||||
})
|
||||
84
src/components/CMyUser/CMyUser.vue
Executable file
84
src/components/CMyUser/CMyUser.vue
Executable file
@@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<div v-if="contact">
|
||||
<q-item 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 @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 v-if="visu === 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="setCmd(shared_consts.FRIENDSCMD.REMOVE_FROM_MYFRIENDS, 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="setCmd(shared_consts.FRIENDSCMD.BLOCK_USER, 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="visu === costanti.ASK_TRUST">
|
||||
<q-item-label>
|
||||
<q-btn color="positive" :label="$t('friends.accept_trust')" @click="setCmd(shared_consts.FRIENDSCMD.SETTRUST, contact.username, true)"/>
|
||||
</q-item-label>
|
||||
<q-item-label>
|
||||
<q-btn color="negative" :label="$t('friends.reject_trust')" @click="setCmd(shared_consts.FRIENDSCMD.SETTRUST, contact.username, false)"/>
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
<q-item-section side v-if="visu === costanti.TRUSTED">
|
||||
<q-item-label>
|
||||
<q-btn rounded icon="fas fa-ellipsis-h">
|
||||
<q-menu>
|
||||
<q-list v-if="true" style="min-width: 200px">
|
||||
<q-item clickable v-close-popup @click="setCmd(shared_consts.FRIENDSCMD.SETFRIEND, contact.username)">
|
||||
<q-item-section>{{ $t('friends.accept_friend') }}</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
<q-list style="min-width: 200px">
|
||||
<q-item clickable v-close-popup @click="setCmd(shared_consts.FRIENDSCMD.SETTRUST, contact.username, false)">
|
||||
<q-item-section>{{ $t('friends.reject_friend') }}</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
<q-item-section side v-if="visu === 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="setCmd(shared_consts.FRIENDSCMD.SETTRUST, contact.username, true)">
|
||||
<q-item-section>{{ $t('friends.accept_trust') }}</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CMyUser.ts">
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './CMyUser.scss';
|
||||
</style>
|
||||
1
src/components/CMyUser/index.ts
Executable file
1
src/components/CMyUser/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export { default as CMyUser } from './CMyUser.vue'
|
||||
@@ -32,7 +32,7 @@ $textcol_scuro: darkblue;
|
||||
background-repeat: no-repeat !important;
|
||||
background-position: top;
|
||||
background-size: contain !important;
|
||||
background-image: url(../../../public/images/landing_first_section.png) !important
|
||||
background-image: url(/public/images/landing_first_section.png) !important
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,6 @@ $textcol_scuro: darkblue;
|
||||
}
|
||||
|
||||
.carousel_img_3 {
|
||||
//background-image: url(../../public/images/cibo_sano.jpg);
|
||||
background-size: cover !important;
|
||||
background-position: 50% center !important;
|
||||
background-repeat: no-repeat !important;
|
||||
|
||||
@@ -34,5 +34,6 @@ export * from './CMySingleEvent'
|
||||
// export * from './PagePolicy'
|
||||
export * from './CFacebookFrame'
|
||||
export * from './CVerifyEmail'
|
||||
export * from './CMyUser'
|
||||
export * from './CVerifyTelegram'
|
||||
// export * from './CPreloadImages'
|
||||
|
||||
@@ -10,6 +10,7 @@ function translate(params: any) {
|
||||
const stringa = messages[lang]
|
||||
|
||||
let ris = stringa
|
||||
try {
|
||||
if (ris) {
|
||||
msg.forEach((param: any) => {
|
||||
ris = ris[param]
|
||||
@@ -18,6 +19,9 @@ function translate(params: any) {
|
||||
console.log('ERRORE IN TRANSLATE! ', params, ' NON ESISTE!')
|
||||
return params
|
||||
}
|
||||
}catch (e) {
|
||||
return params
|
||||
}
|
||||
|
||||
return ris
|
||||
}
|
||||
|
||||
@@ -73,9 +73,10 @@ export default function () {
|
||||
function getMyImgforIcon() {
|
||||
const userStore = useUserStore()
|
||||
const mypath = userStore.getImgByUsername(userStore.my.username)
|
||||
let img_small = tools.baseurl(mypath) + '/' + serv_constants.PREFIX_IMG_SMALL + tools.getLastItem(mypath);
|
||||
const filename = tools.getLastItem(mypath)
|
||||
let img_small = tools.baseurl(mypath) + '/' + serv_constants.PREFIX_IMG_SMALL + filename
|
||||
console.log('img_small', img_small)
|
||||
return (img_small !== '') ? `img:${img_small}` : 'fas fa-user'
|
||||
return (filename !== '') ? `img:${img_small}` : 'fas fa-user'
|
||||
}
|
||||
|
||||
function getIconCart() {
|
||||
|
||||
@@ -475,6 +475,7 @@ export interface IParamsQuery {
|
||||
lookup2?: IParLookup
|
||||
lookup3?: IParLookup
|
||||
lookup4?: IParLookup
|
||||
options?: number
|
||||
}
|
||||
|
||||
export interface IColGridTable {
|
||||
|
||||
@@ -180,8 +180,15 @@ const msg_it = {
|
||||
friendsadded: 'Aggiunto alla lista di Amici',
|
||||
blockedfriend: 'Utente Bloccato',
|
||||
removedfriend: 'Rimosso dalla lista di Amici',
|
||||
addedfriend: 'Aggiunto alla lista di Amici',
|
||||
domanda_trusted: 'Accettare la Fiducia a {username}?',
|
||||
domanda_rejectedtrust: 'Rifiutare la Fiducia a {username}?',
|
||||
domanda_blockuser: 'Bloccare {username}?',
|
||||
domanda: 'Domanda',
|
||||
trusted: 'Accettato la Fiducia',
|
||||
rejected: 'Rifiutato la Fiducia',
|
||||
domanda_addtofriend: 'Aggiungere agli amici {username}?',
|
||||
domanda_removefriend: 'Rimuovi dagli Amici {username}?',
|
||||
},
|
||||
components: {
|
||||
authentication: {
|
||||
@@ -819,14 +826,17 @@ const msg_it = {
|
||||
date_updated: 'Ult. Aggiornamento',
|
||||
},
|
||||
mypages: {
|
||||
find_people: 'Cerca Persone',
|
||||
friends: 'Amici',
|
||||
request_trust: 'Richieste di Fiducia',
|
||||
request_trust: 'Richieste',
|
||||
trusted: 'Accettati',
|
||||
rejected: 'Rifiutati',
|
||||
},
|
||||
friends: {
|
||||
accept: 'Accetta',
|
||||
reject: 'Rifiuta',
|
||||
accept_trust: 'Accetta Fiducia',
|
||||
accept_friend: 'Accetta Amicizia',
|
||||
reject_trust: 'Rifiuta Fiducia',
|
||||
reject_friend: 'Rifiuta Fiducia',
|
||||
remove_from_myfriends: 'Rimuovi dagli Amici',
|
||||
block_user: 'Blocca Utente',
|
||||
}
|
||||
|
||||
@@ -8,10 +8,15 @@ export const costanti = {
|
||||
CONFIG_ID_STATE_CONN: '2',
|
||||
CONFIG_ID_SHOW_TYPE_TODOS: '3',
|
||||
|
||||
SHOW_USERINFO: 1,
|
||||
|
||||
DIR_UPLOAD: 'upload/', // upload/
|
||||
|
||||
FRIENDS: 1,
|
||||
ASK_TRUST: 2,
|
||||
TRUSTED: 3,
|
||||
REEJECTED: 4,
|
||||
FIND_PEOPLE: 10,
|
||||
|
||||
FILTER_TUTTI: -100,
|
||||
|
||||
|
||||
@@ -384,6 +384,19 @@ export const colSubSkills = [
|
||||
AddCol(DeleteRec),
|
||||
]
|
||||
|
||||
export const colmyUserPeople = [
|
||||
// AddCol({ name: '_id', label_trans: 'reg.id' }),
|
||||
AddCol({ name: 'username', label_trans: 'reg.username_short' }),
|
||||
AddCol({ name: 'name', label_trans: 'reg.name' }),
|
||||
AddCol({
|
||||
name: 'profile.img', field: 'profile', subfield: 'img', label_trans: 'reg.img', sortable: false,
|
||||
}),
|
||||
// AddCol({ name: 'sospeso', label_trans: 'reg.sospeso', fieldtype: costanti.FieldType.boolean }),
|
||||
// AddCol({ name: 'deleted', label_trans: 'reg.deleted', fieldtype: costanti.FieldType.boolean }),
|
||||
]
|
||||
|
||||
|
||||
|
||||
export const colmySkills = [
|
||||
/*AddCol({
|
||||
name: 'userId', label_trans: 'order.users', fieldtype: costanti.FieldType.string, jointable: 'users',
|
||||
|
||||
@@ -3368,7 +3368,7 @@ export const tools = {
|
||||
return mystr.replace(/\//g, '-')
|
||||
},
|
||||
geturlrelativeprofile() {
|
||||
return 'upload/profile'
|
||||
return costanti.DIR_UPLOAD + 'profile'
|
||||
},
|
||||
getvers() {
|
||||
return process.env.APP_VERSION
|
||||
|
||||
@@ -21,6 +21,7 @@ import { useTodoStore } from '@store/Todos'
|
||||
import { Router } from 'vue-router'
|
||||
import { useProjectStore } from '@store/Projects'
|
||||
import { shared_consts } from '@/common/shared_vuejs'
|
||||
import { costanti } from '@costanti'
|
||||
|
||||
export const DefaultUser: IUserFields = {
|
||||
_id: '',
|
||||
@@ -171,7 +172,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
const myrec = this.getUserByUsername(username)
|
||||
// console.log('myrec', myrec)
|
||||
if (myrec && myrec.profile && !!myrec.profile.img && myrec.profile.img !== '' && myrec.profile.img !== 'undefined') {
|
||||
return 'upload/profile/' + this.my.username + '/' + myrec.profile.img
|
||||
return costanti.DIR_UPLOAD+'profile/' + this.my.username + '/' + myrec.profile.img
|
||||
}
|
||||
return ''
|
||||
},
|
||||
@@ -180,7 +181,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
|
||||
try{
|
||||
if (userparam.profile && userparam.profile.img) {
|
||||
return 'upload/profile/' + userparam.username + '/' + userparam.profile.img
|
||||
return costanti.DIR_UPLOAD + 'profile/' + userparam.username + '/' + userparam.profile.img
|
||||
}
|
||||
}catch (e) {}
|
||||
return 'images/noimg.png'
|
||||
@@ -843,7 +844,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
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
|
||||
return res.data
|
||||
}).catch((error) => {
|
||||
tools.showNegativeNotif($q, t('db.recfailed'))
|
||||
return {}
|
||||
|
||||
@@ -3,22 +3,23 @@ import { CTitleBanner } from '@/components/CTitleBanner'
|
||||
import { CProfile } from '@/components/CProfile'
|
||||
import { CSkill } from '@/components/CSkill'
|
||||
import { CDateTime } from '@/components/CDateTime'
|
||||
import { CGridTableRec } from '@/components/CGridTableRec'
|
||||
import { CMyUser } from '@/components/CMyUser'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { computed, defineComponent, onMounted, ref, watch } from 'vue'
|
||||
import { computed, defineComponent, onMounted, ref } from 'vue'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { costanti } from '@costanti'
|
||||
import { IUserFields, IUserProfile } from 'model'
|
||||
import { ISearchList, IUserFields } from 'model'
|
||||
import { shared_consts } from '@/common/shared_vuejs'
|
||||
import { colmyUserPeople } from '@store/Modules/fieldsTable'
|
||||
|
||||
|
||||
export default defineComponent({
|
||||
name: 'myuser',
|
||||
components: { CProfile, CTitleBanner, CMyFieldDb, CSkill, CDateTime },
|
||||
components: { CProfile, CTitleBanner, CMyFieldDb, CSkill, CDateTime, CGridTableRec, CMyUser},
|
||||
props: {},
|
||||
setup() {
|
||||
const userStore = useUserStore()
|
||||
@@ -28,12 +29,16 @@ export default defineComponent({
|
||||
const { t } = useI18n()
|
||||
|
||||
const username = ref('')
|
||||
const filter = ref(costanti.FRIENDS)
|
||||
const listFriends = ref([])
|
||||
const listTrusted = ref([])
|
||||
const filter = ref(costanti.FIND_PEOPLE)
|
||||
const listFriends = ref(<IUserFields[]>[])
|
||||
const listTrusted = ref(<IUserFields[]>[])
|
||||
|
||||
const filtroutente = ref(<any[]>[])
|
||||
|
||||
const arrfilterand: any = ref([])
|
||||
const filtercustom: any = ref([])
|
||||
const searchList = ref(<ISearchList[]>[])
|
||||
|
||||
const listfriendsfiltered = computed(() => {
|
||||
let arr: any[] = []
|
||||
if (filter.value === costanti.FRIENDS) {
|
||||
@@ -84,22 +89,38 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
function mounted() {
|
||||
username.value = userStore.my.username
|
||||
loadFriends()
|
||||
}
|
||||
|
||||
function getImgUser(profile: IUserFields) {
|
||||
return userStore.getImgByProfile(profile)
|
||||
}
|
||||
|
||||
function setRequestTrust(usernameDest: string, value: any) {
|
||||
let msg = ''
|
||||
if (value) {
|
||||
msg = t('db.domanda_trusted', { username: usernameDest })
|
||||
} else {
|
||||
msg = t('db.domanda_rejectedtrust', { 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.value, usernameDest, shared_consts.FRIENDSCMD.SETTRUST, value).then((res) => {
|
||||
if (res) {
|
||||
const myuser: IUserFields|undefined = listTrusted.value.find((rec: IUserFields) => rec.username === usernameDest )
|
||||
const myuser: IUserFields = listTrusted.value.find((rec: IUserFields) => rec.username === usernameDest)!
|
||||
if (myuser) {
|
||||
myuser.verified_by_aportador = value
|
||||
if (value) {
|
||||
// ADD to Trusted
|
||||
listFriends.value.push(myuser)
|
||||
listTrusted.value = listTrusted.value.filter((rec: IUserFields) => rec.username !== usernameDest)
|
||||
} else {
|
||||
// REMOVE to Trusted and to Friends
|
||||
listFriends.value = listFriends.value.filter((rec: IUserFields) => rec.username !== usernameDest)
|
||||
}
|
||||
}
|
||||
tools.showPositiveNotif($q, t('db.trusted'))
|
||||
|
||||
@@ -107,28 +128,103 @@ export default defineComponent({
|
||||
tools.showNegativeNotif($q, t('db.recfailed'))
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function addToMyFriends(usernameDest: string) {
|
||||
$q.dialog({
|
||||
message: t('db.domanda_addtofriend', { username: usernameDest }),
|
||||
ok: { label: t('dialog.yes'), push: true },
|
||||
cancel: { label: t('dialog.cancel') },
|
||||
title: t('db.domanda')
|
||||
}).onOk(() => {
|
||||
|
||||
userStore.setFriendsCmd($q, t, username.value, usernameDest, shared_consts.FRIENDSCMD.SETFRIEND, null)
|
||||
.then((res: any) => {
|
||||
if (res) {
|
||||
console.log('res = ', res)
|
||||
listFriends.value = [...listFriends.value, res]
|
||||
tools.showPositiveNotif($q, t('db.addedfriend'))
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function removeFromMyFriends(usernameDest: string) {
|
||||
$q.dialog({
|
||||
message: t('db.domanda_removefriend', { username: usernameDest }),
|
||||
ok: { label: t('dialog.yes'), push: true },
|
||||
cancel: { label: t('dialog.cancel') },
|
||||
title: t('db.domanda')
|
||||
}).onOk(() => {
|
||||
|
||||
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) => {
|
||||
$q.dialog({
|
||||
message: t('db.domanda_blockuser', { username: usernameDest }),
|
||||
ok: { label: t('dialog.yes'), push: true },
|
||||
cancel: { label: t('dialog.cancel') },
|
||||
title: t('db.domanda')
|
||||
}).onOk(() => {
|
||||
userStore.setFriendsCmd($q, t, username.value, usernameDest, shared_consts.FRIENDSCMD.BLOCK_USER, 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)
|
||||
function setCmd(cmd: number, usernameDest: string, value: any = '') {
|
||||
if (cmd === shared_consts.FRIENDSCMD.SETTRUST) {
|
||||
setRequestTrust(usernameDest, value)
|
||||
} else if (cmd === shared_consts.FRIENDSCMD.REMOVE_FROM_MYFRIENDS) {
|
||||
removeFromMyFriends(usernameDest)
|
||||
} else if (cmd === shared_consts.FRIENDSCMD.BLOCK_USER) {
|
||||
blockUser(usernameDest)
|
||||
} else if (cmd === shared_consts.FRIENDSCMD.SETFRIEND) {
|
||||
addToMyFriends(usernameDest)
|
||||
}
|
||||
}
|
||||
|
||||
function mounted() {
|
||||
username.value = userStore.my.username
|
||||
loadFriends()
|
||||
|
||||
searchList.value = []
|
||||
filtercustom.value = []
|
||||
arrfilterand.value = []
|
||||
}
|
||||
|
||||
function extraparams() {
|
||||
let lk_tab = 'users'
|
||||
let lk_LF = 'userId'
|
||||
let lk_FF = '_id'
|
||||
let lk_as = 'user'
|
||||
let af_objId_tab = 'myId'
|
||||
|
||||
return {
|
||||
lookup1: {
|
||||
lk_tab,
|
||||
lk_LF,
|
||||
lk_FF,
|
||||
lk_as,
|
||||
af_objId_tab,
|
||||
lk_proj: {
|
||||
username: 1,
|
||||
name: 1,
|
||||
'profile.img': 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
@@ -137,7 +233,7 @@ export default defineComponent({
|
||||
listfriends: listFriends,
|
||||
tools,
|
||||
costanti,
|
||||
getImgUser,
|
||||
shared_consts,
|
||||
filtroutente,
|
||||
filter,
|
||||
listfriendsfiltered,
|
||||
@@ -145,10 +241,12 @@ export default defineComponent({
|
||||
numAskTrust,
|
||||
numTrusted,
|
||||
numRejected,
|
||||
setRequestTrust,
|
||||
removeFromMyFriends,
|
||||
blockUser,
|
||||
naviga,
|
||||
arrfilterand,
|
||||
filtercustom,
|
||||
searchList,
|
||||
colmyUserPeople,
|
||||
extraparams,
|
||||
setCmd,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
color="white"
|
||||
text-color="primary"
|
||||
:options="[
|
||||
{label: $t('mypages.find_people'), value: costanti.FIND_PEOPLE},
|
||||
{label: $t('mypages.friends') + ' (' + numFriends + ')', value: costanti.FRIENDS},
|
||||
{label: $t('mypages.request_trust') + ' (' + numAskTrust + ')', value: costanti.ASK_TRUST},
|
||||
{label: $t('mypages.trusted') + ' (' + numTrusted + ')', value: costanti.TRUSTED},
|
||||
@@ -20,75 +21,42 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-if="filter === costanti.FIND_PEOPLE">
|
||||
<CGridTableRec
|
||||
prop_mytable="users"
|
||||
prop_mytitle=""
|
||||
:prop_mycolumns="colmyUserPeople"
|
||||
prop_colkey="_id"
|
||||
col_title="username"
|
||||
:vertical="true"
|
||||
nodataLabel=" "
|
||||
:prop_search="true"
|
||||
hint="Username da trovare"
|
||||
:finder="true"
|
||||
:finder_noNull="true"
|
||||
:options="shared_consts.OPTIONS_SEARCH_ONLY_FULL_WORDS"
|
||||
:butt_modif_new="false"
|
||||
noresultLabel="Username non trovato"
|
||||
:arrfilters="arrfilterand"
|
||||
:filtercustom="filtercustom"
|
||||
:prop_searchList="searchList"
|
||||
:showType="costanti.SHOW_USERINFO"
|
||||
keyMain=""
|
||||
:extraparams="extraparams()">
|
||||
|
||||
</CGridTableRec>
|
||||
</div>
|
||||
<div v-else>
|
||||
<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 @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 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>
|
||||
<span v-for="(contact, index) in listfriendsfiltered" :key="index" class="q-my-sm" clickable>
|
||||
<CMyUser
|
||||
:mycontact="contact"
|
||||
@setCmd="setCmd"
|
||||
:visu="filter">
|
||||
</CMyUser>
|
||||
</span>
|
||||
</q-list>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user