Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) O3-3391: Appointments form should show errors if all fields were left empty #1182

Merged
merged 55 commits into from
Aug 8, 2024
Merged
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
01a5198
(fix) fix typo on recurring appointment label (#1047)
donaldkibet Mar 18, 2024
89cb8f0
(fix) service queues - make edit queue entry modal body scrollable if…
chibongho Mar 18, 2024
056b55b
(fix) O3-2471 recommended visit type tab should only show if configur…
mseaton Mar 18, 2024
339fffa
(fix) service queues - unescape queue name when passed into t() (#1043)
chibongho Mar 18, 2024
999d5a3
(refactor) O3-2891: Refactor Patient Appointments ESM into Appointmen…
mogoodrich Mar 18, 2024
e3ad60e
(feat) re-use upcomming appointment work to mark appointments as `Che…
donaldkibet Mar 20, 2024
c4c705b
(chore) Update translations from Transifex (#1011)
github-actions[bot] Mar 20, 2024
d458fce
(feat) use configured identifier type on appointment table (#1054)
donaldkibet Mar 20, 2024
22c4ee9
(fix) add `@openmrs/esm-patient-common-lib` as peer dependency and re…
donaldkibet Mar 21, 2024
ce358de
(fix): Enhanced Tablet View: Service Queues Metrics Header Overhaul (…
Murithijoshua Mar 21, 2024
bf17e2f
(chore) Update translations from Transifex (#1055)
github-actions[bot] Mar 21, 2024
55b1778
Enhanced Monthly Calendar UI for Appointment Scheduler (#1049)
gabriel090 Mar 21, 2024
bb9531d
(BREAKING) O3-2748 service queues - add ability to undo transitions a…
chibongho Mar 22, 2024
d262417
(chore) O3-2989 service queues - refactor <PatientSearch> to not have…
chibongho Mar 22, 2024
0286521
(feat) O3-2892: Add Patient-Centric View within the Appointments App …
mogoodrich Mar 28, 2024
b011d26
O3-2788 (fix) appointments table should correctly search by patient n…
mseaton Mar 28, 2024
eb8b0e8
(fix) O3-3009 Appointment form should limit location to those tagged …
mseaton Mar 28, 2024
9a4f842
(fix) O3-3013 Appointment Form should validate invalid time values (#…
mseaton Mar 29, 2024
6a2d007
(fix) O3-3013 appointment time validation should match entire string …
mseaton Apr 1, 2024
cfa3ddf
(feature) O3-2930: Add date of birth to patient details in Appointmen…
sparsh989 Apr 1, 2024
070ff34
(feat) O3-3025: Add validation in change status modal for service que…
donaldkibet Apr 2, 2024
35e45ee
(fix) O3-2748 service queue - fix NPE in undo transition dialog (#1077)
chibongho Apr 3, 2024
b255b06
(fix) Fix queue filtering by location (#1078)
donaldkibet Apr 3, 2024
9c8ddd5
(chore) Separate linting and formatting concerns (#1080)
denniskigen Apr 3, 2024
6d88d41
(feat) O3-3030 - make new queue table support creating new queue entr…
chibongho Apr 4, 2024
12d4454
(fix):O3-3039-Fix Incorrect Client Selection Issue When Navigating Pa…
makombe Apr 4, 2024
47e0fad
(refactor) O3-3012: Switch registering appointments form workspace ba…
mogoodrich Apr 4, 2024
77e9e93
(fix) Fix error for undifined attribute type (#1083)
makombe Apr 4, 2024
c58d040
(test) O3-3005: Add E2E test for registering an unknown patient (#1070)
kdaud Apr 4, 2024
bf2febc
(fix) Handle null start date on patient list details (#1081)
icrc-psousa Apr 4, 2024
12df966
(chore) Update translations from Transifex (#1059)
github-actions[bot] Apr 5, 2024
41d7986
(refactor) O3-2685: Inconsistent / Duplicated Appointments List UI be…
mogoodrich Apr 5, 2024
b117650
(chore) Fix Prettier glob patterns
denniskigen Apr 5, 2024
db9764e
O3-3030 service queues: fix NPE in mapVisitQueueEntryProperties (#1085)
chibongho Apr 7, 2024
710ca6d
(test) Remove mock implementations of usePagination (#1088)
denniskigen Apr 8, 2024
d58be25
(chore) Bump playwright (#1090)
kdaud Apr 9, 2024
4d60814
O3-3043 - (feat) service queues - add new view of queue entries showi…
chibongho Apr 9, 2024
7daedc0
(chore) Flag rules-of-hooks lint violations (#1091)
denniskigen Apr 9, 2024
b957676
(chore) Update translations from Transifex (#1087)
github-actions[bot] Apr 10, 2024
aedfa6a
(feat) O3-3063: UI tweaks for the Today's appointments widget (#1092)
denniskigen Apr 10, 2024
b20ccfc
(fix) O3-3063: Fix appointments table empty state text (#1094)
denniskigen Apr 11, 2024
cbde1f2
(feat) O3:3063: Appointments dashboard UI tweaks (#1096)
denniskigen Apr 11, 2024
4a8d138
(fix) Fix appointment metrics error state
denniskigen Apr 11, 2024
db9824e
Enhanced relationship display logic to differentiate 'Patient' roles …
piyushmishra1416 Apr 14, 2024
549b513
Merge branch 'main' of https://github.com/openmrs/openmrs-esm-patient…
senthil-athiban Apr 15, 2024
67058cf
Merge branch 'main' of https://github.com/openmrs/openmrs-esm-patient…
senthil-athiban May 1, 2024
9d449e7
Merge branch 'main' of https://github.com/openmrs/openmrs-esm-patient…
senthil-athiban Jun 9, 2024
da79f90
(fix): improve client side form validation
senthil-athiban Jun 10, 2024
03fb9b3
Merge branch 'main' of https://github.com/openmrs/openmrs-esm-patient…
senthil-athiban Jun 12, 2024
2646c9f
Merge branch 'main' of https://github.com/openmrs/openmrs-esm-patient…
senthil-athiban Jun 13, 2024
4482a6a
Merge branch 'main' into fix/form-validation
denniskigen Aug 7, 2024
15cc2ea
(fix): error validation
senthil-athiban Aug 8, 2024
7c8fd65
Merge branch 'main' of https://github.com/openmrs/openmrs-esm-patient…
senthil-athiban Aug 8, 2024
05e113d
Merge branch 'main' into fix/form-validation
denniskigen Aug 8, 2024
d165946
Fixup
denniskigen Aug 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,20 @@ const AppointmentsForm: React.FC<AppointmentsFormProps> = ({
.refine((duration) => (isAllDayAppointment ? true : duration > 0), {
message: translateFrom(moduleName, 'durationErrorMessage', 'Duration should be greater than zero'),
}),
location: z.string().refine((value) => value !== ''),
provider: z.string().refine((value) => value !== ''),
location: z.string().refine((value) => value !== '', {
message: translateFrom(moduleName, 'locationRequired', 'Location is required'),
}),
provider: z.string().refine((value) => value !== '', {
message: translateFrom(moduleName, 'providerRequired', 'Provider is required'),
}),
appointmentStatus: z.string().optional(),
appointmentNote: z.string(),
appointmentType: z.string().refine((value) => value !== ''),
selectedService: z.string().refine((value) => value !== ''),
appointmentType: z.string().refine((value) => value !== '', {
message: translateFrom(moduleName, 'appointmentTypeRequired', 'Appointment type is required'),
}),
selectedService: z.string().refine((value) => value !== '', {
message: translateFrom(moduleName, 'serviceRequired', 'Service is required'),
}),
recurringPatternType: z.enum(['DAY', 'WEEK']),
recurringPatternPeriod: z.number(),
recurringPatternDaysOfWeek: z.array(z.string()),
Expand Down Expand Up @@ -178,7 +186,14 @@ const AppointmentsForm: React.FC<AppointmentsFormProps> = ({
? new Date(appointment?.dateAppointmentScheduled)
: new Date();

denniskigen marked this conversation as resolved.
Show resolved Hide resolved
const { control, getValues, setValue, watch, handleSubmit } = useForm<AppointmentFormData>({
const {
control,
getValues,
setValue,
watch,
handleSubmit,
formState: { errors },
} = useForm<AppointmentFormData>({
mode: 'all',
resolver: zodResolver(appointmentsFormSchema),
defaultValues: {
Expand Down Expand Up @@ -431,15 +446,16 @@ const AppointmentsForm: React.FC<AppointmentsFormProps> = ({
<Controller
name="location"
control={control}
render={({ field: { onChange, value, onBlur, ref } }) => (
render={({ field: { onChange, value, onBlur, ref }, fieldState }) => (
<Select
id="location"
invalidText="Required"
labelText={t('selectALocation', 'Select a location')}
onChange={onChange}
onBlur={onBlur}
value={value}
ref={ref}>
ref={ref}
invalid={!!fieldState?.error?.message}
invalidText={fieldState?.error?.message}>
<SelectItem text={t('chooseLocation', 'Choose a location')} value="" />
{locations?.length > 0 &&
locations.map((location) => (
Expand All @@ -458,13 +474,15 @@ const AppointmentsForm: React.FC<AppointmentsFormProps> = ({
<Controller
name="dateAppointmentScheduled"
control={control}
render={({ field: { onChange, value, ref } }) => (
render={({ field: { onChange, value, ref }, fieldState }) => (
<DatePicker
datePickerType="single"
dateFormat={datePickerFormat}
value={value}
maxDate={new Date()}
onChange={([date]) => onChange(date)}>
onChange={([date]) => onChange(date)}
invalid={!!fieldState?.error?.message}
invalidText={fieldState?.error?.message}>
<DatePickerInput
id="dateAppointmentScheduledPickerInput"
labelText={t('dateScheduledDetail', 'Date appointment issued')}
Expand All @@ -483,10 +501,9 @@ const AppointmentsForm: React.FC<AppointmentsFormProps> = ({
<Controller
name="selectedService"
control={control}
render={({ field: { onBlur, onChange, value, ref } }) => (
render={({ field: { onBlur, onChange, value, ref }, fieldState }) => (
<Select
id="service"
invalidText="Required"
labelText={t('selectService', 'Select a service')}
onChange={(event) => {
if (context === 'creating') {
Expand All @@ -508,7 +525,9 @@ const AppointmentsForm: React.FC<AppointmentsFormProps> = ({
}}
onBlur={onBlur}
value={value}
ref={ref}>
ref={ref}
invalid={!!fieldState?.error?.message}
invalidText={fieldState?.error?.message}>
<SelectItem text={t('chooseService', 'Select service')} value="" />
{services?.length > 0 &&
services.map((service) => (
Expand All @@ -528,16 +547,17 @@ const AppointmentsForm: React.FC<AppointmentsFormProps> = ({
<Controller
name="appointmentType"
control={control}
render={({ field: { onBlur, onChange, value, ref } }) => (
render={({ field: { onBlur, onChange, value, ref }, fieldState }) => (
<Select
disabled={!appointmentTypes?.length}
id="appointmentType"
invalidText="Required"
labelText={t('selectAppointmentType', 'Select the type of appointment')}
onChange={onChange}
value={value}
ref={ref}
onBlur={onBlur}>
onBlur={onBlur}
invalid={!!fieldState?.error?.message}
invalidText={fieldState?.error?.message}>
<SelectItem text={t('chooseAppointmentType', 'Choose appointment type')} value="" />
{appointmentTypes?.length > 0 &&
appointmentTypes.map((appointmentType, index) => (
Expand Down Expand Up @@ -755,10 +775,11 @@ const AppointmentsForm: React.FC<AppointmentsFormProps> = ({
<Controller
name="appointmentStatus"
control={control}
render={({ field: { onBlur, onChange, value, ref } }) => (
render={({ field: { onBlur, onChange, value, ref }, fieldState }) => (
<Select
id="appointmentStatus"
invalidText="Required"
invalid={!!fieldState?.error?.message}
invalidText={fieldState?.error?.message}
labelText={t('selectAppointmentStatus', 'Select status')}
onChange={onChange}
value={value}
Expand Down Expand Up @@ -881,7 +902,7 @@ function TimeAndDuration({ isTablet, t, watch, control, services }) {
name="duration"
control={control}
defaultValue={defaultDuration}
render={({ field: { onChange, onBlur, value, ref } }) => (
render={({ field: { onChange, onBlur, value, ref }, fieldState }) => (
<NumberInput
hideSteppers
disableWheel
Expand All @@ -895,6 +916,7 @@ function TimeAndDuration({ isTablet, t, watch, control, services }) {
onChange={(event) => onChange(Number(event.target.value))}
value={value}
ref={ref}
invalid={fieldState?.error?.message}
/>
)}
/>
Expand Down
Loading