Compare commits
No commits in common. "08872f04b9b250c76449cd8a8235d9aabe39e15e" and "24350884fd7dfb77b0ba7946c07f66e18ba19ae6" have entirely different histories.
08872f04b9
...
24350884fd
|
|
@ -5,7 +5,7 @@ export default function page({ params }: { params: any }) {
|
||||||
const id = params.id;
|
const id = params.id;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-[90vw] sm:w-[90vw] lg:w-[85vw] xl:w-[75vw] 3xl:w-[70vw] mt-10 sm:mt-8 pt-9 mx-auto mb-6">
|
<div className="w-[90vw] sm:w-[90vw] lg:w-[85vw] xl:w-[75vw] 3xl:w-[70vw] mt-10 sm:mt-8 pt-9 mx-auto mb-10">
|
||||||
<ComplainsDetails role="Inspector" id={id} />
|
<ComplainsDetails role="Inspector" id={id} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -214,18 +214,10 @@ export default function AdminCategories() {
|
||||||
description: data.description,
|
description: data.description,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const resetFormAdd = () => {
|
|
||||||
formAdd.reset({
|
|
||||||
titleCategory: "",
|
|
||||||
description: "",
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full min-h-[85vh] flex justify-center">
|
<div className="w-full min-h-[85vh] flex justify-center">
|
||||||
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
||||||
<div className="flex flex-row items-center justify-between w-full ">
|
<div className="flex flex-row justify-between w-full ">
|
||||||
{/* 1 */}
|
{/* 1 */}
|
||||||
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
|
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
|
||||||
لیست دسته بندی ها
|
لیست دسته بندی ها
|
||||||
|
|
@ -250,7 +242,7 @@ const resetFormAdd = () => {
|
||||||
<p className="text-[#464646] text-base font-bold">
|
<p className="text-[#464646] text-base font-bold">
|
||||||
افزودن دسته بندی
|
افزودن دسته بندی
|
||||||
</p>
|
</p>
|
||||||
<AlertDialogCancel className="h-auto p-0 border-0" onClick={() => { resetFormAdd(); }}>
|
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||||
<IoMdClose />
|
<IoMdClose />
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</AlertDialogTitle>
|
</AlertDialogTitle>
|
||||||
|
|
@ -315,7 +307,7 @@ const resetFormAdd = () => {
|
||||||
>
|
>
|
||||||
افزودن
|
افزودن
|
||||||
</Button>
|
</Button>
|
||||||
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl" onClick={() => { resetFormAdd(); }}>
|
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
|
||||||
بستن
|
بستن
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,6 @@ const FormSchemaAddKey = z.object({
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export default function AdminKeysManagement() {
|
export default function AdminKeysManagement() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [keyId, setKeyId] = useState("");
|
const [keyId, setKeyId] = useState("");
|
||||||
|
|
@ -254,15 +253,6 @@ export default function AdminKeysManagement() {
|
||||||
saveTextFile();
|
saveTextFile();
|
||||||
}
|
}
|
||||||
}, [AddKeyMutation.isSuccess]);
|
}, [AddKeyMutation.isSuccess]);
|
||||||
|
|
||||||
|
|
||||||
const resetFormAdd = () => {
|
|
||||||
formAdd.reset({
|
|
||||||
title: "",
|
|
||||||
publicKey: "",
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full min-h-[85vh] flex justify-center">
|
<div className="w-full min-h-[85vh] flex justify-center">
|
||||||
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
||||||
|
|
@ -274,7 +264,7 @@ export default function AdminKeysManagement() {
|
||||||
<p className="text-[#464646] text-base font-bold">
|
<p className="text-[#464646] text-base font-bold">
|
||||||
افزودن کلید جدید
|
افزودن کلید جدید
|
||||||
</p>
|
</p>
|
||||||
<AlertDialogCancel className="h-auto p-0 border-0" onClick={() => { resetFormAdd(); }}>
|
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||||
<IoMdClose />
|
<IoMdClose />
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</AlertDialogTitle>
|
</AlertDialogTitle>
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import React, { useState, useRef, useEffect } from "react";
|
import React, { useState, useRef, useEffect } from "react";
|
||||||
import {
|
import { useMutation, useQuery, RefetchOptions } from "@tanstack/react-query";
|
||||||
useMutation,
|
|
||||||
useQuery,
|
|
||||||
RefetchOptions,
|
|
||||||
useQueryClient,
|
|
||||||
} from "@tanstack/react-query";
|
|
||||||
import {
|
import {
|
||||||
GetAllNews,
|
GetAllNews,
|
||||||
GetSingleNews,
|
GetSingleNews,
|
||||||
SubmitNews,
|
SubmitNews,
|
||||||
UpdateNews,
|
UpdateNews,
|
||||||
DeleteNews,
|
DeleteNews,
|
||||||
|
GetAllOrganizations,
|
||||||
|
GetSingleOrganization,
|
||||||
|
SubmitOrganization,
|
||||||
|
UpdateOrganization,
|
||||||
|
DeleteOrganization,
|
||||||
} from "@/utils/adminApi";
|
} from "@/utils/adminApi";
|
||||||
import { FaRegEdit } from "react-icons/fa";
|
import { FaRegEdit } from "react-icons/fa";
|
||||||
import { IoMdClose } from "react-icons/io";
|
import { IoMdClose } from "react-icons/io";
|
||||||
|
|
@ -132,7 +132,7 @@ export default function AdminNews() {
|
||||||
const [openEdit, setOpenEdit] = React.useState(false);
|
const [openEdit, setOpenEdit] = React.useState(false);
|
||||||
|
|
||||||
const [delOrg, setDelOrg] = React.useState(false);
|
const [delOrg, setDelOrg] = React.useState(false);
|
||||||
const queryClient = useQueryClient();
|
|
||||||
// List News
|
// List News
|
||||||
const {
|
const {
|
||||||
data: data1,
|
data: data1,
|
||||||
|
|
@ -145,18 +145,10 @@ export default function AdminNews() {
|
||||||
GetAllNews({
|
GetAllNews({
|
||||||
PageNumber: page,
|
PageNumber: page,
|
||||||
}),
|
}),
|
||||||
|
// queryFn: () => GetAllOrganizations(),
|
||||||
|
// refetchOnWindowFocus: false,
|
||||||
});
|
});
|
||||||
|
console.log(data1);
|
||||||
const {
|
|
||||||
data: data2,
|
|
||||||
error: Error2,
|
|
||||||
isLoading: isLoading2,
|
|
||||||
refetch: refetch2,
|
|
||||||
} = useQuery({
|
|
||||||
queryKey: ["News", keyId],
|
|
||||||
queryFn: () => GetSingleNews(keyId),
|
|
||||||
enabled: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
const handleClickEdit = (
|
const handleClickEdit = (
|
||||||
|
|
@ -168,30 +160,23 @@ export default function AdminNews() {
|
||||||
image: string
|
image: string
|
||||||
) => {
|
) => {
|
||||||
// Set state variables
|
// Set state variables
|
||||||
console.log(id);
|
|
||||||
setKeyId(id);
|
setKeyId(id);
|
||||||
setTitleNews(title);
|
setTitleNews(title);
|
||||||
setDescNews(description);
|
setDescNews(description);
|
||||||
setUrlNews(url);
|
setUrlNews(url);
|
||||||
setContentNews(content);
|
setContentNews(content);
|
||||||
setImageNews(image);
|
setImageNews(image);
|
||||||
|
|
||||||
// Reset the form with new default values
|
// Reset the form with new default values
|
||||||
|
formEdit.reset({
|
||||||
|
titleNews: title,
|
||||||
|
description: description,
|
||||||
|
urlNews: url,
|
||||||
|
content: content,
|
||||||
|
// uploadImg:image
|
||||||
|
});
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
|
||||||
if (keyId) {
|
|
||||||
refetch2();
|
|
||||||
}
|
|
||||||
}, [keyId]);
|
|
||||||
useEffect(() => {
|
|
||||||
if (data2) {
|
|
||||||
formEdit.reset({
|
|
||||||
titleNews: data2.title,
|
|
||||||
description: data2.description,
|
|
||||||
urlNews: data2.url,
|
|
||||||
content: data2.content,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, [data2]);
|
|
||||||
// Form Edit
|
// Form Edit
|
||||||
type EditNewsFormValues = z.infer<typeof EditNewsFormSchema>;
|
type EditNewsFormValues = z.infer<typeof EditNewsFormSchema>;
|
||||||
// This can come from your database or API.
|
// This can come from your database or API.
|
||||||
|
|
@ -340,18 +325,10 @@ export default function AdminNews() {
|
||||||
}
|
}
|
||||||
}, [data1]);
|
}, [data1]);
|
||||||
|
|
||||||
const resetFormAdd = () => {
|
|
||||||
formAdd.reset({
|
|
||||||
titleNews: "",
|
|
||||||
urlNews: "",
|
|
||||||
content: "",
|
|
||||||
description: "",
|
|
||||||
});
|
|
||||||
};
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full min-h-[85vh] flex justify-center pb-4">
|
<div className="w-full min-h-[85vh] flex justify-center py-4">
|
||||||
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
||||||
<div className="flex flex-row items-center justify-between w-full ">
|
<div className="flex flex-row justify-between w-full ">
|
||||||
{/* 1 */}
|
{/* 1 */}
|
||||||
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
|
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
|
||||||
لیست خبر ها
|
لیست خبر ها
|
||||||
|
|
@ -376,12 +353,7 @@ export default function AdminNews() {
|
||||||
<p className="text-[#464646] text-base font-bold">
|
<p className="text-[#464646] text-base font-bold">
|
||||||
افزودن خبر
|
افزودن خبر
|
||||||
</p>
|
</p>
|
||||||
<AlertDialogCancel
|
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||||
className="h-auto p-0 border-0"
|
|
||||||
onClick={() => {
|
|
||||||
resetFormAdd();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<IoMdClose />
|
<IoMdClose />
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</AlertDialogTitle>
|
</AlertDialogTitle>
|
||||||
|
|
@ -534,12 +506,7 @@ export default function AdminNews() {
|
||||||
>
|
>
|
||||||
افزودن
|
افزودن
|
||||||
</Button>
|
</Button>
|
||||||
<AlertDialogCancel
|
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
|
||||||
className="mt-0 text-white bg-blue rounded-xl"
|
|
||||||
onClick={() => {
|
|
||||||
resetFormAdd();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
بستن
|
بستن
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -751,10 +718,16 @@ export default function AdminNews() {
|
||||||
</p>
|
</p>
|
||||||
<p className="text-sm font-normal leading-normal text-slate-500">
|
<p className="text-sm font-normal leading-normal text-slate-500">
|
||||||
توضیحات:
|
توضیحات:
|
||||||
<span className="self-end text-slate-800 line-clamp-4">
|
<span className="self-end text-slate-800 line-clamp-2">
|
||||||
{item.description}
|
{item.description}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
<p className="text-sm font-normal leading-normal text-slate-500">
|
||||||
|
محتوا:
|
||||||
|
<span className="self-end text-slate-800">
|
||||||
|
{item.content}
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-end justify-end w-full gap-2">
|
<div className="flex items-end justify-end w-full gap-2">
|
||||||
<Switch
|
<Switch
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ const AddOrgFormSchema = z.object({
|
||||||
// message: " توضیحات را وارد کنید",
|
// message: " توضیحات را وارد کنید",
|
||||||
// }),
|
// }),
|
||||||
description: z.string(),
|
description: z.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function AdminOrganizations() {
|
export default function AdminOrganizations() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
@ -217,17 +217,10 @@ export default function AdminOrganizations() {
|
||||||
description: data.description,
|
description: data.description,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const resetFormAdd = () => {
|
|
||||||
formAdd.reset({
|
|
||||||
titleOrg: "",
|
|
||||||
description: "",
|
|
||||||
});
|
|
||||||
};
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full min-h-[85vh] flex justify-center">
|
<div className="w-full min-h-[85vh] flex justify-center">
|
||||||
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
||||||
<div className="flex flex-row items-center justify-between w-full ">
|
<div className="flex flex-row justify-between w-full ">
|
||||||
{/* 1 */}
|
{/* 1 */}
|
||||||
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
|
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
|
||||||
لیست سازمان ها
|
لیست سازمان ها
|
||||||
|
|
@ -252,7 +245,7 @@ export default function AdminOrganizations() {
|
||||||
<p className="text-[#464646] text-base font-bold">
|
<p className="text-[#464646] text-base font-bold">
|
||||||
افزودن سازمان
|
افزودن سازمان
|
||||||
</p>
|
</p>
|
||||||
<AlertDialogCancel className="h-auto p-0 border-0" onClick={() => { resetFormAdd(); }}>
|
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||||
<IoMdClose />
|
<IoMdClose />
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</AlertDialogTitle>
|
</AlertDialogTitle>
|
||||||
|
|
@ -317,7 +310,7 @@ export default function AdminOrganizations() {
|
||||||
>
|
>
|
||||||
افزودن
|
افزودن
|
||||||
</Button>
|
</Button>
|
||||||
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl" onClick={() => { resetFormAdd(); }}>
|
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
|
||||||
بستن
|
بستن
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -250,21 +250,12 @@ const AddSliderMutation = useMutation({
|
||||||
setOpenAdd(false);
|
setOpenAdd(false);
|
||||||
|
|
||||||
refetch1();
|
refetch1();
|
||||||
resetField("Title");
|
|
||||||
resetField("Image");
|
|
||||||
resetField("Url");
|
|
||||||
resetField("Description");
|
|
||||||
|
|
||||||
toast("عملیات شما با موفقیت انجام شد. ", {
|
toast("عملیات شما با موفقیت انجام شد. ", {
|
||||||
className: "!bg-green-500 !text-white",
|
className: "!bg-green-500 !text-white",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onError: (err: any | string) => {
|
onError: (err: any | string) => {
|
||||||
resetField("Title");
|
|
||||||
resetField("Image");
|
|
||||||
resetField("Url");
|
|
||||||
resetField("Description");
|
|
||||||
|
|
||||||
toast(<>{err.response.data.detail}</>, {
|
toast(<>{err.response.data.detail}</>, {
|
||||||
className: "!bg-red-500 !text-white",
|
className: "!bg-red-500 !text-white",
|
||||||
});
|
});
|
||||||
|
|
@ -306,25 +297,14 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
||||||
}
|
}
|
||||||
|
|
||||||
AddSliderMutation.mutate(formData);
|
AddSliderMutation.mutate(formData);
|
||||||
resetField("Title");
|
|
||||||
resetField("Image");
|
|
||||||
resetField("Url");
|
|
||||||
resetField("Description");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const resetFormAdd = () => {
|
|
||||||
formAdd.reset({
|
|
||||||
titleSlider: "",
|
|
||||||
uploadImg: null,
|
|
||||||
urlSlider: "",
|
|
||||||
description: "",
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full min-h-[85vh] flex justify-center">
|
<div className="w-full min-h-[85vh] flex justify-center">
|
||||||
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
||||||
<div className="flex flex-row items-center justify-between w-full ">
|
<div className="flex flex-row justify-between w-full ">
|
||||||
{/* 1 */}
|
{/* 1 */}
|
||||||
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
|
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
|
||||||
لیست اسلایدرها
|
لیست اسلایدرها
|
||||||
|
|
@ -349,7 +329,7 @@ const resetFormAdd = () => {
|
||||||
<p className="text-[#464646] text-base font-bold">
|
<p className="text-[#464646] text-base font-bold">
|
||||||
افزودن اسلایدر
|
افزودن اسلایدر
|
||||||
</p>
|
</p>
|
||||||
<AlertDialogCancel className="h-auto p-0 border-0" onClick={() => { resetFormAdd(); }}>
|
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||||
<IoMdClose />
|
<IoMdClose />
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</AlertDialogTitle>
|
</AlertDialogTitle>
|
||||||
|
|
@ -485,7 +465,7 @@ const resetFormAdd = () => {
|
||||||
>
|
>
|
||||||
افزودن
|
افزودن
|
||||||
</Button>
|
</Button>
|
||||||
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl" onClick={() => { resetFormAdd(); }}>
|
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
|
||||||
بستن
|
بستن
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import { ClipboardList, EyeOff, Info, User, UserCheck } from "lucide-react";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
export default function BoxDashboard({
|
export default function BoxDashboard({
|
||||||
|
|
@ -8,32 +7,17 @@ export default function BoxDashboard({
|
||||||
value: string;
|
value: string;
|
||||||
title: string;
|
title: string;
|
||||||
}) {
|
}) {
|
||||||
const boxIcons = {
|
|
||||||
"درخواست ناشناس": <EyeOff className=" mb-2 mx-auto" />,
|
|
||||||
"درخواست شناس": <UserCheck className=" mb-2 mx-auto" />,
|
|
||||||
درخواست: <ClipboardList className=" mb-2 mx-auto" />,
|
|
||||||
کاربر: <User className=" mb-2 mx-auto" />,
|
|
||||||
};
|
|
||||||
const handelIcon = (item: keyof typeof boxIcons) => {
|
|
||||||
const icon = boxIcons[item];
|
|
||||||
return icon;
|
|
||||||
};
|
|
||||||
const checkIcon = boxIcons[title as keyof typeof boxIcons] ? (
|
|
||||||
boxIcons[title as keyof typeof boxIcons]
|
|
||||||
) : (
|
|
||||||
<Info className=" mb-2 mx-auto" />
|
|
||||||
);
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className=" px-7 py-8 bg-zinc-100 rounded-lg shadow flex flex-col justify-evenly items-center text-black
|
className=" px-7 py-8 bg-zinc-100 rounded-lg shadow flex flex-col justify-end items-center text-black
|
||||||
transition duration-200
|
transition duration-200
|
||||||
hover:text-white hover:bg-blue
|
hover:text-white hover:bg-blue
|
||||||
group h-44 w-44"
|
group h-44 w-44"
|
||||||
>
|
>
|
||||||
{checkIcon ? checkIcon : <Info className=" mb-2 mx-auto" />}
|
<div className="group-hover:-translate-y-2 transition-all duration-300">
|
||||||
{/* <EyeOff className=" mb-2 mx-auto" /> */}
|
<p className="text-center text-xs font-medium">
|
||||||
<div className="group-hover:-translate-y-2 flex flex-col justify-center transition-all duration-300">
|
{value}
|
||||||
<p className="text-center text-sm font-medium">{value}</p>
|
</p>
|
||||||
<p className="text-center text-xs font-medium">{title}</p>
|
<p className="text-center text-xs font-medium">{title}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,8 @@ export default function ComplainsDetails({
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
let data;
|
let data;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const getComplaintMutation = useMutation({
|
const getComplaintMutation = useMutation({
|
||||||
mutationKey: ["Complaint", id],
|
mutationKey: ["Complaint", id],
|
||||||
mutationFn: getComplaint,
|
mutationFn: getComplaint,
|
||||||
|
|
@ -61,7 +63,7 @@ export default function ComplainsDetails({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const storedData = localStorage.getItem("CompliantData");
|
const storedData = localStorage.getItem("CompliantData");
|
||||||
const data = JSON.parse(storedData as string);
|
const data = JSON.parse(storedData as string);
|
||||||
|
|
@ -173,7 +175,7 @@ export default function ComplainsDetails({
|
||||||
|
|
||||||
const checkKey2 = (item: any) => {
|
const checkKey2 = (item: any) => {
|
||||||
const dcKey = Decrypt(item.cipherKeyInspector, selectedFile);
|
const dcKey = Decrypt(item.cipherKeyInspector, selectedFile);
|
||||||
|
|
||||||
if (dcKey != false && dcKey != null) {
|
if (dcKey != false && dcKey != null) {
|
||||||
if (check) {
|
if (check) {
|
||||||
// localStorage.setItem("privateKey", dcKey);
|
// localStorage.setItem("privateKey", dcKey);
|
||||||
|
|
@ -194,8 +196,8 @@ export default function ComplainsDetails({
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
data = getComplaintMutation?.data;
|
data = getComplaintMutation?.data;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AlertDialog open={open} onOpenChange={setOpen}>
|
<AlertDialog open={open} onOpenChange={setOpen}>
|
||||||
|
|
@ -270,7 +272,7 @@ export default function ComplainsDetails({
|
||||||
|
|
||||||
<div className="flex items-start w-full gap-2 mt-2 max-lg:flex-col">
|
<div className="flex items-start w-full gap-2 mt-2 max-lg:flex-col">
|
||||||
{/* 1 */}
|
{/* 1 */}
|
||||||
<div className="flex flex-col w-full lg:w-1/3 gap-3 lg:sticky top-28 lg:h-[80vh]">
|
<div className="flex flex-col w-full lg:w-1/3 gap-3 lg:sticky top-28 lg:h-[78vh]">
|
||||||
<div className=" max-lg:hidden bg-[#E9E9E9] rounded-md p-4 px-10 flex flex-col lg:h-full">
|
<div className=" max-lg:hidden bg-[#E9E9E9] rounded-md p-4 px-10 flex flex-col lg:h-full">
|
||||||
<p className="text-[#464646] text-base font-bold mb-1">
|
<p className="text-[#464646] text-base font-bold mb-1">
|
||||||
انجام عملیات
|
انجام عملیات
|
||||||
|
|
@ -406,83 +408,76 @@ export default function ComplainsDetails({
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="h-[calc(80vh-12.8em)] max-h-[calc(80vh-12.8em)] overflow-hidden">
|
<div className="bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col ">
|
||||||
<div className="bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col h-full ">
|
<p className="text-[#464646] text-base font-bold">روند شکایت</p>
|
||||||
<p className="text-[#464646] text-base font-bold">
|
<div
|
||||||
روند شکایت
|
className="flex flex-col mt-4 gap-y-4 max-h-[50vh] lg:max-h-[39.5vh] 2xl:max-h-[43.5vh] 3xl:max-h-[41vh] min-[1920px]:max-h-[48.5vh] overflow-auto
|
||||||
</p>
|
scrollbar-thin scrollbar-thumb-rounded-md scrollbar-thumb-gray-500 scrollbar-track-gray-100"
|
||||||
<div
|
>
|
||||||
className="flex flex-col mt-4 gap-y-4 overflow-auto
|
{data.contents?.map((item: any) => {
|
||||||
scrollbar-thin scrollbar-thumb-gray-500 scrollbar-track-gray-100 "
|
return (
|
||||||
>
|
<div
|
||||||
{data.contents?.map((item: any) => {
|
key={item.id}
|
||||||
return (
|
className="p-4 bg-white rounded-lg shadow-md "
|
||||||
<div
|
>
|
||||||
key={item.id}
|
<div className="flex items-center gap-4 ">
|
||||||
className="p-4 bg-white rounded-lg shadow-md "
|
<p className="">
|
||||||
>
|
<Badge>
|
||||||
<div className="flex items-center gap-4 ">
|
{item.sender == 0 ? "شهروند" : "بازرس"}
|
||||||
<p className="">
|
</Badge>
|
||||||
<Badge>
|
</p>
|
||||||
{item.sender == 0 ? "شهروند" : "بازرس"}
|
<p className="">
|
||||||
</Badge>
|
تاریخ :
|
||||||
</p>
|
|
||||||
<p className="">
|
|
||||||
تاریخ :
|
|
||||||
<span className="text-[#7C838A]">
|
|
||||||
{convertDate(item.dateTime)}
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div className=" text-[#464646] mt-2">
|
|
||||||
<span className="text-[#7C838A]">
|
<span className="text-[#7C838A]">
|
||||||
{item.text ? item.text : "-"}
|
{convertDate(item.dateTime)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</p>
|
||||||
{item.media.length !== 0 && (
|
</div>
|
||||||
<Separator className="mt-2 mb-1 " />
|
<div className=" text-[#464646] mt-2">
|
||||||
)}
|
<span className="text-[#7C838A]">
|
||||||
<div className=" text-[#464646] mt-2">
|
{item.text ? item.text : "-"}
|
||||||
<div className="flex flex-wrap items-center w-full gap-2 mt-2 text-xs max-md:flex-col">
|
</span>
|
||||||
{item?.media.map((item: any, index: number) => {
|
</div>
|
||||||
return (
|
{item.media.length !== 0 && (
|
||||||
<div
|
<Separator className="mt-2 mb-1 " />
|
||||||
key={index}
|
)}
|
||||||
className=" bg-gray-100 text-[#7C838A] w-full md:w-[30%] rounded-md h-12 p-2 flex justify-between gap-3 items-center"
|
<div className=" text-[#464646] mt-2">
|
||||||
|
<div className="flex flex-wrap items-center w-full gap-2 mt-2 text-xs max-md:flex-col">
|
||||||
|
{item?.media.map((item: any, index: number) => {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
key={index}
|
||||||
|
className=" bg-gray-100 text-[#7C838A] w-full md:w-[30%] rounded-md h-12 p-2 flex justify-between gap-3 items-center"
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
onClick={() =>
|
||||||
|
openFileInNewTab(item.data, item.mimeType)
|
||||||
|
}
|
||||||
|
className="flex items-center gap-2 truncate cursor-pointer "
|
||||||
>
|
>
|
||||||
<a
|
<File className="w-6 h-6 " />
|
||||||
onClick={() =>
|
<p className=" max-w-[5rem] truncate">
|
||||||
openFileInNewTab(
|
{item.title}
|
||||||
item.data,
|
</p>
|
||||||
item.mimeType
|
</a>
|
||||||
)
|
<ArrowDownToLine
|
||||||
}
|
className="cursor-pointer "
|
||||||
className="flex items-center gap-2 truncate cursor-pointer "
|
onClick={() =>
|
||||||
>
|
downloadFile(
|
||||||
<File className="w-6 h-6 " />
|
item.data,
|
||||||
<p className=" max-w-[5rem] truncate">
|
item.title,
|
||||||
{item.title}
|
item.mimeType
|
||||||
</p>
|
)
|
||||||
</a>
|
}
|
||||||
<ArrowDownToLine
|
/>
|
||||||
className="cursor-pointer "
|
</div>
|
||||||
onClick={() =>
|
);
|
||||||
downloadFile(
|
})}
|
||||||
item.data,
|
|
||||||
item.title,
|
|
||||||
item.mimeType
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
</div>
|
||||||
})}
|
);
|
||||||
</div>
|
})}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,9 @@ export default function ControllerDashboard() {
|
||||||
queryFn: () => getInfo(),
|
queryFn: () => getInfo(),
|
||||||
refetchOnWindowFocus: false,
|
refetchOnWindowFocus: false,
|
||||||
});
|
});
|
||||||
|
const [decryptedMessage, errorMessage] = useDecrypt(
|
||||||
|
"gJoT9AqK7wk1MZFSD04yXXfF36fzsOL+RYtJfySrEnQeJ7VoaL7pmOU6nB3+0+PQcaxIi3hf1AHjzIB0Cn5oHgKROeoI4XslhAezZk23QhtIU4HUF1wpeOJfA+4hWyRfbh4fI9774sa/KL47VaBbrNM/rvBxk6hjlKx5mTb3hqM="
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-12 pt-9 mx-auto px-2">
|
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-12 pt-9 mx-auto px-2">
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "sootzani",
|
"name": "sootzani",
|
||||||
"version": "0.2.6",
|
"version": "0.2.5",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "sootzani",
|
"name": "sootzani",
|
||||||
"version": "0.2.6",
|
"version": "0.2.5",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hookform/resolvers": "^3.3.2",
|
"@hookform/resolvers": "^3.3.2",
|
||||||
"@radix-ui/react-alert-dialog": "^1.0.5",
|
"@radix-ui/react-alert-dialog": "^1.0.5",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "sootzani",
|
"name": "sootzani",
|
||||||
"version": "0.2.6",
|
"version": "0.2.5",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ export async function GetAllNews({
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function GetSingleNews(id: string) {
|
export async function GetSingleNews({ id }: { id: string }) {
|
||||||
const data = await axios.get(`api/News/${id}`);
|
const data = await axios.get(`api/News/${id}`);
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue