fixed "Booking Users"

This commit is contained in:
Paolo Arena
2021-10-04 15:55:43 +02:00
parent 76918f6b2c
commit 1a9a81a1ba
20 changed files with 145 additions and 88 deletions

View File

@@ -4,7 +4,7 @@ import { useUserStore } from '@store/UserStore'
import { useGlobalStore } from '@store/globalStore'
import { useQuasar } from 'quasar'
import { colors, Screen, Platform, date } from 'quasar'
import { EState, IBookedEvent, IBookedEventPage, IEvents, IMessage, IMessagePage } from '@model'
import { EState, IBookedEvent, IBookedEventPage, IEvents, IMessage, IMessagePage, IParamDialog } from '@model'
import { Logo } from '../logo'
import { Footer } from '../Footer'
import { CTitle } from '../CTitle'
@@ -25,6 +25,8 @@ import { useCalendarStore } from '@store/CalendarStore'
import { func_tools, toolsext } from '@store/Modules/toolsext'
import { useMessageStore } from '@store/MessageStore'
import { static_data } from '@/db/static_data'
import { lists } from '@store/Modules/lists'
import translate from '@/globalroutines/util'
export default defineComponent({
name: 'CEventsCalendar',
@@ -441,6 +443,61 @@ export default defineComponent({
tools.CancelEvent($q, eventparam)
}
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, eventparam: IEvents, bookeventid: string, notify: boolean, mythis?: any) {
const mytitle = translate('cal.titlebooking')
const mytext = translate('cal.cancelbooking') + ' ' + tools.gettextevent(eventparam) + '?'
const ok = translate('dialog.yes')
const funcok = lists.MenuAction.DELETE
const table = ''
const funccancel = 0
const par = {
param1: bookeventid,
param2: notify,
param3: eventparam.title,
}
console.log('CancelBookingEvent ', eventparam)
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 duplicateEvent(eventparam: any, numgg: number, numev = 1) {
for (let i = 0; i < numev; ++i) {
globalStore.DuplicateRec({ table: costanti.TABEVENTS, id: eventparam._id }).then((rec) => {
@@ -962,6 +1019,8 @@ export default defineComponent({
createContribType,
static_data,
editEvent,
EState,
CancelBookingEvent,
}
}
})

View File

@@ -465,12 +465,13 @@
<q-btn
v-if="bookEventpage.state === EState.Modifying" flat :label="$t('cal.cancelbooking')"
color="negative"
@click="tools.CancelBookingEvent($q, myevent, bookEventForm._id, true)"></q-btn>
@click="CancelBookingEvent($q, myevent, bookEventForm._id, true)"></q-btn>
<q-btn
v-if="checkseinviaMsg" flat :label="$t('dialog.sendonlymsg')" color="primary"
v-if="checkseinviaMsg()" flat :label="$t('dialog.sendonlymsg')" color="primary"
@click="sendMsg(myevent)"></q-btn>
<q-btn
v-else :label="getTitleBtnBooking" color="primary" @click="saveBookEvent(myevent)"
v-else
:label="getTitleBtnBooking()" color="primary" @click="saveBookEvent(myevent)"
:disable="!(bookEventpage.state === EState.Creating || hasModifiedBooking)"></q-btn>