Compare commits
3 Commits
90d7a8377b
...
19f1031c37
| Author | SHA1 | Date |
|---|---|---|
|
|
19f1031c37 | |
|
|
cbc3aae112 | |
|
|
105fea9232 |
|
|
@ -15,7 +15,7 @@ export default function RootLayout({
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<NavbarPanel />
|
<NavbarPanel />
|
||||||
<div className="mt-10 mx-auto px-2">{children}</div>
|
<div className="px-2 mx-auto mt-10">{children}</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import Provider from "../utils/Provider";
|
||||||
import { Toaster as SonnerToaster } from "@/components/ui/sonner";
|
import { Toaster as SonnerToaster } from "@/components/ui/sonner";
|
||||||
const inter = Inter({ subsets: ["latin"] });
|
const inter = Inter({ subsets: ["latin"] });
|
||||||
import { Suspense } from "react";
|
import { Suspense } from "react";
|
||||||
|
import ProgressBarProviders from "@/components/PrograssBar";
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: "عیون",
|
title: "عیون",
|
||||||
|
|
@ -24,7 +25,7 @@ export default function RootLayout({
|
||||||
<body className="font-[yekan] bg-white">
|
<body className="font-[yekan] bg-white">
|
||||||
<Provider>
|
<Provider>
|
||||||
{/* <Suspense fallback={<Loading />}>{children}</Suspense> */}
|
{/* <Suspense fallback={<Loading />}>{children}</Suspense> */}
|
||||||
{children}
|
<ProgressBarProviders>{children}</ProgressBarProviders>
|
||||||
<Toaster />
|
<Toaster />
|
||||||
<SonnerToaster />
|
<SonnerToaster />
|
||||||
</Provider>
|
</Provider>
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ export default function AdminCategories() {
|
||||||
queryKey: ["CategoriesList"],
|
queryKey: ["CategoriesList"],
|
||||||
queryFn: () => GetAllCategories(),
|
queryFn: () => GetAllCategories(),
|
||||||
// refetchOnWindowFocus: false,
|
// refetchOnWindowFocus: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
const handleClickEdit = (id: string, title: string, description: string) => {
|
const handleClickEdit = (id: string, title: string, description: string) => {
|
||||||
|
|
@ -149,14 +149,9 @@ export default function AdminCategories() {
|
||||||
className: "!bg-green-500 !text-white",
|
className: "!bg-green-500 !text-white",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (err: any | string) => {
|
||||||
console.log(error);
|
toast(<>{err.response.data.detail}</>, {
|
||||||
console.log(error?.message);
|
className: "!bg-red-500 !text-white",
|
||||||
|
|
||||||
setOpenEdit(false);
|
|
||||||
|
|
||||||
toast(error?.message, {
|
|
||||||
className: "!bg-red-500 !text-black",
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -174,12 +169,9 @@ export default function AdminCategories() {
|
||||||
className: "!bg-green-500 !text-white",
|
className: "!bg-green-500 !text-white",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (err: any | string) => {
|
||||||
console.log(error);
|
toast(<>{err.response.data.detail}</>, {
|
||||||
console.log(error?.message);
|
className: "!bg-red-500 !text-white",
|
||||||
|
|
||||||
toast(error?.message, {
|
|
||||||
className: "!bg-red-500 !text-black",
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -200,14 +192,9 @@ export default function AdminCategories() {
|
||||||
className: "!bg-green-500 !text-white",
|
className: "!bg-green-500 !text-white",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (err: any | string) => {
|
||||||
console.log(error);
|
toast(<>{err.response.data.detail}</>, {
|
||||||
console.log(error?.message);
|
className: "!bg-red-500 !text-white",
|
||||||
|
|
||||||
setOpenAdd(false);
|
|
||||||
|
|
||||||
toast(error?.message, {
|
|
||||||
className: "!bg-red-500 !text-black",
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -219,20 +206,20 @@ export default function AdminCategories() {
|
||||||
title: data.titleCat,
|
title: data.titleCat,
|
||||||
description: data.description,
|
description: data.description,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function onSubmitAdd(data: AddCatFormValues) {
|
function onSubmitAdd(data: AddCatFormValues) {
|
||||||
AddCatMutation.mutate({
|
AddCatMutation.mutate({
|
||||||
title: data.titleCategory,
|
title: data.titleCategory,
|
||||||
description: data.description,
|
description: data.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 w-full justify-between flex-row ">
|
<div className="flex flex-row justify-between w-full ">
|
||||||
{/* 1 */}
|
{/* 1 */}
|
||||||
<div className="w-full text-right text-neutral-600 text-lg font-bold my-4">
|
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
|
||||||
لیست دسته بندی ها
|
لیست دسته بندی ها
|
||||||
</div>
|
</div>
|
||||||
{/* 2 */}
|
{/* 2 */}
|
||||||
|
|
@ -243,7 +230,7 @@ export default function AdminCategories() {
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
// onClick={handleClickAddCat}
|
// onClick={handleClickAddCat}
|
||||||
className="bg-orange-500 text-white"
|
className="text-white bg-orange-500"
|
||||||
// disabled={isNewKeyLoading}
|
// disabled={isNewKeyLoading}
|
||||||
>
|
>
|
||||||
افزودن دسته بندی
|
افزودن دسته بندی
|
||||||
|
|
@ -255,28 +242,28 @@ export default function AdminCategories() {
|
||||||
<p className="text-[#464646] text-base font-bold">
|
<p className="text-[#464646] text-base font-bold">
|
||||||
افزودن دسته بندی
|
افزودن دسته بندی
|
||||||
</p>
|
</p>
|
||||||
<AlertDialogCancel className="p-0 border-0 h-auto">
|
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||||
<IoMdClose />
|
<IoMdClose />
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</AlertDialogTitle>
|
</AlertDialogTitle>
|
||||||
|
|
||||||
<AlertDialogDescription>
|
<AlertDialogDescription>
|
||||||
<div className="w-full ">
|
<div className="w-full ">
|
||||||
<div className="w-full text-right text-neutral-600 text-lg font-bold mb-2">
|
<div className="w-full mb-2 text-lg font-bold text-right text-neutral-600">
|
||||||
افزودن دسته بندی
|
افزودن دسته بندی
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Form {...formAdd}>
|
<Form {...formAdd}>
|
||||||
<form
|
<form
|
||||||
onSubmit={formAdd.handleSubmit(onSubmitAdd)}
|
onSubmit={formAdd.handleSubmit(onSubmitAdd)}
|
||||||
className="w-full flex flex-col mt-6 "
|
className="flex flex-col w-full mt-6 "
|
||||||
>
|
>
|
||||||
<div className="flex flex-col flex-wrap justify-between">
|
<div className="flex flex-col flex-wrap justify-between">
|
||||||
<FormField
|
<FormField
|
||||||
control={formAdd.control}
|
control={formAdd.control}
|
||||||
name="titleCategory"
|
name="titleCategory"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className=" w-full ">
|
<FormItem className="w-full ">
|
||||||
<FormLabel className="text-[#7C838A] text-sm font-medium">
|
<FormLabel className="text-[#7C838A] text-sm font-medium">
|
||||||
عنوان دسته بندی
|
عنوان دسته بندی
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
|
|
@ -296,7 +283,7 @@ export default function AdminCategories() {
|
||||||
control={formAdd.control}
|
control={formAdd.control}
|
||||||
name="description"
|
name="description"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className=" w-full ">
|
<FormItem className="w-full ">
|
||||||
<FormLabel className="text-[#7C838A] text-sm font-medium ">
|
<FormLabel className="text-[#7C838A] text-sm font-medium ">
|
||||||
توضیحات
|
توضیحات
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
|
|
@ -313,14 +300,14 @@ export default function AdminCategories() {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
|
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="bg-blue text-white min-w-max rounded-xl text-center hover:bg-white hover:text-slate-800"
|
className="text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
|
||||||
>
|
>
|
||||||
افزودن
|
افزودن
|
||||||
</Button>
|
</Button>
|
||||||
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
|
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
|
||||||
بستن
|
بستن
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -335,7 +322,7 @@ export default function AdminCategories() {
|
||||||
</AlertDialogContent>
|
</AlertDialogContent>
|
||||||
</AlertDialog>
|
</AlertDialog>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full flex flex-row flex-wrap justify-between gap-8 md:gap-4 ">
|
<div className="flex flex-row flex-wrap justify-between w-full gap-8 md:gap-4 ">
|
||||||
<AlertDialog open={openEdit} onOpenChange={setOpenEdit}>
|
<AlertDialog open={openEdit} onOpenChange={setOpenEdit}>
|
||||||
<AlertDialogContent className=" w-full max-w-3xl h-full lg:max-h-[25em] max-h-[23em]">
|
<AlertDialogContent className=" w-full max-w-3xl h-full lg:max-h-[25em] max-h-[23em]">
|
||||||
<AlertDialogHeader>
|
<AlertDialogHeader>
|
||||||
|
|
@ -343,7 +330,7 @@ export default function AdminCategories() {
|
||||||
<p className="text-[#464646] text-base font-bold">
|
<p className="text-[#464646] text-base font-bold">
|
||||||
تغییر دسته بندی
|
تغییر دسته بندی
|
||||||
</p>
|
</p>
|
||||||
<AlertDialogCancel className="p-0 border-0 h-auto">
|
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||||
<IoMdClose />
|
<IoMdClose />
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</AlertDialogTitle>
|
</AlertDialogTitle>
|
||||||
|
|
@ -352,20 +339,20 @@ export default function AdminCategories() {
|
||||||
<Form {...formEdit}>
|
<Form {...formEdit}>
|
||||||
<form
|
<form
|
||||||
onSubmit={formEdit.handleSubmit(onSubmitEdit)}
|
onSubmit={formEdit.handleSubmit(onSubmitEdit)}
|
||||||
className="w-full flex flex-col"
|
className="flex flex-col w-full"
|
||||||
>
|
>
|
||||||
<div className="flex flex-col flex-wrap justify-between">
|
<div className="flex flex-col flex-wrap justify-between">
|
||||||
<FormField
|
<FormField
|
||||||
control={formEdit.control}
|
control={formEdit.control}
|
||||||
name="titleCat"
|
name="titleCat"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className=" w-full ">
|
<FormItem className="w-full ">
|
||||||
<FormLabel>عنوان</FormLabel>
|
<FormLabel>عنوان</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
placeholder="عنوان"
|
placeholder="عنوان"
|
||||||
{...field}
|
{...field}
|
||||||
className=" bg-white"
|
className="bg-white "
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|
@ -377,12 +364,12 @@ export default function AdminCategories() {
|
||||||
control={formEdit.control}
|
control={formEdit.control}
|
||||||
name="description"
|
name="description"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className=" w-full ">
|
<FormItem className="w-full ">
|
||||||
<FormLabel>توضیحات</FormLabel>
|
<FormLabel>توضیحات</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Textarea
|
<Textarea
|
||||||
placeholder="توضیحات"
|
placeholder="توضیحات"
|
||||||
className="resize-none bg-white"
|
className="bg-white resize-none"
|
||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
@ -392,15 +379,15 @@ export default function AdminCategories() {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
|
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="bg-blue text-white min-w-max p-2 rounded-xl text-center hover:bg-white hover:text-slate-800"
|
className="p-2 text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
|
||||||
>
|
>
|
||||||
تغییر دسته بندی
|
تغییر دسته بندی
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
|
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
|
||||||
بستن
|
بستن
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -417,18 +404,17 @@ export default function AdminCategories() {
|
||||||
className={`flex flex-col justify-center gap-2 w-full lg:w-[49%] h-28 px-5 rounded-md shadow-md items-start bg-[#F5F5F5]
|
className={`flex flex-col justify-center gap-2 w-full lg:w-[49%] h-28 px-5 rounded-md shadow-md items-start bg-[#F5F5F5]
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
<p className=" text-slate-500 text-sm font-normal leading-normal">
|
<p className="text-sm font-normal leading-normal text-slate-500">
|
||||||
عنوان :
|
عنوان :<span className=" text-slate-800">{item.title}</span>
|
||||||
<span className=" text-slate-800">{item.title}</span>
|
|
||||||
</p>
|
</p>
|
||||||
<p className=" text-slate-500 text-sm font-normal leading-normal">
|
<p className="text-sm font-normal leading-normal text-slate-500">
|
||||||
توضیحات:
|
توضیحات:
|
||||||
<span className=" text-slate-800 self-end">
|
<span className="self-end text-slate-800">
|
||||||
{item.description}
|
{item.description}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div className="w-full flex justify-end items-end gap-2">
|
<div className="flex items-end justify-end w-full gap-2">
|
||||||
<Switch
|
<Switch
|
||||||
dir="ltr"
|
dir="ltr"
|
||||||
checked={!item.isDeleted}
|
checked={!item.isDeleted}
|
||||||
|
|
@ -447,7 +433,7 @@ export default function AdminCategories() {
|
||||||
{/* <Button variant="outline">Show Dialog</Button> */}
|
{/* <Button variant="outline">Show Dialog</Button> */}
|
||||||
<FaRegEdit
|
<FaRegEdit
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
className="w-6 h-6 text-slate-600 hover:cursor-pointer self-end"
|
className="self-end w-6 h-6 text-slate-600 hover:cursor-pointer"
|
||||||
// onClick={() => setKeyId(item?.id)}
|
// onClick={() => setKeyId(item?.id)}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
handleClickEdit(
|
handleClickEdit(
|
||||||
|
|
|
||||||
|
|
@ -118,14 +118,9 @@ export default function AdminKeysManagement() {
|
||||||
|
|
||||||
// router.refresh()
|
// router.refresh()
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (err: any | string) => {
|
||||||
console.log(error);
|
toast(<>{err.response.data.detail}</>, {
|
||||||
console.log(error?.message);
|
className: "!bg-red-500 !text-white",
|
||||||
|
|
||||||
setOpenEdit(false);
|
|
||||||
|
|
||||||
toast(error?.message, {
|
|
||||||
className: "!bg-red-500 !text-black",
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -171,13 +166,9 @@ export default function AdminKeysManagement() {
|
||||||
// inputPubRef.current.clear();
|
// inputPubRef.current.clear();
|
||||||
// router.refresh()
|
// router.refresh()
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (err: any | string) => {
|
||||||
console.log(error);
|
toast(<>{err.response.data.detail}</>, {
|
||||||
console.log(error?.message);
|
className: "!bg-red-500 !text-white",
|
||||||
setOpenAdd(false);
|
|
||||||
|
|
||||||
toast(error?.message, {
|
|
||||||
className: "!bg-red-500 !text-black",
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -267,20 +258,20 @@ export default function AdminKeysManagement() {
|
||||||
<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 ">
|
||||||
{/* 1 */}
|
{/* 1 */}
|
||||||
<AlertDialog open={openAdd} onOpenChange={setOpenAdd}>
|
<AlertDialog open={openAdd} onOpenChange={setOpenAdd}>
|
||||||
<AlertDialogContent className=" ">
|
<AlertDialogContent className="">
|
||||||
<AlertDialogHeader>
|
<AlertDialogHeader>
|
||||||
<AlertDialogTitle>
|
<AlertDialogTitle>
|
||||||
<p className="text-[#464646] text-base font-bold">
|
<p className="text-[#464646] text-base font-bold">
|
||||||
افزودن کلید جدید
|
افزودن کلید جدید
|
||||||
</p>
|
</p>
|
||||||
<AlertDialogCancel className="p-0 border-0 h-auto">
|
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||||
<IoMdClose />
|
<IoMdClose />
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</AlertDialogTitle>
|
</AlertDialogTitle>
|
||||||
|
|
||||||
<AlertDialogDescription>
|
<AlertDialogDescription>
|
||||||
<div className=" w-full flex justify-between">
|
<div className="flex justify-between w-full ">
|
||||||
<div className="w-full text-right text-neutral-600 text-lg font-bold mt-4 mb-2">
|
<div className="w-full mt-4 mb-2 text-lg font-bold text-right text-neutral-600">
|
||||||
افزودن کلید جدید
|
افزودن کلید جدید
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -297,14 +288,14 @@ export default function AdminKeysManagement() {
|
||||||
<Form {...formAdd}>
|
<Form {...formAdd}>
|
||||||
<form
|
<form
|
||||||
onSubmit={formAdd.handleSubmit(onSubmitAdd)}
|
onSubmit={formAdd.handleSubmit(onSubmitAdd)}
|
||||||
className="w-full flex flex-col mt-6 "
|
className="flex flex-col w-full mt-6 "
|
||||||
>
|
>
|
||||||
<div className="flex flex-col flex-wrap justify-between">
|
<div className="flex flex-col flex-wrap justify-between">
|
||||||
<FormField
|
<FormField
|
||||||
control={formAdd.control}
|
control={formAdd.control}
|
||||||
name="title"
|
name="title"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className=" w-full ">
|
<FormItem className="w-full ">
|
||||||
<FormLabel className="text-[#7C838A] text-sm font-medium">
|
<FormLabel className="text-[#7C838A] text-sm font-medium">
|
||||||
عنوان کلید
|
عنوان کلید
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
|
|
@ -324,7 +315,7 @@ export default function AdminKeysManagement() {
|
||||||
control={formAdd.control}
|
control={formAdd.control}
|
||||||
name="publicKey"
|
name="publicKey"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className=" w-full">
|
<FormItem className="w-full ">
|
||||||
<FormLabel className="text-[#7C838A] text-sm font-medium ">
|
<FormLabel className="text-[#7C838A] text-sm font-medium ">
|
||||||
کلید عمومی
|
کلید عمومی
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
|
|
@ -342,10 +333,10 @@ export default function AdminKeysManagement() {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
|
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="bg-blue text-white min-w-max w-1/2 sm:w-1/3 lg:w-1/4 p-2 rounded-xl text-center"
|
className="w-1/2 p-2 text-center text-white bg-blue min-w-max sm:w-1/3 lg:w-1/4 rounded-xl"
|
||||||
>
|
>
|
||||||
افزودن کلید
|
افزودن کلید
|
||||||
</Button>
|
</Button>
|
||||||
|
|
@ -361,21 +352,21 @@ export default function AdminKeysManagement() {
|
||||||
</AlertDialogContent>
|
</AlertDialogContent>
|
||||||
|
|
||||||
{/* 2 */}
|
{/* 2 */}
|
||||||
<div className=" w-full flex justify-between items-center mt-1">
|
<div className="flex items-center justify-between w-full mt-1 ">
|
||||||
<div className="w-full text-right text-neutral-600 text-lg font-bold my-4">
|
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
|
||||||
لیست کلیدها
|
لیست کلیدها
|
||||||
</div>
|
</div>
|
||||||
<AlertDialogTrigger asChild>
|
<AlertDialogTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
className="bg-orange-500 hover:bg-orange-500/80 text-white hover:text-white"
|
className="text-white bg-orange-500 hover:bg-orange-500/80 hover:text-white"
|
||||||
// disabled={isNewKeyLoading}
|
// disabled={isNewKeyLoading}
|
||||||
>
|
>
|
||||||
افزودن کلید جدید
|
افزودن کلید جدید
|
||||||
</Button>
|
</Button>
|
||||||
</AlertDialogTrigger>
|
</AlertDialogTrigger>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full flex flex-row flex-wrap justify-between gap-8 md:gap-4 ">
|
<div className="flex flex-row flex-wrap justify-between w-full gap-8 md:gap-4 ">
|
||||||
{data1?.map((item: any) => {
|
{data1?.map((item: any) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|
@ -383,13 +374,13 @@ export default function AdminKeysManagement() {
|
||||||
className={`flex flex-col justify-center gap-2 w-full lg:w-[49%] h-28 px-5 rounded-md shadow-md items-start bg-[#F5F5F5]
|
className={`flex flex-col justify-center gap-2 w-full lg:w-[49%] h-28 px-5 rounded-md shadow-md items-start bg-[#F5F5F5]
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
<p className=" text-slate-500 text-sm font-normal leading-normal">
|
<p className="text-sm font-normal leading-normal text-slate-500">
|
||||||
عنوان کلید:{" "}
|
عنوان کلید:{" "}
|
||||||
<span className=" text-slate-800">{item.title}</span>
|
<span className=" text-slate-800">{item.title}</span>
|
||||||
</p>
|
</p>
|
||||||
<p className=" text-slate-500 text-sm font-normal leading-normal">
|
<p className="text-sm font-normal leading-normal text-slate-500">
|
||||||
آیدی بازرس:{" "}
|
آیدی بازرس:{" "}
|
||||||
<span className=" text-slate-800 self-end">
|
<span className="self-end text-slate-800">
|
||||||
{item.inspectorId}
|
{item.inspectorId}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -399,7 +390,7 @@ export default function AdminKeysManagement() {
|
||||||
{/* <Button variant="outline">Show Dialog</Button> */}
|
{/* <Button variant="outline">Show Dialog</Button> */}
|
||||||
<FaRegEdit
|
<FaRegEdit
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
className="w-6 h-6 text-slate-600 hover:cursor-pointer self-end"
|
className="self-end w-6 h-6 text-slate-600 hover:cursor-pointer"
|
||||||
onClick={() => setKeyId(item?.id)}
|
onClick={() => setKeyId(item?.id)}
|
||||||
/>
|
/>
|
||||||
</AlertDialogTrigger>
|
</AlertDialogTrigger>
|
||||||
|
|
@ -410,14 +401,14 @@ export default function AdminKeysManagement() {
|
||||||
<Form {...formEdit}>
|
<Form {...formEdit}>
|
||||||
<form
|
<form
|
||||||
onSubmit={formEdit.handleSubmit(onSubmitEdit)}
|
onSubmit={formEdit.handleSubmit(onSubmitEdit)}
|
||||||
className="w-full flex flex-col mt-6 "
|
className="flex flex-col w-full mt-6 "
|
||||||
>
|
>
|
||||||
<div className="flex flex-row flex-wrap justify-between">
|
<div className="flex flex-row flex-wrap justify-between">
|
||||||
<FormField
|
<FormField
|
||||||
control={formEdit.control}
|
control={formEdit.control}
|
||||||
name="uploadPrivateKey"
|
name="uploadPrivateKey"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className=" w-full">
|
<FormItem className="w-full ">
|
||||||
<FormLabel className="text-[#7C838A] text-sm font-medium mb-2">
|
<FormLabel className="text-[#7C838A] text-sm font-medium mb-2">
|
||||||
پیوست (کلید خصوصی)
|
پیوست (کلید خصوصی)
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
|
|
@ -426,7 +417,7 @@ export default function AdminKeysManagement() {
|
||||||
required={true}
|
required={true}
|
||||||
type="file"
|
type="file"
|
||||||
accept=".txt"
|
accept=".txt"
|
||||||
className="bg-slate-300 mt-2"
|
className="mt-2 bg-slate-300"
|
||||||
// {...field}
|
// {...field}
|
||||||
onChange={handleFileChange}
|
onChange={handleFileChange}
|
||||||
/>
|
/>
|
||||||
|
|
@ -446,7 +437,7 @@ export default function AdminKeysManagement() {
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
className="bg-slate-300 mt-2"
|
className="mt-2 bg-slate-300"
|
||||||
value={item?.id}
|
value={item?.id}
|
||||||
readOnly={true}
|
readOnly={true}
|
||||||
// {...field}
|
// {...field}
|
||||||
|
|
@ -458,23 +449,23 @@ export default function AdminKeysManagement() {
|
||||||
/> */}
|
/> */}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
|
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
|
||||||
<Button
|
<Button
|
||||||
// href="/FollowResult"
|
// href="/FollowResult"
|
||||||
type="submit"
|
type="submit"
|
||||||
className="bg-blue text-white min-w-max p-2 rounded-xl text-center hover:bg-white hover:text-slate-800"
|
className="p-2 text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
|
||||||
>
|
>
|
||||||
تغییر کلید
|
تغییر کلید
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{/* <AlertDialogAction
|
{/* <AlertDialogAction
|
||||||
type="submit"
|
type="submit"
|
||||||
className="bg-blue text-white min-w-max p-2 rounded-xl text-center hover:bg-white hover:text-slate-800"
|
className="p-2 text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
|
||||||
>
|
>
|
||||||
تغییر کلید
|
تغییر کلید
|
||||||
</AlertDialogAction> */}
|
</AlertDialogAction> */}
|
||||||
|
|
||||||
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
|
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
|
||||||
بستن
|
بستن
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -220,14 +220,9 @@ export default function AdminNews() {
|
||||||
className: "!bg-green-500 !text-white",
|
className: "!bg-green-500 !text-white",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (err: any | string) => {
|
||||||
console.log(error);
|
toast(<>{err.response.data.detail}</>, {
|
||||||
console.log(error?.message);
|
className: "!bg-red-500 !text-white",
|
||||||
|
|
||||||
setOpenEdit(false);
|
|
||||||
|
|
||||||
toast(error?.message, {
|
|
||||||
className: "!bg-red-500 !text-black",
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -245,12 +240,9 @@ export default function AdminNews() {
|
||||||
className: "!bg-green-500 !text-white",
|
className: "!bg-green-500 !text-white",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (err: any | string) => {
|
||||||
console.log(error);
|
toast(<>{err.response.data.detail}</>, {
|
||||||
console.log(error?.message);
|
className: "!bg-red-500 !text-white",
|
||||||
|
|
||||||
toast(error?.message, {
|
|
||||||
className: "!bg-red-500 !text-black",
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -271,14 +263,9 @@ export default function AdminNews() {
|
||||||
className: "!bg-green-500 !text-white",
|
className: "!bg-green-500 !text-white",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (err: any | string) => {
|
||||||
console.log(error);
|
toast(<>{err.response.data.detail}</>, {
|
||||||
console.log(error?.message);
|
className: "!bg-red-500 !text-white",
|
||||||
|
|
||||||
setOpenAdd(false);
|
|
||||||
|
|
||||||
toast(error?.message, {
|
|
||||||
className: "!bg-red-500 !text-black",
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -330,9 +317,9 @@ export default function AdminNews() {
|
||||||
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 w-full justify-between flex-row ">
|
<div className="flex flex-row justify-between w-full ">
|
||||||
{/* 1 */}
|
{/* 1 */}
|
||||||
<div className="w-full text-right text-neutral-600 text-lg font-bold my-4">
|
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
|
||||||
لیست خبر ها
|
لیست خبر ها
|
||||||
</div>
|
</div>
|
||||||
{/* 2 */}
|
{/* 2 */}
|
||||||
|
|
@ -343,7 +330,7 @@ export default function AdminNews() {
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
// onClick={handleClickAddCat}
|
// onClick={handleClickAddCat}
|
||||||
className="bg-orange-500 text-white"
|
className="text-white bg-orange-500"
|
||||||
// disabled={isNewKeyLoading}
|
// disabled={isNewKeyLoading}
|
||||||
>
|
>
|
||||||
افزودن خبر
|
افزودن خبر
|
||||||
|
|
@ -355,7 +342,7 @@ export default function AdminNews() {
|
||||||
<p className="text-[#464646] text-base font-bold">
|
<p className="text-[#464646] text-base font-bold">
|
||||||
افزودن خبر
|
افزودن خبر
|
||||||
</p>
|
</p>
|
||||||
<AlertDialogCancel className="p-0 border-0 h-auto">
|
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||||
<IoMdClose />
|
<IoMdClose />
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</AlertDialogTitle>
|
</AlertDialogTitle>
|
||||||
|
|
@ -365,20 +352,20 @@ export default function AdminNews() {
|
||||||
<Form {...formAdd}>
|
<Form {...formAdd}>
|
||||||
<form
|
<form
|
||||||
onSubmit={formAdd.handleSubmit(onSubmitAdd)}
|
onSubmit={formAdd.handleSubmit(onSubmitAdd)}
|
||||||
className="w-full flex flex-col "
|
className="flex flex-col w-full "
|
||||||
>
|
>
|
||||||
<div className="flex flex-row flex-wrap justify-between">
|
<div className="flex flex-row flex-wrap justify-between">
|
||||||
<FormField
|
<FormField
|
||||||
control={formAdd.control}
|
control={formAdd.control}
|
||||||
name="titleNews"
|
name="titleNews"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className=" w-full ">
|
<FormItem className="w-full ">
|
||||||
<FormLabel> عنوان خبر</FormLabel>
|
<FormLabel> عنوان خبر</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
placeholder="عنوان خبر را وارد نمایید"
|
placeholder="عنوان خبر را وارد نمایید"
|
||||||
{...field}
|
{...field}
|
||||||
className=" bg-white"
|
className="bg-white "
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|
@ -428,7 +415,7 @@ export default function AdminNews() {
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
type="file"
|
type="file"
|
||||||
className="mb-3 bg-white"
|
className="mb-3 bg-white"
|
||||||
accept="image/*"
|
accept="image/*"
|
||||||
multiple={false} // Allow only one file
|
multiple={false} // Allow only one file
|
||||||
disabled={formAdd.formState.isSubmitting}
|
disabled={formAdd.formState.isSubmitting}
|
||||||
|
|
@ -457,7 +444,7 @@ export default function AdminNews() {
|
||||||
<Input
|
<Input
|
||||||
placeholder="لینک"
|
placeholder="لینک"
|
||||||
{...field}
|
{...field}
|
||||||
className=" bg-white"
|
className="bg-white "
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|
@ -501,14 +488,14 @@ export default function AdminNews() {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
|
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="bg-blue text-white min-w-max rounded-xl text-center hover:bg-white hover:text-slate-800"
|
className="text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
|
||||||
>
|
>
|
||||||
افزودن
|
افزودن
|
||||||
</Button>
|
</Button>
|
||||||
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
|
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
|
||||||
بستن
|
بستن
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -523,7 +510,7 @@ export default function AdminNews() {
|
||||||
</AlertDialogContent>
|
</AlertDialogContent>
|
||||||
</AlertDialog>
|
</AlertDialog>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full flex flex-row flex-wrap justify-between gap-8 md:gap-4 ">
|
<div className="flex flex-row flex-wrap justify-between w-full gap-8 md:gap-4 ">
|
||||||
<AlertDialog open={openEdit} onOpenChange={setOpenEdit}>
|
<AlertDialog open={openEdit} onOpenChange={setOpenEdit}>
|
||||||
<AlertDialogContent className=" w-full max-w-3xl h-full lg:max-h-[28em] max-h-screen sm:max-h-[27em]">
|
<AlertDialogContent className=" w-full max-w-3xl h-full lg:max-h-[28em] max-h-screen sm:max-h-[27em]">
|
||||||
<AlertDialogHeader>
|
<AlertDialogHeader>
|
||||||
|
|
@ -531,7 +518,7 @@ export default function AdminNews() {
|
||||||
<p className="text-[#464646] text-base font-bold">
|
<p className="text-[#464646] text-base font-bold">
|
||||||
تغییر خبر
|
تغییر خبر
|
||||||
</p>
|
</p>
|
||||||
<AlertDialogCancel className="p-0 border-0 h-auto">
|
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||||
<IoMdClose />
|
<IoMdClose />
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</AlertDialogTitle>
|
</AlertDialogTitle>
|
||||||
|
|
@ -539,20 +526,20 @@ export default function AdminNews() {
|
||||||
<Form {...formEdit}>
|
<Form {...formEdit}>
|
||||||
<form
|
<form
|
||||||
onSubmit={formEdit.handleSubmit(onSubmitEdit)}
|
onSubmit={formEdit.handleSubmit(onSubmitEdit)}
|
||||||
className="w-full flex flex-col"
|
className="flex flex-col w-full"
|
||||||
>
|
>
|
||||||
<div className="flex flex-row flex-wrap justify-between">
|
<div className="flex flex-row flex-wrap justify-between">
|
||||||
<FormField
|
<FormField
|
||||||
control={formEdit.control}
|
control={formEdit.control}
|
||||||
name="titleNews"
|
name="titleNews"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className=" w-full ">
|
<FormItem className="w-full ">
|
||||||
<FormLabel>عنوان</FormLabel>
|
<FormLabel>عنوان</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
placeholder="عنوان"
|
placeholder="عنوان"
|
||||||
{...field}
|
{...field}
|
||||||
className=" bg-white"
|
className="bg-white "
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|
@ -602,7 +589,7 @@ export default function AdminNews() {
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
type="file"
|
type="file"
|
||||||
className="mb-3 bg-white"
|
className="mb-3 bg-white"
|
||||||
accept="image/*"
|
accept="image/*"
|
||||||
multiple={false} // Allow only one file
|
multiple={false} // Allow only one file
|
||||||
disabled={formEdit.formState.isSubmitting}
|
disabled={formEdit.formState.isSubmitting}
|
||||||
|
|
@ -631,7 +618,7 @@ export default function AdminNews() {
|
||||||
<Input
|
<Input
|
||||||
placeholder="لینک"
|
placeholder="لینک"
|
||||||
{...field}
|
{...field}
|
||||||
className=" bg-white"
|
className="bg-white "
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|
@ -675,15 +662,15 @@ export default function AdminNews() {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
|
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="bg-blue text-white min-w-max p-2 rounded-xl text-center hover:bg-white hover:text-slate-800"
|
className="p-2 text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
|
||||||
>
|
>
|
||||||
تغییر خبر
|
تغییر خبر
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
|
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
|
||||||
بستن
|
بستن
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -701,19 +688,19 @@ export default function AdminNews() {
|
||||||
className={`flex flex-col justify-center gap-2 w-full lg:w-[49%] h-56 px-5 rounded-md shadow-md items-start bg-[#F5F5F5]
|
className={`flex flex-col justify-center gap-2 w-full lg:w-[49%] h-56 px-5 rounded-md shadow-md items-start bg-[#F5F5F5]
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
<p className=" text-slate-500 text-sm font-normal leading-normal">
|
<p className="text-sm font-normal leading-normal text-slate-500">
|
||||||
عنوان :
|
عنوان :
|
||||||
<span className=" text-slate-800">{item.title}</span>
|
<span className=" text-slate-800">{item.title}</span>
|
||||||
</p>
|
</p>
|
||||||
<p className=" text-slate-500 text-sm font-normal leading-normal">
|
<p className="text-sm font-normal leading-normal text-slate-500">
|
||||||
توضیحات:
|
توضیحات:
|
||||||
<span className=" text-slate-800 self-end">
|
<span className="self-end text-slate-800">
|
||||||
{item.description}
|
{item.description}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p className=" text-slate-500 text-sm font-normal leading-normal">
|
<p className="text-sm font-normal leading-normal text-slate-500">
|
||||||
محتوا:
|
محتوا:
|
||||||
<span className=" text-slate-800 self-end">
|
<span className="self-end text-slate-800">
|
||||||
{item.content}
|
{item.content}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -723,10 +710,10 @@ export default function AdminNews() {
|
||||||
width={100}
|
width={100}
|
||||||
height={100}
|
height={100}
|
||||||
quality={100}
|
quality={100}
|
||||||
className=" w-full h-20 object-contain object-right"
|
className="object-contain object-right w-full h-20 "
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="w-full flex justify-end items-end gap-2">
|
<div className="flex items-end justify-end w-full gap-2">
|
||||||
<Switch
|
<Switch
|
||||||
dir="ltr"
|
dir="ltr"
|
||||||
checked={!item.isDeleted}
|
checked={!item.isDeleted}
|
||||||
|
|
@ -740,7 +727,7 @@ export default function AdminNews() {
|
||||||
{/* <Button variant="outline">Show Dialog</Button> */}
|
{/* <Button variant="outline">Show Dialog</Button> */}
|
||||||
<FaRegEdit
|
<FaRegEdit
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
className="w-6 h-6 text-slate-600 hover:cursor-pointer self-end"
|
className="self-end w-6 h-6 text-slate-600 hover:cursor-pointer"
|
||||||
// onClick={() => setKeyId(item?.id)}
|
// onClick={() => setKeyId(item?.id)}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
handleClickEdit(
|
handleClickEdit(
|
||||||
|
|
|
||||||
|
|
@ -152,14 +152,9 @@ export default function AdminOrganizations() {
|
||||||
className: "!bg-green-500 !text-white",
|
className: "!bg-green-500 !text-white",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (err: any | string) => {
|
||||||
console.log(error);
|
toast(<>{err.response.data.detail}</>, {
|
||||||
console.log(error?.message);
|
className: "!bg-red-500 !text-white",
|
||||||
|
|
||||||
setOpenEdit(false);
|
|
||||||
|
|
||||||
toast(error?.message, {
|
|
||||||
className: "!bg-red-500 !text-black",
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -177,12 +172,9 @@ export default function AdminOrganizations() {
|
||||||
className: "!bg-green-500 !text-white",
|
className: "!bg-green-500 !text-white",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (err: any | string) => {
|
||||||
console.log(error);
|
toast(<>{err.response.data.detail}</>, {
|
||||||
console.log(error?.message);
|
className: "!bg-red-500 !text-white",
|
||||||
|
|
||||||
toast(error?.message, {
|
|
||||||
className: "!bg-red-500 !text-black",
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -203,14 +195,9 @@ export default function AdminOrganizations() {
|
||||||
className: "!bg-green-500 !text-white",
|
className: "!bg-green-500 !text-white",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (err: any | string) => {
|
||||||
console.log(error);
|
toast(<>{err.response.data.detail}</>, {
|
||||||
console.log(error?.message);
|
className: "!bg-red-500 !text-white",
|
||||||
|
|
||||||
setOpenAdd(false);
|
|
||||||
|
|
||||||
toast(error?.message, {
|
|
||||||
className: "!bg-red-500 !text-black",
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -233,9 +220,9 @@ export default function AdminOrganizations() {
|
||||||
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 w-full justify-between flex-row ">
|
<div className="flex flex-row justify-between w-full ">
|
||||||
{/* 1 */}
|
{/* 1 */}
|
||||||
<div className="w-full text-right text-neutral-600 text-lg font-bold my-4">
|
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
|
||||||
لیست سازمان ها
|
لیست سازمان ها
|
||||||
</div>
|
</div>
|
||||||
{/* 2 */}
|
{/* 2 */}
|
||||||
|
|
@ -246,7 +233,7 @@ export default function AdminOrganizations() {
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
// onClick={handleClickAddCat}
|
// onClick={handleClickAddCat}
|
||||||
className="bg-orange-500 text-white"
|
className="text-white bg-orange-500"
|
||||||
// disabled={isNewKeyLoading}
|
// disabled={isNewKeyLoading}
|
||||||
>
|
>
|
||||||
افزودن سازمان
|
افزودن سازمان
|
||||||
|
|
@ -258,28 +245,28 @@ export default function AdminOrganizations() {
|
||||||
<p className="text-[#464646] text-base font-bold">
|
<p className="text-[#464646] text-base font-bold">
|
||||||
افزودن سازمان
|
افزودن سازمان
|
||||||
</p>
|
</p>
|
||||||
<AlertDialogCancel className="p-0 border-0 h-auto">
|
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||||
<IoMdClose />
|
<IoMdClose />
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</AlertDialogTitle>
|
</AlertDialogTitle>
|
||||||
|
|
||||||
<AlertDialogDescription>
|
<AlertDialogDescription>
|
||||||
<div className="w-full ">
|
<div className="w-full ">
|
||||||
<div className="w-full text-right text-neutral-600 text-lg font-bold mb-2">
|
<div className="w-full mb-2 text-lg font-bold text-right text-neutral-600">
|
||||||
سازمان ها
|
سازمان ها
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Form {...formAdd}>
|
<Form {...formAdd}>
|
||||||
<form
|
<form
|
||||||
onSubmit={formAdd.handleSubmit(onSubmitAdd)}
|
onSubmit={formAdd.handleSubmit(onSubmitAdd)}
|
||||||
className="w-full flex flex-col mt-6 "
|
className="flex flex-col w-full mt-6 "
|
||||||
>
|
>
|
||||||
<div className="flex flex-col flex-wrap justify-between">
|
<div className="flex flex-col flex-wrap justify-between">
|
||||||
<FormField
|
<FormField
|
||||||
control={formAdd.control}
|
control={formAdd.control}
|
||||||
name="titleOrg"
|
name="titleOrg"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className=" w-full ">
|
<FormItem className="w-full ">
|
||||||
<FormLabel className="text-[#7C838A] text-sm font-medium">
|
<FormLabel className="text-[#7C838A] text-sm font-medium">
|
||||||
عنوان سازمان
|
عنوان سازمان
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
|
|
@ -299,7 +286,7 @@ export default function AdminOrganizations() {
|
||||||
control={formAdd.control}
|
control={formAdd.control}
|
||||||
name="description"
|
name="description"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className=" w-full ">
|
<FormItem className="w-full ">
|
||||||
<FormLabel className="text-[#7C838A] text-sm font-medium ">
|
<FormLabel className="text-[#7C838A] text-sm font-medium ">
|
||||||
توضیحات
|
توضیحات
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
|
|
@ -316,14 +303,14 @@ export default function AdminOrganizations() {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
|
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="bg-blue text-white min-w-max rounded-xl text-center hover:bg-white hover:text-slate-800"
|
className="text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
|
||||||
>
|
>
|
||||||
افزودن
|
افزودن
|
||||||
</Button>
|
</Button>
|
||||||
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
|
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
|
||||||
بستن
|
بستن
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -338,7 +325,7 @@ export default function AdminOrganizations() {
|
||||||
</AlertDialogContent>
|
</AlertDialogContent>
|
||||||
</AlertDialog>
|
</AlertDialog>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full flex flex-row flex-wrap justify-between gap-8 md:gap-4 ">
|
<div className="flex flex-row flex-wrap justify-between w-full gap-8 md:gap-4 ">
|
||||||
<AlertDialog open={openEdit} onOpenChange={setOpenEdit}>
|
<AlertDialog open={openEdit} onOpenChange={setOpenEdit}>
|
||||||
<AlertDialogContent className=" w-full max-w-3xl h-full lg:max-h-[25em] max-h-[23em]">
|
<AlertDialogContent className=" w-full max-w-3xl h-full lg:max-h-[25em] max-h-[23em]">
|
||||||
<AlertDialogHeader>
|
<AlertDialogHeader>
|
||||||
|
|
@ -346,7 +333,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="p-0 border-0 h-auto">
|
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||||
<IoMdClose />
|
<IoMdClose />
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</AlertDialogTitle>
|
</AlertDialogTitle>
|
||||||
|
|
@ -354,20 +341,20 @@ export default function AdminOrganizations() {
|
||||||
<Form {...formEdit}>
|
<Form {...formEdit}>
|
||||||
<form
|
<form
|
||||||
onSubmit={formEdit.handleSubmit(onSubmitEdit)}
|
onSubmit={formEdit.handleSubmit(onSubmitEdit)}
|
||||||
className="w-full flex flex-col"
|
className="flex flex-col w-full"
|
||||||
>
|
>
|
||||||
<div className="flex flex-col flex-wrap justify-between">
|
<div className="flex flex-col flex-wrap justify-between">
|
||||||
<FormField
|
<FormField
|
||||||
control={formEdit.control}
|
control={formEdit.control}
|
||||||
name="titleOrg"
|
name="titleOrg"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className=" w-full ">
|
<FormItem className="w-full ">
|
||||||
<FormLabel>عنوان</FormLabel>
|
<FormLabel>عنوان</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
placeholder="عنوان"
|
placeholder="عنوان"
|
||||||
{...field}
|
{...field}
|
||||||
className=" bg-white"
|
className="bg-white "
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|
@ -379,12 +366,12 @@ export default function AdminOrganizations() {
|
||||||
control={formEdit.control}
|
control={formEdit.control}
|
||||||
name="description"
|
name="description"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className=" w-full ">
|
<FormItem className="w-full ">
|
||||||
<FormLabel>توضیحات</FormLabel>
|
<FormLabel>توضیحات</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Textarea
|
<Textarea
|
||||||
placeholder="توضیحات"
|
placeholder="توضیحات"
|
||||||
className="resize-none bg-white"
|
className="bg-white resize-none"
|
||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
@ -394,15 +381,15 @@ export default function AdminOrganizations() {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
|
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="bg-blue text-white min-w-max p-2 rounded-xl text-center hover:bg-white hover:text-slate-800"
|
className="p-2 text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
|
||||||
>
|
>
|
||||||
تغییر سازمان
|
تغییر سازمان
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
|
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
|
||||||
بستن
|
بستن
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -421,18 +408,18 @@ export default function AdminOrganizations() {
|
||||||
className={`flex flex-col justify-center gap-2 w-full lg:w-[49%] h-28 px-5 rounded-md shadow-md items-start bg-[#F5F5F5]
|
className={`flex flex-col justify-center gap-2 w-full lg:w-[49%] h-28 px-5 rounded-md shadow-md items-start bg-[#F5F5F5]
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
<p className=" text-slate-500 text-sm font-normal leading-normal">
|
<p className="text-sm font-normal leading-normal text-slate-500">
|
||||||
عنوان :
|
عنوان :
|
||||||
<span className=" text-slate-800">{item.title}</span>
|
<span className=" text-slate-800">{item.title}</span>
|
||||||
</p>
|
</p>
|
||||||
<p className=" text-slate-500 text-sm font-normal leading-normal">
|
<p className="text-sm font-normal leading-normal text-slate-500">
|
||||||
توضیحات:
|
توضیحات:
|
||||||
<span className=" text-slate-800 self-end">
|
<span className="self-end text-slate-800">
|
||||||
{item.description}
|
{item.description}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div className="w-full flex justify-end items-end gap-2">
|
<div className="flex items-end justify-end w-full gap-2">
|
||||||
<Switch
|
<Switch
|
||||||
dir="ltr"
|
dir="ltr"
|
||||||
checked={!item.isDeleted}
|
checked={!item.isDeleted}
|
||||||
|
|
@ -449,7 +436,7 @@ export default function AdminOrganizations() {
|
||||||
{/* <Button variant="outline">Show Dialog</Button> */}
|
{/* <Button variant="outline">Show Dialog</Button> */}
|
||||||
<FaRegEdit
|
<FaRegEdit
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
className="w-6 h-6 text-slate-600 hover:cursor-pointer self-end"
|
className="self-end w-6 h-6 text-slate-600 hover:cursor-pointer"
|
||||||
// onClick={() => setKeyId(item?.id)}
|
// onClick={() => setKeyId(item?.id)}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
handleClickEdit(
|
handleClickEdit(
|
||||||
|
|
|
||||||
|
|
@ -212,14 +212,9 @@ const ChangeSliderMutation = useMutation({
|
||||||
className: "!bg-green-500 !text-white",
|
className: "!bg-green-500 !text-white",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (err: any | string) => {
|
||||||
console.log(error);
|
toast(<>{err.response.data.detail}</>, {
|
||||||
console.log(error?.message);
|
className: "!bg-red-500 !text-white",
|
||||||
|
|
||||||
setOpenEdit(false);
|
|
||||||
|
|
||||||
toast(error?.message, {
|
|
||||||
className: "!bg-red-500 !text-black",
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -237,12 +232,9 @@ const DeleteSliderMutation = useMutation({
|
||||||
className: "!bg-green-500 !text-white",
|
className: "!bg-green-500 !text-white",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (err: any | string) => {
|
||||||
console.log(error);
|
toast(<>{err.response.data.detail}</>, {
|
||||||
console.log(error?.message);
|
className: "!bg-red-500 !text-white",
|
||||||
|
|
||||||
toast(error?.message, {
|
|
||||||
className: "!bg-red-500 !text-black",
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -263,14 +255,9 @@ const AddSliderMutation = useMutation({
|
||||||
className: "!bg-green-500 !text-white",
|
className: "!bg-green-500 !text-white",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (err: any | string) => {
|
||||||
console.log(error);
|
toast(<>{err.response.data.detail}</>, {
|
||||||
console.log(error?.message);
|
className: "!bg-red-500 !text-white",
|
||||||
|
|
||||||
setOpenAdd(false);
|
|
||||||
|
|
||||||
toast(error?.message, {
|
|
||||||
className: "!bg-red-500 !text-black",
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -317,9 +304,9 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
||||||
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 w-full justify-between flex-row ">
|
<div className="flex flex-row justify-between w-full ">
|
||||||
{/* 1 */}
|
{/* 1 */}
|
||||||
<div className="w-full text-right text-neutral-600 text-lg font-bold my-4">
|
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
|
||||||
لیست اسلایدرها
|
لیست اسلایدرها
|
||||||
</div>
|
</div>
|
||||||
{/* 2 */}
|
{/* 2 */}
|
||||||
|
|
@ -330,7 +317,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
// onClick={handleClickAddCat}
|
// onClick={handleClickAddCat}
|
||||||
className="bg-orange-500 text-white"
|
className="text-white bg-orange-500"
|
||||||
// disabled={isNewKeyLoading}
|
// disabled={isNewKeyLoading}
|
||||||
>
|
>
|
||||||
افزودن اسلایدر
|
افزودن اسلایدر
|
||||||
|
|
@ -342,7 +329,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
||||||
<p className="text-[#464646] text-base font-bold">
|
<p className="text-[#464646] text-base font-bold">
|
||||||
افزودن اسلایدر
|
افزودن اسلایدر
|
||||||
</p>
|
</p>
|
||||||
<AlertDialogCancel className="p-0 border-0 h-auto">
|
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||||
<IoMdClose />
|
<IoMdClose />
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</AlertDialogTitle>
|
</AlertDialogTitle>
|
||||||
|
|
@ -352,20 +339,20 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
||||||
<Form {...formAdd}>
|
<Form {...formAdd}>
|
||||||
<form
|
<form
|
||||||
onSubmit={formAdd.handleSubmit(onSubmitAdd)}
|
onSubmit={formAdd.handleSubmit(onSubmitAdd)}
|
||||||
className="w-full flex flex-col "
|
className="flex flex-col w-full "
|
||||||
>
|
>
|
||||||
<div className="flex flex-row flex-wrap justify-between">
|
<div className="flex flex-row flex-wrap justify-between">
|
||||||
<FormField
|
<FormField
|
||||||
control={formAdd.control}
|
control={formAdd.control}
|
||||||
name="titleSlider"
|
name="titleSlider"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className=" w-full ">
|
<FormItem className="w-full ">
|
||||||
<FormLabel> عنوان اسلایدر</FormLabel>
|
<FormLabel> عنوان اسلایدر</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
placeholder="عنوان اسلایدر را وارد نمایید"
|
placeholder="عنوان اسلایدر را وارد نمایید"
|
||||||
{...field}
|
{...field}
|
||||||
className=" bg-white"
|
className="bg-white "
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|
@ -415,7 +402,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
type="file"
|
type="file"
|
||||||
className="mb-3 bg-white"
|
className="mb-3 bg-white"
|
||||||
accept="image/*"
|
accept="image/*"
|
||||||
multiple={false} // Allow only one file
|
multiple={false} // Allow only one file
|
||||||
disabled={formAdd.formState.isSubmitting}
|
disabled={formAdd.formState.isSubmitting}
|
||||||
|
|
@ -444,7 +431,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
||||||
<Input
|
<Input
|
||||||
placeholder="لینک"
|
placeholder="لینک"
|
||||||
{...field}
|
{...field}
|
||||||
className=" bg-white"
|
className="bg-white "
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|
@ -472,14 +459,14 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
|
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="bg-blue text-white min-w-max rounded-xl text-center hover:bg-white hover:text-slate-800"
|
className="text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
|
||||||
>
|
>
|
||||||
افزودن
|
افزودن
|
||||||
</Button>
|
</Button>
|
||||||
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
|
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
|
||||||
بستن
|
بستن
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -494,7 +481,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
||||||
</AlertDialogContent>
|
</AlertDialogContent>
|
||||||
</AlertDialog>
|
</AlertDialog>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full flex flex-row flex-wrap justify-between gap-8 md:gap-4 ">
|
<div className="flex flex-row flex-wrap justify-between w-full gap-8 md:gap-4 ">
|
||||||
<AlertDialog open={openEdit} onOpenChange={setOpenEdit}>
|
<AlertDialog open={openEdit} onOpenChange={setOpenEdit}>
|
||||||
<AlertDialogContent className=" w-full max-w-3xl h-full lg:max-h-[28em] max-h-screen sm:max-h-[27em]">
|
<AlertDialogContent className=" w-full max-w-3xl h-full lg:max-h-[28em] max-h-screen sm:max-h-[27em]">
|
||||||
<AlertDialogHeader>
|
<AlertDialogHeader>
|
||||||
|
|
@ -502,7 +489,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
||||||
<p className="text-[#464646] text-base font-bold">
|
<p className="text-[#464646] text-base font-bold">
|
||||||
تغییر اسلایدر
|
تغییر اسلایدر
|
||||||
</p>
|
</p>
|
||||||
<AlertDialogCancel className="p-0 border-0 h-auto">
|
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||||
<IoMdClose />
|
<IoMdClose />
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</AlertDialogTitle>
|
</AlertDialogTitle>
|
||||||
|
|
@ -510,20 +497,20 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
||||||
<Form {...formEdit}>
|
<Form {...formEdit}>
|
||||||
<form
|
<form
|
||||||
onSubmit={formEdit.handleSubmit(onSubmitEdit)}
|
onSubmit={formEdit.handleSubmit(onSubmitEdit)}
|
||||||
className="w-full flex flex-col"
|
className="flex flex-col w-full"
|
||||||
>
|
>
|
||||||
<div className="flex flex-row flex-wrap justify-between">
|
<div className="flex flex-row flex-wrap justify-between">
|
||||||
<FormField
|
<FormField
|
||||||
control={formEdit.control}
|
control={formEdit.control}
|
||||||
name="titleSlider"
|
name="titleSlider"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className=" w-full ">
|
<FormItem className="w-full ">
|
||||||
<FormLabel>عنوان</FormLabel>
|
<FormLabel>عنوان</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
placeholder="عنوان"
|
placeholder="عنوان"
|
||||||
{...field}
|
{...field}
|
||||||
className=" bg-white"
|
className="bg-white "
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|
@ -573,7 +560,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
type="file"
|
type="file"
|
||||||
className="mb-3 bg-white"
|
className="mb-3 bg-white"
|
||||||
accept="image/*"
|
accept="image/*"
|
||||||
multiple={false} // Allow only one file
|
multiple={false} // Allow only one file
|
||||||
disabled={formEdit.formState.isSubmitting}
|
disabled={formEdit.formState.isSubmitting}
|
||||||
|
|
@ -602,7 +589,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
||||||
<Input
|
<Input
|
||||||
placeholder="لینک"
|
placeholder="لینک"
|
||||||
{...field}
|
{...field}
|
||||||
className=" bg-white"
|
className="bg-white "
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|
@ -630,15 +617,15 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
|
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="bg-blue text-white min-w-max p-2 rounded-xl text-center hover:bg-white hover:text-slate-800"
|
className="p-2 text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
|
||||||
>
|
>
|
||||||
تغییر اسلایدر
|
تغییر اسلایدر
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
|
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
|
||||||
بستن
|
بستن
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -656,13 +643,13 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
||||||
className={`flex flex-col justify-around gap-2 w-full lg:w-[49%] h-52 px-5 rounded-md shadow-md items-start bg-[#F5F5F5]
|
className={`flex flex-col justify-around gap-2 w-full lg:w-[49%] h-52 px-5 rounded-md shadow-md items-start bg-[#F5F5F5]
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
<p className=" text-slate-500 text-sm font-normal leading-normal">
|
<p className="text-sm font-normal leading-normal text-slate-500">
|
||||||
عنوان :
|
عنوان :
|
||||||
<span className=" text-slate-800">{item.title}</span>
|
<span className=" text-slate-800">{item.title}</span>
|
||||||
</p>
|
</p>
|
||||||
<p className=" text-slate-500 text-sm font-normal leading-normal">
|
<p className="text-sm font-normal leading-normal text-slate-500">
|
||||||
توضیحات:
|
توضیحات:
|
||||||
<span className=" text-slate-800 self-end">
|
<span className="self-end text-slate-800">
|
||||||
{item.description}
|
{item.description}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -672,17 +659,17 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
||||||
width={100}
|
width={100}
|
||||||
height={100}
|
height={100}
|
||||||
quality={100}
|
quality={100}
|
||||||
className=" w-full h-20 object-contain object-right"
|
className="object-contain object-right w-full h-20 "
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* <p className=" text-slate-500 text-sm font-normal leading-normal">
|
{/* <p className="text-sm font-normal leading-normal text-slate-500">
|
||||||
محتوا:
|
محتوا:
|
||||||
<span className=" text-slate-800 self-end">
|
<span className="self-end text-slate-800">
|
||||||
{item.content}
|
{item.content}
|
||||||
</span>
|
</span>
|
||||||
</p> */}
|
</p> */}
|
||||||
|
|
||||||
<div className="w-full flex justify-end items-end gap-2">
|
<div className="flex items-end justify-end w-full gap-2">
|
||||||
<Switch
|
<Switch
|
||||||
dir="ltr"
|
dir="ltr"
|
||||||
checked={!item.isDeleted}
|
checked={!item.isDeleted}
|
||||||
|
|
@ -698,7 +685,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
||||||
{/* <Button variant="outline">Show Dialog</Button> */}
|
{/* <Button variant="outline">Show Dialog</Button> */}
|
||||||
<FaRegEdit
|
<FaRegEdit
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
className="w-6 h-6 text-slate-600 hover:cursor-pointer self-end"
|
className="self-end w-6 h-6 text-slate-600 hover:cursor-pointer"
|
||||||
// onClick={() => setKeyId(item?.id)}
|
// onClick={() => setKeyId(item?.id)}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
handleClickEdit(
|
handleClickEdit(
|
||||||
|
|
|
||||||
|
|
@ -126,15 +126,12 @@ export default function AdminWebContents() {
|
||||||
|
|
||||||
toast("عملیات ثبت شما با موفقیت انجام شد. ", {
|
toast("عملیات ثبت شما با موفقیت انجام شد. ", {
|
||||||
className: "!bg-green-500 !text-white",
|
className: "!bg-green-500 !text-white",
|
||||||
});
|
});
|
||||||
refetch1();
|
refetch1();
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (err: any | string) => {
|
||||||
console.log(error);
|
toast(<>{err.response.data.detail}</>, {
|
||||||
console.log(error?.message);
|
className: "!bg-red-500 !text-white",
|
||||||
|
|
||||||
toast(error?.message, {
|
|
||||||
className: "!bg-red-500 !text-black",
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -147,17 +144,14 @@ export default function AdminWebContents() {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
console.log("Success Change UpdateWebContents");
|
console.log("Success Change UpdateWebContents");
|
||||||
|
|
||||||
|
|
||||||
toast("عملیات ویرایش شما با موفقیت انجام شد . ", {
|
toast("عملیات ویرایش شما با موفقیت انجام شد . ", {
|
||||||
className: "!bg-green-500 !text-white",
|
className: "!bg-green-500 !text-white",
|
||||||
});
|
});
|
||||||
refetch1();
|
refetch1();
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (err: any | string) => {
|
||||||
console.log(error?.message);
|
toast(<>{err.response.data.detail}</>, {
|
||||||
|
className: "!bg-red-500 !text-white",
|
||||||
toast(error?.message, {
|
|
||||||
className: "!bg-red-500 !text-black",
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -239,8 +233,8 @@ export default function AdminWebContents() {
|
||||||
<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 ">
|
||||||
{/* Cull Us */}
|
{/* Cull Us */}
|
||||||
<div className="w-full flex flex-col">
|
<div className="flex flex-col w-full">
|
||||||
<div className=" text-right text-neutral-600 text-base font-bold my-4">
|
<div className="my-4 text-base font-bold text-right text-neutral-600">
|
||||||
محتوای تماس با ما
|
محتوای تماس با ما
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -262,15 +256,15 @@ export default function AdminWebContents() {
|
||||||
// setContentTitle("Test");
|
// setContentTitle("Test");
|
||||||
// setContentDesc("Test....");
|
// setContentDesc("Test....");
|
||||||
}}
|
}}
|
||||||
className="w-1/6 self-end my-2"
|
className="self-end w-1/6 my-2"
|
||||||
>
|
>
|
||||||
ثبت
|
ثبت
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* About Us */}
|
{/* About Us */}
|
||||||
<div className="w-full flex flex-col">
|
<div className="flex flex-col w-full">
|
||||||
<div className=" text-right text-neutral-600 text-base font-bold my-4">
|
<div className="my-4 text-base font-bold text-right text-neutral-600">
|
||||||
محتوای درباره ما
|
محتوای درباره ما
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -290,15 +284,15 @@ export default function AdminWebContents() {
|
||||||
onEditAboutUs();
|
onEditAboutUs();
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className="w-1/6 self-end my-2"
|
className="self-end w-1/6 my-2"
|
||||||
>
|
>
|
||||||
ثبت
|
ثبت
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* AfterRegistration */}
|
{/* AfterRegistration */}
|
||||||
<div className="w-full flex flex-col">
|
<div className="flex flex-col w-full">
|
||||||
<div className=" text-right text-neutral-600 text-base font-bold my-4">
|
<div className="my-4 text-base font-bold text-right text-neutral-600">
|
||||||
محتوای بعد از ثبت گزارش
|
محتوای بعد از ثبت گزارش
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -318,15 +312,15 @@ export default function AdminWebContents() {
|
||||||
onEditAfterText();
|
onEditAfterText();
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className="w-1/6 self-end my-2"
|
className="self-end w-1/6 my-2"
|
||||||
>
|
>
|
||||||
ثبت
|
ثبت
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* BeforeRegistration*/}
|
{/* BeforeRegistration*/}
|
||||||
<div className="w-full flex flex-col">
|
<div className="flex flex-col w-full">
|
||||||
<div className=" text-right text-neutral-600 text-base font-bold my-4">
|
<div className="my-4 text-base font-bold text-right text-neutral-600">
|
||||||
محتوای قبل از ثبت گزارش
|
محتوای قبل از ثبت گزارش
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -346,7 +340,7 @@ export default function AdminWebContents() {
|
||||||
onEditBeforeText();
|
onEditBeforeText();
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className="w-1/6 self-end my-2"
|
className="self-end w-1/6 my-2"
|
||||||
>
|
>
|
||||||
ثبت
|
ثبت
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,11 @@ export default function ComplainsDetails({
|
||||||
onSuccess: (res) => {
|
onSuccess: (res) => {
|
||||||
localStorage.setItem("trackingNumber", res.trackingNumber);
|
localStorage.setItem("trackingNumber", res.trackingNumber);
|
||||||
},
|
},
|
||||||
onError: (err) => {},
|
onError: (err: any | string) => {
|
||||||
|
toast(<>{err.response.data.detail}</>, {
|
||||||
|
className: "!bg-red-500 !text-white",
|
||||||
|
});
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -211,15 +215,15 @@ export default function ComplainsDetails({
|
||||||
onChange={handleFileChange}
|
onChange={handleFileChange}
|
||||||
type="file"
|
type="file"
|
||||||
accept=".txt"
|
accept=".txt"
|
||||||
className=" bg-white hover:bg-white focus:bg-white"
|
className="bg-white hover:bg-white focus:bg-white"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center space-x-2 px-8">
|
<div className="flex items-center px-8 space-x-2">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={check}
|
checked={check}
|
||||||
onCheckedChange={setCheck}
|
onCheckedChange={setCheck}
|
||||||
id="terms"
|
id="terms"
|
||||||
className=" ml-2"
|
className="ml-2 "
|
||||||
/>
|
/>
|
||||||
<label
|
<label
|
||||||
htmlFor="terms"
|
htmlFor="terms"
|
||||||
|
|
@ -258,7 +262,7 @@ export default function ComplainsDetails({
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
router.push("/UserPanel/ControllerDashboard/Complaints")
|
router.push("/UserPanel/ControllerDashboard/Complaints")
|
||||||
}
|
}
|
||||||
className=" my-2 flex gap-1 cursor-pointer text-blue lg:sticky top-20"
|
className="flex gap-1 my-2 cursor-pointer text-blue lg:sticky top-20"
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
<ArrowRight />
|
<ArrowRight />
|
||||||
|
|
@ -266,7 +270,7 @@ export default function ComplainsDetails({
|
||||||
<p>بازگشت</p>
|
<p>بازگشت</p>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div className="w-full flex max-lg:flex-col items-start mt-2 gap-2">
|
<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-[78vh]">
|
<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">
|
||||||
|
|
@ -283,11 +287,11 @@ export default function ComplainsDetails({
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* 2 */}
|
{/* 2 */}
|
||||||
<div className="w-full lg:w-2/3 self-stretch rounded-lg flex flex-col gap-2 ">
|
<div className="flex flex-col self-stretch w-full gap-2 rounded-lg lg:w-2/3 ">
|
||||||
<div className=" bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col md:flex-row gap-2 items-center justify-center lg:sticky top-28">
|
<div className=" bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col md:flex-row gap-2 items-center justify-center lg:sticky top-28">
|
||||||
{data.user == null ? (
|
{data.user == null ? (
|
||||||
<>
|
<>
|
||||||
<div className="mt-2 flex flex-col gap-y-1 border rounded-md border-gray-400 w-full p-5 relative">
|
<div className="relative flex flex-col w-full p-5 mt-2 border border-gray-400 rounded-md gap-y-1">
|
||||||
<p className=" absolute -top-3 right-2 bg-[#E9E9E9] px-2 text-sm text-gray-500">
|
<p className=" absolute -top-3 right-2 bg-[#E9E9E9] px-2 text-sm text-gray-500">
|
||||||
اطلاعات کلی
|
اطلاعات کلی
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -321,7 +325,7 @@ export default function ComplainsDetails({
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<div className="mt-2 flex flex-col gap-y-1 border rounded-md border-gray-400 md:w-1/2 p-5 relative">
|
<div className="relative flex flex-col p-5 mt-2 border border-gray-400 rounded-md gap-y-1 md:w-1/2">
|
||||||
<p className=" absolute -top-3 right-2 bg-[#E9E9E9] px-2 text-sm text-gray-500">
|
<p className=" absolute -top-3 right-2 bg-[#E9E9E9] px-2 text-sm text-gray-500">
|
||||||
اطلاعات کلی
|
اطلاعات کلی
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -352,7 +356,7 @@ export default function ComplainsDetails({
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-2 flex flex-col gap-y-1 border rounded-md border-gray-400 md:w-1/2 p-5 relative">
|
<div className="relative flex flex-col p-5 mt-2 border border-gray-400 rounded-md gap-y-1 md:w-1/2">
|
||||||
<p className=" absolute -top-3 right-2 bg-[#E9E9E9] px-2 text-sm text-gray-500">
|
<p className=" absolute -top-3 right-2 bg-[#E9E9E9] px-2 text-sm text-gray-500">
|
||||||
اطلاعات شاکی
|
اطلاعات شاکی
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -388,14 +392,14 @@ export default function ComplainsDetails({
|
||||||
</div>
|
</div>
|
||||||
<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">
|
||||||
<p className="text-[#464646] text-base font-bold">روند شکایت</p>
|
<p className="text-[#464646] text-base font-bold">روند شکایت</p>
|
||||||
<div className=" flex flex-col gap-y-4 mt-4">
|
<div className="flex flex-col mt-4 gap-y-4">
|
||||||
{data.contents?.map((item: any) => {
|
{data.contents?.map((item: any) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={item.id}
|
key={item.id}
|
||||||
className=" bg-white p-4 rounded-lg shadow-md"
|
className="p-4 bg-white rounded-lg shadow-md "
|
||||||
>
|
>
|
||||||
<div className=" flex gap-4 items-center">
|
<div className="flex items-center gap-4 ">
|
||||||
<p className="">
|
<p className="">
|
||||||
<Badge>
|
<Badge>
|
||||||
{item.sender == 0 ? "شهروند" : "بازرس"}
|
{item.sender == 0 ? "شهروند" : "بازرس"}
|
||||||
|
|
@ -414,10 +418,10 @@ export default function ComplainsDetails({
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{item.media.length !== 0 && (
|
{item.media.length !== 0 && (
|
||||||
<Separator className=" mt-2 mb-1" />
|
<Separator className="mt-2 mb-1 " />
|
||||||
)}
|
)}
|
||||||
<div className=" text-[#464646] mt-2">
|
<div className=" text-[#464646] mt-2">
|
||||||
<div className=" flex flex-wrap max-md:flex-col w-full items-center gap-2 text-xs 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) => {
|
{item?.media.map((item: any, index: number) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|
@ -428,15 +432,15 @@ export default function ComplainsDetails({
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
openFileInNewTab(item.data, item.mimeType)
|
openFileInNewTab(item.data, item.mimeType)
|
||||||
}
|
}
|
||||||
className=" cursor-pointer flex gap-2 truncate items-center"
|
className="flex items-center gap-2 truncate cursor-pointer "
|
||||||
>
|
>
|
||||||
<File className=" w-6 h-6" />
|
<File className="w-6 h-6 " />
|
||||||
<p className=" max-w-[5rem] truncate">
|
<p className=" max-w-[5rem] truncate">
|
||||||
{item.title}
|
{item.title}
|
||||||
</p>
|
</p>
|
||||||
</a>
|
</a>
|
||||||
<ArrowDownToLine
|
<ArrowDownToLine
|
||||||
className=" cursor-pointer"
|
className="cursor-pointer "
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
downloadFile(
|
downloadFile(
|
||||||
item.data,
|
item.data,
|
||||||
|
|
@ -475,7 +479,7 @@ export default function ComplainsDetails({
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{getComplaintMutation.isPending && (
|
{getComplaintMutation.isPending && (
|
||||||
<div className="w-full h-full flex justify-center mt-20">
|
<div className="flex justify-center w-full h-full mt-20">
|
||||||
|
|
||||||
<Triangle
|
<Triangle
|
||||||
visible={true}
|
visible={true}
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,11 @@ export default function InspectorOperations({
|
||||||
password: key2 ? key2 : (localStorage.getItem("privateKey") as string),
|
password: key2 ? key2 : (localStorage.getItem("privateKey") as string),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onError: (err) => {},
|
onError: (err: any | string) => {
|
||||||
|
toast(<>{err.response.data.detail}</>, {
|
||||||
|
className: "!bg-red-500 !text-white",
|
||||||
|
});
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function onSubmit(data: z.infer<typeof FormSchema>) {
|
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||||
|
|
@ -143,7 +147,7 @@ export default function InspectorOperations({
|
||||||
/>
|
/>
|
||||||
{/* <div className="grid w-full max-w-sm items-center gap-1.5 mt-1">
|
{/* <div className="grid w-full max-w-sm items-center gap-1.5 mt-1">
|
||||||
<Label htmlFor="picture">پیوست</Label>
|
<Label htmlFor="picture">پیوست</Label>
|
||||||
<Input multiple id="picture" type="file" className=" bg-white" />
|
<Input multiple id="picture" type="file" className="bg-white " />
|
||||||
</div> */}
|
</div> */}
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
|
|
@ -160,7 +164,7 @@ export default function InspectorOperations({
|
||||||
console.log(e.target.files);
|
console.log(e.target.files);
|
||||||
}}
|
}}
|
||||||
multiple
|
multiple
|
||||||
className=" bg-white"
|
className="bg-white "
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|
@ -181,13 +185,13 @@ export default function InspectorOperations({
|
||||||
>
|
>
|
||||||
<FormItem className="flex items-center space-x-3 space-y-0">
|
<FormItem className="flex items-center space-x-3 space-y-0">
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<RadioGroupItem value="private" className=" ml-2" />
|
<RadioGroupItem value="private" className="ml-2 " />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormLabel className="font-normal">خصوصی</FormLabel>
|
<FormLabel className="font-normal">خصوصی</FormLabel>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem className="flex items-center space-x-3 space-y-0">
|
<FormItem className="flex items-center space-x-3 space-y-0">
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<RadioGroupItem value="public" className=" ml-2" />
|
<RadioGroupItem value="public" className="ml-2 " />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormLabel className="font-normal">عمومی</FormLabel>
|
<FormLabel className="font-normal">عمومی</FormLabel>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
@ -199,12 +203,12 @@ export default function InspectorOperations({
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className=" flex justify-between mt-3 gap-2">
|
<div className="flex justify-between gap-2 mt-3 ">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="operation"
|
name="operation"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className=" flex-1">
|
<FormItem className="flex-1 ">
|
||||||
{/* <FormLabel>Email</FormLabel> */}
|
{/* <FormLabel>Email</FormLabel> */}
|
||||||
<Select
|
<Select
|
||||||
onValueChange={field.onChange}
|
onValueChange={field.onChange}
|
||||||
|
|
@ -217,7 +221,7 @@ export default function InspectorOperations({
|
||||||
dir="rtl"
|
dir="rtl"
|
||||||
>
|
>
|
||||||
<SelectValue
|
<SelectValue
|
||||||
className=" text-xs"
|
className="text-xs "
|
||||||
placeholder="نوع عملیات را انتخاب نمایید."
|
placeholder="نوع عملیات را انتخاب نمایید."
|
||||||
/>
|
/>
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
|
|
@ -247,7 +251,7 @@ export default function InspectorOperations({
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
disabled={possibleOperations.length == 0}
|
disabled={possibleOperations.length == 0}
|
||||||
className=" bg-blue w-1/3"
|
className="w-1/3 bg-blue"
|
||||||
type="submit"
|
type="submit"
|
||||||
>
|
>
|
||||||
ثبت
|
ثبت
|
||||||
|
|
|
||||||
|
|
@ -58,16 +58,14 @@ export default function Login() {
|
||||||
|
|
||||||
const loginMutation = useMutation({
|
const loginMutation = useMutation({
|
||||||
mutationFn: loginStaff,
|
mutationFn: loginStaff,
|
||||||
onSuccess: (res) => {},
|
onSuccess: (res) => {
|
||||||
|
router.push("/Verify");
|
||||||
|
localStorage.setItem("verificationToken", res);
|
||||||
|
},
|
||||||
onError: (err: any | string) => {
|
onError: (err: any | string) => {
|
||||||
if (err.response.status == 428) {
|
toast(<>{err.response.data.detail}</>, {
|
||||||
console.log(useData);
|
className: "!bg-red-500 !text-white",
|
||||||
router.push("/Verify");
|
});
|
||||||
} else {
|
|
||||||
toast("مشکلی در ارسال درخواست به وجود آمد.", {
|
|
||||||
className: "!bg-red-500 !text-white",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -97,22 +95,22 @@ export default function Login() {
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className=" w-screen h-screen grid place-content-center bg-gray-200 ">
|
<div className="grid w-screen h-screen bg-gray-200 place-content-center">
|
||||||
<div
|
<div
|
||||||
className="w-full sm:[20rem] md:[20rem] xl:w-[30rem] bg-white rounded-lg dark:border xl:p-0 dark:bg-gray-800 dark:border-gray-700 shadow-[0px_0px_15px_0px_#00000040]
|
className="w-full sm:[20rem] md:[20rem] xl:w-[30rem] bg-white rounded-lg dark:border xl:p-0 dark:bg-gray-800 dark:border-gray-700 shadow-[0px_0px_15px_0px_#00000040]
|
||||||
h-fit"
|
h-fit"
|
||||||
>
|
>
|
||||||
<div className="space-y-3 md:space-y-4 flex flex-col md:py-10 p-10 md:px-12 lg:px-16 h-full justify-center">
|
<div className="flex flex-col justify-center h-full p-10 space-y-3 md:space-y-4 md:py-10 md:px-12 lg:px-16">
|
||||||
<Image alt="icon" src={LoginIcon} className="self-center w-1/3 " />
|
<Image alt="icon" src={LoginIcon} className="self-center w-1/3 " />
|
||||||
|
|
||||||
<p className="text-lg font-bold leading-tight tracking-tight text-blue dark:text-white">
|
<p className="text-lg font-bold leading-tight tracking-tight text-blue dark:text-white">
|
||||||
ورود به پنل کاربری
|
ورود به پنل کاربری
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
<form
|
<form
|
||||||
onSubmit={form.handleSubmit(onSubmit)}
|
onSubmit={form.handleSubmit(onSubmit)}
|
||||||
className="w-full flex flex-col "
|
className="flex flex-col w-full "
|
||||||
>
|
>
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
|
|
@ -158,13 +156,13 @@ export default function Login() {
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<div className="flex gap-3 mt-4 items-center">
|
<div className="flex items-center gap-3 mt-4">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="captcha"
|
name="captcha"
|
||||||
rules={{ required: true }}
|
rules={{ required: true }}
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className=" items-center h-10 flex-1">
|
<FormItem className="items-center flex-1 h-10 ">
|
||||||
{/* <FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
{/* <FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||||
رمز عبور
|
رمز عبور
|
||||||
</FormLabel> */}
|
</FormLabel> */}
|
||||||
|
|
@ -176,7 +174,7 @@ export default function Login() {
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<div className=" w-36 flex justify-center text-center">
|
<div className="flex justify-center text-center w-36">
|
||||||
<ThreeDots
|
<ThreeDots
|
||||||
visible={true}
|
visible={true}
|
||||||
height="50"
|
height="50"
|
||||||
|
|
@ -189,31 +187,31 @@ export default function Login() {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className=" flex items-center justify-center text-center gap-2">
|
<div className="flex items-center justify-center gap-2 text-center ">
|
||||||
<Image
|
<Image
|
||||||
alt="icon"
|
alt="icon"
|
||||||
src={srcForImage as string}
|
src={srcForImage as string}
|
||||||
className=" h-12 rounded-md shadow-md w-36"
|
className="h-12 rounded-md shadow-md w-36"
|
||||||
width={150}
|
width={150}
|
||||||
height={20}
|
height={20}
|
||||||
quality={100}
|
quality={100}
|
||||||
/>
|
/>
|
||||||
<RefreshCcw
|
<RefreshCcw
|
||||||
className=" cursor-pointer"
|
className="cursor-pointer "
|
||||||
onClick={() => refetch()}
|
onClick={() => refetch()}
|
||||||
color="#003778"
|
color="#003778"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-end gap-2 w-full mt-14">
|
<div className="flex justify-end w-full gap-2 mt-14">
|
||||||
<Button
|
<Button
|
||||||
disabled={loginMutation.isPending}
|
disabled={loginMutation.isPending}
|
||||||
type="submit"
|
type="submit"
|
||||||
className="bg-blue hover:bg-blue/90 transition text-white w-1/2 md:w-1/3 p-2 rounded-xl"
|
className="w-1/2 p-2 text-white transition bg-blue hover:bg-blue/90 md:w-1/3 rounded-xl"
|
||||||
>
|
>
|
||||||
{loginMutation.isPending ? (
|
{loginMutation.isPending ? (
|
||||||
<div className="flex justify-center items-center gap-2">
|
<div className="flex items-center justify-center gap-2">
|
||||||
<Oval
|
<Oval
|
||||||
visible={true}
|
visible={true}
|
||||||
height="20"
|
height="20"
|
||||||
|
|
|
||||||
|
|
@ -42,12 +42,9 @@ export default function NavbarPanel() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="fixed flex justify-between items-center gap-3
|
className="fixed top-0 z-10 flex flex-row items-center justify-between w-full gap-3 px-8 py-4 shadow-md sm:items-center sm:gap-0 bg-blue max-md:px-4 "
|
||||||
flex-row sm:items-center sm:gap-0
|
|
||||||
w-full px-8 py-4 z-10 top-0 bg-blue max-md:px-4 shadow-md
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<div className=" flex items-center gap-8 max-md:gap-4">
|
<div className="flex items-center gap-8 max-md:gap-4">
|
||||||
<div className=" md:hidden">
|
<div className=" md:hidden">
|
||||||
<Hamburger
|
<Hamburger
|
||||||
toggled={isOpen}
|
toggled={isOpen}
|
||||||
|
|
@ -57,7 +54,7 @@ export default function NavbarPanel() {
|
||||||
color="#fff"
|
color="#fff"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-white inline-block bg-clip-text text-sm font-bold max-md:text-sm max-md:font-medium">
|
<p className="inline-block text-sm font-bold text-white bg-clip-text max-md:text-sm max-md:font-medium">
|
||||||
پنل کاربری {<span className=" max-md:hidden">|</span>}
|
پنل کاربری {<span className=" max-md:hidden">|</span>}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
@ -103,7 +100,7 @@ export default function NavbarPanel() {
|
||||||
</motion.div>
|
</motion.div>
|
||||||
)}
|
)}
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
<div className="flex flex-row gap-7 max-md:gap-3 max-md:hidden">
|
<div className="flex flex-row gap-7 max-md:gap-3 max-md:hidden">
|
||||||
{role && (
|
{role && (
|
||||||
<>
|
<>
|
||||||
{selectedMenu.map(
|
{selectedMenu.map(
|
||||||
|
|
@ -127,8 +124,8 @@ export default function NavbarPanel() {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className=" flex gap-4 items-center">
|
<div className="flex items-center gap-4 ">
|
||||||
<h1 className="text-white inline-block bg-clip-text before:max-md:hidden text-sm font-bold max-md:text-xs max-md:font-medium">
|
<h1 className="inline-block text-sm font-bold text-white bg-clip-text before:max-md:hidden max-md:text-xs max-md:font-medium">
|
||||||
{data && (
|
{data && (
|
||||||
<>
|
<>
|
||||||
{role === "Admin"
|
{role === "Admin"
|
||||||
|
|
@ -137,7 +134,7 @@ export default function NavbarPanel() {
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</h1>
|
</h1>
|
||||||
<div className="hover:bg-white/50 p-1 rounded-md">
|
<div className="p-1 rounded-md hover:bg-white/50">
|
||||||
<LogOut
|
<LogOut
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
deleteCookie("Sootzani_Token");
|
deleteCookie("Sootzani_Token");
|
||||||
|
|
@ -145,7 +142,7 @@ export default function NavbarPanel() {
|
||||||
localStorage.removeItem("privatePassword");
|
localStorage.removeItem("privatePassword");
|
||||||
router.push("/");
|
router.push("/");
|
||||||
}}
|
}}
|
||||||
className=" text-white cursor-pointer"
|
className="text-white cursor-pointer "
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import { AppProgressBar as ProgressBar } from "next-nprogress-bar";
|
||||||
|
|
||||||
|
const ProgressBarProviders = ({ children }: { children: React.ReactNode }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{children}
|
||||||
|
<ProgressBar
|
||||||
|
height="4px"
|
||||||
|
color="#29D"
|
||||||
|
options={{ showSpinner: false }}
|
||||||
|
shallowRouting
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ProgressBarProviders;
|
||||||
|
|
@ -18,14 +18,24 @@ import {
|
||||||
} from "@/components/ui/alert-dialog";
|
} from "@/components/ui/alert-dialog";
|
||||||
import { IoMdClose } from "react-icons/io";
|
import { IoMdClose } from "react-icons/io";
|
||||||
import { useMediaQuery } from "react-responsive";
|
import { useMediaQuery } from "react-responsive";
|
||||||
export default function Search({ mode }: { mode: string }) {
|
export default function Search({
|
||||||
|
mode,
|
||||||
|
value,
|
||||||
|
action,
|
||||||
|
changeValue,
|
||||||
|
}: {
|
||||||
|
mode: string;
|
||||||
|
value: any;
|
||||||
|
action: (any: any) => any;
|
||||||
|
changeValue: (any: any) => any;
|
||||||
|
}) {
|
||||||
// useEffect(() => {
|
// useEffect(() => {
|
||||||
// const isMobile = useMediaQuery({ query: "(max-width: 768px)" });
|
// const isMobile = useMediaQuery({ query: "(max-width: 768px)" });
|
||||||
// }, []);
|
// }, []);
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{mode === "controller" || mode === "admin" ? (
|
{mode === "controller" || mode === "admin" ? (
|
||||||
<div className="relative flex bg-gray-300 rounded-xl items-center">
|
<div className="relative flex items-center bg-gray-300 rounded-xl">
|
||||||
<Input
|
<Input
|
||||||
// type="search"
|
// type="search"
|
||||||
id="default-search"
|
id="default-search"
|
||||||
|
|
@ -38,21 +48,23 @@ export default function Search({ mode }: { mode: string }) {
|
||||||
"w-full min-w-full bg-white lg:min-w-full h-11"
|
"w-full min-w-full bg-white lg:min-w-full h-11"
|
||||||
}
|
}
|
||||||
`}
|
`}
|
||||||
|
value={value}
|
||||||
|
onChange={(e) => changeValue(e.target.value)}
|
||||||
placeholder="جستجو..."
|
placeholder="جستجو..."
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
{/* <Button
|
{/* <Button
|
||||||
className="absolute left-0 bg-transparent h-auto w-auto text-slate-800"
|
className="absolute left-0 w-auto h-auto bg-transparent text-slate-800"
|
||||||
>
|
>
|
||||||
<CiSearch />
|
<CiSearch />
|
||||||
</Button> */}
|
</Button> */}
|
||||||
<button className="absolute left-3">
|
<button onClick={action} className="absolute left-3">
|
||||||
<CiSearch />
|
<CiSearch />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<div className=" max-md:hidden relative flex bg-gray-300 rounded-xl items-center">
|
<div className="relative flex items-center bg-gray-300 max-md:hidden rounded-xl">
|
||||||
<Input
|
<Input
|
||||||
// type="search"
|
// type="search"
|
||||||
id="default-search"
|
id="default-search"
|
||||||
|
|
@ -78,7 +90,7 @@ export default function Search({ mode }: { mode: string }) {
|
||||||
<button
|
<button
|
||||||
// variant="outline"
|
// variant="outline"
|
||||||
// type="submit"
|
// type="submit"
|
||||||
className=" bg-gradient2 text-white font-bold rounded-md p-1"
|
className="p-1 font-bold text-white rounded-md bg-gradient2"
|
||||||
>
|
>
|
||||||
<CiSearch />
|
<CiSearch />
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -86,11 +98,11 @@ export default function Search({ mode }: { mode: string }) {
|
||||||
|
|
||||||
<AlertDialogContent className=" h-1/5 min-w-[80%] max-w-fit">
|
<AlertDialogContent className=" h-1/5 min-w-[80%] max-w-fit">
|
||||||
<AlertDialogHeader className="w-full">
|
<AlertDialogHeader className="w-full">
|
||||||
<AlertDialogTitle className=" py-1">
|
<AlertDialogTitle className="py-1 ">
|
||||||
<p className="text-[#464646] text-base font-bold">
|
<p className="text-[#464646] text-base font-bold">
|
||||||
فرم جستجو
|
فرم جستجو
|
||||||
</p>
|
</p>
|
||||||
<AlertDialogCancel className="p-0 border-0 h-auto">
|
<AlertDialogCancel className="h-auto p-0 border-0">
|
||||||
<IoMdClose />
|
<IoMdClose />
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
</AlertDialogTitle>
|
</AlertDialogTitle>
|
||||||
|
|
@ -105,7 +117,7 @@ export default function Search({ mode }: { mode: string }) {
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<button className="absolute left-16 text-black">
|
<button className="absolute text-black left-16">
|
||||||
<CiSearch />
|
<CiSearch />
|
||||||
</button>
|
</button>
|
||||||
</AlertDialogDescription>
|
</AlertDialogDescription>
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import { toast } from "sonner";
|
||||||
export default function TabController() {
|
export default function TabController() {
|
||||||
const saveData = useData((state) => state.saveData);
|
const saveData = useData((state) => state.saveData);
|
||||||
const [selectedFile, setSelectedFile] = useState<any>(null);
|
const [selectedFile, setSelectedFile] = useState<any>(null);
|
||||||
|
const [search, setSearch] = useState<any>(null);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const handleFileChange = (event: any) => {
|
const handleFileChange = (event: any) => {
|
||||||
const file = event.target.files[0];
|
const file = event.target.files[0];
|
||||||
|
|
@ -51,10 +52,9 @@ export default function TabController() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
console.log(search);
|
||||||
const [psblState, setPsblState] = useState(0);
|
const [psblState, setPsblState] = useState(0);
|
||||||
const [selectedTab, setSelectedTab] = useState("0");
|
const [selectedTab, setSelectedTab] = useState("0");
|
||||||
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: dataState,
|
data: dataState,
|
||||||
|
|
@ -65,28 +65,31 @@ export default function TabController() {
|
||||||
queryFn: () => getPossibleStates(),
|
queryFn: () => getPossibleStates(),
|
||||||
refetchOnWindowFocus: false,
|
refetchOnWindowFocus: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// const initialSelectedTab = dataState[0]?.value || '';
|
// const initialSelectedTab = dataState[0]?.value || '';
|
||||||
// setSelectedTab(initialSelectedTab);
|
// setSelectedTab(initialSelectedTab);
|
||||||
|
|
||||||
|
|
||||||
const { data, isLoading, refetch } = useQuery({
|
const { data, isLoading, refetch } = useQuery({
|
||||||
queryKey: ["ComplaintsList" ,psblState,dataState],
|
queryKey: ["ComplaintsList", psblState, dataState],
|
||||||
queryFn: () => getComplaintsList(psblState),
|
queryFn: () =>
|
||||||
|
getComplaintsList({ states: psblState, TrackingNumber: search }),
|
||||||
refetchOnWindowFocus: false,
|
refetchOnWindowFocus: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const handelSearch = (event: any) => {
|
||||||
|
refetch();
|
||||||
|
};
|
||||||
// useEffect(() => {
|
// useEffect(() => {
|
||||||
// // Handle the data after it has been updated
|
// // Handle the data after it has been updated
|
||||||
// }, [data]);
|
// }, [data]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-16 pt-9 mx-auto">
|
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-16 pt-9 mx-auto">
|
||||||
<p className="3xl:ml-6 text-xs sm:text-sm font-bold md:hidden my-2">
|
<p className="my-2 text-xs font-bold 3xl:ml-6 sm:text-sm md:hidden">
|
||||||
لیست شکایت ها
|
لیست شکایت ها
|
||||||
</p>
|
</p>
|
||||||
<Tabs
|
<Tabs
|
||||||
defaultValue='0'
|
defaultValue="0"
|
||||||
value={selectedTab}
|
value={selectedTab}
|
||||||
// onClick={(value) => {
|
// onClick={(value) => {
|
||||||
// setPsblState(value);
|
// setPsblState(value);
|
||||||
|
|
@ -96,10 +99,10 @@ export default function TabController() {
|
||||||
className=""
|
className=""
|
||||||
dir="rtl"
|
dir="rtl"
|
||||||
>
|
>
|
||||||
<div className="w-full flex flex-col-reverse lg:flex-row gap-4 lg:gap-5 justify-between items-center mb-10">
|
<div className="flex flex-col-reverse items-center justify-between w-full gap-4 mb-10 lg:flex-row lg:gap-5">
|
||||||
{/* Tab Title */}
|
{/* Tab Title */}
|
||||||
<TabsList className="w-full flex gap-1 md:gap-4 lg:gap-3">
|
<TabsList className="flex w-full gap-1 md:gap-4 lg:gap-3">
|
||||||
<p className="3xl:ml-6 text-xs sm:text-sm font-bold max-md:hidden">
|
<p className="text-xs font-bold 3xl:ml-6 sm:text-sm max-md:hidden">
|
||||||
لیست شکایت ها |
|
لیست شکایت ها |
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
@ -124,15 +127,19 @@ export default function TabController() {
|
||||||
</TabsList>
|
</TabsList>
|
||||||
|
|
||||||
{/* Search Box */}
|
{/* Search Box */}
|
||||||
<Search mode="controller" />
|
<Search
|
||||||
|
value={search}
|
||||||
|
changeValue={(data: any) => setSearch(data)}
|
||||||
|
mode="controller"
|
||||||
|
action={handelSearch}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Tab Content */}
|
{/* Tab Content */}
|
||||||
|
|
||||||
<TabsContent value={selectedTab} key={selectedTab}>
|
<TabsContent value={selectedTab} key={selectedTab}>
|
||||||
<TableController checkKey={(item) => checkKey(item)} data={data} />
|
<TableController checkKey={(item) => checkKey(item)} data={data} />
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
|
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import { useRouter } from "next/navigation";
|
||||||
import useData from "@/store/useData";
|
import useData from "@/store/useData";
|
||||||
import { JwtPayload, jwtDecode } from "jwt-decode";
|
import { JwtPayload, jwtDecode } from "jwt-decode";
|
||||||
import { setCookie } from "cookies-next";
|
import { setCookie } from "cookies-next";
|
||||||
import { Oval } from "react-loader-spinner";
|
import { Oval, Triangle } from "react-loader-spinner";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
|
|
||||||
export default function Verify() {
|
export default function Verify() {
|
||||||
|
|
@ -18,12 +18,13 @@ export default function Verify() {
|
||||||
const space = "\xa0";
|
const space = "\xa0";
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const userData = useData((state) => state.data);
|
const userData = useData((state) => state.data);
|
||||||
const [VerifyRole, setVerifyRole] = useState<any>("");
|
|
||||||
const verifyMutation = useMutation({
|
const verifyMutation = useMutation({
|
||||||
mutationFn: verifyStaff,
|
mutationFn: verifyStaff,
|
||||||
onSuccess: (res) => {
|
onSuccess: (res) => {
|
||||||
const decodedToken = jwtDecode<any>(res);
|
const decodedToken = jwtDecode<any>(res.jwtToken);
|
||||||
setCookie("Sootzani_Token", res);
|
setCookie("Sootzani_Token", res.jwtToken);
|
||||||
|
setCookie("Sootzani_Refresh_Token", res.refreshToken);
|
||||||
const userRole =
|
const userRole =
|
||||||
decodedToken[
|
decodedToken[
|
||||||
"http://schemas.microsoft.com/ws/2008/06/identity/claims/role"
|
"http://schemas.microsoft.com/ws/2008/06/identity/claims/role"
|
||||||
|
|
@ -33,41 +34,14 @@ export default function Verify() {
|
||||||
router.push("/UserPanel/ControllerDashboard");
|
router.push("/UserPanel/ControllerDashboard");
|
||||||
} else if (userRole == "Admin") {
|
} else if (userRole == "Admin") {
|
||||||
router.push("/UserPanel/AdminDashboard");
|
router.push("/UserPanel/AdminDashboard");
|
||||||
} else {
|
}
|
||||||
router.push("/UserPanel/CitizenDashboard");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onError: (err: any) => {
|
onError: (err: any | string) => {
|
||||||
toast("کد تایید شما صحیح نمیباشد.", {
|
toast(<>{err.response.data.detail}</>, {
|
||||||
className: "!bg-red-500 !text-white",
|
className: "!bg-red-500 !text-white",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const CitizenVerifyMutation = useMutation({
|
|
||||||
mutationFn: verifyCitizen,
|
|
||||||
onSuccess: (res) => {
|
|
||||||
const decodedToken = jwtDecode<any>(res);
|
|
||||||
setCookie("Sootzani_Token", res);
|
|
||||||
const userRole =
|
|
||||||
decodedToken[
|
|
||||||
"http://schemas.microsoft.com/ws/2008/06/identity/claims/role"
|
|
||||||
];
|
|
||||||
localStorage.setItem("Sootzani_Role", userRole);
|
|
||||||
router.push("/UserPanel/CitizenDashboard");
|
|
||||||
},
|
|
||||||
onError: (err: any) => {},
|
|
||||||
});
|
|
||||||
|
|
||||||
const handelVerify = () => {
|
|
||||||
console.log(otp);
|
|
||||||
const payload = { ...userData, verificationCode: otp };
|
|
||||||
console.log(userData);
|
|
||||||
if (userData?.phoneNumber) {
|
|
||||||
CitizenVerifyMutation.mutate(payload);
|
|
||||||
} else {
|
|
||||||
verifyMutation.mutate(payload);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
useData.persist.rehydrate();
|
useData.persist.rehydrate();
|
||||||
|
|
@ -75,21 +49,38 @@ export default function Verify() {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (otp.length == 6) {
|
if (otp.length == 6) {
|
||||||
const payload = { ...userData, verificationCode: otp };
|
const payload = {
|
||||||
|
otpToken: localStorage.getItem("verificationToken"),
|
||||||
|
verificationCode: otp,
|
||||||
|
};
|
||||||
console.log(userData);
|
console.log(userData);
|
||||||
verifyMutation.mutate(payload);
|
verifyMutation.mutate(payload);
|
||||||
}
|
}
|
||||||
}, [otp]);
|
}, [otp]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className=" w-screen h-screen grid place-content-center bg-gray-200">
|
<div className="grid w-screen h-screen bg-gray-200 place-content-center">
|
||||||
<div
|
<div
|
||||||
className="w-full sm:[20rem] md:[20rem] xl:w-[30rem] bg-white rounded-lg dark:border xl:p-0 dark:bg-gray-800 dark:border-gray-700 shadow-[0px_0px_15px_0px_#00000040]
|
className="w-full sm:[20rem] md:[20rem] xl:w-[30rem] bg-white rounded-lg dark:border xl:p-0 dark:bg-gray-800 dark:border-gray-700 shadow-[0px_0px_15px_0px_#00000040]
|
||||||
h-fit"
|
h-fit relative"
|
||||||
>
|
>
|
||||||
<div className="space-y-3 md:space-y-4 flex flex-col md:py-12 md:px-20 h-full justify-center">
|
{verifyMutation.isPending && (
|
||||||
|
<div className="absolute top-3 left-5 ">
|
||||||
|
<Triangle
|
||||||
|
visible={true}
|
||||||
|
height="30"
|
||||||
|
width="30"
|
||||||
|
color="#003778"
|
||||||
|
ariaLabel="triangle-loading"
|
||||||
|
wrapperStyle={{}}
|
||||||
|
wrapperClass=""
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="flex flex-col justify-center h-full p-10 space-y-3 md:space-y-4 md:py-10 md:px-12 lg:px-16">
|
||||||
<Image alt="icon" src={LoginIcon} className="self-center w-1/3 " />
|
<Image alt="icon" src={LoginIcon} className="self-center w-1/3 " />
|
||||||
<p className="text-lg font-bold leading-tight tracking-tight text-blue dark:text-white">
|
<p className="text-lg font-bold leading-tight tracking-tight text-blue dark:text-white">
|
||||||
تایید کد
|
تایید کد
|
||||||
</p>
|
</p>
|
||||||
<div className="w-full " dir="ltr">
|
<div className="w-full " dir="ltr">
|
||||||
|
|
@ -102,23 +93,25 @@ export default function Verify() {
|
||||||
<input autoFocus={idx == 0} pattern="[0-9]*" {...props} />
|
<input autoFocus={idx == 0} pattern="[0-9]*" {...props} />
|
||||||
)}
|
)}
|
||||||
containerStyle=" flex justify-center"
|
containerStyle=" flex justify-center"
|
||||||
inputStyle=" !w-10 rounded-md h-10 bg-[#F5F5F5] border border-blue/30 text-black"
|
inputStyle={` !w-10 rounded-md h-10 bg-[#F5F5F5] border border-blue/30 text-black ${
|
||||||
|
verifyMutation.isSuccess && "border-green-600 transition-all"
|
||||||
|
}`}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<label className="label text-center">
|
<label className="text-center label">
|
||||||
<span className="text-xs text-blue/70 label-text text-center">
|
<span className="text-xs text-center text-blue/70 label-text">
|
||||||
کد دریافت شده توسط پیامک را وارد نمایید.
|
کد دریافت شده توسط پیامک را وارد نمایید.
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
{/* <div className="flex justify-end gap-2 w-full mt-14">
|
{/* <div className="flex justify-end w-full gap-2 mt-14">
|
||||||
<Button
|
<Button
|
||||||
disabled={verifyMutation.isPending}
|
disabled={verifyMutation.isPending}
|
||||||
onClick={handelVerify}
|
onClick={handelVerify}
|
||||||
type="submit"
|
type="submit"
|
||||||
className="bg-blue hover:bg-blue/90 text-white w-1/2 md:w-1/3 p-2 rounded-xl"
|
className="w-1/2 p-2 text-white bg-blue hover:bg-blue/90 md:w-1/3 rounded-xl"
|
||||||
>
|
>
|
||||||
{verifyMutation.isPending ? (
|
{verifyMutation.isPending ? (
|
||||||
<div className="flex justify-center items-center gap-2">
|
<div className="flex items-center justify-center gap-2">
|
||||||
<Oval
|
<Oval
|
||||||
visible={true}
|
visible={true}
|
||||||
height="20"
|
height="20"
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@
|
||||||
"leaflet-geosearch": "^3.11.0",
|
"leaflet-geosearch": "^3.11.0",
|
||||||
"lucide-react": "^0.292.0",
|
"lucide-react": "^0.292.0",
|
||||||
"next": "14.0.3",
|
"next": "14.0.3",
|
||||||
|
"next-nprogress-bar": "^2.1.2",
|
||||||
"next-themes": "^0.2.1",
|
"next-themes": "^0.2.1",
|
||||||
"nextjs-toploader": "^1.6.4",
|
"nextjs-toploader": "^1.6.4",
|
||||||
"npm": "^10.2.5",
|
"npm": "^10.2.5",
|
||||||
|
|
@ -4556,6 +4557,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/next-nprogress-bar": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/next-nprogress-bar/-/next-nprogress-bar-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-2Df5d7fr6uPx+BX8MkoWCfl+RjG+uWI5mA399e5sEe8mbT3q/GIUvCXLzBgJBIISpKuMmdLAOYEzqpjlsRVOWw==",
|
||||||
|
"dependencies": {
|
||||||
|
"nprogress": "^0.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/next-themes": {
|
"node_modules/next-themes": {
|
||||||
"version": "0.2.1",
|
"version": "0.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.2.1.tgz",
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@
|
||||||
"leaflet-geosearch": "^3.11.0",
|
"leaflet-geosearch": "^3.11.0",
|
||||||
"lucide-react": "^0.292.0",
|
"lucide-react": "^0.292.0",
|
||||||
"next": "14.0.3",
|
"next": "14.0.3",
|
||||||
|
"next-nprogress-bar": "^2.1.2",
|
||||||
"next-themes": "^0.2.1",
|
"next-themes": "^0.2.1",
|
||||||
"nextjs-toploader": "^1.6.4",
|
"nextjs-toploader": "^1.6.4",
|
||||||
"npm": "^10.2.5",
|
"npm": "^10.2.5",
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,39 @@
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { CookieValueTypes } from "cookies-next";
|
import {
|
||||||
|
CookieValueTypes,
|
||||||
|
deleteCookie,
|
||||||
|
getCookie,
|
||||||
|
setCookie,
|
||||||
|
} from "cookies-next";
|
||||||
|
|
||||||
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
||||||
|
|
||||||
|
axios.interceptors.response.use(
|
||||||
|
(response) => {
|
||||||
|
return response;
|
||||||
|
},
|
||||||
|
async function (error) {
|
||||||
|
console.log(error);
|
||||||
|
const originalRequest = error.config;
|
||||||
|
if (error.response.status === 401) {
|
||||||
|
const accessToken = getCookie("Sootzani_Token");
|
||||||
|
const refreshToken = getCookie("Sootzani_Refresh_Token");
|
||||||
|
const data = await RefreshToken({
|
||||||
|
token: accessToken,
|
||||||
|
refreshToken: refreshToken,
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
// if (error.response.status === 403 && !originalRequest._retry) {
|
||||||
|
// originalRequest._retry = true;
|
||||||
|
// const access_token = await refreshAccessToken();
|
||||||
|
// axios.defaults.headers.common["Authorization"] = "Bearer " + access_token;
|
||||||
|
// return axiosApiInstance(originalRequest);
|
||||||
|
// }
|
||||||
|
return Promise.reject(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
export async function loginStaff(payload: {
|
export async function loginStaff(payload: {
|
||||||
username: string;
|
username: string;
|
||||||
password: string;
|
password: string;
|
||||||
|
|
@ -16,8 +47,7 @@ export async function loginStaff(payload: {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function verifyStaff(payload: {
|
export async function verifyStaff(payload: {
|
||||||
username: string;
|
otpToken: string | null;
|
||||||
password: string;
|
|
||||||
verificationCode: string;
|
verificationCode: string;
|
||||||
}) {
|
}) {
|
||||||
const data = await axios.post("api/Authenticate/VerifyStaff", payload);
|
const data = await axios.post("api/Authenticate/VerifyStaff", payload);
|
||||||
|
|
@ -66,3 +96,16 @@ export async function editProfile(payload: {
|
||||||
const data = await axios.put("api/Authenticate/Profile", payload);
|
const data = await axios.put("api/Authenticate/Profile", payload);
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function RefreshToken(payload: { token: any; refreshToken: any }) {
|
||||||
|
try {
|
||||||
|
const response = await axios.post("api/Authenticate/Refresh", payload);
|
||||||
|
setCookie("Sootzani_Token", response.data.jwtToken);
|
||||||
|
setCookie("Sootzani_Refresh_Token", response.data.refreshToken);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
deleteCookie("Sootzani_Token");
|
||||||
|
deleteCookie("Sootzani_Refresh_Token");
|
||||||
|
window.location.href = "/";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
// import useToken from "@/store/useToken";
|
// import useToken from "@/store/useToken";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { CookieValueTypes, getCookie } from "cookies-next";
|
import { CookieValueTypes, getCookie } from "cookies-next";
|
||||||
|
import { RefreshToken } from "./authenticateApi";
|
||||||
|
|
||||||
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
||||||
|
|
||||||
|
|
@ -16,10 +17,18 @@ export async function getPossibleStates() {
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getComplaintsList(states: number = 0) {
|
export async function getComplaintsList({
|
||||||
|
states = 0,
|
||||||
|
TrackingNumber,
|
||||||
|
}: {
|
||||||
|
states: number;
|
||||||
|
TrackingNumber?: string;
|
||||||
|
}) {
|
||||||
// export async function getComplaintsList() {
|
// export async function getComplaintsList() {
|
||||||
// const data = await axios.get(`api/Inspector/List`);
|
// const data = await axios.get(`api/Inspector/List`);
|
||||||
const data = await axios.get(`api/Inspector/List?States=${states}`);
|
const data = await axios.get(`api/Inspector/List?States=${states}`, {
|
||||||
|
params: { TrackingNumber: TrackingNumber },
|
||||||
|
});
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue