Skip to content

Commit

Permalink
Merge branch 'develop' into issue/10046/modal-overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rajku-dev authored Jan 22, 2025
2 parents 3b632d6 + 6eea7f5 commit 60c0ca0
Show file tree
Hide file tree
Showing 46 changed files with 1,185 additions and 958 deletions.
6 changes: 3 additions & 3 deletions cypress/e2e/facility_spec/facility_creation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FacilityCreation } from "../../pageObject/facility/FacilityCreation";
import { generatePhoneNumber } from "../../utils/commonUtils";
import { generateFacilityData } from "../../utils/facilityData";
import { FacilityCreation } from "@/cypress/pageObject/facility/FacilityCreation";
import { generatePhoneNumber } from "@/cypress/utils/commonUtils";
import { generateFacilityData } from "@/cypress/utils/facilityData";

const LOCATION_HIERARCHY = {
localBody: "Aluva",
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/patient_spec/patient_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
generateAddress,
generateName,
generatePhoneNumber,
} from "../../utils/commonUtils";
} from "@/cypress/utils/commonUtils";

const facilityCreation = new FacilityCreation();
const ENCOUNTER_TYPE = "Observation";
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/users_spec/user_creation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { UserCreation } from "../../pageObject/Users/UserCreation";
import { FacilityCreation } from "../../pageObject/facility/FacilityCreation";
import { UserCreation } from "pageObject/Users/UserCreation";
import { FacilityCreation } from "pageObject/facility/FacilityCreation";
import {
generateName,
generatePhoneNumber,
generateUsername,
} from "../../utils/commonUtils";
} from "utils/commonUtils";

describe("User Creation", () => {
const facilityCreation = new FacilityCreation();
Expand All @@ -30,8 +30,8 @@ describe("User Creation", () => {
confirmPassword: defaultPassword,
email: `${generateUsername(firstName)}@test.com`,
phoneNumber: generatePhoneNumber(),
dateOfBirth: "1990-01-01",
userType: "Doctor",
gender: "Male",
state: "Kerala",
district: "Ernakulam",
localBody: "Aluva",
Expand Down
15 changes: 7 additions & 8 deletions cypress/pageObject/Users/UserCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ export interface UserData {
password?: string;
email?: string;
phoneNumber?: string;
dateOfBirth?: string;
userType?: string;
state?: string;
district?: string;
localBody?: string;
ward?: string;
gender?: string;
}

export class UserCreation {
Expand Down Expand Up @@ -78,17 +78,11 @@ export class UserCreation {
label: "Alternate Phone Number",
message: "Phone number must start with +91 followed by 10 digits",
},
{ label: "Date of Birth", message: "Required" },
{ label: "State", message: "Required" },
]);
return this;
}

fillDateOfBirth(dateOfBirth: string) {
cy.typeIntoField('[data-cy="dob-input"]', dateOfBirth);
return this;
}

selectUserType(userType: string) {
cy.clickAndSelectOption('[data-cy="user-type-select"]', userType);
return this;
Expand All @@ -114,6 +108,11 @@ export class UserCreation {
return this;
}

selectGender(gender: string) {
cy.clickAndSelectOption('[data-cy="gender-select"]', gender);
return this;
}

fillUserDetails(userData: UserData & { confirmPassword?: string }) {
if (userData.userType) this.selectUserType(userData.userType);
if (userData.firstName) this.fillFirstName(userData.firstName);
Expand All @@ -125,7 +124,7 @@ export class UserCreation {
}
if (userData.email) this.fillEmail(userData.email);
if (userData.phoneNumber) this.fillPhoneNumber(userData.phoneNumber);
if (userData.dateOfBirth) this.fillDateOfBirth(userData.dateOfBirth);
if (userData.gender) this.selectGender(userData.gender);
if (userData.state) this.selectState(userData.state);
if (userData.district) this.selectDistrict(userData.district);
if (userData.localBody) this.selectLocalBody(userData.localBody);
Expand Down
10 changes: 10 additions & 0 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@
"add_skill": "Add Skill",
"add_spoke": "Add Spoke Facility",
"add_tags": "Add Tags",
"add_user": "Add User",
"additional_information": "Additional Information",
"additional_instructions": "Additional Instructions",
"address": "Address",
Expand Down Expand Up @@ -380,6 +381,7 @@
"all_patients": "All Patients",
"allergen": "Allergen",
"allergies": "Allergies",
"allergies_empty_message": "No allergies recorded",
"allow_transfer": "Allow Transfer",
"allowed_formats_are": "Allowed formats are {{formats}}.",
"already_a_member": "Already a member?",
Expand Down Expand Up @@ -454,6 +456,7 @@
"audit_log": "Audit Log",
"auth_login_title": "Authorized Login",
"auth_method_unsupported": "This authentication method is not supported, please try a different method",
"authored_on": "Authored On",
"authorize_shift_delete": "Authorize shift delete",
"auto_generated_for_care": "Auto Generated for Care",
"autofilled_fields": "Autofilled Fields",
Expand Down Expand Up @@ -702,6 +705,7 @@
"create_tag": "Create Tag",
"create_template": "Create Template",
"create_user": "Create User",
"create_user_and_add_to_org": "Create a new user and add them to the organization.",
"created": "Created",
"created_by": "Created By",
"created_date": "Created Date",
Expand Down Expand Up @@ -764,6 +768,7 @@
"diagnosis__unconfirmed": "Unconfirmed",
"diagnosis_already_added": "This diagnosis was already added",
"diagnosis_at_discharge": "Diagnosis at Discharge",
"diagnosis_empty_message": "No diagnoses recorded",
"diastolic": "Diastolic",
"didnt_receive_a_message": "Didn't receive a message?",
"diet_preference": "Diet Preference",
Expand Down Expand Up @@ -831,6 +836,7 @@
"edit_profile": "Edit Profile",
"edit_role": "Edit Role",
"edit_schedule_template": "Edit Schedule Template",
"edit_user": "Edit User",
"edit_user_profile": "Edit Profile",
"edit_user_role": "Edit User Role",
"edited_by": "Edited by",
Expand Down Expand Up @@ -1767,6 +1773,7 @@
"required_quantity": "Required Quantity",
"reschedule": "Reschedule",
"reschedule_appointment": "Reschedule Appointment",
"reschedule_appointment_with": "Reschedule Appointment with",
"rescheduled": "Rescheduled",
"rescheduling": "Rescheduling...",
"resend_otp": "Resend OTP",
Expand Down Expand Up @@ -2020,6 +2027,7 @@
"switch_bed": "Switch Bed",
"switch_camera_is_not_available": "Switch camera is not available.",
"symptoms": "Symptoms",
"symptoms_empty_message": "No symptoms recorded",
"systolic": "Systolic",
"tachycardia": "Tachycardia",
"tag_name": "Tag Name",
Expand Down Expand Up @@ -2140,6 +2148,7 @@
"update_shift_request": "Update Shift Request",
"update_status": "Update Status",
"update_status_details": "Update Status/Details",
"update_user": "Update User",
"update_user_role_organization": "Update the role for this user in the organization",
"update_volunteer": "Reassign Volunteer",
"updated": "Updated",
Expand Down Expand Up @@ -2177,6 +2186,7 @@
"user_removed_success": "User removed from organization successfully",
"user_role_update_success": "User role updated successfully",
"user_type": "User Type",
"user_updated_successfully": "User updated successfully",
"username": "Username",
"username_already_exists": "This username already exists",
"username_available": "Username is available",
Expand Down
15 changes: 15 additions & 0 deletions src/Routers/PatientRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@ const AppointmentRoutes = {
facilityId: string;
staffId: string;
}) => <ScheduleAppointment facilityId={facilityId} staffId={staffId} />,
"/facility/:facilityId/appointments/:staffId/reschedule/:appointmentId": ({
facilityId,
staffId,
appointmentId,
}: {
facilityId: string;
staffId: string;
appointmentId: string;
}) => (
<ScheduleAppointment
facilityId={facilityId}
staffId={staffId}
appointmentId={appointmentId}
/>
),
"/facility/:facilityId/appointments/:staffId/patient-select": ({
facilityId,
staffId,
Expand Down
4 changes: 4 additions & 0 deletions src/common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ export const GENDER_TYPES = [
{ id: "non_binary", text: "Non Binary", icon: "TRANS" },
] as const;

export const GENDERS = GENDER_TYPES.map((gender) => gender.id) as [
(typeof GENDER_TYPES)[number]["id"],
];

export const CONSULTATION_SUGGESTION = [
{ id: "HI", text: "Home Isolation", deprecated: true }, // # Deprecated. Preserving option for backward compatibility (use only for readonly operations)
{ id: "A", text: "Admission" },
Expand Down
111 changes: 111 additions & 0 deletions src/components/Common/SkeletonLoading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import { Card, CardContent } from "@/components/ui/card";
import { Skeleton } from "@/components/ui/skeleton";

export const TableSkeleton = ({ count }: { count: number }) => (
<div className="overflow-x-auto rounded-lg border border-gray-200">
<table className="relative min-w-full divide-y divide-gray-200">
{/* Header Skeleton */}
<thead>
<tr>
<th className="sticky top-0 z-10 bg-gray-100 px-4 py-3 text-left text-sm font-medium text-gray-600">
<Skeleton className="h-4 w-24" />
</th>
<th className="bg-gray-100 px-6 py-3 text-left text-sm font-medium text-gray-600">
<Skeleton className="h-4 w-16" />
</th>
<th className="bg-gray-100 px-10 py-3 text-left text-sm font-medium text-gray-600">
<Skeleton className="h-4 w-20" />
</th>
<th className="bg-gray-100 px-4 py-3 text-left text-sm font-medium text-gray-600">
<Skeleton className="h-4 w-24" />
</th>
<th className="bg-gray-100 px-4 py-3 text-left text-sm font-medium text-gray-600">
<Skeleton className="h-4 w-20" />
</th>
</tr>
</thead>
{/* Body Skeleton */}
<tbody className="divide-y divide-gray-200 bg-white animate-pulse">
{Array.from({ length: count }).map((_, i) => (
<tr key={i} className="hover:bg-gray-50">
<td className="sticky left-0 z-10 bg-white px-4 py-4 lg:pr-20">
<div className="flex items-center gap-3">
<Skeleton className="h-10 w-10 rounded-full" />
<div className="flex flex-col">
<Skeleton className="h-4 w-32 mb-1" />
<Skeleton className="h-3 w-20" />
</div>
</div>
</td>
<td className="flex-0 px-6 py-4">
<Skeleton className="h-4 w-16" />
</td>
<td className="px-10 py-4 text-sm">
<Skeleton className="h-4 w-20" />
</td>
<td className="px-4 py-4 text-sm whitespace-nowrap">
<Skeleton className="h-4 w-24" />
</td>
<td className="px-4 py-4">
<Skeleton className="h-8 w-20 rounded-md" />
</td>
</tr>
))}
</tbody>
</table>
</div>
);

export const CardListSkeleton = ({ count }: { count: number }) =>
Array.from({ length: count }, (_, index) => (
<div key={index}>
<div className="p-4 rounded-lg bg-gray-100 animate-pulse">
<div className="flex items-start gap-3">
<div className="w-8 h-8 rounded-full bg-gray-200" />
<div className="flex-1 space-y-2">
<Skeleton className="h-4 w-24" />
<Skeleton className="h-4 w-3/4" />
</div>
</div>
</div>
</div>
));

export const CardGridSkeleton = ({ count }: { count: number }) =>
Array.from({ length: count }, (_, index) => (
<div key={index} className="skeleton-item animate-pulse">
<Card className="h-full">
<CardContent className="p-4 sm:p-6">
<div className="flex flex-col h-full gap-4">
<div className="flex gap-4">
<Skeleton className="h-12 w-12 sm:h-16 sm:w-16 rounded-full flex-shrink-0" />
<div className="flex flex-col min-w-0 flex-1">
<div className="flex flex-col gap-1">
<Skeleton className="h-5 w-32 mb-1" />
<div className="flex items-center gap-2 flex-wrap">
<Skeleton className="h-4 w-20" />
<Skeleton className="h-4 w-16" />
</div>
</div>
</div>
</div>

<div className="grid grid-cols-2 gap-4 text-sm">
<div>
<Skeleton className="h-4 w-16 mb-1" />
<Skeleton className="h-4 w-24" />
</div>
<div>
<Skeleton className="h-4 w-24 mb-1" />
<Skeleton className="h-4 w-16" />
</div>
</div>

<div className="mt-auto pt-2">
<Skeleton className="h-8 w-full rounded-md" />
</div>
</div>
</CardContent>
</Card>
</div>
));
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import PaginatedList from "@/CAREUI/misc/PaginatedList";

import { Card } from "@/components/ui/card";

import { CardListSkeleton } from "@/components/Common/SkeletonLoading";

import routes from "@/Utils/request/api";
import { formatDateTime, properCase } from "@/Utils/utils";
import { Encounter } from "@/types/emr/encounter";
Expand Down Expand Up @@ -147,22 +149,8 @@ export default function QuestionnaireResponsesList({ encounter }: Props) {
</PaginatedList.WhenEmpty>

<PaginatedList.WhenLoading>
<div className="grid gap-4">
{[1, 2, 3].map((i) => (
<Card
key={i}
className="flex items-center justify-between p-4"
>
<div className="flex items-start gap-4">
<div className="h-5 w-5 animate-pulse rounded-full bg-muted" />
<div className="space-y-2">
<div className="h-4 w-48 animate-pulse rounded bg-muted" />
<div className="h-3 w-32 animate-pulse rounded bg-muted" />
<div className="h-3 w-40 animate-pulse rounded bg-muted" />
</div>
</div>
</Card>
))}
<div className="grid gap-5">
<CardListSkeleton count={3} />
</div>
</PaginatedList.WhenLoading>

Expand Down
Loading

0 comments on commit 60c0ca0

Please sign in to comment.