From c9543fbaeede0608288bfc23f534565e324eb040 Mon Sep 17 00:00:00 2001 From: Ann Date: Mon, 22 Feb 2021 20:45:16 -0500 Subject: [PATCH] fixes --- .../bookings/appointment/appointment_post.py | 29 ++----------------- .../components/Appointments/appointments.vue | 12 +++++++- .../appt-blackout-modal.vue | 15 +++++++--- .../appt-booking-modal/appt-booking-modal.vue | 9 +++--- .../Booking/booking-blackout-modal.vue | 2 +- 5 files changed, 30 insertions(+), 37 deletions(-) diff --git a/api/app/resources/bookings/appointment/appointment_post.py b/api/app/resources/bookings/appointment/appointment_post.py index 2590d6f58..0ab1be3d3 100644 --- a/api/app/resources/bookings/appointment/appointment_post.py +++ b/api/app/resources/bookings/appointment/appointment_post.py @@ -142,33 +142,10 @@ def post(self): ches_token = generate_ches_token() except Exception as exc: pprint(f'Error on token generation - {exc}') + + is_stat = (json_data.get('stat_flag', False)) - #below feature inside if is no longer needed - new reqmt -> Stop blackouts from cancelling items (offices will call and cancel people individually if we have to close) - # once tested remove below if statement and adjust Indentation of code inside else statement. - if is_blackout_appt: - # If staff user is creating a blackout event then send email to all of the citizens with appointments for that period - # appointment_ids_to_delete = [] - # appointments_for_the_day = Appointment.get_appointment_conflicts(office_id, json_data.get('start_time'), - # json_data.get('end_time')) - # for (cancelled_appointment, office, timezone, user) in appointments_for_the_day: - # if cancelled_appointment.appointment_id != appointment.appointment_id and not cancelled_appointment.checked_in_time: - # appointment_ids_to_delete.append(cancelled_appointment.appointment_id) - - # # Send blackout email - # try: - # pprint('Sending email for appointment cancellation due to blackout') - # send_email(ches_token, - # *get_blackout_email_contents(appointment, cancelled_appointment, office, timezone, - # user)) - # except Exception as exc: - # pprint(f'Error on email sending - {exc}') - - # # Delete appointments - # if len(appointment_ids_to_delete) > 0: - # Appointment.delete_appointments(appointment_ids_to_delete) - pass - - else: + if ((not is_stat) and (not is_blackout_appt)): # Send confirmation email and sms try: ches_token = generate_ches_token() diff --git a/frontend/src/components/Appointments/appointments.vue b/frontend/src/components/Appointments/appointments.vue index 06d9979a1..6d71dcc90 100644 --- a/frontend/src/components/Appointments/appointments.vue +++ b/frontend/src/components/Appointments/appointments.vue @@ -90,7 +90,7 @@ - + @@ -180,6 +180,8 @@ export default class Appointments extends Vue { value: any = '' // events: any = [] currentDay: any = moment().format('YYYY-MM-DD')// new Date() + + is_stat: boolean = false get events () { if (this.searchTerm) { @@ -343,6 +345,14 @@ export default class Appointments extends Vue { } selectEvent (event) { + this.is_stat = false + this.getAppointments().then((each) => { + const bb = each.find(element => ((moment(event.date).format('YYYY-MM-DD') === moment(element.start_time).format('YYYY-MM-DD')) && (element.stat_flag))); + console.log(bb) + if (bb) { + this.is_stat = true + } + }) this.checkRescheduleCancel() this.blockEventSelect = true // this.unselect() diff --git a/frontend/src/components/Appointments/appt-booking-modal/appt-blackout-modal.vue b/frontend/src/components/Appointments/appt-booking-modal/appt-blackout-modal.vue index 1917413ac..c57eb8019 100644 --- a/frontend/src/components/Appointments/appt-booking-modal/appt-blackout-modal.vue +++ b/frontend/src/components/Appointments/appt-booking-modal/appt-blackout-modal.vue @@ -471,7 +471,7 @@ - + @@ -1332,7 +1332,7 @@ export default class AppointmentBlackoutModal extends Vue { // stat for rooms if (self.only_appointments.length === 0) { const office_room = await getOfficeRooms({'office_id': self.$store.state.user.office.office_id}) - office_room.forEach(function (room) { + await office_room.forEach(function (room) { const blackout_booking: any = {} if (room.id == '_offsite') { blackout_booking.start_time = moment.tz(date+' '+start, self.$store.state.user.office.timezone.timezone_name).format('YYYY-MM-DD HH:mm:ssZ') @@ -1365,7 +1365,7 @@ export default class AppointmentBlackoutModal extends Vue { } else if (self.only_this_office.length == 0) { // stat for appointments - all_offices.forEach(async function(office) { + await all_offices.forEach(async function(office) { const e: any = { start_time: moment.tz(date+' '+start, office.timezone.timezone_name).format('YYYY-MM-DD HH:mm:ssZ'), end_time: moment.tz(date+' '+end, office.timezone.timezone_name).format('YYYY-MM-DD HH:mm:ssZ'), @@ -1380,7 +1380,7 @@ export default class AppointmentBlackoutModal extends Vue { // stat for rooms const office_room = await getOfficeRooms({'office_id': office.office_id}) - office_room.forEach(function (room) { + await office_room.forEach(function (room) { const blackout_booking: any = {} if (room.id == '_offsite') { blackout_booking.start_time = moment.tz(date+' '+start, office.timezone.timezone_name).format('YYYY-MM-DD HH:mm:ssZ') @@ -1442,6 +1442,13 @@ export default class AppointmentBlackoutModal extends Vue { this.hideCollapse('collapse-information-audit') this.show_stat_next = false this.stat_submit = false + + this.stat_dates = [{note:""}] + this.show_next = true + this.only_this_office = [] + this.only_appointments = [] + + } } diff --git a/frontend/src/components/Appointments/appt-booking-modal/appt-booking-modal.vue b/frontend/src/components/Appointments/appt-booking-modal/appt-booking-modal.vue index 87d9a521c..41e2509f4 100644 --- a/frontend/src/components/Appointments/appt-booking-modal/appt-booking-modal.vue +++ b/frontend/src/components/Appointments/appt-booking-modal/appt-booking-modal.vue @@ -21,7 +21,7 @@ class="disabled btn-primary ml-2" v-if="(submitDisabled) && (!submitStat)" @click="validate = true" - >Submit1Submit Book Service Appointment
- + >Book Service Appointment +
@@ -233,7 +232,7 @@
- +
diff --git a/frontend/src/components/Booking/booking-blackout-modal.vue b/frontend/src/components/Booking/booking-blackout-modal.vue index db1d40167..a768bb6e9 100644 --- a/frontend/src/components/Booking/booking-blackout-modal.vue +++ b/frontend/src/components/Booking/booking-blackout-modal.vue @@ -312,7 +312,7 @@ - +