Compare commits

...

3 Commits

20 changed files with 443 additions and 414 deletions

View File

@ -15,7 +15,7 @@ export default function RootLayout({
return (
<>
<NavbarPanel />
<div className="mt-10 mx-auto px-2">{children}</div>
<div className="px-2 mx-auto mt-10">{children}</div>
</>
);
}

View File

@ -8,6 +8,7 @@ import Provider from "../utils/Provider";
import { Toaster as SonnerToaster } from "@/components/ui/sonner";
const inter = Inter({ subsets: ["latin"] });
import { Suspense } from "react";
import ProgressBarProviders from "@/components/PrograssBar";
export const metadata: Metadata = {
title: "عیون",
@ -24,7 +25,7 @@ export default function RootLayout({
<body className="font-[yekan] bg-white">
<Provider>
{/* <Suspense fallback={<Loading />}>{children}</Suspense> */}
{children}
<ProgressBarProviders>{children}</ProgressBarProviders>
<Toaster />
<SonnerToaster />
</Provider>

View File

@ -149,14 +149,9 @@ export default function AdminCategories() {
className: "!bg-green-500 !text-white",
});
},
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenEdit(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
},
});
@ -174,12 +169,9 @@ export default function AdminCategories() {
className: "!bg-green-500 !text-white",
});
},
onError: (error) => {
console.log(error);
console.log(error?.message);
toast(error?.message, {
className: "!bg-red-500 !text-black",
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
},
});
@ -200,14 +192,9 @@ export default function AdminCategories() {
className: "!bg-green-500 !text-white",
});
},
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenAdd(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
},
});
@ -230,9 +217,9 @@ export default function AdminCategories() {
return (
<div className="w-full min-h-[85vh] flex justify-center">
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
<div className="flex w-full justify-between flex-row ">
<div className="flex flex-row justify-between w-full ">
{/* 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>
{/* 2 */}
@ -243,7 +230,7 @@ export default function AdminCategories() {
<Button
variant="outline"
// onClick={handleClickAddCat}
className="bg-orange-500 text-white"
className="text-white bg-orange-500"
// disabled={isNewKeyLoading}
>
افزودن دسته بندی
@ -255,21 +242,21 @@ export default function AdminCategories() {
<p className="text-[#464646] text-base font-bold">
افزودن دسته بندی
</p>
<AlertDialogCancel className="p-0 border-0 h-auto">
<AlertDialogCancel className="h-auto p-0 border-0">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
<AlertDialogDescription>
<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>
<Form {...formAdd}>
<form
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">
<FormField
@ -313,14 +300,14 @@ export default function AdminCategories() {
/>
</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
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>
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
بستن
</AlertDialogCancel>
</div>
@ -335,7 +322,7 @@ export default function AdminCategories() {
</AlertDialogContent>
</AlertDialog>
</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}>
<AlertDialogContent className=" w-full max-w-3xl h-full lg:max-h-[25em] max-h-[23em]">
<AlertDialogHeader>
@ -343,7 +330,7 @@ export default function AdminCategories() {
<p className="text-[#464646] text-base font-bold">
تغییر دسته بندی
</p>
<AlertDialogCancel className="p-0 border-0 h-auto">
<AlertDialogCancel className="h-auto p-0 border-0">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
@ -352,7 +339,7 @@ export default function AdminCategories() {
<Form {...formEdit}>
<form
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">
<FormField
@ -382,7 +369,7 @@ export default function AdminCategories() {
<FormControl>
<Textarea
placeholder="توضیحات"
className="resize-none bg-white"
className="bg-white resize-none"
{...field}
/>
</FormControl>
@ -392,15 +379,15 @@ export default function AdminCategories() {
/>
</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
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>
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
بستن
</AlertDialogCancel>
</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]
`}
>
<p className=" text-slate-500 text-sm font-normal leading-normal">
عنوان :
<span className=" text-slate-800">{item.title}</span>
<p className="text-sm font-normal leading-normal text-slate-500">
عنوان :<span className=" text-slate-800">{item.title}</span>
</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}
</span>
</p>
<div className="w-full flex justify-end items-end gap-2">
<div className="flex items-end justify-end w-full gap-2">
<Switch
dir="ltr"
checked={!item.isDeleted}
@ -447,7 +433,7 @@ export default function AdminCategories() {
{/* <Button variant="outline">Show Dialog</Button> */}
<FaRegEdit
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={() =>
handleClickEdit(

View File

@ -118,14 +118,9 @@ export default function AdminKeysManagement() {
// router.refresh()
},
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenEdit(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
},
});
@ -171,13 +166,9 @@ export default function AdminKeysManagement() {
// inputPubRef.current.clear();
// router.refresh()
},
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenAdd(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
},
});
@ -273,14 +264,14 @@ export default function AdminKeysManagement() {
<p className="text-[#464646] text-base font-bold">
افزودن کلید جدید
</p>
<AlertDialogCancel className="p-0 border-0 h-auto">
<AlertDialogCancel className="h-auto p-0 border-0">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
<AlertDialogDescription>
<div className=" w-full flex justify-between">
<div className="w-full text-right text-neutral-600 text-lg font-bold mt-4 mb-2">
<div className="flex justify-between w-full ">
<div className="w-full mt-4 mb-2 text-lg font-bold text-right text-neutral-600">
افزودن کلید جدید
</div>
@ -297,7 +288,7 @@ export default function AdminKeysManagement() {
<Form {...formAdd}>
<form
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">
<FormField
@ -342,10 +333,10 @@ export default function AdminKeysManagement() {
/>
</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
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>
@ -361,21 +352,21 @@ export default function AdminKeysManagement() {
</AlertDialogContent>
{/* 2 */}
<div className=" w-full flex justify-between items-center mt-1">
<div className="w-full text-right text-neutral-600 text-lg font-bold my-4">
<div className="flex items-center justify-between w-full mt-1 ">
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
لیست کلیدها
</div>
<AlertDialogTrigger asChild>
<Button
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}
>
افزودن کلید جدید
</Button>
</AlertDialogTrigger>
</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) => {
return (
<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]
`}
>
<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>
</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}
</span>
</p>
@ -399,7 +390,7 @@ export default function AdminKeysManagement() {
{/* <Button variant="outline">Show Dialog</Button> */}
<FaRegEdit
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)}
/>
</AlertDialogTrigger>
@ -410,7 +401,7 @@ export default function AdminKeysManagement() {
<Form {...formEdit}>
<form
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">
<FormField
@ -426,7 +417,7 @@ export default function AdminKeysManagement() {
required={true}
type="file"
accept=".txt"
className="bg-slate-300 mt-2"
className="mt-2 bg-slate-300"
// {...field}
onChange={handleFileChange}
/>
@ -446,7 +437,7 @@ export default function AdminKeysManagement() {
</FormLabel>
<FormControl>
<Input
className="bg-slate-300 mt-2"
className="mt-2 bg-slate-300"
value={item?.id}
readOnly={true}
// {...field}
@ -458,23 +449,23 @@ export default function AdminKeysManagement() {
/> */}
</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
// href="/FollowResult"
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>
{/* <AlertDialogAction
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> */}
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
بستن
</AlertDialogCancel>
</div>

View File

@ -220,14 +220,9 @@ export default function AdminNews() {
className: "!bg-green-500 !text-white",
});
},
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenEdit(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
},
});
@ -245,12 +240,9 @@ export default function AdminNews() {
className: "!bg-green-500 !text-white",
});
},
onError: (error) => {
console.log(error);
console.log(error?.message);
toast(error?.message, {
className: "!bg-red-500 !text-black",
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
},
});
@ -271,14 +263,9 @@ export default function AdminNews() {
className: "!bg-green-500 !text-white",
});
},
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenAdd(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
},
});
@ -330,9 +317,9 @@ export default function AdminNews() {
return (
<div className="w-full min-h-[85vh] flex justify-center">
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
<div className="flex w-full justify-between flex-row ">
<div className="flex flex-row justify-between w-full ">
{/* 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>
{/* 2 */}
@ -343,7 +330,7 @@ export default function AdminNews() {
<Button
variant="outline"
// onClick={handleClickAddCat}
className="bg-orange-500 text-white"
className="text-white bg-orange-500"
// disabled={isNewKeyLoading}
>
افزودن خبر
@ -355,7 +342,7 @@ export default function AdminNews() {
<p className="text-[#464646] text-base font-bold">
افزودن خبر
</p>
<AlertDialogCancel className="p-0 border-0 h-auto">
<AlertDialogCancel className="h-auto p-0 border-0">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
@ -365,7 +352,7 @@ export default function AdminNews() {
<Form {...formAdd}>
<form
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">
<FormField
@ -501,14 +488,14 @@ export default function AdminNews() {
/>
</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
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>
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
بستن
</AlertDialogCancel>
</div>
@ -523,7 +510,7 @@ export default function AdminNews() {
</AlertDialogContent>
</AlertDialog>
</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}>
<AlertDialogContent className=" w-full max-w-3xl h-full lg:max-h-[28em] max-h-screen sm:max-h-[27em]">
<AlertDialogHeader>
@ -531,7 +518,7 @@ export default function AdminNews() {
<p className="text-[#464646] text-base font-bold">
تغییر خبر
</p>
<AlertDialogCancel className="p-0 border-0 h-auto">
<AlertDialogCancel className="h-auto p-0 border-0">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
@ -539,7 +526,7 @@ export default function AdminNews() {
<Form {...formEdit}>
<form
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">
<FormField
@ -675,15 +662,15 @@ export default function AdminNews() {
/>
</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
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>
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
بستن
</AlertDialogCancel>
</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]
`}
>
<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>
</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}
</span>
</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}
</span>
</p>
@ -723,10 +710,10 @@ export default function AdminNews() {
width={100}
height={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
dir="ltr"
checked={!item.isDeleted}
@ -740,7 +727,7 @@ export default function AdminNews() {
{/* <Button variant="outline">Show Dialog</Button> */}
<FaRegEdit
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={() =>
handleClickEdit(

View File

@ -152,14 +152,9 @@ export default function AdminOrganizations() {
className: "!bg-green-500 !text-white",
});
},
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenEdit(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
},
});
@ -177,12 +172,9 @@ export default function AdminOrganizations() {
className: "!bg-green-500 !text-white",
});
},
onError: (error) => {
console.log(error);
console.log(error?.message);
toast(error?.message, {
className: "!bg-red-500 !text-black",
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
},
});
@ -203,14 +195,9 @@ export default function AdminOrganizations() {
className: "!bg-green-500 !text-white",
});
},
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenAdd(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
},
});
@ -233,9 +220,9 @@ export default function AdminOrganizations() {
return (
<div className="w-full min-h-[85vh] flex justify-center">
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
<div className="flex w-full justify-between flex-row ">
<div className="flex flex-row justify-between w-full ">
{/* 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>
{/* 2 */}
@ -246,7 +233,7 @@ export default function AdminOrganizations() {
<Button
variant="outline"
// onClick={handleClickAddCat}
className="bg-orange-500 text-white"
className="text-white bg-orange-500"
// disabled={isNewKeyLoading}
>
افزودن سازمان
@ -258,21 +245,21 @@ export default function AdminOrganizations() {
<p className="text-[#464646] text-base font-bold">
افزودن سازمان
</p>
<AlertDialogCancel className="p-0 border-0 h-auto">
<AlertDialogCancel className="h-auto p-0 border-0">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
<AlertDialogDescription>
<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>
<Form {...formAdd}>
<form
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">
<FormField
@ -316,14 +303,14 @@ export default function AdminOrganizations() {
/>
</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
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>
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
بستن
</AlertDialogCancel>
</div>
@ -338,7 +325,7 @@ export default function AdminOrganizations() {
</AlertDialogContent>
</AlertDialog>
</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}>
<AlertDialogContent className=" w-full max-w-3xl h-full lg:max-h-[25em] max-h-[23em]">
<AlertDialogHeader>
@ -346,7 +333,7 @@ export default function AdminOrganizations() {
<p className="text-[#464646] text-base font-bold">
تغییر سازمان
</p>
<AlertDialogCancel className="p-0 border-0 h-auto">
<AlertDialogCancel className="h-auto p-0 border-0">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
@ -354,7 +341,7 @@ export default function AdminOrganizations() {
<Form {...formEdit}>
<form
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">
<FormField
@ -384,7 +371,7 @@ export default function AdminOrganizations() {
<FormControl>
<Textarea
placeholder="توضیحات"
className="resize-none bg-white"
className="bg-white resize-none"
{...field}
/>
</FormControl>
@ -394,15 +381,15 @@ export default function AdminOrganizations() {
/>
</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
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>
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
بستن
</AlertDialogCancel>
</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]
`}
>
<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>
</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}
</span>
</p>
<div className="w-full flex justify-end items-end gap-2">
<div className="flex items-end justify-end w-full gap-2">
<Switch
dir="ltr"
checked={!item.isDeleted}
@ -449,7 +436,7 @@ export default function AdminOrganizations() {
{/* <Button variant="outline">Show Dialog</Button> */}
<FaRegEdit
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={() =>
handleClickEdit(

View File

@ -212,14 +212,9 @@ const ChangeSliderMutation = useMutation({
className: "!bg-green-500 !text-white",
});
},
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenEdit(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
},
});
@ -237,12 +232,9 @@ const DeleteSliderMutation = useMutation({
className: "!bg-green-500 !text-white",
});
},
onError: (error) => {
console.log(error);
console.log(error?.message);
toast(error?.message, {
className: "!bg-red-500 !text-black",
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
},
});
@ -263,14 +255,9 @@ const AddSliderMutation = useMutation({
className: "!bg-green-500 !text-white",
});
},
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenAdd(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
},
});
@ -317,9 +304,9 @@ function onSubmitAdd(data: AddSliderFormValues) {
return (
<div className="w-full min-h-[85vh] flex justify-center">
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
<div className="flex w-full justify-between flex-row ">
<div className="flex flex-row justify-between w-full ">
{/* 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>
{/* 2 */}
@ -330,7 +317,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
<Button
variant="outline"
// onClick={handleClickAddCat}
className="bg-orange-500 text-white"
className="text-white bg-orange-500"
// disabled={isNewKeyLoading}
>
افزودن اسلایدر
@ -342,7 +329,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
<p className="text-[#464646] text-base font-bold">
افزودن اسلایدر
</p>
<AlertDialogCancel className="p-0 border-0 h-auto">
<AlertDialogCancel className="h-auto p-0 border-0">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
@ -352,7 +339,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
<Form {...formAdd}>
<form
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">
<FormField
@ -472,14 +459,14 @@ function onSubmitAdd(data: AddSliderFormValues) {
</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
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>
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
بستن
</AlertDialogCancel>
</div>
@ -494,7 +481,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
</AlertDialogContent>
</AlertDialog>
</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}>
<AlertDialogContent className=" w-full max-w-3xl h-full lg:max-h-[28em] max-h-screen sm:max-h-[27em]">
<AlertDialogHeader>
@ -502,7 +489,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
<p className="text-[#464646] text-base font-bold">
تغییر اسلایدر
</p>
<AlertDialogCancel className="p-0 border-0 h-auto">
<AlertDialogCancel className="h-auto p-0 border-0">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
@ -510,7 +497,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
<Form {...formEdit}>
<form
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">
<FormField
@ -630,15 +617,15 @@ function onSubmitAdd(data: AddSliderFormValues) {
</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
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>
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
بستن
</AlertDialogCancel>
</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]
`}
>
<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>
</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}
</span>
</p>
@ -672,17 +659,17 @@ function onSubmitAdd(data: AddSliderFormValues) {
width={100}
height={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}
</span>
</p> */}
<div className="w-full flex justify-end items-end gap-2">
<div className="flex items-end justify-end w-full gap-2">
<Switch
dir="ltr"
checked={!item.isDeleted}
@ -698,7 +685,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
{/* <Button variant="outline">Show Dialog</Button> */}
<FaRegEdit
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={() =>
handleClickEdit(

View File

@ -129,12 +129,9 @@ export default function AdminWebContents() {
});
refetch1();
},
onError: (error) => {
console.log(error);
console.log(error?.message);
toast(error?.message, {
className: "!bg-red-500 !text-black",
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
},
});
@ -147,17 +144,14 @@ export default function AdminWebContents() {
console.log(res);
console.log("Success Change UpdateWebContents");
toast("عملیات ویرایش شما با موفقیت انجام شد . ", {
className: "!bg-green-500 !text-white",
});
refetch1();
},
onError: (error) => {
console.log(error?.message);
toast(error?.message, {
className: "!bg-red-500 !text-black",
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
},
});
@ -239,8 +233,8 @@ export default function AdminWebContents() {
<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 ">
{/* Cull Us */}
<div className="w-full flex flex-col">
<div className=" text-right text-neutral-600 text-base font-bold my-4">
<div className="flex flex-col w-full">
<div className="my-4 text-base font-bold text-right text-neutral-600">
محتوای تماس با ما
</div>
@ -262,15 +256,15 @@ export default function AdminWebContents() {
// setContentTitle("Test");
// setContentDesc("Test....");
}}
className="w-1/6 self-end my-2"
className="self-end w-1/6 my-2"
>
ثبت
</Button>
</div>
{/* About Us */}
<div className="w-full flex flex-col">
<div className=" text-right text-neutral-600 text-base font-bold my-4">
<div className="flex flex-col w-full">
<div className="my-4 text-base font-bold text-right text-neutral-600">
محتوای درباره ما
</div>
@ -290,15 +284,15 @@ export default function AdminWebContents() {
onEditAboutUs();
}
}}
className="w-1/6 self-end my-2"
className="self-end w-1/6 my-2"
>
ثبت
</Button>
</div>
{/* AfterRegistration */}
<div className="w-full flex flex-col">
<div className=" text-right text-neutral-600 text-base font-bold my-4">
<div className="flex flex-col w-full">
<div className="my-4 text-base font-bold text-right text-neutral-600">
محتوای بعد از ثبت گزارش
</div>
@ -318,15 +312,15 @@ export default function AdminWebContents() {
onEditAfterText();
}
}}
className="w-1/6 self-end my-2"
className="self-end w-1/6 my-2"
>
ثبت
</Button>
</div>
{/* BeforeRegistration*/}
<div className="w-full flex flex-col">
<div className=" text-right text-neutral-600 text-base font-bold my-4">
<div className="flex flex-col w-full">
<div className="my-4 text-base font-bold text-right text-neutral-600">
محتوای قبل از ثبت گزارش
</div>
@ -346,7 +340,7 @@ export default function AdminWebContents() {
onEditBeforeText();
}
}}
className="w-1/6 self-end my-2"
className="self-end w-1/6 my-2"
>
ثبت
</Button>

View File

@ -57,7 +57,11 @@ export default function ComplainsDetails({
onSuccess: (res) => {
localStorage.setItem("trackingNumber", res.trackingNumber);
},
onError: (err) => {},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
},
});
useEffect(() => {
@ -214,7 +218,7 @@ export default function ComplainsDetails({
className="bg-white hover:bg-white focus:bg-white"
/>
</div>
<div className="flex items-center space-x-2 px-8">
<div className="flex items-center px-8 space-x-2">
<Checkbox
checked={check}
onCheckedChange={setCheck}
@ -258,7 +262,7 @@ export default function ComplainsDetails({
onClick={() =>
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>
<ArrowRight />
@ -266,7 +270,7 @@ export default function ComplainsDetails({
<p>بازگشت</p>
</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 */}
<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">
@ -283,11 +287,11 @@ export default function ComplainsDetails({
</div>
</div>
{/* 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">
{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>
@ -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>
@ -352,7 +356,7 @@ export default function ComplainsDetails({
</span>
</p>
</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>
@ -388,14 +392,14 @@ export default function ComplainsDetails({
</div>
<div className="bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col">
<p className="text-[#464646] text-base font-bold">روند شکایت</p>
<div className=" flex flex-col gap-y-4 mt-4">
<div className="flex flex-col mt-4 gap-y-4">
{data.contents?.map((item: any) => {
return (
<div
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="">
<Badge>
{item.sender == 0 ? "شهروند" : "بازرس"}
@ -417,7 +421,7 @@ export default function ComplainsDetails({
<Separator className="mt-2 mb-1 " />
)}
<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) => {
return (
<div
@ -428,7 +432,7 @@ export default function ComplainsDetails({
onClick={() =>
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 " />
<p className=" max-w-[5rem] truncate">
@ -475,7 +479,7 @@ export default function ComplainsDetails({
) : (
<>
{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
visible={true}

View File

@ -91,7 +91,11 @@ export default function InspectorOperations({
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>) {
@ -199,7 +203,7 @@ export default function InspectorOperations({
/>
)}
<div className=" flex justify-between mt-3 gap-2">
<div className="flex justify-between gap-2 mt-3 ">
<FormField
control={form.control}
name="operation"
@ -247,7 +251,7 @@ export default function InspectorOperations({
/>
<Button
disabled={possibleOperations.length == 0}
className=" bg-blue w-1/3"
className="w-1/3 bg-blue"
type="submit"
>
ثبت

View File

@ -58,16 +58,14 @@ export default function Login() {
const loginMutation = useMutation({
mutationFn: loginStaff,
onSuccess: (res) => {},
onError: (err: any | string) => {
if (err.response.status == 428) {
console.log(useData);
onSuccess: (res) => {
router.push("/Verify");
} else {
toast("مشکلی در ارسال درخواست به وجود آمد.", {
localStorage.setItem("verificationToken", res);
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
}
},
});
@ -97,12 +95,12 @@ export default function Login() {
: null;
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
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"
>
<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 " />
<p className="text-lg font-bold leading-tight tracking-tight text-blue dark:text-white">
@ -112,7 +110,7 @@ export default function Login() {
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
className="w-full flex flex-col "
className="flex flex-col w-full "
>
<FormField
control={form.control}
@ -158,13 +156,13 @@ export default function Login() {
</FormItem>
)}
/>
<div className="flex gap-3 mt-4 items-center">
<div className="flex items-center gap-3 mt-4">
<FormField
control={form.control}
name="captcha"
rules={{ required: true }}
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> */}
@ -176,7 +174,7 @@ export default function Login() {
)}
/>
{isLoading ? (
<div className=" w-36 flex justify-center text-center">
<div className="flex justify-center text-center w-36">
<ThreeDots
visible={true}
height="50"
@ -189,7 +187,7 @@ export default function Login() {
/>
</div>
) : (
<div className=" flex items-center justify-center text-center gap-2">
<div className="flex items-center justify-center gap-2 text-center ">
<Image
alt="icon"
src={srcForImage as string}
@ -206,14 +204,14 @@ export default function Login() {
</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
disabled={loginMutation.isPending}
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 ? (
<div className="flex justify-center items-center gap-2">
<div className="flex items-center justify-center gap-2">
<Oval
visible={true}
height="20"

View File

@ -42,10 +42,7 @@ export default function NavbarPanel() {
return (
<div
className="fixed flex justify-between items-center gap-3
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
"
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 "
>
<div className="flex items-center gap-8 max-md:gap-4">
<div className=" md:hidden">
@ -57,7 +54,7 @@ export default function NavbarPanel() {
color="#fff"
/>
</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>}
</p>
@ -127,8 +124,8 @@ export default function NavbarPanel() {
)}
</div>
</div>
<div className=" flex gap-4 items-center">
<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">
<div className="flex items-center gap-4 ">
<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 && (
<>
{role === "Admin"
@ -137,7 +134,7 @@ export default function NavbarPanel() {
</>
)}
</h1>
<div className="hover:bg-white/50 p-1 rounded-md">
<div className="p-1 rounded-md hover:bg-white/50">
<LogOut
onClick={() => {
deleteCookie("Sootzani_Token");

View File

@ -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;

View File

@ -18,14 +18,24 @@ import {
} from "@/components/ui/alert-dialog";
import { IoMdClose } from "react-icons/io";
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(() => {
// const isMobile = useMediaQuery({ query: "(max-width: 768px)" });
// }, []);
return (
<div>
{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
// type="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"
}
`}
value={value}
onChange={(e) => changeValue(e.target.value)}
placeholder="جستجو..."
required
/>
{/* <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 />
</Button> */}
<button className="absolute left-3">
<button onClick={action} className="absolute left-3">
<CiSearch />
</button>
</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
// type="search"
id="default-search"
@ -78,7 +90,7 @@ export default function Search({ mode }: { mode: string }) {
<button
// variant="outline"
// 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 />
</button>
@ -90,7 +102,7 @@ export default function Search({ mode }: { mode: string }) {
<p className="text-[#464646] text-base font-bold">
فرم جستجو
</p>
<AlertDialogCancel className="p-0 border-0 h-auto">
<AlertDialogCancel className="h-auto p-0 border-0">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
@ -105,7 +117,7 @@ export default function Search({ mode }: { mode: string }) {
required
/>
<button className="absolute left-16 text-black">
<button className="absolute text-black left-16">
<CiSearch />
</button>
</AlertDialogDescription>

View File

@ -25,6 +25,7 @@ import { toast } from "sonner";
export default function TabController() {
const saveData = useData((state) => state.saveData);
const [selectedFile, setSelectedFile] = useState<any>(null);
const [search, setSearch] = useState<any>(null);
const router = useRouter();
const handleFileChange = (event: any) => {
const file = event.target.files[0];
@ -51,11 +52,10 @@ export default function TabController() {
});
}
};
console.log(search);
const [psblState, setPsblState] = useState(0);
const [selectedTab, setSelectedTab] = useState("0");
const {
data: dataState,
isLoading: isLoadingState,
@ -69,24 +69,27 @@ export default function TabController() {
// const initialSelectedTab = dataState[0]?.value || '';
// setSelectedTab(initialSelectedTab);
const { data, isLoading, refetch } = useQuery({
queryKey: ["ComplaintsList", psblState, dataState],
queryFn: () => getComplaintsList(psblState),
queryFn: () =>
getComplaintsList({ states: psblState, TrackingNumber: search }),
refetchOnWindowFocus: false,
});
const handelSearch = (event: any) => {
refetch();
};
// useEffect(() => {
// // Handle the data after it has been updated
// }, [data]);
return (
<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>
<Tabs
defaultValue='0'
defaultValue="0"
value={selectedTab}
// onClick={(value) => {
// setPsblState(value);
@ -96,10 +99,10 @@ export default function TabController() {
className=""
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 */}
<TabsList className="w-full flex gap-1 md:gap-4 lg:gap-3">
<p className="3xl:ml-6 text-xs sm:text-sm font-bold max-md:hidden">
<TabsList className="flex w-full gap-1 md:gap-4 lg:gap-3">
<p className="text-xs font-bold 3xl:ml-6 sm:text-sm max-md:hidden">
لیست شکایت ها |
</p>
@ -124,7 +127,12 @@ export default function TabController() {
</TabsList>
{/* Search Box */}
<Search mode="controller" />
<Search
value={search}
changeValue={(data: any) => setSearch(data)}
mode="controller"
action={handelSearch}
/>
</div>
{/* Tab Content */}
@ -132,7 +140,6 @@ export default function TabController() {
<TabsContent value={selectedTab} key={selectedTab}>
<TableController checkKey={(item) => checkKey(item)} data={data} />
</TabsContent>
</Tabs>
</div>
);

View File

@ -10,7 +10,7 @@ import { useRouter } from "next/navigation";
import useData from "@/store/useData";
import { JwtPayload, jwtDecode } from "jwt-decode";
import { setCookie } from "cookies-next";
import { Oval } from "react-loader-spinner";
import { Oval, Triangle } from "react-loader-spinner";
import { toast } from "sonner";
export default function Verify() {
@ -18,12 +18,13 @@ export default function Verify() {
const space = "\xa0";
const router = useRouter();
const userData = useData((state) => state.data);
const [VerifyRole, setVerifyRole] = useState<any>("");
const verifyMutation = useMutation({
mutationFn: verifyStaff,
onSuccess: (res) => {
const decodedToken = jwtDecode<any>(res);
setCookie("Sootzani_Token", res);
const decodedToken = jwtDecode<any>(res.jwtToken);
setCookie("Sootzani_Token", res.jwtToken);
setCookie("Sootzani_Refresh_Token", res.refreshToken);
const userRole =
decodedToken[
"http://schemas.microsoft.com/ws/2008/06/identity/claims/role"
@ -33,41 +34,14 @@ export default function Verify() {
router.push("/UserPanel/ControllerDashboard");
} else if (userRole == "Admin") {
router.push("/UserPanel/AdminDashboard");
} else {
router.push("/UserPanel/CitizenDashboard");
}
},
onError: (err: any) => {
toast("کد تایید شما صحیح نمیباشد.", {
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
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(() => {
useData.persist.rehydrate();
@ -75,19 +49,36 @@ export default function Verify() {
useEffect(() => {
if (otp.length == 6) {
const payload = { ...userData, verificationCode: otp };
const payload = {
otpToken: localStorage.getItem("verificationToken"),
verificationCode: otp,
};
console.log(userData);
verifyMutation.mutate(payload);
}
}, [otp]);
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
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 " />
<p className="text-lg font-bold leading-tight tracking-tight text-blue dark:text-white">
تایید کد
@ -102,23 +93,25 @@ export default function Verify() {
<input autoFocus={idx == 0} pattern="[0-9]*" {...props} />
)}
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>
<label className="label text-center">
<span className="text-xs text-blue/70 label-text text-center">
<label className="text-center label">
<span className="text-xs text-center text-blue/70 label-text">
کد دریافت شده توسط پیامک را وارد نمایید.
</span>
</label>
{/* <div className="flex justify-end gap-2 w-full mt-14">
{/* <div className="flex justify-end w-full gap-2 mt-14">
<Button
disabled={verifyMutation.isPending}
onClick={handelVerify}
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 ? (
<div className="flex justify-center items-center gap-2">
<div className="flex items-center justify-center gap-2">
<Oval
visible={true}
height="20"

9
package-lock.json generated
View File

@ -44,6 +44,7 @@
"leaflet-geosearch": "^3.11.0",
"lucide-react": "^0.292.0",
"next": "14.0.3",
"next-nprogress-bar": "^2.1.2",
"next-themes": "^0.2.1",
"nextjs-toploader": "^1.6.4",
"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": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.2.1.tgz",

View File

@ -45,6 +45,7 @@
"leaflet-geosearch": "^3.11.0",
"lucide-react": "^0.292.0",
"next": "14.0.3",
"next-nprogress-bar": "^2.1.2",
"next-themes": "^0.2.1",
"nextjs-toploader": "^1.6.4",
"npm": "^10.2.5",

View File

@ -1,8 +1,39 @@
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.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: {
username: string;
password: string;
@ -16,8 +47,7 @@ export async function loginStaff(payload: {
}
export async function verifyStaff(payload: {
username: string;
password: string;
otpToken: string | null;
verificationCode: string;
}) {
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);
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 = "/";
}
}

View File

@ -2,6 +2,7 @@
// import useToken from "@/store/useToken";
import axios from "axios";
import { CookieValueTypes, getCookie } from "cookies-next";
import { RefreshToken } from "./authenticateApi";
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
@ -16,10 +17,18 @@ export async function getPossibleStates() {
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() {
// 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;
}