Skip to content

Commit

Permalink
Merge branch 'develop' into issues/9668/fix-auto-fill
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacobjeevan committed Jan 16, 2025
2 parents ebee745 + a4b4206 commit 8d1f0c8
Show file tree
Hide file tree
Showing 23 changed files with 415 additions and 738 deletions.
7 changes: 7 additions & 0 deletions cypress/e2e/facility_spec/facility_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import { FacilityCreation } from "../../pageObject/facility/FacilityCreation";
import { generatePhoneNumber } from "../../utils/commonUtils";
import { generateFacilityData } from "../../utils/facilityData";

const LOCATION_HIERARCHY = {
localBody: "Aluva",
ward: "4",
};

describe("Facility Management", () => {
const facilityPage = new FacilityCreation();
const facilityType = "Primary Health Centre";
Expand Down Expand Up @@ -36,6 +41,8 @@ describe("Facility Management", () => {
testFacility.address,
);

facilityPage.fillLocationHierarchy(LOCATION_HIERARCHY);

facilityPage.fillLocationDetails(
testFacility.coordinates.latitude,
testFacility.coordinates.longitude,
Expand Down
11 changes: 8 additions & 3 deletions cypress/pageObject/facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class FacilityCreation {
label: "Phone Number",
message: "Phone number must start with +91 followed by 10 digits",
},
{ label: "Pincode", message: "Invalid pincode" },
{ label: "Pincode", message: "Invalid Pincode" },
]);
}

Expand All @@ -106,8 +106,7 @@ export class FacilityCreation {
// Split string into array of characters using spread in Array.from
Array.from(facilityName).forEach((char, index) => {
cy.get('[data-cy="search-facility"]').type(char, {
delay: 500,
force: true,
delay: 200,
});

// Wait for the last character's API call
Expand All @@ -126,4 +125,10 @@ export class FacilityCreation {
.should("be.visible")
.should("not.be.empty");
}

fillLocationHierarchy(location: { localBody: string; ward: string }) {
cy.typeAndSelectOption('[data-cy="select-local_body"]', location.localBody);
cy.typeAndSelectOption('[data-cy="select-ward"]', location.ward);
return this;
}
}
68 changes: 34 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"@radix-ui/react-tabs": "^1.1.1",
"@radix-ui/react-toast": "^1.2.4",
"@radix-ui/react-tooltip": "^1.1.6",
"@sentry/browser": "^8.48.0",
"@sentry/browser": "^8.50.0",
"@tanstack/react-query": "^5.64.1",
"@tanstack/react-query-devtools": "^5.64.0",
"@vitejs/plugin-react": "^4.3.4",
Expand Down Expand Up @@ -119,7 +119,7 @@
"react-pdf": "^9.2.1",
"react-webcam": "^7.2.0",
"recharts": "^2.15.0",
"sonner": "^1.7.0",
"sonner": "^1.7.2",
"tailwind-merge": "^2.5.5",
"tailwindcss-animate": "^1.0.7",
"use-keyboard-shortcut": "^1.1.6",
Expand Down
16 changes: 15 additions & 1 deletion public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@
"add_insurance_details": "Add Insurance Details",
"add_location": "Add Location",
"add_new_beds": "Add New Bed(s)",
"add_new_facility": "Add New Facility",
"add_new_patient": "Add New Patient",
"add_new_user": "Add New User",
"add_notes": "Add notes",
Expand Down Expand Up @@ -682,11 +683,12 @@
"create_asset": "Create Asset",
"create_consultation": "Create Consultation",
"create_encounter": "Create Encounter",
"create_facility": "Create a new facility",
"create_facility": "Create Facility",
"create_new_abha_address": "Create New ABHA Address",
"create_new_abha_profile": "Don't have an ABHA Number",
"create_new_asset": "Create New Asset",
"create_new_encounter": "Create a new encounter to get started",
"create_new_facility": "Create a new facility and add it to the organization.",
"create_new_tag": "Create New Tag",
"create_position_preset": "Create a new position preset",
"create_position_preset_description": "Creates a new position preset in Care from the current position of the camera for the given name",
Expand All @@ -701,6 +703,7 @@
"created_date": "Created Date",
"created_on": "Created On",
"creating": "Creating...",
"creating_facility": "Creating Facility...",
"criticality": "Criticality",
"csv_file_in_the_specified_format": "Select a CSV file in the specified format",
"current_address": "Current Address",
Expand Down Expand Up @@ -814,6 +817,7 @@
"edit_avatar_permission_error": "You do not have permissions to edit the avatar of this user",
"edit_caution_note": "A new prescription will be added to the consultation with the edited details and the current prescription will be discontinued.",
"edit_cover_photo": "Edit Cover Photo",
"edit_facility": "Edit Facility",
"edit_history": "Edit History",
"edit_policy": "Edit Insurance Policy",
"edit_policy_description": "Add or edit patient's insurance details",
Expand Down Expand Up @@ -1008,7 +1012,9 @@
"facility_preference": "Facility preference",
"facility_search_placeholder_text": "Search by Facility name",
"facility_type": "Facility Type",
"facility_type_required": "Facility type is required",
"facility_updated_success": "Facility updated successfully",
"facility_updated_successfully": "Facility updated successfully",
"failed_to_create_appointment": "Failed to create an appointment",
"failed_to_link_abha_number": "Failed to link ABHA Number. Please try again later.",
"fast_track_testing_reason": "Fast track testing reason",
Expand Down Expand Up @@ -1076,7 +1082,9 @@
"geolocation_is_not_supported_by_this_browser": "Geolocation is not supported by this browser",
"get_auth_methods": "Get Available Authentication Methods",
"get_auth_mode_error": "Could not find any supported authentication methods, Please try again with a different authentication method",
"get_current_location": "Get Current Location",
"get_tests": "Get Tests",
"getting_location": "Getting Location...",
"go_back": "Go Back",
"goal": "Our goal is to continuously improve the quality and accessibility of public healthcare services using digital tools.",
"granted_on": "Granted On",
Expand Down Expand Up @@ -1150,7 +1158,9 @@
"invalid_email": "Please enter a valid email address",
"invalid_email_address": "Invalid email address",
"invalid_ip_address": "Invalid IP Address",
"invalid_latitude": "Invalid latitude",
"invalid_link_msg": "It appears that the password reset link you have used is either invalid or expired. Please request a new password reset link.",
"invalid_longitude": "Invalid longitude",
"invalid_otp": "Invalid OTP, Please check the OPT and try Again",
"invalid_password": "Password doesn't meet the requirements",
"invalid_password_reset_link": "Invalid password reset link",
Expand Down Expand Up @@ -1246,6 +1256,7 @@
"local_ip_address_example": "e.g. 192.168.0.123",
"location": "Location",
"location_beds_empty": "No beds available in this location",
"location_details": "Location Details",
"location_management": "Location Management",
"location_updated_successfully": "Location updated successfully",
"log_lab_results": "Log Lab Results",
Expand Down Expand Up @@ -2083,6 +2094,7 @@
"update_asset_service_record": "Update Asset Service Record",
"update_available": "Update Available",
"update_bed": "Update Bed",
"update_existing_facility": "Update the details of the existing facility.",
"update_facility": "Update Facility",
"update_facility_middleware_success": "Facility middleware updated successfully",
"update_log": "Update Log",
Expand All @@ -2102,6 +2114,7 @@
"updated_on": "Updated On",
"updates": "Updates",
"updating": "Updating...",
"updating_facility": "Updating Facility...",
"upload": "Upload",
"upload_an_image": "Upload an image",
"upload_file": "Upload File",
Expand Down Expand Up @@ -2195,6 +2208,7 @@
"view_users": "View Users",
"village": "Village",
"virtual_nursing_assistant": "Virtual Nursing Assistant",
"visibility_settings": "Visibility Settings",
"vitals": "Vitals",
"vitals_monitor": "Vitals Monitor",
"vitals_present": "Vitals Monitor present",
Expand Down
6 changes: 1 addition & 5 deletions src/Routers/routes/FacilityRoutes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Redirect } from "raviger";

import { FacilityCreate } from "@/components/Facility/FacilityCreate";
import { FacilityHome } from "@/components/Facility/FacilityHome";
import FacilityUsers from "@/components/Facility/FacilityUsers";
import ResourceCreate from "@/components/Resource/ResourceCreate";
Expand All @@ -12,10 +11,7 @@ import FacilityOrganizationView from "@/pages/FacilityOrganization/FacilityOrgan

const FacilityRoutes: AppRoutes = {
"/facility": () => <Redirect to="/" />,
"/facility/create": () => <FacilityCreate />,
"/facility/:facilityId/update": ({ facilityId }) => (
<FacilityCreate facilityId={facilityId} />
),

"/facility/:facilityId": ({ facilityId }) => (
<FacilityHome facilityId={facilityId} />
),
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/request/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ const routes = {
getPermittedFacility: {
path: "/api/v1/facility/{id}/",
method: "GET",
TRes: Type<FacilityModel>(),
TRes: Type<FacilityData>(),
},

getAnyFacility: {
Expand Down
5 changes: 5 additions & 0 deletions src/Utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { differenceInMinutes, format } from "date-fns";
import html2canvas from "html2canvas";
import { toast } from "sonner";

import { AREACODES, IN_LANDLINE_AREA_CODES } from "@/common/constants";
import phoneCodesJson from "@/common/static/countryPhoneAndFlags.json";
Expand Down Expand Up @@ -112,6 +113,10 @@ export const getPincodeDetails = async (pincode: string, apiKey: string) => {
`https://api.data.gov.in/resource/6176ee09-3d56-4a3b-8115-21841576b2f6?api-key=${apiKey}&format=json&filters[pincode]=${pincode}&limit=1`,
);
const data = await response.json();
if (!data.records || data.records.length === 0) {
toast.error("Invalid pincode");
return null;
}
return data.records[0];
};

Expand Down
Loading

0 comments on commit 8d1f0c8

Please sign in to comment.