- Se clicchi sulla foto, mi apre il profilo anzichè l'invio dei RIS - ++ Filtro sulle ricerche: Scegliere un Circuito specifico. - Nella lista iscritti compaiono anche i cancellati... - n "Attività" si vede tutto allargato, non sta nella dimensione della pagina. - Nelle notifiche della campanellina non si vede più il titolo... (è vuoto). - Non funziona il Filtro per Settore (nella Home sugli Eventi) - Filtri avanzati da mostrare solo se clicco sul bottone. - I menu in basso non funzionano ! - Nel menu "Iscritti" del circuito, non compare più la ricerca ! Riattivarla - Opzione di mandare una email quando uno si registra al Circuito - ++ Opzione per il Circuito: Chiedi di entrare agli admin (e non in automatico).
236 lines
6.0 KiB
TypeScript
Executable File
236 lines
6.0 KiB
TypeScript
Executable File
import { CMyCircuit } from '@/components/CMyCircuit'
|
|
import { computed, defineComponent, onMounted, PropType, ref, toRef, watch } from 'vue'
|
|
import { useUserStore } from '@store/UserStore'
|
|
import { useGlobalStore } from '@store/globalStore'
|
|
import { useCircuitStore } from '@store/CircuitStore'
|
|
import { useI18n } from '@/boot/i18n'
|
|
import { useQuasar } from 'quasar'
|
|
import { costanti } from '@costanti'
|
|
import { ICircuit, ISearchList, IUserFields } from 'model'
|
|
import { shared_consts } from '@/common/shared_vuejs'
|
|
import { tools } from '@store/Modules/tools'
|
|
import { CUserNonVerif } from '@/components/CUserNonVerif'
|
|
import { CTitleBanner } from '@/components/CTitleBanner'
|
|
import { CMovements } from '@/components/CMovements'
|
|
import { CSendRISTo } from '@/components/CSendRISTo'
|
|
|
|
|
|
export default defineComponent({
|
|
name: 'CMyCircuits',
|
|
components: { CMyCircuit, CUserNonVerif, CTitleBanner, CMovements, CSendRISTo },
|
|
emits: ['update:modelValue'],
|
|
props: {
|
|
modelValue: {
|
|
type: Number,
|
|
required: false,
|
|
default: 0,
|
|
},
|
|
finder: {
|
|
type: Boolean,
|
|
required: true,
|
|
},
|
|
showfinder: {
|
|
type: Boolean,
|
|
required: false,
|
|
default: true,
|
|
},
|
|
showBarSelection: {
|
|
type: Boolean,
|
|
required: false,
|
|
default: true,
|
|
},
|
|
circuit: {
|
|
type: Object as PropType<ICircuit | null>,
|
|
required: false,
|
|
default: null,
|
|
},
|
|
circuitname: {
|
|
type: String,
|
|
required: false,
|
|
default: null,
|
|
},
|
|
visu: {
|
|
type: Number,
|
|
required: false,
|
|
default: 0,
|
|
},
|
|
},
|
|
setup(props, { emit }) {
|
|
const userStore = useUserStore()
|
|
const circuitStore = useCircuitStore()
|
|
const $q = useQuasar()
|
|
const { t } = useI18n()
|
|
|
|
const username = ref('')
|
|
const visu = ref(0)
|
|
const numtransaz = ref(0)
|
|
const finishloading = ref(false)
|
|
const loadingvalues = ref(false)
|
|
|
|
const mytab = ref('circuiti')
|
|
|
|
const init = ref(false)
|
|
|
|
const globalStore = useGlobalStore()
|
|
const isfinishLoadingSite = computed(() => globalStore.finishLoading)
|
|
|
|
const filtroutente = ref(<any[]>[])
|
|
|
|
const nummovTodownload = ref(5)
|
|
|
|
const listcircuitsfind = computed(() => {
|
|
// console.log('list modif')
|
|
return updateListCircuit(costanti.FIND_CIRCUIT)
|
|
})
|
|
const listcircuitsmy = computed(() => {
|
|
// console.log('list modif')
|
|
return updateListCircuit(costanti.MY_CIRCUITS)
|
|
})
|
|
|
|
const listcircuitsfiltered = computed(() => {
|
|
// console.log('list modif')
|
|
return updateListCircuit(visu.value)
|
|
})
|
|
|
|
const myoptions = computed(() => {
|
|
const mybutt = []
|
|
mybutt.push({ label: t('mypages.follow_circuits') + ' (' + numMyCircuits.value + ')', value: costanti.MY_CIRCUITS })
|
|
mybutt.push({ label: t('mypages.find_circuit'), value: costanti.FIND_CIRCUIT })
|
|
|
|
|
|
if (numAskSentCircuits.value > 0 || visu.value === costanti.ASK_SENT_CIRCUIT)
|
|
mybutt.push({
|
|
label: t('mypages.request_sent') + ' (' + numAskSentCircuits.value + ')',
|
|
value: costanti.ASK_SENT_CIRCUIT
|
|
})
|
|
|
|
|
|
return mybutt
|
|
})
|
|
|
|
|
|
const numMyCircuits = computed(() => {
|
|
const arr = userStore.my.profile.mycircuits
|
|
return (arr) ? arr.length : 0
|
|
})
|
|
|
|
const numAskSentCircuits = computed(() => {
|
|
const arr = userStore.my.profile.asked_circuits
|
|
return (arr) ? arr.length : 0
|
|
})
|
|
|
|
watch(() => globalStore.finishLoading, async (to: any, from: any) => {
|
|
load()
|
|
})
|
|
|
|
async function loadCircuits(nummovTodownload: number) {
|
|
// Carica il profilo di quest'utente
|
|
if (username.value) {
|
|
filtroutente.value = await tools.loadCircuits(nummovTodownload)
|
|
}
|
|
}
|
|
|
|
function updateListCircuit(visu: number) {
|
|
let arr: any[] = []
|
|
try {
|
|
if (visu === costanti.CIRCUITS) {
|
|
arr = circuitStore.listcircuits
|
|
} else if (visu === costanti.MY_CIRCUITS) {
|
|
arr = circuitStore.listcircuits.filter((circ: any) => userStore.my.profile.mycircuits.findIndex((rec: any) => circ.name === rec.circuitname) >= 0)
|
|
} else if (visu === costanti.ASK_SENT_CIRCUIT) {
|
|
arr = userStore.my.profile.asked_circuits
|
|
}
|
|
} catch (e) {
|
|
arr = []
|
|
}
|
|
|
|
if (visu === costanti.MY_CIRCUITS) {
|
|
const arrtoinsert: any = circuitStore.listcircuits.filter((circ: any) => circ.showAlways)
|
|
for (const rec of arrtoinsert) {
|
|
if (arr.findIndex(myrec => myrec._id === rec._id) < 0) {
|
|
// Se non c'è il circuito Nazionale, glielo aggiungo
|
|
arr.push(rec)
|
|
}
|
|
}
|
|
}
|
|
|
|
return arr
|
|
}
|
|
|
|
|
|
async function load() {
|
|
if (init.value)
|
|
return // Gia inizializzato
|
|
|
|
// console.log(' ## INIZIO MOUNT ')
|
|
username.value = userStore.my.username
|
|
visu.value = props.modelValue
|
|
|
|
await loadCircuits(nummovTodownload.value)
|
|
|
|
finishloading.value = true
|
|
init.value = true
|
|
// console.log(' -- FINE MOUNT ')
|
|
}
|
|
|
|
function updateValue(val: number) {
|
|
emit('update:modelValue', val)
|
|
}
|
|
|
|
function togglevisu() {
|
|
if (visu.value !== costanti.FIND_CIRCUIT) {
|
|
visu.value = costanti.FIND_CIRCUIT
|
|
} else {
|
|
visu.value = costanti.MY_CIRCUITS
|
|
}
|
|
}
|
|
function movcaricati(params: any) {
|
|
if (params.numtransaz) {
|
|
numtransaz.value = params.numtransaz
|
|
}
|
|
|
|
}
|
|
|
|
function mounted() {
|
|
if (globalStore.finishLoading) {
|
|
load()
|
|
}
|
|
}
|
|
|
|
async function addlastmov() {
|
|
nummovTodownload.value += 5
|
|
|
|
loadingvalues.value = true
|
|
await loadCircuits(nummovTodownload.value)
|
|
loadingvalues.value = false
|
|
}
|
|
|
|
|
|
onMounted(mounted)
|
|
|
|
return {
|
|
tools,
|
|
costanti,
|
|
shared_consts,
|
|
filtroutente,
|
|
listcircuitsfiltered,
|
|
updateValue,
|
|
myoptions,
|
|
userStore,
|
|
circuitStore,
|
|
username,
|
|
t,
|
|
visu,
|
|
listcircuitsfind,
|
|
listcircuitsmy,
|
|
togglevisu,
|
|
movcaricati,
|
|
numtransaz,
|
|
finishloading,
|
|
addlastmov,
|
|
loadingvalues,
|
|
mytab,
|
|
}
|
|
}
|
|
})
|