Fixed: le reactions devono stare in una tabella a parte (reactions).
- cambiata la gestione dei seen, fav, book, attend
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
APP_VERSION="1.0.15"
|
APP_VERSION="1.0.16"
|
||||||
SERVICE_WORKER_FILE="service-worker.js"
|
SERVICE_WORKER_FILE="service-worker.js"
|
||||||
APP_ID="13"
|
APP_ID="13"
|
||||||
DIRECTORY_LOCAL="newfreeplanet"
|
DIRECTORY_LOCAL="newfreeplanet"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
APP_VERSION="1.0.15"
|
APP_VERSION="1.0.16"
|
||||||
SERVICE_WORKER_FILE="service-worker.js"
|
SERVICE_WORKER_FILE="service-worker.js"
|
||||||
APP_ID="13"
|
APP_ID="13"
|
||||||
DIRECTORY_LOCAL=newfreeplanet
|
DIRECTORY_LOCAL=newfreeplanet
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
APP_VERSION="1.0.15"
|
APP_VERSION="1.0.16"
|
||||||
SERVICE_WORKER_FILE="service-worker.js"
|
SERVICE_WORKER_FILE="service-worker.js"
|
||||||
APP_ID="13"
|
APP_ID="13"
|
||||||
DIRECTORY_LOCAL=newfreeplanet
|
DIRECTORY_LOCAL=newfreeplanet
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
APP_VERSION="1.0.15"
|
APP_VERSION="1.0.16"
|
||||||
SERVICE_WORKER_FILE="service-worker.js"
|
SERVICE_WORKER_FILE="service-worker.js"
|
||||||
APP_ID="13"
|
APP_ID="13"
|
||||||
DIRECTORY_LOCAL="newfreeplanet"
|
DIRECTORY_LOCAL="newfreeplanet"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
APP_VERSION="1.0.15"
|
APP_VERSION="1.0.16"
|
||||||
SERVICE_WORKER_FILE="service-worker.js"
|
SERVICE_WORKER_FILE="service-worker.js"
|
||||||
APP_ID="13"
|
APP_ID="13"
|
||||||
DIRECTORY_LOCAL=newfreeplanet
|
DIRECTORY_LOCAL=newfreeplanet
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
APP_VERSION="1.0.15"
|
APP_VERSION="1.0.16"
|
||||||
SERVICE_WORKER_FILE="service-worker.js"
|
SERVICE_WORKER_FILE="service-worker.js"
|
||||||
APP_ID="14"
|
APP_ID="14"
|
||||||
DIRECTORY_LOCAL="newfreeplanet"
|
DIRECTORY_LOCAL="newfreeplanet"
|
||||||
|
|||||||
@@ -1144,6 +1144,12 @@
|
|||||||
:prop_myrec="myrecdialog"
|
:prop_myrec="myrecdialog"
|
||||||
>
|
>
|
||||||
</CMyCardCircuitPopup>
|
</CMyCardCircuitPopup>
|
||||||
|
<!--<CMyCardService
|
||||||
|
v-else-if="shared_consts.TABLES_FAVORITE_BOOKMARK.includes(mytable)"
|
||||||
|
:table="mytable"
|
||||||
|
:idRec="myrecdialog._id"
|
||||||
|
>
|
||||||
|
</CMyCardService>-->
|
||||||
<CMyCardService
|
<CMyCardService
|
||||||
v-else-if="shared_consts.TABLES_FAVORITE_BOOKMARK.includes(mytable)"
|
v-else-if="shared_consts.TABLES_FAVORITE_BOOKMARK.includes(mytable)"
|
||||||
:table="mytable"
|
:table="mytable"
|
||||||
|
|||||||
48
src/components/CGridTableUser/CGridTableUser.scss
Executable file
48
src/components/CGridTableUser/CGridTableUser.scss
Executable file
@@ -0,0 +1,48 @@
|
|||||||
|
.colmodif {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coldate {
|
||||||
|
max-width: 250px;
|
||||||
|
min-width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tdclass, .trclass{
|
||||||
|
min-height: 20px !important;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.q-table td {
|
||||||
|
padding-left: 1px;
|
||||||
|
padding-right: 2px;
|
||||||
|
padding-top: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
&__title {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.q-table {
|
||||||
|
&__col {
|
||||||
|
font-size: 1rem;
|
||||||
|
color: gray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.newrec_fields{
|
||||||
|
display: flex;
|
||||||
|
padding: 2px;
|
||||||
|
margin: 2px;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.riduci_pad {
|
||||||
|
min-height: 30px;
|
||||||
|
padding: 4px 8px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.q-table__top{
|
||||||
|
padding-top: 0 !important;
|
||||||
|
}
|
||||||
2360
src/components/CGridTableUser/CGridTableUser.ts
Executable file
2360
src/components/CGridTableUser/CGridTableUser.ts
Executable file
File diff suppressed because it is too large
Load Diff
1411
src/components/CGridTableUser/CGridTableUser.vue
Executable file
1411
src/components/CGridTableUser/CGridTableUser.vue
Executable file
File diff suppressed because it is too large
Load Diff
1
src/components/CGridTableUser/index.ts
Executable file
1
src/components/CGridTableUser/index.ts
Executable file
@@ -0,0 +1 @@
|
|||||||
|
export {default as CGridTableUser} from './CGridTableUser.vue'
|
||||||
@@ -24,7 +24,7 @@ import { useI18n } from '@/boot/i18n'
|
|||||||
import { toolsext } from '@store/Modules/toolsext'
|
import { toolsext } from '@store/Modules/toolsext'
|
||||||
import { useQuasar } from 'quasar'
|
import { useQuasar } from 'quasar'
|
||||||
import { costanti } from '@costanti'
|
import { costanti } from '@costanti'
|
||||||
import { IBookmark, ICircuit, IFavorite, IMyCircuit, IMyGroup, IUserFields } from 'model'
|
import { IBookmark, IReaction, ICircuit, IFavorite, IMyCircuit, IMyGroup, IUserFields } from 'model'
|
||||||
import { shared_consts } from '@/common/shared_vuejs'
|
import { shared_consts } from '@/common/shared_vuejs'
|
||||||
import { static_data } from '@/db/static_data'
|
import { static_data } from '@/db/static_data'
|
||||||
import { fieldsTable } from '@store/Modules/fieldsTable'
|
import { fieldsTable } from '@store/Modules/fieldsTable'
|
||||||
@@ -183,19 +183,19 @@ export default defineComponent({
|
|||||||
|
|
||||||
function filtrofavorite(table: string) {
|
function filtrofavorite(table: string) {
|
||||||
const tab = tools.getNumTabByTable(table)
|
const tab = tools.getNumTabByTable(table)
|
||||||
if (myuser.value && myuser.value.profile.favorite) {
|
if (myuser.value && myuser.value.profile.reaction) {
|
||||||
let arrfav = myuser.value.profile.favorite.filter((rec: IBookmark) => rec.tab === tab)
|
let arrfav = myuser.value.profile.reaction.filter((rec: IReaction) => rec.tab === tab && (rec.fav! === true))
|
||||||
if (arrfav)
|
if (arrfav)
|
||||||
return myuser.value.profile.favorite ? [{ _id: { $in: arrfav.map((rec: any) => rec.id) } }] : []
|
return myuser.value.profile.reaction ? [{ _id: { $in: arrfav.map((rec: any) => rec.id) } }] : []
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
function filtrobookmark(table: string) {
|
function filtrobookmark(table: string) {
|
||||||
const tab = tools.getNumTabByTable(table)
|
const tab = tools.getNumTabByTable(table)
|
||||||
if (myuser.value && myuser.value.profile.bookmark) {
|
if (myuser.value && myuser.value.profile.reaction) {
|
||||||
let arrfav = myuser.value.profile.bookmark.filter((rec: IBookmark) => rec.tab === tab)
|
let arrfav = myuser.value.profile.reaction.filter((rec: IReaction) => rec.tab === tab && rec.book === true);
|
||||||
if (arrfav)
|
if (arrfav)
|
||||||
return myuser.value.profile.bookmark ? [{ _id: { $in: arrfav.map((rec: any) => rec.id) } }] : []
|
return myuser.value.profile.reaction ? [{ _id: { $in: arrfav.map((rec: any) => rec.id) } }] : []
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { CDateTime } from '@/components/CDateTime'
|
|||||||
import { CMyPage } from '@/components/CMyPage'
|
import { CMyPage } from '@/components/CMyPage'
|
||||||
import { CMyGroup } from '@/components/CMyGroup'
|
import { CMyGroup } from '@/components/CMyGroup'
|
||||||
import { CMyChipList } from '@/components/CMyChipList'
|
import { CMyChipList } from '@/components/CMyChipList'
|
||||||
|
import { CGridTableUser } from '@/components/CGridTableUser'
|
||||||
import { CMyFieldRec } from '@/components/CMyFieldRec'
|
import { CMyFieldRec } from '@/components/CMyFieldRec'
|
||||||
import { CMyUser } from '@/components/CMyUser'
|
import { CMyUser } from '@/components/CMyUser'
|
||||||
import { CLabel } from '@/components/CLabel'
|
import { CLabel } from '@/components/CLabel'
|
||||||
@@ -20,7 +21,7 @@ import { useI18n } from '@/boot/i18n'
|
|||||||
import { toolsext } from '@store/Modules/toolsext'
|
import { toolsext } from '@store/Modules/toolsext'
|
||||||
import { useQuasar } from 'quasar'
|
import { useQuasar } from 'quasar'
|
||||||
import { costanti } from '@costanti'
|
import { costanti } from '@costanti'
|
||||||
import { EState, IBookedEventPage, IColGridTable, IBookedEvent, IEvents, IMessage, IMessagePage, IParamDialog } from '@model'
|
import { EState, IReaction, IBookedEventPage, IColGridTable, IBookedEvent, IEvents, IMessage, IMessagePage, IParamDialog, ISearchList } from '@model'
|
||||||
import { shared_consts } from '@/common/shared_vuejs'
|
import { shared_consts } from '@/common/shared_vuejs'
|
||||||
import { colCitys, fieldsTable } from '@store/Modules/fieldsTable'
|
import { colCitys, fieldsTable } from '@store/Modules/fieldsTable'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
@@ -35,7 +36,7 @@ export default defineComponent({
|
|||||||
components: {
|
components: {
|
||||||
CProfile, CTitleBanner,
|
CProfile, CTitleBanner,
|
||||||
CMyFieldDb, CDateTime, CMyPage, CMyFieldRec, CAccomodation,
|
CMyFieldDb, CDateTime, CMyPage, CMyFieldRec, CAccomodation,
|
||||||
CMyUser, CGalleryImages, CMyChipList, CLabel, CMyGroup
|
CMyUser, CGalleryImages, CMyChipList, CLabel, CMyGroup, CGridTableUser,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
table: {
|
table: {
|
||||||
@@ -69,6 +70,10 @@ export default defineComponent({
|
|||||||
const $route = useRoute()
|
const $route = useRoute()
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
|
const arrfilterand: any = ref([])
|
||||||
|
const searchList = ref(<ISearchList[]>[])
|
||||||
|
|
||||||
|
const filter = ref(costanti.FIND_PEOPLE)
|
||||||
|
|
||||||
const showPic = ref(false)
|
const showPic = ref(false)
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
@@ -77,8 +82,8 @@ export default defineComponent({
|
|||||||
|
|
||||||
const contextDay = ref(<any>null)
|
const contextDay = ref(<any>null)
|
||||||
|
|
||||||
const usersList = ref({ show: false, title: '', list: [] })
|
const usersList = ref(<any>{ show: false, title: '', list: [], loadfromDb: false, tipofavbook: 0 })
|
||||||
const bookedList = ref(<any>{ show: false, title: '', list: [] })
|
const bookedList = ref(<any>{ show: false, title: '', list: [], loadfromDb: false, tipofavbook: 0 })
|
||||||
|
|
||||||
const formbookEventDefault = ref(<IBookedEvent>{
|
const formbookEventDefault = ref(<IBookedEvent>{
|
||||||
userId: '',
|
userId: '',
|
||||||
@@ -138,12 +143,35 @@ export default defineComponent({
|
|||||||
const idnotif = computed(() => $route.query.idnotif ? $route.query.idnotif.toString() : '')
|
const idnotif = computed(() => $route.query.idnotif ? $route.query.idnotif.toString() : '')
|
||||||
const arrbookings = computed(() => calendarStore.findAllBookedByIdEvent(myrec.value._id))
|
const arrbookings = computed(() => calendarStore.findAllBookedByIdEvent(myrec.value._id))
|
||||||
|
|
||||||
|
const filtercustom: any = computed(() => {
|
||||||
|
|
||||||
|
let queryreact = {}
|
||||||
|
|
||||||
|
if (usersList.value.tipofavbook === costanti.TIPOFAVBOOK.SEEN) {
|
||||||
|
queryreact = {seen: true}
|
||||||
|
} else if (usersList.value.tipofavbook === costanti.TIPOFAVBOOK.FAVORITE) {
|
||||||
|
queryreact = {fav: true}
|
||||||
|
} else if (usersList.value.tipofavbook === costanti.TIPOFAVBOOK.BOOKMARK) {
|
||||||
|
queryreact = {book: true}
|
||||||
|
} else if (usersList.value.tipofavbook === costanti.TIPOFAVBOOK.ATTEND) {
|
||||||
|
queryreact = {attend: true}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [{
|
||||||
|
idapp: process.env.APP_ID,
|
||||||
|
tab: tools.getNumTabByTable(props.table),
|
||||||
|
idrec: myrec.value._id,
|
||||||
|
...queryreact,
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
|
||||||
function profile() {
|
function profile() {
|
||||||
return userStore.my.profile
|
return userStore.my.profile
|
||||||
}
|
}
|
||||||
|
|
||||||
function load() {
|
function load() {
|
||||||
// Carica il profilo di quest'utente
|
|
||||||
|
// Carica il record
|
||||||
if (props.idRec) {
|
if (props.idRec) {
|
||||||
userStore.loadGeneric(props.table, props.idRec, idnotif.value).then((ris) => {
|
userStore.loadGeneric(props.table, props.idRec, idnotif.value).then((ris) => {
|
||||||
myrec.value = ris
|
myrec.value = ris
|
||||||
@@ -210,29 +238,32 @@ export default defineComponent({
|
|||||||
if (myset) {
|
if (myset) {
|
||||||
await userStore.setFavorite($q, t, myrec.value._id, props.table, myrec.value);
|
await userStore.setFavorite($q, t, myrec.value._id, props.table, myrec.value);
|
||||||
}
|
}
|
||||||
mylist = myrec.value.myfav
|
mylist = myrec.value.myreaction ? myrec.value.myreaction.filter((rec: IReaction) => rec.fav) : []
|
||||||
} else if (tipo === costanti.TIPOFAVBOOK.BOOKMARK) {
|
} else if (tipo === costanti.TIPOFAVBOOK.BOOKMARK) {
|
||||||
if (myset) {
|
if (myset) {
|
||||||
await userStore.setBookmark($q, t, myrec.value._id, props.table, myrec.value);
|
await userStore.setBookmark($q, t, myrec.value._id, props.table, myrec.value);
|
||||||
}
|
}
|
||||||
mylist = myrec.value.mybook
|
mylist = myrec.value.myreaction ? myrec.value.myreaction.filter((rec: IReaction) => rec.book) : []
|
||||||
} else if (tipo === costanti.TIPOFAVBOOK.SEEN) {
|
} else if (tipo === costanti.TIPOFAVBOOK.SEEN) {
|
||||||
if (myset) {
|
if (myset) {
|
||||||
loading.value = true
|
|
||||||
const risrecord = await userStore.setSeen($q, t, myrec.value._id, props.table, myrec.value)
|
|
||||||
if (risrecord) {
|
|
||||||
myrec.value = risrecord
|
|
||||||
|
|
||||||
calendarStore.updatearrBookingEvent(myrec.value._id, risrecord.mybookings)
|
if (!userStore.isSeen(myrec.value._id, props.table)) {
|
||||||
|
loading.value = true
|
||||||
|
const risrecord = await userStore.setSeen($q, t, myrec.value._id, props.table, myrec.value)
|
||||||
|
if (risrecord && risrecord.mybookings) {
|
||||||
|
myrec.value = risrecord
|
||||||
|
|
||||||
bookEventpage.value.state = EState.None
|
calendarStore.updatearrBookingEvent(myrec.value._id, risrecord.mybookings)
|
||||||
|
|
||||||
const findev = calendarStore.findEventBooked(myrec.value._id, false)
|
bookEventpage.value.state = EState.None
|
||||||
EditBookEvent(false)
|
|
||||||
|
const findev = calendarStore.findEventBooked(myrec.value._id, false)
|
||||||
|
EditBookEvent(false)
|
||||||
|
}
|
||||||
|
loading.value = false
|
||||||
}
|
}
|
||||||
loading.value = false
|
|
||||||
}
|
}
|
||||||
mylist = myrec.value.myseen
|
mylist = myrec.value.myreaction ? myrec.value.myreaction.filter((rec: IReaction) => rec.seen) : []
|
||||||
} else if (tipo === costanti.TIPOFAVBOOK.ATTEND) {
|
} else if (tipo === costanti.TIPOFAVBOOK.ATTEND) {
|
||||||
if (myset) {
|
if (myset) {
|
||||||
// userStore.setAttend($q, t, myrec.value._id, props.table, bookEventpage.value.bookedevent.numpeople, myrec.value);
|
// userStore.setAttend($q, t, myrec.value._id, props.table, bookEventpage.value.bookedevent.numpeople, myrec.value);
|
||||||
@@ -240,17 +271,19 @@ export default defineComponent({
|
|||||||
mylist = arrbookings.value
|
mylist = arrbookings.value
|
||||||
|
|
||||||
if (!myset && mylist && mylist.length > 0) {
|
if (!myset && mylist && mylist.length > 0) {
|
||||||
bookedList.value.show = true;
|
bookedList.value.show = true
|
||||||
bookedList.value.title = title;
|
bookedList.value.title = title
|
||||||
bookedList.value.list = mylist;
|
bookedList.value.list = mylist
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!myset && mylist && mylist.length > 0) {
|
if (!myset && mylist) {
|
||||||
usersList.value.show = true;
|
usersList.value.show = true
|
||||||
usersList.value.title = title;
|
usersList.value.title = title
|
||||||
usersList.value.list = mylist;
|
usersList.value.tipofavbook = tipo
|
||||||
|
usersList.value.loadfromDb = true
|
||||||
|
usersList.value.list = mylist
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -442,6 +475,101 @@ export default defineComponent({
|
|||||||
arrbookings.value.find((recbook: IBookedEvent) => recbook.userId === userStore.my._id && recbook.booked)
|
arrbookings.value.find((recbook: IBookedEvent) => recbook.userId === userStore.my._id && recbook.booked)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function extraparams() {
|
||||||
|
|
||||||
|
return {
|
||||||
|
lookupPipeline1: {
|
||||||
|
lk_tab: 'users',
|
||||||
|
lk_LF: 'userId',
|
||||||
|
lk_FF: '_id',
|
||||||
|
lk_as: 'user',
|
||||||
|
lk_proj: {
|
||||||
|
name: 1,
|
||||||
|
surname: 1,
|
||||||
|
username: 1,
|
||||||
|
'profile.handshake': 1,
|
||||||
|
'profile.img': 1,
|
||||||
|
'profile.mygroups': 1,
|
||||||
|
'profile.qualifica': 1,
|
||||||
|
'profile.resid_province': 1,
|
||||||
|
'mycities.reg': 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
$lookup: {
|
||||||
|
from: "users",
|
||||||
|
let: { searchId: { $toObjectId: "$userId" } },
|
||||||
|
pipeline: [
|
||||||
|
{
|
||||||
|
$match: {
|
||||||
|
$expr: {
|
||||||
|
$and: [
|
||||||
|
{ $eq: ["$_id", "$$searchId"] },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$project: {
|
||||||
|
name: 1,
|
||||||
|
surname: 1,
|
||||||
|
username: 1,
|
||||||
|
"profile.handshake": 1,
|
||||||
|
"profile.img": 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
|
"profile.qualifica": 1,
|
||||||
|
"profile.resid_province": 1,
|
||||||
|
"mycities.reg": 1,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
as: "user",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$replaceRoot: {
|
||||||
|
newRoot: {
|
||||||
|
$mergeObjects: [
|
||||||
|
{
|
||||||
|
$arrayElemAt: [
|
||||||
|
"$mycities",
|
||||||
|
0,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$arrayElemAt: [
|
||||||
|
"$user",
|
||||||
|
0,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"$$ROOT",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
lookup1: {
|
||||||
|
lk_tab: 'provinces',
|
||||||
|
lk_LF: 'profile.resid_province',
|
||||||
|
lk_FF: 'prov',
|
||||||
|
lk_as: 'mycities',
|
||||||
|
lk_proj: {
|
||||||
|
username: 1,
|
||||||
|
name: 1,
|
||||||
|
surname: 1,
|
||||||
|
'profile.handshake': 1,
|
||||||
|
'profile.img': 1,
|
||||||
|
'profile.mygroups': 1,
|
||||||
|
'profile.qualifica': 1,
|
||||||
|
'profile.resid_province': 1,
|
||||||
|
'mycities.reg': 1,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(mounted)
|
onMounted(mounted)
|
||||||
|
|
||||||
@@ -485,6 +613,11 @@ export default defineComponent({
|
|||||||
isAlreadyBooked,
|
isAlreadyBooked,
|
||||||
bookEventForm,
|
bookEventForm,
|
||||||
loading,
|
loading,
|
||||||
|
arrfilterand,
|
||||||
|
filtercustom,
|
||||||
|
searchList,
|
||||||
|
filter,
|
||||||
|
extraparams,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<div v-if="myrec && myrec._id" class="fulldiv">
|
<div v-if="myrec && myrec._id" class="fulldiv">
|
||||||
<div class="q-pa-sm row items-start q-gutter-sm full-height fulldiv">
|
<div class="q-pa-sm row items-start q-gutter-sm full-height fulldiv">
|
||||||
<q-card class="my-card fulldiv" bordered>
|
<q-card class="my-card fulldiv" bordered>
|
||||||
|
idRec: {{ idRec }}
|
||||||
<CGalleryImages
|
<CGalleryImages
|
||||||
v-if="myrec.photos.length > 0"
|
v-if="myrec.photos.length > 0"
|
||||||
:imgGallery="myrec.photos"
|
:imgGallery="myrec.photos"
|
||||||
@@ -40,9 +41,8 @@
|
|||||||
<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.myseen"
|
|
||||||
color="primary"
|
color="primary"
|
||||||
:label="myrec.myseen.length"
|
:label="myrec.myreact.numseen ? myrec.myreact.numseen : 0"
|
||||||
floating
|
floating
|
||||||
transparent
|
transparent
|
||||||
/>
|
/>
|
||||||
@@ -61,9 +61,8 @@
|
|||||||
@click="clicca(costanti.TIPOFAVBOOK.FAVORITE, true, '')"
|
@click="clicca(costanti.TIPOFAVBOOK.FAVORITE, true, '')"
|
||||||
>
|
>
|
||||||
<q-badge
|
<q-badge
|
||||||
v-if="myrec.myfav"
|
|
||||||
color="primary"
|
color="primary"
|
||||||
:label="myrec.myfav.length"
|
:label="myrec.myreact.numfav ? myrec.myreact.numfav : 0"
|
||||||
floating
|
floating
|
||||||
transparent
|
transparent
|
||||||
/>
|
/>
|
||||||
@@ -82,9 +81,8 @@
|
|||||||
@click="clicca(costanti.TIPOFAVBOOK.BOOKMARK, true, '')"
|
@click="clicca(costanti.TIPOFAVBOOK.BOOKMARK, true, '')"
|
||||||
>
|
>
|
||||||
<q-badge
|
<q-badge
|
||||||
v-if="myrec.mybook"
|
|
||||||
color="primary"
|
color="primary"
|
||||||
:label="myrec.mybook.length"
|
:label="myrec.myreact.numbook ? myrec.myreact.numbook : 0"
|
||||||
floating
|
floating
|
||||||
transparent
|
transparent
|
||||||
/>
|
/>
|
||||||
@@ -104,7 +102,7 @@
|
|||||||
<q-menu>
|
<q-menu>
|
||||||
<q-list v-if="true" style="min-width: 200px">
|
<q-list v-if="true" style="min-width: 200px">
|
||||||
<q-item
|
<q-item
|
||||||
v-if="myrec.profile.username_telegram"
|
v-if="myrec.profile && myrec.profile.username_telegram"
|
||||||
clickable
|
clickable
|
||||||
v-close-popup
|
v-close-popup
|
||||||
>
|
>
|
||||||
@@ -113,6 +111,7 @@
|
|||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<a
|
<a
|
||||||
|
v-if="myrec.profile && myrec.profile.username_telegram"
|
||||||
:href="
|
:href="
|
||||||
tools.getHttpForTelegram(
|
tools.getHttpForTelegram(
|
||||||
myrec.profile.username_telegram
|
myrec.profile.username_telegram
|
||||||
@@ -146,7 +145,9 @@
|
|||||||
costanti.TIPOFAVBOOK.SEEN,
|
costanti.TIPOFAVBOOK.SEEN,
|
||||||
false,
|
false,
|
||||||
$t('cmd.seen', {
|
$t('cmd.seen', {
|
||||||
num: myrec.myseen ? myrec.myseen.length : 0,
|
num: myrec.myreact.numseen
|
||||||
|
? myrec.myreact.numseen
|
||||||
|
: 0,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
@@ -157,7 +158,9 @@
|
|||||||
<q-item-section>
|
<q-item-section>
|
||||||
{{
|
{{
|
||||||
$t('cmd.seen', {
|
$t('cmd.seen', {
|
||||||
num: myrec.myseen ? myrec.myseen.length : 0,
|
num: myrec.myreact.numseen
|
||||||
|
? myrec.myreact.numseen
|
||||||
|
: 0,
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
@@ -170,7 +173,7 @@
|
|||||||
costanti.TIPOFAVBOOK.FAVORITE,
|
costanti.TIPOFAVBOOK.FAVORITE,
|
||||||
false,
|
false,
|
||||||
$t('cmd.favorite', {
|
$t('cmd.favorite', {
|
||||||
num: myrec.myfav ? myrec.myfav.length : 0,
|
num: myrec.myreact.numfav ? myrec.myreact.numfav : 0,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
@@ -181,12 +184,13 @@
|
|||||||
<q-item-section>
|
<q-item-section>
|
||||||
{{
|
{{
|
||||||
$t('cmd.favorite', {
|
$t('cmd.favorite', {
|
||||||
num: myrec.myfav ? myrec.myfav.length : 0,
|
num: myrec.myreact.numfav ? myrec.myreact.numfav : 0,
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item
|
<q-item
|
||||||
|
v-if="table === shared_consts.TABLES_MYBACHECAS"
|
||||||
clickable
|
clickable
|
||||||
v-close-popup
|
v-close-popup
|
||||||
@click="
|
@click="
|
||||||
@@ -226,7 +230,9 @@
|
|||||||
costanti.TIPOFAVBOOK.BOOKMARK,
|
costanti.TIPOFAVBOOK.BOOKMARK,
|
||||||
false,
|
false,
|
||||||
$t('cmd.bookmark', {
|
$t('cmd.bookmark', {
|
||||||
num: myrec.mybook ? myrec.mybook.length : 0,
|
num: myrec.myreact.numbook
|
||||||
|
? myrec.myreact.numbook
|
||||||
|
: 0,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
@@ -237,7 +243,9 @@
|
|||||||
<q-item-section>
|
<q-item-section>
|
||||||
{{
|
{{
|
||||||
$t('cmd.bookmark', {
|
$t('cmd.bookmark', {
|
||||||
num: myrec.mybook ? myrec.mybook.length : 0,
|
num: myrec.myreact.numbook
|
||||||
|
? myrec.myreact.numbook
|
||||||
|
: 0,
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
@@ -695,7 +703,10 @@
|
|||||||
class="row absolute-bottom text-shadow custom-caption q-px-md buttons_bottom"
|
class="row absolute-bottom text-shadow custom-caption q-px-md buttons_bottom"
|
||||||
>
|
>
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="myrec.profile.username_telegram || myrec.contact_telegram"
|
v-if="
|
||||||
|
(myrec.profile && myrec.profile.username_telegram) ||
|
||||||
|
myrec.contact_telegram
|
||||||
|
"
|
||||||
:label="$t('dialog.contact')"
|
:label="$t('dialog.contact')"
|
||||||
color="primary"
|
color="primary"
|
||||||
icon="far fa-comment"
|
icon="far fa-comment"
|
||||||
@@ -751,7 +762,7 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<q-dialog v-model="usersList.show">
|
<q-dialog v-model="usersList.loadfromDb">
|
||||||
<q-card class="dialog_card">
|
<q-card class="dialog_card">
|
||||||
<q-toolbar class="bg-primary text-white">
|
<q-toolbar class="bg-primary text-white">
|
||||||
<q-toolbar-title>
|
<q-toolbar-title>
|
||||||
@@ -761,13 +772,43 @@
|
|||||||
</q-toolbar>
|
</q-toolbar>
|
||||||
|
|
||||||
<q-card-section class="inset-shadow">
|
<q-card-section class="inset-shadow">
|
||||||
<div v-for="(rec, i) in usersList.list" :key="i">
|
<div v-if="usersList.loadfromDb">
|
||||||
<CMyUser
|
<CGridTableUser
|
||||||
:mycontact="rec"
|
prop_mytable="reactions"
|
||||||
:visu="costanti.FIND_PEOPLE"
|
prop_mytitle=""
|
||||||
@setCmd="tools.setCmd"
|
:prop_mycolumns="colmyUserPeople"
|
||||||
|
prop_colkey="_id"
|
||||||
|
col_title="username"
|
||||||
|
:vertical="costanti.VISUTABLE_LISTA"
|
||||||
|
nodataLabel=" "
|
||||||
|
:prop_search="false"
|
||||||
|
:prop_showfilter="false"
|
||||||
|
hint=""
|
||||||
|
:finder="false"
|
||||||
|
:choose_visutype="false"
|
||||||
|
:finder_noNull="false"
|
||||||
|
:finder_noNullFilters="false"
|
||||||
|
:options="shared_consts.OPTIONS_SEARCH_USER_ALL_WORDS"
|
||||||
|
:butt_modif_new="false"
|
||||||
|
noresultLabel="Username o nome non trovato"
|
||||||
|
:arrfilters="arrfilterand"
|
||||||
|
:filtercustom="filtercustom"
|
||||||
|
:prop_searchList="searchList"
|
||||||
|
:showType="costanti.SHOW_USERINFO"
|
||||||
|
:showCol="false"
|
||||||
|
:extraparams="extraparams()"
|
||||||
>
|
>
|
||||||
</CMyUser>
|
</CGridTableUser>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<div v-for="(rec, i) in usersList.list" :key="i">
|
||||||
|
<CMyUser
|
||||||
|
:mycontact="rec"
|
||||||
|
:visu="costanti.FIND_PEOPLE"
|
||||||
|
@setCmd="tools.setCmd"
|
||||||
|
>
|
||||||
|
</CMyUser>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
@@ -903,7 +944,8 @@
|
|||||||
<div class="q-pa-xs">
|
<div class="q-pa-xs">
|
||||||
<q-card class="windowcol" style="display: block">
|
<q-card class="windowcol" style="display: block">
|
||||||
<q-card-section class="q-pa-xs">
|
<q-card-section class="q-pa-xs">
|
||||||
<div>{{ $t('cal.infoprenota') }}</div><br>
|
<div>{{ $t('cal.infoprenota') }}</div>
|
||||||
|
<br />
|
||||||
<div style="display: inline-flex" class="q-px-xs centermydiv">
|
<div style="display: inline-flex" class="q-px-xs centermydiv">
|
||||||
<q-checkbox
|
<q-checkbox
|
||||||
style="color: black"
|
style="color: black"
|
||||||
|
|||||||
@@ -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">{{ myrec.myseen ? myrec.myseen.length : 0 }}</span>
|
<span class="q-mx-xxs">{{ myrec.myreact.numseen ? myrec.myreact.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="">{{ myrec.myfav ? myrec.myfav.length : 0 }}</span>
|
<span class="">{{ myrec.myreact.numfav ? myrec.myreact.numfav : 0 }}</span>
|
||||||
<span class="q-mx-xxs"
|
<span class="q-mx-xxs"
|
||||||
><q-icon
|
><q-icon
|
||||||
dense
|
dense
|
||||||
|
|||||||
@@ -77,6 +77,16 @@ export interface IAttend {
|
|||||||
tab: number
|
tab: number
|
||||||
num: number
|
num: number
|
||||||
}
|
}
|
||||||
|
export interface IReaction {
|
||||||
|
id: string
|
||||||
|
idrec: string
|
||||||
|
username: string
|
||||||
|
tab: number
|
||||||
|
seen?: boolean
|
||||||
|
fav?: boolean
|
||||||
|
book?: boolean
|
||||||
|
attend?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
export interface IFavBook {
|
export interface IFavBook {
|
||||||
username: string
|
username: string
|
||||||
@@ -141,16 +151,14 @@ export interface IUserProfile {
|
|||||||
noNameSurname: boolean
|
noNameSurname: boolean
|
||||||
noCircuit: boolean
|
noCircuit: boolean
|
||||||
noFoto: boolean
|
noFoto: boolean
|
||||||
bookmark: IBookmark[]
|
reaction: IReaction[]
|
||||||
favorite: IFavorite[]
|
// bookmark: IBookmark[]
|
||||||
seen: ISeen[]
|
// favorite: IFavorite[]
|
||||||
attend: IAttend[]
|
// seen: ISeen[]
|
||||||
|
// attend: IAttend[]
|
||||||
|
|
||||||
// Query
|
// Query
|
||||||
myfav: IFavBook[]
|
myreaction: IReaction[]
|
||||||
mybook: IFavBook[]
|
|
||||||
myseen: IFavBook[]
|
|
||||||
myattend: IFavBook[]
|
|
||||||
mybookings: IBookedEvent[]
|
mybookings: IBookedEvent[]
|
||||||
|
|
||||||
// in memory
|
// in memory
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import { tools } from '@store/Modules/tools'
|
|||||||
import translate from '@src/globalroutines/util'
|
import translate from '@src/globalroutines/util'
|
||||||
import { ICallResult, ILinkReg, IResult, IToken } from '@model/other'
|
import { ICallResult, ILinkReg, IResult, IToken } from '@model/other'
|
||||||
|
|
||||||
|
import objectId from '@src/js/objectId'
|
||||||
|
|
||||||
import * as Types from '@src/store/Api/ApiTypes'
|
import * as Types from '@src/store/Api/ApiTypes'
|
||||||
import { useGlobalStore } from '@store/globalStore'
|
import { useGlobalStore } from '@store/globalStore'
|
||||||
import { serv_constants } from '@store/Modules/serv_constants'
|
import { serv_constants } from '@store/Modules/serv_constants'
|
||||||
@@ -35,13 +37,13 @@ import { Router } from 'vue-router'
|
|||||||
import { useProjectStore } from '@store/Projects'
|
import { useProjectStore } from '@store/Projects'
|
||||||
import { shared_consts } from '@/common/shared_vuejs'
|
import { shared_consts } from '@/common/shared_vuejs'
|
||||||
import { costanti } from '@costanti'
|
import { costanti } from '@costanti'
|
||||||
import { IBookmark, ISeen, IFavBook, IAttend, IFavorite, IGroupShort, IMyGroup, IUserAdmins } from '@model/UserStore'
|
import { IReaction, IBookmark, ISeen, IFavBook, IAttend, IFavorite, IGroupShort, IMyGroup, IUserAdmins } from '@model/UserStore'
|
||||||
|
|
||||||
import globalroutines from '../globalroutines/index'
|
import globalroutines from '../globalroutines/index'
|
||||||
import { useNotifStore } from '@store/NotifStore'
|
import { useNotifStore } from '@store/NotifStore'
|
||||||
import { useCircuitStore } from './CircuitStore'
|
import { useCircuitStore } from './CircuitStore'
|
||||||
|
|
||||||
export const CMD_USER = {
|
export const CMD_REACTION = {
|
||||||
SET_FAVORITE: 1,
|
SET_FAVORITE: 1,
|
||||||
SET_BOOKMARK: 2,
|
SET_BOOKMARK: 2,
|
||||||
SET_SEEN: 3,
|
SET_SEEN: 3,
|
||||||
@@ -83,14 +85,12 @@ export const DefaultUser: IUserFields = {
|
|||||||
asked_groups: [],
|
asked_groups: [],
|
||||||
refused_groups: [],
|
refused_groups: [],
|
||||||
notifs: [],
|
notifs: [],
|
||||||
bookmark: [],
|
// bookmark: [],
|
||||||
favorite: [],
|
// favorite: [],
|
||||||
seen: [],
|
// seen: [],
|
||||||
attend: [],
|
// attend: [],
|
||||||
myfav: [],
|
reaction: [],
|
||||||
mybook: [],
|
myreaction: [],
|
||||||
myseen: [],
|
|
||||||
myattend: [],
|
|
||||||
mybookings: [],
|
mybookings: [],
|
||||||
notif_idCities: [],
|
notif_idCities: [],
|
||||||
notif_provinces: [],
|
notif_provinces: [],
|
||||||
@@ -157,14 +157,8 @@ export const DefaultProfile: IUserProfile = {
|
|||||||
asked_groups: [],
|
asked_groups: [],
|
||||||
refused_groups: [],
|
refused_groups: [],
|
||||||
notifs: [],
|
notifs: [],
|
||||||
bookmark: [],
|
reaction: [],
|
||||||
favorite: [],
|
myreaction: [],
|
||||||
seen: [],
|
|
||||||
attend: [],
|
|
||||||
myfav: [],
|
|
||||||
mybook: [],
|
|
||||||
myseen: [],
|
|
||||||
myattend: [],
|
|
||||||
mybookings: [],
|
mybookings: [],
|
||||||
notif_idCities: [],
|
notif_idCities: [],
|
||||||
notif_provinces: [],
|
notif_provinces: [],
|
||||||
@@ -1701,21 +1695,29 @@ export const useUserStore = defineStore('UserStore', {
|
|||||||
console.log('table', table)
|
console.log('table', table)
|
||||||
const tab = tools.getNumTabByTable(table)
|
const tab = tools.getNumTabByTable(table)
|
||||||
|
|
||||||
|
const recreaction = this.getRecReaction(id, table)
|
||||||
value = this.isFavorite(id, table) ? false : true
|
value = this.isFavorite(id, table) ? false : true
|
||||||
|
|
||||||
return await Api.SendReq('/users/cmd', 'POST', { cmd: CMD_USER.SET_FAVORITE, id, tab, value })
|
return await Api.SendReq('/reactions/cmd', 'POST', { cmd: CMD_REACTION.SET_FAVORITE, id, tab, value })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res && res.data.state === 1) {
|
if (res && res.data.state === 1) {
|
||||||
if (!myrec.myfav)
|
if (myrec) {
|
||||||
myrec.myfav = []
|
if (!recreaction)
|
||||||
this.my.profile.favorite.push({ id, tab })
|
this.my.profile.reaction.push({ id: objectId(), idrec: id, tab, username: this.my.username, fav: true })
|
||||||
if (myrec)
|
else
|
||||||
myrec.myfav.push({ username: this.my.username })
|
recreaction.fav = true;
|
||||||
|
|
||||||
|
myrec.myreact.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.myfav)
|
if (myrec && myrec.myreact.numfav) {
|
||||||
myrec.myfav = myrec.myfav.filter((rec: IFavBook) => rec.username !== this.my.username)
|
myrec.myreact.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
|
||||||
|
}
|
||||||
tools.showNegativeNotif($q, t('cmd.favorite_unset'))
|
tools.showNegativeNotif($q, t('cmd.favorite_unset'))
|
||||||
}
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
@@ -1731,21 +1733,27 @@ export const useUserStore = defineStore('UserStore', {
|
|||||||
console.log('table', table)
|
console.log('table', table)
|
||||||
const tab = tools.getNumTabByTable(table)
|
const tab = tools.getNumTabByTable(table)
|
||||||
|
|
||||||
|
const recreaction = this.getRecReaction(id, table)
|
||||||
value = this.isAttend(id, table) ? false : true
|
value = this.isAttend(id, table) ? false : true
|
||||||
|
|
||||||
return await Api.SendReq('/users/cmd', 'POST', { cmd: CMD_USER.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.myattend)
|
if (!myrec.myreact.attend)
|
||||||
myrec.myattend = []
|
myrec.myreact.attend = false
|
||||||
this.my.profile.attend.push({ id, tab, num })
|
// create a record
|
||||||
if (myrec)
|
//++ this.my.profile.reaction.push({ id, tab, attend: true })
|
||||||
myrec.myattend.push({ username: this.my.username })
|
if (myrec) {
|
||||||
|
if (!recreaction)
|
||||||
|
this.my.profile.reaction.push({ id: objectId(), idrec: id, tab, username: this.my.username, attend: true })
|
||||||
|
else
|
||||||
|
recreaction.attend = true
|
||||||
|
}
|
||||||
tools.showPositiveNotif($q, t('cmd.attend_set'))
|
tools.showPositiveNotif($q, t('cmd.attend_set'))
|
||||||
} else if (res && res.data.state === -1) {
|
} else if (res && res.data.state === -1) {
|
||||||
this.my.profile.attend = tools.removeIObjectOnce(this.my.profile.attend, { id, tab })
|
//++ this.my.profile.attend = tools.removeIObjectOnce(this.my.profile.attend, { id, tab })
|
||||||
if (myrec && myrec.myattend)
|
if (myrec && myrec.myattend && recreaction)
|
||||||
myrec.myattend = myrec.myattend.filter((rec: IFavBook) => rec.username !== this.my.username)
|
recreaction.attend = false
|
||||||
tools.showNegativeNotif($q, t('cmd.attend_unset'))
|
tools.showNegativeNotif($q, t('cmd.attend_unset'))
|
||||||
}
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
@@ -1755,28 +1763,30 @@ export const useUserStore = defineStore('UserStore', {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isSeen(id: string, table: string) {
|
getRecReaction(id: string, table: string) {
|
||||||
const tab = tools.getNumTabByTable(table)
|
const tab = tools.getNumTabByTable(table)
|
||||||
const myseen = this.my.profile.seen.find((rec: ISeen) => ((rec.id === id) && (rec.tab === tab)))
|
const myrec = this.my.profile.reaction.find((rec: IReaction) => ((rec.idrec === id) && (rec.tab === tab)))
|
||||||
return myseen
|
return myrec
|
||||||
|
},
|
||||||
|
|
||||||
|
isSeen(id: string, table: string) {
|
||||||
|
const myrec = this.getRecReaction(id, table)
|
||||||
|
return myrec ? myrec.seen : false
|
||||||
},
|
},
|
||||||
|
|
||||||
isBookmarked(id: string, table: string) {
|
isBookmarked(id: string, table: string) {
|
||||||
const tab = tools.getNumTabByTable(table)
|
const myrec = this.getRecReaction(id, table)
|
||||||
const mybookmark = this.my.profile.bookmark.find((rec: IBookmark) => ((rec.id === id) && (rec.tab === tab)))
|
return myrec ? myrec.book : false
|
||||||
return mybookmark
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isFavorite(id: string, table: string) {
|
isFavorite(id: string, table: string) {
|
||||||
const tab = tools.getNumTabByTable(table)
|
const myrec = this.getRecReaction(id, table)
|
||||||
const myfavorite = this.my.profile.favorite.find((rec: IFavorite) => ((rec.id === id) && (rec.tab === tab)))
|
return myrec ? myrec.fav : false
|
||||||
return myfavorite
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isAttend(id: string, table: string) {
|
isAttend(id: string, table: string) {
|
||||||
const tab = tools.getNumTabByTable(table)
|
const myrec = this.getRecReaction(id, table)
|
||||||
const myattend = this.my.profile.attend.find((rec: IAttend) => ((rec.id === id) && (rec.tab === tab)))
|
return myrec ? myrec.attend : false
|
||||||
return myattend
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async setBookmark($q: any, t: any, id: any, table: string, myrec: any) {
|
async setBookmark($q: any, t: any, id: any, table: string, myrec: any) {
|
||||||
@@ -1784,21 +1794,27 @@ export const useUserStore = defineStore('UserStore', {
|
|||||||
|
|
||||||
const tab = tools.getNumTabByTable(table)
|
const tab = tools.getNumTabByTable(table)
|
||||||
|
|
||||||
|
const recreaction = this.getRecReaction(id, table)
|
||||||
value = this.isBookmarked(id, table) ? false : true
|
value = this.isBookmarked(id, table) ? false : true
|
||||||
|
|
||||||
return await Api.SendReq('/users/cmd', 'POST', { cmd: CMD_USER.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.mybook)
|
if (!myrec.mybook)
|
||||||
myrec.mybook = []
|
myrec.mybook = []
|
||||||
this.my.profile.bookmark.push({ id, tab })
|
if (!recreaction)
|
||||||
if (myrec)
|
this.my.profile.reaction.push({ id: objectId(), idrec: id, tab, username: this.my.username, book: true })
|
||||||
myrec.mybook.push({ username: this.my.username })
|
else
|
||||||
|
recreaction.book = true
|
||||||
|
|
||||||
|
myrec.myreact.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.bookmark = tools.removeIObjectOnce(this.my.profile.bookmark, { id, tab })
|
//++ this.my.profile.reaction = tools.removeIObjectOnce(this.my.profile.reaction, { id, tab, })
|
||||||
if (myrec && myrec.mybook)
|
if ((myrec && myrec.mybook) && recreaction)
|
||||||
myrec.mybook = myrec.mybook.filter((rec: IFavBook) => rec.username !== this.my.username)
|
recreaction.book = false
|
||||||
|
myrec.myreact.numbook--
|
||||||
|
//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'))
|
||||||
}
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
@@ -1833,17 +1849,19 @@ export const useUserStore = defineStore('UserStore', {
|
|||||||
|
|
||||||
const tab = tools.getNumTabByTable(table)
|
const tab = tools.getNumTabByTable(table)
|
||||||
|
|
||||||
|
const recreaction = this.getRecReaction(id, table)
|
||||||
value = this.isSeen(id, table) ? false : true
|
value = this.isSeen(id, table) ? false : true
|
||||||
|
|
||||||
return await Api.SendReq('/users/cmd', 'POST', { cmd: CMD_USER.SET_SEEN, id, tab, value })
|
return await Api.SendReq('/reactions/cmd', 'POST', { cmd: CMD_REACTION.SET_SEEN, id, tab, value })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res && res.data.state === 1) {
|
if (res && res.data.state === 1) {
|
||||||
if (!myrec.myseen)
|
if (value) {
|
||||||
myrec.myseen = []
|
myrec.myreact.numseen++
|
||||||
this.my.profile.seen.push({ id, tab })
|
if (!recreaction)
|
||||||
if (myrec)
|
this.my.profile.reaction.push({ id: objectId(), idrec: id, tab, username: this.my.username, seen: true })
|
||||||
myrec.myseen.push({ username: this.my.username })
|
else
|
||||||
|
recreaction.seen = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (res && res.data) {
|
if (res && res.data) {
|
||||||
if (res.data.record) {
|
if (res.data.record) {
|
||||||
|
|||||||
@@ -530,6 +530,14 @@
|
|||||||
@click="EseguiFunz('setstrProvByIdCityCircuits')"
|
@click="EseguiFunz('setstrProvByIdCityCircuits')"
|
||||||
></q-btn>
|
></q-btn>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<q-btn
|
||||||
|
label="Aggiorna newRecordsFav - UNA VOLTA SOLA"
|
||||||
|
color="negative"
|
||||||
|
@click="EseguiFunz('newRecordsFav')"
|
||||||
|
></q-btn>
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" src="./dbop.ts">
|
<script lang="ts" src="./dbop.ts">
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user