2022-01-14 23:54:12 +01:00
|
|
|
import { CMyFriends } from '@/components/CMyFriends'
|
2022-01-12 00:38:31 +01:00
|
|
|
import { CGridTableRec } from '@/components/CGridTableRec'
|
2022-01-05 19:11:47 +01:00
|
|
|
import { tools } from '@store/Modules/tools'
|
2022-01-14 23:54:12 +01:00
|
|
|
import { computed, defineComponent, onMounted, ref, watch } from 'vue'
|
2022-01-05 19:11:47 +01:00
|
|
|
import { useUserStore } from '@store/UserStore'
|
|
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
2022-01-14 23:54:12 +01:00
|
|
|
import { useGlobalStore } from '@store/globalStore'
|
2022-01-05 19:11:47 +01:00
|
|
|
import { useI18n } from '@/boot/i18n'
|
2022-01-14 23:54:12 +01:00
|
|
|
import { colmyUserPeople } from '@store/Modules/fieldsTable'
|
|
|
|
|
import { ISearchList } from 'model'
|
2022-01-05 19:11:47 +01:00
|
|
|
import { costanti } from '@costanti'
|
2022-01-07 01:16:46 +01:00
|
|
|
import { shared_consts } from '@/common/shared_vuejs'
|
2022-03-01 23:50:47 +01:00
|
|
|
import { toolsext } from '@store/Modules/toolsext'
|
2022-01-05 19:11:47 +01:00
|
|
|
|
|
|
|
|
export default defineComponent({
|
2022-01-14 23:54:12 +01:00
|
|
|
name: 'myfriends',
|
|
|
|
|
components: { CMyFriends, CGridTableRec },
|
2022-01-05 19:11:47 +01:00
|
|
|
props: {},
|
|
|
|
|
setup() {
|
|
|
|
|
const userStore = useUserStore()
|
|
|
|
|
const $route = useRoute()
|
|
|
|
|
const { t } = useI18n()
|
|
|
|
|
|
2022-01-12 00:38:31 +01:00
|
|
|
const arrfilterand: any = ref([])
|
|
|
|
|
const filtercustom: any = ref([])
|
|
|
|
|
const searchList = ref(<ISearchList[]>[])
|
|
|
|
|
|
2022-01-14 23:54:12 +01:00
|
|
|
const filter = ref(costanti.FIND_PEOPLE)
|
2022-01-12 00:38:31 +01:00
|
|
|
|
|
|
|
|
function mounted() {
|
2022-03-11 12:38:17 +01:00
|
|
|
console.log('mounted')
|
2022-03-01 23:50:47 +01:00
|
|
|
searchList.value = [
|
|
|
|
|
{
|
|
|
|
|
label: 'Regione',
|
|
|
|
|
table: 'regions',
|
|
|
|
|
key: 'idReg',
|
|
|
|
|
type: costanti.FieldType.select,
|
|
|
|
|
value: tools.getCookie(tools.COOK_SEARCH + 'regions', costanti.FILTER_TUTTI),
|
|
|
|
|
addall: true,
|
|
|
|
|
arrvalue: [],
|
|
|
|
|
filter: null,
|
|
|
|
|
useinput: false,
|
|
|
|
|
icon: 'fas fa-globe-europe'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'Provincia',
|
|
|
|
|
table: 'provinces',
|
|
|
|
|
key: 'idProvince',
|
|
|
|
|
type: costanti.FieldType.select,
|
|
|
|
|
value: tools.getCookie(tools.COOK_SEARCH + 'provinces', costanti.FILTER_TUTTI),
|
|
|
|
|
addall: true,
|
|
|
|
|
arrvalue: [],
|
|
|
|
|
filter: getFilterProvinceByRegion,
|
|
|
|
|
useinput: true,
|
|
|
|
|
icon: 'flag',
|
|
|
|
|
tablesel: 'provinces',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'Comune',
|
|
|
|
|
table: 'cities',
|
2022-03-11 12:38:17 +01:00
|
|
|
key: 'profile.born_city_id',
|
2022-03-01 23:50:47 +01:00
|
|
|
type: costanti.FieldType.select_by_server,
|
|
|
|
|
value: tools.getCookie(tools.COOK_SEARCH + 'cities', costanti.FILTER_TUTTI),
|
|
|
|
|
addall: true,
|
|
|
|
|
arrvalue: [],
|
|
|
|
|
useinput: true,
|
|
|
|
|
filter: null,
|
|
|
|
|
// filter: getFilterCitiesByProvince,
|
|
|
|
|
// param1: shared_consts.PARAM_SHOW_PROVINCE,
|
|
|
|
|
tablesel: 'cities',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'In cambio di',
|
|
|
|
|
table: 'contribtypes',
|
|
|
|
|
key: 'idContribType',
|
|
|
|
|
value: 0,
|
|
|
|
|
arrvalue: tools.getCookie(tools.COOK_SEARCH + 'contribtypes', []),
|
|
|
|
|
type: costanti.FieldType.multiselect,
|
|
|
|
|
filter: null,
|
|
|
|
|
useinput: false,
|
|
|
|
|
icon: 'fas fa-hand-holding',
|
|
|
|
|
filteradv: true,
|
|
|
|
|
//icon: 'swap_horizontal_circle',
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
2022-01-12 00:38:31 +01:00
|
|
|
filtercustom.value = []
|
|
|
|
|
arrfilterand.value = []
|
2022-01-28 18:15:46 +01:00
|
|
|
|
|
|
|
|
const filt_loaded = tools.getCookie(tools.COOK_SEARCH + tools.FRIENDS_SEARCH)
|
|
|
|
|
filter.value = filt_loaded ? filt_loaded : costanti.FIND_PEOPLE
|
2022-01-12 00:38:31 +01:00
|
|
|
}
|
2022-01-28 18:15:46 +01:00
|
|
|
watch(() => filter.value, (newval: any, oldval) => {
|
|
|
|
|
tools.setCookie(tools.COOK_SEARCH + tools.FRIENDS_SEARCH, newval)
|
|
|
|
|
|
|
|
|
|
})
|
2022-01-12 00:38:31 +01:00
|
|
|
|
|
|
|
|
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,
|
2022-03-11 12:38:17 +01:00
|
|
|
'profile.born_city_id': 1,
|
2022-01-20 00:38:49 +01:00
|
|
|
'profile.qualifica': 1,
|
2022-08-04 17:30:01 +02:00
|
|
|
reported: 1,
|
2022-08-09 17:31:49 +02:00
|
|
|
date_report: 1,
|
|
|
|
|
username_who_report: 1,
|
2022-01-12 00:38:31 +01:00
|
|
|
}
|
2022-03-11 12:38:17 +01:00
|
|
|
},
|
|
|
|
|
lookup2: {
|
|
|
|
|
lk_tab: 'cities',
|
|
|
|
|
lk_LF: 'profile.born_city_id',
|
|
|
|
|
lk_FF: '_id',
|
|
|
|
|
lk_as: 'comune',
|
|
|
|
|
af_objId_tab: '',
|
|
|
|
|
lk_proj: {
|
|
|
|
|
idCity: 1,
|
|
|
|
|
numLevel: 1,
|
|
|
|
|
comune: 1,
|
|
|
|
|
userId: 1,
|
|
|
|
|
username: 1,
|
|
|
|
|
name: 1,
|
|
|
|
|
surname: 1,
|
|
|
|
|
mycities: 1,
|
|
|
|
|
'profile.img': 1,
|
|
|
|
|
'profile.qualifica': 1,
|
2022-08-04 17:30:01 +02:00
|
|
|
reported: 1,
|
2022-08-09 17:31:49 +02:00
|
|
|
date_report: 1,
|
|
|
|
|
username_who_report: 1,
|
2022-03-11 12:38:17 +01:00
|
|
|
'profile.born_city_id': 1,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2022-01-12 00:38:31 +01:00
|
|
|
}
|
2022-01-07 01:16:46 +01:00
|
|
|
}
|
|
|
|
|
|
2022-03-01 23:50:47 +01:00
|
|
|
function getFilterProvinceByRegion(recProvince: any, index: number, arr: any) {
|
|
|
|
|
const recreg: any = searchList.value.find((rec) => rec.table === 'regions')
|
|
|
|
|
if (recreg) {
|
|
|
|
|
return recProvince.reg === recreg.value
|
|
|
|
|
} else {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-14 23:54:12 +01:00
|
|
|
|
2022-01-05 19:11:47 +01:00
|
|
|
onMounted(mounted)
|
|
|
|
|
|
|
|
|
|
return {
|
2022-01-14 23:54:12 +01:00
|
|
|
filter,
|
2022-01-05 19:11:47 +01:00
|
|
|
costanti,
|
2022-01-12 00:38:31 +01:00
|
|
|
shared_consts,
|
|
|
|
|
arrfilterand,
|
|
|
|
|
filtercustom,
|
|
|
|
|
searchList,
|
|
|
|
|
colmyUserPeople,
|
|
|
|
|
extraparams,
|
2022-03-01 23:50:47 +01:00
|
|
|
getFilterProvinceByRegion,
|
2022-01-05 19:11:47 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|