2022-08-26 03:32:50 +02:00
|
|
|
import { CGridTableRec } from '@/components/CGridTableRec'
|
|
|
|
|
import { CMyFriends } from '@/components/CMyFriends'
|
|
|
|
|
import { CMyUser } from '@/components/CMyUser'
|
|
|
|
|
import { CTitleBanner } from '@/components/CTitleBanner'
|
|
|
|
|
import { CProfile } from '@/components/CProfile'
|
|
|
|
|
import { CCheckIfIsLogged } from '@/components/CCheckIfIsLogged'
|
|
|
|
|
import { CMyFieldRec } from '@/components/CMyFieldRec'
|
|
|
|
|
import { CSkill } from '@/components/CSkill'
|
|
|
|
|
import { CDateTime } from '@/components/CDateTime'
|
|
|
|
|
import { tools } from '@store/Modules/tools'
|
|
|
|
|
import { computed, defineComponent, onMounted, ref, watch } 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'
|
2022-09-03 13:06:35 +02:00
|
|
|
import { ICity, IFriends, ICircuit, ISearchList, IUserFields, IAccount } from 'model'
|
2022-08-26 03:32:50 +02:00
|
|
|
import { shared_consts } from '@/common/shared_vuejs'
|
2022-09-11 11:45:13 +02:00
|
|
|
import { colmyUserPeople, colmyUserCircuit, colmyMovement } from '@store/Modules/fieldsTable'
|
2022-08-26 03:32:50 +02:00
|
|
|
import { useNotifStore } from '@store/NotifStore'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
|
name: 'mycircuit',
|
2022-09-11 11:45:13 +02:00
|
|
|
components: { CProfile, CTitleBanner, CMyFieldRec, CSkill, CDateTime, CMyFriends,
|
|
|
|
|
CGridTableRec, CMyUser, CCheckIfIsLogged },
|
2022-08-26 03:32:50 +02:00
|
|
|
props: {},
|
|
|
|
|
setup() {
|
|
|
|
|
const userStore = useUserStore()
|
|
|
|
|
const notifStore = useNotifStore()
|
|
|
|
|
const $route = useRoute()
|
|
|
|
|
const $q = useQuasar()
|
|
|
|
|
const { t } = useI18n()
|
|
|
|
|
|
|
|
|
|
const animation = ref('fade')
|
|
|
|
|
|
2022-08-30 17:00:32 +02:00
|
|
|
const path = computed(() => $route.params.path ? $route.params.path.toString() : '')
|
2022-08-26 03:32:50 +02:00
|
|
|
const idnotif = computed(() => $route.query.idnotif ? $route.query.idnotif.toString() : '')
|
|
|
|
|
|
|
|
|
|
const filtroutente = ref(<any[]>[])
|
|
|
|
|
const showPic = ref(false)
|
|
|
|
|
|
|
|
|
|
const circuit = ref(<ICircuit|null>{})
|
2022-09-03 13:06:35 +02:00
|
|
|
const account = ref(<IAccount|null>{})
|
2022-08-26 03:32:50 +02:00
|
|
|
const mystatus = ref(<number>0)
|
|
|
|
|
const users_in_circuit = ref(<IFriends[]>[])
|
|
|
|
|
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
|
|
|
|
|
const tabgrp = ref('info')
|
|
|
|
|
const tabmembers = ref('all')
|
|
|
|
|
const tab = ref('membri')
|
|
|
|
|
|
|
|
|
|
const arrfilterand: any = ref([])
|
|
|
|
|
const filtercustom: any = ref([])
|
|
|
|
|
const filtercustom_rich: any = ref([])
|
|
|
|
|
const searchList = ref(<ISearchList[]>[])
|
|
|
|
|
|
|
|
|
|
const cities = ref(<ICity[]>[])
|
|
|
|
|
|
2022-08-30 17:00:32 +02:00
|
|
|
watch(() => path.value, (to: any, from: any) => {
|
|
|
|
|
loadCircuit()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
2022-08-26 03:32:50 +02:00
|
|
|
function profile() {
|
|
|
|
|
return userStore.my.profile
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function loadCircuit() {
|
|
|
|
|
// Carica il profilo di quest'utente
|
2022-08-30 17:00:32 +02:00
|
|
|
if (path.value) {
|
2022-09-02 02:25:17 +02:00
|
|
|
await userStore.loadCircuit(path.value, idnotif.value).then(({ data, status }: {data: any, status: number}) => {
|
2022-08-26 03:32:50 +02:00
|
|
|
console.log('data', data)
|
|
|
|
|
if (data) {
|
|
|
|
|
circuit.value = data.circuit
|
|
|
|
|
notifStore.setAsRead(idnotif.value)
|
|
|
|
|
users_in_circuit.value = data.users_in_circuit
|
|
|
|
|
} else {
|
|
|
|
|
circuit.value = null
|
|
|
|
|
users_in_circuit.value = []
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-11 11:45:13 +02:00
|
|
|
if (circuit.value) {
|
|
|
|
|
account.value = userStore.getAccountByCircuitId(circuit.value._id)
|
|
|
|
|
console.log('account', account.value)
|
|
|
|
|
}
|
2022-09-03 13:06:35 +02:00
|
|
|
|
2022-08-26 03:32:50 +02:00
|
|
|
mystatus.value = status
|
|
|
|
|
|
|
|
|
|
loading.value = false
|
|
|
|
|
// filtroutente.value = [{ userId: userStore.my._id }]
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function mounted() {
|
|
|
|
|
loading.value = true
|
|
|
|
|
await loadCircuit()
|
|
|
|
|
|
|
|
|
|
searchList.value = []
|
2022-09-02 02:25:17 +02:00
|
|
|
if (circuit.value) {
|
|
|
|
|
filtercustom.value = [{ 'profile.mycircuits': { $elemMatch: { circuitname: { $eq: circuit.value.name } } } }]
|
|
|
|
|
}
|
2022-08-26 03:32:50 +02:00
|
|
|
|
|
|
|
|
arrfilterand.value = []
|
|
|
|
|
filtercustom_rich.value = []
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-30 17:00:32 +02:00
|
|
|
function getImgCircuit() {
|
2022-08-26 03:32:50 +02:00
|
|
|
if (circuit.value)
|
|
|
|
|
return userStore.getImgByCircuit(circuit.value)
|
|
|
|
|
else
|
|
|
|
|
return ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function checkifShow(col: string) {
|
|
|
|
|
//++Todo: checkifShow Permessi !
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
'profile.img': 1,
|
|
|
|
|
'profile.mycircuits': 1,
|
|
|
|
|
'profile.qualifica': 1,
|
|
|
|
|
reported: 1,
|
|
|
|
|
date_report: 1,
|
|
|
|
|
username_who_report: 1,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function extraparams_rich() {
|
|
|
|
|
return {
|
|
|
|
|
querytype: shared_consts.QUERYTYPE_CIRCUIT,
|
2022-09-11 11:45:13 +02:00
|
|
|
myid: circuit.value ? circuit.value._id : '',
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function extraparams_movs() {
|
|
|
|
|
return {
|
|
|
|
|
querytype: shared_consts.QUERYTYPE_LIST_MOVEMENTS,
|
|
|
|
|
myid: circuit.value ? circuit.value._id : '',
|
|
|
|
|
username: userStore.my.username,
|
2022-08-26 03:32:50 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function extraparams_refused() {
|
|
|
|
|
return {
|
2022-08-30 17:00:32 +02:00
|
|
|
querytype: shared_consts.QUERYTYPE_REFUSED_USER_CIRCUIT,
|
2022-09-11 11:45:13 +02:00
|
|
|
myid: circuit.value ? circuit.value._id : '',
|
2022-08-26 03:32:50 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function numUsers() {
|
|
|
|
|
return users_in_circuit.value ? users_in_circuit.value.length : 0
|
|
|
|
|
}
|
|
|
|
|
function numAdmins() {
|
|
|
|
|
return (circuit.value && circuit.value.admins) ? circuit.value.admins.length : 0
|
|
|
|
|
}
|
|
|
|
|
function listaAdmins() {
|
|
|
|
|
return (circuit.value && circuit.value.admins) ? circuit.value.admins.map((rec) => rec.username).join(', ') : ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(mounted)
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
profile,
|
|
|
|
|
tools,
|
|
|
|
|
costanti,
|
|
|
|
|
circuit,
|
2022-09-03 13:06:35 +02:00
|
|
|
account,
|
2022-08-26 03:32:50 +02:00
|
|
|
shared_consts,
|
2022-08-30 17:00:32 +02:00
|
|
|
getImgCircuit,
|
2022-08-26 03:32:50 +02:00
|
|
|
checkifShow,
|
|
|
|
|
|
|
|
|
|
filtroutente,
|
|
|
|
|
showPic,
|
|
|
|
|
userStore,
|
|
|
|
|
t,
|
|
|
|
|
animation,
|
|
|
|
|
arrfilterand,
|
|
|
|
|
filtercustom,
|
|
|
|
|
filtercustom_rich,
|
|
|
|
|
searchList,
|
2022-09-11 11:45:13 +02:00
|
|
|
colmyMovement,
|
2022-08-26 03:32:50 +02:00
|
|
|
colmyUserPeople,
|
|
|
|
|
colmyUserCircuit,
|
|
|
|
|
extraparams,
|
|
|
|
|
extraparams_rich,
|
|
|
|
|
extraparams_refused,
|
2022-09-11 11:45:13 +02:00
|
|
|
extraparams_movs,
|
2022-08-26 03:32:50 +02:00
|
|
|
tab,
|
|
|
|
|
tabgrp,
|
|
|
|
|
tabmembers,
|
|
|
|
|
numUsers,
|
|
|
|
|
numAdmins,
|
|
|
|
|
listaAdmins,
|
|
|
|
|
users_in_circuit,
|
|
|
|
|
loading,
|
|
|
|
|
mystatus,
|
|
|
|
|
cities,
|
2022-09-11 11:45:13 +02:00
|
|
|
path,
|
2022-08-26 03:32:50 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|