- se annuncio cancellato (mostra avviso)

This commit is contained in:
Surya Paolo
2024-09-18 14:56:25 +02:00
parent 1142526ed8
commit 4ac0acc2f3
4 changed files with 29 additions and 12 deletions

View File

@@ -87,6 +87,7 @@ export default defineComponent({
const $router = useRouter()
const contextDay = ref(<any>null)
const ismounted = ref(false)
const usersList = ref(<any>{ show: false, title: '', list: [], loadfromDb: false, tipofavbook: 0 })
const bookedList = ref(<any>{ show: false, title: '', list: [], loadfromDb: false, tipofavbook: 0 })
@@ -143,7 +144,7 @@ export default defineComponent({
state: EState.Creating,
})
const myrec = ref(<any>{})
const myrec = ref(<any>null)
const col = ref(<IColGridTable>{})
const idnotif = computed(() => $route.query.idnotif ? $route.query.idnotif.toString() : '')
@@ -187,13 +188,14 @@ export default defineComponent({
}
async function load() {
console.log('load')
// Carica il record
if (props.idRec) {
await userStore.loadGeneric(props.table, props.idRec, idnotif.value).then((ris) => {
// console.log('myrec', myrec)
myrec.value = ris
notifStore.setAsRead(idnotif.value)
if (ris)
notifStore.setAsRead(idnotif.value)
}).catch((err) => {
})
@@ -203,7 +205,8 @@ export default defineComponent({
await userStore.loadGeneric(props.table, props.prop_myrec._id, idnotif.value).then((ris) => {
// console.log('myrec', myrec)
myrec.value = ris
notifStore.setAsRead(idnotif.value)
if (ris)
notifStore.setAsRead(idnotif.value)
})
}
@@ -212,16 +215,19 @@ export default defineComponent({
clicca(costanti.TIPOFAVBOOK.SEEN, true, myrec.value._id)
col.value = fieldsTable.getArrColsByTable(props.table)
ismounted.value = true
}
watch(() => props.idRec, (to: any, from: any) => {
load()
if (ismounted.value)
load()
})
async function mounted() {
load()
await load()
await nextTick()
}
function updateCard() {
@@ -708,6 +714,7 @@ export default defineComponent({
smallHeight,
toggleShowScheda,
showInMap,
ismounted,
}
}
})

View File

@@ -1041,6 +1041,16 @@
/>
</div>
</div>
<div v-else-if="ismounted && !myrec">
<br /><br />
<q-banner rounded class="q-ma-md q-pa-md bg-negative text-white">
<div class="text-h6 text-center">
Pagina non trovata<br />
Probabilmente l'annuncio è stato cancellato
</div>
</q-banner>
<br /><br />
</div>
<q-dialog v-model="usersList.loadfromDb">
<q-card class="dialog_card">

View File

@@ -225,7 +225,7 @@ export const useNotifStore = defineStore('NotifStore', {
},
async updateNotifDataFromServer({ username, lastdataread }: { username: string, lastdataread: Date }) {
// console.log('updateNotifDataFromServer', username, lastdataread)
console.log('updateNotifDataFromServer', username, lastdataread)
return Api.SendReq(`/sendnotif/${username}/${lastdataread}/${process.env.APP_ID}`, 'GET', null)
.then((res) => {

View File

@@ -515,7 +515,7 @@ export const useUserStore = defineStore('UserStore', {
else
arrout = tools.getCommon([...this.my.profile.mycircuits], [...user.profile.mycircuits], 'circuitname')
// controlla che il circuito sia Abilitato e Territoriale !
for (const circuitname of arrout) {
@@ -1697,7 +1697,7 @@ export const useUserStore = defineStore('UserStore', {
return res.data
}).catch((error) => {
console.error('err', error)
return {}
return null
})
},
@@ -1872,11 +1872,11 @@ export const useUserStore = defineStore('UserStore', {
} else {
msg = t('db.recupdated')
tools.showPositiveNotif($q, msg)
}
}
} else {
tools.showPositiveNotif($q, msg)
}
}
}).catch((error) => {
tools.showNegativeNotif($q, t('db.recfailed'))