);
diff --git a/components/AdminKeysManagement.tsx b/components/AdminKeysManagement.tsx
new file mode 100644
index 0000000..972cd7a
--- /dev/null
+++ b/components/AdminKeysManagement.tsx
@@ -0,0 +1,257 @@
+"use client";
+
+import React, { useState } from "react";
+import { useQuery } from "@tanstack/react-query";
+import { GenerateKeyPair, GetKeys } from "@/utils/adminApi";
+
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+ AlertDialogTrigger,
+} from "@/components/ui/alert-dialog";
+import { Button } from "@/components/ui/button";
+import { ThreeDots } from "react-loader-spinner";
+
+import {
+ Form,
+ FormControl,
+ FormDescription,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@/components/ui/form";
+import { Input } from "@/components/ui/input";
+
+
+// const FormSchema = z.object({
+// title: z.string().min(2, {
+// message: "trackingNumber must be at least 2 characters.",
+// }),
+// password: z.string().min(4, {
+// message: "Password must be at least 4 characters.",
+// }),
+// });
+
+export default function AdminKeysManagement() {
+ // List Keys
+ const {
+ data: data1,
+ error: Error1,
+ isLoading: isListLoading,
+ refetch: refetch1,
+ } = useQuery({
+ queryKey: ["KeysList"],
+ queryFn: () => GetKeys(),
+ // refetchOnWindowFocus: false,
+ });
+ console.log(data1);
+
+ // GenerateKeyPair
+ const {
+ data: data2,
+ error: Error2,
+ isLoading: isNewKeyLoading,
+ refetch: refetch2,
+ } = useQuery({
+ queryKey: ["GenerateKey"],
+ queryFn: () => GenerateKeyPair(),
+ enabled: false, // Disable automatic fetching
+ });
+ const handleClick = () => {
+ refetch2();
+ console.log(data2);
+ // Manually trigger the query when the button is clicked
+ };
+
+ // }
+ return (
+
+
+ {/* 1 */}
+
+
+
+
+
+
+ اطلاعات کلید جدید
+
+ {isNewKeyLoading ? (
+
+
+
+ ) : (
+
+
+ کلید عمومی :
+
+
+ {data2?.publicKey}
+
+
+
+ کلید خصوصی :
+
+
+ {data2?.privateKey}
+
+
+ )}
+
+
+
+ بستن
+ {/* Continue */}
+
+
+
+
+ {/* 1 */}
+
+
+
+
+
+
+ افزودن کلید جدید
+
+ {isNewKeyLoading ? (
+
+
+
+ ) : (
+ <>>
+ //
+ //
+ )}
+
+
+
+ بستن
+ {/* Continue */}
+
+
+
+
+
+ لیست کلیدها
+
+ {/* 2 */}
+
+ {data1?.map((item: any) => {
+ return (
+
+
+ عنوان کلید :
+ {item.title}
+
+
+ آی دی بازرس :
+
+ {item.inspectorId}
+
+
+
+ );
+ })}
+
+
+
+ );
+}
diff --git a/components/AdminManagement.tsx b/components/AdminUserManagement.tsx
similarity index 99%
rename from components/AdminManagement.tsx
rename to components/AdminUserManagement.tsx
index 5b3f89e..827cd7d 100644
--- a/components/AdminManagement.tsx
+++ b/components/AdminUserManagement.tsx
@@ -22,7 +22,7 @@ import { Button } from "./ui/button";
import { AdminCardItems } from "@/constants";
import TableAdmin from "./TableAdmin";
-export default function AdminManagement() {
+export default function AdminUserManagement() {
return (
diff --git a/components/ComplainsDetails.tsx b/components/ComplainsDetails.tsx
index 2f3dc93..0b85a67 100644
--- a/components/ComplainsDetails.tsx
+++ b/components/ComplainsDetails.tsx
@@ -118,7 +118,7 @@ export default function ComplainsDetails({
{data.contents?.map((item: any) => {
return (
-
+
{item.sender == 0 ? "شهروند" : "بازرس"}
@@ -140,6 +140,26 @@ export default function ComplainsDetails({
);
})}
{/* {data.contents?.map((item: any) => {
+ return (
+
+
+
+ {item.sender == 0 ? "شهروند" : "بازرس"}
+
+
+ تاریخ :
+
+ {convertDate(item.dateTime)}
+
+
+
+
+ متن: {item.text ? item.text : "-"}
+
+
+ );
+ })}
+ {data.contents?.map((item: any) => {
return (
@@ -158,7 +178,47 @@ export default function ComplainsDetails({
);
- })} */}
+ })}
+ {data.contents?.map((item: any) => {
+ return (
+
+
+
+ {item.sender == 0 ? "شهروند" : "بازرس"}
+
+
+ تاریخ :
+
+ {convertDate(item.dateTime)}
+
+
+
+
+ متن: {item.text ? item.text : "-"}
+
+
+ );
+ })}
+ {data.contents?.map((item: any) => {
+ return (
+
+
+
+ {item.sender == 0 ? "شهروند" : "بازرس"}
+
+
+ تاریخ :
+
+ {convertDate(item.dateTime)}
+
+
+
+
+ متن: {item.text ? item.text : "-"}
+
+
+ );
+ })}
diff --git a/components/FollowResult.tsx b/components/FollowResult.tsx
index d552cf7..f5b555e 100644
--- a/components/FollowResult.tsx
+++ b/components/FollowResult.tsx
@@ -30,12 +30,20 @@ export default function FollowResult() {
const router = useRouter();
const [trackingNumber, setTrackingNumber] = useState
();
const [password, setPassword] = useState();
- const [complaintData, setComplaintData] = useState();
+ const [complaintData, setComplaintData] = useState();
+ const [printStyle, setPrintStyle] = useState(true);
+
// Print component Data
const componentRef = useRef(null);
const handlePrint = useReactToPrint({
content: () => componentRef.current,
+ // onBeforePrint() {
+ // setPrintStyle(!printStyle);
+ // },
+ // onAfterPrint() {
+ // setPrintStyle(!printStyle)
+ // },
});
useEffect(() => {
@@ -119,6 +127,39 @@ export default function FollowResult() {
+
+ {complaintPrintMutation.isPending ? (
+
+
+
+ ) : (
+
+
+ {" "}
+ موضوع شکایت:{" "}
+
+ {`${complaintData?.title}`}
+
+
+
+ {" "}
+ متن شکایت:{" "}
+
+ {`${complaintData?.contents[0]?.text}`}
+
+
+
{complaintPrintMutation.isPending ? (
diff --git a/components/NavbarPanel.tsx b/components/NavbarPanel.tsx
index 94963f2..9722d50 100644
--- a/components/NavbarPanel.tsx
+++ b/components/NavbarPanel.tsx
@@ -68,7 +68,9 @@ export default function NavbarPanel() {
- نام و نام خانوادگی (بازرس)
+
+ {role === 'Admin' ? 'نام و نام خانوادگی (ادمین)' : 'نام و نام خانوادگی (بازرس)'}
+
);
diff --git a/components/RequestStep1.tsx b/components/RequestStep1.tsx
index 4428591..5f99518 100644
--- a/components/RequestStep1.tsx
+++ b/components/RequestStep1.tsx
@@ -64,7 +64,7 @@ export default function RequestStep1() {
لطفا جهت ارسال درخواست فرم زیر را تکمیل نمایید.
-
+
در صورت عدم تمایل به ثبت مشخصات شخصی می توانید به صفحه ی بعد مراجعه کنید.