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

Added translations in encounter page and minor fixes in patient registration form #10264

Merged
merged 12 commits into from
Feb 2, 2025
Merged
6 changes: 4 additions & 2 deletions src/components/Patient/PatientInfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ export default function PatientInfoCard(props: PatientInfoCardProps) {
>
{patient.name}
<div className="mt-[6px] text-sm font-semibold text-secondary-600">
{formatPatientAge(patient, true)} • {patient.gender}
{formatPatientAge(patient, true)} •{" "}
{t(`GENDER__${patient.gender}`)}
</div>
</div>
</div>
Expand All @@ -114,7 +115,8 @@ export default function PatientInfoCard(props: PatientInfoCardProps) {
>
{patient.name}
<div className="ml-3 mr-2 mt-[6px] text-sm font-semibold text-secondary-600">
{formatPatientAge(patient, true)} • {patient.gender}
{formatPatientAge(patient, true)} •{" "}
{t(`GENDER__${patient.gender}`)}
</div>
</div>
<div className="grid gap-4 grid-cols-3 mt-2 md:mt-0">
Expand Down
10 changes: 9 additions & 1 deletion src/components/Patient/PatientRegistration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,15 @@ export default function PatientRegistration(
data-cy="age-input"
/>
</FormControl>

<FormMessage />
{form.getValues("age") && (
<div className="text-violet-600 text-sm font-bold">
{t("year_of_birth")}:{" "}
{new Date().getFullYear() -
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
Number(form.getValues("age"))}
</div>
)}
</FormItem>
)}
/>
Expand Down Expand Up @@ -707,7 +715,7 @@ export default function PatientRegistration(
/>
</div>

<div className="grid grid-cols-2 gap-4">
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
{form.watch("nationality") === "India" && (
<FormField
control={form.control}
Expand Down
8 changes: 4 additions & 4 deletions src/components/ui/date-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function DateField({
}, [date]);

const handleDayChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newDay = e.target.value;
const newDay = e.target.value.slice(0, 2);
Mahendar0701 marked this conversation as resolved.
Show resolved Hide resolved
setDay(newDay);

if (
Expand All @@ -63,7 +63,7 @@ export default function DateField({
};

const handleMonthChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newMonth = e.target.value;
const newMonth = e.target.value.slice(0, 2);
Mahendar0701 marked this conversation as resolved.
Show resolved Hide resolved
setMonth(newMonth);

if (
Expand All @@ -85,7 +85,7 @@ export default function DateField({
};

const handleYearChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newYear = e.target.value;
const newYear = e.target.value.slice(0, 4);
Mahendar0701 marked this conversation as resolved.
Show resolved Hide resolved
setYear(newYear);

if (newYear.length === 4 && parseInt(newYear) >= 1900) {
Expand All @@ -101,7 +101,7 @@ export default function DateField({
};

return (
<div className="flex items-center gap-2">
<div className="flex flex-wrap items-center gap-4 md:gap-2 ">
Mahendar0701 marked this conversation as resolved.
Show resolved Hide resolved
<div className="flex flex-col gap-1">
<Label>{t("day")}</Label>
<Input
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/phone-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const CountrySelect = ({
<Button
type="button"
variant="outline"
className="flex gap-1 rounded-e-none rounded-s-md border-r-0 px-3 focus:z-10 h-[38px]"
className="flex gap-1 rounded-e-none rounded-s-md border-r-0 px-3 focus:z-10 h-[42px]"
Mahendar0701 marked this conversation as resolved.
Show resolved Hide resolved
disabled={disabled}
>
<FlagComponent
Expand Down
Loading