feat/update-code
This commit is contained in:
@@ -4,6 +4,18 @@ import React from "react";
|
|||||||
import { GridColumnProps } from "./interface";
|
import { GridColumnProps } from "./interface";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
|
|
||||||
|
// Mapping số cột mong muốn trên Desktop (lg/xl) thành class responsive đầy đủ
|
||||||
|
const colResponsiveMap: Record<number, string> = {
|
||||||
|
1: "grid-cols-1",
|
||||||
|
2: "grid-cols-1 sm:grid-cols-2",
|
||||||
|
3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3",
|
||||||
|
4: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-4",
|
||||||
|
5: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-5",
|
||||||
|
6: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-6",
|
||||||
|
8: "grid-cols-2 sm:grid-cols-4 lg:grid-cols-8",
|
||||||
|
12: "grid-cols-3 sm:grid-cols-6 lg:grid-cols-12",
|
||||||
|
};
|
||||||
|
|
||||||
const GridColumn = ({
|
const GridColumn = ({
|
||||||
children,
|
children,
|
||||||
col = 3,
|
col = 3,
|
||||||
@@ -22,41 +34,19 @@ const GridColumn = ({
|
|||||||
/* ===== GAP ===== */
|
/* ===== GAP ===== */
|
||||||
sm ? "gap-2" : "gap-4",
|
sm ? "gap-2" : "gap-4",
|
||||||
|
|
||||||
/* ===== DEFAULT COL ===== */
|
/* ===== RESPONSIVE GRID BY COL ===== */
|
||||||
{
|
colResponsiveMap[col] || "grid-cols-1 md:grid-cols-2 lg:grid-cols-3",
|
||||||
"grid-cols-1": col === 1,
|
|
||||||
"grid-cols-2": col === 2,
|
|
||||||
"grid-cols-3": col === 3,
|
|
||||||
"grid-cols-4": col === 4,
|
|
||||||
"grid-cols-5": col === 5,
|
|
||||||
"grid-cols-6": col === 6,
|
|
||||||
"grid-cols-8": col === 8,
|
|
||||||
"grid-cols-12": col === 12,
|
|
||||||
},
|
|
||||||
|
|
||||||
/* ===== RESPONSIVE ===== */
|
/* ===== CUSTOM OVERRIDES ===== */
|
||||||
"xl:grid-cols-3", // giống default SCSS fallback
|
tabletCol3 && "md:grid-cols-3 lg:grid-cols-3",
|
||||||
"lg:grid-cols-2",
|
mobile2 && "grid-cols-2",
|
||||||
"md:grid-cols-2",
|
|
||||||
"sm:grid-cols-1",
|
|
||||||
|
|
||||||
/* ===== CUSTOM RULES ===== */
|
/* ===== SCROLL MODES ===== */
|
||||||
tabletCol3 && "lg:grid-cols-3",
|
|
||||||
|
|
||||||
mobile2 && "sm:grid-cols-2",
|
|
||||||
|
|
||||||
/* ===== COL 4 SPECIAL ===== */
|
|
||||||
col === 4 && clsx("xl:grid-cols-3", "lg:grid-cols-2", "sm:grid-cols-1"),
|
|
||||||
|
|
||||||
/* ===== COL 5 ===== */
|
|
||||||
col === 5 && clsx("xl:grid-cols-3", "lg:grid-cols-2", "sm:grid-cols-1"),
|
|
||||||
|
|
||||||
/* ===== SCROLL ===== */
|
|
||||||
scroll20 &&
|
scroll20 &&
|
||||||
"grid-flow-col auto-cols-[20%] overflow-x-auto snap-x snap-mandatory gap-2",
|
"grid-flow-col auto-cols-[20%] overflow-x-auto snap-x snap-mandatory gap-2",
|
||||||
|
|
||||||
scrollMobile85 &&
|
scrollMobile85 &&
|
||||||
"md:grid-cols-none md:grid-flow-col md:auto-cols-[85%] md:overflow-x-auto md:snap-x md:snap-mandatory",
|
"max-md:grid-cols-none max-md:grid-flow-col max-md:auto-cols-[85%] max-md:overflow-x-auto max-md:snap-x max-md:snap-mandatory",
|
||||||
|
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -86,14 +86,14 @@ export default function MainRegister() {
|
|||||||
label={
|
label={
|
||||||
<span>
|
<span>
|
||||||
Họ và tên
|
Họ và tên
|
||||||
<span className="text-red-500"> *</span>
|
{/* <span className="text-red-500"> *</span> */}
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
placeholder="Nhập họ và tên"
|
placeholder="Nhập họ và tên"
|
||||||
type="text"
|
type="text"
|
||||||
name="fullName"
|
name="fullName"
|
||||||
onClean
|
onClean
|
||||||
isRequired
|
// isRequired
|
||||||
isBlur
|
isBlur
|
||||||
showDone
|
showDone
|
||||||
icon={<BadgeInfo size={22} />}
|
icon={<BadgeInfo size={22} />}
|
||||||
@@ -105,14 +105,14 @@ export default function MainRegister() {
|
|||||||
label={
|
label={
|
||||||
<span>
|
<span>
|
||||||
Email
|
Email
|
||||||
<span className="text-red-500"> *</span>
|
{/* <span className="text-red-500"> *</span> */}
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
placeholder="Nhập email"
|
placeholder="Nhập email"
|
||||||
type="email"
|
type="email"
|
||||||
name="email"
|
name="email"
|
||||||
onClean
|
onClean
|
||||||
isRequired
|
// isRequired
|
||||||
isBlur
|
isBlur
|
||||||
showDone
|
showDone
|
||||||
icon={<Mail size={22} />}
|
icon={<Mail size={22} />}
|
||||||
|
|||||||
@@ -137,14 +137,14 @@ const CreateConsultation = () => {
|
|||||||
<FormCustom form={form} setForm={setForm} onSubmit={handleSubmit}>
|
<FormCustom form={form} setForm={setForm} onSubmit={handleSubmit}>
|
||||||
<div
|
<div
|
||||||
className="
|
className="
|
||||||
max-w-[95vw]
|
max-w-[95vw]
|
||||||
border
|
border
|
||||||
rounded-lg
|
rounded-lg
|
||||||
bg-white
|
bg-white
|
||||||
shadow-xl
|
shadow-xl
|
||||||
flex
|
flex
|
||||||
flex-col
|
flex-col
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div
|
<div
|
||||||
@@ -163,7 +163,7 @@ const CreateConsultation = () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* BODY */}
|
{/* BODY */}
|
||||||
<div className="flex-1 px-7 py-5">
|
<div className="flex-1 px-7 py-5">
|
||||||
<div className="space-y-5 mb-2">
|
<div className="space-y-5 mb-2">
|
||||||
<SelectForm
|
<SelectForm
|
||||||
label={
|
label={
|
||||||
|
|||||||
@@ -319,7 +319,8 @@ const UpdateConsultation = () => {
|
|||||||
setForm((prev) => ({ ...prev, vitalSigns: String(v) }))
|
setForm((prev) => ({ ...prev, vitalSigns: String(v) }))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
</GridColumn>
|
||||||
|
<GridColumn col={2}>
|
||||||
<InputForm
|
<InputForm
|
||||||
type="text"
|
type="text"
|
||||||
label={
|
label={
|
||||||
@@ -338,37 +339,36 @@ const UpdateConsultation = () => {
|
|||||||
|
|
||||||
<InputForm
|
<InputForm
|
||||||
type="text"
|
type="text"
|
||||||
label={
|
label={<span>Ghi chú bác sĩ</span>}
|
||||||
<span>
|
|
||||||
Kế hoạch điều trị <span className="text-red-500">*</span>
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
name="treatmentPlan"
|
|
||||||
placeholder="Nhập kế hoạch điều trị"
|
|
||||||
value={form.treatmentPlan}
|
|
||||||
isRequired
|
|
||||||
onChangeValue={(v) =>
|
|
||||||
setForm((prev) => ({ ...prev, treatmentPlan: String(v) }))
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<InputForm
|
|
||||||
type="text"
|
|
||||||
label={
|
|
||||||
<span>
|
|
||||||
Ghi chú bác sĩ <span className="text-red-500">*</span>
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
name="doctorNotes"
|
name="doctorNotes"
|
||||||
placeholder="Nhập ghi chú"
|
placeholder="Nhập ghi chú"
|
||||||
value={form.doctorNotes}
|
value={form.doctorNotes}
|
||||||
isRequired
|
|
||||||
onChangeValue={(v) =>
|
onChangeValue={(v) =>
|
||||||
setForm((prev) => ({ ...prev, doctorNotes: String(v) }))
|
setForm((prev) => ({ ...prev, doctorNotes: String(v) }))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</GridColumn>
|
</GridColumn>
|
||||||
|
<TextArea
|
||||||
|
name="treatmentPlan"
|
||||||
|
placeholder="Nhập thông số chi tiết loại kính được chỉ định"
|
||||||
|
label={
|
||||||
|
<span>
|
||||||
|
Kế hoạch điều trị
|
||||||
|
<span className="text-red-500">*</span>
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
value={form.treatmentPlan}
|
||||||
|
isRequired
|
||||||
|
// readOnly
|
||||||
|
isBlur
|
||||||
|
max={5000}
|
||||||
|
onChangeValue={(v) =>
|
||||||
|
setForm((prev) => ({
|
||||||
|
...prev,
|
||||||
|
treatmentPlan: String(v),
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
{eyeClinic && (
|
{eyeClinic && (
|
||||||
<div className="mt-2 rounded-xl border border-blue-100 bg-[#f8fafc] p-5 transition-all">
|
<div className="mt-2 rounded-xl border border-blue-100 bg-[#f8fafc] p-5 transition-all">
|
||||||
<h3 className="mb-4 text-sm font-bold uppercase tracking-wider text-blue-600">
|
<h3 className="mb-4 text-sm font-bold uppercase tracking-wider text-blue-600">
|
||||||
@@ -452,7 +452,6 @@ const UpdateConsultation = () => {
|
|||||||
!form.vitalSigns ||
|
!form.vitalSigns ||
|
||||||
!form.diagnosis ||
|
!form.diagnosis ||
|
||||||
!form.treatmentPlan ||
|
!form.treatmentPlan ||
|
||||||
!form.doctorNotes ||
|
|
||||||
updateConsultationMutation.isPending
|
updateConsultationMutation.isPending
|
||||||
}
|
}
|
||||||
className="min-w-[140px]"
|
className="min-w-[140px]"
|
||||||
|
|||||||
@@ -255,16 +255,6 @@ const MainPagePatient = () => {
|
|||||||
>
|
>
|
||||||
{item.fullName}
|
{item.fullName}
|
||||||
</Link>
|
</Link>
|
||||||
{/* <Link
|
|
||||||
href={`/patient/${item.id}`}
|
|
||||||
className={
|
|
||||||
isReturnWithin14Days(item.lastVisitDate)
|
|
||||||
? "text-red-500 font-semibold hover:underline"
|
|
||||||
: "text-blue-500 hover:underline"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{item.fullName}
|
|
||||||
</Link> */}
|
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
|
|
||||||
<TooltipContent>
|
<TooltipContent>
|
||||||
|
|||||||
Reference in New Issue
Block a user