From c366d0362bbdba218a5a8b8320f094981cd688e9 Mon Sep 17 00:00:00 2001 From: Yemitan Isaiah Olurotimi Date: Thu, 17 Nov 2022 20:53:27 +0100 Subject: [PATCH 1/3] refactor: remove service type input and state from appointments form --- .../appointments-form.component.tsx | 29 +------------------ 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/packages/esm-patient-appointments-app/src/appointments/appointments-form.component.tsx b/packages/esm-patient-appointments-app/src/appointments/appointments-form.component.tsx index a0288263ae..15f60e4653 100644 --- a/packages/esm-patient-appointments-app/src/appointments/appointments-form.component.tsx +++ b/packages/esm-patient-appointments-app/src/appointments/appointments-form.component.tsx @@ -34,7 +34,6 @@ const AppointmentsForm: React.FC = ({ patientUuid, closeW const [appointmentNote, setAppointmentNote] = useState(''); const [selectedAppointmentType, setSelectedAppointmentType] = useState(''); const [selectedService, setSelectedService] = useState(''); - const [selectedServiceType, setSelectedServiceType] = useState(''); const [startDate, setStartDate] = useState(new Date()); const [startTime, setStartTime] = useState(dayjs(new Date()).format('hh:mm')); const [timeFormat, setTimeFormat] = useState(new Date().getHours() >= 12 ? 'PM' : 'AM'); @@ -46,14 +45,7 @@ const AppointmentsForm: React.FC = ({ patientUuid, closeW const { data: services, isLoading } = useAppointmentService(); - let serviceTypes; - if (services?.length) { - [{ serviceTypes }] = services; - } - const handleSubmit = () => { - const serviceType = serviceTypes.find((service) => service.name === selectedServiceType); - const serviceUuid = services.find((service) => service.name === selectedService)?.uuid; const serviceDuration = services.find((service) => service.name === selectedService)?.durationMins; @@ -189,7 +181,7 @@ const AppointmentsForm: React.FC = ({ patientUuid, closeW labelText={t('selectService', 'Select a service')} light={isTablet} onChange={(event) => setSelectedService(event.target.value)} - value={selectedServiceType} + value={selectedService} > {!selectedService ? : null} {services?.length > 0 && @@ -200,25 +192,6 @@ const AppointmentsForm: React.FC = ({ patientUuid, closeW ))} -
- {t('serviceType', 'Service Type')} - -
{t('appointmentType', 'Appointment Type')}