-
+
+
({ label: c, value: c }))}
value={form.nationality || ""}
@@ -631,7 +890,16 @@ export default function PatientRegistration(
}));
}}
/>
-
+ {errors["nationality"] && (
+
+ {errors["nationality"].map((error, index) => (
+
+ {error}
+
+ )) || "This field is required"}
+
+ )}
+
{form.nationality === "India" && (
<>
diff --git a/src/components/ui/errors.tsx b/src/components/ui/errors.tsx
deleted file mode 100644
index debe66d7308..00000000000
--- a/src/components/ui/errors.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-export function InputErrors({ errors }: { errors?: string[] }) {
- return errors && !!errors.length ? (
-
- {errors?.map((error, i) => (
-
- {error}
-
- ))}
-
- ) : null;
-}
diff --git a/src/components/ui/input-with-error.tsx b/src/components/ui/input-with-error.tsx
deleted file mode 100644
index 01e27d92775..00000000000
--- a/src/components/ui/input-with-error.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import { InputErrors } from "./errors";
-import { Label } from "./label";
-
-export default function InputWithError(props: {
- label?: string;
- required?: boolean;
- errors?: string[];
- children: React.ReactNode;
-}) {
- const { label, errors, children, required } = props;
-
- return (
- <>
- {label && (
-
- )}
- {children}
-
- >
- );
-}
diff --git a/src/pages/FacilityOrganization/components/FacilityOrganizationSelector.tsx b/src/pages/FacilityOrganization/components/FacilityOrganizationSelector.tsx
index 4d4f6c16b0c..8197ab11847 100644
--- a/src/pages/FacilityOrganization/components/FacilityOrganizationSelector.tsx
+++ b/src/pages/FacilityOrganization/components/FacilityOrganizationSelector.tsx
@@ -6,7 +6,7 @@ import CareIcon from "@/CAREUI/icons/CareIcon";
import Autocomplete from "@/components/ui/autocomplete";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
-import InputWithError from "@/components/ui/input-with-error";
+import { Label } from "@/components/ui/label";
import routes from "@/Utils/request/api";
import query from "@/Utils/request/query";
@@ -31,7 +31,7 @@ interface AutoCompleteOption {
export default function FacilityOrganizationSelector(
props: FacilityOrganizationSelectorProps,
) {
- const { onChange, required, facilityId } = props;
+ const { onChange, required: _required, facilityId } = props;
const [selectedLevels, setSelectedLevels] = useState
(
[],
);
@@ -105,10 +105,19 @@ export default function FacilityOrganizationSelector(
}
};
+ function t(key: string): string {
+ const translations: { [key: string]: string } = {
+ Organization: "Organization",
+ };
+ return translations[key] || key;
+ }
+
return (
-
+
+
- {/* Selected Organization Display */}
{selectedOrganization && (
@@ -185,6 +194,8 @@ export default function FacilityOrganizationSelector(
)}
-
+
+ {/* Handle errors if needed */}
+
);
}
diff --git a/src/pages/Organization/components/OrganizationSelector.tsx b/src/pages/Organization/components/OrganizationSelector.tsx
index 5220e7d7c5b..0731b8bdd03 100644
--- a/src/pages/Organization/components/OrganizationSelector.tsx
+++ b/src/pages/Organization/components/OrganizationSelector.tsx
@@ -5,7 +5,7 @@ import CareIcon from "@/CAREUI/icons/CareIcon";
import Autocomplete from "@/components/ui/autocomplete";
import { Button } from "@/components/ui/button";
-import InputWithError from "@/components/ui/input-with-error";
+import { Label } from "@/components/ui/label";
import useDebouncedState from "@/hooks/useDebouncedState";
@@ -28,7 +28,7 @@ interface AutoCompleteOption {
}
export default function OrganizationSelector(props: OrganizationSelectorProps) {
- const { onChange, required } = props;
+ const { onChange, required: _required } = props;
const [selectedLevels, setSelectedLevels] = useState
([]);
const [searchQuery, setSearchQuery] = useDebouncedState("", 500);
@@ -113,13 +113,10 @@ export default function OrganizationSelector(props: OrganizationSelectorProps) {
{/* Selected Levels */}
{selectedLevels.map((level, index) => (
-
+
+
@@ -135,7 +132,13 @@ export default function OrganizationSelector(props: OrganizationSelectorProps) {
-
+
+ {false && (
+
+ {"This field is required"}
+
+ )}
+
))}
@@ -143,10 +146,14 @@ export default function OrganizationSelector(props: OrganizationSelectorProps) {
{(!selectedLevels.length ||
selectedLevels[selectedLevels.length - 1]?.has_children) && (
-
+
+
+
-
+
+ {false && (
+
+ {"This field is required"}
+
+ )}
+
)}
>