Skip to content

Commit

Permalink
feat(ZMS-2936): fix timeslot bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lehju committed Feb 18, 2025
1 parent 962f6c2 commit 7afe546
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 67 deletions.
28 changes: 13 additions & 15 deletions zmscitizenview/src/components/Appointment/AppointmentView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<service-finder
:base-url="baseUrl"
:preselected-service-id="serviceId"
:preselected-offive-id="locationId"
:preselected-office-id="locationId"
:exclusive-location="exclusiveLocation"
:t="t"
@next="setServices"
Expand Down Expand Up @@ -340,7 +340,7 @@ const setRebookData = () => {
rebookedAppointment.value.customTextfield;
updateAppointment(appointment.value, props.baseUrl ?? undefined).then(
(data) => {
if ((data as AppointmentDTO).processId !== undefined) {
if ((data as AppointmentDTO).processId != undefined) {
appointment.value = data as AppointmentDTO;
} else {
if (
Expand All @@ -366,7 +366,7 @@ const nextReserveAppointment = () => {
selectedProvider.value.id,
props.baseUrl ?? undefined
).then((data) => {
if ((data as AppointmentDTO).processId !== undefined) {
if ((data as AppointmentDTO).processId != undefined) {
if (appointment.value && !isRebooking.value) {
cancelAppointment(appointment.value, props.baseUrl ?? undefined);
}
Expand Down Expand Up @@ -398,7 +398,7 @@ const nextUpdateAppointment = () => {
updateAppointment(appointment.value, props.baseUrl ?? undefined).then(
(data) => {
if ((data as AppointmentDTO).processId !== undefined) {
if ((data as AppointmentDTO).processId != undefined) {
appointment.value = data as AppointmentDTO;
} else {
if (
Expand All @@ -419,18 +419,16 @@ const nextBookAppointment = () => {
if (appointment.value) {
preconfirmAppointment(appointment.value, props.baseUrl ?? undefined).then(
(data) => {
if ((data as AppointmentDTO).processId !== undefined) {
if ((data as AppointmentDTO).processId != undefined) {
appointment.value = data as AppointmentDTO;
if (isRebooking.value && rebookedAppointment.value) {
cancelAppointment(
rebookedAppointment.value,
props.baseUrl ?? undefined
);
}
} else {
// error.value = true;
increaseCurrentView();
}
increaseCurrentView();
}
);
}
Expand All @@ -440,7 +438,7 @@ const nextCancelAppointment = () => {
if (appointment.value) {
cancelAppointment(appointment.value, props.baseUrl ?? undefined).then(
(data) => {
if ((data as AppointmentDTO).processId !== undefined) {
if ((data as AppointmentDTO).processId != undefined) {
cancelAppointmentSuccess.value = true;
} else {
cancelAppointmentError.value = true;
Expand Down Expand Up @@ -491,8 +489,8 @@ onMounted(() => {
try {
appointmentData = JSON.parse(window.atob(props.confirmAppointmentHash));
if (
appointmentData.id === undefined ||
appointmentData.authKey === undefined
appointmentData.id == undefined ||
appointmentData.authKey == undefined
) {
confirmAppointmentError.value = true;
return;
Expand All @@ -503,7 +501,7 @@ onMounted(() => {
}
confirmAppointment(appointmentData, props.baseUrl ?? undefined).then(
(data) => {
if ((data as AppointmentDTO).processId !== undefined) {
if ((data as AppointmentDTO).processId != undefined) {
confirmAppointmentSuccess.value = true;
} else {
confirmAppointmentError.value = true;
Expand All @@ -527,8 +525,8 @@ onMounted(() => {
try {
appointmentData = JSON.parse(window.atob(props.appointmentHash));
if (
appointmentData.id === undefined ||
appointmentData.authKey === undefined
appointmentData.id == undefined ||
appointmentData.authKey == undefined
) {
confirmAppointmentError.value = true;
return;
Expand All @@ -539,7 +537,7 @@ onMounted(() => {
}
fetchAppointment(appointmentData, props.baseUrl ?? undefined).then(
(data) => {
if ((data as AppointmentDTO).processId !== undefined) {
if ((data as AppointmentDTO).processId != undefined) {
appointment.value = data as AppointmentDTO;
selectedService.value = services.value.find(
(service) => service.id == appointment.value.serviceId
Expand Down
1 change: 1 addition & 0 deletions zmscitizenview/src/components/Appointment/CalendarView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ const allowedDates = (date: Date) => {
};
watch(selectedDay, (newDate) => {
selectedTimeslot.value = 0;
if (newDate) {
getAppointmentsOfDay(convertDateToString(newDate));
}
Expand Down
8 changes: 4 additions & 4 deletions zmscitizenview/src/components/Appointment/ServiceFinder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ import {
const props = defineProps<{
baseUrl: string | undefined;
preselectedServiceId: string | undefined;
preselectedOffiveId: string | undefined;
preselectedOfficeId: string | undefined;
exclusiveLocation: string | undefined;
t: any;
}>();
Expand Down Expand Up @@ -189,9 +189,9 @@ const setServiceData = (selectedService: ServiceImpl) => {
})
.filter((subService) => {
if (subService === undefined) return false;
if (props.preselectedOffiveId) {
if (props.preselectedOfficeId) {
return subService.providers.some(
(provider) => provider.id == props.preselectedOffiveId
(provider) => provider.id == props.preselectedOfficeId
);
}
return true;
Expand Down Expand Up @@ -314,7 +314,7 @@ onMounted(() => {
} else {
fetchServicesAndProviders(
props.preselectedServiceId ?? undefined,
props.preselectedOffiveId ?? undefined,
props.preselectedOfficeId ?? undefined,
props.baseUrl ?? undefined
).then((data) => {
services.value = data.services;
Expand Down
48 changes: 0 additions & 48 deletions zmscitizenview/tests/unit/AppointmentView.spec.ts

This file was deleted.

0 comments on commit 7afe546

Please sign in to comment.