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