correzione numseen, numfav, ...: ora li ho aggiunti alle tabelle...
This commit is contained in:
@@ -966,6 +966,14 @@ export const shared_consts = {
|
||||
10,
|
||||
],
|
||||
|
||||
REACTIONS_FIELD:
|
||||
{
|
||||
numseen: 1,
|
||||
numbook: 1,
|
||||
numfav: 1,
|
||||
numattend: 1,
|
||||
},
|
||||
|
||||
OrderStatusStr: [
|
||||
{
|
||||
label: 'Nessuno',
|
||||
@@ -1755,6 +1763,7 @@ export const shared_consts = {
|
||||
},
|
||||
|
||||
getProjectForAll(proj_add: any, table?: string) {
|
||||
|
||||
let proj = {
|
||||
idContribType: 1,
|
||||
idCity: 1,
|
||||
@@ -1796,6 +1805,8 @@ export const shared_consts = {
|
||||
if (proj_add)
|
||||
proj = Object.assign({}, proj, proj_add);
|
||||
|
||||
proj = {...proj, ...this.REACTIONS_FIELD};
|
||||
|
||||
if (table) {
|
||||
let proj_add3 = this.getProjectByTable(table);
|
||||
proj = Object.assign({}, proj, proj_add3);
|
||||
|
||||
@@ -180,7 +180,13 @@ export default defineComponent({
|
||||
})
|
||||
|
||||
} else {
|
||||
myrec.value = props.prop_myrec
|
||||
// myrec.value = props.prop_myrec
|
||||
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 (myrec.value)
|
||||
|
||||
@@ -40,9 +40,9 @@
|
||||
<div class="">
|
||||
<q-btn flat round color="blue" icon="far fa-eye">
|
||||
<q-badge
|
||||
v-if="myrec.myreact"
|
||||
v-if="myrec"
|
||||
color="primary"
|
||||
:label="myrec.myreact.numseen ? myrec.myreact.numseen : 0"
|
||||
:label="myrec.numseen ? myrec.numseen : 0"
|
||||
floating
|
||||
transparent
|
||||
/>
|
||||
@@ -61,9 +61,9 @@
|
||||
@click="clicca(costanti.TIPOFAVBOOK.FAVORITE, true, '')"
|
||||
>
|
||||
<q-badge
|
||||
v-if="myrec.myreact"
|
||||
v-if="myrec"
|
||||
color="primary"
|
||||
:label="myrec.myreact.numfav ? myrec.myreact.numfav : 0"
|
||||
:label="myrec.numfav ? myrec.numfav : 0"
|
||||
floating
|
||||
transparent
|
||||
/>
|
||||
@@ -82,9 +82,9 @@
|
||||
@click="clicca(costanti.TIPOFAVBOOK.BOOKMARK, true, '')"
|
||||
>
|
||||
<q-badge
|
||||
v-if="myrec.myreact"
|
||||
v-if="myrec"
|
||||
color="primary"
|
||||
:label="myrec.myreact.numbook ? myrec.myreact.numbook : 0"
|
||||
:label="myrec.numbook ? myrec.numbook : 0"
|
||||
floating
|
||||
transparent
|
||||
/>
|
||||
@@ -140,7 +140,7 @@
|
||||
</q-item>
|
||||
<q-separator />
|
||||
<q-item
|
||||
v-if="myrec.myreact"
|
||||
v-if="myrec"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="
|
||||
@@ -148,8 +148,8 @@
|
||||
costanti.TIPOFAVBOOK.SEEN,
|
||||
false,
|
||||
$t('cmd.seen', {
|
||||
num: myrec.myreact.numseen
|
||||
? myrec.myreact.numseen
|
||||
num: myrec.numseen
|
||||
? myrec.numseen
|
||||
: 0,
|
||||
})
|
||||
)
|
||||
@@ -161,15 +161,15 @@
|
||||
<q-item-section>
|
||||
{{
|
||||
$t('cmd.seen', {
|
||||
num: myrec.myreact.numseen
|
||||
? myrec.myreact.numseen
|
||||
num: myrec.numseen
|
||||
? myrec.numseen
|
||||
: 0,
|
||||
})
|
||||
}}
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
v-if="myrec.myreact"
|
||||
v-if="myrec"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="
|
||||
@@ -177,7 +177,7 @@
|
||||
costanti.TIPOFAVBOOK.FAVORITE,
|
||||
false,
|
||||
$t('cmd.favorite', {
|
||||
num: myrec.myreact.numfav ? myrec.myreact.numfav : 0,
|
||||
num: myrec.numfav ? myrec.numfav : 0,
|
||||
})
|
||||
)
|
||||
"
|
||||
@@ -188,7 +188,7 @@
|
||||
<q-item-section>
|
||||
{{
|
||||
$t('cmd.favorite', {
|
||||
num: myrec.myreact.numfav ? myrec.myreact.numfav : 0,
|
||||
num: myrec.numfav ? myrec.numfav : 0,
|
||||
})
|
||||
}}
|
||||
</q-item-section>
|
||||
@@ -227,7 +227,7 @@
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
v-if="myrec.myreact"
|
||||
v-if="myrec"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="
|
||||
@@ -235,8 +235,8 @@
|
||||
costanti.TIPOFAVBOOK.BOOKMARK,
|
||||
false,
|
||||
$t('cmd.bookmark', {
|
||||
num: myrec.myreact.numbook
|
||||
? myrec.myreact.numbook
|
||||
num: myrec.numbook
|
||||
? myrec.numbook
|
||||
: 0,
|
||||
})
|
||||
)
|
||||
@@ -248,8 +248,8 @@
|
||||
<q-item-section>
|
||||
{{
|
||||
$t('cmd.bookmark', {
|
||||
num: myrec.myreact.numbook
|
||||
? myrec.myreact.numbook
|
||||
num: myrec.numbook
|
||||
? myrec.numbook
|
||||
: 0,
|
||||
})
|
||||
}}
|
||||
|
||||
@@ -181,12 +181,12 @@
|
||||
><q-icon dense color="blue" name="far fa-check-circle" />
|
||||
</span>
|
||||
</span>
|
||||
<span class="q-mx-xxs" v-if="myrec.myreact">{{ myrec.myreact.numseen ? myrec.myreact.numseen : 0 }}</span>
|
||||
<span class="q-mx-xxs">{{ myrec.numseen ? myrec.numseen : 0 }}</span>
|
||||
<span class="q-mx-xxs"
|
||||
><q-icon dense color="blue" name="far fa-eye" />
|
||||
</span>
|
||||
<span class="q-mx-xxs"> </span>
|
||||
<span class="" v-if="myrec.myreact">{{ myrec.myreact.numfav ? myrec.myreact.numfav : 0 }}</span>
|
||||
<span class="" v-if="myrec">{{ myrec.numfav ? myrec.numfav : 0 }}</span>
|
||||
<span class="q-mx-xxs"
|
||||
><q-icon
|
||||
dense
|
||||
|
||||
@@ -1706,10 +1706,8 @@ export const useUserStore = defineStore('UserStore', {
|
||||
.then((res) => {
|
||||
if (res && res.data.state === 1) {
|
||||
if (myrec) {
|
||||
if (!myrec.myreact) {
|
||||
myrec.myreact = {
|
||||
numfav: 0,
|
||||
}
|
||||
if (!myrec.numfav) {
|
||||
myrec.numfav = 0
|
||||
}
|
||||
|
||||
if (!recreaction)
|
||||
@@ -1717,13 +1715,13 @@ export const useUserStore = defineStore('UserStore', {
|
||||
else
|
||||
recreaction.fav = true;
|
||||
|
||||
myrec.myreact.numfav++
|
||||
myrec.numfav++
|
||||
}
|
||||
tools.showPositiveNotif($q, t('cmd.favorite_set'))
|
||||
} else if (res && res.data.state === -1) {
|
||||
// this.my.profile.favorite = tools.removeIObjectOnce(this.my.profile.favorite, { id, tab })
|
||||
if (myrec && myrec.myreact.numfav) {
|
||||
myrec.myreact.numfav--
|
||||
if (myrec && myrec.numfav) {
|
||||
myrec.numfav--
|
||||
//this.my.profile.reaction = this.my.profile.reaction.filter((rec: IReaction) => !((rec.idrec === id) && (rec.tab === tab) && (rec.username === this.my.username) && (rec.fav === true)))
|
||||
if (recreaction)
|
||||
recreaction.fav = false
|
||||
@@ -1749,10 +1747,8 @@ export const useUserStore = defineStore('UserStore', {
|
||||
return await Api.SendReq('/reactions/cmd', 'POST', { cmd: CMD_REACTION.SET_ATTEND, id, tab, value })
|
||||
.then((res) => {
|
||||
if (res && res.data.state === 1) {
|
||||
if (!myrec.myreact) {
|
||||
myrec.myreact = {
|
||||
numattend: 0,
|
||||
}
|
||||
if (!myrec.numattend) {
|
||||
myrec.numattend = 0
|
||||
}
|
||||
if (!myrec.myreact.attend)
|
||||
myrec.myreact.attend = false
|
||||
@@ -1815,10 +1811,8 @@ export const useUserStore = defineStore('UserStore', {
|
||||
return await Api.SendReq('/reactions/cmd', 'POST', { cmd: CMD_REACTION.SET_BOOKMARK, id, tab, value })
|
||||
.then((res) => {
|
||||
if (res && res.data.state === 1) {
|
||||
if (!myrec.myreact) {
|
||||
myrec.myreact = {
|
||||
numseen: 0,
|
||||
}
|
||||
if (!myrec.numbook) {
|
||||
myrec.numbook = 0
|
||||
}
|
||||
if (!myrec.mybook)
|
||||
myrec.mybook = []
|
||||
@@ -1827,13 +1821,13 @@ export const useUserStore = defineStore('UserStore', {
|
||||
else
|
||||
recreaction.book = true
|
||||
|
||||
myrec.myreact.numbook++
|
||||
myrec.numbook++
|
||||
tools.showPositiveNotif($q, t('cmd.bookmark_set'))
|
||||
} else if (res && res.data.state === -1) {
|
||||
//++ this.my.profile.reaction = tools.removeIObjectOnce(this.my.profile.reaction, { id, tab, })
|
||||
if ((myrec && myrec.mybook) && recreaction)
|
||||
recreaction.book = false
|
||||
myrec.myreact.numbook--
|
||||
myrec.numbook--
|
||||
//myrec.mybook = myrec.mybook.filter((rec: IFavBook) => rec.username !== this.my.username)
|
||||
tools.showNegativeNotif($q, t('cmd.bookmark_unset'))
|
||||
}
|
||||
@@ -1876,12 +1870,12 @@ export const useUserStore = defineStore('UserStore', {
|
||||
.then((res) => {
|
||||
if (res && res.data.state === 1) {
|
||||
if (value) {
|
||||
if (!myrec.myreact) {
|
||||
myrec.myreact = {
|
||||
if (!myrec) {
|
||||
myrec = {
|
||||
numseen: 0,
|
||||
}
|
||||
}
|
||||
myrec.myreact.numseen++
|
||||
myrec.numseen++
|
||||
if (!recreaction)
|
||||
this.my.profile.reaction.push({ id: objectId(), idrec: id, tab, username: this.my.username, seen: true })
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user