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

Resources redesign #10308

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
15 changes: 14 additions & 1 deletion public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@
"additional_instructions": "Additional Instructions",
"address": "Address",
"address_is_required": "Address is required",
"adjust_resource_filters": "Try adjusting your filters or create a new resource",
"administer": "Administer",
"administer_medicine": "Administer Medicine",
"administer_medicines": "Administer Medicines",
Expand Down Expand Up @@ -1071,6 +1072,7 @@
"immunisation-records": "Immunisation",
"in_consultation": "In-Consultation",
"inactive": "Inactive",
"incoming": "Incoming",
"incomplete_patient_details_warning": "Patient details are incomplete. Please update the details before proceeding.",
"inconsistent_dosage_units_error": "Dosage units must be same",
"indian_mobile": "Indian Mobile",
Expand Down Expand Up @@ -1363,6 +1365,7 @@
"no_records_found": "No Records Found",
"no_remarks": "No remarks",
"no_resource_requests_found": "No requests found",
"no_resources_found": "No resources found",
"no_results": "No results",
"no_results_found": "No Results Found",
"no_schedule_templates_found": "No schedule templates found for this month.",
Expand Down Expand Up @@ -1437,6 +1440,7 @@
"otp_verification_error": "Failed to verify OTP. Please try again later.",
"otp_verification_success": "OTP has been verified successfully.",
"out_of_range_error": "Value must be between {{ start }} and {{ end }}.",
"outgoing": "Outgoing",
"overview": "Overview",
"oxygen_information": "Oxygen Information",
"packages": "Packages",
Expand Down Expand Up @@ -1729,6 +1733,14 @@
"resource_request_details_description": "Provide detailed information about what resource is needed and why.",
"resource_requests": "Requests",
"resource_status": "Request Status",
"resource_status__approved": "Approved",
"resource_status__cancelled": "Cancelled",
"resource_status__completed": "Completed",
"resource_status__pending": "Pending",
"resource_status__rejected": "Rejected",
"resource_status__transfer_in_progress": "Transfer in progress",
"resource_status__transportation_to_be_arranged": "Transportation to be arranged",
"resource_title": "Resource Title",
"resource_type": "Request Type",
"result": "Result",
"result_date": "Result Date",
Expand Down Expand Up @@ -1799,6 +1811,7 @@
"search_by_patient_name": "Search by Patient Name",
"search_by_patient_no": "Search by Patient Number",
"search_by_phone_number": "Search by Phone Number",
"search_by_resource_title": "Search by resource title",
"search_by_username": "Search by username",
"search_country": "Search country...",
"search_encounters": "Search Encounters",
Expand Down Expand Up @@ -1993,6 +2006,7 @@
"third_party_software_licenses": "Third Party Software Licenses",
"time": "Time",
"time_slot": "Time Slot",
"title": "Title",
"title_of_request": "Title of Request",
"titrate_dosage": "Titrate Dosage",
"to": "to",
Expand All @@ -2011,7 +2025,6 @@
"total_users": "Total Users",
"transfer_allowed": "Transfer Allowed",
"transfer_blocked": "Transfer Blocked",
"transfer_in_progress": "TRANSFER IN PROGRESS",
"transfer_status_updated": "Transfer Status Updated",
"transfer_to_receiving_facility": "Transfer to receiving facility",
"travel_within_last_28_days": "Domestic/international Travel (within last 28 days)",
Expand Down
1 change: 0 additions & 1 deletion public/locale/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,6 @@
"to_be_conducted": "संचालित किया जाना है",
"total_beds": "कुल बिस्तर",
"total_users": "कुल उपयोगकर्ता",
"transfer_in_progress": "स्थानांतरण प्रगति पर है",
"transfer_to_receiving_facility": "प्राप्ति सुविधा में स्थानांतरण",
"travel_within_last_28_days": "घरेलू/अंतर्राष्ट्रीय यात्रा (पिछले 28 दिनों के भीतर)",
"treating_doctor": "इलाज करने वाला डॉक्टर",
Expand Down
1 change: 0 additions & 1 deletion public/locale/kn.json
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,6 @@
"to_be_conducted": "ನಡೆಸಲಾಗುವುದು",
"total_beds": "ಒಟ್ಟು ಹಾಸಿಗೆಗಳು",
"total_users": "ಒಟ್ಟು ಬಳಕೆದಾರರು",
"transfer_in_progress": "ವರ್ಗಾವಣೆ ಪ್ರಗತಿಯಲ್ಲಿದೆ",
"transfer_to_receiving_facility": "ಸ್ವೀಕರಿಸುವ ಸೌಲಭ್ಯಕ್ಕೆ ವರ್ಗಾಯಿಸಿ",
"travel_within_last_28_days": "ದೇಶೀಯ/ಅಂತರರಾಷ್ಟ್ರೀಯ ಪ್ರಯಾಣ (ಕಳೆದ 28 ದಿನಗಳಲ್ಲಿ)",
"treating_doctor": "ಚಿಕಿತ್ಸೆ ನೀಡುತ್ತಿರುವ ವೈದ್ಯರು",
Expand Down
1 change: 0 additions & 1 deletion public/locale/ml.json
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,6 @@
"transcript_information": "ഇതാണ് നമ്മൾ കേട്ടത്",
"transfer_allowed": "കൈമാറ്റം അനുവദിച്ചു",
"transfer_blocked": "കൈമാറ്റം തടഞ്ഞു",
"transfer_in_progress": "കൈമാറ്റം പുരോഗമിക്കുന്നു",
"transfer_status_updated": "ട്രാൻസ്ഫർ സ്റ്റാറ്റസ് അപ്ഡേറ്റ് ചെയ്തു",
"transfer_to_receiving_facility": "സ്വീകരിക്കാനുള്ള സൗകര്യത്തിലേക്ക് ട്രാൻസ്ഫർ ചെയ്യുക",
"travel_within_last_28_days": "ആഭ്യന്തര/അന്താരാഷ്ട്ര യാത്ര (കഴിഞ്ഞ 28 ദിവസത്തിനുള്ളിൽ)",
Expand Down
1 change: 0 additions & 1 deletion public/locale/ta.json
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,6 @@
"to_be_conducted": "நடத்தப்பட வேண்டும்",
"total_beds": "மொத்த படுக்கைகள்",
"total_users": "மொத்த பயனர்கள்",
"transfer_in_progress": "இடமாற்றம் நடைபெறுகிறது",
"transfer_to_receiving_facility": "பெறும் வசதிக்கு இடமாற்றம்",
"travel_within_last_28_days": "உள்நாட்டு/சர்வதேச பயணம் (கடந்த 28 நாட்களுக்குள்)",
"treating_doctor": "சிகிச்சை அளிக்கும் மருத்துவர்",
Expand Down
16 changes: 10 additions & 6 deletions src/Routers/routes/ResourceRoutes.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import View from "@/components/Common/View";
import BoardView from "@/components/Resource/ResourceBoard";
import ResourceDetails from "@/components/Resource/ResourceDetails";
import { ResourceDetailsUpdate } from "@/components/Resource/ResourceDetailsUpdate";
import ListView from "@/components/Resource/ResourceList";
import ResourceList from "@/components/Resource/ResourceList";

import { AppRoutes } from "@/Routers/AppRouter";

const ResourceRoutes: AppRoutes = {
"/resource": () => <View name="resource" board={BoardView} list={ListView} />,
"/resource/:id": ({ id }) => <ResourceDetails id={id} />,
"/resource/:id/update": ({ id }) => <ResourceDetailsUpdate id={id} />,
"/facility/:facilityId/resource": ({ facilityId }) => (
<ResourceList facilityId={facilityId} />
),
"/facility/:facilityId/resource/:id": ({ facilityId, id }) => (
<ResourceDetails facilityId={facilityId} id={id} />
),
"/facility/:facilityId/resource/:id/update": ({ facilityId, id }) => (
<ResourceDetailsUpdate facilityId={facilityId} id={id} />
),
};

export default ResourceRoutes;
19 changes: 9 additions & 10 deletions src/common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,15 @@ export const RESOURCE_CATEGORY_CHOICES = [
{ id: "FINANCIAL", text: "Financial" },
{ id: "OTHERS", text: "Other" },
];

export const RESOURCE_CHOICES: Array<OptionsType> = [
{ id: 10, text: "PENDING" },
{ id: 15, text: "ON HOLD" },
{ id: 20, text: "APPROVED" },
{ id: 30, text: "REJECTED" },
{ id: 55, text: "TRANSPORTATION TO BE ARRANGED" },
{ id: 70, text: "TRANSFER IN PROGRESS" },
{ id: 80, text: "COMPLETED" },
];
export const RESOURCE_STATUS_CHOICES = [
{ icon: "l-clock", text: "pending" },
{ icon: "l-check", text: "approved" },
{ icon: "l-ban", text: "rejected" },
{ icon: "l-file-slash", text: "cancelled" },
{ icon: "l-truck", text: "transportation_to_be_arranged" },
{ icon: "l-spinner", text: "transfer_in_progress" },
{ icon: "l-check-circle", text: "completed" },
] as const;
Comment on lines +165 to +173
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Inconsistent status value casing found in resource components

The new RESOURCE_STATUS_CHOICES uses lowercase values, but some components still use uppercase status values. This inconsistency should be fixed in:

  • src/components/Resource/ResourceCreate.tsx: Uses "PENDING"
  • src/components/Resource/PrintResourceLetter.tsx: Uses "PENDING" and "REJECTED"
🔗 Analysis chain

LGTM! The new resource status choices are well-structured.

The changes improve the code in several ways:

  • Added icons for better visual representation in the UI
  • Uses lowercase values for consistency
  • Marked with as const for better type safety
  • Clear status workflow from pending to completed

Let's verify the usage of these new status choices:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new resource status choices and check for any remaining references to the old constant.

# Test 1: Search for any remaining references to the old constant
echo "Checking for any remaining references to RESOURCE_CHOICES..."
rg "RESOURCE_CHOICES" -A 5

# Test 2: Search for components using the new constant
echo "Checking components using RESOURCE_STATUS_CHOICES..."
rg "RESOURCE_STATUS_CHOICES" -A 5

# Test 3: Search for any hardcoded status values that should use the constant
echo "Checking for hardcoded status values..."
rg -i "status.*['\"](?:pending|approved|rejected|cancelled|completed)['\"]" --type ts --type tsx

Length of output: 3463


Script:

#!/bin/bash
# Description: Check for hardcoded status values with correct file type specification

# Search for hardcoded status values in TypeScript and TSX files
echo "Checking for hardcoded status values..."
rg -t typescript -t tsx -i "status.*['\"](?:pending|approved|rejected|cancelled|completed)['\"]"

# Also check for transportation and transfer status values
echo "Checking for transportation status values..."
rg -t typescript -t tsx -i "status.*['\"](?:transportation_to_be_arranged|transfer_in_progress)['\"]"

Length of output: 468


Script:

#!/bin/bash
# Description: Check for hardcoded status values with correct ripgrep file types

# Search in .ts files
echo "Checking .ts files for hardcoded status values..."
rg --type-add 'ts:*.ts' -t ts -i "status.*['\"](?:pending|approved|rejected|cancelled|completed|transportation_to_be_arranged|transfer_in_progress)['\"]"

# Search in .tsx files
echo "Checking .tsx files for hardcoded status values..."
rg --type-add 'tsx:*.tsx' -t tsx -i "status.*['\"](?:pending|approved|rejected|cancelled|completed|transportation_to_be_arranged|transfer_in_progress)['\"]"

Length of output: 2830


export const RESOURCE_FILTER_ORDER: Array<OptionsType> = [
{ id: 1, text: "created_date", desc: "ASC Created Date" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ export const ResourceRequests = (props: PatientProps) => {
<Button
variant="outline"
size="sm"
onClick={() => navigate(`/resource/${request.id}`)}
onClick={() =>
navigate(
`/facility/${request.origin_facility.id}/resource/${request.id}`,
)
}
>
<CareIcon icon="l-eye" className="mr-2" />
{t("view")}
Expand Down
66 changes: 0 additions & 66 deletions src/components/Resource/ResourceBadges.tsx

This file was deleted.

97 changes: 0 additions & 97 deletions src/components/Resource/ResourceBlock.tsx

This file was deleted.

Loading
Loading