diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index b84fe9ca..f44f6518 100755 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -170,6 +170,8 @@ export const shared_consts = { TABLES_MYHOSPS: 'myhosps', TABLES_MYGOODS: 'mygoods', TABLES_MYEVENTS: 'myevents', + TABLES_CIRCUITS: 'circuits', + TABLES_MYGROUPS: 'mygroups', MYTABS: [{ id: 0, table: 'none' }, { id: 1, table: 'myskills' }, @@ -1072,6 +1074,8 @@ export const shared_consts = { TYPEDIR_EVENTS: 2, ID_EVENTS_NEW_REC: 1, ID_EVENTS_REMOVE_REC: 2, + ID_EVENTS_ATTEND: 4, + ID_EVENTS_SEND_MSG: 8, TYPEDIR_FRIENDS: 3, ID_FRIENDS_NEW_REC: 1, @@ -1181,6 +1185,10 @@ export const shared_consts = { { value: 1, // ID_EVENTS_NEW_REC labeltrans: 'notifsid.events_new', + }, + { + value: 4, // ID_EVENTS_ATTEND + labeltrans: 'notifsid.attend_new', } ], }, @@ -1267,10 +1275,15 @@ export const shared_consts = { directory: 1, }, { - value: 1, // + value: 1, // ID_EVENTS_NEW_REC labeltrans: 'notifs.new_event', directory: 2, }, + { + value: 4, // ID_EVENTS_ATTEND + labeltrans: 'notifs.new_attend', + directory: 2, + }, { value: 1, // labeltrans: 'notifs.new_friends', @@ -1573,6 +1586,11 @@ export const shared_consts = { UP_LEFT: 5, }, + TABLETYPE: { + DefaultCal: 0, + MyBachecas: 1, + }, + getStatusStr(status: number) { const trovatorec = this.OrderStatusStr.find((rec) => rec.value === status) return (trovatorec) ? trovatorec.label : '' @@ -1587,7 +1605,147 @@ export const shared_consts = { return ['_id', 'username', 'group', 'email', 'name', 'surname', 'perm', 'date_reg', 'verified_email', 'notask_verif', 'verified_by_aportador', 'trust_modified', 'img', 'ipaddr', 'lasttimeonline', 'profile', 'news_on'] }, - getProjectForAll(proj_add: any) { + getProjectByTable(table: string, proj_add?: any) { + let proj = {} + if (table === this.TABLES_MYGOODS) { + proj = { + 'recGood': 1, + 'sectorGood': 1, + 'idSectorGood': 1, + 'idGood': 1, + 'idShipping': 1, + 'idStatusGood': 1, + groupname: 1, + //**ADDFIELD_MYGOOD + } + + } else if (table === this.TABLES_MYGROUPS) { + proj = { + groupname: 1, + title: 1, + descr: 1, + img: 1, + visibility: 1, + admins: 1, + idCatGrp: 1, + date_created: 1, + date_updated: 1, + photos: 1, + idCity: 1, + note: 1, + website: 1, + link_telegram: 1, + comune: 1, + mycities: 1, + sector: 1, + recCatGrp: 1, + } + } else if (table === this.TABLES_CIRCUITS) { + proj = { + _id: 1, + groupnameId: 1, + path: 1, + name: 1, + strProv: 1, + subname: 1, + longdescr: 1, + regulation: 1, + numMembers: 1, + totCircolante: 1, + totTransato: 1, + systemUserId: 1, + createdBy: 1, + date_created: 1, + date_updated: 1, + nome_valuta: 1, + fido_scoperto_default: 1, + deperimento: 1, + status: 1, + transactionsEnabled: 1, + qta_max_default: 1, + fido_scoperto_default_grp: 1, + qta_max_default_grp: 1, + valuta_per_euro: 1, + symbol: 1, + idCity: 1, + pub_to_share: 1, + visibility: 1, + color: 1, + abbrev: 1, + data_costituz: 1, + photos: 1, + admins: 1, + req_users: 1, + refused_users: 1, + 'mycities': 1, + //**ADDFIELD_CIRCUITS + } + } else if (table === this.TABLES_MYSKILLS) { + proj = { + recSkill: 1, + sector: 1, + idSector: 1, + idSkill: 1, + myskill: 1, + idStatusSkill: 1, + idContribType: 1, + numLevel: 1, + adType: 1, + photos: 1, + note: 1, + website: 1, + groupname: 1, + //**ADDFIELD_MYSKILL + } + + } else if (table === this.TABLES_MYHOSPS) { + proj = { + visibile: 1, + typeHosp: 1, + numMaxPeopleHosp: 1, + accomodation: 1, + preferences: 1, + idContribType: 1, + photos: 1, + idCity: 1, + note: 1, + website: 1, + link_maplocation: 1, + groupname: 1, + } + + } else if (table === this.TABLES_MYBACHECAS) { + proj = { + recSkill: 1, + sector: 1, + idSector: 1, + idSkill: 1, + // 'idSubSkill': 1, + idStatusSkill: 1, + idContribType: 1, + dateTimeStart: 1, + dateTimeEnd: 1, + website: 1, + organisedBy: 1, + contact_phone: 1, + contact_telegram: 1, + address: 1, + min_partecip: 1, + max_partecip: 1, + contribstr: 1, + link_maplocation: 1, + groupname: 1, + //**ADDFIELD_MYBACHECAS + } + } + + if (proj_add) + proj = Object.assign({}, proj, proj_add); + + return proj; + }, + + getProjectForAll(proj_add: any, table?: string) { let proj = { idContribType: 1, idCity: 1, @@ -1613,7 +1771,11 @@ export const shared_consts = { 'profile.username_telegram': 1, 'profile.favorite': 1, 'profile.bookmark': 1, + 'profile.attend': 1, 'profile.seen': 1, + 'mygrp.groupname': 1, + 'mygrp.title': 1, + 'mygrp.photos': 1, reported: 1, date_report: 1, username_who_report: 1, @@ -1624,6 +1786,11 @@ export const shared_consts = { if (proj_add) proj = Object.assign({}, proj, proj_add); + if (table) { + let proj_add3 = this.getProjectByTable(table); + proj = Object.assign({}, proj, proj_add3); + } + return proj; }, diff --git a/src/components/CEventsCalendar/CEventsCalendar.ts b/src/components/CEventsCalendar/CEventsCalendar.ts index 114d46db..62e38176 100755 --- a/src/components/CEventsCalendar/CEventsCalendar.ts +++ b/src/components/CEventsCalendar/CEventsCalendar.ts @@ -27,6 +27,7 @@ import { useMessageStore } from '@store/MessageStore' import { static_data } from '@/db/static_data' import { lists } from '@store/Modules/lists' import translate from '@/globalroutines/util' +import { shared_consts } from '@src/common/shared_vuejs' export default defineComponent({ name: 'CEventsCalendar', @@ -82,8 +83,10 @@ export default defineComponent({ const formbookEventDefault = ref({ userId: '', + username: '', msgbooking: '', infoevent: '', + tableType: shared_consts.TABLETYPE.DefaultCal, numpeople: 1, numpeopleLunch: 0, numpeopleDinner: 0, @@ -94,14 +97,8 @@ export default defineComponent({ }) const formAskForDefault = ref({ - dest: { - idapp: process.env.APP_ID, - username: '' - }, - origin: { - idapp: process.env.APP_ID, - username: '' - }, + dest: '', + origin: '', message: '' }) @@ -151,15 +148,9 @@ export default defineComponent({ }) const bookEventForm = ref({ ...formbookEventDefault.value }) const askInfoForm = ref({ - dest: { - idapp: process.env.APP_ID, - username: '' - }, - origin: { - idapp: process.env.APP_ID, - username: '' - }, - message: '' + dest: '', + origin: '', + message: '', }) const displayEvent = ref(false) const myevent = ref({}) @@ -402,6 +393,8 @@ export default defineComponent({ myevent.value = eventparam askInfoForm.value = { + origin: '', + dest: '', message: '' } @@ -610,7 +603,7 @@ export default defineComponent({ function EditBookEvent(myevent: IEvents) { - const bookedevent: any = calendarStore.findEventBooked(myevent, false) + const bookedevent: any = calendarStore.findEventBooked(myevent._id, false) console.log('bookedevent', bookedevent) @@ -639,10 +632,8 @@ export default defineComponent({ event_id: myevent._id, infoevent: tools.gettextevent(myevent) }, - dest: { - idapp: process.env.APP_ID, - username: myevent.teacher - }, + origin: userStore.my.username, + dest: myevent.teacher!, message: askInfoForm.value.message } @@ -668,6 +659,8 @@ export default defineComponent({ const data: IBookedEvent = { userId: userStore.my._id, id_bookedevent: myevent._id, + username: bookEventForm.value.username, + tableType: shared_consts.TABLETYPE.DefaultCal, numpeople: bookEventForm.value.numpeople, numpeopleLunch: bookEventForm.value.numpeopleLunch, numpeopleDinner: bookEventForm.value.numpeopleDinner, diff --git a/src/components/CFinder/CFinder.ts b/src/components/CFinder/CFinder.ts index 79782cc6..1af4ed75 100755 --- a/src/components/CFinder/CFinder.ts +++ b/src/components/CFinder/CFinder.ts @@ -149,7 +149,7 @@ export default defineComponent({ else if (props.table === toolsext.TABUSER) return userStore.getMypaginationMembers() else if (shared_consts.TABLES_ORDER_DATE_UPDATED.includes(props.table)) - return { sortBy: 'date_updated', descending: true, page: 1, rowsNumber: 0, rowsPerPage: 10 } // date_updated + return { sortBy: 'date_updated', descending: true, page: 1, rowsNumber: 0, rowsPerPage: 10 } // date_updated else if (shared_consts.TABLES_ORDER_DESCR.includes(props.table)) return { sortBy: 'desc', descending: false, page: 1, rowsNumber: 0, rowsPerPage: 10 } @@ -981,434 +981,6 @@ export default defineComponent({ } - function extraparams() { - if (props.table === toolsext.TABMYGROUPS) { - - let lk_tab = 'mygroups' - let lk_LF = 'userId' - let lk_FF = '_id' - let lk_as = 'group' - let af_objId_tab = 'myId' - - return { - lookup1: { - lk_tab, - lk_LF, - lk_FF, - lk_as, - af_objId_tab, - lk_proj: { - groupname: 1, - title: 1, - descr: 1, - img: 1, - visibility: 1, - admins: 1, - idCatGrp: 1, - date_created: 1, - date_updated: 1, - photos: 1, - idCity: 1, - note: 1, - link_telegram: 1, - website: 1, - comune: 1, - mycities: 1, - sector: 1, - } - }, - lookup2: { - lk_tab: 'catgrps', - lk_LF: 'idCatGrp', - lk_FF: '_id', - lk_as: 'recCatGrp', - lk_proj: { - groupname: 1, - title: 1, - descr: 1, - img: 1, - visibility: 1, - admins: 1, - idCatGrp: 1, - date_created: 1, - date_updated: 1, - photos: 1, - idCity: 1, - note: 1, - website: 1, - link_telegram: 1, - comune: 1, - mycities: 1, - sector: 1, - recCatGrp: 1, - - } - }, - lookup3: { - lk_tab: 'cities', - lk_LF: 'idCity', - lk_FF: '_id', - lk_as: 'comune', - lk_proj: { - groupname: 1, - title: 1, - descr: 1, - img: 1, - idCatGrp: 1, - date_created: 1, - date_updated: 1, - visibility: 1, - admins: 1, - photos: 1, - idCity: 1, - note: 1, - //**ADDFIELD_MYGROUPS - website: 1, - link_telegram: 1, - comune: 1, - mycities: 1, - recCatGrp: 1, - } - }, - lookup5: { - lk_tab: 'cities', - lk_LF: 'idCity', - lk_FF: '_id', - lk_as: 'mycities', - af_objId_tab: '', - }, - } - - } else if (props.table === toolsext.TABCIRCUITS) { - - let lk_tab = 'cities' - let lk_LF = 'idCity' - let lk_FF = '_id' - let lk_as = 'mycities' - let af_objId_tab = '' - - return { - lookup1: { - lk_tab, - lk_LF, - lk_FF, - lk_as, - af_objId_tab, - lk_proj: { - _id: 1, - groupnameId: 1, - path: 1, - name: 1, - strProv: 1, - subname: 1, - longdescr: 1, - regulation: 1, - numMembers: 1, - totCircolante: 1, - totTransato: 1, - systemUserId: 1, - createdBy: 1, - date_created: 1, - date_updated: 1, - nome_valuta: 1, - fido_scoperto_default: 1, - deperimento: 1, - status: 1, - transactionsEnabled: 1, - qta_max_default: 1, - fido_scoperto_default_grp: 1, - qta_max_default_grp: 1, - valuta_per_euro: 1, - symbol: 1, - idCity: 1, - pub_to_share: 1, - visibility: 1, - color: 1, - abbrev: 1, - data_costituz: 1, - photos: 1, - admins: 1, - req_users: 1, - refused_users: 1, - 'mycities': 1, - } - }, - } - - } else if (props.table === toolsext.TABMYGOODS) { - return { - lookup1: { - lk_tab: 'users', - lk_LF: 'userId', - lk_FF: '_id', - lk_as: 'user', - af_objId_tab: 'myId', - }, - lookup2: { - lk_tab: 'goods', - lk_LF: 'idGood', - lk_FF: '_id', - lk_as: 'recGood', - af_objId_tab: '', - lk_proj: { - recGood: 1, - sectorGood: 1, - idSectorGood: 1, - idGood: 1, - mygood: 1, - idStatusSkill: 1, - idContribType: 1, - 'profile.username_telegram': 1, - 'profile.favorite': 1, - 'profile.bookmark': 1, - 'profile.seen': 1, - idCity: 1, - pub_to_share: 1, - numLevel: 1, - adType: 1, - photos: 1, - note: 1, - website: 1, - //**ADDFIELD_MYSKILL - descr: 1, - date_created: 1, - date_updated: 1, - userId: 1, - username: 1, - name: 1, - surname: 1, - lasttimeonline: 1, - comune: 1, - mycities: 1, - 'profile.img': 1, - 'profile.mygroups': 1, - 'profile.qualifica': 1, - 'profile.resid_province': 1, - reported: 1, - date_report: 1, - username_who_report: 1, - } - }, - lookup3: { - lk_tab: 'sectorgoods', - // lk_LF: 'recGood.idSectorGood', - lk_LF: 'idSectorGood', - lk_FF: '_id', - lk_as: 'sectorGood', - af_objId_tab: '', - }, - lookup5: { - lk_tab: 'cities', - lk_LF: 'idCity', - lk_FF: '_id', - lk_as: 'mycities', - af_objId_tab: '', - }, - } - } else if (props.table === toolsext.TABMYBACHECAS) { - return { - // Servizi - lookup1: { - lk_tab: 'users', - lk_LF: 'userId', - lk_FF: '_id', - lk_as: 'user', - af_objId_tab: 'myId', - }, - lookup2: { - lk_tab: 'skills', - lk_LF: 'idSkill', - lk_FF: '_id', - lk_as: 'recSkill', - af_objId_tab: '', - lk_proj: { - recSkill: 1, - sector: 1, - idSector: 1, - idSkill: 1, - // idSubSkill: 1, - myskill: 1, - idStatusSkill: 1, - idContribType: 1, - 'profile.username_telegram': 1, - 'profile.favorite': 1, - 'profile.bookmark': 1, - 'profile.seen': 1, - idCity: 1, - pub_to_share: 1, - dateTimeStart: 1, - dateTimeEnd: 1, - numLevel: 1, - adType: 1, - photos: 1, - note: 1, - website: 1, - //**ADDFIELD_MYSKILL - descr: 1, - date_created: 1, - date_updated: 1, - userId: 1, - username: 1, - name: 1, - surname: 1, - lasttimeonline: 1, - comune: 1, - mycities: 1, - 'profile.img': 1, - 'profile.mygroups': 1, - 'profile.qualifica': 1, - 'profile.resid_province': 1, - reported: 1, - date_report: 1, - username_who_report: 1, - } - }, - lookup3: { - lk_tab: toolsext.TABSECTORS, - // lk_LF: 'recSkill.idSector', - lk_LF: 'idSector', - lk_FF: '_id', - lk_as: 'sector', - af_objId_tab: '', - }, - lookup5: { - lk_tab: 'cities', - lk_LF: 'idCity', - lk_FF: '_id', - lk_as: 'mycities', - af_objId_tab: '', - }, - } - - } else if (props.table === toolsext.TABMYHOSPS) { - let obj2: any = {} - - if (myrecfiltertoggle.value === tools.FILTER_ALL) { - obj2['visibile'] = true - } - - return { - // Servizi - filtersearch2: [obj2], - lookup1: { - lk_tab: 'users', - lk_LF: 'userId', - lk_FF: '_id', - lk_as: 'user', - af_objId_tab: 'myId', - }, - lookup2: { - lk_tab: 'cities', - lk_LF: 'idCity', - lk_FF: '_id', - lk_as: 'mycities', - af_objId_tab: '', - lk_proj: { - visibile: 1, - typeHosp: 1, - numMaxPeopleHosp: 1, - accomodation: 1, - preferences: 1, - idContribType: 1, - 'profile.username_telegram': 1, - 'profile.favorite': 1, - 'profile.bookmark': 1, - 'profile.seen': 1, - photos: 1, - idCity: 1, - pub_to_share: 1, - note: 1, - website: 1, - link_maplocation: 1, - descr: 1, - date_created: 1, - date_updated: 1, - userId: 1, - username: 1, - name: 1, - surname: 1, - lasttimeonline: 1, - comune: 1, - mycities: 1, - 'profile.img': 1, - } - }, - } - - } else { - return { - // Servizi - lookup1: { - lk_tab: 'users', - lk_LF: 'userId', - lk_FF: '_id', - lk_as: 'user', - af_objId_tab: 'myId', - }, - lookup2: { - lk_tab: 'skills', - lk_LF: 'idSkill', - lk_FF: '_id', - lk_as: 'recSkill', - af_objId_tab: '', - lk_proj: { - recSkill: 1, - sector: 1, - idSector: 1, - idSkill: 1, - // idSubSkill: 1, - myskill: 1, - idStatusSkill: 1, - idContribType: 1, - 'profile.username_telegram': 1, - 'profile.favorite': 1, - 'profile.bookmark': 1, - 'profile.seen': 1, - idCity: 1, - pub_to_share: 1, - numLevel: 1, - adType: 1, - photos: 1, - note: 1, - website: 1, - //**ADDFIELD_MYSKILL - descr: 1, - date_created: 1, - date_updated: 1, - userId: 1, - username: 1, - name: 1, - surname: 1, - lasttimeonline: 1, - comune: 1, - mycities: 1, - 'profile.img': 1, - 'profile.mygroups': 1, - 'profile.qualifica': 1, - 'profile.resid_province': 1, - reported: 1, - date_report: 1, - username_who_report: 1, - } - }, - lookup3: { - lk_tab: toolsext.TABSECTORS, - // lk_LF: 'recSkill.idSector', - lk_LF: 'idSector', - lk_FF: '_id', - lk_as: 'sector', - af_objId_tab: '', - }, - lookup5: { - lk_tab: 'cities', - lk_LF: 'idCity', - lk_FF: '_id', - lk_as: 'mycities', - af_objId_tab: '', - }, - } - } - } function mySortFieldsAvailable() { if (props.table === toolsext.TABUSER) { @@ -1418,22 +990,6 @@ export default defineComponent({ return [] } - function getdefaultnewrec(): any { - if (props.table === toolsext.TABMYSKILLS) { - return tools.getdefaultnewrec_MySkill() - } else if (props.table === toolsext.TABMYBACHECAS) { - return tools.getdefaultnewrec_MyBacheca() - } else if (props.table === toolsext.TABMYHOSPS) { - return tools.getdefaultnewrec_MyHosp() - } else if (props.table === toolsext.TABMYGOODS) { - return tools.getdefaultnewrec_MyGoods() - } else if (props.table === toolsext.TABMYGROUPS) { - return tools.getdefaultnewrec_MyGroup() - } else if (props.table === toolsext.TABCIRCUITS) { - return tools.getdefaultnewrec_Circuit() - } - return null - } function doSearch() { @@ -1446,7 +1002,6 @@ export default defineComponent({ t, tools, costanti, - extraparams, arrfilterand, filtercustom, searchList, @@ -1459,7 +1014,6 @@ export default defineComponent({ col_tabfooter, col, toolsext, - getdefaultnewrec, mypagination, noMsgRecord, showType, diff --git a/src/components/CFinder/CFinder.vue b/src/components/CFinder/CFinder.vue index d7f7e5cb..84313643 100755 --- a/src/components/CFinder/CFinder.vue +++ b/src/components/CFinder/CFinder.vue @@ -55,11 +55,11 @@ :arrfilters="arrfilterand" :filtercustom="filtercustom" :prop_searchList="searchList" - :defaultnewrec="getdefaultnewrec" + :defaultnewrec="tools.getdefaultnewrec(table)" labelBtnAddRow="NONE" :prop_SortFieldsAvailable="mySortFieldsAvailable" :labelBtnAddExtra="noButtAdd ? `` : ``" - :extraparams="extraparams()" + :extraparams="tools.extraparams(table, {myrecfiltertoggle})" > diff --git a/src/components/CGallery/CGallery.vue b/src/components/CGallery/CGallery.vue index fc74fd12..4f219f2a 100755 --- a/src/components/CGallery/CGallery.vue +++ b/src/components/CGallery/CGallery.vue @@ -116,7 +116,7 @@
rowsel[myfield]', rowsel[myfield]) - valPrec = valinitial - // console.log('rowsel FINALE', rowsel) - saveFieldValue(mydata) } } @@ -1431,7 +1435,9 @@ export default defineComponent({ // @ts-ignore if (props.defaultnewrec) { // @ts-ignore - newRecord.value = props.defaultnewrec() + newRecord.value = props.defaultnewrec + } else { + newRecord.value = tools.getdefaultnewrec(mytable.value, {groupname: props.groupname}) } if (!newRecord.value) { newRecord.value = {} @@ -2089,6 +2095,14 @@ export default defineComponent({ function cmdExt(cmd: any, id: any, val2: any) { console.log('cmd', cmd) + if (cmd === costanti.CMD_CLONE) { + const myarr = serverData.value.find((rec: any) => rec._id === id) + newRecord.value = myarr + newRecord.value._id = 0 + newRecordBool.value = true + return true; + } + if (cmd === costanti.CMD_SHOW_PAGE) { visupagedialog.value = true myrecdialog.value = id @@ -2103,6 +2117,8 @@ export default defineComponent({ action = lists.MenuAction.DELETE_RECTABLE } else if (cmd === costanti.CMD_MODIFY) { action = lists.MenuAction.CAN_EDIT_TABLE + } else if (cmd === costanti.CMD_DUPLICATE) { + action = lists.MenuAction.DUPLICATE_RECTABLE } @@ -2314,6 +2330,7 @@ export default defineComponent({ ordinam, ordinam_desc, getNumFilterSelected, + rowsel, } } }) diff --git a/src/components/CGridTableRec/CGridTableRec.vue b/src/components/CGridTableRec/CGridTableRec.vue index 8e645d27..d3ef4f04 100755 --- a/src/components/CGridTableRec/CGridTableRec.vue +++ b/src/components/CGridTableRec/CGridTableRec.vue @@ -370,7 +370,7 @@
@@ -1176,7 +1176,6 @@ -
null) + const usersList = ref({ show: false, title: '', list: [] }) + const bookedList = ref({ show: false, title: '', list: [] }) + + const formbookEventDefault = ref({ + userId: '', + username: '', + msgbooking: '', + infoevent: '', + tableType: shared_consts.TABLETYPE.MyBachecas, + numpeople: 1, + numpeopleLunch: 0, + numpeopleDinner: 0, + numpeopleDinnerShared: 0, + datebooked: tools.getDateNow(), + booked: false, + modified: false + }) + + const formAskForDefault = ref({ + dest: '', + origin: '', + message: '', + }) + + const bookEventForm = ref({ ...formbookEventDefault.value }) + const askInfoForm = ref({ + dest: '', + origin: '', + message: '', + }) + + const askInfopage = ref({ + show: false, + msg: { + message: '' + }, + state: EState.None + }) + + + const bookEventpage = ref({ + show: false, + bookedevent: { + userId: '', + username: '', + tableType: shared_consts.TABLETYPE.MyBachecas, + numpeople: 0, + infoevent: '', + msgbooking: '', + modified: false, + booked: false + }, + state: EState.Creating, + }) const myrec = ref({}) const col = ref({}) const idnotif = computed(() => $route.query.idnotif ? $route.query.idnotif.toString() : '') + const arrbookings = computed(() => calendarStore.findAllBookedByIdEvent(myrec.value._id)) function profile() { return userStore.my.profile @@ -139,23 +204,47 @@ export default defineComponent({ return null } - function clicca(tipo: any, myset: any, title: string) { + async function clicca(tipo: any, myset: any, title: string) { let mylist = null if (tipo === costanti.TIPOFAVBOOK.FAVORITE) { if (myset) { - 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 } else if (tipo === costanti.TIPOFAVBOOK.BOOKMARK) { if (myset) { - 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 } else if (tipo === costanti.TIPOFAVBOOK.SEEN) { if (myset) { - userStore.setSeen($q, t, myrec.value._id, props.table, myrec.value); + 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) + + bookEventpage.value.state = EState.None + + const findev = calendarStore.findEventBooked(myrec.value._id, false) + EditBookEvent(false) + } + loading.value = false } mylist = myrec.value.myseen + } else if (tipo === costanti.TIPOFAVBOOK.ATTEND) { + if (myset) { + // userStore.setAttend($q, t, myrec.value._id, props.table, bookEventpage.value.bookedevent.numpeople, myrec.value); + } + mylist = arrbookings.value + + if (!myset && mylist && mylist.length > 0) { + bookedList.value.show = true; + bookedList.value.title = title; + bookedList.value.list = mylist; + } + return true; } if (!myset && mylist && mylist.length > 0) { @@ -180,6 +269,180 @@ export default defineComponent({ return obj } + function hasModifiedBooking() { + return (bookEventpage.value.bookedevent.numpeople !== bookEventForm.value.numpeople) || + (bookEventpage.value.bookedevent.numpeopleLunch !== bookEventForm.value.numpeopleLunch) || + (bookEventpage.value.bookedevent.numpeopleDinner !== bookEventForm.value.numpeopleDinner) || + (bookEventpage.value.bookedevent.numpeopleDinnerShared !== bookEventForm.value.numpeopleDinnerShared) || + (bookEventpage.value.bookedevent.msgbooking !== bookEventForm.value.msgbooking) || + (bookEventpage.value.bookedevent.booked !== bookEventForm.value.booked) + } + + function checkseinviaMsg() { + return (bookEventpage.value.state === EState.Creating) && (!bookEventForm.value.booked) + } + + function getTitleBtnBooking() { + if (bookEventpage.value.state === EState.Creating) { + return t('dialog.book') + } else { + return t('dialog.update') + } + } + + function EditBookEvent(show: boolean) { + + // const bookedevent: any = calendarStore.findEventBooked(myrec.value._id, false) + const bookedevent: any = arrbookings.value.find((recbook: IBookedEvent) => recbook.userId === userStore.my._id) + + + console.log('bookedevent', bookedevent) + + if (bookedevent) { + bookEventForm.value._id = bookedevent._id + bookEventForm.value.numpeople = bookedevent.numpeople + bookEventForm.value.numpeopleLunch = bookedevent.numpeopleLunch + bookEventForm.value.numpeopleDinner = bookedevent.numpeopleDinner + bookEventForm.value.numpeopleDinnerShared = bookedevent.numpeopleDinnerShared + bookEventForm.value.infoevent = bookedevent.infoevent + bookEventForm.value.msgbooking = bookedevent.msgbooking + bookEventForm.value.booked = bookedevent.booked + bookEventForm.value.datebooked = bookedevent.datebooked + bookEventpage.value.state = EState.Modifying + } else { + bookEventpage.value.state = EState.Creating + } + + bookEventpage.value.bookedevent = bookedevent + bookEventpage.value.show = show + } + + async function BookEvent(eventparam: IBookedEvent) { + const ris = await calendarStore.BookEvent(eventparam) + load() + return ris + } + + function saveBookEvent(myevent: IEvents) { + + if (true) { + // close the dialog + bookEventpage.value.show = false + + // bookEventForm.value.booked = bookEventForm.value.bookedcheck + + const data: IBookedEvent = { + userId: userStore.my._id, + username: userStore.my.username, + id_bookedevent: myrec.value._id, + tableType: shared_consts.TABLETYPE.MyBachecas, + numpeople: bookEventForm.value.numpeople, + numpeopleLunch: bookEventForm.value.numpeopleLunch, + numpeopleDinner: bookEventForm.value.numpeopleDinner, + numpeopleDinnerShared: bookEventForm.value.numpeopleDinnerShared, + infoevent: tools.gettextevent(myrec.value), + msgbooking: bookEventForm.value.msgbooking, + booked: bookEventForm.value.booked, + datebooked: tools.getDateNow(), + modified: (bookEventpage.value.state !== EState.Creating) + } + + BookEvent(data).then((ris) => { + if (ris) + tools.showPositiveNotif($q, t('cal.booked') + ' ' + t('cal.event') + ' "' + myrec.value.descr + '"') + else + tools.showNegativeNotif($q, t('cal.booked_error')) + }) + + contextDay.value = null + } + } + + function executefunc(mythisq: any, table: string, func: number, par: IParamDialog) { + + if (func === lists.MenuAction.DELETE) { + // console.log('param1', par.param1) + calendarStore.CancelBookingEvent({ + ideventbook: par.param1, + notify: par.param2 === true ? '1' : '0', + }).then((ris: any) => { + if (ris) { + tools.showPositiveNotif(mythisq, t('cal.canceledbooking') + ' "' + par.param3 + '"') + if (bookEventpage.value) + bookEventpage.value.show = false + } else { + tools.showNegativeNotif(mythisq, t('cal.cancelederrorbooking')) + } + }) + } + } + + function CancelBookingEvent(mythisq: any, bookeventid: string, notify: boolean, mythis?: any) { + + const mytitle = translate('cal.titlebooking') + const mytext = translate('cal.cancelbooking') + ' ' + tools.gettextevent(myrec.value) + '?' + const ok = translate('dialog.yes') + const funcok = lists.MenuAction.DELETE + const table = '' + const funccancel = 0 + const par = { + param1: bookeventid, + param2: notify, + param3: myrec.value.descr, + } + + // console.log('CancelBookingEvent ', myrec.value) + return $q.dialog({ + message: mytext, + html: true, + ok: { + label: ok, + push: true, + }, + title: mytitle, + cancel: true, + persistent: false, + }).onOk(() => { + // console.log('OK') + executefunc($q, table, funcok, par) + return true + }).onCancel(() => { + // console.log('CANCEL') + executefunc($q, table, funccancel, par) + return false + }) + } + + function sendMsg(info: boolean) { + askInfopage.value.show = false + + const data: IMessage = { + source: { + event_id: myrec.value._id, + infoevent: tools.gettextevent(myrec.value) + }, + origin: userStore.my.username, + dest: myrec.value.username, + message: info ? askInfoForm.value.message : bookEventForm.value.msgbooking + } + + messageStore.SendMsgEvent(data).then((ris) => { + contextDay.value = null + if (ris) + tools.showPositiveNotif($q, t('cal.sendmsg_sent')) + else + tools.showNegativeNotif($q, t('cal.sendmsg_error')) + }) + + } + + function isAlreadyBooked() { + // const calendarStore = useCalendarStore() + // return calendarStore.findEventBooked(myrec.value._id, true) + arrbookings.value.find((recbook: IBookedEvent) => recbook.userId === userStore.my._id && recbook.booked) + } + + onMounted(mounted) return { @@ -189,6 +452,7 @@ export default defineComponent({ myrec, shared_consts, globalStore, + site: globalStore.site, showPic, userStore, t, @@ -203,9 +467,24 @@ export default defineComponent({ getSectorByRec, getRecGoodSkillByRec, usersList, + bookedList, clicca, naviga, getTypeHosps, + bookEventpage, + hasModifiedBooking, + checkseinviaMsg, + getTitleBtnBooking, + askInfoForm, + EState, + saveBookEvent, + EditBookEvent, + CancelBookingEvent, + sendMsg, + askInfopage, + isAlreadyBooked, + bookEventForm, + loading, } } }) diff --git a/src/components/CMyCardService/CMyCardService.vue b/src/components/CMyCardService/CMyCardService.vue index 502b3f8a..cbe3b7fb 100644 --- a/src/components/CMyCardService/CMyCardService.vue +++ b/src/components/CMyCardService/CMyCardService.vue @@ -10,13 +10,35 @@ -
+
+ + +
+
+ - {{ $t('dialog.contact') }} - {{tools.getNomeUtenteByRecUser(myrec)}} + {{ $t('dialog.contact') }} - + {{ tools.getNomeUtenteByRecUser(myrec) }} - + - {{ $t('cmd.seen', {num: myrec.myseen ? myrec.myseen.length : 0}) }} + {{ + $t('cmd.seen', { + num: myrec.myseen ? myrec.myseen.length : 0, + }) + }} @@ -132,7 +179,43 @@ - {{ $t('cmd.favorite', {num: myrec.myfav ? myrec.myfav.length : 0}) }} + {{ + $t('cmd.favorite', { + num: myrec.myfav ? myrec.myfav.length : 0, + }) + }} + + + + + + + + {{ + $t('cmd.attend', { + num: calendarStore.getNumParticipants( + myrec, + true, + tools.peopleWhere.participants + ), + }) + }} @@ -150,7 +235,11 @@ - {{ $t('cmd.bookmark', {num: myrec.mybook ? myrec.mybook.length : 0}) }} + {{ + $t('cmd.bookmark', { + num: myrec.mybook ? myrec.mybook.length : 0, + }) + }} @@ -195,7 +284,9 @@ - {{tools.getstrDateMonthTimeLong(myrec.dateTimeStart)}} + {{ + tools.getstrDateMonthTimeLong(myrec.dateTimeStart) + }} @@ -206,7 +297,9 @@ - {{tools.getstrDateMonthTimeLong(myrec.dateTimeEnd)}} + {{ + tools.getstrDateMonthTimeLong(myrec.dateTimeEnd) + }} @@ -305,7 +398,35 @@ >
- + + + + + + + + {{ $t('event.organisedBy') }}: {{ myrec.organisedBy }} + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ $t('msgs.telegrammsg') }}: @{{ myrec.contact_telegram }} + + + + +
+ {{ myrec.address }} +
{{ city.comune }} ({{ city.prov }})
+ + + + + + + + + + @@ -344,18 +519,66 @@ /> - + - + + + + + + + + + + + + + - + {{ $t('event.min_partecip') }}: + {{ myrec.min_partecip }}
+ {{ $t('event.max_partecip') }}: + {{ myrec.max_partecip }} +
@@ -377,6 +600,9 @@ {{ calendarStore.getContribtypeById(reccontr) }} +
{{ myrec.contribstr }}
@@ -386,14 +612,23 @@ - {{ + + {{ $t('reg.pub_updated') }} + {{ tools.getstrDateMonthLong(myrec.date_updated) }}{{ tools.getstrDateMonthLong(myrec.date_created) - }} + }} +
{{ $t('reg.who_updated') }} + {{ + tools.getNomeUtenteByRecUser(myrec) + }}
+
@@ -409,42 +644,16 @@
- - - - +
+   +
+ + + +
+
@@ -491,6 +730,212 @@ + + + + + {{ bookedList.title }} + + + + +
+ + +
+ {{ tools.getstrshortDateTime(eventbook.datebooked) }} + {{ $t('sendmsg.write') }}: + +
+ + {{ eventbook.msgbooking }} +
+ Partecipanti: {{ eventbook.numpeople }}
+ Pranzo: {{ eventbook.numpeopleLunch }}
+ Cena: {{ eventbook.numpeopleDinner }}
+ C.Cond: {{ eventbook.numpeopleDinnerShared }}
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+ + + + + {{ $t('cal.booking') }} + + + + + +
+ + {{ myrec.descr }} + +
+ {{ $t('cal.when') }}: + + +
+
+ + + + + + +
+
+
+ + + + +
+
+ + + + + {{ $t('cal.booking') }} + + + + +
+ + +
+ + + +
+ + +
+
+ + +
+
+
+ + + + + + + + +
+