diff --git a/app/UserPanel/(Admin)/AdminDashboard/KeysManagement/page.tsx b/app/UserPanel/(Admin)/AdminDashboard/KeysManagement/page.tsx new file mode 100644 index 0000000..24aea02 --- /dev/null +++ b/app/UserPanel/(Admin)/AdminDashboard/KeysManagement/page.tsx @@ -0,0 +1,8 @@ +import AdminKeysManagement from '@/components/AdminKeysManagement' +import React from 'react' + +export default function page() { + return ( + + ) +} diff --git a/app/UserPanel/(Admin)/AdminDashboard/Management/page.tsx b/app/UserPanel/(Admin)/AdminDashboard/Management/page.tsx deleted file mode 100644 index 82e57d0..0000000 --- a/app/UserPanel/(Admin)/AdminDashboard/Management/page.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import AdminManagement from '@/components/AdminManagement' -import React from 'react' - -export default function page() { - return ( - - ) -} diff --git a/app/UserPanel/(Admin)/AdminDashboard/UserManagement/page.tsx b/app/UserPanel/(Admin)/AdminDashboard/UserManagement/page.tsx new file mode 100644 index 0000000..ec7fdbb --- /dev/null +++ b/app/UserPanel/(Admin)/AdminDashboard/UserManagement/page.tsx @@ -0,0 +1,8 @@ +import AdminUserManagement from '@/components/AdminUserManagement' +import React from 'react' + +export default function page() { + return ( + + ) +} diff --git a/app/components/Landing.tsx b/app/components/Landing.tsx index 933c4e9..48ceedd 100644 --- a/app/components/Landing.tsx +++ b/app/components/Landing.tsx @@ -21,7 +21,7 @@ import { sliderItems } from "@/constants"; export default function Landing() { return ( -
+
); 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() {

لطفا جهت ارسال درخواست فرم زیر را تکمیل نمایید.

-

+

در صورت عدم تمایل به ثبت مشخصات شخصی می توانید به صفحه ی بعد مراجعه کنید.

diff --git a/components/RequestStep2.tsx b/components/RequestStep2.tsx index ae67f04..1789dea 100644 --- a/components/RequestStep2.tsx +++ b/components/RequestStep2.tsx @@ -68,19 +68,19 @@ const FormSchema = z.object({ }), uploadFile: z .custom((val) => val instanceof FileList, "Required") - .refine((files) => files.length > 0, `Required`) + // .refine((files) => files.length > 0, `Required`) .refine((files) => files.length <= 5, `Maximum of 5 File are allowed.`) .refine( (files) => Array.from(files).every((file) => file.size <= MAX_IMAGE_SIZE), `Each file size should be less than 5 MB.` - ) - .refine( - (files) => - Array.from(files).every((file) => - ALLOWED_IMAGE_TYPES.includes(file.type) - ), - "Only these types are allowed .jpg, .jpeg, .png and .webp" ), + // .refine( + // (files) => + // Array.from(files).every((file) => + // ALLOWED_IMAGE_TYPES.includes(file.type) + // ), + // "Only these types are allowed .jpg, .jpeg, .png and .webp" + // ), categoryId: z.string({ required_error: "Please select an category to display.", }), @@ -331,7 +331,7 @@ export default function RequestStep2() {