Feature/amiriis missions
This commit is contained in:
@@ -1,18 +1,18 @@
|
|||||||
import AzmayeshPage from "@/components/dashboard/azmayesh";
|
import AzmayeshPage from "@/components/dashboard/azmayesh";
|
||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
||||||
|
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "کارتابل آزمایشات",
|
title: "کارتابل آزمایشات",
|
||||||
};
|
};
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission permission_name={["azmayesh-management"]}>
|
<WithPermission permission_name={["azmayesh-management"]}>
|
||||||
<AzmayeshPage />
|
<AzmayeshPage />
|
||||||
<ActivityCodeLog activity_code={1157} />
|
<ActivityCodeLog activity_code={1157} />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import AzmayeshTypePage from "@/components/dashboard/azmayeshType";
|
import AzmayeshTypePage from "@/components/dashboard/azmayeshType";
|
||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "کارتابل نوع آزمایشات",
|
title: "کارتابل نوع آزمایشات",
|
||||||
};
|
};
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission permission_name={["azmayesh-type-management"]}>
|
<WithPermission permission_name={["azmayesh-type-management"]}>
|
||||||
<AzmayeshTypePage />
|
<AzmayeshTypePage />
|
||||||
<ActivityCodeLog activity_code={1161} />
|
<ActivityCodeLog activity_code={1161} />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import DamagesPage from "@/components/dashboard/damageItems";
|
import DamagesPage from "@/components/dashboard/damageItems";
|
||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "آیتم خسارات",
|
title: "آیتم خسارات",
|
||||||
};
|
};
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission permission_name={["manage-damage"]}>
|
<WithPermission permission_name={["manage-damage"]}>
|
||||||
<DamagesPage />
|
<DamagesPage />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import OperatorPage from "@/components/dashboard/damages/operator";
|
import OperatorPage from "@/components/dashboard/damages/operator";
|
||||||
import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "کارتابل عملیات خسارات وارد بر ابنیه فنی",
|
title: "کارتابل عملیات خسارات وارد بر ابنیه فنی",
|
||||||
};
|
};
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission permission_name={["show-receipt", "show-receipt-province"]}>
|
<WithPermission permission_name={["show-receipt", "show-receipt-province"]}>
|
||||||
<OperatorPage />
|
<OperatorPage />
|
||||||
<ActivityCodeLog activity_code={1122} />
|
<ActivityCodeLog activity_code={1122} />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import DamagesReportPage from "@/components/dashboard/damages/report";
|
import DamagesReportPage from "@/components/dashboard/damages/report";
|
||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "کارتابل گزارش خسارات وارد بر ابنیه فنی",
|
title: "کارتابل گزارش خسارات وارد بر ابنیه فنی",
|
||||||
};
|
};
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission permission_name={["show-receipt", "show-receipt-province"]}>
|
<WithPermission permission_name={["show-receipt", "show-receipt-province"]}>
|
||||||
<DamagesReportPage />
|
<DamagesReportPage />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import OperatorPage from "@/components/dashboard/fastReact/operator";
|
import OperatorPage from "@/components/dashboard/fastReact/operator";
|
||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "کارتابل عملیات واکنش سریع",
|
title: "کارتابل عملیات واکنش سریع",
|
||||||
};
|
};
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission permission_name={["show-fast-react-edarate-shahri"]}>
|
<WithPermission permission_name={["show-fast-react-edarate-shahri"]}>
|
||||||
<OperatorPage />
|
<OperatorPage />
|
||||||
{/* <ActivityCodeLog activity_code={1137} /> */}
|
{/* <ActivityCodeLog activity_code={1137} /> */}
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
import SupervisorPage from "@/components/dashboard/fastReact/supervisor";
|
import SupervisorPage from "@/components/dashboard/fastReact/supervisor";
|
||||||
import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "کارتابل ارزیابی واکنش سریع",
|
title: "کارتابل ارزیابی واکنش سریع",
|
||||||
};
|
};
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission permission_name={["show-fast-react", "show-fast-react-province"]}>
|
<WithPermission permission_name={["show-fast-react", "show-fast-react-province"]}>
|
||||||
<SupervisorPage />
|
<SupervisorPage />
|
||||||
<ActivityCodeLog activity_code={1137} />
|
<ActivityCodeLog activity_code={1137} />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import AssistantZaminGovComponent from "@/components/dashboard/inquiryPrivacy/assistant/zaminGov";
|
import AssistantZaminGovComponent from "@/components/dashboard/inquiryPrivacy/assistant/zaminGov";
|
||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission>
|
<WithPermission>
|
||||||
<AssistantZaminGovComponent />
|
<AssistantZaminGovComponent />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import CityAdminZaminGovComponent from "@/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov";
|
import CityAdminZaminGovComponent from "@/components/dashboard/inquiryPrivacy/cityAdmin/zaminGov";
|
||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission>
|
<WithPermission>
|
||||||
<CityAdminZaminGovComponent />
|
<CityAdminZaminGovComponent />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import GeneralManagerZaminGovComponent from "@/components/dashboard/inquiryPrivacy/generalManager/zaminGov";
|
import GeneralManagerZaminGovComponent from "@/components/dashboard/inquiryPrivacy/generalManager/zaminGov";
|
||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission>
|
<WithPermission>
|
||||||
<GeneralManagerZaminGovComponent />
|
<GeneralManagerZaminGovComponent />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import ProvinceAdminZaminGovComponent from "@/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov";
|
import ProvinceAdminZaminGovComponent from "@/components/dashboard/inquiryPrivacy/provinceAdmin/zaminGov";
|
||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission>
|
<WithPermission>
|
||||||
<ProvinceAdminZaminGovComponent />
|
<ProvinceAdminZaminGovComponent />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import PageLoading from "@/core/components/PageLoading";
|
import PageLoading from "@/core/components/PageLoading";
|
||||||
|
|
||||||
const Loading = () => {
|
const Loading = () => {
|
||||||
return <PageLoading />;
|
return <PageLoading />;
|
||||||
};
|
};
|
||||||
export default Loading;
|
export default Loading;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "پیشخوان",
|
title: "پیشخوان",
|
||||||
};
|
};
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return <></>;
|
return <></>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
import PermissionTablePage from "@/components/dashboard/permissionTable";
|
import PermissionTablePage from "@/components/dashboard/permissionTable";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "سطح دسترسی ها",
|
title: "سطح دسترسی ها",
|
||||||
};
|
};
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission permission_name={["manage-permissions"]}>
|
<WithPermission permission_name={["manage-permissions"]}>
|
||||||
<PermissionTablePage />
|
<PermissionTablePage />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
import OperatorPage from "@/components/dashboard/roadItems/operator";
|
import OperatorPage from "@/components/dashboard/roadItems/operator";
|
||||||
import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "کارتابل عملیات فعالیت روزانه",
|
title: "کارتابل عملیات فعالیت روزانه",
|
||||||
};
|
};
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission permission_name={["create-road-item"]}>
|
<WithPermission permission_name={["create-road-item"]}>
|
||||||
<OperatorPage />
|
<OperatorPage />
|
||||||
<ActivityCodeLog activity_code={1152} />
|
<ActivityCodeLog activity_code={1152} />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
import ReportPage from "@/components/dashboard/roadItems/reports/ItemsReports";
|
import ReportPage from "@/components/dashboard/roadItems/reports/ItemsReports";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "کارتابل گزارش تعداد فعالیت ها به تفکیک آیتم",
|
title: "کارتابل گزارش تعداد فعالیت ها به تفکیک آیتم",
|
||||||
};
|
};
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission
|
<WithPermission
|
||||||
permission_name={[
|
permission_name={[
|
||||||
"show-road-item-supervise-cartable",
|
"show-road-item-supervise-cartable",
|
||||||
"show-road-item-supervise-cartable-province",
|
"show-road-item-supervise-cartable-province",
|
||||||
"create-road-item",
|
"create-road-item",
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<ReportPage />
|
<ReportPage />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import RoadItemsReportMap from "@/components/dashboard/roadItems/reports/Map";
|
import RoadItemsReportMap from "@/components/dashboard/roadItems/reports/Map";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "پراکندگی بر روی نقشه فعالیت روزانه",
|
title: "پراکندگی بر روی نقشه فعالیت روزانه",
|
||||||
};
|
};
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return <RoadItemsReportMap />;
|
return <RoadItemsReportMap />;
|
||||||
};
|
};
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
import SubItemsReports from "@/components/dashboard/roadItems/reports/SubItemsReports";
|
import SubItemsReports from "@/components/dashboard/roadItems/reports/SubItemsReports";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "کارتابل گزارش تعداد فعالیت ها به تفکیک موارد مشاهده شده",
|
title: "کارتابل گزارش تعداد فعالیت ها به تفکیک موارد مشاهده شده",
|
||||||
};
|
};
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission
|
<WithPermission
|
||||||
permission_name={[
|
permission_name={[
|
||||||
"show-road-item-supervise-cartable",
|
"show-road-item-supervise-cartable",
|
||||||
"show-road-item-supervise-cartable-province",
|
"show-road-item-supervise-cartable-province",
|
||||||
"create-road-item",
|
"create-road-item",
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<SubItemsReports />
|
<SubItemsReports />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
import SupervisorPage from "@/components/dashboard/roadItems/supervisor";
|
import SupervisorPage from "@/components/dashboard/roadItems/supervisor";
|
||||||
import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "کارتابل ارزیابی فعالیت روزانه",
|
title: "کارتابل ارزیابی فعالیت روزانه",
|
||||||
};
|
};
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission
|
<WithPermission
|
||||||
permission_name={["show-road-item-supervise-cartable", "show-road-item-supervise-cartable-province"]}
|
permission_name={["show-road-item-supervise-cartable", "show-road-item-supervise-cartable-province"]}
|
||||||
>
|
>
|
||||||
<SupervisorPage />
|
<SupervisorPage />
|
||||||
<ActivityCodeLog activity_code={1148} />
|
<ActivityCodeLog activity_code={1148} />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import ControlPage from "@/components/dashboard/roadMissions/control";
|
||||||
|
|
||||||
|
export const metadata = {
|
||||||
|
title: "کارتابل کنترل",
|
||||||
|
};
|
||||||
|
const Page = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* <WithPermission permission_name={["create-road-item"]}> */}
|
||||||
|
<ControlPage />
|
||||||
|
{/* <ActivityCodeLog activity_code={1152} /> */}
|
||||||
|
{/* </WithPermission> */}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Page;
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
|
import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
||||||
|
import OperatorPage from "@/components/dashboard/roadMissions/operator";
|
||||||
|
export const metadata = {
|
||||||
|
title: "کارتابل ماموریت",
|
||||||
|
};
|
||||||
|
const Page = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* <WithPermission permission_name={["create-road-item"]}> */}
|
||||||
|
<OperatorPage />
|
||||||
|
{/* <ActivityCodeLog activity_code={1152} /> */}
|
||||||
|
{/* </WithPermission> */}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Page;
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import TransportationPage from "@/components/dashboard/roadMissions/transportation";
|
||||||
|
|
||||||
|
export const metadata = {
|
||||||
|
title: "کارتابل نقلیه",
|
||||||
|
};
|
||||||
|
const Page = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* <WithPermission permission_name={["create-road-item"]}> */}
|
||||||
|
<TransportationPage />
|
||||||
|
{/* <ActivityCodeLog activity_code={1152} /> */}
|
||||||
|
{/* </WithPermission> */}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Page;
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
import OperatorPage from "@/components/dashboard/roadPatrols/operator";
|
import OperatorPage from "@/components/dashboard/roadPatrols/operator";
|
||||||
import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "کارتابل عملیات گشت راهداری",
|
title: "کارتابل عملیات گشت راهداری",
|
||||||
};
|
};
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission permission_name={["add-road-patrol"]}>
|
<WithPermission permission_name={["add-road-patrol"]}>
|
||||||
<OperatorPage />
|
<OperatorPage />
|
||||||
<ActivityCodeLog activity_code={1145} />
|
<ActivityCodeLog activity_code={1145} />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
import ReportPage from "@/components/dashboard/roadPatrols/reports";
|
import ReportPage from "@/components/dashboard/roadPatrols/reports";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "کارتابل گزارش گشت راهداری",
|
title: "کارتابل گزارش گشت راهداری",
|
||||||
};
|
};
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission
|
<WithPermission
|
||||||
permission_name={[
|
permission_name={[
|
||||||
"add-road-patrol",
|
"add-road-patrol",
|
||||||
"show-road-patrol-supervise-cartable",
|
"show-road-patrol-supervise-cartable",
|
||||||
"show-road-patrol-supervise-cartable-province",
|
"show-road-patrol-supervise-cartable-province",
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<ReportPage />
|
<ReportPage />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
import SupervisorPage from "@/components/dashboard/roadPatrols/supervisor";
|
import SupervisorPage from "@/components/dashboard/roadPatrols/supervisor";
|
||||||
import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "کارتابل ارزیابی گشت راهداری",
|
title: "کارتابل ارزیابی گشت راهداری",
|
||||||
};
|
};
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission
|
<WithPermission
|
||||||
permission_name={["show-road-patrol-supervise-cartable", "show-road-patrol-supervise-cartable-province"]}
|
permission_name={["show-road-patrol-supervise-cartable", "show-road-patrol-supervise-cartable-province"]}
|
||||||
>
|
>
|
||||||
<SupervisorPage />
|
<SupervisorPage />
|
||||||
<ActivityCodeLog activity_code={1143} />
|
<ActivityCodeLog activity_code={1143} />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
import OperatorPage from "@/components/dashboard/roadSafety/operator";
|
import OperatorPage from "@/components/dashboard/roadSafety/operator";
|
||||||
// import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
// import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "کارتابل عملیات نگهداری حریم",
|
title: "کارتابل عملیات نگهداری حریم",
|
||||||
};
|
};
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission permission_name={["show-safety-and-privacy-operator-cartable-edarate-shahri"]}>
|
<WithPermission permission_name={["show-safety-and-privacy-operator-cartable-edarate-shahri"]}>
|
||||||
<OperatorPage />
|
<OperatorPage />
|
||||||
{/*<ActivityCodeLog activity_code={1145} />*/}
|
{/*<ActivityCodeLog activity_code={1145} />*/}
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import RoadSafetyReportMap from "@/components/dashboard/roadSafety/reports/map";
|
import RoadSafetyReportMap from "@/components/dashboard/roadSafety/reports/map";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "پراکندگی بر روی نقشه نگهداری حریم",
|
title: "پراکندگی بر روی نقشه نگهداری حریم",
|
||||||
};
|
};
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return <RoadSafetyReportMap />;
|
return <RoadSafetyReportMap />;
|
||||||
};
|
};
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
import ReportPage from "@/components/dashboard/roadSafety/reports/reportPage";
|
import ReportPage from "@/components/dashboard/roadSafety/reports/reportPage";
|
||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "کارتابل گزارش نگهداری حریم",
|
title: "کارتابل گزارش نگهداری حریم",
|
||||||
};
|
};
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission
|
<WithPermission
|
||||||
permission_name={[
|
permission_name={[
|
||||||
"show-safety-and-privacy-operator-cartable",
|
"show-safety-and-privacy-operator-cartable",
|
||||||
"show-safety-and-privacy-operator-cartable-province",
|
"show-safety-and-privacy-operator-cartable-province",
|
||||||
"show-safety-and-privacy-operator-cartable-edarate-shahri",
|
"show-safety-and-privacy-operator-cartable-edarate-shahri",
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<ReportPage />
|
<ReportPage />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
import SupervisorPage from "@/components/dashboard/roadSafety/supervisor";
|
import SupervisorPage from "@/components/dashboard/roadSafety/supervisor";
|
||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
// import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
// import ActivityCodeLog from "@/core/components/ActivityCodeLog";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "کارتابل ارزیابی نگهداری حریم",
|
title: "کارتابل ارزیابی نگهداری حریم",
|
||||||
};
|
};
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission
|
<WithPermission
|
||||||
permission_name={[
|
permission_name={[
|
||||||
"show-safety-and-privacy-operator-cartable",
|
"show-safety-and-privacy-operator-cartable",
|
||||||
"show-safety-and-privacy-operator-cartable-province",
|
"show-safety-and-privacy-operator-cartable-province",
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<SupervisorPage />
|
<SupervisorPage />
|
||||||
{/*<ActivityCodeLog activity_code={1145} />*/}
|
{/*<ActivityCodeLog activity_code={1145} />*/}
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import UserActivitiesPage from "@/components/dashboard/userActivities";
|
import UserActivitiesPage from "@/components/dashboard/userActivities";
|
||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "انواع فعالیت کاربران",
|
title: "انواع فعالیت کاربران",
|
||||||
};
|
};
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission permission_name={["manage-log-list"]}>
|
<WithPermission permission_name={["manage-log-list"]}>
|
||||||
<UserActivitiesPage />
|
<UserActivitiesPage />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import PageLoading from "@/core/components/PageLoading";
|
import PageLoading from "@/core/components/PageLoading";
|
||||||
|
|
||||||
const Loading = () => {
|
const Loading = () => {
|
||||||
return <PageLoading />;
|
return <PageLoading />;
|
||||||
};
|
};
|
||||||
export default Loading;
|
export default Loading;
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import WithPermission from "@/core/middlewares/withPermission";
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
import TollHousePage from "@/components/infrastructure/tollHouse";
|
import TollHousePage from "@/components/infrastructure/tollHouse";
|
||||||
|
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "لیست راهدارخانه ها",
|
title: "لیست راهدارخانه ها",
|
||||||
};
|
};
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return (
|
return (
|
||||||
<WithPermission permission_name={["show-tollhouse", "show-tollhouse-province"]}>
|
<WithPermission permission_name={["show-tollhouse", "show-tollhouse-province"]}>
|
||||||
<TollHousePage />
|
<TollHousePage />
|
||||||
</WithPermission>
|
</WithPermission>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import HeaderWithLogo from "@/components/layouts/dashboard/headerWithLogo";
|
import HeaderWithLogo from "@/components/layouts/dashboard/headerWithLogo";
|
||||||
import HeaderWithSidebar from "@/components/layouts/dashboard/headerWithSidebar";
|
import HeaderWithSidebar from "@/components/layouts/dashboard/headerWithSidebar";
|
||||||
import { Stack } from "@mui/material";
|
import { Stack } from "@mui/material";
|
||||||
import { SWRConfig } from "swr";
|
import { SWRConfig } from "swr";
|
||||||
|
|
||||||
const Layout = ({ children }) => {
|
const Layout = ({ children }) => {
|
||||||
return (
|
return (
|
||||||
<SWRConfig value={{ provider: () => new Map() }}>
|
<SWRConfig value={{ provider: () => new Map() }}>
|
||||||
<Stack sx={{ width: "100%", height: "100%" }}>
|
<Stack sx={{ width: "100%", height: "100%" }}>
|
||||||
<HeaderWithLogo />
|
<HeaderWithLogo />
|
||||||
<HeaderWithSidebar>{children}</HeaderWithSidebar>
|
<HeaderWithSidebar>{children}</HeaderWithSidebar>
|
||||||
</Stack>
|
</Stack>
|
||||||
</SWRConfig>
|
</SWRConfig>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default Layout;
|
export default Layout;
|
||||||
|
|||||||
@@ -1,31 +1,31 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { useAuth } from "@/lib/contexts/auth";
|
import { useAuth } from "@/lib/contexts/auth";
|
||||||
import { Typography, Stack } from "@mui/material";
|
import { Typography, Stack } from "@mui/material";
|
||||||
import WithAuthMiddleware from "@/core/middlewares/withAuth";
|
import WithAuthMiddleware from "@/core/middlewares/withAuth";
|
||||||
import LoadingHardPage from "@/core/components/LoadingHardPage";
|
import LoadingHardPage from "@/core/components/LoadingHardPage";
|
||||||
|
|
||||||
const Layout = ({ children }) => {
|
const Layout = ({ children }) => {
|
||||||
const { isAuth, initAuthState, errorState } = useAuth();
|
const { isAuth, initAuthState, errorState } = useAuth();
|
||||||
|
|
||||||
if (!initAuthState && !isAuth)
|
if (!initAuthState && !isAuth)
|
||||||
return (
|
return (
|
||||||
<LoadingHardPage
|
<LoadingHardPage
|
||||||
authState={errorState.status}
|
authState={errorState.status}
|
||||||
label={
|
label={
|
||||||
errorState.status ? (
|
errorState.status ? (
|
||||||
<Stack justifyContent={"center"} alignItems={"center"}>
|
<Stack justifyContent={"center"} alignItems={"center"}>
|
||||||
<Typography variant={"body1"}>{errorState.message}</Typography>
|
<Typography variant={"body1"}>{errorState.message}</Typography>
|
||||||
<Typography variant={"body1"}> کد : {errorState.status}</Typography>
|
<Typography variant={"body1"}> کد : {errorState.status}</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
) : (
|
) : (
|
||||||
<Typography variant={"body1"}>درحال احراز هویت...</Typography>
|
<Typography variant={"body1"}>درحال احراز هویت...</Typography>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
loading={true}
|
loading={true}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <WithAuthMiddleware>{children}</WithAuthMiddleware>;
|
return <WithAuthMiddleware>{children}</WithAuthMiddleware>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Layout;
|
export default Layout;
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
const data = [
|
const data = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
name: "تهران",
|
name: "تهران",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
name: "ری",
|
name: "ری",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
name: "اندیشه",
|
name: "اندیشه",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
return Response.json({ data });
|
return Response.json({ data });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,41 +1,41 @@
|
|||||||
const data = [
|
const data = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
aplication_number: 1,
|
aplication_number: 1,
|
||||||
application_date: "1",
|
application_date: "1",
|
||||||
province: "tehran",
|
province: "tehran",
|
||||||
city: "tehran",
|
city: "tehran",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
aplication_number: 2,
|
aplication_number: 2,
|
||||||
application_date: "1",
|
application_date: "1",
|
||||||
province: "tehran",
|
province: "tehran",
|
||||||
city: "tehran",
|
city: "tehran",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
aplication_number: 3,
|
aplication_number: 3,
|
||||||
application_date: "1",
|
application_date: "1",
|
||||||
province: "tehran",
|
province: "tehran",
|
||||||
city: "tehran",
|
city: "tehran",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
aplication_number: 4,
|
aplication_number: 4,
|
||||||
application_date: "1",
|
application_date: "1",
|
||||||
province: "tehran",
|
province: "tehran",
|
||||||
city: "tehran",
|
city: "tehran",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 5,
|
id: 5,
|
||||||
aplication_number: 5,
|
aplication_number: 5,
|
||||||
application_date: "1",
|
application_date: "1",
|
||||||
province: "tehran",
|
province: "tehran",
|
||||||
city: "tehran",
|
city: "tehran",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
return Response.json({ data });
|
return Response.json({ data });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
export async function GET() {
|
export async function GET() {
|
||||||
return Response.json({
|
return Response.json({
|
||||||
message:
|
message:
|
||||||
"به موجب این نامه، به استحضار جنابعالی می رساند، این جانب ……… از تاریخ ……… افتخار همکاری\n" +
|
"به موجب این نامه، به استحضار جنابعالی می رساند، این جانب ……… از تاریخ ……… افتخار همکاری\n" +
|
||||||
"با مجموعه ……… را دارم. اما متاسفانه، به علت ………، تقاضای استعفای خود را از تاریخ ………\n" +
|
"با مجموعه ……… را دارم. اما متاسفانه، به علت ………، تقاضای استعفای خود را از تاریخ ………\n" +
|
||||||
"اعلام میدارم. ضمن تشکر پیشاپیش از همکاری شما خواهشمند است، دستور اقدامات لازم در این\n" +
|
"اعلام میدارم. ضمن تشکر پیشاپیش از همکاری شما خواهشمند است، دستور اقدامات لازم در این\n" +
|
||||||
"زمینه را صادر فرمایید.",
|
"زمینه را صادر فرمایید.",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
const data = [
|
const data = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
name: "تهران",
|
name: "تهران",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
name: "مشهد",
|
name: "مشهد",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
name: "اصفهان",
|
name: "اصفهان",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
return Response.json({ data });
|
return Response.json({ data });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,84 +1,84 @@
|
|||||||
const data = [
|
const data = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
province: "تهران",
|
province: "تهران",
|
||||||
office: "اداره کل",
|
office: "اداره کل",
|
||||||
action_item: "بررسی خودرو", // Replace with the correct label
|
action_item: "بررسی خودرو", // Replace with the correct label
|
||||||
observed_subject: "تنظیم سطح بستر حریم", // Replace with the correct label
|
observed_subject: "تنظیم سطح بستر حریم", // Replace with the correct label
|
||||||
value: "1 کیلومتر", // Replace with actual value
|
value: "1 کیلومتر", // Replace with actual value
|
||||||
images: {
|
images: {
|
||||||
before: "https://cdn-icons-png.flaticon.com/512/783/783154.png",
|
before: "https://cdn-icons-png.flaticon.com/512/783/783154.png",
|
||||||
after: "https://cdn-icons-png.flaticon.com/512/1651/1651833.png",
|
after: "https://cdn-icons-png.flaticon.com/512/1651/1651833.png",
|
||||||
},
|
},
|
||||||
location: [{ lat: 35.6892, lng: 51.389 }], // Add URLs to images if needed
|
location: [{ lat: 35.6892, lng: 51.389 }], // Add URLs to images if needed
|
||||||
register_date: "2024-11-03T11:01:14.000000Z",
|
register_date: "2024-11-03T11:01:14.000000Z",
|
||||||
start_date: "2024-11-02T11:48:22.000000Z",
|
start_date: "2024-11-02T11:48:22.000000Z",
|
||||||
status: 0, // Replace with actual status
|
status: 0, // Replace with actual status
|
||||||
car_id: 1,
|
car_id: 1,
|
||||||
person_id: [0, 1, 2],
|
person_id: [0, 1, 2],
|
||||||
description: "بررسی شد", // Replace with actual description
|
description: "بررسی شد", // Replace with actual description
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
province: "تهران",
|
province: "تهران",
|
||||||
office: "اداره کل",
|
office: "اداره کل",
|
||||||
action_item: "بررسی خودرو", // Replace with the correct label
|
action_item: "بررسی خودرو", // Replace with the correct label
|
||||||
observed_subject: "تنظیم سطح بستر حریم", // Replace with the correct label
|
observed_subject: "تنظیم سطح بستر حریم", // Replace with the correct label
|
||||||
value: "1 کیلومتر", // Replace with actual value
|
value: "1 کیلومتر", // Replace with actual value
|
||||||
images: {
|
images: {
|
||||||
before: "https://cdn-icons-png.flaticon.com/512/783/783154.png",
|
before: "https://cdn-icons-png.flaticon.com/512/783/783154.png",
|
||||||
after: "https://cdn-icons-png.flaticon.com/512/1651/1651833.png",
|
after: "https://cdn-icons-png.flaticon.com/512/1651/1651833.png",
|
||||||
},
|
},
|
||||||
location: [{ lat: 35.6892, lng: 51.389 }], // Add URLs to images if needed
|
location: [{ lat: 35.6892, lng: 51.389 }], // Add URLs to images if needed
|
||||||
register_date: "2024-11-03T11:01:14.000000Z",
|
register_date: "2024-11-03T11:01:14.000000Z",
|
||||||
start_date: "2024-11-02T11:48:22.000000Z",
|
start_date: "2024-11-02T11:48:22.000000Z",
|
||||||
status: 2, // Replace with actual status
|
status: 2, // Replace with actual status
|
||||||
car_id: 10,
|
car_id: 10,
|
||||||
person_id: [10, 11, 12],
|
person_id: [10, 11, 12],
|
||||||
description: "بررسی شد", // Replace with actual description
|
description: "بررسی شد", // Replace with actual description
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
province: "تهران",
|
province: "تهران",
|
||||||
office: "اداره کل",
|
office: "اداره کل",
|
||||||
action_item: "بررسی خودرو", // Replace with the correct label
|
action_item: "بررسی خودرو", // Replace with the correct label
|
||||||
observed_subject: "تنظیم سطح بستر حریم", // Replace with the correct label
|
observed_subject: "تنظیم سطح بستر حریم", // Replace with the correct label
|
||||||
value: "1 کیلومتر", // Replace with actual value
|
value: "1 کیلومتر", // Replace with actual value
|
||||||
images: {
|
images: {
|
||||||
before: "https://cdn-icons-png.flaticon.com/512/783/783154.png",
|
before: "https://cdn-icons-png.flaticon.com/512/783/783154.png",
|
||||||
after: "https://cdn-icons-png.flaticon.com/512/1651/1651833.png",
|
after: "https://cdn-icons-png.flaticon.com/512/1651/1651833.png",
|
||||||
}, // Add URLs to images if needed
|
}, // Add URLs to images if needed
|
||||||
location: [{ lat: 35.6892, lng: 51.389 }], // Add URLs to images if needed
|
location: [{ lat: 35.6892, lng: 51.389 }], // Add URLs to images if needed
|
||||||
register_date: "2024-11-03T11:01:14.000000Z",
|
register_date: "2024-11-03T11:01:14.000000Z",
|
||||||
start_date: "2024-11-02T11:48:22.000000Z",
|
start_date: "2024-11-02T11:48:22.000000Z",
|
||||||
status: 0, // Replace with actual status
|
status: 0, // Replace with actual status
|
||||||
car_id: 11,
|
car_id: 11,
|
||||||
person_id: [20, 15, 29],
|
person_id: [20, 15, 29],
|
||||||
description: "بررسی شد", // Replace with actual description
|
description: "بررسی شد", // Replace with actual description
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
province: "تهران",
|
province: "تهران",
|
||||||
office: "اداره کل",
|
office: "اداره کل",
|
||||||
action_item: "بررسی خودرو", // Replace with the correct label
|
action_item: "بررسی خودرو", // Replace with the correct label
|
||||||
observed_subject: "تنظیم سطح بستر حریم", // Replace with the correct label
|
observed_subject: "تنظیم سطح بستر حریم", // Replace with the correct label
|
||||||
value: "1 کیلومتر", // Replace with actual value
|
value: "1 کیلومتر", // Replace with actual value
|
||||||
images: {
|
images: {
|
||||||
before: "https://cdn-icons-png.flaticon.com/512/783/783154.png",
|
before: "https://cdn-icons-png.flaticon.com/512/783/783154.png",
|
||||||
after: "https://cdn-icons-png.flaticon.com/512/1651/1651833.png",
|
after: "https://cdn-icons-png.flaticon.com/512/1651/1651833.png",
|
||||||
}, // Add URLs to images if needed
|
}, // Add URLs to images if needed
|
||||||
location: [{ lat: 35.6892, lng: 51.389 }], // Add URLs to images if needed
|
location: [{ lat: 35.6892, lng: 51.389 }], // Add URLs to images if needed
|
||||||
register_date: "2024-11-03T11:01:14.000000Z",
|
register_date: "2024-11-03T11:01:14.000000Z",
|
||||||
start_date: "2024-11-02T11:48:22.000000Z",
|
start_date: "2024-11-02T11:48:22.000000Z",
|
||||||
status: 1, // Replace with actual status
|
status: 1, // Replace with actual status
|
||||||
car_id: 26,
|
car_id: 26,
|
||||||
person_id: [78, 18, 56],
|
person_id: [78, 18, 56],
|
||||||
description: "بررسی شد", // Replace with actual description
|
description: "بررسی شد", // Replace with actual description
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
return new Response(JSON.stringify({ data }), {
|
return new Response(JSON.stringify({ data }), {
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,84 +1,84 @@
|
|||||||
const data = [
|
const data = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
province: "تهران",
|
province: "تهران",
|
||||||
office: "اداره کل",
|
office: "اداره کل",
|
||||||
action_item: "بررسی خودرو", // Replace with the correct label
|
action_item: "بررسی خودرو", // Replace with the correct label
|
||||||
observed_subject: "تنظیم سطح بستر حریم", // Replace with the correct label
|
observed_subject: "تنظیم سطح بستر حریم", // Replace with the correct label
|
||||||
value: "1 کیلومتر", // Replace with actual value
|
value: "1 کیلومتر", // Replace with actual value
|
||||||
images: {
|
images: {
|
||||||
before: "https://cdn-icons-png.flaticon.com/512/783/783154.png",
|
before: "https://cdn-icons-png.flaticon.com/512/783/783154.png",
|
||||||
after: "https://cdn-icons-png.flaticon.com/512/1651/1651833.png",
|
after: "https://cdn-icons-png.flaticon.com/512/1651/1651833.png",
|
||||||
}, // Add URLs to images if needed
|
}, // Add URLs to images if needed
|
||||||
location: [{ lat: 35.6892, lng: 51.389 }], // Add URLs to images if needed
|
location: [{ lat: 35.6892, lng: 51.389 }], // Add URLs to images if needed
|
||||||
register_date: "2024-11-03T11:01:14.000000Z",
|
register_date: "2024-11-03T11:01:14.000000Z",
|
||||||
start_date: "2024-11-02T11:48:22.000000Z",
|
start_date: "2024-11-02T11:48:22.000000Z",
|
||||||
status: 0, // Replace with actual status
|
status: 0, // Replace with actual status
|
||||||
car_id: 1,
|
car_id: 1,
|
||||||
person_id: [0, 1, 2],
|
person_id: [0, 1, 2],
|
||||||
description: "بررسی شد", // Replace with actual description
|
description: "بررسی شد", // Replace with actual description
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
province: "تهران",
|
province: "تهران",
|
||||||
office: "اداره کل",
|
office: "اداره کل",
|
||||||
action_item: "بررسی خودرو", // Replace with the correct label
|
action_item: "بررسی خودرو", // Replace with the correct label
|
||||||
observed_subject: "تنظیم سطح بستر حریم", // Replace with the correct label
|
observed_subject: "تنظیم سطح بستر حریم", // Replace with the correct label
|
||||||
value: "1 کیلومتر", // Replace with actual value
|
value: "1 کیلومتر", // Replace with actual value
|
||||||
images: {
|
images: {
|
||||||
before: "https://cdn-icons-png.flaticon.com/512/783/783154.png",
|
before: "https://cdn-icons-png.flaticon.com/512/783/783154.png",
|
||||||
after: "https://cdn-icons-png.flaticon.com/512/1651/1651833.png",
|
after: "https://cdn-icons-png.flaticon.com/512/1651/1651833.png",
|
||||||
}, // Add URLs to images if needed
|
}, // Add URLs to images if needed
|
||||||
location: [{ lat: 35.6892, lng: 51.389 }], // Add URLs to images if needed
|
location: [{ lat: 35.6892, lng: 51.389 }], // Add URLs to images if needed
|
||||||
register_date: "2024-11-03T11:01:14.000000Z",
|
register_date: "2024-11-03T11:01:14.000000Z",
|
||||||
start_date: "2024-11-02T11:48:22.000000Z",
|
start_date: "2024-11-02T11:48:22.000000Z",
|
||||||
status: 2, // Replace with actual status
|
status: 2, // Replace with actual status
|
||||||
car_id: 10,
|
car_id: 10,
|
||||||
person_id: [10, 11, 12],
|
person_id: [10, 11, 12],
|
||||||
description: "بررسی شد", // Replace with actual description
|
description: "بررسی شد", // Replace with actual description
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
province: "تهران",
|
province: "تهران",
|
||||||
office: "اداره کل",
|
office: "اداره کل",
|
||||||
action_item: "بررسی خودرو", // Replace with the correct label
|
action_item: "بررسی خودرو", // Replace with the correct label
|
||||||
observed_subject: "تنظیم سطح بستر حریم", // Replace with the correct label
|
observed_subject: "تنظیم سطح بستر حریم", // Replace with the correct label
|
||||||
value: "1 کیلومتر", // Replace with actual value
|
value: "1 کیلومتر", // Replace with actual value
|
||||||
images: {
|
images: {
|
||||||
before: "https://cdn-icons-png.flaticon.com/512/783/783154.png",
|
before: "https://cdn-icons-png.flaticon.com/512/783/783154.png",
|
||||||
after: "https://cdn-icons-png.flaticon.com/512/1651/1651833.png",
|
after: "https://cdn-icons-png.flaticon.com/512/1651/1651833.png",
|
||||||
}, // Add URLs to images if needed
|
}, // Add URLs to images if needed
|
||||||
location: [{ lat: 35.6892, lng: 51.389 }], // Add URLs to images if needed
|
location: [{ lat: 35.6892, lng: 51.389 }], // Add URLs to images if needed
|
||||||
register_date: "2024-11-03T11:01:14.000000Z",
|
register_date: "2024-11-03T11:01:14.000000Z",
|
||||||
start_date: "2024-11-02T11:48:22.000000Z",
|
start_date: "2024-11-02T11:48:22.000000Z",
|
||||||
status: 0, // Replace with actual status
|
status: 0, // Replace with actual status
|
||||||
car_id: 11,
|
car_id: 11,
|
||||||
person_id: [20, 15, 29],
|
person_id: [20, 15, 29],
|
||||||
description: "بررسی شد", // Replace with actual description
|
description: "بررسی شد", // Replace with actual description
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
province: "تهران",
|
province: "تهران",
|
||||||
office: "اداره کل",
|
office: "اداره کل",
|
||||||
action_item: "بررسی خودرو", // Replace with the correct label
|
action_item: "بررسی خودرو", // Replace with the correct label
|
||||||
observed_subject: "تنظیم سطح بستر حریم", // Replace with the correct label
|
observed_subject: "تنظیم سطح بستر حریم", // Replace with the correct label
|
||||||
value: "1 کیلومتر", // Replace with actual value
|
value: "1 کیلومتر", // Replace with actual value
|
||||||
images: {
|
images: {
|
||||||
before: "https://cdn-icons-png.flaticon.com/512/783/783154.png",
|
before: "https://cdn-icons-png.flaticon.com/512/783/783154.png",
|
||||||
after: "https://cdn-icons-png.flaticon.com/512/1651/1651833.png",
|
after: "https://cdn-icons-png.flaticon.com/512/1651/1651833.png",
|
||||||
}, // Add URLs to images if needed
|
}, // Add URLs to images if needed
|
||||||
location: [{ lat: 35.6892, lng: 51.389 }], // Add URLs to images if needed
|
location: [{ lat: 35.6892, lng: 51.389 }], // Add URLs to images if needed
|
||||||
register_date: "2024-11-03T11:01:14.000000Z",
|
register_date: "2024-11-03T11:01:14.000000Z",
|
||||||
start_date: "2024-11-02T11:48:22.000000Z",
|
start_date: "2024-11-02T11:48:22.000000Z",
|
||||||
status: 1, // Replace with actual status
|
status: 1, // Replace with actual status
|
||||||
car_id: 26,
|
car_id: 26,
|
||||||
person_id: [78, 18, 56],
|
person_id: [78, 18, 56],
|
||||||
description: "بررسی شد", // Replace with actual description
|
description: "بررسی شد", // Replace with actual description
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
return new Response(JSON.stringify({ data }), {
|
return new Response(JSON.stringify({ data }), {
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,24 @@
|
|||||||
const data = [
|
const data = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
operator_name: "امین",
|
operator_name: "امین",
|
||||||
phone_number: "09134849737",
|
phone_number: "09134849737",
|
||||||
car_id: "33",
|
car_id: "33",
|
||||||
start_date: "2024-11-02T11:48:22.000000Z",
|
start_date: "2024-11-02T11:48:22.000000Z",
|
||||||
end_date: "2024-11-03T11:01:14.000000Z",
|
end_date: "2024-11-03T11:01:14.000000Z",
|
||||||
register_date: "2024-11-03T11:01:14.000000Z",
|
register_date: "2024-11-03T11:01:14.000000Z",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
operator_name: "امیر",
|
operator_name: "امیر",
|
||||||
phone_number: "09134844955",
|
phone_number: "09134844955",
|
||||||
car_id: "233",
|
car_id: "233",
|
||||||
start_date: "2024-11-02T11:48:22.000000Z",
|
start_date: "2024-11-02T11:48:22.000000Z",
|
||||||
end_date: "2024-11-03T11:01:14.000000Z",
|
end_date: "2024-11-03T11:01:14.000000Z",
|
||||||
register_date: "2024-11-03T11:01:14.000000Z",
|
register_date: "2024-11-03T11:01:14.000000Z",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
return Response.json({ data });
|
return Response.json({ data });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
const data = [
|
const data = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
operator_name: "امین",
|
operator_name: "امین",
|
||||||
phone_number: "09134849737",
|
phone_number: "09134849737",
|
||||||
province: "تهران",
|
province: "تهران",
|
||||||
office: "اداره کل",
|
office: "اداره کل",
|
||||||
car_id: "33",
|
car_id: "33",
|
||||||
start_date: "2024-11-02T11:48:22.000000Z",
|
start_date: "2024-11-02T11:48:22.000000Z",
|
||||||
end_date: "2024-11-03T11:01:14.000000Z",
|
end_date: "2024-11-03T11:01:14.000000Z",
|
||||||
register_date: "2024-11-03T11:01:14.000000Z",
|
register_date: "2024-11-03T11:01:14.000000Z",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
operator_name: "امیر",
|
operator_name: "امیر",
|
||||||
phone_number: "09134844955",
|
phone_number: "09134844955",
|
||||||
province: "تهران",
|
province: "تهران",
|
||||||
office: "اداره کل",
|
office: "اداره کل",
|
||||||
car_id: "233",
|
car_id: "233",
|
||||||
start_date: "2024-11-02T11:48:22.000000Z",
|
start_date: "2024-11-02T11:48:22.000000Z",
|
||||||
end_date: "2024-11-03T11:01:14.000000Z",
|
end_date: "2024-11-03T11:01:14.000000Z",
|
||||||
register_date: "2024-11-03T11:01:14.000000Z",
|
register_date: "2024-11-03T11:01:14.000000Z",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
return Response.json({ data });
|
return Response.json({ data });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
export async function POST() {
|
export async function POST() {
|
||||||
return Response.json({ message: "Done" });
|
return Response.json({ message: "Done" });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
const data = [
|
const data = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
name: "تست نوع 1",
|
name: "تست نوع 1",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
name: "تست نوع 2",
|
name: "تست نوع 2",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
name: "تست نوع 3",
|
name: "تست نوع 3",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
return Response.json({ data });
|
return Response.json({ data });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,71 +1,71 @@
|
|||||||
const data = [
|
const data = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
test_type_name: 1,
|
test_type_name: 1,
|
||||||
project_name: "نوع پروژه",
|
project_name: "نوع پروژه",
|
||||||
employer: "کارفرما",
|
employer: "کارفرما",
|
||||||
consultant: "مشاور",
|
consultant: "مشاور",
|
||||||
contractor: "پیمانکار",
|
contractor: "پیمانکار",
|
||||||
applicant: "متقاضی",
|
applicant: "متقاضی",
|
||||||
work_number: "شماره کار",
|
work_number: "شماره کار",
|
||||||
request_number: "شماره درخواست",
|
request_number: "شماره درخواست",
|
||||||
request_date: "تاریخ درخواست",
|
request_date: "تاریخ درخواست",
|
||||||
report_date: "تاریخ گزارش",
|
report_date: "تاریخ گزارش",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
test_type_name: 5,
|
test_type_name: 5,
|
||||||
project_name: "نوع پروژه",
|
project_name: "نوع پروژه",
|
||||||
employer: "کارفرما",
|
employer: "کارفرما",
|
||||||
consultant: "مشاور",
|
consultant: "مشاور",
|
||||||
contractor: "پیمانکار",
|
contractor: "پیمانکار",
|
||||||
applicant: "متقاضی",
|
applicant: "متقاضی",
|
||||||
work_number: "شماره کار",
|
work_number: "شماره کار",
|
||||||
request_number: "شماره درخواست",
|
request_number: "شماره درخواست",
|
||||||
request_date: "تاریخ درخواست",
|
request_date: "تاریخ درخواست",
|
||||||
report_date: "تاریخ گزارش",
|
report_date: "تاریخ گزارش",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
test_type_name: 2,
|
test_type_name: 2,
|
||||||
project_name: "نوع پروژه",
|
project_name: "نوع پروژه",
|
||||||
employer: "کارفرما",
|
employer: "کارفرما",
|
||||||
consultant: "مشاور",
|
consultant: "مشاور",
|
||||||
contractor: "پیمانکار",
|
contractor: "پیمانکار",
|
||||||
applicant: "متقاضی",
|
applicant: "متقاضی",
|
||||||
work_number: "شماره کار",
|
work_number: "شماره کار",
|
||||||
request_number: "شماره درخواست",
|
request_number: "شماره درخواست",
|
||||||
request_date: "تاریخ درخواست",
|
request_date: "تاریخ درخواست",
|
||||||
report_date: "تاریخ گزارش",
|
report_date: "تاریخ گزارش",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
test_type_name: 4,
|
test_type_name: 4,
|
||||||
project_name: "نوع پروژه",
|
project_name: "نوع پروژه",
|
||||||
employer: "کارفرما",
|
employer: "کارفرما",
|
||||||
consultant: "مشاور",
|
consultant: "مشاور",
|
||||||
contractor: "پیمانکار",
|
contractor: "پیمانکار",
|
||||||
applicant: "متقاضی",
|
applicant: "متقاضی",
|
||||||
work_number: "شماره کار",
|
work_number: "شماره کار",
|
||||||
request_number: "شماره درخواست",
|
request_number: "شماره درخواست",
|
||||||
request_date: "تاریخ درخواست",
|
request_date: "تاریخ درخواست",
|
||||||
report_date: "تاریخ گزارش",
|
report_date: "تاریخ گزارش",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 5,
|
id: 5,
|
||||||
test_type_name: 3,
|
test_type_name: 3,
|
||||||
project_name: "نوع پروژه",
|
project_name: "نوع پروژه",
|
||||||
employer: "کارفرما",
|
employer: "کارفرما",
|
||||||
consultant: "مشاور",
|
consultant: "مشاور",
|
||||||
contractor: "پیمانکار",
|
contractor: "پیمانکار",
|
||||||
applicant: "متقاضی",
|
applicant: "متقاضی",
|
||||||
work_number: "شماره کار",
|
work_number: "شماره کار",
|
||||||
request_number: "شماره درخواست",
|
request_number: "شماره درخواست",
|
||||||
request_date: "تاریخ درخواست",
|
request_date: "تاریخ درخواست",
|
||||||
report_date: "تاریخ گزارش",
|
report_date: "تاریخ گزارش",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
return Response.json({ data });
|
return Response.json({ data });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
export default function Default() {
|
export default function Default() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
import favicon from "@/assets/images/favicon.svg";
|
import favicon from "@/assets/images/favicon.svg";
|
||||||
import { AuthProvider } from "@/lib/contexts/auth";
|
import { AuthProvider } from "@/lib/contexts/auth";
|
||||||
import { TableSettingProvider } from "@/lib/contexts/tableSetting";
|
import { TableSettingProvider } from "@/lib/contexts/tableSetting";
|
||||||
|
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: {
|
title: {
|
||||||
template: "%s | سامانه جامع راهداری",
|
template: "%s | سامانه جامع راهداری",
|
||||||
default: "سامانه جامع راهداری",
|
default: "سامانه جامع راهداری",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function RootLayout({ children }) {
|
export default function RootLayout({ children }) {
|
||||||
return (
|
return (
|
||||||
<html lang="fa" dir={"rtl"}>
|
<html lang="fa" dir={"rtl"}>
|
||||||
<head>
|
<head>
|
||||||
<link rel="icon" href={favicon.src} type="image/svg" sizes="any" />
|
<link rel="icon" href={favicon.src} type="image/svg" sizes="any" />
|
||||||
</head>
|
</head>
|
||||||
<body style={{ height: "100vh", width: "100vw" }}>
|
<body style={{ height: "100vh", width: "100vw" }}>
|
||||||
<AuthProvider>
|
<AuthProvider>
|
||||||
<TableSettingProvider>{children}</TableSettingProvider>
|
<TableSettingProvider>{children}</TableSettingProvider>
|
||||||
</AuthProvider>
|
</AuthProvider>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,61 +1,61 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { GET_LOGIN_ROUTE } from "@/core/utils/routes";
|
import { GET_LOGIN_ROUTE } from "@/core/utils/routes";
|
||||||
import { useAuth } from "@/lib/contexts/auth";
|
import { useAuth } from "@/lib/contexts/auth";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import { Button, Stack, Typography, Zoom } from "@mui/material";
|
import { Button, Stack, Typography, Zoom } from "@mui/material";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
const Page = ({ searchParams }) => {
|
const Page = ({ searchParams }) => {
|
||||||
const { getUser } = useAuth();
|
const { getUser } = useAuth();
|
||||||
const { username } = searchParams;
|
const { username } = searchParams;
|
||||||
const [login, setLogin] = useState(0);
|
const [login, setLogin] = useState(0);
|
||||||
const request = useRequest();
|
const request = useRequest();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const login = async () => {
|
const login = async () => {
|
||||||
try {
|
try {
|
||||||
await request(`${GET_LOGIN_ROUTE}?username=${username}`);
|
await request(`${GET_LOGIN_ROUTE}?username=${username}`);
|
||||||
await getUser();
|
await getUser();
|
||||||
setLogin(1);
|
setLogin(1);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setLogin(2);
|
setLogin(2);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
login();
|
login();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const retry = async () => {
|
const retry = async () => {
|
||||||
setLogin(0);
|
setLogin(0);
|
||||||
try {
|
try {
|
||||||
await request(`${GET_LOGIN_ROUTE}?username=${username}`);
|
await request(`${GET_LOGIN_ROUTE}?username=${username}`);
|
||||||
await getUser();
|
await getUser();
|
||||||
setLogin(1);
|
setLogin(1);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setLogin(2);
|
setLogin(2);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack alignItems={"center"} justifyContent={"center"} sx={{ height: "100%" }} spacing={2}>
|
<Stack alignItems={"center"} justifyContent={"center"} sx={{ height: "100%" }} spacing={2}>
|
||||||
<Typography variant="h5">
|
<Typography variant="h5">
|
||||||
{login === 0
|
{login === 0
|
||||||
? "درحال دریافت مجوز برای ارتباط با سرور..."
|
? "درحال دریافت مجوز برای ارتباط با سرور..."
|
||||||
: login === 1
|
: login === 1
|
||||||
? "ارتباط با سرور برقرار شد."
|
? "ارتباط با سرور برقرار شد."
|
||||||
: "ارتباط با سرور برقرار نشد. مشکلی وجود دارد."}
|
: "ارتباط با سرور برقرار نشد. مشکلی وجود دارد."}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Zoom in={login === 1}>
|
<Zoom in={login === 1}>
|
||||||
<Button component={Link} href="/">
|
<Button component={Link} href="/">
|
||||||
ورود به سامانه
|
ورود به سامانه
|
||||||
</Button>
|
</Button>
|
||||||
</Zoom>
|
</Zoom>
|
||||||
<Zoom in={login === 2}>
|
<Zoom in={login === 2}>
|
||||||
<Button onClick={retry}>تلاش مجدد</Button>
|
<Button onClick={retry}>تلاش مجدد</Button>
|
||||||
</Zoom>
|
</Zoom>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { Box, Stack, Typography } from "@mui/material";
|
import { Box, Stack, Typography } from "@mui/material";
|
||||||
import SvgNotFound from "@/core/components/svgs/SvgNotFound";
|
import SvgNotFound from "@/core/components/svgs/SvgNotFound";
|
||||||
|
|
||||||
export default function NotFound() {
|
export default function NotFound() {
|
||||||
return (
|
return (
|
||||||
<Stack sx={{ height: "100%" }} justifyContent={"center"} alignItems={"center"} spacing={2}>
|
<Stack sx={{ height: "100%" }} justifyContent={"center"} alignItems={"center"} spacing={2}>
|
||||||
<Box>
|
<Box>
|
||||||
<SvgNotFound width={200} height={200} />
|
<SvgNotFound width={200} height={200} />
|
||||||
</Box>
|
</Box>
|
||||||
<Typography variant={"body1"} sx={{ color: "primary.main" }}>
|
<Typography variant={"body1"} sx={{ color: "primary.main" }}>
|
||||||
صفحه موردنظر یافت نشد ...
|
صفحه موردنظر یافت نشد ...
|
||||||
</Typography>
|
</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
|
|
||||||
function Page() {
|
function Page() {
|
||||||
redirect("/dashboard", "replace");
|
redirect("/dashboard", "replace");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Page;
|
export default Page;
|
||||||
|
|||||||
@@ -1,40 +1,40 @@
|
|||||||
import cacheProviderRtl from "@/core/utils/cacheRtl";
|
import cacheProviderRtl from "@/core/utils/cacheRtl";
|
||||||
import { CssBaseline, GlobalStyles, ThemeProvider } from "@mui/material";
|
import { CssBaseline, GlobalStyles, ThemeProvider } from "@mui/material";
|
||||||
import theme from "@/core/utils/theme";
|
import theme from "@/core/utils/theme";
|
||||||
import { AppRouterCacheProvider } from "@mui/material-nextjs/v14-appRouter";
|
import { AppRouterCacheProvider } from "@mui/material-nextjs/v14-appRouter";
|
||||||
import "@/assets/scss/global.scss";
|
import "@/assets/scss/global.scss";
|
||||||
import { ToastContainer } from "react-toastify";
|
import { ToastContainer } from "react-toastify";
|
||||||
|
|
||||||
const Template = ({ children }) => {
|
const Template = ({ children }) => {
|
||||||
return (
|
return (
|
||||||
<AppRouterCacheProvider CacheProvider={cacheProviderRtl} options={{ enableCssLayer: true }}>
|
<AppRouterCacheProvider CacheProvider={cacheProviderRtl} options={{ enableCssLayer: true }}>
|
||||||
<ThemeProvider theme={theme}>
|
<ThemeProvider theme={theme}>
|
||||||
<GlobalStyles
|
<GlobalStyles
|
||||||
styles={{
|
styles={{
|
||||||
"*": {
|
"*": {
|
||||||
scrollbarWidth: "thin",
|
scrollbarWidth: "thin",
|
||||||
scrollbarColor: `#155175 transparent`,
|
scrollbarColor: `#155175 transparent`,
|
||||||
},
|
},
|
||||||
"*&::-webkit-scrollbar": {
|
"*&::-webkit-scrollbar": {
|
||||||
width: "4px",
|
width: "4px",
|
||||||
},
|
},
|
||||||
"*&::-webkit-scrollbar-track": {
|
"*&::-webkit-scrollbar-track": {
|
||||||
boxShadow: "inset 0 0 5px #fff",
|
boxShadow: "inset 0 0 5px #fff",
|
||||||
borderRadius: "4px",
|
borderRadius: "4px",
|
||||||
},
|
},
|
||||||
"*&::-webkit-scrollbar-thumb": {
|
"*&::-webkit-scrollbar-thumb": {
|
||||||
background: "#155175",
|
background: "#155175",
|
||||||
borderRadius: "4px",
|
borderRadius: "4px",
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<CssBaseline />
|
<CssBaseline />
|
||||||
{children}
|
{children}
|
||||||
<ToastContainer rtl containerId="filtering" closeButton={false} />
|
<ToastContainer rtl containerId="filtering" closeButton={false} />
|
||||||
<ToastContainer rtl containerId="request_data" />
|
<ToastContainer rtl containerId="request_data" />
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
</AppRouterCacheProvider>
|
</AppRouterCacheProvider>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Template;
|
export default Template;
|
||||||
|
|||||||
@@ -1,190 +1,190 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Name: IRAN Sans-Serif Font
|
* Name: IRAN Sans-Serif Font
|
||||||
* Version: 5.0
|
* Version: 5.0
|
||||||
* Author: Moslem Ebrahimi (moslemebrahimi.com)
|
* Author: Moslem Ebrahimi (moslemebrahimi.com)
|
||||||
* Created on: Dec 25, 2012
|
* Created on: Dec 25, 2012
|
||||||
* Updated on: Sep 01, 2017
|
* Updated on: Sep 01, 2017
|
||||||
* Website: http://fontiran.com
|
* Website: http://fontiran.com
|
||||||
* Copyright: Commercial/Proprietary Software
|
* Copyright: Commercial/Proprietary Software
|
||||||
--------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------
|
||||||
فونت های ایران سن سریف یک نرم افزار مالکیتی محسوب می شود. جهت آگاهی از قوانین استفاده از این فونت ها لطفا به وب سایت (فونت ایران دات کام) مراجعه نمایید
|
فونت های ایران سن سریف یک نرم افزار مالکیتی محسوب می شود. جهت آگاهی از قوانین استفاده از این فونت ها لطفا به وب سایت (فونت ایران دات کام) مراجعه نمایید
|
||||||
--------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------
|
||||||
IRAN Sans-serif fonts are considered a proprietary software. To gain information about the laws regarding the use of these fonts, please visit www.fontiran.com
|
IRAN Sans-serif fonts are considered a proprietary software. To gain information about the laws regarding the use of these fonts, please visit www.fontiran.com
|
||||||
--------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------
|
||||||
This set of fonts are used in this project under the license: (.....)
|
This set of fonts are used in this project under the license: (.....)
|
||||||
--------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: IRANSansFaNum;
|
font-family: IRANSansFaNum;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
src: url("../fonts/eot/IRANSansWeb(FaNum)_Black.eot");
|
src: url("../fonts/eot/IRANSansWeb(FaNum)_Black.eot");
|
||||||
src:
|
src:
|
||||||
url("../fonts/eot/IRANSansWeb(FaNum)_Black.eot?#iefix") format("embedded-opentype"),
|
url("../fonts/eot/IRANSansWeb(FaNum)_Black.eot?#iefix") format("embedded-opentype"),
|
||||||
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb(FaNum)_Black.woff2") format("woff2"),
|
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb(FaNum)_Black.woff2") format("woff2"),
|
||||||
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb(FaNum)_Black.woff") format("woff"),
|
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb(FaNum)_Black.woff") format("woff"),
|
||||||
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb(FaNum)_Black.ttf") format("truetype");
|
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb(FaNum)_Black.ttf") format("truetype");
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: IRANSansFaNum;
|
font-family: IRANSansFaNum;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
src: url("../fonts/eot/IRANSansWeb(FaNum)_Bold.eot");
|
src: url("../fonts/eot/IRANSansWeb(FaNum)_Bold.eot");
|
||||||
src:
|
src:
|
||||||
url("../fonts/eot/IRANSansWeb(FaNum)_Bold.eot?#iefix") format("embedded-opentype"),
|
url("../fonts/eot/IRANSansWeb(FaNum)_Bold.eot?#iefix") format("embedded-opentype"),
|
||||||
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb(FaNum)_Bold.woff2") format("woff2"),
|
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb(FaNum)_Bold.woff2") format("woff2"),
|
||||||
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb(FaNum)_Bold.woff") format("woff"),
|
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb(FaNum)_Bold.woff") format("woff"),
|
||||||
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb(FaNum)_Bold.ttf") format("truetype");
|
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb(FaNum)_Bold.ttf") format("truetype");
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: IRANSansFaNum;
|
font-family: IRANSansFaNum;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
src: url("../fonts/eot/IRANSansWeb(FaNum)_Medium.eot");
|
src: url("../fonts/eot/IRANSansWeb(FaNum)_Medium.eot");
|
||||||
src:
|
src:
|
||||||
url("../fonts/eot/IRANSansWeb(FaNum)_Medium.eot?#iefix") format("embedded-opentype"),
|
url("../fonts/eot/IRANSansWeb(FaNum)_Medium.eot?#iefix") format("embedded-opentype"),
|
||||||
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb(FaNum)_Medium.woff2") format("woff2"),
|
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb(FaNum)_Medium.woff2") format("woff2"),
|
||||||
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb(FaNum)_Medium.woff") format("woff"),
|
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb(FaNum)_Medium.woff") format("woff"),
|
||||||
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb(FaNum)_Medium.ttf") format("truetype");
|
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb(FaNum)_Medium.ttf") format("truetype");
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: IRANSansFaNum;
|
font-family: IRANSansFaNum;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
src: url("../fonts/eot/IRANSansWeb(FaNum)_Light.eot");
|
src: url("../fonts/eot/IRANSansWeb(FaNum)_Light.eot");
|
||||||
src:
|
src:
|
||||||
url("../fonts/eot/IRANSansWeb(FaNum)_Light.eot?#iefix") format("embedded-opentype"),
|
url("../fonts/eot/IRANSansWeb(FaNum)_Light.eot?#iefix") format("embedded-opentype"),
|
||||||
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb(FaNum)_Light.woff2") format("woff2"),
|
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb(FaNum)_Light.woff2") format("woff2"),
|
||||||
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb(FaNum)_Light.woff") format("woff"),
|
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb(FaNum)_Light.woff") format("woff"),
|
||||||
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb(FaNum)_Light.ttf") format("truetype");
|
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb(FaNum)_Light.ttf") format("truetype");
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: IRANSansFaNum;
|
font-family: IRANSansFaNum;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 200;
|
font-weight: 200;
|
||||||
src: url("../fonts/eot/IRANSansWeb(FaNum)_UltraLight.eot");
|
src: url("../fonts/eot/IRANSansWeb(FaNum)_UltraLight.eot");
|
||||||
src:
|
src:
|
||||||
url("../fonts/eot/IRANSansWeb(FaNum)_UltraLight.eot?#iefix") format("embedded-opentype"),
|
url("../fonts/eot/IRANSansWeb(FaNum)_UltraLight.eot?#iefix") format("embedded-opentype"),
|
||||||
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb(FaNum)_UltraLight.woff2") format("woff2"),
|
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb(FaNum)_UltraLight.woff2") format("woff2"),
|
||||||
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb(FaNum)_UltraLight.woff") format("woff"),
|
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb(FaNum)_UltraLight.woff") format("woff"),
|
||||||
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb(FaNum)_UltraLight.ttf") format("truetype");
|
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb(FaNum)_UltraLight.ttf") format("truetype");
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: IRANSansFaNum;
|
font-family: IRANSansFaNum;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
src: url("../fonts/eot/IRANSansWeb(FaNum).eot");
|
src: url("../fonts/eot/IRANSansWeb(FaNum).eot");
|
||||||
src:
|
src:
|
||||||
url("../fonts/eot/IRANSansWeb(FaNum).eot?#iefix") format("embedded-opentype"),
|
url("../fonts/eot/IRANSansWeb(FaNum).eot?#iefix") format("embedded-opentype"),
|
||||||
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb(FaNum).woff2") format("woff2"),
|
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb(FaNum).woff2") format("woff2"),
|
||||||
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb(FaNum).woff") format("woff"),
|
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb(FaNum).woff") format("woff"),
|
||||||
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb(FaNum).ttf") format("truetype");
|
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb(FaNum).ttf") format("truetype");
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: IRANSans;
|
font-family: IRANSans;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
src: url("../fonts/eot/IRANSansWeb_Black.eot");
|
src: url("../fonts/eot/IRANSansWeb_Black.eot");
|
||||||
src:
|
src:
|
||||||
url("../fonts/eot/IRANSansWeb_Black.eot?#iefix") format("embedded-opentype"),
|
url("../fonts/eot/IRANSansWeb_Black.eot?#iefix") format("embedded-opentype"),
|
||||||
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb_Black.woff2") format("woff2"),
|
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb_Black.woff2") format("woff2"),
|
||||||
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb_Black.woff") format("woff"),
|
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb_Black.woff") format("woff"),
|
||||||
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb_Black.ttf") format("truetype");
|
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb_Black.ttf") format("truetype");
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: IRANSans;
|
font-family: IRANSans;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
src: url("../fonts/eot/IRANSansWeb_Bold.eot");
|
src: url("../fonts/eot/IRANSansWeb_Bold.eot");
|
||||||
src:
|
src:
|
||||||
url("../fonts/eot/IRANSansWeb_Bold.eot?#iefix") format("embedded-opentype"),
|
url("../fonts/eot/IRANSansWeb_Bold.eot?#iefix") format("embedded-opentype"),
|
||||||
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb_Bold.woff2") format("woff2"),
|
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb_Bold.woff2") format("woff2"),
|
||||||
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb_Bold.woff") format("woff"),
|
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb_Bold.woff") format("woff"),
|
||||||
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb_Bold.ttf") format("truetype");
|
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb_Bold.ttf") format("truetype");
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: IRANSans;
|
font-family: IRANSans;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
src: url("../fonts/eot/IRANSansWeb_Medium.eot");
|
src: url("../fonts/eot/IRANSansWeb_Medium.eot");
|
||||||
src:
|
src:
|
||||||
url("../fonts/eot/IRANSansWeb_Medium.eot?#iefix") format("embedded-opentype"),
|
url("../fonts/eot/IRANSansWeb_Medium.eot?#iefix") format("embedded-opentype"),
|
||||||
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb_Medium.woff2") format("woff2"),
|
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb_Medium.woff2") format("woff2"),
|
||||||
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb_Medium.woff") format("woff"),
|
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb_Medium.woff") format("woff"),
|
||||||
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb_Medium.ttf") format("truetype");
|
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb_Medium.ttf") format("truetype");
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: IRANSans;
|
font-family: IRANSans;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
src: url("../fonts/eot/IRANSansWeb_Light.eot");
|
src: url("../fonts/eot/IRANSansWeb_Light.eot");
|
||||||
src:
|
src:
|
||||||
url("../fonts/eot/IRANSansWeb_Light.eot?#iefix") format("embedded-opentype"),
|
url("../fonts/eot/IRANSansWeb_Light.eot?#iefix") format("embedded-opentype"),
|
||||||
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb_Light.woff2") format("woff2"),
|
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb_Light.woff2") format("woff2"),
|
||||||
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb_Light.woff") format("woff"),
|
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb_Light.woff") format("woff"),
|
||||||
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb_Light.ttf") format("truetype");
|
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb_Light.ttf") format("truetype");
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: IRANSans;
|
font-family: IRANSans;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 200;
|
font-weight: 200;
|
||||||
src: url("../fonts/eot/IRANSansWeb_UltraLight.eot");
|
src: url("../fonts/eot/IRANSansWeb_UltraLight.eot");
|
||||||
src:
|
src:
|
||||||
url("../fonts/eot/IRANSansWeb_UltraLight.eot?#iefix") format("embedded-opentype"),
|
url("../fonts/eot/IRANSansWeb_UltraLight.eot?#iefix") format("embedded-opentype"),
|
||||||
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb_UltraLight.woff2") format("woff2"),
|
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb_UltraLight.woff2") format("woff2"),
|
||||||
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb_UltraLight.woff") format("woff"),
|
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb_UltraLight.woff") format("woff"),
|
||||||
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb_UltraLight.ttf") format("truetype");
|
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb_UltraLight.ttf") format("truetype");
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: IRANSans;
|
font-family: IRANSans;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
src: url("../fonts/eot/IRANSansWeb.eot");
|
src: url("../fonts/eot/IRANSansWeb.eot");
|
||||||
src:
|
src:
|
||||||
url("../fonts/eot/IRANSansWeb.eot?#iefix") format("embedded-opentype"),
|
url("../fonts/eot/IRANSansWeb.eot?#iefix") format("embedded-opentype"),
|
||||||
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb.woff2") format("woff2"),
|
/* IE6-8 */ url("../fonts/woff2/IRANSansWeb.woff2") format("woff2"),
|
||||||
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb.woff") format("woff"),
|
/* FF39+,Chrome36+, Opera24+*/ url("../fonts/woff/IRANSansWeb.woff") format("woff"),
|
||||||
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb.ttf") format("truetype");
|
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/IRANSansWeb.ttf") format("truetype");
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: Parastoo;
|
font-family: Parastoo;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
src: url("../fonts/eot/Parastoo.eot");
|
src: url("../fonts/eot/Parastoo.eot");
|
||||||
src:
|
src:
|
||||||
url("../fonts/eot/Parastoo.eot?#iefix") format("embedded-opentype"),
|
url("../fonts/eot/Parastoo.eot?#iefix") format("embedded-opentype"),
|
||||||
/* IE6-8 */ url("../fonts/woff/Parastoo.woff") format("woff"),
|
/* IE6-8 */ url("../fonts/woff/Parastoo.woff") format("woff"),
|
||||||
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/Parastoo.ttf") format("truetype");
|
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/Parastoo.ttf") format("truetype");
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: Parastoo;
|
font-family: Parastoo;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
src: url("../fonts/eot/Parastoo-Bold.eot");
|
src: url("../fonts/eot/Parastoo-Bold.eot");
|
||||||
src:
|
src:
|
||||||
url("../fonts/eot/Parastoo-Bold.eot?#iefix") format("embedded-opentype"),
|
url("../fonts/eot/Parastoo-Bold.eot?#iefix") format("embedded-opentype"),
|
||||||
/* IE6-8 */ url("../fonts/woff/Parastoo-Bold.woff") format("woff"),
|
/* IE6-8 */ url("../fonts/woff/Parastoo-Bold.woff") format("woff"),
|
||||||
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/Parastoo-Bold.ttf") format("truetype");
|
/* FF3.6+, IE9, Chrome6+, Saf5.1+*/ url("../fonts/ttf/Parastoo-Bold.ttf") format("truetype");
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: Bnazanin;
|
font-family: Bnazanin;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
src: url("../fonts/ttf/BNazanin.ttf") format("truetype");
|
src: url("../fonts/ttf/BNazanin.ttf") format("truetype");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
@import "fontiran";
|
@import "fontiran";
|
||||||
@import "leaflet/dist/leaflet.css";
|
@import "leaflet/dist/leaflet.css";
|
||||||
@import "react-toastify/dist/ReactToastify.css";
|
@import "leaflet-draw/dist/leaflet.draw.css";
|
||||||
@import "./map-styles.scss";
|
@import "react-toastify/dist/ReactToastify.css";
|
||||||
|
@import "./map-styles.scss";
|
||||||
.filter-toast {
|
|
||||||
box-shadow:
|
.filter-toast {
|
||||||
rgba(50, 50, 93, 0.25) 0px 13px 27px -5px,
|
box-shadow:
|
||||||
rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
|
rgba(50, 50, 93, 0.25) 0px 13px 27px -5px,
|
||||||
background-color: #d0dfe8;
|
rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
|
||||||
}
|
background-color: #d0dfe8;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,9 +1,29 @@
|
|||||||
.custom-marker-cluster {
|
.custom-marker-cluster {
|
||||||
font-family: IRANSansFaNum;
|
font-family: IRANSansFaNum;
|
||||||
background-color: rgba(51, 181, 229, 0.6);
|
background-color: rgba(51, 181, 229, 0.6);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.leaflet-draw {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-draw-tooltip {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
.leaflet-draw-tooltip::before {
|
||||||
|
border-left: 6px solid black;
|
||||||
|
border-left-color: rgba(0, 0, 0, 0.5);
|
||||||
|
border-right: 0;
|
||||||
|
right: -7px;
|
||||||
|
left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-editing-icon {
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Button, IconButton, useMediaQuery } from "@mui/material";
|
import { Button, IconButton, useMediaQuery } from "@mui/material";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { AddCircle } from "@mui/icons-material";
|
import { AddCircle } from "@mui/icons-material";
|
||||||
import CandUAzmayesh from "@/components/dashboard/azmayesh/Forms/CandUAzmayesh";
|
import CandUAzmayesh from "@/components/dashboard/azmayesh/Forms/CandUAzmayesh";
|
||||||
|
|
||||||
const AzmayeshCreate = ({ mutate }) => {
|
const AzmayeshCreate = ({ mutate }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
const handleOpen = () => {
|
const handleOpen = () => {
|
||||||
setOpen(true);
|
setOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isMobile ? (
|
{isMobile ? (
|
||||||
<IconButton aria-label="ثبت آزمایش جدید" color="primary" onClick={handleOpen}>
|
<IconButton aria-label="ثبت آزمایش جدید" color="primary" onClick={handleOpen}>
|
||||||
<AddCircle sx={{ fontSize: "25px" }} />
|
<AddCircle sx={{ fontSize: "25px" }} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
) : (
|
) : (
|
||||||
<Button variant="contained" color="primary" startIcon={<AddCircle />} onClick={handleOpen}>
|
<Button variant="contained" color="primary" startIcon={<AddCircle />} onClick={handleOpen}>
|
||||||
ثبت آزمایش
|
ثبت آزمایش
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{open && <CandUAzmayesh open={open} setOpen={setOpen} mutate={mutate} />}
|
{open && <CandUAzmayesh open={open} setOpen={setOpen} mutate={mutate} />}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default AzmayeshCreate;
|
export default AzmayeshCreate;
|
||||||
|
|||||||
@@ -1,216 +1,216 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { Box, Typography } from "@mui/material";
|
import { Box, Typography } from "@mui/material";
|
||||||
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
|
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
|
||||||
import Toolbar from "./Toolbar";
|
import Toolbar from "./Toolbar";
|
||||||
import { GET_AZMAYESH_LIST } from "@/core/utils/routes";
|
import { GET_AZMAYESH_LIST } from "@/core/utils/routes";
|
||||||
import ShowLocation from "./ShowLocation";
|
import ShowLocation from "./ShowLocation";
|
||||||
import moment from "jalali-moment";
|
import moment from "jalali-moment";
|
||||||
import RowActions from "./RowActions";
|
import RowActions from "./RowActions";
|
||||||
import ShowSampleOfAzmayesh from "./RowActions/ShowSampleOfAzmayesh";
|
import ShowSampleOfAzmayesh from "./RowActions/ShowSampleOfAzmayesh";
|
||||||
|
|
||||||
const AzmayeshList = () => {
|
const AzmayeshList = () => {
|
||||||
const columns = useMemo(
|
const columns = useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
accessorKey: "id",
|
accessorKey: "id",
|
||||||
header: "کد یکتا",
|
header: "کد یکتا",
|
||||||
id: "id",
|
id: "id",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
filterMode: "notEquals",
|
filterMode: "notEquals",
|
||||||
grow: false,
|
grow: false,
|
||||||
size: 100,
|
size: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "province_name",
|
accessorKey: "province_name",
|
||||||
header: "استان",
|
header: "استان",
|
||||||
id: "province_name",
|
id: "province_name",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
filterMode: "notEquals",
|
filterMode: "notEquals",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "azmayesh_type_name",
|
accessorKey: "azmayesh_type_name",
|
||||||
header: "نوع آزمایش",
|
header: "نوع آزمایش",
|
||||||
id: "azmayesh_type_name",
|
id: "azmayesh_type_name",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
filterMode: "notEquals",
|
filterMode: "notEquals",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "contract_subitem_id",
|
accessorKey: "contract_subitem_id",
|
||||||
header: "کد یکتا پروژه",
|
header: "کد یکتا پروژه",
|
||||||
id: "contract_subitem_id",
|
id: "contract_subitem_id",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
filterMode: "equals",
|
filterMode: "equals",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "project_name",
|
accessorKey: "project_name",
|
||||||
header: "پروژه",
|
header: "پروژه",
|
||||||
id: "project_name",
|
id: "project_name",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
filterMode: "equals",
|
filterMode: "equals",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "location",
|
accessorKey: "location",
|
||||||
header: "نمایش مختصات",
|
header: "نمایش مختصات",
|
||||||
id: "location",
|
id: "location",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
filterMode: "equals",
|
filterMode: "equals",
|
||||||
grow: false,
|
grow: false,
|
||||||
size: 100,
|
size: 100,
|
||||||
muiTableBodyCellProps: {
|
muiTableBodyCellProps: {
|
||||||
sx: {
|
sx: {
|
||||||
borderLeft: "1px solid #e1e1e1",
|
borderLeft: "1px solid #e1e1e1",
|
||||||
py: 0,
|
py: 0,
|
||||||
"&:first-of-type": {
|
"&:first-of-type": {
|
||||||
borderLeft: "unset",
|
borderLeft: "unset",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Cell: ({ row }) => <ShowLocation lat={row.original.lat} lng={row.original.lng} />,
|
Cell: ({ row }) => <ShowLocation lat={row.original.lat} lng={row.original.lng} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "employer",
|
accessorKey: "employer",
|
||||||
header: "کارفرما",
|
header: "کارفرما",
|
||||||
id: "employer",
|
id: "employer",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
filterMode: "equals",
|
filterMode: "equals",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "consultant",
|
accessorKey: "consultant",
|
||||||
header: "مشاور",
|
header: "مشاور",
|
||||||
id: "consultant",
|
id: "consultant",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
filterMode: "equals",
|
filterMode: "equals",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "contractor",
|
accessorKey: "contractor",
|
||||||
header: "پیمانکار",
|
header: "پیمانکار",
|
||||||
id: "contractor",
|
id: "contractor",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
filterMode: "equals",
|
filterMode: "equals",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "applicant",
|
accessorKey: "applicant",
|
||||||
header: "متقاضی",
|
header: "متقاضی",
|
||||||
id: "applicant",
|
id: "applicant",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
filterMode: "equals",
|
filterMode: "equals",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "work_number",
|
accessorKey: "work_number",
|
||||||
header: "شماره کار",
|
header: "شماره کار",
|
||||||
id: "work_number",
|
id: "work_number",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
filterMode: "equals",
|
filterMode: "equals",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "request_number",
|
accessorKey: "request_number",
|
||||||
header: "شماره درخواست",
|
header: "شماره درخواست",
|
||||||
id: "request_number",
|
id: "request_number",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
filterMode: "equals",
|
filterMode: "equals",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "request_date",
|
accessorKey: "request_date",
|
||||||
header: "تاریخ درخواست",
|
header: "تاریخ درخواست",
|
||||||
id: "request_date",
|
id: "request_date",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "date",
|
datatype: "date",
|
||||||
filterMode: "equals",
|
filterMode: "equals",
|
||||||
grow: false,
|
grow: false,
|
||||||
size: 100,
|
size: 100,
|
||||||
Cell: ({ renderedCellValue }) => (
|
Cell: ({ renderedCellValue }) => (
|
||||||
<Typography variant="body2">
|
<Typography variant="body2">
|
||||||
{renderedCellValue ? moment(renderedCellValue).locale("fa").format("YYYY/MM/DD") : "-"}
|
{renderedCellValue ? moment(renderedCellValue).locale("fa").format("YYYY/MM/DD") : "-"}
|
||||||
</Typography>
|
</Typography>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "report_date",
|
accessorKey: "report_date",
|
||||||
header: "تاریخ گزارش",
|
header: "تاریخ گزارش",
|
||||||
id: "report_date",
|
id: "report_date",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "date",
|
datatype: "date",
|
||||||
filterMode: "equals",
|
filterMode: "equals",
|
||||||
grow: false,
|
grow: false,
|
||||||
size: 100,
|
size: 100,
|
||||||
Cell: ({ renderedCellValue }) => (
|
Cell: ({ renderedCellValue }) => (
|
||||||
<Typography variant="body2">
|
<Typography variant="body2">
|
||||||
{renderedCellValue ? moment(renderedCellValue).locale("fa").format("YYYY/MM/DD") : "-"}
|
{renderedCellValue ? moment(renderedCellValue).locale("fa").format("YYYY/MM/DD") : "-"}
|
||||||
</Typography>
|
</Typography>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "updated_at",
|
accessorKey: "updated_at",
|
||||||
header: "تاریخ بروزرسانی",
|
header: "تاریخ بروزرسانی",
|
||||||
id: "updated_at",
|
id: "updated_at",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "date",
|
datatype: "date",
|
||||||
filterMode: "equals",
|
filterMode: "equals",
|
||||||
grow: false,
|
grow: false,
|
||||||
size: 100,
|
size: 100,
|
||||||
Cell: ({ renderedCellValue }) => (
|
Cell: ({ renderedCellValue }) => (
|
||||||
<Typography variant="body2">
|
<Typography variant="body2">
|
||||||
{renderedCellValue ? moment(renderedCellValue).locale("fa").format("HH:mm | YYYY/MM/DD") : "-"}
|
{renderedCellValue ? moment(renderedCellValue).locale("fa").format("HH:mm | YYYY/MM/DD") : "-"}
|
||||||
</Typography>
|
</Typography>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "samples",
|
accessorKey: "samples",
|
||||||
header: "نمونه ها",
|
header: "نمونه ها",
|
||||||
id: "samples",
|
id: "samples",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
filterMode: "equals",
|
filterMode: "equals",
|
||||||
grow: false,
|
grow: false,
|
||||||
size: 100,
|
size: 100,
|
||||||
muiTableBodyCellProps: {
|
muiTableBodyCellProps: {
|
||||||
sx: {
|
sx: {
|
||||||
borderLeft: "1px solid #e1e1e1",
|
borderLeft: "1px solid #e1e1e1",
|
||||||
py: 0,
|
py: 0,
|
||||||
"&:first-of-type": {
|
"&:first-of-type": {
|
||||||
borderLeft: "unset",
|
borderLeft: "unset",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Cell: ({ row }) => <ShowSampleOfAzmayesh rowData={row.original} />,
|
Cell: ({ row }) => <ShowSampleOfAzmayesh rowData={row.original} />,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
||||||
<DataTableWithAuth
|
<DataTableWithAuth
|
||||||
table_title={"لیست آزمایشات"}
|
table_title={"لیست آزمایشات"}
|
||||||
need_filter={false}
|
need_filter={false}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
table_url={GET_AZMAYESH_LIST}
|
table_url={GET_AZMAYESH_LIST}
|
||||||
page_name={"azmayesh"}
|
page_name={"azmayesh"}
|
||||||
table_name={"azmayeshList"}
|
table_name={"azmayeshList"}
|
||||||
TableToolbar={Toolbar}
|
TableToolbar={Toolbar}
|
||||||
enableRowActions
|
enableRowActions
|
||||||
positionActionsColumn={"last"}
|
positionActionsColumn={"last"}
|
||||||
RowActions={RowActions}
|
RowActions={RowActions}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default AzmayeshList;
|
export default AzmayeshList;
|
||||||
|
|||||||
@@ -1,213 +1,213 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Marker, useMapEvents } from "react-leaflet";
|
import { Marker, useMapEvents } from "react-leaflet";
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import L from "leaflet";
|
import L from "leaflet";
|
||||||
import AzmayeshIcon from "@/assets/images/examine_marker.png";
|
import AzmayeshIcon from "@/assets/images/examine_marker.png";
|
||||||
import AzmayeshActiveIcon from "@/assets/images/examine_marker_active.png";
|
import AzmayeshActiveIcon from "@/assets/images/examine_marker_active.png";
|
||||||
import {
|
import {
|
||||||
Alert,
|
Alert,
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
FormControl,
|
FormControl,
|
||||||
InputAdornment,
|
InputAdornment,
|
||||||
InputLabel,
|
InputLabel,
|
||||||
OutlinedInput,
|
OutlinedInput,
|
||||||
Stack,
|
Stack,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Zoom,
|
Zoom,
|
||||||
useMediaQuery,
|
useMediaQuery,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import NewReleasesIcon from "@mui/icons-material/NewReleases";
|
import NewReleasesIcon from "@mui/icons-material/NewReleases";
|
||||||
import VerifiedIcon from "@mui/icons-material/Verified";
|
import VerifiedIcon from "@mui/icons-material/Verified";
|
||||||
import EditIcon from "@mui/icons-material/Edit";
|
import EditIcon from "@mui/icons-material/Edit";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
|
|
||||||
const MAX_ZOOM_FOR_MARKER = 13;
|
const MAX_ZOOM_FOR_MARKER = 13;
|
||||||
|
|
||||||
const CandUChooseLocation = ({ mapBoxData, setMapBoxData }) => {
|
const CandUChooseLocation = ({ mapBoxData, setMapBoxData }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
||||||
const [enableSend, setEnableSend] = useState(false);
|
const [enableSend, setEnableSend] = useState(false);
|
||||||
|
|
||||||
const mapAzmayeshMarker = useRef();
|
const mapAzmayeshMarker = useRef();
|
||||||
const defaultIconSize = [35, 35];
|
const defaultIconSize = [35, 35];
|
||||||
const createCustomIcon = (size, iconUrl) => {
|
const createCustomIcon = (size, iconUrl) => {
|
||||||
return L.icon({
|
return L.icon({
|
||||||
iconUrl: iconUrl,
|
iconUrl: iconUrl,
|
||||||
iconSize: size,
|
iconSize: size,
|
||||||
iconAnchor: [size[0] / 2, size[1]],
|
iconAnchor: [size[0] / 2, size[1]],
|
||||||
popupAnchor: [0, -size[1]],
|
popupAnchor: [0, -size[1]],
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const map = useMapEvents({
|
const map = useMapEvents({
|
||||||
move(e) {
|
move(e) {
|
||||||
setEnableSend(e.target.getZoom() > MAX_ZOOM_FOR_MARKER);
|
setEnableSend(e.target.getZoom() > MAX_ZOOM_FOR_MARKER);
|
||||||
if (!mapBoxData) {
|
if (!mapBoxData) {
|
||||||
mapAzmayeshMarker.current.setLatLng(e.target.getCenter());
|
mapAzmayeshMarker.current.setLatLng(e.target.getCenter());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
movestart() {
|
movestart() {
|
||||||
if (!mapBoxData) {
|
if (!mapBoxData) {
|
||||||
mapAzmayeshMarker.current.setIcon(createCustomIcon([45, 45], AzmayeshIcon.src));
|
mapAzmayeshMarker.current.setIcon(createCustomIcon([45, 45], AzmayeshIcon.src));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
moveend() {
|
moveend() {
|
||||||
if (!mapBoxData) {
|
if (!mapBoxData) {
|
||||||
mapAzmayeshMarker.current.setIcon(createCustomIcon(defaultIconSize, AzmayeshIcon.src));
|
mapAzmayeshMarker.current.setIcon(createCustomIcon(defaultIconSize, AzmayeshIcon.src));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
zoom(e) {
|
zoom(e) {
|
||||||
setEnableSend(e.target.getZoom() > MAX_ZOOM_FOR_MARKER);
|
setEnableSend(e.target.getZoom() > MAX_ZOOM_FOR_MARKER);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!mapAzmayeshMarker.current) return;
|
if (!mapAzmayeshMarker.current) return;
|
||||||
if (mapBoxData) {
|
if (mapBoxData) {
|
||||||
mapAzmayeshMarker.current.setIcon(createCustomIcon([45, 45], AzmayeshActiveIcon.src));
|
mapAzmayeshMarker.current.setIcon(createCustomIcon([45, 45], AzmayeshActiveIcon.src));
|
||||||
mapAzmayeshMarker.current.setLatLng(mapBoxData);
|
mapAzmayeshMarker.current.setLatLng(mapBoxData);
|
||||||
map.setView(mapBoxData, 14);
|
map.setView(mapBoxData, 14);
|
||||||
} else {
|
} else {
|
||||||
mapAzmayeshMarker.current.setIcon(createCustomIcon(defaultIconSize, AzmayeshIcon.src));
|
mapAzmayeshMarker.current.setIcon(createCustomIcon(defaultIconSize, AzmayeshIcon.src));
|
||||||
}
|
}
|
||||||
}, [mapBoxData, mapAzmayeshMarker.current]);
|
}, [mapBoxData, mapAzmayeshMarker.current]);
|
||||||
|
|
||||||
const handleMarkerClick = () => {
|
const handleMarkerClick = () => {
|
||||||
if (!enableSend) return;
|
if (!enableSend) return;
|
||||||
if (!mapBoxData) {
|
if (!mapBoxData) {
|
||||||
setMapBoxData({
|
setMapBoxData({
|
||||||
lat: mapAzmayeshMarker.current.getLatLng().lat,
|
lat: mapAzmayeshMarker.current.getLatLng().lat,
|
||||||
lng: mapAzmayeshMarker.current.getLatLng().lng,
|
lng: mapAzmayeshMarker.current.getLatLng().lng,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleEditLocation = () => {
|
const handleEditLocation = () => {
|
||||||
setMapBoxData(null);
|
setMapBoxData(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Marker
|
<Marker
|
||||||
position={map.getCenter()}
|
position={map.getCenter()}
|
||||||
ref={mapAzmayeshMarker}
|
ref={mapAzmayeshMarker}
|
||||||
eventHandlers={{ click: handleMarkerClick }}
|
eventHandlers={{ click: handleMarkerClick }}
|
||||||
icon={L.divIcon({ className: "" })}
|
icon={L.divIcon({ className: "" })}
|
||||||
/>
|
/>
|
||||||
<Stack
|
<Stack
|
||||||
direction={"row"}
|
direction={"row"}
|
||||||
justifyContent={"center"}
|
justifyContent={"center"}
|
||||||
sx={{
|
sx={{
|
||||||
zIndex: "400",
|
zIndex: "400",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
top: 0,
|
top: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Zoom in={!enableSend}>
|
<Zoom in={!enableSend}>
|
||||||
<Alert sx={{ mt: 1, py: 0.5, px: 2, borderRadius: 2, border: 1 }} icon={false} color={"warning"}>
|
<Alert sx={{ mt: 1, py: 0.5, px: 2, borderRadius: 2, border: 1 }} icon={false} color={"warning"}>
|
||||||
برای ثبت محل آزمایش، لطفاً نقشه را بیشتر زوم کنید.
|
برای ثبت محل آزمایش، لطفاً نقشه را بیشتر زوم کنید.
|
||||||
</Alert>
|
</Alert>
|
||||||
</Zoom>
|
</Zoom>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack
|
<Stack
|
||||||
direction={"row"}
|
direction={"row"}
|
||||||
sx={{
|
sx={{
|
||||||
zIndex: "400",
|
zIndex: "400",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
background: "#ffffff94",
|
background: "#ffffff94",
|
||||||
flex: isMobile ? 1 : "",
|
flex: isMobile ? 1 : "",
|
||||||
m: 1,
|
m: 1,
|
||||||
p: 2,
|
p: 2,
|
||||||
borderRadius: 2,
|
borderRadius: 2,
|
||||||
boxShadow: "rgba(0, 0, 0, 0.24) 0px 3px 8px",
|
boxShadow: "rgba(0, 0, 0, 0.24) 0px 3px 8px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Stack sx={{ gap: 2 }}>
|
<Stack sx={{ gap: 2 }}>
|
||||||
<Tooltip title="با کلیک بر روی مارکر، محل آزمایش را انتخاب کنید" arrow>
|
<Tooltip title="با کلیک بر روی مارکر، محل آزمایش را انتخاب کنید" arrow>
|
||||||
<FormControl size="small" variant="outlined">
|
<FormControl size="small" variant="outlined">
|
||||||
<InputLabel sx={{ color: mapBoxData ? "success.main" : "" }} htmlFor="lat">
|
<InputLabel sx={{ color: mapBoxData ? "success.main" : "" }} htmlFor="lat">
|
||||||
طول جغرافیایی
|
طول جغرافیایی
|
||||||
</InputLabel>
|
</InputLabel>
|
||||||
<OutlinedInput
|
<OutlinedInput
|
||||||
id="lat"
|
id="lat"
|
||||||
type="text"
|
type="text"
|
||||||
size="small"
|
size="small"
|
||||||
readOnly
|
readOnly
|
||||||
sx={{
|
sx={{
|
||||||
"& .MuiOutlinedInput-notchedOutline": {
|
"& .MuiOutlinedInput-notchedOutline": {
|
||||||
borderColor: mapBoxData ? "success.main" : "",
|
borderColor: mapBoxData ? "success.main" : "",
|
||||||
},
|
},
|
||||||
color: mapBoxData ? "success.main" : "",
|
color: mapBoxData ? "success.main" : "",
|
||||||
}}
|
}}
|
||||||
value={mapBoxData ? `${mapBoxData.lat}` : ""}
|
value={mapBoxData ? `${mapBoxData.lat}` : ""}
|
||||||
endAdornment={
|
endAdornment={
|
||||||
<InputAdornment position="end">
|
<InputAdornment position="end">
|
||||||
{mapBoxData ? (
|
{mapBoxData ? (
|
||||||
<VerifiedIcon color="success" />
|
<VerifiedIcon color="success" />
|
||||||
) : (
|
) : (
|
||||||
<NewReleasesIcon color="error" />
|
<NewReleasesIcon color="error" />
|
||||||
)}
|
)}
|
||||||
</InputAdornment>
|
</InputAdornment>
|
||||||
}
|
}
|
||||||
label="طول جغرافیایی"
|
label="طول جغرافیایی"
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip title="با کلیک بر روی مارکر، محل آزمایش را انتخاب کنید" arrow>
|
<Tooltip title="با کلیک بر روی مارکر، محل آزمایش را انتخاب کنید" arrow>
|
||||||
<FormControl size="small" variant="outlined">
|
<FormControl size="small" variant="outlined">
|
||||||
<InputLabel sx={{ color: mapBoxData ? "success.main" : "" }} htmlFor="lng">
|
<InputLabel sx={{ color: mapBoxData ? "success.main" : "" }} htmlFor="lng">
|
||||||
عرض جغرافیایی
|
عرض جغرافیایی
|
||||||
</InputLabel>
|
</InputLabel>
|
||||||
<OutlinedInput
|
<OutlinedInput
|
||||||
id="lng"
|
id="lng"
|
||||||
type="text"
|
type="text"
|
||||||
size="small"
|
size="small"
|
||||||
readOnly
|
readOnly
|
||||||
sx={{
|
sx={{
|
||||||
"& .MuiOutlinedInput-notchedOutline": {
|
"& .MuiOutlinedInput-notchedOutline": {
|
||||||
borderColor: mapBoxData ? "success.main" : "",
|
borderColor: mapBoxData ? "success.main" : "",
|
||||||
},
|
},
|
||||||
color: mapBoxData ? "success.main" : "",
|
color: mapBoxData ? "success.main" : "",
|
||||||
}}
|
}}
|
||||||
value={mapBoxData ? `${mapBoxData.lng}` : ""}
|
value={mapBoxData ? `${mapBoxData.lng}` : ""}
|
||||||
endAdornment={
|
endAdornment={
|
||||||
<InputAdornment position="end">
|
<InputAdornment position="end">
|
||||||
{mapBoxData ? (
|
{mapBoxData ? (
|
||||||
<VerifiedIcon color="success" />
|
<VerifiedIcon color="success" />
|
||||||
) : (
|
) : (
|
||||||
<NewReleasesIcon color="error" />
|
<NewReleasesIcon color="error" />
|
||||||
)}
|
)}
|
||||||
</InputAdornment>
|
</InputAdornment>
|
||||||
}
|
}
|
||||||
label="عرض جغرافیایی"
|
label="عرض جغرافیایی"
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="primary"
|
color="primary"
|
||||||
disabled={!mapBoxData}
|
disabled={!mapBoxData}
|
||||||
startIcon={<EditIcon />}
|
startIcon={<EditIcon />}
|
||||||
onClick={handleEditLocation}
|
onClick={handleEditLocation}
|
||||||
>
|
>
|
||||||
ویرایش مختصات
|
ویرایش مختصات
|
||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default CandUChooseLocation;
|
export default CandUChooseLocation;
|
||||||
|
|||||||
@@ -1,373 +1,373 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Controller } from "react-hook-form";
|
import { Controller } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
Autocomplete,
|
Autocomplete,
|
||||||
CircularProgress,
|
CircularProgress,
|
||||||
FormControl,
|
FormControl,
|
||||||
FormHelperText,
|
FormHelperText,
|
||||||
Grid,
|
Grid,
|
||||||
IconButton,
|
IconButton,
|
||||||
InputAdornment,
|
InputAdornment,
|
||||||
InputLabel,
|
InputLabel,
|
||||||
OutlinedInput,
|
OutlinedInput,
|
||||||
TextField,
|
TextField,
|
||||||
Typography,
|
Typography,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import useAzmayesh from "@/lib/hooks/useAzmayesh";
|
import useAzmayesh from "@/lib/hooks/useAzmayesh";
|
||||||
import useProvinces from "@/lib/hooks/useProvince";
|
import useProvinces from "@/lib/hooks/useProvince";
|
||||||
import { LocalizationProvider, MobileDatePicker } from "@mui/x-date-pickers";
|
import { LocalizationProvider, MobileDatePicker } from "@mui/x-date-pickers";
|
||||||
import { AdapterDateFnsJalali } from "@mui/x-date-pickers/AdapterDateFnsJalali";
|
import { AdapterDateFnsJalali } from "@mui/x-date-pickers/AdapterDateFnsJalali";
|
||||||
import { faIR } from "@mui/x-date-pickers/locales";
|
import { faIR } from "@mui/x-date-pickers/locales";
|
||||||
import ClearIcon from "@mui/icons-material/Clear";
|
import ClearIcon from "@mui/icons-material/Clear";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
const CandUGeneralInfo = ({ control, register, setValue, errors }) => {
|
const CandUGeneralInfo = ({ control, register, setValue, errors }) => {
|
||||||
const { azmayeshes, errorAzmayeshes, loadingAzmayeshes } = useAzmayesh();
|
const { azmayeshes, errorAzmayeshes, loadingAzmayeshes } = useAzmayesh();
|
||||||
const { provinces, errorProvinces, loadingProvinces } = useProvinces();
|
const { provinces, errorProvinces, loadingProvinces } = useProvinces();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid container spacing={2}>
|
<Grid container spacing={2}>
|
||||||
<Grid item xs={12} md={6} sx={{ display: "flex", alignItems: "center", justifyContent: "center" }}>
|
<Grid item xs={12} md={6} sx={{ display: "flex", alignItems: "center", justifyContent: "center" }}>
|
||||||
<Controller
|
<Controller
|
||||||
name="azmayesh_type_id"
|
name="azmayesh_type_id"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
||||||
<FormControl error={!!errors.azmayesh_type_id} size="small" fullWidth variant="outlined">
|
<FormControl error={!!errors.azmayesh_type_id} size="small" fullWidth variant="outlined">
|
||||||
<InputLabel htmlFor="azmayesh_type_id" />
|
<InputLabel htmlFor="azmayesh_type_id" />
|
||||||
{errorAzmayeshes ? (
|
{errorAzmayeshes ? (
|
||||||
<Typography color={"red"} sx={{ display: "flex", alignItems: "center", gap: 2 }}>
|
<Typography color={"red"} sx={{ display: "flex", alignItems: "center", gap: 2 }}>
|
||||||
خطایی در دریافت لیست آزمایش ها رخ داده است!
|
خطایی در دریافت لیست آزمایش ها رخ داده است!
|
||||||
</Typography>
|
</Typography>
|
||||||
) : loadingAzmayeshes ? (
|
) : loadingAzmayeshes ? (
|
||||||
<Typography sx={{ display: "flex", alignItems: "center", gap: 2 }}>
|
<Typography sx={{ display: "flex", alignItems: "center", gap: 2 }}>
|
||||||
<CircularProgress size={20} />
|
<CircularProgress size={20} />
|
||||||
درحال دریافت لیست آزمایش ها
|
درحال دریافت لیست آزمایش ها
|
||||||
</Typography>
|
</Typography>
|
||||||
) : (
|
) : (
|
||||||
<Autocomplete
|
<Autocomplete
|
||||||
id="azmayesh_type_id"
|
id="azmayesh_type_id"
|
||||||
size="small"
|
size="small"
|
||||||
value={azmayeshes.find((azmayesh) => azmayesh.id === value) || null}
|
value={azmayeshes.find((azmayesh) => azmayesh.id === value) || null}
|
||||||
disablePortal
|
disablePortal
|
||||||
options={azmayeshes}
|
options={azmayeshes}
|
||||||
getOptionLabel={(azmayesh) => azmayesh.name}
|
getOptionLabel={(azmayesh) => azmayesh.name}
|
||||||
isOptionEqualToValue={(option, value) => option.id === value?.id}
|
isOptionEqualToValue={(option, value) => option.id === value?.id}
|
||||||
onChange={(event, newValue) => {
|
onChange={(event, newValue) => {
|
||||||
onChange(newValue ? newValue.id : "");
|
onChange(newValue ? newValue.id : "");
|
||||||
setValue("azmayesh_type_name", newValue ? newValue.name : "");
|
setValue("azmayesh_type_name", newValue ? newValue.name : "");
|
||||||
}}
|
}}
|
||||||
renderInput={(params) => (
|
renderInput={(params) => (
|
||||||
<TextField
|
<TextField
|
||||||
{...params}
|
{...params}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
error={!!errors.azmayesh_type_id}
|
error={!!errors.azmayesh_type_id}
|
||||||
fullWidth
|
fullWidth
|
||||||
label="نوع آزمایش"
|
label="نوع آزمایش"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
renderOption={(props, option) => (
|
renderOption={(props, option) => (
|
||||||
<li {...props} key={option.id}>
|
<li {...props} key={option.id}>
|
||||||
{option.name}
|
{option.name}
|
||||||
</li>
|
</li>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<FormHelperText id="azmayesh_type_id">
|
<FormHelperText id="azmayesh_type_id">
|
||||||
{errors.azmayesh_type_id ? errors.azmayesh_type_id.message : null}
|
{errors.azmayesh_type_id ? errors.azmayesh_type_id.message : null}
|
||||||
</FormHelperText>
|
</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} md={6} sx={{ display: "flex", alignItems: "center", justifyContent: "center" }}>
|
<Grid item xs={12} md={6} sx={{ display: "flex", alignItems: "center", justifyContent: "center" }}>
|
||||||
<Controller
|
<Controller
|
||||||
name="province_id"
|
name="province_id"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
||||||
<FormControl error={!!errors.province_id} size="small" fullWidth variant="outlined">
|
<FormControl error={!!errors.province_id} size="small" fullWidth variant="outlined">
|
||||||
<InputLabel htmlFor="province_id" />
|
<InputLabel htmlFor="province_id" />
|
||||||
{errorProvinces ? (
|
{errorProvinces ? (
|
||||||
<Typography color={"red"} sx={{ display: "flex", alignItems: "center", gap: 2 }}>
|
<Typography color={"red"} sx={{ display: "flex", alignItems: "center", gap: 2 }}>
|
||||||
خطایی در دریافت لیست استان ها رخ داده است!
|
خطایی در دریافت لیست استان ها رخ داده است!
|
||||||
</Typography>
|
</Typography>
|
||||||
) : loadingProvinces ? (
|
) : loadingProvinces ? (
|
||||||
<Typography sx={{ display: "flex", alignItems: "center", gap: 2 }}>
|
<Typography sx={{ display: "flex", alignItems: "center", gap: 2 }}>
|
||||||
<CircularProgress size={20} />
|
<CircularProgress size={20} />
|
||||||
درحال دریافت لیست استان ها
|
درحال دریافت لیست استان ها
|
||||||
</Typography>
|
</Typography>
|
||||||
) : (
|
) : (
|
||||||
<Autocomplete
|
<Autocomplete
|
||||||
id="province_id"
|
id="province_id"
|
||||||
size="small"
|
size="small"
|
||||||
value={provinces.find((province) => province.id === value) || null}
|
value={provinces.find((province) => province.id === value) || null}
|
||||||
disablePortal
|
disablePortal
|
||||||
options={provinces}
|
options={provinces}
|
||||||
getOptionLabel={(province) => province.name_fa}
|
getOptionLabel={(province) => province.name_fa}
|
||||||
isOptionEqualToValue={(option, value) => option.id === value?.id}
|
isOptionEqualToValue={(option, value) => option.id === value?.id}
|
||||||
onChange={(event, newValue) => {
|
onChange={(event, newValue) => {
|
||||||
onChange(newValue ? newValue.id : "");
|
onChange(newValue ? newValue.id : "");
|
||||||
setValue("province_name", newValue ? newValue.name_fa : "");
|
setValue("province_name", newValue ? newValue.name_fa : "");
|
||||||
}}
|
}}
|
||||||
renderInput={(params) => (
|
renderInput={(params) => (
|
||||||
<TextField
|
<TextField
|
||||||
{...params}
|
{...params}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
error={!!errors.province_id}
|
error={!!errors.province_id}
|
||||||
fullWidth
|
fullWidth
|
||||||
label="استان"
|
label="استان"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<FormHelperText id="province_id">
|
<FormHelperText id="province_id">
|
||||||
{errors.province_id ? errors.province_id.message : null}
|
{errors.province_id ? errors.province_id.message : null}
|
||||||
</FormHelperText>
|
</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} md={6}>
|
<Grid item xs={12} md={6}>
|
||||||
<FormControl error={!!errors.contract_subitem_id} size="small" fullWidth variant="outlined">
|
<FormControl error={!!errors.contract_subitem_id} size="small" fullWidth variant="outlined">
|
||||||
<InputLabel htmlFor="contract_subitem_id">کد یکتا پروژه</InputLabel>
|
<InputLabel htmlFor="contract_subitem_id">کد یکتا پروژه</InputLabel>
|
||||||
<OutlinedInput
|
<OutlinedInput
|
||||||
id="contract_subitem_id"
|
id="contract_subitem_id"
|
||||||
label={"کد یکتا پروژه"}
|
label={"کد یکتا پروژه"}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
{...register("contract_subitem_id")}
|
{...register("contract_subitem_id")}
|
||||||
size="small"
|
size="small"
|
||||||
fullWidth
|
fullWidth
|
||||||
type="text"
|
type="text"
|
||||||
/>
|
/>
|
||||||
<FormHelperText id="contract_subitem_id">
|
<FormHelperText id="contract_subitem_id">
|
||||||
{errors.contract_subitem_id ? errors.contract_subitem_id.message : null}
|
{errors.contract_subitem_id ? errors.contract_subitem_id.message : null}
|
||||||
</FormHelperText>
|
</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} md={6}>
|
<Grid item xs={12} md={6}>
|
||||||
<FormControl error={!!errors.project_name} size="small" fullWidth variant="outlined">
|
<FormControl error={!!errors.project_name} size="small" fullWidth variant="outlined">
|
||||||
<InputLabel htmlFor="project_name">پروژه</InputLabel>
|
<InputLabel htmlFor="project_name">پروژه</InputLabel>
|
||||||
<OutlinedInput
|
<OutlinedInput
|
||||||
id="project_name"
|
id="project_name"
|
||||||
label={"پروژه"}
|
label={"پروژه"}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
{...register("project_name")}
|
{...register("project_name")}
|
||||||
size="small"
|
size="small"
|
||||||
fullWidth
|
fullWidth
|
||||||
type="text"
|
type="text"
|
||||||
/>
|
/>
|
||||||
<FormHelperText id="project_name">
|
<FormHelperText id="project_name">
|
||||||
{errors.project_name ? errors.project_name.message : null}
|
{errors.project_name ? errors.project_name.message : null}
|
||||||
</FormHelperText>
|
</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} md={6}>
|
<Grid item xs={12} md={6}>
|
||||||
<FormControl error={!!errors.employer} size="small" fullWidth variant="outlined">
|
<FormControl error={!!errors.employer} size="small" fullWidth variant="outlined">
|
||||||
<InputLabel htmlFor="employer">کارفرما</InputLabel>
|
<InputLabel htmlFor="employer">کارفرما</InputLabel>
|
||||||
<OutlinedInput
|
<OutlinedInput
|
||||||
id="employer"
|
id="employer"
|
||||||
label={"کارفرما"}
|
label={"کارفرما"}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
{...register("employer")}
|
{...register("employer")}
|
||||||
size="small"
|
size="small"
|
||||||
fullWidth
|
fullWidth
|
||||||
type="text"
|
type="text"
|
||||||
/>
|
/>
|
||||||
<FormHelperText id="employer">{errors.employer ? errors.employer.message : null}</FormHelperText>
|
<FormHelperText id="employer">{errors.employer ? errors.employer.message : null}</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} md={6}>
|
<Grid item xs={12} md={6}>
|
||||||
<FormControl error={!!errors.consultant} size="small" fullWidth variant="outlined">
|
<FormControl error={!!errors.consultant} size="small" fullWidth variant="outlined">
|
||||||
<InputLabel htmlFor="consultant">مشاور</InputLabel>
|
<InputLabel htmlFor="consultant">مشاور</InputLabel>
|
||||||
<OutlinedInput
|
<OutlinedInput
|
||||||
id="consultant"
|
id="consultant"
|
||||||
label={"مشاور"}
|
label={"مشاور"}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
{...register("consultant")}
|
{...register("consultant")}
|
||||||
size="small"
|
size="small"
|
||||||
fullWidth
|
fullWidth
|
||||||
type="text"
|
type="text"
|
||||||
/>
|
/>
|
||||||
<FormHelperText id="consultant">
|
<FormHelperText id="consultant">
|
||||||
{errors.consultant ? errors.consultant.message : null}
|
{errors.consultant ? errors.consultant.message : null}
|
||||||
</FormHelperText>
|
</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} md={6}>
|
<Grid item xs={12} md={6}>
|
||||||
<FormControl error={!!errors.contractor} size="small" fullWidth variant="outlined">
|
<FormControl error={!!errors.contractor} size="small" fullWidth variant="outlined">
|
||||||
<InputLabel htmlFor="contractor">پیمانکار</InputLabel>
|
<InputLabel htmlFor="contractor">پیمانکار</InputLabel>
|
||||||
<OutlinedInput
|
<OutlinedInput
|
||||||
id="contractor"
|
id="contractor"
|
||||||
label={"پیمانکار"}
|
label={"پیمانکار"}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
{...register("contractor")}
|
{...register("contractor")}
|
||||||
size="small"
|
size="small"
|
||||||
fullWidth
|
fullWidth
|
||||||
type="text"
|
type="text"
|
||||||
/>
|
/>
|
||||||
<FormHelperText id="contractor">
|
<FormHelperText id="contractor">
|
||||||
{errors.contractor ? errors.contractor.message : null}
|
{errors.contractor ? errors.contractor.message : null}
|
||||||
</FormHelperText>
|
</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} md={6}>
|
<Grid item xs={12} md={6}>
|
||||||
<FormControl error={!!errors.applicant} size="small" fullWidth variant="outlined">
|
<FormControl error={!!errors.applicant} size="small" fullWidth variant="outlined">
|
||||||
<InputLabel htmlFor="applicant">متقاضی</InputLabel>
|
<InputLabel htmlFor="applicant">متقاضی</InputLabel>
|
||||||
<OutlinedInput
|
<OutlinedInput
|
||||||
id="applicant"
|
id="applicant"
|
||||||
label={"متقاضی"}
|
label={"متقاضی"}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
{...register("applicant")}
|
{...register("applicant")}
|
||||||
size="small"
|
size="small"
|
||||||
fullWidth
|
fullWidth
|
||||||
type="text"
|
type="text"
|
||||||
/>
|
/>
|
||||||
<FormHelperText id="applicant">{errors.applicant ? errors.applicant.message : null}</FormHelperText>
|
<FormHelperText id="applicant">{errors.applicant ? errors.applicant.message : null}</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} md={6}>
|
<Grid item xs={12} md={6}>
|
||||||
<FormControl error={!!errors.work_number} size="small" fullWidth variant="outlined">
|
<FormControl error={!!errors.work_number} size="small" fullWidth variant="outlined">
|
||||||
<InputLabel htmlFor="work_number">شماره کار</InputLabel>
|
<InputLabel htmlFor="work_number">شماره کار</InputLabel>
|
||||||
<OutlinedInput
|
<OutlinedInput
|
||||||
id="work_number"
|
id="work_number"
|
||||||
label={"شماره کار"}
|
label={"شماره کار"}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
{...register("work_number")}
|
{...register("work_number")}
|
||||||
size="small"
|
size="small"
|
||||||
fullWidth
|
fullWidth
|
||||||
type="text"
|
type="text"
|
||||||
/>
|
/>
|
||||||
<FormHelperText id="work_number">
|
<FormHelperText id="work_number">
|
||||||
{errors.work_number ? errors.work_number.message : null}
|
{errors.work_number ? errors.work_number.message : null}
|
||||||
</FormHelperText>
|
</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} md={6}>
|
<Grid item xs={12} md={6}>
|
||||||
<FormControl error={!!errors.request_number} size="small" fullWidth variant="outlined">
|
<FormControl error={!!errors.request_number} size="small" fullWidth variant="outlined">
|
||||||
<InputLabel htmlFor="request_number">شماره درخواست</InputLabel>
|
<InputLabel htmlFor="request_number">شماره درخواست</InputLabel>
|
||||||
<OutlinedInput
|
<OutlinedInput
|
||||||
id="request_number"
|
id="request_number"
|
||||||
label={"شماره درخواست"}
|
label={"شماره درخواست"}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
{...register("request_number")}
|
{...register("request_number")}
|
||||||
size="small"
|
size="small"
|
||||||
fullWidth
|
fullWidth
|
||||||
type="text"
|
type="text"
|
||||||
/>
|
/>
|
||||||
<FormHelperText id="request_number">
|
<FormHelperText id="request_number">
|
||||||
{errors.request_number ? errors.request_number.message : null}
|
{errors.request_number ? errors.request_number.message : null}
|
||||||
</FormHelperText>
|
</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} md={6}>
|
<Grid item xs={12} md={6}>
|
||||||
<Controller
|
<Controller
|
||||||
name="request_date"
|
name="request_date"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
||||||
<FormControl error={!!errors.request_date} fullWidth size="small" variant="outlined">
|
<FormControl error={!!errors.request_date} fullWidth size="small" variant="outlined">
|
||||||
<LocalizationProvider
|
<LocalizationProvider
|
||||||
dateAdapter={AdapterDateFnsJalali}
|
dateAdapter={AdapterDateFnsJalali}
|
||||||
localeText={faIR.components.MuiLocalizationProvider.defaultProps.localeText}
|
localeText={faIR.components.MuiLocalizationProvider.defaultProps.localeText}
|
||||||
>
|
>
|
||||||
<MobileDatePicker
|
<MobileDatePicker
|
||||||
value={value || null}
|
value={value || null}
|
||||||
onChange={(newValue) => {
|
onChange={(newValue) => {
|
||||||
onChange(newValue);
|
onChange(newValue);
|
||||||
}}
|
}}
|
||||||
closeOnSelect
|
closeOnSelect
|
||||||
slotProps={{
|
slotProps={{
|
||||||
textField: {
|
textField: {
|
||||||
size: "small",
|
size: "small",
|
||||||
error: !!errors.request_date,
|
error: !!errors.request_date,
|
||||||
placeholder: "تاریخ درخواست",
|
placeholder: "تاریخ درخواست",
|
||||||
InputProps: {
|
InputProps: {
|
||||||
endAdornment: (
|
endAdornment: (
|
||||||
<InputAdornment position="end">
|
<InputAdornment position="end">
|
||||||
<IconButton
|
<IconButton
|
||||||
size="small"
|
size="small"
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
setValue("request_date", "");
|
setValue("request_date", "");
|
||||||
}}
|
}}
|
||||||
sx={{
|
sx={{
|
||||||
color: "#bfbfbf",
|
color: "#bfbfbf",
|
||||||
"&:hover": {
|
"&:hover": {
|
||||||
backgroundColor: "rgba(189, 189, 189, 0.1)",
|
backgroundColor: "rgba(189, 189, 189, 0.1)",
|
||||||
color: "#363434",
|
color: "#363434",
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ClearIcon />
|
<ClearIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</InputAdornment>
|
</InputAdornment>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</LocalizationProvider>
|
</LocalizationProvider>
|
||||||
<FormHelperText id="request_date">
|
<FormHelperText id="request_date">
|
||||||
{errors.request_date ? errors.request_date.message : null}
|
{errors.request_date ? errors.request_date.message : null}
|
||||||
</FormHelperText>
|
</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} md={6}>
|
<Grid item xs={12} md={6}>
|
||||||
<Controller
|
<Controller
|
||||||
name="report_date"
|
name="report_date"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
||||||
<FormControl error={!!errors.report_date} fullWidth size="small" variant="outlined">
|
<FormControl error={!!errors.report_date} fullWidth size="small" variant="outlined">
|
||||||
<LocalizationProvider
|
<LocalizationProvider
|
||||||
dateAdapter={AdapterDateFnsJalali}
|
dateAdapter={AdapterDateFnsJalali}
|
||||||
localeText={faIR.components.MuiLocalizationProvider.defaultProps.localeText}
|
localeText={faIR.components.MuiLocalizationProvider.defaultProps.localeText}
|
||||||
>
|
>
|
||||||
<MobileDatePicker
|
<MobileDatePicker
|
||||||
value={value || null}
|
value={value || null}
|
||||||
onChange={(newValue) => {
|
onChange={(newValue) => {
|
||||||
onChange(newValue);
|
onChange(newValue);
|
||||||
}}
|
}}
|
||||||
closeOnSelect
|
closeOnSelect
|
||||||
slotProps={{
|
slotProps={{
|
||||||
textField: {
|
textField: {
|
||||||
size: "small",
|
size: "small",
|
||||||
error: !!errors.report_date,
|
error: !!errors.report_date,
|
||||||
placeholder: "تاریخ گزارش",
|
placeholder: "تاریخ گزارش",
|
||||||
InputProps: {
|
InputProps: {
|
||||||
endAdornment: (
|
endAdornment: (
|
||||||
<InputAdornment position="end">
|
<InputAdornment position="end">
|
||||||
<IconButton
|
<IconButton
|
||||||
size="small"
|
size="small"
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
setValue("report_date", "");
|
setValue("report_date", "");
|
||||||
}}
|
}}
|
||||||
sx={{
|
sx={{
|
||||||
color: "#bfbfbf",
|
color: "#bfbfbf",
|
||||||
"&:hover": {
|
"&:hover": {
|
||||||
backgroundColor: "rgba(189, 189, 189, 0.1)",
|
backgroundColor: "rgba(189, 189, 189, 0.1)",
|
||||||
color: "#363434",
|
color: "#363434",
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ClearIcon />
|
<ClearIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</InputAdornment>
|
</InputAdornment>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</LocalizationProvider>
|
</LocalizationProvider>
|
||||||
<FormHelperText id="report_date">
|
<FormHelperText id="report_date">
|
||||||
{errors.report_date ? errors.report_date.message : null}
|
{errors.report_date ? errors.report_date.message : null}
|
||||||
</FormHelperText>
|
</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default CandUGeneralInfo;
|
export default CandUGeneralInfo;
|
||||||
|
|||||||
@@ -1,41 +1,41 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Box, Stack } from "@mui/material";
|
import { Box, Stack } from "@mui/material";
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
import MapLoading from "@/core/components/MapLayer/Loading";
|
import MapLoading from "@/core/components/MapLayer/Loading";
|
||||||
import CandUChooseLocation from "./CandUChooseLocation";
|
import CandUChooseLocation from "./CandUChooseLocation";
|
||||||
|
|
||||||
const MapLayer = dynamic(() => import("@/core/components/MapLayer"), {
|
const MapLayer = dynamic(() => import("@/core/components/MapLayer"), {
|
||||||
loading: () => <MapLoading />,
|
loading: () => <MapLoading />,
|
||||||
ssr: false,
|
ssr: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const CandUMapBox = ({ mapBoxData, setMapBoxData }) => {
|
const CandUMapBox = ({ mapBoxData, setMapBoxData }) => {
|
||||||
return (
|
return (
|
||||||
<Stack spacing={1} sx={{ height: "500px" }}>
|
<Stack spacing={1} sx={{ height: "500px" }}>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
p: 1,
|
p: 1,
|
||||||
border: "1px dashed",
|
border: "1px dashed",
|
||||||
borderColor: "divider",
|
borderColor: "divider",
|
||||||
borderRadius: 1,
|
borderRadius: 1,
|
||||||
height: "100%",
|
height: "100%",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
height: "100%",
|
height: "100%",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<MapLayer>
|
<MapLayer>
|
||||||
<CandUChooseLocation mapBoxData={mapBoxData} setMapBoxData={setMapBoxData} />
|
<CandUChooseLocation mapBoxData={mapBoxData} setMapBoxData={setMapBoxData} />
|
||||||
</MapLayer>
|
</MapLayer>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default CandUMapBox;
|
export default CandUMapBox;
|
||||||
|
|||||||
@@ -1,65 +1,65 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Box, Typography } from "@mui/material";
|
import { Box, Typography } from "@mui/material";
|
||||||
import TextSnippetIcon from "@mui/icons-material/TextSnippet";
|
import TextSnippetIcon from "@mui/icons-material/TextSnippet";
|
||||||
import TravelExploreIcon from "@mui/icons-material/TravelExplore";
|
import TravelExploreIcon from "@mui/icons-material/TravelExplore";
|
||||||
import {
|
import {
|
||||||
Timeline,
|
Timeline,
|
||||||
TimelineConnector,
|
TimelineConnector,
|
||||||
TimelineContent,
|
TimelineContent,
|
||||||
TimelineDot,
|
TimelineDot,
|
||||||
TimelineItem,
|
TimelineItem,
|
||||||
timelineItemClasses,
|
timelineItemClasses,
|
||||||
TimelineSeparator,
|
TimelineSeparator,
|
||||||
} from "@mui/lab";
|
} from "@mui/lab";
|
||||||
|
|
||||||
const CandUCreateTimeLine = ({ tabState }) => {
|
const CandUCreateTimeLine = ({ tabState }) => {
|
||||||
return (
|
return (
|
||||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||||
<Timeline
|
<Timeline
|
||||||
position="right"
|
position="right"
|
||||||
sx={{
|
sx={{
|
||||||
[`& .${timelineItemClasses.root}:before`]: { flex: 0, padding: 0 },
|
[`& .${timelineItemClasses.root}:before`]: { flex: 0, padding: 0 },
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TimelineItem>
|
<TimelineItem>
|
||||||
<TimelineSeparator>
|
<TimelineSeparator>
|
||||||
<TimelineConnector />
|
<TimelineConnector />
|
||||||
<TimelineDot sx={{ backgroundColor: "#fff" }}>
|
<TimelineDot sx={{ backgroundColor: "#fff" }}>
|
||||||
<TravelExploreIcon
|
<TravelExploreIcon
|
||||||
color={tabState === 0 ? "primary" : "error"}
|
color={tabState === 0 ? "primary" : "error"}
|
||||||
sx={{ width: "1.5rem", height: "1.5rem" }}
|
sx={{ width: "1.5rem", height: "1.5rem" }}
|
||||||
/>
|
/>
|
||||||
</TimelineDot>
|
</TimelineDot>
|
||||||
<TimelineConnector />
|
<TimelineConnector />
|
||||||
</TimelineSeparator>
|
</TimelineSeparator>
|
||||||
<TimelineContent sx={{ py: "12px", px: 2 }}>
|
<TimelineContent sx={{ py: "12px", px: 2 }}>
|
||||||
<Typography variant="h6">نقشه</Typography>
|
<Typography variant="h6">نقشه</Typography>
|
||||||
<Typography variant="caption" sx={{ color: "#606060" }}>
|
<Typography variant="caption" sx={{ color: "#606060" }}>
|
||||||
ثبت مختصات محل آزمایش
|
ثبت مختصات محل آزمایش
|
||||||
</Typography>
|
</Typography>
|
||||||
</TimelineContent>
|
</TimelineContent>
|
||||||
</TimelineItem>
|
</TimelineItem>
|
||||||
<TimelineItem>
|
<TimelineItem>
|
||||||
<TimelineSeparator>
|
<TimelineSeparator>
|
||||||
<TimelineConnector />
|
<TimelineConnector />
|
||||||
<TimelineDot sx={{ backgroundColor: "#fff" }}>
|
<TimelineDot sx={{ backgroundColor: "#fff" }}>
|
||||||
<TextSnippetIcon
|
<TextSnippetIcon
|
||||||
color={tabState === 1 ? "primary" : "error"}
|
color={tabState === 1 ? "primary" : "error"}
|
||||||
sx={{ width: "1.5rem", height: "1.5rem" }}
|
sx={{ width: "1.5rem", height: "1.5rem" }}
|
||||||
/>
|
/>
|
||||||
</TimelineDot>
|
</TimelineDot>
|
||||||
<TimelineConnector />
|
<TimelineConnector />
|
||||||
</TimelineSeparator>
|
</TimelineSeparator>
|
||||||
<TimelineContent sx={{ py: "12px", px: 2 }}>
|
<TimelineContent sx={{ py: "12px", px: 2 }}>
|
||||||
<Typography variant="h6">مشخصات آزمایش</Typography>
|
<Typography variant="h6">مشخصات آزمایش</Typography>
|
||||||
<Typography variant="caption" sx={{ color: "#606060" }}>
|
<Typography variant="caption" sx={{ color: "#606060" }}>
|
||||||
ثبت مشخصات اولیه
|
ثبت مشخصات اولیه
|
||||||
</Typography>
|
</Typography>
|
||||||
</TimelineContent>
|
</TimelineContent>
|
||||||
</TimelineItem>
|
</TimelineItem>
|
||||||
</Timeline>
|
</Timeline>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default CandUCreateTimeLine;
|
export default CandUCreateTimeLine;
|
||||||
|
|||||||
@@ -1,200 +1,200 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Box, Button, DialogActions, DialogContent, Tab, Tabs, useMediaQuery } from "@mui/material";
|
import { Box, Button, DialogActions, DialogContent, Tab, Tabs, useMediaQuery } from "@mui/material";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import { object, string } from "yup";
|
import { object, string } from "yup";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import { yupResolver } from "@hookform/resolvers/yup";
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
import moment from "jalali-moment";
|
import moment from "jalali-moment";
|
||||||
import { CREATE_AZMAYESH, UPDATE_AZMAYESH } from "@/core/utils/routes";
|
import { CREATE_AZMAYESH, UPDATE_AZMAYESH } from "@/core/utils/routes";
|
||||||
import StyledForm from "@/core/components/StyledForm";
|
import StyledForm from "@/core/components/StyledForm";
|
||||||
import TravelExploreIcon from "@mui/icons-material/TravelExplore";
|
import TravelExploreIcon from "@mui/icons-material/TravelExplore";
|
||||||
import TextSnippetIcon from "@mui/icons-material/TextSnippet";
|
import TextSnippetIcon from "@mui/icons-material/TextSnippet";
|
||||||
import ExitToAppIcon from "@mui/icons-material/ExitToApp";
|
import ExitToAppIcon from "@mui/icons-material/ExitToApp";
|
||||||
import KeyboardDoubleArrowRightIcon from "@mui/icons-material/KeyboardDoubleArrowRight";
|
import KeyboardDoubleArrowRightIcon from "@mui/icons-material/KeyboardDoubleArrowRight";
|
||||||
import KeyboardDoubleArrowLeftIcon from "@mui/icons-material/KeyboardDoubleArrowLeft";
|
import KeyboardDoubleArrowLeftIcon from "@mui/icons-material/KeyboardDoubleArrowLeft";
|
||||||
import BeenhereIcon from "@mui/icons-material/Beenhere";
|
import BeenhereIcon from "@mui/icons-material/Beenhere";
|
||||||
import CandUMapBox from "./CandUMapBox";
|
import CandUMapBox from "./CandUMapBox";
|
||||||
import CandUCreateTimeLine from "./CandUTimeLine";
|
import CandUCreateTimeLine from "./CandUTimeLine";
|
||||||
import CandUGeneralInfo from "./CandUGeneralInfo";
|
import CandUGeneralInfo from "./CandUGeneralInfo";
|
||||||
|
|
||||||
function TabPanel(props) {
|
function TabPanel(props) {
|
||||||
const { children, value, index } = props;
|
const { children, value, index } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div role="tabpanel" hidden={value !== index}>
|
<div role="tabpanel" hidden={value !== index}>
|
||||||
{value === index && <Box>{children}</Box>}
|
{value === index && <Box>{children}</Box>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const validationSchema = object({
|
const validationSchema = object({
|
||||||
azmayesh_type_id: string().required("نوع آزمایش را مشخص کنید!"),
|
azmayesh_type_id: string().required("نوع آزمایش را مشخص کنید!"),
|
||||||
province_id: string().required("استان را وارد کنید!"),
|
province_id: string().required("استان را وارد کنید!"),
|
||||||
contract_subitem_id: string().required("کد یکتا پروژه را وارد کنید!"),
|
contract_subitem_id: string().required("کد یکتا پروژه را وارد کنید!"),
|
||||||
project_name: string().required("عنوان پروژه را وارد کنید!"),
|
project_name: string().required("عنوان پروژه را وارد کنید!"),
|
||||||
employer: string().required("کارفرما را وارد کنید!"),
|
employer: string().required("کارفرما را وارد کنید!"),
|
||||||
consultant: string().required("مشاور را وارد کنید!"),
|
consultant: string().required("مشاور را وارد کنید!"),
|
||||||
contractor: string().required("پیمانکار را وارد کنید!"),
|
contractor: string().required("پیمانکار را وارد کنید!"),
|
||||||
applicant: string().required("متقاضی را وارد کنید!"),
|
applicant: string().required("متقاضی را وارد کنید!"),
|
||||||
work_number: string().required("شماره کار را وارد کنید!"),
|
work_number: string().required("شماره کار را وارد کنید!"),
|
||||||
request_number: string().required("شماره درخواست را وارد کنید!"),
|
request_number: string().required("شماره درخواست را وارد کنید!"),
|
||||||
request_date: string().required("تاریخ درخواست را وارد کنید!"),
|
request_date: string().required("تاریخ درخواست را وارد کنید!"),
|
||||||
report_date: string().required("تاریخ گزارش را وارد کنید!"),
|
report_date: string().required("تاریخ گزارش را وارد کنید!"),
|
||||||
});
|
});
|
||||||
|
|
||||||
const CandUAzmayesh = ({ setOpen, mutate, updateInfo, rowId }) => {
|
const CandUAzmayesh = ({ setOpen, mutate, updateInfo, rowId }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const requestServer = useRequest({ notificationSuccess: true });
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
||||||
const [tabState, setTabState] = useState(0);
|
const [tabState, setTabState] = useState(0);
|
||||||
const [mapBoxData, setMapBoxData] = useState(updateInfo ? { lat: updateInfo.lat, lng: updateInfo.lng } : null);
|
const [mapBoxData, setMapBoxData] = useState(updateInfo ? { lat: updateInfo.lat, lng: updateInfo.lng } : null);
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleChangeTab = (event, newValue) => {
|
const handleChangeTab = (event, newValue) => {
|
||||||
setTabState(newValue);
|
setTabState(newValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePrev = () => {
|
const handlePrev = () => {
|
||||||
if (tabState === 0) {
|
if (tabState === 0) {
|
||||||
handleClose();
|
handleClose();
|
||||||
} else {
|
} else {
|
||||||
setTabState(tabState - 1);
|
setTabState(tabState - 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultValues = {
|
const defaultValues = {
|
||||||
azmayesh_type_id: updateInfo ? updateInfo.azmayesh_type_id : "",
|
azmayesh_type_id: updateInfo ? updateInfo.azmayesh_type_id : "",
|
||||||
azmayesh_type_name: updateInfo ? updateInfo.azmayesh_type_name : "",
|
azmayesh_type_name: updateInfo ? updateInfo.azmayesh_type_name : "",
|
||||||
province_id: updateInfo ? updateInfo.province_id : "",
|
province_id: updateInfo ? updateInfo.province_id : "",
|
||||||
province_name: updateInfo ? updateInfo.province_name : "",
|
province_name: updateInfo ? updateInfo.province_name : "",
|
||||||
contract_subitem_id: updateInfo ? updateInfo.contract_subitem_id : "",
|
contract_subitem_id: updateInfo ? updateInfo.contract_subitem_id : "",
|
||||||
project_name: updateInfo ? updateInfo.project_name : "",
|
project_name: updateInfo ? updateInfo.project_name : "",
|
||||||
employer: updateInfo ? updateInfo.employer : "",
|
employer: updateInfo ? updateInfo.employer : "",
|
||||||
consultant: updateInfo ? updateInfo.consultant : "",
|
consultant: updateInfo ? updateInfo.consultant : "",
|
||||||
contractor: updateInfo ? updateInfo.contractor : "",
|
contractor: updateInfo ? updateInfo.contractor : "",
|
||||||
applicant: updateInfo ? updateInfo.applicant : "",
|
applicant: updateInfo ? updateInfo.applicant : "",
|
||||||
work_number: updateInfo ? updateInfo.work_number : "",
|
work_number: updateInfo ? updateInfo.work_number : "",
|
||||||
request_number: updateInfo ? updateInfo.request_number : "",
|
request_number: updateInfo ? updateInfo.request_number : "",
|
||||||
request_date: updateInfo ? moment(updateInfo.request_date, "YYYY-MM-DD").toDate() : "",
|
request_date: updateInfo ? moment(updateInfo.request_date, "YYYY-MM-DD").toDate() : "",
|
||||||
report_date: updateInfo ? moment(updateInfo.report_date, "YYYY-MM-DD").toDate() : "",
|
report_date: updateInfo ? moment(updateInfo.report_date, "YYYY-MM-DD").toDate() : "",
|
||||||
};
|
};
|
||||||
|
|
||||||
const {
|
const {
|
||||||
control,
|
control,
|
||||||
register,
|
register,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
setValue,
|
setValue,
|
||||||
formState: { isSubmitting, errors },
|
formState: { isSubmitting, errors },
|
||||||
} = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "all" });
|
} = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "all" });
|
||||||
|
|
||||||
const onSubmit = async (data) => {
|
const onSubmit = async (data) => {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("lat", mapBoxData.lat);
|
formData.append("lat", mapBoxData.lat);
|
||||||
formData.append("lng", mapBoxData.lng);
|
formData.append("lng", mapBoxData.lng);
|
||||||
formData.append("azmayesh_type_id", data.azmayesh_type_id);
|
formData.append("azmayesh_type_id", data.azmayesh_type_id);
|
||||||
formData.append("azmayesh_type_name", data.azmayesh_type_name);
|
formData.append("azmayesh_type_name", data.azmayesh_type_name);
|
||||||
formData.append("province_id", data.province_id);
|
formData.append("province_id", data.province_id);
|
||||||
formData.append("province_name", data.province_name);
|
formData.append("province_name", data.province_name);
|
||||||
formData.append("contract_subitem_id", data.contract_subitem_id);
|
formData.append("contract_subitem_id", data.contract_subitem_id);
|
||||||
formData.append("project_name", data.project_name);
|
formData.append("project_name", data.project_name);
|
||||||
formData.append("employer", data.employer);
|
formData.append("employer", data.employer);
|
||||||
formData.append("consultant", data.consultant);
|
formData.append("consultant", data.consultant);
|
||||||
formData.append("contractor", data.contractor);
|
formData.append("contractor", data.contractor);
|
||||||
formData.append("applicant", data.applicant);
|
formData.append("applicant", data.applicant);
|
||||||
formData.append("work_number", data.work_number);
|
formData.append("work_number", data.work_number);
|
||||||
formData.append("request_number", data.request_number);
|
formData.append("request_number", data.request_number);
|
||||||
formData.append("request_date", moment(new Date(data.request_date)).format("YYYY-MM-DD"));
|
formData.append("request_date", moment(new Date(data.request_date)).format("YYYY-MM-DD"));
|
||||||
formData.append("report_date", moment(new Date(data.report_date)).format("YYYY-MM-DD"));
|
formData.append("report_date", moment(new Date(data.report_date)).format("YYYY-MM-DD"));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await requestServer(updateInfo ? `${UPDATE_AZMAYESH}/${rowId}` : CREATE_AZMAYESH, "post", {
|
await requestServer(updateInfo ? `${UPDATE_AZMAYESH}/${rowId}` : CREATE_AZMAYESH, "post", {
|
||||||
data: formData,
|
data: formData,
|
||||||
});
|
});
|
||||||
mutate();
|
mutate();
|
||||||
handleClose();
|
handleClose();
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledForm onSubmit={handleSubmit(onSubmit)}>
|
<StyledForm onSubmit={handleSubmit(onSubmit)}>
|
||||||
<Tabs
|
<Tabs
|
||||||
allowScrollButtonsMobile
|
allowScrollButtonsMobile
|
||||||
value={tabState}
|
value={tabState}
|
||||||
onChange={handleChangeTab}
|
onChange={handleChangeTab}
|
||||||
variant={`${isMobile ? "scrollable" : "fullWidth"}`}
|
variant={`${isMobile ? "scrollable" : "fullWidth"}`}
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
justifyContent: "space-around",
|
justifyContent: "space-around",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
backgroundColor: "#efefef",
|
backgroundColor: "#efefef",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Tab icon={<TravelExploreIcon />} label="انتخاب محل آزمایش"></Tab>
|
<Tab icon={<TravelExploreIcon />} label="انتخاب محل آزمایش"></Tab>
|
||||||
<Tab disabled={!mapBoxData} icon={<TextSnippetIcon />} label="مشخصات آزمایش"></Tab>
|
<Tab disabled={!mapBoxData} icon={<TextSnippetIcon />} label="مشخصات آزمایش"></Tab>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
<DialogContent dividers sx={{ display: "flex" }}>
|
<DialogContent dividers sx={{ display: "flex" }}>
|
||||||
<Box sx={{ flex: 1 }}>
|
<Box sx={{ flex: 1 }}>
|
||||||
<TabPanel value={tabState} index={0}>
|
<TabPanel value={tabState} index={0}>
|
||||||
<CandUMapBox mapBoxData={mapBoxData} setMapBoxData={setMapBoxData} />
|
<CandUMapBox mapBoxData={mapBoxData} setMapBoxData={setMapBoxData} />
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
<TabPanel value={tabState} index={1}>
|
<TabPanel value={tabState} index={1}>
|
||||||
<CandUGeneralInfo control={control} register={register} setValue={setValue} errors={errors} />
|
<CandUGeneralInfo control={control} register={register} setValue={setValue} errors={errors} />
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
</Box>
|
</Box>
|
||||||
{!isMobile && (
|
{!isMobile && (
|
||||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||||
<CandUCreateTimeLine tabState={tabState} />
|
<CandUCreateTimeLine tabState={tabState} />
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions sx={{ alignItems: "center", justifyContent: "center" }}>
|
<DialogActions sx={{ alignItems: "center", justifyContent: "center" }}>
|
||||||
<Button
|
<Button
|
||||||
onClick={handlePrev}
|
onClick={handlePrev}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
color="error"
|
color="error"
|
||||||
size="large"
|
size="large"
|
||||||
startIcon={tabState === 0 ? <ExitToAppIcon /> : <KeyboardDoubleArrowRightIcon />}
|
startIcon={tabState === 0 ? <ExitToAppIcon /> : <KeyboardDoubleArrowRightIcon />}
|
||||||
>
|
>
|
||||||
{tabState === 0 ? "بستن" : "مرحله قبل"}
|
{tabState === 0 ? "بستن" : "مرحله قبل"}
|
||||||
</Button>
|
</Button>
|
||||||
{tabState === 0 ? (
|
{tabState === 0 ? (
|
||||||
<Button
|
<Button
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
setTabState(tabState + 1);
|
setTabState(tabState + 1);
|
||||||
}}
|
}}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
size="large"
|
size="large"
|
||||||
disabled={!mapBoxData}
|
disabled={!mapBoxData}
|
||||||
endIcon={<KeyboardDoubleArrowLeftIcon />}
|
endIcon={<KeyboardDoubleArrowLeftIcon />}
|
||||||
>
|
>
|
||||||
مرحله بعد
|
مرحله بعد
|
||||||
</Button>
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
size="large"
|
size="large"
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
type={"submit"}
|
type={"submit"}
|
||||||
endIcon={<BeenhereIcon />}
|
endIcon={<BeenhereIcon />}
|
||||||
>
|
>
|
||||||
{updateInfo
|
{updateInfo
|
||||||
? isSubmitting
|
? isSubmitting
|
||||||
? "در حال ویرایش آزمایش"
|
? "در حال ویرایش آزمایش"
|
||||||
: "ویرایش آزمایش"
|
: "ویرایش آزمایش"
|
||||||
: isSubmitting
|
: isSubmitting
|
||||||
? "در حال ثبت آزمایش"
|
? "در حال ثبت آزمایش"
|
||||||
: "ثبت آزمایش"}
|
: "ثبت آزمایش"}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</StyledForm>
|
</StyledForm>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default CandUAzmayesh;
|
export default CandUAzmayesh;
|
||||||
|
|||||||
@@ -1,38 +1,38 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Dialog, IconButton } from "@mui/material";
|
import { Dialog, IconButton } from "@mui/material";
|
||||||
import FormAndRequest from "./FormAndRequest";
|
import FormAndRequest from "./FormAndRequest";
|
||||||
import DialogLoading from "@/core/components/DialogLoading";
|
import DialogLoading from "@/core/components/DialogLoading";
|
||||||
import CloseIcon from "@mui/icons-material/Close";
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
|
|
||||||
const CandUAzmayesh = ({ open, setOpen, mutate, updateInfo, rowId, loadingOpen, fromUpdate = false }) => {
|
const CandUAzmayesh = ({ open, setOpen, mutate, updateInfo, rowId, loadingOpen, fromUpdate = false }) => {
|
||||||
const isUpdateReady = fromUpdate ? updateInfo !== null : true;
|
const isUpdateReady = fromUpdate ? updateInfo !== null : true;
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} fullWidth maxWidth="lg">
|
<Dialog open={open} fullWidth maxWidth="lg">
|
||||||
<IconButton
|
<IconButton
|
||||||
aria-label="close"
|
aria-label="close"
|
||||||
onClick={() => setOpen(false)}
|
onClick={() => setOpen(false)}
|
||||||
sx={(theme) => ({
|
sx={(theme) => ({
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
right: 8,
|
right: 8,
|
||||||
top: 8,
|
top: 8,
|
||||||
zIndex: 50,
|
zIndex: 50,
|
||||||
color: theme.palette.grey[500],
|
color: theme.palette.grey[500],
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<CloseIcon />
|
<CloseIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
{isUpdateReady ? (
|
{isUpdateReady ? (
|
||||||
<FormAndRequest
|
<FormAndRequest
|
||||||
setOpen={setOpen}
|
setOpen={setOpen}
|
||||||
mutate={mutate}
|
mutate={mutate}
|
||||||
rowId={rowId}
|
rowId={rowId}
|
||||||
{...(fromUpdate ? { updateInfo } : {})}
|
{...(fromUpdate ? { updateInfo } : {})}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<DialogLoading loadingOpen={loadingOpen} />
|
<DialogLoading loadingOpen={loadingOpen} />
|
||||||
)}
|
)}
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default CandUAzmayesh;
|
export default CandUAzmayesh;
|
||||||
|
|||||||
@@ -1,52 +1,52 @@
|
|||||||
import { IconButton, Tooltip } from "@mui/material";
|
import { IconButton, Tooltip } from "@mui/material";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import EditIcon from "@mui/icons-material/Edit";
|
import EditIcon from "@mui/icons-material/Edit";
|
||||||
import { GET_AZMAYESH_LIST } from "@/core/utils/routes";
|
import { GET_AZMAYESH_LIST } from "@/core/utils/routes";
|
||||||
import CandUAzmayesh from "@/components/dashboard/azmayesh/Forms/CandUAzmayesh";
|
import CandUAzmayesh from "@/components/dashboard/azmayesh/Forms/CandUAzmayesh";
|
||||||
|
|
||||||
const AzmayeshUpdate = ({ rowId, mutate }) => {
|
const AzmayeshUpdate = ({ rowId, mutate }) => {
|
||||||
const requestServer = useRequest();
|
const requestServer = useRequest();
|
||||||
const [openUpdateDialog, setOpenUpdateDialog] = useState(false);
|
const [openUpdateDialog, setOpenUpdateDialog] = useState(false);
|
||||||
const [updateInfo, setUpdateInfo] = useState(null);
|
const [updateInfo, setUpdateInfo] = useState(null);
|
||||||
const [loadingOpen, setLoadingOpen] = useState(false);
|
const [loadingOpen, setLoadingOpen] = useState(false);
|
||||||
|
|
||||||
const handleGetInfo = () => {
|
const handleGetInfo = () => {
|
||||||
setLoadingOpen(true);
|
setLoadingOpen(true);
|
||||||
setOpenUpdateDialog(true);
|
setOpenUpdateDialog(true);
|
||||||
requestServer(`${GET_AZMAYESH_LIST}/${rowId}`, "get")
|
requestServer(`${GET_AZMAYESH_LIST}/${rowId}`, "get")
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
setUpdateInfo(response.data.data);
|
setUpdateInfo(response.data.data);
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setLoadingOpen(false);
|
setLoadingOpen(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Tooltip title="ویرایش آزمایش" arrow placement="right">
|
<Tooltip title="ویرایش آزمایش" arrow placement="right">
|
||||||
<IconButton
|
<IconButton
|
||||||
color="success"
|
color="success"
|
||||||
sx={{ textTransform: "unset", alignSelf: "center" }}
|
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||||
onClick={handleGetInfo}
|
onClick={handleGetInfo}
|
||||||
>
|
>
|
||||||
<EditIcon />
|
<EditIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
{openUpdateDialog && (
|
{openUpdateDialog && (
|
||||||
<CandUAzmayesh
|
<CandUAzmayesh
|
||||||
open={openUpdateDialog}
|
open={openUpdateDialog}
|
||||||
setOpen={setOpenUpdateDialog}
|
setOpen={setOpenUpdateDialog}
|
||||||
mutate={mutate}
|
mutate={mutate}
|
||||||
updateInfo={updateInfo}
|
updateInfo={updateInfo}
|
||||||
rowId={rowId}
|
rowId={rowId}
|
||||||
loadingOpen={loadingOpen}
|
loadingOpen={loadingOpen}
|
||||||
fromUpdate={true}
|
fromUpdate={true}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default AzmayeshUpdate;
|
export default AzmayeshUpdate;
|
||||||
|
|||||||
@@ -1,78 +1,78 @@
|
|||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogActions,
|
DialogActions,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
IconButton,
|
IconButton,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Typography,
|
Typography,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import DeleteIcon from "@mui/icons-material/Delete";
|
import DeleteIcon from "@mui/icons-material/Delete";
|
||||||
import { DELETE_AZMAYESH } from "@/core/utils/routes";
|
import { DELETE_AZMAYESH } from "@/core/utils/routes";
|
||||||
|
|
||||||
const DeleteAzmayesh = ({ rowId, mutate }) => {
|
const DeleteAzmayesh = ({ rowId, mutate }) => {
|
||||||
const requestServer = useRequest({ notificationSuccess: true });
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
const [openDeleteDialog, setOpenDeleteDialog] = useState(false);
|
const [openDeleteDialog, setOpenDeleteDialog] = useState(false);
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
|
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
setIsSubmitting(true);
|
setIsSubmitting(true);
|
||||||
requestServer(`${DELETE_AZMAYESH}/${rowId}`, "post")
|
requestServer(`${DELETE_AZMAYESH}/${rowId}`, "post")
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setOpenDeleteDialog(false);
|
setOpenDeleteDialog(false);
|
||||||
mutate();
|
mutate();
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setIsSubmitting(false);
|
setIsSubmitting(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Tooltip title="حذف آزمایش" arrow placement="right">
|
<Tooltip title="حذف آزمایش" arrow placement="right">
|
||||||
<IconButton
|
<IconButton
|
||||||
color="error"
|
color="error"
|
||||||
sx={{ textTransform: "unset", alignSelf: "center" }}
|
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setOpenDeleteDialog(true);
|
setOpenDeleteDialog(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<DeleteIcon />
|
<DeleteIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Dialog
|
<Dialog
|
||||||
maxWidth="sm"
|
maxWidth="sm"
|
||||||
open={openDeleteDialog}
|
open={openDeleteDialog}
|
||||||
PaperProps={{
|
PaperProps={{
|
||||||
sx: {
|
sx: {
|
||||||
boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
|
boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<DialogTitle>حذف آزمایش</DialogTitle>
|
<DialogTitle>حذف آزمایش</DialogTitle>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<Typography>آیا از حذف این آزمایش مطمئن هستید؟</Typography>
|
<Typography>آیا از حذف این آزمایش مطمئن هستید؟</Typography>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => setOpenDeleteDialog(false)}
|
onClick={() => setOpenDeleteDialog(false)}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
color="primary"
|
color="primary"
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
autoFocus
|
autoFocus
|
||||||
>
|
>
|
||||||
بستن
|
بستن
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={handleSubmit} variant="contained" color="error" disabled={isSubmitting}>
|
<Button onClick={handleSubmit} variant="contained" color="error" disabled={isSubmitting}>
|
||||||
حذف
|
حذف
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default DeleteAzmayesh;
|
export default DeleteAzmayesh;
|
||||||
|
|||||||
@@ -1,59 +1,59 @@
|
|||||||
import { Button, IconButton, useMediaQuery } from "@mui/material";
|
import { Button, IconButton, useMediaQuery } from "@mui/material";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { GET_AZMAYESH_SAMPLE_FIELDS } from "@/core/utils/routes";
|
import { GET_AZMAYESH_SAMPLE_FIELDS } from "@/core/utils/routes";
|
||||||
import { AddCircle } from "@mui/icons-material";
|
import { AddCircle } from "@mui/icons-material";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import CandUSampleOfAzmayesh from "@/components/dashboard/azmayesh/RowActions/ShowSampleOfAzmayesh/Forms/CandUSampleOfAzmayesh";
|
import CandUSampleOfAzmayesh from "@/components/dashboard/azmayesh/RowActions/ShowSampleOfAzmayesh/Forms/CandUSampleOfAzmayesh";
|
||||||
|
|
||||||
const AddSampleToAzmayesh = ({ azmayeshTypeId, mutate, rowId }) => {
|
const AddSampleToAzmayesh = ({ azmayeshTypeId, mutate, rowId }) => {
|
||||||
const requestServer = useRequest();
|
const requestServer = useRequest();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
||||||
const [sampleInfo, setSampleInfo] = useState(null);
|
const [sampleInfo, setSampleInfo] = useState(null);
|
||||||
const [openAddSampleDialog, setOpenAddSampleDialog] = useState(false);
|
const [openAddSampleDialog, setOpenAddSampleDialog] = useState(false);
|
||||||
const [defaultValues, setDefaultValues] = useState({});
|
const [defaultValues, setDefaultValues] = useState({});
|
||||||
|
|
||||||
const handleGetFields = () => {
|
const handleGetFields = () => {
|
||||||
requestServer(`${GET_AZMAYESH_SAMPLE_FIELDS}/${azmayeshTypeId}`, "get")
|
requestServer(`${GET_AZMAYESH_SAMPLE_FIELDS}/${azmayeshTypeId}`, "get")
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
setSampleInfo(response.data.data);
|
setSampleInfo(response.data.data);
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setOpenAddSampleDialog(true);
|
setOpenAddSampleDialog(true);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const initialValues = sampleInfo?.reduce((acc, item) => {
|
const initialValues = sampleInfo?.reduce((acc, item) => {
|
||||||
acc[item.id] = "";
|
acc[item.id] = "";
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
setDefaultValues(initialValues);
|
setDefaultValues(initialValues);
|
||||||
}, [sampleInfo]);
|
}, [sampleInfo]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isMobile ? (
|
{isMobile ? (
|
||||||
<IconButton aria-label="ایجاد نمونه جدید" color="primary" onClick={handleGetFields}>
|
<IconButton aria-label="ایجاد نمونه جدید" color="primary" onClick={handleGetFields}>
|
||||||
<AddCircle sx={{ fontSize: "25px" }} />
|
<AddCircle sx={{ fontSize: "25px" }} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
) : (
|
) : (
|
||||||
<Button variant="contained" color="primary" startIcon={<AddCircle />} onClick={handleGetFields}>
|
<Button variant="contained" color="primary" startIcon={<AddCircle />} onClick={handleGetFields}>
|
||||||
ثبت نمونه
|
ثبت نمونه
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<CandUSampleOfAzmayesh
|
<CandUSampleOfAzmayesh
|
||||||
openSampleDialog={openAddSampleDialog}
|
openSampleDialog={openAddSampleDialog}
|
||||||
setOpenSampleDialog={setOpenAddSampleDialog}
|
setOpenSampleDialog={setOpenAddSampleDialog}
|
||||||
sampleInfo={sampleInfo}
|
sampleInfo={sampleInfo}
|
||||||
mutate={mutate}
|
mutate={mutate}
|
||||||
rowId={rowId}
|
rowId={rowId}
|
||||||
defaultValues={defaultValues}
|
defaultValues={defaultValues}
|
||||||
setDefaultValues={setDefaultValues}
|
setDefaultValues={setDefaultValues}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default AddSampleToAzmayesh;
|
export default AddSampleToAzmayesh;
|
||||||
|
|||||||
@@ -1,82 +1,82 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Box, Chip, Divider, Grid, Stack, Typography } from "@mui/material";
|
import { Box, Chip, Divider, Grid, Stack, Typography } from "@mui/material";
|
||||||
import ScienceIcon from "@mui/icons-material/Science";
|
import ScienceIcon from "@mui/icons-material/Science";
|
||||||
import LocationCityIcon from "@mui/icons-material/LocationCity";
|
import LocationCityIcon from "@mui/icons-material/LocationCity";
|
||||||
|
|
||||||
const AzmayeshInfo = ({ rowData }) => {
|
const AzmayeshInfo = ({ rowData }) => {
|
||||||
return (
|
return (
|
||||||
<Stack sx={{ p: 2, alignItems: "center" }}>
|
<Stack sx={{ p: 2, alignItems: "center" }}>
|
||||||
<Typography variant="body1" sx={{ fontWeight: 600, pb: 4 }}>
|
<Typography variant="body1" sx={{ fontWeight: 600, pb: 4 }}>
|
||||||
{rowData.project_name}
|
{rowData.project_name}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Grid container spacing={2} sx={{ alignItems: "center", justifyContent: "space-around" }}>
|
<Grid container spacing={2} sx={{ alignItems: "center", justifyContent: "space-around" }}>
|
||||||
<Grid item xs={12} sm={6} sx={{ display: "flex", alignItems: "center" }}>
|
<Grid item xs={12} sm={6} sx={{ display: "flex", alignItems: "center" }}>
|
||||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||||
<Chip
|
<Chip
|
||||||
icon={<ScienceIcon />}
|
icon={<ScienceIcon />}
|
||||||
label={
|
label={
|
||||||
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.700" }}>
|
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.700" }}>
|
||||||
نوع آزمایش
|
نوع آزمایش
|
||||||
</Typography>
|
</Typography>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Divider sx={{ flex: 1, mx: 2 }} />
|
<Divider sx={{ flex: 1, mx: 2 }} />
|
||||||
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.800" }}>
|
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.800" }}>
|
||||||
{rowData.azmayesh_type_name}
|
{rowData.azmayesh_type_name}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} sm={6} sx={{ display: "flex", alignItems: "center" }}>
|
<Grid item xs={12} sm={6} sx={{ display: "flex", alignItems: "center" }}>
|
||||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||||
<Chip
|
<Chip
|
||||||
icon={<LocationCityIcon />}
|
icon={<LocationCityIcon />}
|
||||||
label={
|
label={
|
||||||
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.700" }}>
|
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.700" }}>
|
||||||
نام استان
|
نام استان
|
||||||
</Typography>
|
</Typography>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Divider sx={{ flex: 1, mx: 2 }} />
|
<Divider sx={{ flex: 1, mx: 2 }} />
|
||||||
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.800" }}>
|
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.800" }}>
|
||||||
{rowData.province_name}
|
{rowData.province_name}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} sm={6} sx={{ display: "flex", alignItems: "center" }}>
|
<Grid item xs={12} sm={6} sx={{ display: "flex", alignItems: "center" }}>
|
||||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||||
<Chip
|
<Chip
|
||||||
icon={<LocationCityIcon />}
|
icon={<LocationCityIcon />}
|
||||||
label={
|
label={
|
||||||
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.700" }}>
|
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.700" }}>
|
||||||
شماره کار
|
شماره کار
|
||||||
</Typography>
|
</Typography>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Divider sx={{ flex: 1, mx: 2 }} />
|
<Divider sx={{ flex: 1, mx: 2 }} />
|
||||||
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.800" }}>
|
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.800" }}>
|
||||||
{rowData.work_number}
|
{rowData.work_number}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} sm={6} sx={{ display: "flex", alignItems: "center" }}>
|
<Grid item xs={12} sm={6} sx={{ display: "flex", alignItems: "center" }}>
|
||||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||||
<Chip
|
<Chip
|
||||||
icon={<LocationCityIcon />}
|
icon={<LocationCityIcon />}
|
||||||
label={
|
label={
|
||||||
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.700" }}>
|
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.700" }}>
|
||||||
شماره درخواست
|
شماره درخواست
|
||||||
</Typography>
|
</Typography>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Divider sx={{ flex: 1, mx: 2 }} />
|
<Divider sx={{ flex: 1, mx: 2 }} />
|
||||||
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.800" }}>
|
<Typography variant="body2" sx={{ fontWeight: 600, color: "grey.800" }}>
|
||||||
{rowData.request_number}
|
{rowData.request_number}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default AzmayeshInfo;
|
export default AzmayeshInfo;
|
||||||
|
|||||||
@@ -1,76 +1,76 @@
|
|||||||
import { Button, DialogActions, DialogContent, DialogTitle } from "@mui/material";
|
import { Button, DialogActions, DialogContent, DialogTitle } from "@mui/material";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { ADD_SAMPLE_TO_AZMAYESH, UPDATE_SAMPLE_OF_AZMAYESH } from "@/core/utils/routes";
|
import { ADD_SAMPLE_TO_AZMAYESH, UPDATE_SAMPLE_OF_AZMAYESH } from "@/core/utils/routes";
|
||||||
import FormMaker from "@/core/components/FormMaker";
|
import FormMaker from "@/core/components/FormMaker";
|
||||||
import { DialogHeader } from "next/dist/client/components/react-dev-overlay/internal/components/Dialog";
|
import { DialogHeader } from "next/dist/client/components/react-dev-overlay/internal/components/Dialog";
|
||||||
|
|
||||||
const CandUSampleOfAzmayesh = ({
|
const CandUSampleOfAzmayesh = ({
|
||||||
sampleInfo,
|
sampleInfo,
|
||||||
mutate,
|
mutate,
|
||||||
rowId,
|
rowId,
|
||||||
setOpenSampleDialog,
|
setOpenSampleDialog,
|
||||||
defaultValues,
|
defaultValues,
|
||||||
setDefaultValues,
|
setDefaultValues,
|
||||||
isUpdate,
|
isUpdate,
|
||||||
azmayesh_id,
|
azmayesh_id,
|
||||||
}) => {
|
}) => {
|
||||||
const requestServer = useRequest({ notificationSuccess: true });
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
const data = {};
|
const data = {};
|
||||||
setIsSubmitting(true);
|
setIsSubmitting(true);
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("azmayesh_id", isUpdate ? azmayesh_id : rowId);
|
formData.append("azmayesh_id", isUpdate ? azmayesh_id : rowId);
|
||||||
Object.entries(defaultValues).forEach(([key, value]) => {
|
Object.entries(defaultValues).forEach(([key, value]) => {
|
||||||
data[key] = value;
|
data[key] = value;
|
||||||
});
|
});
|
||||||
formData.append("data", JSON.stringify(data));
|
formData.append("data", JSON.stringify(data));
|
||||||
try {
|
try {
|
||||||
await requestServer(
|
await requestServer(
|
||||||
isUpdate ? `${UPDATE_SAMPLE_OF_AZMAYESH}/${rowId}` : `${ADD_SAMPLE_TO_AZMAYESH}`,
|
isUpdate ? `${UPDATE_SAMPLE_OF_AZMAYESH}/${rowId}` : `${ADD_SAMPLE_TO_AZMAYESH}`,
|
||||||
"post",
|
"post",
|
||||||
{
|
{
|
||||||
data: formData,
|
data: formData,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
mutate();
|
mutate();
|
||||||
setOpenSampleDialog(false);
|
setOpenSampleDialog(false);
|
||||||
setIsSubmitting(false);
|
setIsSubmitting(false);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setIsSubmitting(false);
|
setIsSubmitting(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>{isUpdate ? "ویرایش نمونه" : "افزودن نمونه"}</DialogTitle>
|
<DialogTitle>{isUpdate ? "ویرایش نمونه" : "افزودن نمونه"}</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<FormMaker formInfo={sampleInfo} defaultValues={defaultValues} setDefaultValues={setDefaultValues} />
|
<FormMaker formInfo={sampleInfo} defaultValues={defaultValues} setDefaultValues={setDefaultValues} />
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => setOpenSampleDialog(false)}
|
onClick={() => setOpenSampleDialog(false)}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
color="error"
|
color="error"
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
>
|
>
|
||||||
بستن
|
بستن
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={handleSubmit} variant="contained" color="primary" disabled={isSubmitting}>
|
<Button onClick={handleSubmit} variant="contained" color="primary" disabled={isSubmitting}>
|
||||||
{isUpdate
|
{isUpdate
|
||||||
? isSubmitting
|
? isSubmitting
|
||||||
? "در حال ویرایش نمونه"
|
? "در حال ویرایش نمونه"
|
||||||
: "ویرایش نمونه"
|
: "ویرایش نمونه"
|
||||||
: isSubmitting
|
: isSubmitting
|
||||||
? "در حال ثبت نمونه"
|
? "در حال ثبت نمونه"
|
||||||
: "ثبت نمونه"}
|
: "ثبت نمونه"}
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default CandUSampleOfAzmayesh;
|
export default CandUSampleOfAzmayesh;
|
||||||
|
|||||||
@@ -1,74 +1,74 @@
|
|||||||
import { Button, Dialog, DialogActions, DialogContent, DialogTitle } from "@mui/material";
|
import { Button, Dialog, DialogActions, DialogContent, DialogTitle } from "@mui/material";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { ADD_SAMPLE_TO_AZMAYESH, UPDATE_SAMPLE_OF_AZMAYESH } from "@/core/utils/routes";
|
import { ADD_SAMPLE_TO_AZMAYESH, UPDATE_SAMPLE_OF_AZMAYESH } from "@/core/utils/routes";
|
||||||
import FormMaker from "@/core/components/FormMaker";
|
import FormMaker from "@/core/components/FormMaker";
|
||||||
import { DialogHeader } from "next/dist/client/components/react-dev-overlay/internal/components/Dialog";
|
import { DialogHeader } from "next/dist/client/components/react-dev-overlay/internal/components/Dialog";
|
||||||
|
|
||||||
const CandUSampleOfAzmayesh = ({
|
const CandUSampleOfAzmayesh = ({
|
||||||
sampleInfo,
|
sampleInfo,
|
||||||
mutate,
|
mutate,
|
||||||
rowId,
|
rowId,
|
||||||
openSampleDialog,
|
openSampleDialog,
|
||||||
setOpenSampleDialog,
|
setOpenSampleDialog,
|
||||||
defaultValues,
|
defaultValues,
|
||||||
setDefaultValues,
|
setDefaultValues,
|
||||||
isUpdate,
|
isUpdate,
|
||||||
azmayesh_id,
|
azmayesh_id,
|
||||||
}) => {
|
}) => {
|
||||||
const requestServer = useRequest({ notificationSuccess: true });
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
|
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
const data = {};
|
const data = {};
|
||||||
setIsSubmitting(true);
|
setIsSubmitting(true);
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("azmayesh_id", isUpdate ? azmayesh_id : rowId);
|
formData.append("azmayesh_id", isUpdate ? azmayesh_id : rowId);
|
||||||
Object.entries(defaultValues).forEach(([key, value]) => {
|
Object.entries(defaultValues).forEach(([key, value]) => {
|
||||||
data[key] = value;
|
data[key] = value;
|
||||||
});
|
});
|
||||||
formData.append("data", JSON.stringify(data));
|
formData.append("data", JSON.stringify(data));
|
||||||
requestServer(isUpdate ? `${UPDATE_SAMPLE_OF_AZMAYESH}/${rowId}` : `${ADD_SAMPLE_TO_AZMAYESH}`, "post", {
|
requestServer(isUpdate ? `${UPDATE_SAMPLE_OF_AZMAYESH}/${rowId}` : `${ADD_SAMPLE_TO_AZMAYESH}`, "post", {
|
||||||
data: formData,
|
data: formData,
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
mutate();
|
mutate();
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setOpenSampleDialog(false);
|
setOpenSampleDialog(false);
|
||||||
setIsSubmitting(false);
|
setIsSubmitting(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog maxWidth="md" fullWidth open={openSampleDialog}>
|
<Dialog maxWidth="md" fullWidth open={openSampleDialog}>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>{isUpdate ? "ویرایش نمونه" : "افزودن نمونه"}</DialogTitle>
|
<DialogTitle>{isUpdate ? "ویرایش نمونه" : "افزودن نمونه"}</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<FormMaker formInfo={sampleInfo} defaultValues={defaultValues} setDefaultValues={setDefaultValues} />
|
<FormMaker formInfo={sampleInfo} defaultValues={defaultValues} setDefaultValues={setDefaultValues} />
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => setOpenSampleDialog(false)}
|
onClick={() => setOpenSampleDialog(false)}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
color="error"
|
color="error"
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
>
|
>
|
||||||
بستن
|
بستن
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={handleSubmit} variant="contained" color="primary" disabled={isSubmitting}>
|
<Button onClick={handleSubmit} variant="contained" color="primary" disabled={isSubmitting}>
|
||||||
{isUpdate
|
{isUpdate
|
||||||
? isSubmitting
|
? isSubmitting
|
||||||
? "در حال ویرایش نمونه"
|
? "در حال ویرایش نمونه"
|
||||||
: "ویرایش نمونه"
|
: "ویرایش نمونه"
|
||||||
: isSubmitting
|
: isSubmitting
|
||||||
? "در حال ثبت نمونه"
|
? "در حال ثبت نمونه"
|
||||||
: "ثبت نمونه"}
|
: "ثبت نمونه"}
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default CandUSampleOfAzmayesh;
|
export default CandUSampleOfAzmayesh;
|
||||||
|
|||||||
@@ -1,78 +1,78 @@
|
|||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogActions,
|
DialogActions,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
IconButton,
|
IconButton,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Typography,
|
Typography,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import DeleteIcon from "@mui/icons-material/Delete";
|
import DeleteIcon from "@mui/icons-material/Delete";
|
||||||
import { DELETE_SAMPLE_LIST } from "@/core/utils/routes";
|
import { DELETE_SAMPLE_LIST } from "@/core/utils/routes";
|
||||||
|
|
||||||
const DeleteSample = ({ rowId, mutate }) => {
|
const DeleteSample = ({ rowId, mutate }) => {
|
||||||
const requestServer = useRequest({ notificationSuccess: true });
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
const [openDeleteDialog, setOpenDeleteDialog] = useState(false);
|
const [openDeleteDialog, setOpenDeleteDialog] = useState(false);
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
|
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
setIsSubmitting(true);
|
setIsSubmitting(true);
|
||||||
requestServer(`${DELETE_SAMPLE_LIST}/${rowId}`, "post")
|
requestServer(`${DELETE_SAMPLE_LIST}/${rowId}`, "post")
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setOpenDeleteDialog(false);
|
setOpenDeleteDialog(false);
|
||||||
mutate();
|
mutate();
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setIsSubmitting(false);
|
setIsSubmitting(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Tooltip title="حذف نمونه" arrow placement="right">
|
<Tooltip title="حذف نمونه" arrow placement="right">
|
||||||
<IconButton
|
<IconButton
|
||||||
color="error"
|
color="error"
|
||||||
sx={{ textTransform: "unset", alignSelf: "center" }}
|
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setOpenDeleteDialog(true);
|
setOpenDeleteDialog(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<DeleteIcon />
|
<DeleteIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Dialog
|
<Dialog
|
||||||
maxWidth="sm"
|
maxWidth="sm"
|
||||||
open={openDeleteDialog}
|
open={openDeleteDialog}
|
||||||
PaperProps={{
|
PaperProps={{
|
||||||
sx: {
|
sx: {
|
||||||
boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
|
boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<DialogTitle>حذف نمونه</DialogTitle>
|
<DialogTitle>حذف نمونه</DialogTitle>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<Typography>آیا از حذف این نمونه مطمئن هستید؟</Typography>
|
<Typography>آیا از حذف این نمونه مطمئن هستید؟</Typography>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => setOpenDeleteDialog(false)}
|
onClick={() => setOpenDeleteDialog(false)}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
color="primary"
|
color="primary"
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
autoFocus
|
autoFocus
|
||||||
>
|
>
|
||||||
بستن
|
بستن
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={handleSubmit} variant="contained" color="error" disabled={isSubmitting}>
|
<Button onClick={handleSubmit} variant="contained" color="error" disabled={isSubmitting}>
|
||||||
حذف
|
حذف
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default DeleteSample;
|
export default DeleteSample;
|
||||||
|
|||||||
@@ -1,60 +1,60 @@
|
|||||||
import { IconButton, Tooltip } from "@mui/material";
|
import { IconButton, Tooltip } from "@mui/material";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { GET_AZMAYESH_SAMPLE_FIELDS, GET_SAMPLE_LIST } from "@/core/utils/routes";
|
import { GET_AZMAYESH_SAMPLE_FIELDS, GET_SAMPLE_LIST } from "@/core/utils/routes";
|
||||||
import CandUSampleOfAzmayesh from "@/components/dashboard/azmayesh/RowActions/ShowSampleOfAzmayesh/Forms/CandUSampleOfAzmayesh";
|
import CandUSampleOfAzmayesh from "@/components/dashboard/azmayesh/RowActions/ShowSampleOfAzmayesh/Forms/CandUSampleOfAzmayesh";
|
||||||
import EditIcon from "@mui/icons-material/Edit";
|
import EditIcon from "@mui/icons-material/Edit";
|
||||||
|
|
||||||
const UpdateSample = ({ azmayeshTypeId, mutate, rowId, azmayesh_id }) => {
|
const UpdateSample = ({ azmayeshTypeId, mutate, rowId, azmayesh_id }) => {
|
||||||
const requestServer = useRequest();
|
const requestServer = useRequest();
|
||||||
const [sampleInfo, setSampleInfo] = useState(null);
|
const [sampleInfo, setSampleInfo] = useState(null);
|
||||||
const [openUpdateSampleDialog, setOpenUpdateSampleDialog] = useState(false);
|
const [openUpdateSampleDialog, setOpenUpdateSampleDialog] = useState(false);
|
||||||
const [defaultValues, setDefaultValues] = useState({});
|
const [defaultValues, setDefaultValues] = useState({});
|
||||||
const [sampleDetail, setSampleDetail] = useState({});
|
const [sampleDetail, setSampleDetail] = useState({});
|
||||||
|
|
||||||
const handleGetFields = () => {
|
const handleGetFields = () => {
|
||||||
requestServer(`${GET_AZMAYESH_SAMPLE_FIELDS}/${azmayeshTypeId}`, "get")
|
requestServer(`${GET_AZMAYESH_SAMPLE_FIELDS}/${azmayeshTypeId}`, "get")
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
setSampleInfo(response.data.data);
|
setSampleInfo(response.data.data);
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
requestServer(`${GET_SAMPLE_LIST}/${rowId}`, "get")
|
requestServer(`${GET_SAMPLE_LIST}/${rowId}`, "get")
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
setSampleDetail(JSON.parse(response.data.data.data));
|
setSampleDetail(JSON.parse(response.data.data.data));
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setOpenUpdateSampleDialog(true);
|
setOpenUpdateSampleDialog(true);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setDefaultValues(sampleDetail);
|
setDefaultValues(sampleDetail);
|
||||||
}, [sampleDetail]);
|
}, [sampleDetail]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Tooltip title="ویرایش نمونه" arrow placement="right">
|
<Tooltip title="ویرایش نمونه" arrow placement="right">
|
||||||
<IconButton
|
<IconButton
|
||||||
color="success"
|
color="success"
|
||||||
sx={{ textTransform: "unset", alignSelf: "center" }}
|
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||||
onClick={handleGetFields}
|
onClick={handleGetFields}
|
||||||
>
|
>
|
||||||
<EditIcon />
|
<EditIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<CandUSampleOfAzmayesh
|
<CandUSampleOfAzmayesh
|
||||||
openSampleDialog={openUpdateSampleDialog}
|
openSampleDialog={openUpdateSampleDialog}
|
||||||
setOpenSampleDialog={setOpenUpdateSampleDialog}
|
setOpenSampleDialog={setOpenUpdateSampleDialog}
|
||||||
sampleInfo={sampleInfo}
|
sampleInfo={sampleInfo}
|
||||||
mutate={mutate}
|
mutate={mutate}
|
||||||
rowId={rowId}
|
rowId={rowId}
|
||||||
defaultValues={defaultValues}
|
defaultValues={defaultValues}
|
||||||
setDefaultValues={setDefaultValues}
|
setDefaultValues={setDefaultValues}
|
||||||
isUpdate={true}
|
isUpdate={true}
|
||||||
azmayesh_id={azmayesh_id}
|
azmayesh_id={azmayesh_id}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default UpdateSample;
|
export default UpdateSample;
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
import { Box } from "@mui/material";
|
import { Box } from "@mui/material";
|
||||||
import DeleteSample from "./DeleteSample";
|
import DeleteSample from "./DeleteSample";
|
||||||
import UpdateSample from "./UpdateSample";
|
import UpdateSample from "./UpdateSample";
|
||||||
|
|
||||||
const RowActions = ({ rowData, row, mutate }) => {
|
const RowActions = ({ rowData, row, mutate }) => {
|
||||||
return (
|
return (
|
||||||
<Box sx={{ display: "flex", gap: 1 }}>
|
<Box sx={{ display: "flex", gap: 1 }}>
|
||||||
<UpdateSample
|
<UpdateSample
|
||||||
mutate={mutate}
|
mutate={mutate}
|
||||||
rowId={row.getValue("id")}
|
rowId={row.getValue("id")}
|
||||||
azmayeshTypeId={rowData.azmayesh_type_id}
|
azmayeshTypeId={rowData.azmayesh_type_id}
|
||||||
azmayesh_id={rowData.id}
|
azmayesh_id={rowData.id}
|
||||||
/>
|
/>
|
||||||
<DeleteSample mutate={mutate} rowId={row.getValue("id")} />
|
<DeleteSample mutate={mutate} rowId={row.getValue("id")} />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default RowActions;
|
export default RowActions;
|
||||||
|
|||||||
@@ -1,80 +1,80 @@
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { Box, Typography } from "@mui/material";
|
import { Box, Typography } from "@mui/material";
|
||||||
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
|
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
|
||||||
import { GET_SAMPLE_LIST } from "@/core/utils/routes";
|
import { GET_SAMPLE_LIST } from "@/core/utils/routes";
|
||||||
import RowActions from "./RowActions";
|
import RowActions from "./RowActions";
|
||||||
import AzmayeshInfo from "@/components/dashboard/azmayesh/RowActions/ShowSampleOfAzmayesh/AzmayeshInfo";
|
import AzmayeshInfo from "@/components/dashboard/azmayesh/RowActions/ShowSampleOfAzmayesh/AzmayeshInfo";
|
||||||
import Toolbar from "./Toolbar";
|
import Toolbar from "./Toolbar";
|
||||||
import moment from "jalali-moment";
|
import moment from "jalali-moment";
|
||||||
|
|
||||||
const ShowSampleList = ({ sampleInfo, rowData }) => {
|
const ShowSampleList = ({ sampleInfo, rowData }) => {
|
||||||
const parsedData = (data) => {
|
const parsedData = (data) => {
|
||||||
return data.data.map((item) => ({
|
return data.data.map((item) => ({
|
||||||
...JSON.parse(item.data),
|
...JSON.parse(item.data),
|
||||||
id: item.id,
|
id: item.id,
|
||||||
updated_at: item.updated_at,
|
updated_at: item.updated_at,
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
const columns = useMemo(
|
const columns = useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
accessorKey: "id",
|
accessorKey: "id",
|
||||||
header: "کد یکتا",
|
header: "کد یکتا",
|
||||||
id: "id",
|
id: "id",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
grow: false,
|
grow: false,
|
||||||
size: 100,
|
size: 100,
|
||||||
},
|
},
|
||||||
...sampleInfo.map((item) => ({
|
...sampleInfo.map((item) => ({
|
||||||
accessorKey: item.id.toString(),
|
accessorKey: item.id.toString(),
|
||||||
header: item.unit ? `${item.name} (${item.unit})` : item.name,
|
header: item.unit ? `${item.name} (${item.unit})` : item.name,
|
||||||
id: item.id.toString(),
|
id: item.id.toString(),
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
})),
|
})),
|
||||||
{
|
{
|
||||||
accessorKey: "updated_at",
|
accessorKey: "updated_at",
|
||||||
header: "تاریخ بروزرسانی",
|
header: "تاریخ بروزرسانی",
|
||||||
id: "updated_at",
|
id: "updated_at",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "date",
|
datatype: "date",
|
||||||
grow: false,
|
grow: false,
|
||||||
size: 100,
|
size: 100,
|
||||||
Cell: ({ renderedCellValue }) => (
|
Cell: ({ renderedCellValue }) => (
|
||||||
<Typography variant="body2">
|
<Typography variant="body2">
|
||||||
{renderedCellValue ? moment(renderedCellValue).locale("fa").format("HH:mm | YYYY/MM/DD") : "-"}
|
{renderedCellValue ? moment(renderedCellValue).locale("fa").format("HH:mm | YYYY/MM/DD") : "-"}
|
||||||
</Typography>
|
</Typography>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[sampleInfo]
|
[sampleInfo]
|
||||||
);
|
);
|
||||||
|
|
||||||
const ToolbarWithRowData = (props) => <Toolbar rowData={rowData} {...props} />;
|
const ToolbarWithRowData = (props) => <Toolbar rowData={rowData} {...props} />;
|
||||||
const RowActionsWithRowData = (props) => <RowActions rowData={rowData} {...props} />;
|
const RowActionsWithRowData = (props) => <RowActions rowData={rowData} {...props} />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<AzmayeshInfo rowData={rowData} />
|
<AzmayeshInfo rowData={rowData} />
|
||||||
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
||||||
<DataTableWithAuth
|
<DataTableWithAuth
|
||||||
table_title={"نمونه های ثبت شده"}
|
table_title={"نمونه های ثبت شده"}
|
||||||
need_filter={false}
|
need_filter={false}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
table_url={`${GET_SAMPLE_LIST}/index/${rowData.id}`}
|
table_url={`${GET_SAMPLE_LIST}/index/${rowData.id}`}
|
||||||
page_name={`azmayesh_${rowData.azmayesh_type_id}`}
|
page_name={`azmayesh_${rowData.azmayesh_type_id}`}
|
||||||
table_name={"sample_list"}
|
table_name={"sample_list"}
|
||||||
TableToolbar={ToolbarWithRowData}
|
TableToolbar={ToolbarWithRowData}
|
||||||
specific_data={parsedData}
|
specific_data={parsedData}
|
||||||
enableRowActions
|
enableRowActions
|
||||||
positionActionsColumn={"last"}
|
positionActionsColumn={"last"}
|
||||||
RowActions={RowActionsWithRowData}
|
RowActions={RowActionsWithRowData}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ShowSampleList;
|
export default ShowSampleList;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import AddSampleToAzmayesh from "./Actions/Create";
|
import AddSampleToAzmayesh from "./Actions/Create";
|
||||||
|
|
||||||
const Toolbar = ({ mutate, rowData }) => {
|
const Toolbar = ({ mutate, rowData }) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AddSampleToAzmayesh mutate={mutate} azmayeshTypeId={rowData.azmayesh_type_id} rowId={rowData.id} />
|
<AddSampleToAzmayesh mutate={mutate} azmayeshTypeId={rowData.azmayesh_type_id} rowId={rowData.id} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default Toolbar;
|
export default Toolbar;
|
||||||
|
|||||||
@@ -1,46 +1,46 @@
|
|||||||
import { Box, Button, Dialog, DialogActions, DialogContent, IconButton, Tooltip } from "@mui/material";
|
import { Box, Button, Dialog, DialogActions, DialogContent, IconButton, Tooltip } from "@mui/material";
|
||||||
import AssignmentIcon from "@mui/icons-material/Assignment";
|
import AssignmentIcon from "@mui/icons-material/Assignment";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import ShowSampleList from "./ShowSampleList";
|
import ShowSampleList from "./ShowSampleList";
|
||||||
import { GET_AZMAYESH_SAMPLE_FIELDS } from "@/core/utils/routes";
|
import { GET_AZMAYESH_SAMPLE_FIELDS } from "@/core/utils/routes";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
|
|
||||||
const ShowSampleOfAzmayesh = ({ rowData }) => {
|
const ShowSampleOfAzmayesh = ({ rowData }) => {
|
||||||
const requestServer = useRequest();
|
const requestServer = useRequest();
|
||||||
const [openShowSampleDialog, setOpenShowSampleDialog] = useState(false);
|
const [openShowSampleDialog, setOpenShowSampleDialog] = useState(false);
|
||||||
const [sampleInfo, setSampleInfo] = useState(null);
|
const [sampleInfo, setSampleInfo] = useState(null);
|
||||||
const handleGetSampleFields = () => {
|
const handleGetSampleFields = () => {
|
||||||
requestServer(`${GET_AZMAYESH_SAMPLE_FIELDS}/${rowData.azmayesh_type_id}`, "get")
|
requestServer(`${GET_AZMAYESH_SAMPLE_FIELDS}/${rowData.azmayesh_type_id}`, "get")
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
setSampleInfo(response.data.data);
|
setSampleInfo(response.data.data);
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setOpenShowSampleDialog(true);
|
setOpenShowSampleDialog(true);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<Box sx={{ display: "flex", justifyContent: "center" }}>
|
<Box sx={{ display: "flex", justifyContent: "center" }}>
|
||||||
<Tooltip title="نمایش نمونه های آزمایش" arrow placement="right">
|
<Tooltip title="نمایش نمونه های آزمایش" arrow placement="right">
|
||||||
<IconButton
|
<IconButton
|
||||||
color="primary"
|
color="primary"
|
||||||
sx={{ textTransform: "unset", alignSelf: "center" }}
|
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||||
onClick={handleGetSampleFields}
|
onClick={handleGetSampleFields}
|
||||||
>
|
>
|
||||||
<AssignmentIcon />
|
<AssignmentIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Dialog maxWidth="lg" fullWidth open={openShowSampleDialog}>
|
<Dialog maxWidth="lg" fullWidth open={openShowSampleDialog}>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<ShowSampleList rowData={rowData} sampleInfo={sampleInfo} />
|
<ShowSampleList rowData={rowData} sampleInfo={sampleInfo} />
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={() => setOpenShowSampleDialog(false)} variant="outlined" color="error">
|
<Button onClick={() => setOpenShowSampleDialog(false)} variant="outlined" color="error">
|
||||||
بستن
|
بستن
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default ShowSampleOfAzmayesh;
|
export default ShowSampleOfAzmayesh;
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { Box } from "@mui/material";
|
import { Box } from "@mui/material";
|
||||||
import DeleteAzmayesh from "./DeleteAzmayesh";
|
import DeleteAzmayesh from "./DeleteAzmayesh";
|
||||||
import ShowSampleOfAzmayesh from "@/components/dashboard/azmayesh/RowActions/ShowSampleOfAzmayesh";
|
import ShowSampleOfAzmayesh from "@/components/dashboard/azmayesh/RowActions/ShowSampleOfAzmayesh";
|
||||||
import AzmayeshUpdate from "@/components/dashboard/azmayesh/RowActions/AzmayeshUpdate";
|
import AzmayeshUpdate from "@/components/dashboard/azmayesh/RowActions/AzmayeshUpdate";
|
||||||
|
|
||||||
const RowActions = ({ row, mutate }) => {
|
const RowActions = ({ row, mutate }) => {
|
||||||
return (
|
return (
|
||||||
<Box sx={{ display: "flex", gap: 1 }}>
|
<Box sx={{ display: "flex", gap: 1 }}>
|
||||||
<AzmayeshUpdate mutate={mutate} rowId={row.getValue("id")} />
|
<AzmayeshUpdate mutate={mutate} rowId={row.getValue("id")} />
|
||||||
<DeleteAzmayesh mutate={mutate} rowId={row.getValue("id")} />
|
<DeleteAzmayesh mutate={mutate} rowId={row.getValue("id")} />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default RowActions;
|
export default RowActions;
|
||||||
|
|||||||
@@ -1,52 +1,52 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import ExploreIcon from "@mui/icons-material/Explore";
|
import ExploreIcon from "@mui/icons-material/Explore";
|
||||||
import { Box, Button, Dialog, DialogActions, DialogContent, IconButton } from "@mui/material";
|
import { Box, Button, Dialog, DialogActions, DialogContent, IconButton } from "@mui/material";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
import MapLoading from "@/core/components/MapLayer/Loading";
|
import MapLoading from "@/core/components/MapLayer/Loading";
|
||||||
import ShowLocationMarker from "@/core/components/ShowLocationMarker";
|
import ShowLocationMarker from "@/core/components/ShowLocationMarker";
|
||||||
|
|
||||||
const MapLayer = dynamic(() => import("@/core/components/MapLayer"), {
|
const MapLayer = dynamic(() => import("@/core/components/MapLayer"), {
|
||||||
loading: () => <MapLoading />,
|
loading: () => <MapLoading />,
|
||||||
ssr: false,
|
ssr: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const ShowLocation = ({ lat, lng }) => {
|
const ShowLocation = ({ lat, lng }) => {
|
||||||
const [openShowLocationModal, setOpenShowLocationModal] = useState(false);
|
const [openShowLocationModal, setOpenShowLocationModal] = useState(false);
|
||||||
|
|
||||||
const handleOpenShowLocationModal = () => {
|
const handleOpenShowLocationModal = () => {
|
||||||
setOpenShowLocationModal(true);
|
setOpenShowLocationModal(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCloseShowLocationModal = () => {
|
const handleCloseShowLocationModal = () => {
|
||||||
setOpenShowLocationModal(false);
|
setOpenShowLocationModal(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box sx={{ display: "flex", justifyContent: "center" }}>
|
<Box sx={{ display: "flex", justifyContent: "center" }}>
|
||||||
<IconButton onClick={handleOpenShowLocationModal} size="small" color="primary">
|
<IconButton onClick={handleOpenShowLocationModal} size="small" color="primary">
|
||||||
<ExploreIcon />
|
<ExploreIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<Dialog
|
<Dialog
|
||||||
open={openShowLocationModal}
|
open={openShowLocationModal}
|
||||||
onClose={handleCloseShowLocationModal}
|
onClose={handleCloseShowLocationModal}
|
||||||
aria-labelledby="responsive-dialog-title"
|
aria-labelledby="responsive-dialog-title"
|
||||||
>
|
>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<Box sx={{ width: "400px", height: "400px" }}>
|
<Box sx={{ width: "400px", height: "400px" }}>
|
||||||
<MapLayer>
|
<MapLayer>
|
||||||
<ShowLocationMarker start_lat={lat} start_lng={lng} />
|
<ShowLocationMarker start_lat={lat} start_lng={lng} />
|
||||||
</MapLayer>
|
</MapLayer>
|
||||||
</Box>
|
</Box>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button color="error" variant="outlined" onClick={handleCloseShowLocationModal}>
|
<Button color="error" variant="outlined" onClick={handleCloseShowLocationModal}>
|
||||||
بستن
|
بستن
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default ShowLocation;
|
export default ShowLocation;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import AzmayeshCreate from "./Actions/Create";
|
import AzmayeshCreate from "./Actions/Create";
|
||||||
|
|
||||||
const Toolbar = ({ mutate }) => {
|
const Toolbar = ({ mutate }) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AzmayeshCreate mutate={mutate} />
|
<AzmayeshCreate mutate={mutate} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default Toolbar;
|
export default Toolbar;
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import PageTitle from "@/core/components/PageTitle";
|
import PageTitle from "@/core/components/PageTitle";
|
||||||
import { Stack } from "@mui/material";
|
import { Stack } from "@mui/material";
|
||||||
import AzmayeshList from "./AzmayeshList";
|
import AzmayeshList from "./AzmayeshList";
|
||||||
|
|
||||||
const AzmayeshPage = () => {
|
const AzmayeshPage = () => {
|
||||||
return (
|
return (
|
||||||
<Stack spacing={1}>
|
<Stack spacing={1}>
|
||||||
<PageTitle title={"کارتابل آزمایشات (OPTS)"} />
|
<PageTitle title={"کارتابل آزمایشات (OPTS)"} />
|
||||||
<AzmayeshList />
|
<AzmayeshList />
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default AzmayeshPage;
|
export default AzmayeshPage;
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Button, IconButton, useMediaQuery } from "@mui/material";
|
import { Button, IconButton, useMediaQuery } from "@mui/material";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { AddCircle } from "@mui/icons-material";
|
import { AddCircle } from "@mui/icons-material";
|
||||||
import CandUAzmayeshType from "@/components/dashboard/azmayeshType/Forms/CandUAzmayeshType";
|
import CandUAzmayeshType from "@/components/dashboard/azmayeshType/Forms/CandUAzmayeshType";
|
||||||
|
|
||||||
const AzmayeshTypeCreate = ({ mutate }) => {
|
const AzmayeshTypeCreate = ({ mutate }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
const handleOpen = () => {
|
const handleOpen = () => {
|
||||||
setOpen(true);
|
setOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isMobile ? (
|
{isMobile ? (
|
||||||
<IconButton aria-label="ثبت نوع آزمایش جدید" color="primary" onClick={handleOpen}>
|
<IconButton aria-label="ثبت نوع آزمایش جدید" color="primary" onClick={handleOpen}>
|
||||||
<AddCircle sx={{ fontSize: "25px" }} />
|
<AddCircle sx={{ fontSize: "25px" }} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
) : (
|
) : (
|
||||||
<Button variant="contained" color="primary" startIcon={<AddCircle />} onClick={handleOpen}>
|
<Button variant="contained" color="primary" startIcon={<AddCircle />} onClick={handleOpen}>
|
||||||
ثبت نوع آزمایش
|
ثبت نوع آزمایش
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{open && <CandUAzmayeshType open={open} setOpen={setOpen} mutate={mutate} />}
|
{open && <CandUAzmayeshType open={open} setOpen={setOpen} mutate={mutate} />}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default AzmayeshTypeCreate;
|
export default AzmayeshTypeCreate;
|
||||||
|
|||||||
@@ -1,65 +1,65 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { Box, Typography } from "@mui/material";
|
import { Box, Typography } from "@mui/material";
|
||||||
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
|
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
|
||||||
import Toolbar from "./Toolbar";
|
import Toolbar from "./Toolbar";
|
||||||
import { GET_AZMAYESH_TYPE_LIST_TABLE } from "@/core/utils/routes";
|
import { GET_AZMAYESH_TYPE_LIST_TABLE } from "@/core/utils/routes";
|
||||||
import moment from "jalali-moment";
|
import moment from "jalali-moment";
|
||||||
import RowActions from "./RowActions";
|
import RowActions from "./RowActions";
|
||||||
|
|
||||||
const AzmayeshTypeList = () => {
|
const AzmayeshTypeList = () => {
|
||||||
const columns = useMemo(
|
const columns = useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
accessorKey: "id",
|
accessorKey: "id",
|
||||||
header: "کد یکتا",
|
header: "کد یکتا",
|
||||||
id: "id",
|
id: "id",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
filterMode: "notEquals",
|
filterMode: "notEquals",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "name",
|
accessorKey: "name",
|
||||||
header: "عنوان",
|
header: "عنوان",
|
||||||
id: "name",
|
id: "name",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
filterMode: "notEquals",
|
filterMode: "notEquals",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "updated_at",
|
accessorKey: "updated_at",
|
||||||
header: "تاریخ بروزرسانی",
|
header: "تاریخ بروزرسانی",
|
||||||
id: "updated_at",
|
id: "updated_at",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
datatype: "date",
|
datatype: "date",
|
||||||
filterMode: "equals",
|
filterMode: "equals",
|
||||||
Cell: ({ renderedCellValue }) => (
|
Cell: ({ renderedCellValue }) => (
|
||||||
<Typography variant="body2">
|
<Typography variant="body2">
|
||||||
{renderedCellValue ? moment(renderedCellValue).locale("fa").format("HH:mm | YYYY/MM/DD") : "-"}
|
{renderedCellValue ? moment(renderedCellValue).locale("fa").format("HH:mm | YYYY/MM/DD") : "-"}
|
||||||
</Typography>
|
</Typography>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
||||||
<DataTableWithAuth
|
<DataTableWithAuth
|
||||||
table_title={"لیست انواع آزمایشات"}
|
table_title={"لیست انواع آزمایشات"}
|
||||||
need_filter={false}
|
need_filter={false}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
sorting={[{ id: "id", desc: true }]}
|
sorting={[{ id: "id", desc: true }]}
|
||||||
table_url={GET_AZMAYESH_TYPE_LIST_TABLE}
|
table_url={GET_AZMAYESH_TYPE_LIST_TABLE}
|
||||||
page_name={"azmayeshType"}
|
page_name={"azmayeshType"}
|
||||||
table_name={"azmayeshTypeList"}
|
table_name={"azmayeshTypeList"}
|
||||||
TableToolbar={Toolbar}
|
TableToolbar={Toolbar}
|
||||||
enableRowActions
|
enableRowActions
|
||||||
positionActionsColumn={"last"}
|
positionActionsColumn={"last"}
|
||||||
RowActions={RowActions}
|
RowActions={RowActions}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default AzmayeshTypeList;
|
export default AzmayeshTypeList;
|
||||||
|
|||||||
@@ -1,181 +1,181 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Chip,
|
Chip,
|
||||||
FormControl,
|
FormControl,
|
||||||
FormHelperText,
|
FormHelperText,
|
||||||
Grid,
|
Grid,
|
||||||
InputAdornment,
|
InputAdornment,
|
||||||
InputLabel,
|
InputLabel,
|
||||||
MenuItem,
|
MenuItem,
|
||||||
OutlinedInput,
|
OutlinedInput,
|
||||||
Select,
|
Select,
|
||||||
Typography,
|
Typography,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import ExtensionIcon from "@mui/icons-material/Extension";
|
import ExtensionIcon from "@mui/icons-material/Extension";
|
||||||
import SelectItemBox from "@/components/dashboard/azmayeshType/Forms/CandUAzmayeshType/SelectItemBox";
|
import SelectItemBox from "@/components/dashboard/azmayeshType/Forms/CandUAzmayeshType/SelectItemBox";
|
||||||
import KeyboardIcon from "@mui/icons-material/Keyboard";
|
import KeyboardIcon from "@mui/icons-material/Keyboard";
|
||||||
import TextFieldsIcon from "@mui/icons-material/TextFields";
|
import TextFieldsIcon from "@mui/icons-material/TextFields";
|
||||||
import ViewListIcon from "@mui/icons-material/ViewList";
|
import ViewListIcon from "@mui/icons-material/ViewList";
|
||||||
import CalendarMonthIcon from "@mui/icons-material/CalendarMonth";
|
import CalendarMonthIcon from "@mui/icons-material/CalendarMonth";
|
||||||
|
|
||||||
const fieldTypeList = [
|
const fieldTypeList = [
|
||||||
{ value: "input", label: "متن", icon: <TextFieldsIcon /> },
|
{ value: "input", label: "متن", icon: <TextFieldsIcon /> },
|
||||||
{ value: "select", label: "انتخابی", icon: <ViewListIcon /> },
|
{ value: "select", label: "انتخابی", icon: <ViewListIcon /> },
|
||||||
{ value: "date", label: "تاریخ", icon: <CalendarMonthIcon /> },
|
{ value: "date", label: "تاریخ", icon: <CalendarMonthIcon /> },
|
||||||
];
|
];
|
||||||
|
|
||||||
const AzmayeshFields = ({ errors, selectedListItem, register, setValue, fields, watch }) => {
|
const AzmayeshFields = ({ errors, selectedListItem, register, setValue, fields, watch }) => {
|
||||||
const watchedFields = watch("fields");
|
const watchedFields = watch("fields");
|
||||||
const [isSelectType, setIsSelectType] = useState(false);
|
const [isSelectType, setIsSelectType] = useState(false);
|
||||||
const [openSelectItem, setOpenSelectItem] = useState(false);
|
const [openSelectItem, setOpenSelectItem] = useState(false);
|
||||||
const [typeIcon, setTypeIcon] = useState(<KeyboardIcon />);
|
const [typeIcon, setTypeIcon] = useState(<KeyboardIcon />);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const selectedIcon = fieldTypeList.find((option) => option.value === watchedFields?.[selectedListItem]?.type)
|
const selectedIcon = fieldTypeList.find((option) => option.value === watchedFields?.[selectedListItem]?.type)
|
||||||
?.icon || <KeyboardIcon />;
|
?.icon || <KeyboardIcon />;
|
||||||
setTypeIcon(selectedIcon);
|
setTypeIcon(selectedIcon);
|
||||||
setIsSelectType(watchedFields[selectedListItem]?.type === "select");
|
setIsSelectType(watchedFields[selectedListItem]?.type === "select");
|
||||||
}, [watchedFields, selectedListItem]);
|
}, [watchedFields, selectedListItem]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid container>
|
<Grid container>
|
||||||
<Grid xs={12} sm={6} sx={{ px: { xs: 0, sm: 1 }, py: 1 }}>
|
<Grid xs={12} sm={6} sx={{ px: { xs: 0, sm: 1 }, py: 1 }}>
|
||||||
<FormControl
|
<FormControl
|
||||||
error={!!errors.fields?.[selectedListItem]?.type}
|
error={!!errors.fields?.[selectedListItem]?.type}
|
||||||
size="small"
|
size="small"
|
||||||
fullWidth
|
fullWidth
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
>
|
>
|
||||||
<InputLabel htmlFor={`fields.${selectedListItem}.type`}>نوع</InputLabel>
|
<InputLabel htmlFor={`fields.${selectedListItem}.type`}>نوع</InputLabel>
|
||||||
<Select
|
<Select
|
||||||
id={`fields.${selectedListItem}.type`}
|
id={`fields.${selectedListItem}.type`}
|
||||||
label="نوع"
|
label="نوع"
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
{...register(`fields.${selectedListItem}.type`)}
|
{...register(`fields.${selectedListItem}.type`)}
|
||||||
size="small"
|
size="small"
|
||||||
fullWidth
|
fullWidth
|
||||||
value={watchedFields?.[selectedListItem]?.type || ""}
|
value={watchedFields?.[selectedListItem]?.type || ""}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
const selectedValue = event.target.value;
|
const selectedValue = event.target.value;
|
||||||
const selectedIcon = fieldTypeList.find((option) => option.value === selectedValue)
|
const selectedIcon = fieldTypeList.find((option) => option.value === selectedValue)
|
||||||
?.icon || <KeyboardIcon />;
|
?.icon || <KeyboardIcon />;
|
||||||
setValue(`fields.${selectedListItem}.type`, selectedValue);
|
setValue(`fields.${selectedListItem}.type`, selectedValue);
|
||||||
setIsSelectType(selectedValue === "select");
|
setIsSelectType(selectedValue === "select");
|
||||||
setTypeIcon(selectedIcon);
|
setTypeIcon(selectedIcon);
|
||||||
}}
|
}}
|
||||||
startAdornment={<InputAdornment position="start">{typeIcon}</InputAdornment>}
|
startAdornment={<InputAdornment position="start">{typeIcon}</InputAdornment>}
|
||||||
>
|
>
|
||||||
<MenuItem value="">نوع</MenuItem>
|
<MenuItem value="">نوع</MenuItem>
|
||||||
{fieldTypeList.map((option) => (
|
{fieldTypeList.map((option) => (
|
||||||
<MenuItem key={option.value} value={option.value}>
|
<MenuItem key={option.value} value={option.value}>
|
||||||
{option.label}
|
{option.label}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
<FormHelperText>{errors.fields?.[selectedListItem]?.type?.message}</FormHelperText>
|
<FormHelperText>{errors.fields?.[selectedListItem]?.type?.message}</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
{isSelectType && (
|
{isSelectType && (
|
||||||
<Grid
|
<Grid
|
||||||
xs={12}
|
xs={12}
|
||||||
sm={6}
|
sm={6}
|
||||||
sx={{
|
sx={{
|
||||||
px: { xs: 0, sm: 1 },
|
px: { xs: 0, sm: 1 },
|
||||||
py: 1,
|
py: 1,
|
||||||
mb: 0.5,
|
mb: 0.5,
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
alignItems: "start",
|
alignItems: "start",
|
||||||
justifyContent: "space-around",
|
justifyContent: "space-around",
|
||||||
position: "relative",
|
position: "relative",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Chip
|
<Chip
|
||||||
sx={{
|
sx={{
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
top: "-6px",
|
top: "-6px",
|
||||||
right: "-6px",
|
right: "-6px",
|
||||||
zIndex: "1",
|
zIndex: "1",
|
||||||
}}
|
}}
|
||||||
color="error"
|
color="error"
|
||||||
label={watchedFields?.[selectedListItem].options.length}
|
label={watchedFields?.[selectedListItem].options.length}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
color="success"
|
color="success"
|
||||||
sx={{ width: "100%", height: "37px" }}
|
sx={{ width: "100%", height: "37px" }}
|
||||||
startIcon={<ExtensionIcon />}
|
startIcon={<ExtensionIcon />}
|
||||||
onClick={() => setOpenSelectItem(true)}
|
onClick={() => setOpenSelectItem(true)}
|
||||||
>
|
>
|
||||||
افزودن آیتم نوع انتخابی
|
افزودن آیتم نوع انتخابی
|
||||||
</Button>
|
</Button>
|
||||||
<Typography variant="caption" color="error">
|
<Typography variant="caption" color="error">
|
||||||
{errors.fields?.[selectedListItem]?.options?.message}
|
{errors.fields?.[selectedListItem]?.options?.message}
|
||||||
</Typography>
|
</Typography>
|
||||||
{openSelectItem && (
|
{openSelectItem && (
|
||||||
<SelectItemBox
|
<SelectItemBox
|
||||||
open={openSelectItem}
|
open={openSelectItem}
|
||||||
setOpen={setOpenSelectItem}
|
setOpen={setOpenSelectItem}
|
||||||
fields={fields}
|
fields={fields}
|
||||||
setValue={setValue}
|
setValue={setValue}
|
||||||
index={selectedListItem}
|
index={selectedListItem}
|
||||||
watch={watch}
|
watch={watch}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Grid>
|
</Grid>
|
||||||
)}
|
)}
|
||||||
<Grid xs={12} sm={6} sx={{ px: { xs: 0, sm: 1 }, py: 1 }}>
|
<Grid xs={12} sm={6} sx={{ px: { xs: 0, sm: 1 }, py: 1 }}>
|
||||||
<FormControl
|
<FormControl
|
||||||
error={!!errors.fields?.[selectedListItem]?.name}
|
error={!!errors.fields?.[selectedListItem]?.name}
|
||||||
size="small"
|
size="small"
|
||||||
fullWidth
|
fullWidth
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
>
|
>
|
||||||
<InputLabel htmlFor={`fields[${selectedListItem}].name`}>نام فیلد</InputLabel>
|
<InputLabel htmlFor={`fields[${selectedListItem}].name`}>نام فیلد</InputLabel>
|
||||||
<OutlinedInput
|
<OutlinedInput
|
||||||
id={`fields[${selectedListItem}].name`}
|
id={`fields[${selectedListItem}].name`}
|
||||||
label="نام فیلد"
|
label="نام فیلد"
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
{...register(`fields[${selectedListItem}].name`)}
|
{...register(`fields[${selectedListItem}].name`)}
|
||||||
value={watchedFields?.[selectedListItem]?.name || ""}
|
value={watchedFields?.[selectedListItem]?.name || ""}
|
||||||
onInput={(event) => setValue(`fields.${selectedListItem}.name`, event.target.value)}
|
onInput={(event) => setValue(`fields.${selectedListItem}.name`, event.target.value)}
|
||||||
size="small"
|
size="small"
|
||||||
fullWidth
|
fullWidth
|
||||||
type="text"
|
type="text"
|
||||||
/>
|
/>
|
||||||
<FormHelperText>
|
<FormHelperText>
|
||||||
{errors.fields?.[selectedListItem]?.name ? errors.fields[selectedListItem].name.message : null}
|
{errors.fields?.[selectedListItem]?.name ? errors.fields[selectedListItem].name.message : null}
|
||||||
</FormHelperText>
|
</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid xs={12} sm={6} sx={{ px: { xs: 0, sm: 1 }, py: 1 }}>
|
<Grid xs={12} sm={6} sx={{ px: { xs: 0, sm: 1 }, py: 1 }}>
|
||||||
<FormControl
|
<FormControl
|
||||||
error={!!errors.fields?.[selectedListItem]?.unit}
|
error={!!errors.fields?.[selectedListItem]?.unit}
|
||||||
size="small"
|
size="small"
|
||||||
fullWidth
|
fullWidth
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
>
|
>
|
||||||
<InputLabel htmlFor={`fields[${selectedListItem}].unit`}>واحد اندازه گیری</InputLabel>
|
<InputLabel htmlFor={`fields[${selectedListItem}].unit`}>واحد اندازه گیری</InputLabel>
|
||||||
<OutlinedInput
|
<OutlinedInput
|
||||||
id={`fields[${selectedListItem}].unit`}
|
id={`fields[${selectedListItem}].unit`}
|
||||||
label="واحد اندازه گیری"
|
label="واحد اندازه گیری"
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
{...register(`fields[${selectedListItem}].unit`)}
|
{...register(`fields[${selectedListItem}].unit`)}
|
||||||
value={watchedFields?.[selectedListItem]?.unit || ""}
|
value={watchedFields?.[selectedListItem]?.unit || ""}
|
||||||
onChange={(event) => setValue(`fields.${selectedListItem}.unit`, event.target.value)}
|
onChange={(event) => setValue(`fields.${selectedListItem}.unit`, event.target.value)}
|
||||||
size="small"
|
size="small"
|
||||||
fullWidth
|
fullWidth
|
||||||
type="text"
|
type="text"
|
||||||
/>
|
/>
|
||||||
<FormHelperText>
|
<FormHelperText>
|
||||||
{errors.fields?.[selectedListItem]?.unit ? errors.fields[selectedListItem].unit.message : null}
|
{errors.fields?.[selectedListItem]?.unit ? errors.fields[selectedListItem].unit.message : null}
|
||||||
</FormHelperText>
|
</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default AzmayeshFields;
|
export default AzmayeshFields;
|
||||||
|
|||||||
@@ -1,218 +1,218 @@
|
|||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
Chip,
|
Chip,
|
||||||
DialogActions,
|
DialogActions,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
Divider,
|
Divider,
|
||||||
FormControl,
|
FormControl,
|
||||||
FormHelperText,
|
FormHelperText,
|
||||||
Grid,
|
Grid,
|
||||||
InputLabel,
|
InputLabel,
|
||||||
List,
|
List,
|
||||||
OutlinedInput,
|
OutlinedInput,
|
||||||
Typography,
|
Typography,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import StyledForm from "@/core/components/StyledForm";
|
import StyledForm from "@/core/components/StyledForm";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useFieldArray, useForm } from "react-hook-form";
|
import { useFieldArray, useForm } from "react-hook-form";
|
||||||
import { array, object, string } from "yup";
|
import { array, object, string } from "yup";
|
||||||
import { yupResolver } from "@hookform/resolvers/yup";
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
import DataSaverOnIcon from "@mui/icons-material/DataSaverOn";
|
import DataSaverOnIcon from "@mui/icons-material/DataSaverOn";
|
||||||
import ListItems from "./ListItems";
|
import ListItems from "./ListItems";
|
||||||
import AzmayeshFields from "./AzmayeshFields";
|
import AzmayeshFields from "./AzmayeshFields";
|
||||||
import { ADD_AZMAYESH_TYPE, UPDATE_AZMAYESH_TYPE } from "@/core/utils/routes";
|
import { ADD_AZMAYESH_TYPE, UPDATE_AZMAYESH_TYPE } from "@/core/utils/routes";
|
||||||
|
|
||||||
const validationSchema = object({
|
const validationSchema = object({
|
||||||
name: string().required("عنوان نوع آزمایش را مشخص کنید!"),
|
name: string().required("عنوان نوع آزمایش را مشخص کنید!"),
|
||||||
fields: array()
|
fields: array()
|
||||||
.of(
|
.of(
|
||||||
object({
|
object({
|
||||||
name: string().required("نام فیلد الزامی است"),
|
name: string().required("نام فیلد الزامی است"),
|
||||||
type: string().required("نوع فیلد الزامی است"),
|
type: string().required("نوع فیلد الزامی است"),
|
||||||
options: array().when("type", {
|
options: array().when("type", {
|
||||||
is: "select",
|
is: "select",
|
||||||
then: (schema) => schema.min(1, "حداقل باید یک آیتم برای نوع انتخابی ایجاد کنید."),
|
then: (schema) => schema.min(1, "حداقل باید یک آیتم برای نوع انتخابی ایجاد کنید."),
|
||||||
otherwise: (schema) => schema.notRequired(),
|
otherwise: (schema) => schema.notRequired(),
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.min(1, "حداقل باید یک فیلد ایجاد نمایید."),
|
.min(1, "حداقل باید یک فیلد ایجاد نمایید."),
|
||||||
});
|
});
|
||||||
|
|
||||||
const FormAndRequest = ({ setOpen, mutate, rowId, updateInfo }) => {
|
const FormAndRequest = ({ setOpen, mutate, rowId, updateInfo }) => {
|
||||||
const requestServer = useRequest({ notificationSuccess: true });
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
const [selectedListItem, setSelectedListItem] = useState(null);
|
const [selectedListItem, setSelectedListItem] = useState(null);
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultValues = {
|
const defaultValues = {
|
||||||
name: updateInfo?.name || "",
|
name: updateInfo?.name || "",
|
||||||
fields: Array.isArray(updateInfo?.azmayesh_fields)
|
fields: Array.isArray(updateInfo?.azmayesh_fields)
|
||||||
? updateInfo.azmayesh_fields.map((field) => ({
|
? updateInfo.azmayesh_fields.map((field) => ({
|
||||||
name: field.name || "",
|
name: field.name || "",
|
||||||
type: field.type || "",
|
type: field.type || "",
|
||||||
unit: field.unit || "",
|
unit: field.unit || "",
|
||||||
options: field.option ? field.option : [],
|
options: field.option ? field.option : [],
|
||||||
}))
|
}))
|
||||||
: [],
|
: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
const {
|
const {
|
||||||
control,
|
control,
|
||||||
register,
|
register,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
setValue,
|
setValue,
|
||||||
watch,
|
watch,
|
||||||
formState: { errors, isSubmitting },
|
formState: { errors, isSubmitting },
|
||||||
} = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "all" });
|
} = useForm({ defaultValues, resolver: yupResolver(validationSchema), mode: "all" });
|
||||||
|
|
||||||
const { fields, append, remove } = useFieldArray({
|
const { fields, append, remove } = useFieldArray({
|
||||||
control,
|
control,
|
||||||
name: "fields",
|
name: "fields",
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleRemove = (index) => {
|
const handleRemove = (index) => {
|
||||||
remove(index);
|
remove(index);
|
||||||
if (selectedListItem === index) {
|
if (selectedListItem === index) {
|
||||||
setSelectedListItem(null);
|
setSelectedListItem(null);
|
||||||
} else if (selectedListItem > index) {
|
} else if (selectedListItem > index) {
|
||||||
setSelectedListItem((prev) => prev - 1);
|
setSelectedListItem((prev) => prev - 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAddField = () => {
|
const handleAddField = () => {
|
||||||
append({ name: "", type: "", unit: "", options: [] });
|
append({ name: "", type: "", unit: "", options: [] });
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = async (data) => {
|
const onSubmit = async (data) => {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("name", data.name);
|
formData.append("name", data.name);
|
||||||
data.fields.map((field, index) => {
|
data.fields.map((field, index) => {
|
||||||
formData.append(`fields[${index}][name]`, field.name);
|
formData.append(`fields[${index}][name]`, field.name);
|
||||||
if (field.unit !== "") formData.append(`fields[${index}][unit]`, field.unit);
|
if (field.unit !== "") formData.append(`fields[${index}][unit]`, field.unit);
|
||||||
formData.append(`fields[${index}][type]`, field.type);
|
formData.append(`fields[${index}][type]`, field.type);
|
||||||
if (field.options.length !== 0) formData.append(`fields[${index}][option]`, JSON.stringify(field.options));
|
if (field.options.length !== 0) formData.append(`fields[${index}][option]`, JSON.stringify(field.options));
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await requestServer(updateInfo ? `${UPDATE_AZMAYESH_TYPE}/${rowId}` : ADD_AZMAYESH_TYPE, "post", {
|
await requestServer(updateInfo ? `${UPDATE_AZMAYESH_TYPE}/${rowId}` : ADD_AZMAYESH_TYPE, "post", {
|
||||||
data: formData,
|
data: formData,
|
||||||
});
|
});
|
||||||
mutate();
|
mutate();
|
||||||
handleClose();
|
handleClose();
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledForm onSubmit={handleSubmit(onSubmit)}>
|
<StyledForm onSubmit={handleSubmit(onSubmit)}>
|
||||||
<DialogContent dividers>
|
<DialogContent dividers>
|
||||||
<Box sx={{ display: "flex", alignItems: "center", justifyContent: "center", my: 2 }}>
|
<Box sx={{ display: "flex", alignItems: "center", justifyContent: "center", my: 2 }}>
|
||||||
<FormControl error={!!errors.name} size="small" variant="outlined" sx={{ width: "250px" }}>
|
<FormControl error={!!errors.name} size="small" variant="outlined" sx={{ width: "250px" }}>
|
||||||
<InputLabel htmlFor="name">عنوان نوع آزمایش</InputLabel>
|
<InputLabel htmlFor="name">عنوان نوع آزمایش</InputLabel>
|
||||||
<OutlinedInput
|
<OutlinedInput
|
||||||
id="name"
|
id="name"
|
||||||
label={"عنوان نوع آزمایش"}
|
label={"عنوان نوع آزمایش"}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
{...register("name")}
|
{...register("name")}
|
||||||
size="small"
|
size="small"
|
||||||
type="text"
|
type="text"
|
||||||
/>
|
/>
|
||||||
<FormHelperText id="name">{errors.name ? errors.name.message : null}</FormHelperText>
|
<FormHelperText id="name">{errors.name ? errors.name.message : null}</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Box>
|
</Box>
|
||||||
<Grid container spacing={2} sx={{ justifyContent: "space-between" }}>
|
<Grid container spacing={2} sx={{ justifyContent: "space-between" }}>
|
||||||
<Grid xs={12} md={4} lg={3} sx={{ px: 1 }}>
|
<Grid xs={12} md={4} lg={3} sx={{ px: 1 }}>
|
||||||
<Divider sx={{ my: 2 }}>
|
<Divider sx={{ my: 2 }}>
|
||||||
<Chip label="لیست فیلد ها" />
|
<Chip label="لیست فیلد ها" />
|
||||||
</Divider>
|
</Divider>
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="success"
|
color="success"
|
||||||
fullWidth
|
fullWidth
|
||||||
startIcon={<DataSaverOnIcon />}
|
startIcon={<DataSaverOnIcon />}
|
||||||
sx={{ mb: 2 }}
|
sx={{ mb: 2 }}
|
||||||
onClick={handleAddField}
|
onClick={handleAddField}
|
||||||
>
|
>
|
||||||
ایجاد فیلد جدید
|
ایجاد فیلد جدید
|
||||||
</Button>
|
</Button>
|
||||||
<List
|
<List
|
||||||
sx={{
|
sx={{
|
||||||
border: "1px dashed #e1e1e1",
|
border: "1px dashed #e1e1e1",
|
||||||
borderRadius: "5px",
|
borderRadius: "5px",
|
||||||
p: 1,
|
p: 1,
|
||||||
maxHeight: "300px",
|
maxHeight: "300px",
|
||||||
overflowY: "auto",
|
overflowY: "auto",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{fields.length !== 0 ? (
|
{fields.length !== 0 ? (
|
||||||
fields.map((item, index) => (
|
fields.map((item, index) => (
|
||||||
<ListItems
|
<ListItems
|
||||||
key={index}
|
key={index}
|
||||||
index={index}
|
index={index}
|
||||||
selectedListItem={selectedListItem}
|
selectedListItem={selectedListItem}
|
||||||
fields={fields}
|
fields={fields}
|
||||||
handleRemove={handleRemove}
|
handleRemove={handleRemove}
|
||||||
setSelectedListItem={setSelectedListItem}
|
setSelectedListItem={setSelectedListItem}
|
||||||
watch={watch}
|
watch={watch}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
<Typography
|
<Typography
|
||||||
variant="h6"
|
variant="h6"
|
||||||
sx={{ color: "#a2a2a2", textAlign: "center", letterSpacing: "1px" }}
|
sx={{ color: "#a2a2a2", textAlign: "center", letterSpacing: "1px" }}
|
||||||
>
|
>
|
||||||
فیلدی وجود ندارد
|
فیلدی وجود ندارد
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
</List>
|
</List>
|
||||||
<Typography variant="caption" color="error">
|
<Typography variant="caption" color="error">
|
||||||
{errors.fields ? errors.fields.message : null}
|
{errors.fields ? errors.fields.message : null}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Divider orientation="vertical" variant="middle" flexItem />
|
<Divider orientation="vertical" variant="middle" flexItem />
|
||||||
<Grid xs={12} md={7} lg={8} sx={{ pl: 2 }}>
|
<Grid xs={12} md={7} lg={8} sx={{ pl: 2 }}>
|
||||||
<Divider sx={{ my: 2 }}>
|
<Divider sx={{ my: 2 }}>
|
||||||
<Chip label="اطلاعات فیلد" />
|
<Chip label="اطلاعات فیلد" />
|
||||||
</Divider>
|
</Divider>
|
||||||
{selectedListItem !== null ? (
|
{selectedListItem !== null ? (
|
||||||
<AzmayeshFields
|
<AzmayeshFields
|
||||||
errors={errors}
|
errors={errors}
|
||||||
selectedListItem={selectedListItem}
|
selectedListItem={selectedListItem}
|
||||||
register={register}
|
register={register}
|
||||||
setValue={setValue}
|
setValue={setValue}
|
||||||
fields={fields}
|
fields={fields}
|
||||||
watch={watch}
|
watch={watch}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Box sx={{ display: "flex", alignItems: "center", justifyContent: "center", py: 2 }}>
|
<Box sx={{ display: "flex", alignItems: "center", justifyContent: "center", py: 2 }}>
|
||||||
<Typography variant="h6" sx={{ letterSpacing: "2px", color: "#a2a2a2" }}>
|
<Typography variant="h6" sx={{ letterSpacing: "2px", color: "#a2a2a2" }}>
|
||||||
از بخش لیست فیلد ها یک آیتم را انتخاب نمایید
|
از بخش لیست فیلد ها یک آیتم را انتخاب نمایید
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions sx={{ alignItems: "center", justifyContent: "center", py: 2 }}>
|
<DialogActions sx={{ alignItems: "center", justifyContent: "center", py: 2 }}>
|
||||||
<Button variant="outlined" color="error" onClick={handleClose}>
|
<Button variant="outlined" color="error" onClick={handleClose}>
|
||||||
بستن
|
بستن
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type={"submit"}
|
type={"submit"}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="primary"
|
color="primary"
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
sx={{ width: "200px" }}
|
sx={{ width: "200px" }}
|
||||||
>
|
>
|
||||||
{isSubmitting ? "در حال ثبت..." : "ثبت نوع آزمایش"}
|
{isSubmitting ? "در حال ثبت..." : "ثبت نوع آزمایش"}
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</StyledForm>
|
</StyledForm>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default FormAndRequest;
|
export default FormAndRequest;
|
||||||
|
|||||||
@@ -1,77 +1,77 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Box, IconButton, ListItem, Stack, Typography } from "@mui/material";
|
import { Box, IconButton, ListItem, Stack, Typography } from "@mui/material";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import DeleteIcon from "@mui/icons-material/Delete";
|
import DeleteIcon from "@mui/icons-material/Delete";
|
||||||
import SettingsIcon from "@mui/icons-material/Settings";
|
import SettingsIcon from "@mui/icons-material/Settings";
|
||||||
import TextFieldsIcon from "@mui/icons-material/TextFields";
|
import TextFieldsIcon from "@mui/icons-material/TextFields";
|
||||||
import ViewListIcon from "@mui/icons-material/ViewList";
|
import ViewListIcon from "@mui/icons-material/ViewList";
|
||||||
import CalendarMonthIcon from "@mui/icons-material/CalendarMonth";
|
import CalendarMonthIcon from "@mui/icons-material/CalendarMonth";
|
||||||
|
|
||||||
const fieldsType = {
|
const fieldsType = {
|
||||||
input: "متن",
|
input: "متن",
|
||||||
date: "تاریخ",
|
date: "تاریخ",
|
||||||
select: "انتخابی",
|
select: "انتخابی",
|
||||||
};
|
};
|
||||||
const fieldsTypeIcon = {
|
const fieldsTypeIcon = {
|
||||||
input: <TextFieldsIcon sx={{ fontSize: "18px" }} />,
|
input: <TextFieldsIcon sx={{ fontSize: "18px" }} />,
|
||||||
date: <CalendarMonthIcon sx={{ fontSize: "18px" }} />,
|
date: <CalendarMonthIcon sx={{ fontSize: "18px" }} />,
|
||||||
select: <ViewListIcon sx={{ fontSize: "18px" }} />,
|
select: <ViewListIcon sx={{ fontSize: "18px" }} />,
|
||||||
};
|
};
|
||||||
|
|
||||||
const ListItems = ({ index, handleRemove, selectedListItem, setSelectedListItem, watch }) => {
|
const ListItems = ({ index, handleRemove, selectedListItem, setSelectedListItem, watch }) => {
|
||||||
const watchedFields = watch("fields");
|
const watchedFields = watch("fields");
|
||||||
return (
|
return (
|
||||||
<ListItem
|
<ListItem
|
||||||
sx={{
|
sx={{
|
||||||
transition: "all 0.3s",
|
transition: "all 0.3s",
|
||||||
boxShadow:
|
boxShadow:
|
||||||
selectedListItem === index
|
selectedListItem === index
|
||||||
? "rgba(0, 0, 0, 0.16) 0px 3px 6px, rgba(0, 0, 0, 0.23) 0px 3px 6px"
|
? "rgba(0, 0, 0, 0.16) 0px 3px 6px, rgba(0, 0, 0, 0.23) 0px 3px 6px"
|
||||||
: "rgba(0, 0, 0, 0.15) 1.95px 1.95px 2.6px",
|
: "rgba(0, 0, 0, 0.15) 1.95px 1.95px 2.6px",
|
||||||
borderRadius: 2,
|
borderRadius: 2,
|
||||||
mb: 1.5,
|
mb: 1.5,
|
||||||
px: 1,
|
px: 1,
|
||||||
py: 0.7,
|
py: 0.7,
|
||||||
backgroundColor: selectedListItem === index ? "#6ea1714d" : "#ebebeb7a",
|
backgroundColor: selectedListItem === index ? "#6ea1714d" : "#ebebeb7a",
|
||||||
"&:last-child": {
|
"&:last-child": {
|
||||||
mb: 0,
|
mb: 0,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
disablePadding
|
disablePadding
|
||||||
secondaryAction={
|
secondaryAction={
|
||||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||||
<IconButton
|
<IconButton
|
||||||
edge="start"
|
edge="start"
|
||||||
aria-label="edit"
|
aria-label="edit"
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={() => setSelectedListItem(index)}
|
onClick={() => setSelectedListItem(index)}
|
||||||
>
|
>
|
||||||
<SettingsIcon />
|
<SettingsIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton edge="end" aria-label="delete" color="error" onClick={() => handleRemove(index)}>
|
<IconButton edge="end" aria-label="delete" color="error" onClick={() => handleRemove(index)}>
|
||||||
<DeleteIcon />
|
<DeleteIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Box>
|
</Box>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Stack sx={{ width: "100%" }}>
|
<Stack sx={{ width: "100%" }}>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{ color: watchedFields[index].name !== "" ? "" : "error.main" }}
|
sx={{ color: watchedFields[index].name !== "" ? "" : "error.main" }}
|
||||||
variant="body1"
|
variant="body1"
|
||||||
fontWeight={500}
|
fontWeight={500}
|
||||||
noWrap
|
noWrap
|
||||||
>
|
>
|
||||||
{watchedFields[index].name !== "" ? watchedFields[index].name : "نام تعیین نشده"}
|
{watchedFields[index].name !== "" ? watchedFields[index].name : "نام تعیین نشده"}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Box sx={{ display: "flex", alignItems: "center", gap: 0.5 }}>
|
<Box sx={{ display: "flex", alignItems: "center", gap: 0.5 }}>
|
||||||
{fieldsTypeIcon[watchedFields[index].type] || null}
|
{fieldsTypeIcon[watchedFields[index].type] || null}
|
||||||
<Typography sx={{ color: watchedFields[index].type !== "" ? "" : "error.main" }} variant="caption">
|
<Typography sx={{ color: watchedFields[index].type !== "" ? "" : "error.main" }} variant="caption">
|
||||||
{watchedFields[index].type !== "" ? fieldsType[watchedFields[index].type] : "واحد تعیین نشده"}
|
{watchedFields[index].type !== "" ? fieldsType[watchedFields[index].type] : "واحد تعیین نشده"}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default ListItems;
|
export default ListItems;
|
||||||
|
|||||||
@@ -1,108 +1,108 @@
|
|||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
Chip,
|
Chip,
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogActions,
|
DialogActions,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
Divider,
|
Divider,
|
||||||
IconButton,
|
IconButton,
|
||||||
List,
|
List,
|
||||||
ListItem,
|
ListItem,
|
||||||
ListItemText,
|
ListItemText,
|
||||||
TextField,
|
TextField,
|
||||||
Typography,
|
Typography,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import DeleteIcon from "@mui/icons-material/Delete";
|
import DeleteIcon from "@mui/icons-material/Delete";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
|
|
||||||
const SelectItemBox = ({ open, setOpen, setValue, index, watch }) => {
|
const SelectItemBox = ({ open, setOpen, setValue, index, watch }) => {
|
||||||
const watchedFields = watch("fields");
|
const watchedFields = watch("fields");
|
||||||
const [itemValue, setItemValue] = useState("");
|
const [itemValue, setItemValue] = useState("");
|
||||||
const [listArr, setListArr] = useState(watchedFields?.[index]?.options);
|
const [listArr, setListArr] = useState(watchedFields?.[index]?.options);
|
||||||
|
|
||||||
const addToList = () => {
|
const addToList = () => {
|
||||||
if (itemValue) {
|
if (itemValue) {
|
||||||
setListArr([...listArr, itemValue]);
|
setListArr([...listArr, itemValue]);
|
||||||
setItemValue("");
|
setItemValue("");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeFromList = (index) => {
|
const removeFromList = (index) => {
|
||||||
setListArr(listArr.filter((_, i) => i !== index));
|
setListArr(listArr.filter((_, i) => i !== index));
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveAndCloseList = () => {
|
const saveAndCloseList = () => {
|
||||||
setValue(`fields.${index}.options`, listArr);
|
setValue(`fields.${index}.options`, listArr);
|
||||||
closeModal();
|
closeModal();
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeModal = () => {
|
const closeModal = () => {
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} fullWidth={true} maxWidth={"xs"} onClose={closeModal}>
|
<Dialog open={open} fullWidth={true} maxWidth={"xs"} onClose={closeModal}>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<Box sx={{ display: "flex", alignItems: "center", justifyContent: "center", gap: 2 }}>
|
<Box sx={{ display: "flex", alignItems: "center", justifyContent: "center", gap: 2 }}>
|
||||||
<TextField
|
<TextField
|
||||||
fullWidth
|
fullWidth
|
||||||
size="small"
|
size="small"
|
||||||
id="outlined-controlled"
|
id="outlined-controlled"
|
||||||
label="نام آیتم را وارد کنید"
|
label="نام آیتم را وارد کنید"
|
||||||
value={itemValue}
|
value={itemValue}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setItemValue(event.target.value);
|
setItemValue(event.target.value);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Button variant="contained" color="primary" disabled={!itemValue} onClick={addToList}>
|
<Button variant="contained" color="primary" disabled={!itemValue} onClick={addToList}>
|
||||||
افزودن
|
افزودن
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
<Box sx={{ borderRadius: "5px", mt: 2 }}>
|
<Box sx={{ borderRadius: "5px", mt: 2 }}>
|
||||||
<Divider>
|
<Divider>
|
||||||
<Chip label="لیست آیتم ها" />
|
<Chip label="لیست آیتم ها" />
|
||||||
</Divider>
|
</Divider>
|
||||||
<List>
|
<List>
|
||||||
{listArr.length !== 0 ? (
|
{listArr.length !== 0 ? (
|
||||||
listArr.map((item, index) => (
|
listArr.map((item, index) => (
|
||||||
<ListItem
|
<ListItem
|
||||||
key={index}
|
key={index}
|
||||||
sx={{
|
sx={{
|
||||||
boxShadow:
|
boxShadow:
|
||||||
"rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 1px 3px 1px",
|
"rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 1px 3px 1px",
|
||||||
my: 1,
|
my: 1,
|
||||||
borderRadius: "5px",
|
borderRadius: "5px",
|
||||||
}}
|
}}
|
||||||
secondaryAction={
|
secondaryAction={
|
||||||
<IconButton
|
<IconButton
|
||||||
edge="end"
|
edge="end"
|
||||||
aria-label="delete"
|
aria-label="delete"
|
||||||
color="error"
|
color="error"
|
||||||
onClick={() => removeFromList(index)}
|
onClick={() => removeFromList(index)}
|
||||||
>
|
>
|
||||||
<DeleteIcon />
|
<DeleteIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<ListItemText primary={item} />
|
<ListItemText primary={item} />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
<Typography variant="h6" sx={{ textAlign: "center", letterSpacing: "1px" }}>
|
<Typography variant="h6" sx={{ textAlign: "center", letterSpacing: "1px" }}>
|
||||||
هنوز آیتمی ثبت نشده است
|
هنوز آیتمی ثبت نشده است
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
</List>
|
</List>
|
||||||
</Box>
|
</Box>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button variant="outlined" color="primary" onClick={saveAndCloseList}>
|
<Button variant="outlined" color="primary" onClick={saveAndCloseList}>
|
||||||
ذخیره لیست
|
ذخیره لیست
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default SelectItemBox;
|
export default SelectItemBox;
|
||||||
|
|||||||
@@ -1,37 +1,37 @@
|
|||||||
import { Dialog, IconButton } from "@mui/material";
|
import { Dialog, IconButton } from "@mui/material";
|
||||||
import FormAndRequest from "./FormAndRequest";
|
import FormAndRequest from "./FormAndRequest";
|
||||||
import DialogLoading from "@/core/components/DialogLoading";
|
import DialogLoading from "@/core/components/DialogLoading";
|
||||||
import CloseIcon from "@mui/icons-material/Close";
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
|
|
||||||
const CandUAzmayeshType = ({ open, setOpen, mutate, rowId, updateInfo, loadingOpen, fromUpdate = false }) => {
|
const CandUAzmayeshType = ({ open, setOpen, mutate, rowId, updateInfo, loadingOpen, fromUpdate = false }) => {
|
||||||
const isUpdateReady = fromUpdate ? updateInfo !== null : true;
|
const isUpdateReady = fromUpdate ? updateInfo !== null : true;
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} fullWidth maxWidth="lg">
|
<Dialog open={open} fullWidth maxWidth="lg">
|
||||||
<IconButton
|
<IconButton
|
||||||
aria-label="close"
|
aria-label="close"
|
||||||
onClick={() => setOpen(false)}
|
onClick={() => setOpen(false)}
|
||||||
sx={(theme) => ({
|
sx={(theme) => ({
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
right: 8,
|
right: 8,
|
||||||
top: 8,
|
top: 8,
|
||||||
zIndex: 50,
|
zIndex: 50,
|
||||||
color: theme.palette.grey[500],
|
color: theme.palette.grey[500],
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<CloseIcon />
|
<CloseIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
{isUpdateReady ? (
|
{isUpdateReady ? (
|
||||||
<FormAndRequest
|
<FormAndRequest
|
||||||
setOpen={setOpen}
|
setOpen={setOpen}
|
||||||
mutate={mutate}
|
mutate={mutate}
|
||||||
rowId={rowId}
|
rowId={rowId}
|
||||||
{...(fromUpdate ? { updateInfo } : {})}
|
{...(fromUpdate ? { updateInfo } : {})}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<DialogLoading loadingOpen={loadingOpen} />
|
<DialogLoading loadingOpen={loadingOpen} />
|
||||||
)}
|
)}
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default CandUAzmayeshType;
|
export default CandUAzmayeshType;
|
||||||
|
|||||||
@@ -1,78 +1,78 @@
|
|||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogActions,
|
DialogActions,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
IconButton,
|
IconButton,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Typography,
|
Typography,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import DeleteIcon from "@mui/icons-material/Delete";
|
import DeleteIcon from "@mui/icons-material/Delete";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { DELETE_AZMAYESH_TYPE_LIST } from "@/core/utils/routes";
|
import { DELETE_AZMAYESH_TYPE_LIST } from "@/core/utils/routes";
|
||||||
|
|
||||||
const DeleteAzmayeshType = ({ rowId, mutate }) => {
|
const DeleteAzmayeshType = ({ rowId, mutate }) => {
|
||||||
const requestServer = useRequest({ notificationSuccess: true });
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
const [openDeleteDialog, setOpenDeleteDialog] = useState(false);
|
const [openDeleteDialog, setOpenDeleteDialog] = useState(false);
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
|
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
setIsSubmitting(true);
|
setIsSubmitting(true);
|
||||||
requestServer(`${DELETE_AZMAYESH_TYPE_LIST}/${rowId}`, "post")
|
requestServer(`${DELETE_AZMAYESH_TYPE_LIST}/${rowId}`, "post")
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setOpenDeleteDialog(false);
|
setOpenDeleteDialog(false);
|
||||||
mutate();
|
mutate();
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setIsSubmitting(false);
|
setIsSubmitting(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Tooltip title="حذف نوع آزمایش" arrow placement="right">
|
<Tooltip title="حذف نوع آزمایش" arrow placement="right">
|
||||||
<IconButton
|
<IconButton
|
||||||
color="error"
|
color="error"
|
||||||
sx={{ textTransform: "unset", alignSelf: "center" }}
|
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setOpenDeleteDialog(true);
|
setOpenDeleteDialog(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<DeleteIcon />
|
<DeleteIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Dialog
|
<Dialog
|
||||||
maxWidth="sm"
|
maxWidth="sm"
|
||||||
open={openDeleteDialog}
|
open={openDeleteDialog}
|
||||||
PaperProps={{
|
PaperProps={{
|
||||||
sx: {
|
sx: {
|
||||||
boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
|
boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<DialogTitle>حذف نوع آزمایش</DialogTitle>
|
<DialogTitle>حذف نوع آزمایش</DialogTitle>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<Typography>آیا از حذف این نوع آزمایش مطمئن هستید؟</Typography>
|
<Typography>آیا از حذف این نوع آزمایش مطمئن هستید؟</Typography>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => setOpenDeleteDialog(false)}
|
onClick={() => setOpenDeleteDialog(false)}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
color="primary"
|
color="primary"
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
autoFocus
|
autoFocus
|
||||||
>
|
>
|
||||||
بستن
|
بستن
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={handleSubmit} variant="contained" color="error" disabled={isSubmitting}>
|
<Button onClick={handleSubmit} variant="contained" color="error" disabled={isSubmitting}>
|
||||||
حذف
|
حذف
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default DeleteAzmayeshType;
|
export default DeleteAzmayeshType;
|
||||||
|
|||||||
@@ -1,53 +1,53 @@
|
|||||||
import { IconButton, Tooltip } from "@mui/material";
|
import { IconButton, Tooltip } from "@mui/material";
|
||||||
import EditIcon from "@mui/icons-material/Edit";
|
import EditIcon from "@mui/icons-material/Edit";
|
||||||
import { GET_AZMAYESH_TYPE_LIST_TABLE } from "@/core/utils/routes";
|
import { GET_AZMAYESH_TYPE_LIST_TABLE } from "@/core/utils/routes";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import CandUAzmayeshType from "@/components/dashboard/azmayeshType/Forms/CandUAzmayeshType";
|
import CandUAzmayeshType from "@/components/dashboard/azmayeshType/Forms/CandUAzmayeshType";
|
||||||
|
|
||||||
const UpdateAzmayeshType = ({ rowId, mutate }) => {
|
const UpdateAzmayeshType = ({ rowId, mutate }) => {
|
||||||
const requestServer = useRequest();
|
const requestServer = useRequest();
|
||||||
const [openUpdateDialog, setOpenUpdateDialog] = useState(false);
|
const [openUpdateDialog, setOpenUpdateDialog] = useState(false);
|
||||||
const [updateInfo, setUpdateInfo] = useState(null);
|
const [updateInfo, setUpdateInfo] = useState(null);
|
||||||
const [loadingOpen, setLoadingOpen] = useState(false);
|
const [loadingOpen, setLoadingOpen] = useState(false);
|
||||||
|
|
||||||
const handleGetInfo = () => {
|
const handleGetInfo = () => {
|
||||||
setLoadingOpen(true);
|
setLoadingOpen(true);
|
||||||
setOpenUpdateDialog(true);
|
setOpenUpdateDialog(true);
|
||||||
requestServer(`${GET_AZMAYESH_TYPE_LIST_TABLE}/${rowId}`, "get")
|
requestServer(`${GET_AZMAYESH_TYPE_LIST_TABLE}/${rowId}`, "get")
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
setUpdateInfo(response.data.data);
|
setUpdateInfo(response.data.data);
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setLoadingOpen(false);
|
setLoadingOpen(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Tooltip title="ویرایش آزمایش" arrow placement="right">
|
<Tooltip title="ویرایش آزمایش" arrow placement="right">
|
||||||
<IconButton
|
<IconButton
|
||||||
color="success"
|
color="success"
|
||||||
sx={{ textTransform: "unset", alignSelf: "center" }}
|
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||||
onClick={handleGetInfo}
|
onClick={handleGetInfo}
|
||||||
>
|
>
|
||||||
<EditIcon />
|
<EditIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
{openUpdateDialog && (
|
{openUpdateDialog && (
|
||||||
<CandUAzmayeshType
|
<CandUAzmayeshType
|
||||||
open={openUpdateDialog}
|
open={openUpdateDialog}
|
||||||
setOpen={setOpenUpdateDialog}
|
setOpen={setOpenUpdateDialog}
|
||||||
mutate={mutate}
|
mutate={mutate}
|
||||||
updateInfo={updateInfo}
|
updateInfo={updateInfo}
|
||||||
rowId={rowId}
|
rowId={rowId}
|
||||||
loadingOpen={loadingOpen}
|
loadingOpen={loadingOpen}
|
||||||
fromUpdate={true}
|
fromUpdate={true}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default UpdateAzmayeshType;
|
export default UpdateAzmayeshType;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { Box } from "@mui/material";
|
import { Box } from "@mui/material";
|
||||||
import UpdateAzmayeshType from "./UpdateAzmayeshType";
|
import UpdateAzmayeshType from "./UpdateAzmayeshType";
|
||||||
import DeleteAzmayeshType from "./DeleteAzmayeshType";
|
import DeleteAzmayeshType from "./DeleteAzmayeshType";
|
||||||
|
|
||||||
const RowActions = ({ row, mutate }) => {
|
const RowActions = ({ row, mutate }) => {
|
||||||
return (
|
return (
|
||||||
<Box sx={{ display: "flex", gap: 1 }}>
|
<Box sx={{ display: "flex", gap: 1 }}>
|
||||||
<UpdateAzmayeshType rowId={row.getValue("id")} mutate={mutate} />
|
<UpdateAzmayeshType rowId={row.getValue("id")} mutate={mutate} />
|
||||||
<DeleteAzmayeshType rowId={row.getValue("id")} mutate={mutate} />
|
<DeleteAzmayeshType rowId={row.getValue("id")} mutate={mutate} />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default RowActions;
|
export default RowActions;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import AzmayeshTypeCreate from "./Actions/Create";
|
import AzmayeshTypeCreate from "./Actions/Create";
|
||||||
|
|
||||||
const Toolbar = ({ mutate }) => {
|
const Toolbar = ({ mutate }) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AzmayeshTypeCreate mutate={mutate} />
|
<AzmayeshTypeCreate mutate={mutate} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default Toolbar;
|
export default Toolbar;
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import PageTitle from "@/core/components/PageTitle";
|
import PageTitle from "@/core/components/PageTitle";
|
||||||
import { Stack } from "@mui/material";
|
import { Stack } from "@mui/material";
|
||||||
import AzmayeshTypeList from "./AzmayeshTypeList";
|
import AzmayeshTypeList from "./AzmayeshTypeList";
|
||||||
|
|
||||||
const AzmayeshTypePage = () => {
|
const AzmayeshTypePage = () => {
|
||||||
return (
|
return (
|
||||||
<Stack spacing={1}>
|
<Stack spacing={1}>
|
||||||
<PageTitle title={"کارتابل نوع آزمایشات"} />
|
<PageTitle title={"کارتابل نوع آزمایشات"} />
|
||||||
<AzmayeshTypeList />
|
<AzmayeshTypeList />
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default AzmayeshTypePage;
|
export default AzmayeshTypePage;
|
||||||
|
|||||||
@@ -1,145 +1,145 @@
|
|||||||
import NumberField from "@/core/components/NumberField";
|
import NumberField from "@/core/components/NumberField";
|
||||||
import StyledForm from "@/core/components/StyledForm";
|
import StyledForm from "@/core/components/StyledForm";
|
||||||
import { CREATE_RECEIPT_DAMAGE_ITEMS } from "@/core/utils/routes";
|
import { CREATE_RECEIPT_DAMAGE_ITEMS } from "@/core/utils/routes";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import { yupResolver } from "@hookform/resolvers/yup";
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
import { Beenhere, ExitToApp } from "@mui/icons-material";
|
import { Beenhere, ExitToApp } from "@mui/icons-material";
|
||||||
import { Button, DialogActions, DialogContent, DialogTitle, Stack, TextField } from "@mui/material";
|
import { Button, DialogActions, DialogContent, DialogTitle, Stack, TextField } from "@mui/material";
|
||||||
import { DialogHeader } from "next/dist/client/components/react-dev-overlay/internal/components/Dialog";
|
import { DialogHeader } from "next/dist/client/components/react-dev-overlay/internal/components/Dialog";
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { object, string } from "yup";
|
import { object, string } from "yup";
|
||||||
|
|
||||||
const validationSchema = object({
|
const validationSchema = object({
|
||||||
title: string().required("وارد کردن عنوان الزامیست!"),
|
title: string().required("وارد کردن عنوان الزامیست!"),
|
||||||
unit: string().required("وارد کردن واحد الزامیست!"),
|
unit: string().required("وارد کردن واحد الزامیست!"),
|
||||||
base_price: string().required("وارد کردن فی الزامیست!"),
|
base_price: string().required("وارد کردن فی الزامیست!"),
|
||||||
});
|
});
|
||||||
|
|
||||||
const CreateFormContent = ({ setOpen, mutate }) => {
|
const CreateFormContent = ({ setOpen, mutate }) => {
|
||||||
const requestServer = useRequest({ notificationSuccess: true });
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
const defaultValues = {
|
const defaultValues = {
|
||||||
title: "",
|
title: "",
|
||||||
unit: "",
|
unit: "",
|
||||||
base_price: null,
|
base_price: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
const {
|
const {
|
||||||
control,
|
control,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
formState: { isSubmitting },
|
formState: { isSubmitting },
|
||||||
} = useForm({
|
} = useForm({
|
||||||
defaultValues,
|
defaultValues,
|
||||||
resolver: yupResolver(validationSchema),
|
resolver: yupResolver(validationSchema),
|
||||||
mode: "all",
|
mode: "all",
|
||||||
});
|
});
|
||||||
|
|
||||||
const onSubmit = async (data) => {
|
const onSubmit = async (data) => {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("title", data.title);
|
formData.append("title", data.title);
|
||||||
formData.append("unit", data.unit);
|
formData.append("unit", data.unit);
|
||||||
formData.append("base_price", data.base_price);
|
formData.append("base_price", data.base_price);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await requestServer(CREATE_RECEIPT_DAMAGE_ITEMS, "post", {
|
await requestServer(CREATE_RECEIPT_DAMAGE_ITEMS, "post", {
|
||||||
data: formData,
|
data: formData,
|
||||||
});
|
});
|
||||||
mutate();
|
mutate();
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>ثبت آیتم جدید</DialogTitle>
|
<DialogTitle>ثبت آیتم جدید</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<DialogContent dividers>
|
<DialogContent dividers>
|
||||||
<StyledForm onSubmit={handleSubmit(onSubmit)} id="createDamageForm">
|
<StyledForm onSubmit={handleSubmit(onSubmit)} id="createDamageForm">
|
||||||
<Stack spacing={3}>
|
<Stack spacing={3}>
|
||||||
<Controller
|
<Controller
|
||||||
name="title"
|
name="title"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
||||||
<TextField
|
<TextField
|
||||||
fullWidth
|
fullWidth
|
||||||
size="small"
|
size="small"
|
||||||
label="عنوان"
|
label="عنوان"
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder="عنوان را وارد کنید"
|
placeholder="عنوان را وارد کنید"
|
||||||
error={!!error}
|
error={!!error}
|
||||||
helperText={error ? error.message : null}
|
helperText={error ? error.message : null}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
InputLabelProps={{ shrink: true }}
|
InputLabelProps={{ shrink: true }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<Controller
|
<Controller
|
||||||
name="unit"
|
name="unit"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
||||||
<TextField
|
<TextField
|
||||||
fullWidth
|
fullWidth
|
||||||
size="small"
|
size="small"
|
||||||
label="واحد"
|
label="واحد"
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
error={!!error}
|
error={!!error}
|
||||||
placeholder="واحد را وارد کنید"
|
placeholder="واحد را وارد کنید"
|
||||||
helperText={error ? error.message : null}
|
helperText={error ? error.message : null}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
InputLabelProps={{ shrink: true }}
|
InputLabelProps={{ shrink: true }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<Controller
|
<Controller
|
||||||
name="base_price"
|
name="base_price"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
||||||
<NumberField
|
<NumberField
|
||||||
label={`فی`}
|
label={`فی`}
|
||||||
error={!!error}
|
error={!!error}
|
||||||
value={value || ""}
|
value={value || ""}
|
||||||
type="text"
|
type="text"
|
||||||
size={"small"}
|
size={"small"}
|
||||||
unit={"ریال"}
|
unit={"ریال"}
|
||||||
inputProps={{
|
inputProps={{
|
||||||
placeholder: "فی را وارد کنید",
|
placeholder: "فی را وارد کنید",
|
||||||
inputMode: "number",
|
inputMode: "number",
|
||||||
min: 0,
|
min: 0,
|
||||||
pattern: "[0-9]*",
|
pattern: "[0-9]*",
|
||||||
}}
|
}}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
if (!isNaN(event.target.value)) {
|
if (!isNaN(event.target.value)) {
|
||||||
onChange(event.target.value);
|
onChange(event.target.value);
|
||||||
} else {
|
} else {
|
||||||
onChange(value);
|
onChange(value);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
helperText={error ? error.message : null}
|
helperText={error ? error.message : null}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
fullWidth
|
fullWidth
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StyledForm>
|
</StyledForm>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={() => setOpen(false)} variant="outlined" color="secondary" startIcon={<ExitToApp />}>
|
<Button onClick={() => setOpen(false)} variant="outlined" color="secondary" startIcon={<ExitToApp />}>
|
||||||
بستن
|
بستن
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
type={"submit"}
|
type={"submit"}
|
||||||
form="createDamageForm"
|
form="createDamageForm"
|
||||||
endIcon={<Beenhere />}
|
endIcon={<Beenhere />}
|
||||||
>
|
>
|
||||||
{isSubmitting ? "در حال ثبت آیتم" : "ثبت آیتم"}
|
{isSubmitting ? "در حال ثبت آیتم" : "ثبت آیتم"}
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default CreateFormContent;
|
export default CreateFormContent;
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
import { Dialog, IconButton } from "@mui/material";
|
import { Dialog, IconButton } from "@mui/material";
|
||||||
import CreateFormContent from "./CreateFormContent";
|
import CreateFormContent from "./CreateFormContent";
|
||||||
import CloseIcon from "@mui/icons-material/Close";
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
|
|
||||||
const CreateForm = ({ open, setOpen, mutate }) => {
|
const CreateForm = ({ open, setOpen, mutate }) => {
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} fullWidth maxWidth="xs">
|
<Dialog open={open} fullWidth maxWidth="xs">
|
||||||
<IconButton
|
<IconButton
|
||||||
aria-label="close"
|
aria-label="close"
|
||||||
onClick={() => setOpen(false)}
|
onClick={() => setOpen(false)}
|
||||||
sx={(theme) => ({
|
sx={(theme) => ({
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
right: 8,
|
right: 8,
|
||||||
top: 8,
|
top: 8,
|
||||||
zIndex: 50,
|
zIndex: 50,
|
||||||
color: theme.palette.grey[500],
|
color: theme.palette.grey[500],
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<CloseIcon />
|
<CloseIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
{open && <CreateFormContent setOpen={setOpen} mutate={mutate} />}
|
{open && <CreateFormContent setOpen={setOpen} mutate={mutate} />}
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default CreateForm;
|
export default CreateForm;
|
||||||
|
|||||||
@@ -1,36 +1,36 @@
|
|||||||
import { AddCircle } from "@mui/icons-material";
|
import { AddCircle } from "@mui/icons-material";
|
||||||
import { Button, IconButton, useMediaQuery, useTheme } from "@mui/material";
|
import { Button, IconButton, useMediaQuery, useTheme } from "@mui/material";
|
||||||
import CreateForm from "./Form";
|
import CreateForm from "./Form";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
const CreateDamage = ({ mutate }) => {
|
const CreateDamage = ({ mutate }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
const handleOpen = () => {
|
const handleOpen = () => {
|
||||||
setOpen(true);
|
setOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isMobile ? (
|
{isMobile ? (
|
||||||
<IconButton aria-label="ثبت آیتم" color="primary" onClick={handleOpen}>
|
<IconButton aria-label="ثبت آیتم" color="primary" onClick={handleOpen}>
|
||||||
<AddCircle sx={{ fontSize: "25px" }} />
|
<AddCircle sx={{ fontSize: "25px" }} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
) : (
|
) : (
|
||||||
<Button
|
<Button
|
||||||
size={"small"}
|
size={"small"}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="primary"
|
color="primary"
|
||||||
startIcon={<AddCircle />}
|
startIcon={<AddCircle />}
|
||||||
onClick={handleOpen}
|
onClick={handleOpen}
|
||||||
>
|
>
|
||||||
ثبت آیتم
|
ثبت آیتم
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<CreateForm open={open} setOpen={setOpen} mutate={mutate} />
|
<CreateForm open={open} setOpen={setOpen} mutate={mutate} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default CreateDamage;
|
export default CreateDamage;
|
||||||
|
|||||||
@@ -1,84 +1,84 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
|
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
|
||||||
import { GET_RECEIPT_DAMAGE_ITEMS_LIST } from "@/core/utils/routes";
|
import { GET_RECEIPT_DAMAGE_ITEMS_LIST } from "@/core/utils/routes";
|
||||||
import { Box } from "@mui/material";
|
import { Box } from "@mui/material";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import Toolbar from "./Toolbar";
|
import Toolbar from "./Toolbar";
|
||||||
import RowActions from "./RowActions";
|
import RowActions from "./RowActions";
|
||||||
|
|
||||||
const DamagesList = () => {
|
const DamagesList = () => {
|
||||||
const columns = useMemo(
|
const columns = useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
accessorKey: "id",
|
accessorKey: "id",
|
||||||
header: "کد یکتا",
|
header: "کد یکتا",
|
||||||
id: "id",
|
id: "id",
|
||||||
enableColumnFilter: true,
|
enableColumnFilter: true,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
filterMode: "equals",
|
filterMode: "equals",
|
||||||
sortDescFirst: false,
|
sortDescFirst: false,
|
||||||
columnFilterModeOptions: ["equals", "contains"],
|
columnFilterModeOptions: ["equals", "contains"],
|
||||||
grow: false,
|
grow: false,
|
||||||
size: 100,
|
size: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "title",
|
accessorKey: "title",
|
||||||
header: "عنوان",
|
header: "عنوان",
|
||||||
id: "title",
|
id: "title",
|
||||||
enableColumnFilter: true,
|
enableColumnFilter: true,
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
filterMode: "equals",
|
filterMode: "equals",
|
||||||
columnFilterModeOptions: ["equals", "contains"],
|
columnFilterModeOptions: ["equals", "contains"],
|
||||||
grow: false,
|
grow: false,
|
||||||
size: 100,
|
size: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "unit",
|
accessorKey: "unit",
|
||||||
header: "واحد",
|
header: "واحد",
|
||||||
id: "unit",
|
id: "unit",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
grow: false,
|
grow: false,
|
||||||
size: 100,
|
size: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "base_price",
|
accessorKey: "base_price",
|
||||||
header: "فی (ریال)",
|
header: "فی (ریال)",
|
||||||
id: "base_price",
|
id: "base_price",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
grow: false,
|
grow: false,
|
||||||
size: 100,
|
size: 100,
|
||||||
Cell: ({ renderedCellValue }) => (renderedCellValue / 1).toLocaleString(),
|
Cell: ({ renderedCellValue }) => (renderedCellValue / 1).toLocaleString(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "status",
|
accessorKey: "status",
|
||||||
header: "وضعیت",
|
header: "وضعیت",
|
||||||
id: "status",
|
id: "status",
|
||||||
enableColumnFilter: false,
|
enableColumnFilter: false,
|
||||||
grow: false,
|
grow: false,
|
||||||
size: 100,
|
size: 100,
|
||||||
Cell: ({ renderedCellValue }) => (renderedCellValue == 1 ? "فعال" : "غیرفعال"),
|
Cell: ({ renderedCellValue }) => (renderedCellValue == 1 ? "فعال" : "غیرفعال"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
||||||
<DataTableWithAuth
|
<DataTableWithAuth
|
||||||
need_filter={true}
|
need_filter={true}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
sorting={[{ id: "id", desc: true }]}
|
sorting={[{ id: "id", desc: true }]}
|
||||||
table_url={GET_RECEIPT_DAMAGE_ITEMS_LIST}
|
table_url={GET_RECEIPT_DAMAGE_ITEMS_LIST}
|
||||||
page_name={"receiptDamagePage"}
|
page_name={"receiptDamagePage"}
|
||||||
table_name={"receiptDamageList"}
|
table_name={"receiptDamageList"}
|
||||||
TableToolbar={Toolbar}
|
TableToolbar={Toolbar}
|
||||||
enableRowActions
|
enableRowActions
|
||||||
positionActionsColumn={"last"}
|
positionActionsColumn={"last"}
|
||||||
RowActions={RowActions}
|
RowActions={RowActions}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default DamagesList;
|
export default DamagesList;
|
||||||
|
|||||||
@@ -1,31 +1,31 @@
|
|||||||
import { ATIVITY_RECEIPT_DAMAGE_ITEMS } from "@/core/utils/routes";
|
import { ATIVITY_RECEIPT_DAMAGE_ITEMS } from "@/core/utils/routes";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import { Switch } from "@mui/material";
|
import { Switch } from "@mui/material";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
const Activity = ({ rowId, mutate, status }) => {
|
const Activity = ({ rowId, mutate, status }) => {
|
||||||
const [disabled, setDisabled] = useState(false);
|
const [disabled, setDisabled] = useState(false);
|
||||||
const [checked, setChecked] = useState(status == 1);
|
const [checked, setChecked] = useState(status == 1);
|
||||||
const requestServer = useRequest();
|
const requestServer = useRequest();
|
||||||
|
|
||||||
const handleSwitch = (event) => {
|
const handleSwitch = (event) => {
|
||||||
const newChecked = event.target.checked;
|
const newChecked = event.target.checked;
|
||||||
setChecked(newChecked);
|
setChecked(newChecked);
|
||||||
setDisabled(true);
|
setDisabled(true);
|
||||||
|
|
||||||
requestServer(`${ATIVITY_RECEIPT_DAMAGE_ITEMS}/${rowId}`, "post")
|
requestServer(`${ATIVITY_RECEIPT_DAMAGE_ITEMS}/${rowId}`, "post")
|
||||||
.then(() => {
|
.then(() => {
|
||||||
mutate();
|
mutate();
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
setChecked(!newChecked);
|
setChecked(!newChecked);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setDisabled(false);
|
setDisabled(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return <Switch size="small" disabled={disabled} checked={checked} onChange={handleSwitch} />;
|
return <Switch size="small" disabled={disabled} checked={checked} onChange={handleSwitch} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Activity;
|
export default Activity;
|
||||||
|
|||||||
@@ -1,145 +1,145 @@
|
|||||||
import NumberField from "@/core/components/NumberField";
|
import NumberField from "@/core/components/NumberField";
|
||||||
import StyledForm from "@/core/components/StyledForm";
|
import StyledForm from "@/core/components/StyledForm";
|
||||||
import { UPDATE_RECEIPT_DAMAGE_ITEMS } from "@/core/utils/routes";
|
import { UPDATE_RECEIPT_DAMAGE_ITEMS } from "@/core/utils/routes";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
import { yupResolver } from "@hookform/resolvers/yup";
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
import { Beenhere, ExitToApp } from "@mui/icons-material";
|
import { Beenhere, ExitToApp } from "@mui/icons-material";
|
||||||
import { Button, DialogActions, DialogContent, DialogTitle, Stack, TextField } from "@mui/material";
|
import { Button, DialogActions, DialogContent, DialogTitle, Stack, TextField } from "@mui/material";
|
||||||
import { DialogHeader } from "next/dist/client/components/react-dev-overlay/internal/components/Dialog";
|
import { DialogHeader } from "next/dist/client/components/react-dev-overlay/internal/components/Dialog";
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { object, string } from "yup";
|
import { object, string } from "yup";
|
||||||
|
|
||||||
const validationSchema = object({
|
const validationSchema = object({
|
||||||
title: string().required("وارد کردن عنوان الزامیست!"),
|
title: string().required("وارد کردن عنوان الزامیست!"),
|
||||||
unit: string().required("وارد کردن واحد الزامیست!"),
|
unit: string().required("وارد کردن واحد الزامیست!"),
|
||||||
base_price: string().required("وارد کردن فی الزامیست!"),
|
base_price: string().required("وارد کردن فی الزامیست!"),
|
||||||
});
|
});
|
||||||
|
|
||||||
const EditFormContent = ({ row, rowId, mutate, setOpen }) => {
|
const EditFormContent = ({ row, rowId, mutate, setOpen }) => {
|
||||||
const requestServer = useRequest({ notificationSuccess: true });
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
const defaultValues = {
|
const defaultValues = {
|
||||||
title: row.original.title,
|
title: row.original.title,
|
||||||
unit: row.original.unit,
|
unit: row.original.unit,
|
||||||
base_price: row.original.base_price,
|
base_price: row.original.base_price,
|
||||||
};
|
};
|
||||||
|
|
||||||
const {
|
const {
|
||||||
control,
|
control,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
formState: { isSubmitting },
|
formState: { isSubmitting },
|
||||||
} = useForm({
|
} = useForm({
|
||||||
defaultValues,
|
defaultValues,
|
||||||
resolver: yupResolver(validationSchema),
|
resolver: yupResolver(validationSchema),
|
||||||
mode: "all",
|
mode: "all",
|
||||||
});
|
});
|
||||||
|
|
||||||
const onSubmit = async (data) => {
|
const onSubmit = async (data) => {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("title", data.title);
|
formData.append("title", data.title);
|
||||||
formData.append("unit", data.unit);
|
formData.append("unit", data.unit);
|
||||||
formData.append("base_price", data.base_price);
|
formData.append("base_price", data.base_price);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await requestServer(`${UPDATE_RECEIPT_DAMAGE_ITEMS}/${rowId}`, "post", {
|
await requestServer(`${UPDATE_RECEIPT_DAMAGE_ITEMS}/${rowId}`, "post", {
|
||||||
data: formData,
|
data: formData,
|
||||||
});
|
});
|
||||||
mutate();
|
mutate();
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>ویرایش آیتم</DialogTitle>
|
<DialogTitle>ویرایش آیتم</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<DialogContent dividers>
|
<DialogContent dividers>
|
||||||
<StyledForm onSubmit={handleSubmit(onSubmit)} id="updateDamageForm">
|
<StyledForm onSubmit={handleSubmit(onSubmit)} id="updateDamageForm">
|
||||||
<Stack spacing={3}>
|
<Stack spacing={3}>
|
||||||
<Controller
|
<Controller
|
||||||
name="title"
|
name="title"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
||||||
<TextField
|
<TextField
|
||||||
fullWidth
|
fullWidth
|
||||||
size="small"
|
size="small"
|
||||||
label="عنوان"
|
label="عنوان"
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder="عنوان را وارد کنید"
|
placeholder="عنوان را وارد کنید"
|
||||||
error={!!error}
|
error={!!error}
|
||||||
helperText={error ? error.message : null}
|
helperText={error ? error.message : null}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
InputLabelProps={{ shrink: true }}
|
InputLabelProps={{ shrink: true }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<Controller
|
<Controller
|
||||||
name="unit"
|
name="unit"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
||||||
<TextField
|
<TextField
|
||||||
fullWidth
|
fullWidth
|
||||||
size="small"
|
size="small"
|
||||||
label="واحد"
|
label="واحد"
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
error={!!error}
|
error={!!error}
|
||||||
placeholder="واحد را وارد کنید"
|
placeholder="واحد را وارد کنید"
|
||||||
helperText={error ? error.message : null}
|
helperText={error ? error.message : null}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
InputLabelProps={{ shrink: true }}
|
InputLabelProps={{ shrink: true }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<Controller
|
<Controller
|
||||||
name="base_price"
|
name="base_price"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
||||||
<NumberField
|
<NumberField
|
||||||
label={`فی`}
|
label={`فی`}
|
||||||
error={!!error}
|
error={!!error}
|
||||||
value={value || ""}
|
value={value || ""}
|
||||||
type="text"
|
type="text"
|
||||||
size={"small"}
|
size={"small"}
|
||||||
unit={"ریال"}
|
unit={"ریال"}
|
||||||
inputProps={{
|
inputProps={{
|
||||||
placeholder: "فی را وارد کنید",
|
placeholder: "فی را وارد کنید",
|
||||||
inputMode: "number",
|
inputMode: "number",
|
||||||
min: 0,
|
min: 0,
|
||||||
pattern: "[0-9]*",
|
pattern: "[0-9]*",
|
||||||
}}
|
}}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
if (!isNaN(event.target.value)) {
|
if (!isNaN(event.target.value)) {
|
||||||
onChange(event.target.value);
|
onChange(event.target.value);
|
||||||
} else {
|
} else {
|
||||||
onChange(value);
|
onChange(value);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
helperText={error ? error.message : null}
|
helperText={error ? error.message : null}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
fullWidth
|
fullWidth
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</StyledForm>
|
</StyledForm>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={() => setOpen(false)} variant="outlined" color="secondary" startIcon={<ExitToApp />}>
|
<Button onClick={() => setOpen(false)} variant="outlined" color="secondary" startIcon={<ExitToApp />}>
|
||||||
بستن
|
بستن
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
type={"submit"}
|
type={"submit"}
|
||||||
form="updateDamageForm"
|
form="updateDamageForm"
|
||||||
endIcon={<Beenhere />}
|
endIcon={<Beenhere />}
|
||||||
>
|
>
|
||||||
{isSubmitting ? "در حال ویرایش آیتم" : "ویرایش آیتم"}
|
{isSubmitting ? "در حال ویرایش آیتم" : "ویرایش آیتم"}
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default EditFormContent;
|
export default EditFormContent;
|
||||||
|
|||||||
@@ -1,44 +1,44 @@
|
|||||||
import BorderColorIcon from "@mui/icons-material/BorderColor";
|
import BorderColorIcon from "@mui/icons-material/BorderColor";
|
||||||
import { Dialog, IconButton, Tooltip } from "@mui/material";
|
import { Dialog, IconButton, Tooltip } from "@mui/material";
|
||||||
import EditFormContent from "./Form";
|
import EditFormContent from "./Form";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import CloseIcon from "@mui/icons-material/Close";
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
|
|
||||||
const Edit = ({ row, mutate, rowId }) => {
|
const Edit = ({ row, mutate, rowId }) => {
|
||||||
const [openEditDialog, setOpenEditDialog] = useState(false);
|
const [openEditDialog, setOpenEditDialog] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Tooltip title="ویرایش" arrow placement="right">
|
<Tooltip title="ویرایش" arrow placement="right">
|
||||||
<IconButton
|
<IconButton
|
||||||
color="primary"
|
color="primary"
|
||||||
sx={{ textTransform: "unset", alignSelf: "center" }}
|
sx={{ textTransform: "unset", alignSelf: "center" }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setOpenEditDialog(true);
|
setOpenEditDialog(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<BorderColorIcon />
|
<BorderColorIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Dialog open={openEditDialog} fullWidth maxWidth="xs">
|
<Dialog open={openEditDialog} fullWidth maxWidth="xs">
|
||||||
<IconButton
|
<IconButton
|
||||||
aria-label="close"
|
aria-label="close"
|
||||||
onClick={() => setOpenEditDialog(false)}
|
onClick={() => setOpenEditDialog(false)}
|
||||||
sx={(theme) => ({
|
sx={(theme) => ({
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
right: 8,
|
right: 8,
|
||||||
top: 8,
|
top: 8,
|
||||||
zIndex: 50,
|
zIndex: 50,
|
||||||
color: theme.palette.grey[500],
|
color: theme.palette.grey[500],
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<CloseIcon />
|
<CloseIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
{openEditDialog && (
|
{openEditDialog && (
|
||||||
<EditFormContent rowId={rowId} row={row} setOpen={setOpenEditDialog} mutate={mutate} />
|
<EditFormContent rowId={rowId} row={row} setOpen={setOpenEditDialog} mutate={mutate} />
|
||||||
)}
|
)}
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default Edit;
|
export default Edit;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { Box } from "@mui/material";
|
import { Box } from "@mui/material";
|
||||||
import Activity from "./Activity";
|
import Activity from "./Activity";
|
||||||
import Edit from "./Edit";
|
import Edit from "./Edit";
|
||||||
|
|
||||||
const RowActions = ({ row, mutate }) => {
|
const RowActions = ({ row, mutate }) => {
|
||||||
return (
|
return (
|
||||||
<Box sx={{ display: "flex", gap: 1, alignItems: "center" }}>
|
<Box sx={{ display: "flex", gap: 1, alignItems: "center" }}>
|
||||||
<Edit row={row} mutate={mutate} rowId={row.getValue("id")} />
|
<Edit row={row} mutate={mutate} rowId={row.getValue("id")} />
|
||||||
<Activity mutate={mutate} rowId={row.getValue("id")} status={row.original.status} />
|
<Activity mutate={mutate} rowId={row.getValue("id")} status={row.original.status} />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default RowActions;
|
export default RowActions;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import CreateDamage from "./Actions/Create";
|
import CreateDamage from "./Actions/Create";
|
||||||
|
|
||||||
const Toolbar = ({ mutate }) => {
|
const Toolbar = ({ mutate }) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<CreateDamage mutate={mutate} />
|
<CreateDamage mutate={mutate} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default Toolbar;
|
export default Toolbar;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import PageTitle from "@/core/components/PageTitle";
|
import PageTitle from "@/core/components/PageTitle";
|
||||||
import { Stack } from "@mui/material";
|
import { Stack } from "@mui/material";
|
||||||
import DamagesList from "./DamagesList";
|
import DamagesList from "./DamagesList";
|
||||||
|
|
||||||
const DamagesPage = () => {
|
const DamagesPage = () => {
|
||||||
return (
|
return (
|
||||||
<Stack spacing={1}>
|
<Stack spacing={1}>
|
||||||
<PageTitle title={"آیتم خسارات"} />
|
<PageTitle title={"آیتم خسارات"} />
|
||||||
<DamagesList />
|
<DamagesList />
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default DamagesPage;
|
export default DamagesPage;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user