Compare commits

..

No commits in common. "19f1031c37526b8ffb331aa5b81e2e6f8dc2f825" and "90d7a8377b60d67037645e0f58ceeeb4c497acdf" have entirely different histories.

20 changed files with 414 additions and 443 deletions

View File

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

View File

@ -8,7 +8,6 @@ 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: "عیون",
@ -25,7 +24,7 @@ export default function RootLayout({
<body className="font-[yekan] bg-white">
<Provider>
{/* <Suspense fallback={<Loading />}>{children}</Suspense> */}
<ProgressBarProviders>{children}</ProgressBarProviders>
{children}
<Toaster />
<SonnerToaster />
</Provider>

View File

@ -89,7 +89,7 @@ export default function AdminCategories() {
queryKey: ["CategoriesList"],
queryFn: () => GetAllCategories(),
// refetchOnWindowFocus: false,
});
});
// Edit
const handleClickEdit = (id: string, title: string, description: string) => {
@ -149,9 +149,14 @@ export default function AdminCategories() {
className: "!bg-green-500 !text-white",
});
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenEdit(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
});
},
});
@ -169,9 +174,12 @@ export default function AdminCategories() {
className: "!bg-green-500 !text-white",
});
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
onError: (error) => {
console.log(error);
console.log(error?.message);
toast(error?.message, {
className: "!bg-red-500 !text-black",
});
},
});
@ -192,9 +200,14 @@ export default function AdminCategories() {
className: "!bg-green-500 !text-white",
});
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenAdd(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
});
},
});
@ -206,20 +219,20 @@ export default function AdminCategories() {
title: data.titleCat,
description: data.description,
},
});
});
}
function onSubmitAdd(data: AddCatFormValues) {
AddCatMutation.mutate({
title: data.titleCategory,
description: data.description,
});
});
}
return (
<div className="w-full min-h-[85vh] flex justify-center">
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
<div className="flex flex-row justify-between w-full ">
<div className="flex w-full justify-between flex-row ">
{/* 1 */}
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
<div className="w-full text-right text-neutral-600 text-lg font-bold my-4">
لیست دسته بندی ها
</div>
{/* 2 */}
@ -230,7 +243,7 @@ export default function AdminCategories() {
<Button
variant="outline"
// onClick={handleClickAddCat}
className="text-white bg-orange-500"
className="bg-orange-500 text-white"
// disabled={isNewKeyLoading}
>
افزودن دسته بندی
@ -242,28 +255,28 @@ export default function AdminCategories() {
<p className="text-[#464646] text-base font-bold">
افزودن دسته بندی
</p>
<AlertDialogCancel className="h-auto p-0 border-0">
<AlertDialogCancel className="p-0 border-0 h-auto">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
<AlertDialogDescription>
<div className="w-full ">
<div className="w-full mb-2 text-lg font-bold text-right text-neutral-600">
<div className="w-full text-right text-neutral-600 text-lg font-bold mb-2">
افزودن دسته بندی
</div>
<Form {...formAdd}>
<form
onSubmit={formAdd.handleSubmit(onSubmitAdd)}
className="flex flex-col w-full mt-6 "
className="w-full flex flex-col mt-6 "
>
<div className="flex flex-col flex-wrap justify-between">
<FormField
control={formAdd.control}
name="titleCategory"
render={({ field }) => (
<FormItem className="w-full ">
<FormItem className=" w-full ">
<FormLabel className="text-[#7C838A] text-sm font-medium">
عنوان دسته بندی
</FormLabel>
@ -283,7 +296,7 @@ export default function AdminCategories() {
control={formAdd.control}
name="description"
render={({ field }) => (
<FormItem className="w-full ">
<FormItem className=" w-full ">
<FormLabel className="text-[#7C838A] text-sm font-medium ">
توضیحات
</FormLabel>
@ -300,14 +313,14 @@ export default function AdminCategories() {
/>
</div>
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
<Button
type="submit"
className="text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
className="bg-blue text-white min-w-max rounded-xl text-center hover:bg-white hover:text-slate-800"
>
افزودن
</Button>
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
بستن
</AlertDialogCancel>
</div>
@ -322,7 +335,7 @@ export default function AdminCategories() {
</AlertDialogContent>
</AlertDialog>
</div>
<div className="flex flex-row flex-wrap justify-between w-full gap-8 md:gap-4 ">
<div className="w-full flex flex-row flex-wrap justify-between 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>
@ -330,7 +343,7 @@ export default function AdminCategories() {
<p className="text-[#464646] text-base font-bold">
تغییر دسته بندی
</p>
<AlertDialogCancel className="h-auto p-0 border-0">
<AlertDialogCancel className="p-0 border-0 h-auto">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
@ -339,20 +352,20 @@ export default function AdminCategories() {
<Form {...formEdit}>
<form
onSubmit={formEdit.handleSubmit(onSubmitEdit)}
className="flex flex-col w-full"
className="w-full flex flex-col"
>
<div className="flex flex-col flex-wrap justify-between">
<FormField
control={formEdit.control}
name="titleCat"
render={({ field }) => (
<FormItem className="w-full ">
<FormItem className=" w-full ">
<FormLabel>عنوان</FormLabel>
<FormControl>
<Input
placeholder="عنوان"
{...field}
className="bg-white "
className=" bg-white"
/>
</FormControl>
<FormMessage />
@ -364,12 +377,12 @@ export default function AdminCategories() {
control={formEdit.control}
name="description"
render={({ field }) => (
<FormItem className="w-full ">
<FormItem className=" w-full ">
<FormLabel>توضیحات</FormLabel>
<FormControl>
<Textarea
placeholder="توضیحات"
className="bg-white resize-none"
className="resize-none bg-white"
{...field}
/>
</FormControl>
@ -379,15 +392,15 @@ export default function AdminCategories() {
/>
</div>
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
<Button
type="submit"
className="p-2 text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
className="bg-blue text-white min-w-max p-2 rounded-xl text-center hover:bg-white hover:text-slate-800"
>
تغییر دسته بندی
</Button>
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
بستن
</AlertDialogCancel>
</div>
@ -404,17 +417,18 @@ 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-sm font-normal leading-normal text-slate-500">
عنوان :<span className=" text-slate-800">{item.title}</span>
<p className=" text-slate-500 text-sm font-normal leading-normal">
عنوان :
<span className=" text-slate-800">{item.title}</span>
</p>
<p className="text-sm font-normal leading-normal text-slate-500">
<p className=" text-slate-500 text-sm font-normal leading-normal">
توضیحات:
<span className="self-end text-slate-800">
<span className=" text-slate-800 self-end">
{item.description}
</span>
</p>
<div className="flex items-end justify-end w-full gap-2">
<div className="w-full flex justify-end items-end gap-2">
<Switch
dir="ltr"
checked={!item.isDeleted}
@ -433,7 +447,7 @@ export default function AdminCategories() {
{/* <Button variant="outline">Show Dialog</Button> */}
<FaRegEdit
aria-hidden="true"
className="self-end w-6 h-6 text-slate-600 hover:cursor-pointer"
className="w-6 h-6 text-slate-600 hover:cursor-pointer self-end"
// onClick={() => setKeyId(item?.id)}
onClick={() =>
handleClickEdit(

View File

@ -118,9 +118,14 @@ export default function AdminKeysManagement() {
// router.refresh()
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenEdit(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
});
},
});
@ -166,9 +171,13 @@ export default function AdminKeysManagement() {
// inputPubRef.current.clear();
// router.refresh()
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenAdd(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
});
},
});
@ -258,20 +267,20 @@ export default function AdminKeysManagement() {
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
{/* 1 */}
<AlertDialog open={openAdd} onOpenChange={setOpenAdd}>
<AlertDialogContent className="">
<AlertDialogContent className=" ">
<AlertDialogHeader>
<AlertDialogTitle>
<p className="text-[#464646] text-base font-bold">
افزودن کلید جدید
</p>
<AlertDialogCancel className="h-auto p-0 border-0">
<AlertDialogCancel className="p-0 border-0 h-auto">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
<AlertDialogDescription>
<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 className=" w-full flex justify-between">
<div className="w-full text-right text-neutral-600 text-lg font-bold mt-4 mb-2">
افزودن کلید جدید
</div>
@ -288,14 +297,14 @@ export default function AdminKeysManagement() {
<Form {...formAdd}>
<form
onSubmit={formAdd.handleSubmit(onSubmitAdd)}
className="flex flex-col w-full mt-6 "
className="w-full flex flex-col mt-6 "
>
<div className="flex flex-col flex-wrap justify-between">
<FormField
control={formAdd.control}
name="title"
render={({ field }) => (
<FormItem className="w-full ">
<FormItem className=" w-full ">
<FormLabel className="text-[#7C838A] text-sm font-medium">
عنوان کلید
</FormLabel>
@ -315,7 +324,7 @@ export default function AdminKeysManagement() {
control={formAdd.control}
name="publicKey"
render={({ field }) => (
<FormItem className="w-full ">
<FormItem className=" w-full">
<FormLabel className="text-[#7C838A] text-sm font-medium ">
کلید عمومی
</FormLabel>
@ -333,10 +342,10 @@ export default function AdminKeysManagement() {
/>
</div>
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
<Button
type="submit"
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"
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"
>
افزودن کلید
</Button>
@ -352,21 +361,21 @@ export default function AdminKeysManagement() {
</AlertDialogContent>
{/* 2 */}
<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 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>
<AlertDialogTrigger asChild>
<Button
variant="outline"
className="text-white bg-orange-500 hover:bg-orange-500/80 hover:text-white"
className="bg-orange-500 hover:bg-orange-500/80 text-white hover:text-white"
// disabled={isNewKeyLoading}
>
افزودن کلید جدید
</Button>
</AlertDialogTrigger>
</div>
<div className="flex flex-row flex-wrap justify-between w-full gap-8 md:gap-4 ">
<div className="w-full flex flex-row flex-wrap justify-between gap-8 md:gap-4 ">
{data1?.map((item: any) => {
return (
<div
@ -374,13 +383,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-sm font-normal leading-normal text-slate-500">
<p className=" text-slate-500 text-sm font-normal leading-normal">
عنوان کلید:{" "}
<span className=" text-slate-800">{item.title}</span>
<span className=" text-slate-800">{item.title}</span>
</p>
<p className="text-sm font-normal leading-normal text-slate-500">
<p className=" text-slate-500 text-sm font-normal leading-normal">
آیدی بازرس:{" "}
<span className="self-end text-slate-800">
<span className=" text-slate-800 self-end">
{item.inspectorId}
</span>
</p>
@ -390,7 +399,7 @@ export default function AdminKeysManagement() {
{/* <Button variant="outline">Show Dialog</Button> */}
<FaRegEdit
aria-hidden="true"
className="self-end w-6 h-6 text-slate-600 hover:cursor-pointer"
className="w-6 h-6 text-slate-600 hover:cursor-pointer self-end"
onClick={() => setKeyId(item?.id)}
/>
</AlertDialogTrigger>
@ -401,14 +410,14 @@ export default function AdminKeysManagement() {
<Form {...formEdit}>
<form
onSubmit={formEdit.handleSubmit(onSubmitEdit)}
className="flex flex-col w-full mt-6 "
className="w-full flex flex-col mt-6 "
>
<div className="flex flex-row flex-wrap justify-between">
<FormField
control={formEdit.control}
name="uploadPrivateKey"
render={({ field }) => (
<FormItem className="w-full ">
<FormItem className=" w-full">
<FormLabel className="text-[#7C838A] text-sm font-medium mb-2">
پیوست (کلید خصوصی)
</FormLabel>
@ -417,7 +426,7 @@ export default function AdminKeysManagement() {
required={true}
type="file"
accept=".txt"
className="mt-2 bg-slate-300"
className="bg-slate-300 mt-2"
// {...field}
onChange={handleFileChange}
/>
@ -437,7 +446,7 @@ export default function AdminKeysManagement() {
</FormLabel>
<FormControl>
<Input
className="mt-2 bg-slate-300"
className="bg-slate-300 mt-2"
value={item?.id}
readOnly={true}
// {...field}
@ -449,23 +458,23 @@ export default function AdminKeysManagement() {
/> */}
</div>
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
<Button
// href="/FollowResult"
type="submit"
className="p-2 text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
className="bg-blue text-white min-w-max p-2 rounded-xl text-center hover:bg-white hover:text-slate-800"
>
تغییر کلید
</Button>
{/* <AlertDialogAction
type="submit"
className="p-2 text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
className="bg-blue text-white min-w-max p-2 rounded-xl text-center hover:bg-white hover:text-slate-800"
>
تغییر کلید
</AlertDialogAction> */}
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
بستن
</AlertDialogCancel>
</div>

View File

@ -220,9 +220,14 @@ export default function AdminNews() {
className: "!bg-green-500 !text-white",
});
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenEdit(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
});
},
});
@ -240,9 +245,12 @@ export default function AdminNews() {
className: "!bg-green-500 !text-white",
});
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
onError: (error) => {
console.log(error);
console.log(error?.message);
toast(error?.message, {
className: "!bg-red-500 !text-black",
});
},
});
@ -263,9 +271,14 @@ export default function AdminNews() {
className: "!bg-green-500 !text-white",
});
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenAdd(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
});
},
});
@ -317,9 +330,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 flex-row justify-between w-full ">
<div className="flex w-full justify-between flex-row ">
{/* 1 */}
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
<div className="w-full text-right text-neutral-600 text-lg font-bold my-4">
لیست خبر ها
</div>
{/* 2 */}
@ -330,7 +343,7 @@ export default function AdminNews() {
<Button
variant="outline"
// onClick={handleClickAddCat}
className="text-white bg-orange-500"
className="bg-orange-500 text-white"
// disabled={isNewKeyLoading}
>
افزودن خبر
@ -342,7 +355,7 @@ export default function AdminNews() {
<p className="text-[#464646] text-base font-bold">
افزودن خبر
</p>
<AlertDialogCancel className="h-auto p-0 border-0">
<AlertDialogCancel className="p-0 border-0 h-auto">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
@ -352,20 +365,20 @@ export default function AdminNews() {
<Form {...formAdd}>
<form
onSubmit={formAdd.handleSubmit(onSubmitAdd)}
className="flex flex-col w-full "
className="w-full flex flex-col "
>
<div className="flex flex-row flex-wrap justify-between">
<FormField
control={formAdd.control}
name="titleNews"
render={({ field }) => (
<FormItem className="w-full ">
<FormItem className=" w-full ">
<FormLabel> عنوان خبر</FormLabel>
<FormControl>
<Input
placeholder="عنوان خبر را وارد نمایید"
{...field}
className="bg-white "
className=" bg-white"
/>
</FormControl>
<FormMessage />
@ -415,7 +428,7 @@ export default function AdminNews() {
<FormControl>
<Input
type="file"
className="mb-3 bg-white"
className="mb-3 bg-white"
accept="image/*"
multiple={false} // Allow only one file
disabled={formAdd.formState.isSubmitting}
@ -444,7 +457,7 @@ export default function AdminNews() {
<Input
placeholder="لینک"
{...field}
className="bg-white "
className=" bg-white"
/>
</FormControl>
<FormMessage />
@ -488,14 +501,14 @@ export default function AdminNews() {
/>
</div>
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
<Button
type="submit"
className="text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
className="bg-blue text-white min-w-max rounded-xl text-center hover:bg-white hover:text-slate-800"
>
افزودن
</Button>
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
بستن
</AlertDialogCancel>
</div>
@ -510,7 +523,7 @@ export default function AdminNews() {
</AlertDialogContent>
</AlertDialog>
</div>
<div className="flex flex-row flex-wrap justify-between w-full gap-8 md:gap-4 ">
<div className="w-full flex flex-row flex-wrap justify-between 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>
@ -518,7 +531,7 @@ export default function AdminNews() {
<p className="text-[#464646] text-base font-bold">
تغییر خبر
</p>
<AlertDialogCancel className="h-auto p-0 border-0">
<AlertDialogCancel className="p-0 border-0 h-auto">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
@ -526,20 +539,20 @@ export default function AdminNews() {
<Form {...formEdit}>
<form
onSubmit={formEdit.handleSubmit(onSubmitEdit)}
className="flex flex-col w-full"
className="w-full flex flex-col"
>
<div className="flex flex-row flex-wrap justify-between">
<FormField
control={formEdit.control}
name="titleNews"
render={({ field }) => (
<FormItem className="w-full ">
<FormItem className=" w-full ">
<FormLabel>عنوان</FormLabel>
<FormControl>
<Input
placeholder="عنوان"
{...field}
className="bg-white "
className=" bg-white"
/>
</FormControl>
<FormMessage />
@ -589,7 +602,7 @@ export default function AdminNews() {
<FormControl>
<Input
type="file"
className="mb-3 bg-white"
className="mb-3 bg-white"
accept="image/*"
multiple={false} // Allow only one file
disabled={formEdit.formState.isSubmitting}
@ -618,7 +631,7 @@ export default function AdminNews() {
<Input
placeholder="لینک"
{...field}
className="bg-white "
className=" bg-white"
/>
</FormControl>
<FormMessage />
@ -662,15 +675,15 @@ export default function AdminNews() {
/>
</div>
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
<Button
type="submit"
className="p-2 text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
className="bg-blue text-white min-w-max p-2 rounded-xl text-center hover:bg-white hover:text-slate-800"
>
تغییر خبر
</Button>
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
بستن
</AlertDialogCancel>
</div>
@ -688,19 +701,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-sm font-normal leading-normal text-slate-500">
<p className=" text-slate-500 text-sm font-normal leading-normal">
عنوان :
<span className=" text-slate-800">{item.title}</span>
<span className=" text-slate-800">{item.title}</span>
</p>
<p className="text-sm font-normal leading-normal text-slate-500">
<p className=" text-slate-500 text-sm font-normal leading-normal">
توضیحات:
<span className="self-end text-slate-800">
<span className=" text-slate-800 self-end">
{item.description}
</span>
</p>
<p className="text-sm font-normal leading-normal text-slate-500">
<p className=" text-slate-500 text-sm font-normal leading-normal">
محتوا:
<span className="self-end text-slate-800">
<span className=" text-slate-800 self-end">
{item.content}
</span>
</p>
@ -710,10 +723,10 @@ export default function AdminNews() {
width={100}
height={100}
quality={100}
className="object-contain object-right w-full h-20 "
className=" w-full h-20 object-contain object-right"
/>
<div className="flex items-end justify-end w-full gap-2">
<div className="w-full flex justify-end items-end gap-2">
<Switch
dir="ltr"
checked={!item.isDeleted}
@ -727,7 +740,7 @@ export default function AdminNews() {
{/* <Button variant="outline">Show Dialog</Button> */}
<FaRegEdit
aria-hidden="true"
className="self-end w-6 h-6 text-slate-600 hover:cursor-pointer"
className="w-6 h-6 text-slate-600 hover:cursor-pointer self-end"
// onClick={() => setKeyId(item?.id)}
onClick={() =>
handleClickEdit(

View File

@ -152,9 +152,14 @@ export default function AdminOrganizations() {
className: "!bg-green-500 !text-white",
});
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenEdit(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
});
},
});
@ -172,9 +177,12 @@ export default function AdminOrganizations() {
className: "!bg-green-500 !text-white",
});
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
onError: (error) => {
console.log(error);
console.log(error?.message);
toast(error?.message, {
className: "!bg-red-500 !text-black",
});
},
});
@ -195,9 +203,14 @@ export default function AdminOrganizations() {
className: "!bg-green-500 !text-white",
});
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenAdd(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
});
},
});
@ -220,9 +233,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 flex-row justify-between w-full ">
<div className="flex w-full justify-between flex-row ">
{/* 1 */}
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
<div className="w-full text-right text-neutral-600 text-lg font-bold my-4">
لیست سازمان ها
</div>
{/* 2 */}
@ -233,7 +246,7 @@ export default function AdminOrganizations() {
<Button
variant="outline"
// onClick={handleClickAddCat}
className="text-white bg-orange-500"
className="bg-orange-500 text-white"
// disabled={isNewKeyLoading}
>
افزودن سازمان
@ -245,28 +258,28 @@ export default function AdminOrganizations() {
<p className="text-[#464646] text-base font-bold">
افزودن سازمان
</p>
<AlertDialogCancel className="h-auto p-0 border-0">
<AlertDialogCancel className="p-0 border-0 h-auto">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
<AlertDialogDescription>
<div className="w-full ">
<div className="w-full mb-2 text-lg font-bold text-right text-neutral-600">
<div className="w-full text-right text-neutral-600 text-lg font-bold mb-2">
سازمان ها
</div>
<Form {...formAdd}>
<form
onSubmit={formAdd.handleSubmit(onSubmitAdd)}
className="flex flex-col w-full mt-6 "
className="w-full flex flex-col mt-6 "
>
<div className="flex flex-col flex-wrap justify-between">
<FormField
control={formAdd.control}
name="titleOrg"
render={({ field }) => (
<FormItem className="w-full ">
<FormItem className=" w-full ">
<FormLabel className="text-[#7C838A] text-sm font-medium">
عنوان سازمان
</FormLabel>
@ -286,7 +299,7 @@ export default function AdminOrganizations() {
control={formAdd.control}
name="description"
render={({ field }) => (
<FormItem className="w-full ">
<FormItem className=" w-full ">
<FormLabel className="text-[#7C838A] text-sm font-medium ">
توضیحات
</FormLabel>
@ -303,14 +316,14 @@ export default function AdminOrganizations() {
/>
</div>
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
<Button
type="submit"
className="text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
className="bg-blue text-white min-w-max rounded-xl text-center hover:bg-white hover:text-slate-800"
>
افزودن
</Button>
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
بستن
</AlertDialogCancel>
</div>
@ -325,7 +338,7 @@ export default function AdminOrganizations() {
</AlertDialogContent>
</AlertDialog>
</div>
<div className="flex flex-row flex-wrap justify-between w-full gap-8 md:gap-4 ">
<div className="w-full flex flex-row flex-wrap justify-between 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>
@ -333,7 +346,7 @@ export default function AdminOrganizations() {
<p className="text-[#464646] text-base font-bold">
تغییر سازمان
</p>
<AlertDialogCancel className="h-auto p-0 border-0">
<AlertDialogCancel className="p-0 border-0 h-auto">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
@ -341,20 +354,20 @@ export default function AdminOrganizations() {
<Form {...formEdit}>
<form
onSubmit={formEdit.handleSubmit(onSubmitEdit)}
className="flex flex-col w-full"
className="w-full flex flex-col"
>
<div className="flex flex-col flex-wrap justify-between">
<FormField
control={formEdit.control}
name="titleOrg"
render={({ field }) => (
<FormItem className="w-full ">
<FormItem className=" w-full ">
<FormLabel>عنوان</FormLabel>
<FormControl>
<Input
placeholder="عنوان"
{...field}
className="bg-white "
className=" bg-white"
/>
</FormControl>
<FormMessage />
@ -366,12 +379,12 @@ export default function AdminOrganizations() {
control={formEdit.control}
name="description"
render={({ field }) => (
<FormItem className="w-full ">
<FormItem className=" w-full ">
<FormLabel>توضیحات</FormLabel>
<FormControl>
<Textarea
placeholder="توضیحات"
className="bg-white resize-none"
className="resize-none bg-white"
{...field}
/>
</FormControl>
@ -381,15 +394,15 @@ export default function AdminOrganizations() {
/>
</div>
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
<Button
type="submit"
className="p-2 text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
className="bg-blue text-white min-w-max p-2 rounded-xl text-center hover:bg-white hover:text-slate-800"
>
تغییر سازمان
</Button>
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
بستن
</AlertDialogCancel>
</div>
@ -408,18 +421,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-sm font-normal leading-normal text-slate-500">
<p className=" text-slate-500 text-sm font-normal leading-normal">
عنوان :
<span className=" text-slate-800">{item.title}</span>
<span className=" text-slate-800">{item.title}</span>
</p>
<p className="text-sm font-normal leading-normal text-slate-500">
<p className=" text-slate-500 text-sm font-normal leading-normal">
توضیحات:
<span className="self-end text-slate-800">
<span className=" text-slate-800 self-end">
{item.description}
</span>
</p>
<div className="flex items-end justify-end w-full gap-2">
<div className="w-full flex justify-end items-end gap-2">
<Switch
dir="ltr"
checked={!item.isDeleted}
@ -436,7 +449,7 @@ export default function AdminOrganizations() {
{/* <Button variant="outline">Show Dialog</Button> */}
<FaRegEdit
aria-hidden="true"
className="self-end w-6 h-6 text-slate-600 hover:cursor-pointer"
className="w-6 h-6 text-slate-600 hover:cursor-pointer self-end"
// onClick={() => setKeyId(item?.id)}
onClick={() =>
handleClickEdit(

View File

@ -212,9 +212,14 @@ const ChangeSliderMutation = useMutation({
className: "!bg-green-500 !text-white",
});
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenEdit(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
});
},
});
@ -232,9 +237,12 @@ const DeleteSliderMutation = useMutation({
className: "!bg-green-500 !text-white",
});
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
onError: (error) => {
console.log(error);
console.log(error?.message);
toast(error?.message, {
className: "!bg-red-500 !text-black",
});
},
});
@ -255,9 +263,14 @@ const AddSliderMutation = useMutation({
className: "!bg-green-500 !text-white",
});
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
onError: (error) => {
console.log(error);
console.log(error?.message);
setOpenAdd(false);
toast(error?.message, {
className: "!bg-red-500 !text-black",
});
},
});
@ -304,9 +317,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 flex-row justify-between w-full ">
<div className="flex w-full justify-between flex-row ">
{/* 1 */}
<div className="w-full my-4 text-lg font-bold text-right text-neutral-600">
<div className="w-full text-right text-neutral-600 text-lg font-bold my-4">
لیست اسلایدرها
</div>
{/* 2 */}
@ -317,7 +330,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
<Button
variant="outline"
// onClick={handleClickAddCat}
className="text-white bg-orange-500"
className="bg-orange-500 text-white"
// disabled={isNewKeyLoading}
>
افزودن اسلایدر
@ -329,7 +342,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
<p className="text-[#464646] text-base font-bold">
افزودن اسلایدر
</p>
<AlertDialogCancel className="h-auto p-0 border-0">
<AlertDialogCancel className="p-0 border-0 h-auto">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
@ -339,20 +352,20 @@ function onSubmitAdd(data: AddSliderFormValues) {
<Form {...formAdd}>
<form
onSubmit={formAdd.handleSubmit(onSubmitAdd)}
className="flex flex-col w-full "
className="w-full flex flex-col "
>
<div className="flex flex-row flex-wrap justify-between">
<FormField
control={formAdd.control}
name="titleSlider"
render={({ field }) => (
<FormItem className="w-full ">
<FormItem className=" w-full ">
<FormLabel> عنوان اسلایدر</FormLabel>
<FormControl>
<Input
placeholder="عنوان اسلایدر را وارد نمایید"
{...field}
className="bg-white "
className=" bg-white"
/>
</FormControl>
<FormMessage />
@ -402,7 +415,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
<FormControl>
<Input
type="file"
className="mb-3 bg-white"
className="mb-3 bg-white"
accept="image/*"
multiple={false} // Allow only one file
disabled={formAdd.formState.isSubmitting}
@ -431,7 +444,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
<Input
placeholder="لینک"
{...field}
className="bg-white "
className=" bg-white"
/>
</FormControl>
<FormMessage />
@ -459,14 +472,14 @@ function onSubmitAdd(data: AddSliderFormValues) {
</div>
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
<Button
type="submit"
className="text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
className="bg-blue text-white min-w-max rounded-xl text-center hover:bg-white hover:text-slate-800"
>
افزودن
</Button>
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
بستن
</AlertDialogCancel>
</div>
@ -481,7 +494,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
</AlertDialogContent>
</AlertDialog>
</div>
<div className="flex flex-row flex-wrap justify-between w-full gap-8 md:gap-4 ">
<div className="w-full flex flex-row flex-wrap justify-between 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>
@ -489,7 +502,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
<p className="text-[#464646] text-base font-bold">
تغییر اسلایدر
</p>
<AlertDialogCancel className="h-auto p-0 border-0">
<AlertDialogCancel className="p-0 border-0 h-auto">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
@ -497,20 +510,20 @@ function onSubmitAdd(data: AddSliderFormValues) {
<Form {...formEdit}>
<form
onSubmit={formEdit.handleSubmit(onSubmitEdit)}
className="flex flex-col w-full"
className="w-full flex flex-col"
>
<div className="flex flex-row flex-wrap justify-between">
<FormField
control={formEdit.control}
name="titleSlider"
render={({ field }) => (
<FormItem className="w-full ">
<FormItem className=" w-full ">
<FormLabel>عنوان</FormLabel>
<FormControl>
<Input
placeholder="عنوان"
{...field}
className="bg-white "
className=" bg-white"
/>
</FormControl>
<FormMessage />
@ -560,7 +573,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
<FormControl>
<Input
type="file"
className="mb-3 bg-white"
className="mb-3 bg-white"
accept="image/*"
multiple={false} // Allow only one file
disabled={formEdit.formState.isSubmitting}
@ -589,7 +602,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
<Input
placeholder="لینک"
{...field}
className="bg-white "
className=" bg-white"
/>
</FormControl>
<FormMessage />
@ -617,15 +630,15 @@ function onSubmitAdd(data: AddSliderFormValues) {
</div>
<div className="flex justify-center w-full gap-2 mt-8 sm:justify-end">
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
<Button
type="submit"
className="p-2 text-center text-white bg-blue min-w-max rounded-xl hover:bg-white hover:text-slate-800"
className="bg-blue text-white min-w-max p-2 rounded-xl text-center hover:bg-white hover:text-slate-800"
>
تغییر اسلایدر
</Button>
<AlertDialogCancel className="mt-0 text-white bg-blue rounded-xl">
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
بستن
</AlertDialogCancel>
</div>
@ -643,13 +656,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-sm font-normal leading-normal text-slate-500">
<p className=" text-slate-500 text-sm font-normal leading-normal">
عنوان :
<span className=" text-slate-800">{item.title}</span>
<span className=" text-slate-800">{item.title}</span>
</p>
<p className="text-sm font-normal leading-normal text-slate-500">
<p className=" text-slate-500 text-sm font-normal leading-normal">
توضیحات:
<span className="self-end text-slate-800">
<span className=" text-slate-800 self-end">
{item.description}
</span>
</p>
@ -659,17 +672,17 @@ function onSubmitAdd(data: AddSliderFormValues) {
width={100}
height={100}
quality={100}
className="object-contain object-right w-full h-20 "
className=" w-full h-20 object-contain object-right"
/>
{/* <p className="text-sm font-normal leading-normal text-slate-500">
{/* <p className=" text-slate-500 text-sm font-normal leading-normal">
محتوا:
<span className="self-end text-slate-800">
<span className=" text-slate-800 self-end">
{item.content}
</span>
</p> */}
<div className="flex items-end justify-end w-full gap-2">
<div className="w-full flex justify-end items-end gap-2">
<Switch
dir="ltr"
checked={!item.isDeleted}
@ -685,7 +698,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
{/* <Button variant="outline">Show Dialog</Button> */}
<FaRegEdit
aria-hidden="true"
className="self-end w-6 h-6 text-slate-600 hover:cursor-pointer"
className="w-6 h-6 text-slate-600 hover:cursor-pointer self-end"
// onClick={() => setKeyId(item?.id)}
onClick={() =>
handleClickEdit(

View File

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

View File

@ -57,11 +57,7 @@ export default function ComplainsDetails({
onSuccess: (res) => {
localStorage.setItem("trackingNumber", res.trackingNumber);
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
},
onError: (err) => {},
});
useEffect(() => {
@ -215,15 +211,15 @@ export default function ComplainsDetails({
onChange={handleFileChange}
type="file"
accept=".txt"
className="bg-white hover:bg-white focus:bg-white"
className=" bg-white hover:bg-white focus:bg-white"
/>
</div>
<div className="flex items-center px-8 space-x-2">
<div className="flex items-center space-x-2 px-8">
<Checkbox
checked={check}
onCheckedChange={setCheck}
id="terms"
className="ml-2 "
className=" ml-2"
/>
<label
htmlFor="terms"
@ -262,7 +258,7 @@ export default function ComplainsDetails({
onClick={() =>
router.push("/UserPanel/ControllerDashboard/Complaints")
}
className="flex gap-1 my-2 cursor-pointer text-blue lg:sticky top-20"
className=" my-2 flex gap-1 cursor-pointer text-blue lg:sticky top-20"
>
<span>
<ArrowRight />
@ -270,7 +266,7 @@ export default function ComplainsDetails({
<p>بازگشت</p>
</button>
<div className="flex items-start w-full gap-2 mt-2 max-lg:flex-col">
<div className="w-full flex max-lg:flex-col items-start mt-2 gap-2">
{/* 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">
@ -287,11 +283,11 @@ export default function ComplainsDetails({
</div>
</div>
{/* 2 */}
<div className="flex flex-col self-stretch w-full gap-2 rounded-lg lg:w-2/3 ">
<div className="w-full lg:w-2/3 self-stretch rounded-lg flex flex-col gap-2 ">
<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="relative flex flex-col w-full p-5 mt-2 border border-gray-400 rounded-md gap-y-1">
<div className="mt-2 flex flex-col gap-y-1 border rounded-md border-gray-400 w-full p-5 relative">
<p className=" absolute -top-3 right-2 bg-[#E9E9E9] px-2 text-sm text-gray-500">
اطلاعات کلی
</p>
@ -325,7 +321,7 @@ export default function ComplainsDetails({
</>
) : (
<>
<div className="relative flex flex-col p-5 mt-2 border border-gray-400 rounded-md gap-y-1 md:w-1/2">
<div className="mt-2 flex flex-col gap-y-1 border rounded-md border-gray-400 md:w-1/2 p-5 relative">
<p className=" absolute -top-3 right-2 bg-[#E9E9E9] px-2 text-sm text-gray-500">
اطلاعات کلی
</p>
@ -356,7 +352,7 @@ export default function ComplainsDetails({
</span>
</p>
</div>
<div className="relative flex flex-col p-5 mt-2 border border-gray-400 rounded-md gap-y-1 md:w-1/2">
<div className="mt-2 flex flex-col gap-y-1 border rounded-md border-gray-400 md:w-1/2 p-5 relative">
<p className=" absolute -top-3 right-2 bg-[#E9E9E9] px-2 text-sm text-gray-500">
اطلاعات شاکی
</p>
@ -392,14 +388,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 mt-4 gap-y-4">
<div className=" flex flex-col gap-y-4 mt-4">
{data.contents?.map((item: any) => {
return (
<div
key={item.id}
className="p-4 bg-white rounded-lg shadow-md "
className=" bg-white p-4 rounded-lg shadow-md"
>
<div className="flex items-center gap-4 ">
<div className=" flex gap-4 items-center">
<p className="">
<Badge>
{item.sender == 0 ? "شهروند" : "بازرس"}
@ -418,10 +414,10 @@ export default function ComplainsDetails({
</span>
</div>
{item.media.length !== 0 && (
<Separator className="mt-2 mb-1 " />
<Separator className=" mt-2 mb-1" />
)}
<div className=" text-[#464646] mt-2">
<div className="flex flex-wrap items-center w-full gap-2 mt-2 text-xs max-md:flex-col">
<div className=" flex flex-wrap max-md:flex-col w-full items-center gap-2 text-xs mt-2">
{item?.media.map((item: any, index: number) => {
return (
<div
@ -432,15 +428,15 @@ export default function ComplainsDetails({
onClick={() =>
openFileInNewTab(item.data, item.mimeType)
}
className="flex items-center gap-2 truncate cursor-pointer "
className=" cursor-pointer flex gap-2 truncate items-center"
>
<File className="w-6 h-6 " />
<File className=" w-6 h-6" />
<p className=" max-w-[5rem] truncate">
{item.title}
</p>
</a>
<ArrowDownToLine
className="cursor-pointer "
className=" cursor-pointer"
onClick={() =>
downloadFile(
item.data,
@ -479,7 +475,7 @@ export default function ComplainsDetails({
) : (
<>
{getComplaintMutation.isPending && (
<div className="flex justify-center w-full h-full mt-20">
<div className="w-full h-full flex justify-center mt-20">
<Triangle
visible={true}

View File

@ -91,11 +91,7 @@ export default function InspectorOperations({
password: key2 ? key2 : (localStorage.getItem("privateKey") as string),
});
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
},
onError: (err) => {},
});
function onSubmit(data: z.infer<typeof FormSchema>) {
@ -147,7 +143,7 @@ export default function InspectorOperations({
/>
{/* <div className="grid w-full max-w-sm items-center gap-1.5 mt-1">
<Label htmlFor="picture">پیوست</Label>
<Input multiple id="picture" type="file" className="bg-white " />
<Input multiple id="picture" type="file" className=" bg-white" />
</div> */}
<FormField
control={form.control}
@ -164,7 +160,7 @@ export default function InspectorOperations({
console.log(e.target.files);
}}
multiple
className="bg-white "
className=" bg-white"
/>
</FormControl>
<FormMessage />
@ -185,13 +181,13 @@ export default function InspectorOperations({
>
<FormItem className="flex items-center space-x-3 space-y-0">
<FormControl>
<RadioGroupItem value="private" className="ml-2 " />
<RadioGroupItem value="private" className=" ml-2" />
</FormControl>
<FormLabel className="font-normal">خصوصی</FormLabel>
</FormItem>
<FormItem className="flex items-center space-x-3 space-y-0">
<FormControl>
<RadioGroupItem value="public" className="ml-2 " />
<RadioGroupItem value="public" className=" ml-2" />
</FormControl>
<FormLabel className="font-normal">عمومی</FormLabel>
</FormItem>
@ -203,12 +199,12 @@ export default function InspectorOperations({
/>
)}
<div className="flex justify-between gap-2 mt-3 ">
<div className=" flex justify-between mt-3 gap-2">
<FormField
control={form.control}
name="operation"
render={({ field }) => (
<FormItem className="flex-1 ">
<FormItem className=" flex-1">
{/* <FormLabel>Email</FormLabel> */}
<Select
onValueChange={field.onChange}
@ -221,7 +217,7 @@ export default function InspectorOperations({
dir="rtl"
>
<SelectValue
className="text-xs "
className=" text-xs"
placeholder="نوع عملیات را انتخاب نمایید."
/>
</SelectTrigger>
@ -251,7 +247,7 @@ export default function InspectorOperations({
/>
<Button
disabled={possibleOperations.length == 0}
className="w-1/3 bg-blue"
className=" bg-blue w-1/3"
type="submit"
>
ثبت

View File

@ -58,14 +58,16 @@ export default function Login() {
const loginMutation = useMutation({
mutationFn: loginStaff,
onSuccess: (res) => {
router.push("/Verify");
localStorage.setItem("verificationToken", res);
},
onSuccess: (res) => {},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
className: "!bg-red-500 !text-white",
});
if (err.response.status == 428) {
console.log(useData);
router.push("/Verify");
} else {
toast("مشکلی در ارسال درخواست به وجود آمد.", {
className: "!bg-red-500 !text-white",
});
}
},
});
@ -95,22 +97,22 @@ export default function Login() {
: null;
return (
<div className="grid w-screen h-screen bg-gray-200 place-content-center">
<div className=" w-screen h-screen grid place-content-center bg-gray-200 ">
<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="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">
<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">
<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>
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
className="flex flex-col w-full "
className="w-full flex flex-col "
>
<FormField
control={form.control}
@ -156,13 +158,13 @@ export default function Login() {
</FormItem>
)}
/>
<div className="flex items-center gap-3 mt-4">
<div className="flex gap-3 mt-4 items-center">
<FormField
control={form.control}
name="captcha"
rules={{ required: true }}
render={({ field }) => (
<FormItem className="items-center flex-1 h-10 ">
<FormItem className=" items-center h-10 flex-1">
{/* <FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
رمز عبور
</FormLabel> */}
@ -174,7 +176,7 @@ export default function Login() {
)}
/>
{isLoading ? (
<div className="flex justify-center text-center w-36">
<div className=" w-36 flex justify-center text-center">
<ThreeDots
visible={true}
height="50"
@ -187,31 +189,31 @@ export default function Login() {
/>
</div>
) : (
<div className="flex items-center justify-center gap-2 text-center ">
<div className=" flex items-center justify-center text-center gap-2">
<Image
alt="icon"
src={srcForImage as string}
className="h-12 rounded-md shadow-md w-36"
className=" h-12 rounded-md shadow-md w-36"
width={150}
height={20}
quality={100}
/>
<RefreshCcw
className="cursor-pointer "
className=" cursor-pointer"
onClick={() => refetch()}
color="#003778"
/>
</div>
)}
</div>
<div className="flex justify-end w-full gap-2 mt-14">
<div className="flex justify-end gap-2 w-full mt-14">
<Button
disabled={loginMutation.isPending}
type="submit"
className="w-1/2 p-2 text-white transition bg-blue hover:bg-blue/90 md:w-1/3 rounded-xl"
className="bg-blue hover:bg-blue/90 transition text-white w-1/2 md:w-1/3 p-2 rounded-xl"
>
{loginMutation.isPending ? (
<div className="flex items-center justify-center gap-2">
<div className="flex justify-center items-center gap-2">
<Oval
visible={true}
height="20"

View File

@ -42,9 +42,12 @@ export default function NavbarPanel() {
return (
<div
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 "
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
"
>
<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">
<Hamburger
toggled={isOpen}
@ -54,7 +57,7 @@ export default function NavbarPanel() {
color="#fff"
/>
</div>
<p className="inline-block text-sm font-bold text-white bg-clip-text max-md:text-sm max-md:font-medium">
<p className="text-white inline-block bg-clip-text text-sm font-bold max-md:text-sm max-md:font-medium">
پنل کاربری {<span className=" max-md:hidden">|</span>}
</p>
@ -100,7 +103,7 @@ export default function NavbarPanel() {
</motion.div>
)}
</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 && (
<>
{selectedMenu.map(
@ -124,8 +127,8 @@ export default function NavbarPanel() {
)}
</div>
</div>
<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">
<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">
{data && (
<>
{role === "Admin"
@ -134,7 +137,7 @@ export default function NavbarPanel() {
</>
)}
</h1>
<div className="p-1 rounded-md hover:bg-white/50">
<div className="hover:bg-white/50 p-1 rounded-md">
<LogOut
onClick={() => {
deleteCookie("Sootzani_Token");
@ -142,7 +145,7 @@ export default function NavbarPanel() {
localStorage.removeItem("privatePassword");
router.push("/");
}}
className="text-white cursor-pointer "
className=" text-white cursor-pointer"
/>
</div>
</div>

View File

@ -1,19 +0,0 @@
"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,24 +18,14 @@ import {
} from "@/components/ui/alert-dialog";
import { IoMdClose } from "react-icons/io";
import { useMediaQuery } from "react-responsive";
export default function Search({
mode,
value,
action,
changeValue,
}: {
mode: string;
value: any;
action: (any: any) => any;
changeValue: (any: any) => any;
}) {
export default function Search({ mode }: { mode: string }) {
// useEffect(() => {
// const isMobile = useMediaQuery({ query: "(max-width: 768px)" });
// }, []);
return (
<div>
{mode === "controller" || mode === "admin" ? (
<div className="relative flex items-center bg-gray-300 rounded-xl">
<div className="relative flex bg-gray-300 rounded-xl items-center">
<Input
// type="search"
id="default-search"
@ -48,23 +38,21 @@ export default function Search({
"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 w-auto h-auto bg-transparent text-slate-800"
className="absolute left-0 bg-transparent h-auto w-auto text-slate-800"
>
<CiSearch />
</Button> */}
<button onClick={action} className="absolute left-3">
<button className="absolute left-3">
<CiSearch />
</button>
</div>
) : (
<>
<div className="relative flex items-center bg-gray-300 max-md:hidden rounded-xl">
<div className=" max-md:hidden relative flex bg-gray-300 rounded-xl items-center">
<Input
// type="search"
id="default-search"
@ -90,7 +78,7 @@ export default function Search({
<button
// variant="outline"
// type="submit"
className="p-1 font-bold text-white rounded-md bg-gradient2"
className=" bg-gradient2 text-white font-bold rounded-md p-1"
>
<CiSearch />
</button>
@ -98,11 +86,11 @@ export default function Search({
<AlertDialogContent className=" h-1/5 min-w-[80%] max-w-fit">
<AlertDialogHeader className="w-full">
<AlertDialogTitle className="py-1 ">
<AlertDialogTitle className=" py-1">
<p className="text-[#464646] text-base font-bold">
فرم جستجو
</p>
<AlertDialogCancel className="h-auto p-0 border-0">
<AlertDialogCancel className="p-0 border-0 h-auto">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
@ -117,7 +105,7 @@ export default function Search({
required
/>
<button className="absolute text-black left-16">
<button className="absolute left-16 text-black">
<CiSearch />
</button>
</AlertDialogDescription>

View File

@ -25,7 +25,6 @@ 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];
@ -52,9 +51,10 @@ export default function TabController() {
});
}
};
console.log(search);
const [psblState, setPsblState] = useState(0);
const [selectedTab, setSelectedTab] = useState("0");
const [selectedTab, setSelectedTab] = useState("0");
const {
data: dataState,
@ -65,31 +65,28 @@ export default function TabController() {
queryFn: () => getPossibleStates(),
refetchOnWindowFocus: false,
});
// const initialSelectedTab = dataState[0]?.value || '';
// const initialSelectedTab = dataState[0]?.value || '';
// setSelectedTab(initialSelectedTab);
const { data, isLoading, refetch } = useQuery({
queryKey: ["ComplaintsList", psblState, dataState],
queryFn: () =>
getComplaintsList({ states: psblState, TrackingNumber: search }),
queryKey: ["ComplaintsList" ,psblState,dataState],
queryFn: () => getComplaintsList(psblState),
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="my-2 text-xs font-bold 3xl:ml-6 sm:text-sm md:hidden">
<p className="3xl:ml-6 text-xs sm:text-sm font-bold md:hidden my-2">
لیست شکایت ها
</p>
<Tabs
defaultValue="0"
defaultValue='0'
value={selectedTab}
// onClick={(value) => {
// setPsblState(value);
@ -99,10 +96,10 @@ export default function TabController() {
className=""
dir="rtl"
>
<div className="flex flex-col-reverse items-center justify-between w-full gap-4 mb-10 lg:flex-row lg:gap-5">
<div className="w-full flex flex-col-reverse lg:flex-row gap-4 lg:gap-5 justify-between items-center mb-10">
{/* Tab Title */}
<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">
<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">
لیست شکایت ها |
</p>
@ -127,19 +124,15 @@ export default function TabController() {
</TabsList>
{/* Search Box */}
<Search
value={search}
changeValue={(data: any) => setSearch(data)}
mode="controller"
action={handelSearch}
/>
<Search mode="controller" />
</div>
{/* Tab Content */}
<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, Triangle } from "react-loader-spinner";
import { Oval } from "react-loader-spinner";
import { toast } from "sonner";
export default function Verify() {
@ -18,13 +18,12 @@ 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.jwtToken);
setCookie("Sootzani_Token", res.jwtToken);
setCookie("Sootzani_Refresh_Token", res.refreshToken);
const decodedToken = jwtDecode<any>(res);
setCookie("Sootzani_Token", res);
const userRole =
decodedToken[
"http://schemas.microsoft.com/ws/2008/06/identity/claims/role"
@ -34,14 +33,41 @@ export default function Verify() {
router.push("/UserPanel/ControllerDashboard");
} else if (userRole == "Admin") {
router.push("/UserPanel/AdminDashboard");
}
} else {
router.push("/UserPanel/CitizenDashboard");
}
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {
onError: (err: any) => {
toast("کد تایید شما صحیح نمیباشد.", {
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();
@ -49,38 +75,21 @@ export default function Verify() {
useEffect(() => {
if (otp.length == 6) {
const payload = {
otpToken: localStorage.getItem("verificationToken"),
verificationCode: otp,
};
const payload = { ...userData, verificationCode: otp };
console.log(userData);
verifyMutation.mutate(payload);
}
}, [otp]);
return (
<div className="grid w-screen h-screen bg-gray-200 place-content-center">
<div className=" w-screen h-screen grid place-content-center bg-gray-200">
<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 relative"
h-fit"
>
{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">
<div className="space-y-3 md:space-y-4 flex flex-col md:py-12 md:px-20 h-full justify-center">
<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>
<div className="w-full " dir="ltr">
@ -93,25 +102,23 @@ 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 ${
verifyMutation.isSuccess && "border-green-600 transition-all"
}`}
inputStyle=" !w-10 rounded-md h-10 bg-[#F5F5F5] border border-blue/30 text-black"
/>
</div>
<label className="text-center label">
<span className="text-xs text-center text-blue/70 label-text">
<label className="label text-center">
<span className="text-xs text-blue/70 label-text text-center">
کد دریافت شده توسط پیامک را وارد نمایید.
</span>
</label>
{/* <div className="flex justify-end w-full gap-2 mt-14">
{/* <div className="flex justify-end gap-2 w-full mt-14">
<Button
disabled={verifyMutation.isPending}
onClick={handelVerify}
type="submit"
className="w-1/2 p-2 text-white bg-blue hover:bg-blue/90 md:w-1/3 rounded-xl"
className="bg-blue hover:bg-blue/90 text-white w-1/2 md:w-1/3 p-2 rounded-xl"
>
{verifyMutation.isPending ? (
<div className="flex items-center justify-center gap-2">
<div className="flex justify-center items-center gap-2">
<Oval
visible={true}
height="20"

9
package-lock.json generated
View File

@ -44,7 +44,6 @@
"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",
@ -4557,14 +4556,6 @@
}
}
},
"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,7 +45,6 @@
"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,39 +1,8 @@
import axios from "axios";
import {
CookieValueTypes,
deleteCookie,
getCookie,
setCookie,
} from "cookies-next";
import { CookieValueTypes } 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;
@ -47,7 +16,8 @@ export async function loginStaff(payload: {
}
export async function verifyStaff(payload: {
otpToken: string | null;
username: string;
password: string;
verificationCode: string;
}) {
const data = await axios.post("api/Authenticate/VerifyStaff", payload);
@ -96,16 +66,3 @@ 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,7 +2,6 @@
// 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;
@ -17,18 +16,10 @@ export async function getPossibleStates() {
return data.data;
}
export async function getComplaintsList({
states = 0,
TrackingNumber,
}: {
states: number;
TrackingNumber?: string;
}) {
export async function getComplaintsList(states: number = 0) {
// export async function getComplaintsList() {
// const data = await axios.get(`api/Inspector/List`);
const data = await axios.get(`api/Inspector/List?States=${states}`, {
params: { TrackingNumber: TrackingNumber },
});
const data = await axios.get(`api/Inspector/List?States=${states}`);
return data.data;
}