Skip to content

Commit

Permalink
otp patient registration: switching backing to dateformfield
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacobjeevan committed Dec 27, 2024
1 parent e042651 commit 79afe4e
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/pages/Appoinments/PatientRegistration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { z } from "zod";
import CareIcon from "@/CAREUI/icons/CareIcon";

import { Button } from "@/components/ui/button";
import { DatePicker } from "@/components/ui/date-picker";
import {
Form,
FormControl,
Expand All @@ -23,6 +22,7 @@ import { Label } from "@/components/ui/label";
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
import { Textarea } from "@/components/ui/textarea";

import DateFormField from "@/components/Form/FormFields/DateFormField";
import {
Appointment,
AppointmentCreate,
Expand Down Expand Up @@ -324,11 +324,24 @@ export function PatientRegistration(props: PatientRegistrationProps) {
<FormItem className="flex flex-col">
<FormLabel required>{t("date_of_birth")}</FormLabel>
<FormControl>
<DatePicker
date={
<DateFormField
name="date_of_birth"
value={
field.value ? new Date(field.value) : undefined
}
onChange={(date) => field.onChange(date)}
onChange={(dateObj: {
name: string;
value: Date;
}) => {
if (dateObj?.value instanceof Date) {
field.onChange(dateObj.value.toISOString());
} else {
field.onChange(null);
}
}}
disableFuture
min={new Date(1900, 0, 1)}
className="-mb-6"
/>
</FormControl>
<FormMessage />
Expand Down Expand Up @@ -396,13 +409,11 @@ export function PatientRegistration(props: PatientRegistrationProps) {
name="geo_organization"
render={({ field }) => (
<FormItem className="flex flex-col">
<FormLabel required>{t("organization")}</FormLabel>
<FormControl>
<OrganisationSelector
required
authToken={tokenData.token}
onChange={(value) => {
console.log(value);
field.onChange(value);
}}
/>
Expand Down

0 comments on commit 79afe4e

Please sign in to comment.