Response Errors handled + ProgressBar added
parent
cbc3aae112
commit
19f1031c37
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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,28 +242,28 @@ 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
|
||||
control={formAdd.control}
|
||||
name="titleCategory"
|
||||
render={({ field }) => (
|
||||
<FormItem className=" w-full ">
|
||||
<FormItem className="w-full ">
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium">
|
||||
عنوان دسته بندی
|
||||
</FormLabel>
|
||||
|
|
@ -296,7 +283,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>
|
||||
|
|
@ -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,20 +339,20 @@ 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
|
||||
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 />
|
||||
|
|
@ -377,12 +364,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="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(
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
@ -267,20 +258,20 @@ export default function AdminKeysManagement() {
|
|||
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
||||
{/* 1 */}
|
||||
<AlertDialog open={openAdd} onOpenChange={setOpenAdd}>
|
||||
<AlertDialogContent className=" ">
|
||||
<AlertDialogContent className="">
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>
|
||||
<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,14 +288,14 @@ 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
|
||||
control={formAdd.control}
|
||||
name="title"
|
||||
render={({ field }) => (
|
||||
<FormItem className=" w-full ">
|
||||
<FormItem className="w-full ">
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium">
|
||||
عنوان کلید
|
||||
</FormLabel>
|
||||
|
|
@ -324,7 +315,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>
|
||||
|
|
@ -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>
|
||||
<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,14 +401,14 @@ 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
|
||||
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>
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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,20 +352,20 @@ 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
|
||||
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 />
|
||||
|
|
@ -428,7 +415,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}
|
||||
|
|
@ -457,7 +444,7 @@ export default function AdminNews() {
|
|||
<Input
|
||||
placeholder="لینک"
|
||||
{...field}
|
||||
className=" bg-white"
|
||||
className="bg-white "
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
|
|
@ -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,20 +526,20 @@ 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
|
||||
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 />
|
||||
|
|
@ -602,7 +589,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}
|
||||
|
|
@ -631,7 +618,7 @@ export default function AdminNews() {
|
|||
<Input
|
||||
placeholder="لینک"
|
||||
{...field}
|
||||
className=" bg-white"
|
||||
className="bg-white "
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
|
|
@ -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>
|
||||
<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(
|
||||
|
|
|
|||
|
|
@ -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,28 +245,28 @@ 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
|
||||
control={formAdd.control}
|
||||
name="titleOrg"
|
||||
render={({ field }) => (
|
||||
<FormItem className=" w-full ">
|
||||
<FormItem className="w-full ">
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium">
|
||||
عنوان سازمان
|
||||
</FormLabel>
|
||||
|
|
@ -299,7 +286,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>
|
||||
|
|
@ -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,20 +341,20 @@ 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
|
||||
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 />
|
||||
|
|
@ -379,12 +366,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="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>
|
||||
<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(
|
||||
|
|
|
|||
|
|
@ -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,20 +339,20 @@ 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
|
||||
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 />
|
||||
|
|
@ -415,7 +402,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}
|
||||
|
|
@ -444,7 +431,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
|||
<Input
|
||||
placeholder="لینک"
|
||||
{...field}
|
||||
className=" bg-white"
|
||||
className="bg-white "
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
|
|
@ -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,20 +497,20 @@ 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
|
||||
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 />
|
||||
|
|
@ -573,7 +560,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}
|
||||
|
|
@ -602,7 +589,7 @@ function onSubmitAdd(data: AddSliderFormValues) {
|
|||
<Input
|
||||
placeholder="لینک"
|
||||
{...field}
|
||||
className=" bg-white"
|
||||
className="bg-white "
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
|
|
@ -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>
|
||||
<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(
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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(() => {
|
||||
|
|
@ -211,15 +215,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 space-x-2 px-8">
|
||||
<div className="flex items-center px-8 space-x-2">
|
||||
<Checkbox
|
||||
checked={check}
|
||||
onCheckedChange={setCheck}
|
||||
id="terms"
|
||||
className=" ml-2"
|
||||
className="ml-2 "
|
||||
/>
|
||||
<label
|
||||
htmlFor="terms"
|
||||
|
|
@ -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 ? "شهروند" : "بازرس"}
|
||||
|
|
@ -414,10 +418,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 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,15 +432,15 @@ 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" />
|
||||
<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,
|
||||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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>) {
|
||||
|
|
@ -143,7 +147,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}
|
||||
|
|
@ -160,7 +164,7 @@ export default function InspectorOperations({
|
|||
console.log(e.target.files);
|
||||
}}
|
||||
multiple
|
||||
className=" bg-white"
|
||||
className="bg-white "
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
|
|
@ -181,13 +185,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>
|
||||
|
|
@ -199,12 +203,12 @@ export default function InspectorOperations({
|
|||
/>
|
||||
)}
|
||||
|
||||
<div className=" flex justify-between mt-3 gap-2">
|
||||
<div className="flex justify-between gap-2 mt-3 ">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="operation"
|
||||
render={({ field }) => (
|
||||
<FormItem className=" flex-1">
|
||||
<FormItem className="flex-1 ">
|
||||
{/* <FormLabel>Email</FormLabel> */}
|
||||
<Select
|
||||
onValueChange={field.onChange}
|
||||
|
|
@ -217,7 +221,7 @@ export default function InspectorOperations({
|
|||
dir="rtl"
|
||||
>
|
||||
<SelectValue
|
||||
className=" text-xs"
|
||||
className="text-xs "
|
||||
placeholder="نوع عملیات را انتخاب نمایید."
|
||||
/>
|
||||
</SelectTrigger>
|
||||
|
|
@ -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"
|
||||
>
|
||||
ثبت
|
||||
|
|
|
|||
|
|
@ -60,10 +60,10 @@ export default function Login() {
|
|||
mutationFn: loginStaff,
|
||||
onSuccess: (res) => {
|
||||
router.push("/Verify");
|
||||
localStorage.setItem("verificationToken", res.verificationToken);
|
||||
localStorage.setItem("verificationToken", res);
|
||||
},
|
||||
onError: (err: any | string) => {
|
||||
toast("مشکلی در ارسال درخواست به وجود آمد.", {
|
||||
toast(<>{err.response.data.detail}</>, {
|
||||
className: "!bg-red-500 !text-white",
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
"use client";
|
||||
|
||||
import { AppProgressBar as ProgressBar } from "next-nprogress-bar";
|
||||
|
||||
const ProgressBarProviders = ({ children }: { children: React.ReactNode }) => {
|
||||
return (
|
||||
<>
|
||||
{children}
|
||||
<ProgressBar
|
||||
height="4px"
|
||||
color="#29D"
|
||||
options={{ showSpinner: false }}
|
||||
shallowRouting
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default ProgressBarProviders;
|
||||
|
|
@ -18,14 +18,24 @@ import {
|
|||
} from "@/components/ui/alert-dialog";
|
||||
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>
|
||||
|
|
@ -86,11 +98,11 @@ export default function Search({ mode }: { mode: string }) {
|
|||
|
||||
<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="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>
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
queryKey: ["ComplaintsList", psblState, dataState],
|
||||
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>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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,7 +18,7 @@ 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) => {
|
||||
|
|
@ -34,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();
|
||||
|
|
@ -89,8 +62,22 @@ export default function Verify() {
|
|||
<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"
|
||||
>
|
||||
{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">
|
||||
|
|
@ -106,7 +93,9 @@ 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="text-center label">
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import {
|
|||
getCookie,
|
||||
setCookie,
|
||||
} from "cookies-next";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
||||
|
||||
|
|
@ -14,6 +13,7 @@ axios.interceptors.response.use(
|
|||
return response;
|
||||
},
|
||||
async function (error) {
|
||||
console.log(error);
|
||||
const originalRequest = error.config;
|
||||
if (error.response.status === 401) {
|
||||
const accessToken = getCookie("Sootzani_Token");
|
||||
|
|
@ -30,7 +30,7 @@ axios.interceptors.response.use(
|
|||
// axios.defaults.headers.common["Authorization"] = "Bearer " + access_token;
|
||||
// return axiosApiInstance(originalRequest);
|
||||
// }
|
||||
// return Promise.reject(error);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,17 +12,23 @@ axios.interceptors.request.use(function (config) {
|
|||
return config;
|
||||
});
|
||||
|
||||
|
||||
|
||||
export async function getPossibleStates() {
|
||||
const data = await axios.get(`api/Inspector/PossibleStates`);
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue