diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/PrivacyOfficeList.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/PrivacyOfficeList.jsx
index 27a8f85..c339a16 100644
--- a/src/components/dashboard/inquiryPrivacy/privacy-office/PrivacyOfficeList.jsx
+++ b/src/components/dashboard/inquiryPrivacy/privacy-office/PrivacyOfficeList.jsx
@@ -34,15 +34,15 @@ const PrivacyOfficeList = () => {
const [modal, setModal] = useState({
open: false,
type: null, // "reject" | "confirm" | "referral"
- row: null,
+ rowId: null,
});
- const handleOpenModal = (type, row) => {
- setModal({ open: true, type, row });
+ const handleOpenModal = (type, rowId) => {
+ setModal({ open: true, type, rowId });
};
const handleCloseModal = () => {
- setModal({ open: false, type: null, row: null });
+ setModal({ open: false, type: null, rowId: null });
};
const columns = useMemo(() => {
@@ -254,12 +254,7 @@ const PrivacyOfficeList = () => {
/>
-
+
>
);
};
diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ActionsDialog.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ActionsDialog.jsx
index 1dae411..75a1bf6 100644
--- a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ActionsDialog.jsx
+++ b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ActionsDialog.jsx
@@ -10,17 +10,30 @@ import {
TextField,
} from "@mui/material";
import { useEffect, useState } from "react";
+import { Controller, useForm } from "react-hook-form";
const ActionDialog = ({ open, type, rowDataId, onClose }) => {
- const [description, setDescription] = useState("");
- const [checked, setChecked] = useState(false);
+ const [needsAccessRoad, setNeedsAccessRoad] = useState(false);
+ const {
+ control,
+ handleSubmit,
+ reset,
+ formState: { isSubmitting },
+ } = useForm({
+ defaultValues: {
+ expert_description: "",
+ need_payment: false,
+ },
+ });
useEffect(() => {
if (open) {
- setDescription("");
- setChecked(false);
+ reset({
+ expert_description: "",
+ need_payment: false,
+ });
}
- }, [open]);
+ }, [open, reset]);
const actionLabel = {
reject: "رد درخواست",
@@ -28,13 +41,12 @@ const ActionDialog = ({ open, type, rowDataId, onClose }) => {
referral: "ارجاع درخواست",
}[type];
- const handleSubmit = () => {
- console.log("Row data id: ", rowDataId);
- console.log("Action type: ", type);
- console.log("Desctiption: ", description);
- console.log("Checked: ", checked);
+ const onSubmit = (formData) => {
+ console.log("Row data id:", rowDataId);
+ console.log("Action type:", type);
+ console.log("Form data:", formData);
- // TODO: Implement api call
+ // TODO: Implement the API call here
onClose();
};
@@ -44,28 +56,43 @@ const ActionDialog = ({ open, type, rowDataId, onClose }) => {
{actionLabel}
-
- setDescription(e.target.value)}
- />
-
- setChecked(e.target.checked)} />}
- label="تایید انجام عملیات"
+
+ }
/>
+ {type === "confirm" && (
+ <>
+ (
+ }
+ label="نیاز به پرداخت"
+ />
+ )}
+ />
+ setNeedsAccessRoad(e.target.checked)}
+ />
+ }
+ label="به راه دسترسی نیاز دارد"
+ />
+ >
+ )}
-
diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ReferralAction/index.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ReferralAction/index.jsx
index 28667cf..7f56971 100644
--- a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ReferralAction/index.jsx
+++ b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/ReferralAction/index.jsx
@@ -4,7 +4,7 @@ import { IconButton, Tooltip } from "@mui/material";
const ReferralAction = ({ onClick }) => {
return (
<>
-
+
diff --git a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/index.jsx b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/index.jsx
index b45eb01..61c5a54 100644
--- a/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/index.jsx
+++ b/src/components/dashboard/inquiryPrivacy/privacy-office/RowActions/index.jsx
@@ -3,12 +3,17 @@ import ConfirmAction from "./ConfirmAction";
import ReferralAction from "./ReferralAction";
import RejectAction from "./RejectAction";
-const RowActions = ({ row, onActionClick }) => {
+const RowActions = ({
+ row: {
+ original: { id },
+ },
+ onActionClick,
+}) => {
return (
- onActionClick("referral", row)} />
- onActionClick("reject", row)} />
- onActionClick("confirm", row)} />
+ onActionClick("referral", id)} />
+ onActionClick("reject", id)} />
+ onActionClick("confirm", id)} />
);
};