From 4fb39ab9fa934eeef81af79bcd9ba720dc1b8045 Mon Sep 17 00:00:00 2001 From: TuanVT Date: Mon, 8 Jun 2026 11:24:57 +0700 Subject: [PATCH] feat: Update glasses --- .../DetailConsultation/DetailConsultation.tsx | 256 ++++++++++++------ .../MainPageConsultation.tsx | 2 +- .../UpdateSpecialtyClinicId.tsx | 64 ++++- .../MainPageStatistical.tsx | 22 +- src/services/consultationServices.ts | 3 + 5 files changed, 245 insertions(+), 102 deletions(-) diff --git a/src/components/page/consultation/DetailConsultation/DetailConsultation.tsx b/src/components/page/consultation/DetailConsultation/DetailConsultation.tsx index 964c1b5..dc1a5b1 100644 --- a/src/components/page/consultation/DetailConsultation/DetailConsultation.tsx +++ b/src/components/page/consultation/DetailConsultation/DetailConsultation.tsx @@ -22,6 +22,12 @@ import DataWrapper from "@/components/customs/DataWrapper"; import Table from "@/components/customs/custom-table"; import CustomButton from "@/components/customs/custom-button"; import Pagination from "@/components/customs/custom-pagination"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@radix-ui/react-tooltip"; const DetailConsultation = () => { const params = useParams(); @@ -178,7 +184,7 @@ const DetailConsultation = () => { {/* ID PHIÊN KHÁM */} -
+ {/*

ID PHIÊN KHÁM

@@ -186,7 +192,7 @@ const DetailConsultation = () => {

{consultation.id}

-
+
*/} {/* MÃ PHIÊN KHÁM */}
@@ -330,53 +336,85 @@ const DetailConsultation = () => {

FILE UPLOAD

- {consultation.generalAttachmentUrls?.length > 0 ? ( -
    - {consultation.generalAttachmentUrls.map((item, index) => { - const file = getFileInfo(item, index); + + + +
    + 📎 + Chi tiết các file +
    +
    - const extension = - file.fileName.split(".").pop()?.toLowerCase() || ""; + +
    +

    + Danh sách file đính kèm +

    - const isImage = [ - "jpg", - "jpeg", - "png", - "gif", - "webp", - "bmp", - "svg", - ].includes(extension); +
    + {consultation.generalAttachmentUrls.map( + (item, index) => { + const file = getFileInfo(item, index); - return ( -
  • - {isImage ? ( - - 🖼️ {file.fileName} - - ) : ( - - 📄 {file.fileName} - - )} -
  • - ); - })} -
+ const extension = + file.fileName + .split(".") + .pop() + ?.toLowerCase() || ""; + + const isImage = [ + "jpg", + "jpeg", + "png", + "gif", + "webp", + "bmp", + "svg", + ].includes(extension); + + return ( + +
+ + {isImage ? "🖼️" : "📄"} + + +
+

+ {file.fileName} +

+ +

+ {extension || "FILE"} +

+
+
+ + + Mở + +
+ ); + }, + )} +
+ + + + ) : ( -

- Không có file nào được tải lên. -

+
Không có file nào được tải lên
)} @@ -408,7 +446,7 @@ const DetailConsultation = () => { }, { state: TYPE_STATUS.PendingPrescription, - text: "Chờ nhận thuốc/kính", + text: "Chờ nhận thuốc", textColor: "#9A3412", backgroundColor: "#FED7AA", }, @@ -560,54 +598,86 @@ const DetailConsultation = () => {
-

+

FILE UPLOAD

- {selectedSpecialty.attachmentUrls?.length > 0 ? ( -
    - {selectedSpecialty.attachmentUrls.map((item, index) => { - const file = getFileInfo(item, index); + + + +
    + 📎 + Chi tiết các file +
    +
    - const extension = - file.fileName.split(".").pop()?.toLowerCase() || ""; + +
    +

    + Danh sách file đính kèm +

    - const isImage = [ - "jpg", - "jpeg", - "png", - "gif", - "webp", - "bmp", - "svg", - ].includes(extension); +
    + {selectedSpecialty.attachmentUrls.map( + (item, index) => { + const file = getFileInfo(item, index); - return ( -
  • - {isImage ? ( - - 🖼️ {file.fileName} - - ) : ( - - 📄 {file.fileName} - - )} -
  • - ); - })} -
+ const extension = + file.fileName.split(".").pop()?.toLowerCase() || + ""; + + const isImage = [ + "jpg", + "jpeg", + "png", + "gif", + "webp", + "bmp", + "svg", + ].includes(extension); + + return ( + +
+ + {isImage ? "🖼️" : "📄"} + + +
+

+ {file.fileName} +

+ +

+ {extension || "FILE"} +

+
+
+ + + Mở + +
+ ); + }, + )} +
+ + + + ) : ( -

Không có file nào được tải lên.

+
Không có file nào được tải lên
)} @@ -624,6 +694,20 @@ const DetailConsultation = () => {

{selectedSpecialty.glassType || "---"}

+ +
+

ĐÃ PHÁT KÍNH CHƯA

+ + {selectedSpecialty.isGlassesDelivered ? ( +

+ Đã phát kính +

+ ) : ( +

+ Chưa phát kính +

+ )} +
)}
diff --git a/src/components/page/consultation/MainPageConsultation/MainPageConsultation.tsx b/src/components/page/consultation/MainPageConsultation/MainPageConsultation.tsx index 7f8b975..36cf89f 100644 --- a/src/components/page/consultation/MainPageConsultation/MainPageConsultation.tsx +++ b/src/components/page/consultation/MainPageConsultation/MainPageConsultation.tsx @@ -542,7 +542,7 @@ const MainPageConsultation = () => { }, { state: TYPE_STATUS.PendingPrescription, - text: "Chờ nhận thuốc/kính", + text: "Chờ nhận thuốc", textColor: "#9A3412", backgroundColor: "#FED7AA", }, diff --git a/src/components/page/consultation/UpdateSpecialtyClinicId/UpdateSpecialtyClinicId.tsx b/src/components/page/consultation/UpdateSpecialtyClinicId/UpdateSpecialtyClinicId.tsx index 37ebbee..64c3981 100644 --- a/src/components/page/consultation/UpdateSpecialtyClinicId/UpdateSpecialtyClinicId.tsx +++ b/src/components/page/consultation/UpdateSpecialtyClinicId/UpdateSpecialtyClinicId.tsx @@ -36,6 +36,7 @@ const UpdateSpecialtyClinicId = () => { procedureNotes: string; glassRequired: boolean; glassType: string; + isGlassesDelivered: boolean; fileUrls: string[]; }>({ specialtyAssignmentId: "", @@ -44,6 +45,7 @@ const UpdateSpecialtyClinicId = () => { procedureNotes: "", glassRequired: false, glassType: "", + isGlassesDelivered: false, fileUrls: [], }); @@ -113,6 +115,7 @@ const UpdateSpecialtyClinicId = () => { procedureNotes: specialtyClinic.procedureNotes || "", glassRequired: specialtyClinic.glassRequired || false, glassType: specialtyClinic.glassType || "", + isGlassesDelivered: specialtyClinic.isGlassesDelivered || false, fileUrls: specialtyClinic.attachmentUrls || [], }); setImages( @@ -145,6 +148,7 @@ const UpdateSpecialtyClinicId = () => { procedureNotes: form.procedureNotes, glassRequired: isEyeClinic ? form.glassRequired : false, glassType: isEyeClinic ? form.glassType : "", + isGlassesDelivered: isEyeClinic ? form.isGlassesDelivered : false, fileUrls: body.paths, }, ), @@ -360,16 +364,56 @@ const UpdateSpecialtyClinicId = () => { {form.glassRequired && ( -
-