Skip to content

Commit

Permalink
Fix resource request (#9935)
Browse files Browse the repository at this point in the history
  • Loading branch information
bodhish authored Jan 13, 2025
1 parent b8f25c2 commit a47edbf
Show file tree
Hide file tree
Showing 9 changed files with 421 additions and 309 deletions.
27 changes: 24 additions & 3 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@
"back_to_login": "Back to login",
"base_dosage": "Dosage",
"basic_info": "Basic Information",
"basic_information": "Basic Information",
"bed_capacity": "Bed Capacity",
"bed_created_notification_one": "{{count}} Bed created successfully",
"bed_created_notification_other": "{{count}} Beds created successfully",
Expand Down Expand Up @@ -512,6 +513,7 @@
"card": "Card",
"care": "CARE",
"category": "Category",
"category_description": "Choose the category that best describes the resource needed.",
"caution": "Caution",
"central_nursing_station": "Central Nursing Station",
"change_avatar": "Change Avatar",
Expand Down Expand Up @@ -639,11 +641,15 @@
"contact_info_note": "View or update user's contact information",
"contact_info_note_self": "View or update your contact information",
"contact_info_note_view": "View user's contact information",
"contact_information": "Contact Information",
"contact_information_description": "Provide contact details for follow-up communication.",
"contact_number": "Contact Number",
"contact_person": "Name of Contact Person at Facility",
"contact_person_at_the_facility": "Contact person at the current facility",
"contact_person_description": "Name of the person to contact regarding this request.",
"contact_person_number": "Contact person number",
"contact_phone": "Contact Person Number",
"contact_phone_description": "Phone number to reach the contact person.",
"contact_with_confirmed_carrier": "Contact with confirmed carrier",
"contact_with_suspected_carrier": "Contact with suspected carrier",
"contact_your_admin_to_add_facilities": "Contact your admin to add facilities",
Expand Down Expand Up @@ -823,6 +829,7 @@
"emergency_contact_person_name_details": "Emergency contact person (Father, Mother, Spouse, Sibling, Friend)",
"emergency_contact_person_name_volunteer": "Emergency Contact Person Name (Volunteer)",
"emergency_contact_volunteer": "Emergency Contact (Volunteer)",
"emergency_description": "Mark as emergency if immediate attention is required.",
"emergency_phone_number": "Emergency Phone Number",
"empty_date_time": "--:-- --; --/--/----",
"encounter": "Encounter",
Expand Down Expand Up @@ -974,6 +981,7 @@
"facility_consent_requests_page_title": "Patient Consent List",
"facility_district_name": "Facility/District Name",
"facility_district_pincode": "Facility/District/Pincode",
"facility_for_care_support": "Facility for Care Support",
"facility_linked_success": "Facility linked successfully",
"facility_name": "Facility Name",
"facility_not_found": "Facility Not Found",
Expand Down Expand Up @@ -1014,10 +1022,15 @@
"file_preview": "File Preview",
"file_preview_not_supported": "Can't preview this file. Try downloading it.",
"file_type": "File Type",
"file_upload_error": "Error uploading file",
"file_upload_success": "File uploaded successfully",
"file_uploaded": "File Uploaded Successfully",
"files": "Files",
"fill_my_details": "Fill My Details",
"filter": "Filter",
"filter_by": "Filter By",
"filter_by_category": "Filter by category",
"filter_by_date": "Filter by Date",
"filters": "Filters",
"first_name": "First Name",
"footer_body": "Open Healthcare Network is an open-source public utility designed by a multi-disciplinary team of innovators and volunteers. Open Healthcare Network CARE is a Digital Public Good recognised by the United Nations.",
Expand Down Expand Up @@ -1154,7 +1167,7 @@
"is_it_upshift": "is it upshift",
"is_phone_a_whatsapp_number": "Is the phone number a WhatsApp number?",
"is_pregnant": "Is pregnant",
"is_this_an_emergency": "Is this an emergency?",
"is_this_an_emergency": "Is this an Emergency?",
"is_this_an_emergency_request": "Is this an emergency request?",
"is_this_an_upshift": "Is this an upshift?",
"is_unusual_course": "Is unusual course",
Expand Down Expand Up @@ -1190,6 +1203,7 @@
"link_facility_error": "Error while linking facility. Try again later.",
"linked_facilities": "Linked Facilities",
"linked_facilities_note": "Add or remove facilities and set or change the Home Facility",
"linked_patient": "Linked Patient",
"linked_patient_details": "Linked Patient Details",
"linked_skills": "Linked Skills",
"linked_skills_note": "Search and select skills to add to the skill set",
Expand Down Expand Up @@ -1427,7 +1441,7 @@
"pain_chart_description": "Mark region and intensity of pain",
"passport_number": "Passport Number",
"password": "Password",
"password_length_met": "Its at least 8 characters long",
"password_length_met": "It's at least 8 characters long",
"password_length_validation": "Use at least 8 characters",
"password_lowercase_met": "It includes at least one lowercase letter",
"password_lowercase_validation": "Include at least one lowercase letter",
Expand Down Expand Up @@ -1662,14 +1676,17 @@
"request": "Request",
"request-sample-test": "Service Request",
"request_consent": "Request Consent",
"request_details": "Request Details",
"request_for": "Request for",
"request_letter": "Request Letter",
"request_reason": "Reason of Request",
"request_reason_description": "Provide a detailed explanation of why this resource is needed.",
"request_reason_placeholder": "Type your description here",
"request_sample_test": "Request Sample Test",
"request_the_following_resource": "This is to request the following resource",
"request_title": "Request Title",
"request_title_placeholder": "Type your title here",
"request_title_description": "A brief title that describes what resource is needed.",
"request_title_placeholder": "Enter a clear, concise title for your request",
"request_updated_successfully": "Request updated successfully",
"requested_by": "Requested By",
"required": "Required",
Expand All @@ -1685,6 +1702,8 @@
"resource_details": "Resource details",
"resource_origin_facility": "Origin Facility",
"resource_request": "Request",
"resource_request_basic_info_description": "Provide the basic details about the resource request including the facility and urgency.",
"resource_request_details_description": "Provide detailed information about what resource is needed and why.",
"resource_requests": "Requests",
"resource_status": "Request Status",
"resource_type": "Request Type",
Expand Down Expand Up @@ -1771,11 +1790,13 @@
"select": "Select",
"select_additional_instructions": "Select additional instructions",
"select_all": "Select All",
"select_category": "Select a category",
"select_date": "Select date",
"select_department": "Select Department",
"select_diff_role": "Please select a different role",
"select_eligible_policy": "Select an Eligible Insurance Policy",
"select_facility": "Select Facility",
"select_facility_description": "Select the healthcare facility that will provide the requested resource.",
"select_facility_for_discharged_patients_warning": "Facility needs to be selected to view discharged patients.",
"select_for_administration": "Select for Administration",
"select_frequency": "Select frequency",
Expand Down
5 changes: 0 additions & 5 deletions src/Utils/request/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,6 @@ const routes = {
TRes: Type<PaginatedResponse<FacilityModel>>(),
},

getAllFacilities: {
path: "/api/v1/getallfacilities/",
TRes: Type<PaginatedResponse<FacilityModel>>(),
},

createFacility: {
path: "/api/v1/facility/",
method: "POST",
Expand Down
18 changes: 3 additions & 15 deletions src/components/Common/FacilitySelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { useCallback } from "react";
import { FacilityModel } from "@/components/Facility/models";
import AutoCompleteAsync from "@/components/Form/AutoCompleteAsync";

import routes from "@/Utils/request/api";
import request from "@/Utils/request/request";
import facilityApi from "@/types/facility/facilityApi";

interface BaseFacilitySelectProps {
name: string;
Expand Down Expand Up @@ -57,8 +57,6 @@ export const FacilitySelect = ({
showNOptions,
className = "",
facilityType,
district,
state,
allowNone = false,
freeText = false,
errors = "",
Expand All @@ -75,19 +73,9 @@ export const FacilitySelect = ({
all: searchAll,
facility_type: facilityType,
exclude_user: exclude_user,
district,
state,
};

const { data } = await request(
showAll ? routes.getAllFacilities : routes.getPermittedFacilities,
{ query },
);

if (freeText)
data?.results?.push({
name: text,
});
const { data } = await request(facilityApi.getAllFacilities, { query });

if (allowNone)
return [
Expand All @@ -97,7 +85,7 @@ export const FacilitySelect = ({

return data?.results;
},
[searchAll, showAll, facilityType, district, exclude_user, freeText],
[searchAll, showAll, facilityType, exclude_user, freeText],
);

return (
Expand Down
Loading

0 comments on commit a47edbf

Please sign in to comment.