Skip to content

Commit

Permalink
Fix issue #8672: Updated PatientRegister, en.json, and validators.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
syedfardeenjeelani committed Oct 20, 2024
1 parent 5c39b2c commit 4306a95
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/Components/HCX/validators.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import { t } from "i18next";
import { FieldValidator } from "../Form/FieldValidators";
import { HCXPolicyModel } from "./models";

const HCXPolicyValidator: FieldValidator<HCXPolicyModel> = (
value,
enable_hcx,
) => {
if (
!value.policy_id.trim() ||
!value.subscriber_id.trim() ||
(enable_hcx && (!value.insurer_id?.trim() || !value.insurer_name?.trim()))
)
return "All fields are mandatory";
if (!value.subscriber_id.trim()) {
return t("member_id_required");
} else if (!value.policy_id.trim()) {
return t("policy_id_required");
}
if (enable_hcx) {
if (!value.insurer_id?.trim() || !value.insurer_name?.trim()) {
return t("insurer_name_required");
}
}
};

export default HCXPolicyValidator;
2 changes: 2 additions & 0 deletions src/Components/Patient/PatientRegister.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ export const PatientRegister = (props: PatientRegisterProps) => {
.find((error) => !!error);
setInsuranceDetailsError(insuranceDetailsError);

errors["insurance_details"] = insuranceDetailsError;

Object.keys(form).forEach((field) => {
let phoneNumber, emergency_phone_number;
switch (field) {
Expand Down
3 changes: 3 additions & 0 deletions src/Locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@
"indicator": "Indicator",
"inidcator_event": "Indicator Event",
"instruction_on_titration": "Instruction on titration",
"insurer_name_required": "Insurer Name is required",
"international_mobile": "International Mobile",
"invalid_asset_id_msg": "Oops! The asset ID you entered does not appear to be valid.",
"invalid_email": "Please Enter a Valid Email Address",
Expand Down Expand Up @@ -808,6 +809,7 @@
"medicine_administration_history": "Medicine Administration History",
"medicines_administered": "Medicine(s) administered",
"medicines_administered_error": "Error administering medicine(s)",
"member_id_required": "Member Id is required",
"middleware_hostname": "Middleware Hostname",
"middleware_hostname_example": "e.g. example.ohc.network",
"middleware_hostname_sourced_from": "Middleware hostname sourced from {{ source }}",
Expand Down Expand Up @@ -967,6 +969,7 @@
"policy__policy_id__example": "POL001",
"policy__subscriber_id": "Member ID",
"policy__subscriber_id__example": "SUB001",
"policy_id_required": "Policy Id or Policy Name is required",
"position": "Position",
"post_your_comment": "Post Your Comment",
"powered_by": "Powered By",
Expand Down

0 comments on commit 4306a95

Please sign in to comment.