ComplaintDetails Modified + Bugs Fixed
parent
24350884fd
commit
dae4ec5264
|
|
@ -5,7 +5,7 @@ export default function page({ params }: { params: any }) {
|
|||
const id = params.id;
|
||||
|
||||
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-10">
|
||||
<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">
|
||||
<ComplainsDetails role="Inspector" id={id} />
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -214,10 +214,18 @@ export default function AdminCategories() {
|
|||
description: data.description,
|
||||
});
|
||||
}
|
||||
|
||||
const resetFormAdd = () => {
|
||||
formAdd.reset({
|
||||
titleCategory: "",
|
||||
description: "",
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<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="flex flex-row justify-between w-full ">
|
||||
<div className="flex flex-row items-center justify-between w-full ">
|
||||
{/* 1 */}
|
||||
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
|
||||
لیست دسته بندی ها
|
||||
|
|
@ -242,7 +250,7 @@ export default function AdminCategories() {
|
|||
<p className="text-[#464646] text-base font-bold">
|
||||
افزودن دسته بندی
|
||||
</p>
|
||||
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||
<AlertDialogCancel className="h-auto p-0 border-0" onClick={() => { resetFormAdd(); }}>
|
||||
<IoMdClose />
|
||||
</AlertDialogCancel>
|
||||
</AlertDialogTitle>
|
||||
|
|
@ -307,7 +315,7 @@ export default function AdminCategories() {
|
|||
>
|
||||
افزودن
|
||||
</Button>
|
||||
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
|
||||
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl" onClick={() => { resetFormAdd(); }}>
|
||||
بستن
|
||||
</AlertDialogCancel>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ const FormSchemaAddKey = z.object({
|
|||
}),
|
||||
});
|
||||
|
||||
|
||||
export default function AdminKeysManagement() {
|
||||
const router = useRouter();
|
||||
const [keyId, setKeyId] = useState("");
|
||||
|
|
@ -253,6 +254,15 @@ export default function AdminKeysManagement() {
|
|||
saveTextFile();
|
||||
}
|
||||
}, [AddKeyMutation.isSuccess]);
|
||||
|
||||
|
||||
const resetFormAdd = () => {
|
||||
formAdd.reset({
|
||||
title: "",
|
||||
publicKey: "",
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<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 ">
|
||||
|
|
@ -264,7 +274,7 @@ export default function AdminKeysManagement() {
|
|||
<p className="text-[#464646] text-base font-bold">
|
||||
افزودن کلید جدید
|
||||
</p>
|
||||
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||
<AlertDialogCancel className="h-auto p-0 border-0" onClick={() => { resetFormAdd(); }}>
|
||||
<IoMdClose />
|
||||
</AlertDialogCancel>
|
||||
</AlertDialogTitle>
|
||||
|
|
|
|||
|
|
@ -324,11 +324,19 @@ export default function AdminNews() {
|
|||
setPage(headersData.CurrentPage);
|
||||
}
|
||||
}, [data1]);
|
||||
|
||||
|
||||
const resetFormAdd = () => {
|
||||
formAdd.reset({
|
||||
titleNews: "",
|
||||
urlNews: "",
|
||||
content: "",
|
||||
description: "",
|
||||
});
|
||||
};
|
||||
return (
|
||||
<div className="w-full min-h-[85vh] flex justify-center py-4">
|
||||
<div className="w-full min-h-[85vh] flex justify-center pb-4">
|
||||
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
||||
<div className="flex flex-row justify-between w-full ">
|
||||
<div className="flex flex-row items-center justify-between w-full ">
|
||||
{/* 1 */}
|
||||
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
|
||||
لیست خبر ها
|
||||
|
|
@ -353,7 +361,7 @@ export default function AdminNews() {
|
|||
<p className="text-[#464646] text-base font-bold">
|
||||
افزودن خبر
|
||||
</p>
|
||||
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||
<AlertDialogCancel className="h-auto p-0 border-0" onClick={() => { resetFormAdd(); }}>
|
||||
<IoMdClose />
|
||||
</AlertDialogCancel>
|
||||
</AlertDialogTitle>
|
||||
|
|
@ -506,7 +514,7 @@ export default function AdminNews() {
|
|||
>
|
||||
افزودن
|
||||
</Button>
|
||||
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
|
||||
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl" onClick={() => { resetFormAdd(); }}>
|
||||
بستن
|
||||
</AlertDialogCancel>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ const AddOrgFormSchema = z.object({
|
|||
// message: " توضیحات را وارد کنید",
|
||||
// }),
|
||||
description: z.string(),
|
||||
});
|
||||
});
|
||||
|
||||
export default function AdminOrganizations() {
|
||||
const router = useRouter();
|
||||
|
|
@ -217,10 +217,17 @@ export default function AdminOrganizations() {
|
|||
description: data.description,
|
||||
});
|
||||
}
|
||||
|
||||
const resetFormAdd = () => {
|
||||
formAdd.reset({
|
||||
titleOrg: "",
|
||||
description: "",
|
||||
});
|
||||
};
|
||||
return (
|
||||
<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="flex flex-row justify-between w-full ">
|
||||
<div className="flex flex-row items-center justify-between w-full ">
|
||||
{/* 1 */}
|
||||
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
|
||||
لیست سازمان ها
|
||||
|
|
@ -245,7 +252,7 @@ export default function AdminOrganizations() {
|
|||
<p className="text-[#464646] text-base font-bold">
|
||||
افزودن سازمان
|
||||
</p>
|
||||
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||
<AlertDialogCancel className="h-auto p-0 border-0" onClick={() => { resetFormAdd(); }}>
|
||||
<IoMdClose />
|
||||
</AlertDialogCancel>
|
||||
</AlertDialogTitle>
|
||||
|
|
@ -310,7 +317,7 @@ export default function AdminOrganizations() {
|
|||
>
|
||||
افزودن
|
||||
</Button>
|
||||
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
|
||||
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl" onClick={() => { resetFormAdd(); }}>
|
||||
بستن
|
||||
</AlertDialogCancel>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -250,12 +250,21 @@ const AddSliderMutation = useMutation({
|
|||
setOpenAdd(false);
|
||||
|
||||
refetch1();
|
||||
resetField("Title");
|
||||
resetField("Image");
|
||||
resetField("Url");
|
||||
resetField("Description");
|
||||
|
||||
toast("عملیات شما با موفقیت انجام شد. ", {
|
||||
className: "!bg-green-500 !text-white",
|
||||
});
|
||||
},
|
||||
onError: (err: any | string) => {
|
||||
resetField("Title");
|
||||
resetField("Image");
|
||||
resetField("Url");
|
||||
resetField("Description");
|
||||
|
||||
toast(<>{err.response.data.detail}</>, {
|
||||
className: "!bg-red-500 !text-white",
|
||||
});
|
||||
|
|
@ -297,14 +306,25 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
|||
}
|
||||
|
||||
AddSliderMutation.mutate(formData);
|
||||
|
||||
resetField("Title");
|
||||
resetField("Image");
|
||||
resetField("Url");
|
||||
resetField("Description");
|
||||
}
|
||||
|
||||
const resetFormAdd = () => {
|
||||
formAdd.reset({
|
||||
titleSlider: "",
|
||||
uploadImg: null,
|
||||
urlSlider: "",
|
||||
description: "",
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<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="flex flex-row justify-between w-full ">
|
||||
<div className="flex flex-row items-center justify-between w-full ">
|
||||
{/* 1 */}
|
||||
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
|
||||
لیست اسلایدرها
|
||||
|
|
@ -329,7 +349,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
|||
<p className="text-[#464646] text-base font-bold">
|
||||
افزودن اسلایدر
|
||||
</p>
|
||||
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||
<AlertDialogCancel className="h-auto p-0 border-0" onClick={() => { resetFormAdd(); }}>
|
||||
<IoMdClose />
|
||||
</AlertDialogCancel>
|
||||
</AlertDialogTitle>
|
||||
|
|
@ -465,7 +485,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
|||
>
|
||||
افزودن
|
||||
</Button>
|
||||
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
|
||||
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl" onClick={() => { resetFormAdd(); }}>
|
||||
بستن
|
||||
</AlertDialogCancel>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -49,8 +49,6 @@ export default function ComplainsDetails({
|
|||
const router = useRouter();
|
||||
let data;
|
||||
|
||||
|
||||
|
||||
const getComplaintMutation = useMutation({
|
||||
mutationKey: ["Complaint", id],
|
||||
mutationFn: getComplaint,
|
||||
|
|
@ -63,7 +61,7 @@ export default function ComplainsDetails({
|
|||
});
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const storedData = localStorage.getItem("CompliantData");
|
||||
const data = JSON.parse(storedData as string);
|
||||
|
|
@ -175,7 +173,7 @@ export default function ComplainsDetails({
|
|||
|
||||
const checkKey2 = (item: any) => {
|
||||
const dcKey = Decrypt(item.cipherKeyInspector, selectedFile);
|
||||
|
||||
|
||||
if (dcKey != false && dcKey != null) {
|
||||
if (check) {
|
||||
// localStorage.setItem("privateKey", dcKey);
|
||||
|
|
@ -196,8 +194,8 @@ export default function ComplainsDetails({
|
|||
}
|
||||
};
|
||||
|
||||
data = getComplaintMutation?.data;
|
||||
|
||||
data = getComplaintMutation?.data;
|
||||
|
||||
return (
|
||||
<>
|
||||
<AlertDialog open={open} onOpenChange={setOpen}>
|
||||
|
|
@ -272,7 +270,7 @@ export default function ComplainsDetails({
|
|||
|
||||
<div className="flex items-start w-full gap-2 mt-2 max-lg:flex-col">
|
||||
{/* 1 */}
|
||||
<div className="flex flex-col w-full lg:w-1/3 gap-3 lg:sticky top-28 lg:h-[78vh]">
|
||||
<div className="flex flex-col w-full lg:w-1/3 gap-3 lg:sticky top-28 lg:h-[80vh]">
|
||||
<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">
|
||||
انجام عملیات
|
||||
|
|
@ -408,76 +406,83 @@ export default function ComplainsDetails({
|
|||
</>
|
||||
)}
|
||||
</div>
|
||||
<div className="bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col ">
|
||||
<p className="text-[#464646] text-base font-bold">روند شکایت</p>
|
||||
<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
|
||||
scrollbar-thin scrollbar-thumb-rounded-md scrollbar-thumb-gray-500 scrollbar-track-gray-100"
|
||||
>
|
||||
{data.contents?.map((item: any) => {
|
||||
return (
|
||||
<div
|
||||
key={item.id}
|
||||
className="p-4 bg-white rounded-lg shadow-md "
|
||||
>
|
||||
<div className="flex items-center gap-4 ">
|
||||
<p className="">
|
||||
<Badge>
|
||||
{item.sender == 0 ? "شهروند" : "بازرس"}
|
||||
</Badge>
|
||||
</p>
|
||||
<p className="">
|
||||
تاریخ :
|
||||
<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 h-full ">
|
||||
<p className="text-[#464646] text-base font-bold">
|
||||
روند شکایت
|
||||
</p>
|
||||
<div
|
||||
className="flex flex-col mt-4 gap-y-4 overflow-auto
|
||||
scrollbar-thin scrollbar-thumb-gray-500 scrollbar-track-gray-100 "
|
||||
>
|
||||
{data.contents?.map((item: any) => {
|
||||
return (
|
||||
<div
|
||||
key={item.id}
|
||||
className="p-4 bg-white rounded-lg shadow-md "
|
||||
>
|
||||
<div className="flex items-center gap-4 ">
|
||||
<p className="">
|
||||
<Badge>
|
||||
{item.sender == 0 ? "شهروند" : "بازرس"}
|
||||
</Badge>
|
||||
</p>
|
||||
<p className="">
|
||||
تاریخ :
|
||||
<span className="text-[#7C838A]">
|
||||
{convertDate(item.dateTime)}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div className=" text-[#464646] mt-2">
|
||||
<span className="text-[#7C838A]">
|
||||
{convertDate(item.dateTime)}
|
||||
{item.text ? item.text : "-"}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div className=" text-[#464646] mt-2">
|
||||
<span className="text-[#7C838A]">
|
||||
{item.text ? item.text : "-"}
|
||||
</span>
|
||||
</div>
|
||||
{item.media.length !== 0 && (
|
||||
<Separator className="mt-2 mb-1 " />
|
||||
)}
|
||||
<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 "
|
||||
</div>
|
||||
{item.media.length !== 0 && (
|
||||
<Separator className="mt-2 mb-1 " />
|
||||
)}
|
||||
<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"
|
||||
>
|
||||
<File className="w-6 h-6 " />
|
||||
<p className=" max-w-[5rem] truncate">
|
||||
{item.title}
|
||||
</p>
|
||||
</a>
|
||||
<ArrowDownToLine
|
||||
className="cursor-pointer "
|
||||
onClick={() =>
|
||||
downloadFile(
|
||||
item.data,
|
||||
item.title,
|
||||
item.mimeType
|
||||
)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<a
|
||||
onClick={() =>
|
||||
openFileInNewTab(
|
||||
item.data,
|
||||
item.mimeType
|
||||
)
|
||||
}
|
||||
className="flex items-center gap-2 truncate cursor-pointer "
|
||||
>
|
||||
<File className="w-6 h-6 " />
|
||||
<p className=" max-w-[5rem] truncate">
|
||||
{item.title}
|
||||
</p>
|
||||
</a>
|
||||
<ArrowDownToLine
|
||||
className="cursor-pointer "
|
||||
onClick={() =>
|
||||
downloadFile(
|
||||
item.data,
|
||||
item.title,
|
||||
item.mimeType
|
||||
)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue