Skip to content

Commit

Permalink
Merge branch 'develop' into issue/10158/patient-user-card-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rajku-dev authored Feb 1, 2025
2 parents 710b57f + 66104a8 commit 835bae6
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 22 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

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

6 changes: 6 additions & 0 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,7 @@
"enter_phone_number_to_login_register": "Enter phone number to login/register",
"enter_tag_name": "Enter tag name",
"enter_tag_slug": "Enter tag slug",
"enter_the_file_name": "Enter the file name",
"enter_the_verification_code": "Enter the verification code sent to your phone",
"enter_valid_age": "Please Enter Valid Age",
"enter_valid_dob": "Enter a valid date of birth",
Expand Down Expand Up @@ -1557,7 +1558,9 @@
"please_assign_bed_to_patient": "Please assign a bed to this patient",
"please_check_your_messages": "Please check your messages",
"please_confirm_password": "Please confirm your new password.",
"please_enter_a_name": "Please enter a name!",
"please_enter_a_reason_for_the_shift": "Please enter a reason for the shift.",
"please_enter_a_valid_reason": "Please enter a valid reason!",
"please_enter_confirm_password": "Please confirm your new password",
"please_enter_correct_birth_year": "Please enter the correct birth year to verify the patient details.",
"please_enter_current_password": "Please enter your current password.",
Expand Down Expand Up @@ -1696,6 +1699,7 @@
"remove_user_organization": "Remove User from Organization",
"remove_user_warn": "Are you sure you want to remove {{firstName}} {{lastName}} from this organization? This action cannot be undone.",
"rename": "Rename",
"rename_file": "Rename File",
"replace_home_facility": "Replace Home Facility",
"replace_home_facility_confirm": "Are you sure you want to replace",
"replace_home_facility_confirm_as": "as home facility for user",
Expand Down Expand Up @@ -2014,6 +2018,8 @@
"thank_you_for_choosing": "Thank you for choosing our care service",
"the_request_for_resources_placed_by_yourself_is": "The request for resource (details below) placed by yourself is",
"third_party_software_licenses": "Third Party Software Licenses",
"this_action_is_irreversible": "This action is irreversible. Once a file is archived it cannot be unarchived.",
"this_file_has_been_archived": "This file has been archived and cannot be unarchived.",
"time": "Time",
"time_slot": "Time Slot",
"title": "Title",
Expand Down
13 changes: 8 additions & 5 deletions src/components/Files/FileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import { useTranslation } from "react-i18next";
import CareIcon, { IconName } from "@/CAREUI/icons/CareIcon";

import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";

import Pagination from "@/components/Common/Pagination";
import Tabs from "@/components/Common/Tabs";
import FileBlock from "@/components/Files/FileBlock";
import TextFormField from "@/components/Form/FormFields/TextFormField";
import { FileUploadModel } from "@/components/Patient/models";

import useAuthUser from "@/hooks/useAuthUser";
Expand Down Expand Up @@ -276,17 +277,19 @@ export const FileUpload = (props: FileUploadProps) => {
<CareIcon icon="l-times" />
</button>
</div>
<TextFormField
<Label>{t("enter_file_name")}</Label>
<Input
name="consultation_file"
type="text"
label={t("enter_file_name")}
id="upload-file-name"
required
value={fileUpload.fileNames[0] || ""}
disabled={fileUpload.uploading}
onChange={(e) => fileUpload.setFileName(e.value)}
error={fileUpload.error || undefined}
onChange={(e) => fileUpload.setFileName(e.target.value)}
/>
{fileUpload.error && (
<p className="text-red-500 text-sm mt-1">{fileUpload.error}</p>
)}
<div className="flex items-center gap-2">
<Button
variant="outline_primary"
Expand Down
24 changes: 13 additions & 11 deletions src/hooks/useFileManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { cn } from "@/lib/utils";
import CareIcon from "@/CAREUI/icons/CareIcon";

import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";

import DialogModal from "@/components/Common/Dialog";
import FilePreviewDialog from "@/components/Common/FilePreviewDialog";
import { StateInterface } from "@/components/Files/FileUpload";
import TextFormField from "@/components/Form/FormFields/TextFormField";
import { FileUploadModel } from "@/components/Patient/models";

import {
Expand Down Expand Up @@ -135,7 +135,7 @@ export default function useFileManager(

const validateArchiveReason = (name: any) => {
if (name.trim() === "") {
setArchiveReasonError("Please enter a valid reason!");
setArchiveReasonError(t("please_enter_a_valid_reason"));
return false;
} else {
setArchiveReasonError("");
Expand Down Expand Up @@ -204,7 +204,7 @@ export default function useFileManager(

const validateEditFileName = (name: string) => {
if (name.trim() === "") {
setEditError("Please enter a name!");
setEditError(t("please_enter_a_name"));
return false;
} else {
setEditError("");
Expand Down Expand Up @@ -278,8 +278,7 @@ export default function useFileManager(
<div className="text-sm">
<h1 className="text-xl text-black">Archive File</h1>
<span className="text-sm text-secondary-600">
This action is irreversible. Once a file is archived it cannot
be unarchived.
{t("this_action_is_irreversible")}
</span>
</div>
</div>
Expand Down Expand Up @@ -348,7 +347,7 @@ export default function useFileManager(
>
<div className="mb-8 text-xs text-secondary-700">
<CareIcon icon="l-archive" className="mr-2" />
This file has been archived and cannot be unarchived.
{t("this_file_has_been_archived")}
</div>
<div className="flex flex-col gap-4 md:grid md:grid-cols-2">
{[
Expand Down Expand Up @@ -425,7 +424,7 @@ export default function useFileManager(
/>
</div>
<div className="m-4">
<h1 className="text-xl text-black">Rename File</h1>
<h1 className="text-xl text-black">{t("rename_file")}</h1>
</div>
</div>
}
Expand All @@ -440,16 +439,19 @@ export default function useFileManager(
className="flex w-full flex-col"
>
<div>
<TextFormField
<Label>{t("enter_the_file_name")}</Label>
<Input
name="editFileName"
id="edit-file-name"
label="Enter the file name"
value={editDialogueOpen?.name}
onChange={(e) => {
setEditDialogueOpen({ ...editDialogueOpen, name: e.value });
setEditDialogueOpen({
...editDialogueOpen,
name: e.target.value,
});
}}
error={editError}
/>
{editError && <p className="text-sm text-red-500">{editError}</p>}
</div>
<div className="mt-4 flex flex-col-reverse justify-end gap-2 md:flex-row">
<Button
Expand Down

0 comments on commit 835bae6

Please sign in to comment.