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

Edit feature for facilities in organization | pincode, geo_organization info auto populates #9662

Open
wants to merge 55 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
03fd617
pincode updated
Mahendar0701 Jan 2, 2025
d1a6ca1
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 2, 2025
7db9c3a
populated geo_organization values
Mahendar0701 Jan 3, 2025
080f442
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 3, 2025
8159f13
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 3, 2025
fc0413e
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 3, 2025
d0daf9c
autofill of state and districts
Mahendar0701 Jan 4, 2025
f7db9bc
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 4, 2025
02a4ca0
Merge branch 'facility-edit' of https://github.com/Mahendar0701/care_…
Mahendar0701 Jan 4, 2025
ab383d5
translation
Mahendar0701 Jan 4, 2025
7dff65f
commit
Mahendar0701 Jan 4, 2025
4eda986
added usequery
Mahendar0701 Jan 4, 2025
c811b60
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 4, 2025
d9078ad
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 5, 2025
884fc82
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 5, 2025
0f49a53
Merge branch 'facility-edit' of https://github.com/Mahendar0701/care_…
Mahendar0701 Jan 5, 2025
b6b2318
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 5, 2025
fd3241f
moved useFetchOrganizationByName organizationapi.ts
Mahendar0701 Jan 5, 2025
f9d4e49
Merge branch 'facility-edit' of https://github.com/Mahendar0701/care_…
Mahendar0701 Jan 5, 2025
3a9dcbf
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 5, 2025
e87535d
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 5, 2025
213eb95
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 6, 2025
87db767
added conditions
Mahendar0701 Jan 6, 2025
4599c93
Merge branch 'facility-edit' of https://github.com/Mahendar0701/care_…
Mahendar0701 Jan 6, 2025
8df1055
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 9, 2025
80dde3f
added edit option
Mahendar0701 Jan 9, 2025
f63a324
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 9, 2025
dcad86a
added edit option
Mahendar0701 Jan 9, 2025
0e370c9
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 10, 2025
9b57759
resolved conflicts
Mahendar0701 Jan 10, 2025
a5d9d6e
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 11, 2025
a932b00
autopopulation of existing details
Mahendar0701 Jan 11, 2025
15eb9d3
added i18n and pincode limit
Mahendar0701 Jan 11, 2025
f735ac9
added i18n and pincode limit
Mahendar0701 Jan 11, 2025
a68184f
link wrap in button
Mahendar0701 Jan 11, 2025
4a9f3a6
autofill pincode
Mahendar0701 Jan 11, 2025
43caefd
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 12, 2025
5ffb199
added form.watch
Mahendar0701 Jan 12, 2025
5bda95e
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 12, 2025
ed06a75
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 13, 2025
f763eba
facility edit sheet
Mahendar0701 Jan 13, 2025
8dbda7e
Merge branch 'facility-edit' of https://github.com/Mahendar0701/care_…
Mahendar0701 Jan 13, 2025
ec1014e
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 13, 2025
763b4aa
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 14, 2025
439a061
Update FacilityHome.tsx
Mahendar0701 Jan 14, 2025
0a6f616
organization error on update fixed
Mahendar0701 Jan 14, 2025
281e692
Merge branch 'facility-edit' of https://github.com/Mahendar0701/care_…
Mahendar0701 Jan 14, 2025
d1ac44c
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 14, 2025
02ee915
organization selector autofill
Mahendar0701 Jan 14, 2025
ddfc48a
added i8n
Mahendar0701 Jan 14, 2025
7a197f8
autofill pincode and editsheet wrapped out
Mahendar0701 Jan 14, 2025
9f20cde
Merge branch 'develop' into facility-edit
Mahendar0701 Jan 14, 2025
5ef6fae
edit button
Mahendar0701 Jan 14, 2025
652a56a
coderabbit suggestions
Mahendar0701 Jan 14, 2025
bd099ec
test case fixed
Mahendar0701 Jan 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions 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 @@ -685,6 +686,7 @@
"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_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 @@ -699,6 +701,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 @@ -812,6 +815,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 @@ -1070,7 +1074,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...",
"goal": "Our goal is to continuously improve the quality and accessibility of public healthcare services using digital tools.",
"granted_on": "Granted On",
"has_allergies": "Has Allergies",
Expand Down Expand Up @@ -1239,6 +1245,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 @@ -2059,6 +2066,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 @@ -2078,6 +2086,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 @@ -2167,6 +2176,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
7 changes: 3 additions & 4 deletions src/Utils/featureFlags.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { createContext, useContext, useEffect, useState } from "react";

import { FacilityModel } from "@/components/Facility/models";

import useAuthUser from "@/hooks/useAuthUser";

import routes from "@/Utils/request/api";
import useTanStackQueryInstead from "@/Utils/request/useQuery";
import { FacilityData } from "@/types/facility/facility";

export type FeatureFlag = "SCRIBE_ENABLED"; // "HCX_ENABLED" | "ABDM_ENABLED" |

Expand Down Expand Up @@ -48,9 +47,9 @@ export const FeatureFlagsProvider = (props: { children: React.ReactNode }) => {
);
};

export const useFeatureFlags = (facility?: FacilityModel | string) => {
export const useFeatureFlags = (facility?: FacilityData | string) => {
const [facilityObject, setFacilityObject] = useState<
FacilityModel | undefined
FacilityData | undefined
>(typeof facility === "string" ? undefined : facility);

const context = useContext(FeatureFlagsContext);
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");
Mahendar0701 marked this conversation as resolved.
Show resolved Hide resolved
return null;
}
return data.records[0];
};

Expand Down
Loading
Loading