Added Violation component and modifeid Comment Componnent and Delete Component
thats all related to RequestComponentmaster
parent
d82592c189
commit
f8d9513d6a
|
|
@ -46,7 +46,7 @@ function RecentRequests() {
|
||||||
<div className="w-full rounded-md bg-rose-100">
|
<div className="w-full rounded-md bg-rose-100">
|
||||||
<div id="map" aria-label="نقشه">
|
<div id="map" aria-label="نقشه">
|
||||||
{/* <OnMapRequests /> */}
|
{/* <OnMapRequests /> */}
|
||||||
<ComponentMap />
|
{/* <ComponentMap /> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ import { convertFullTime } from "@/lib/utils";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import RequestViolations from "./RequestViolations";
|
import RequestViolations from "./RequestViolations";
|
||||||
|
|
||||||
|
import { postReportViolation } from "@/utils/CitizenReport";
|
||||||
|
|
||||||
// interface RequestCardProps {
|
// interface RequestCardProps {
|
||||||
// isSelfRequest?: boolean;
|
// isSelfRequest?: boolean;
|
||||||
// }
|
// }
|
||||||
|
|
@ -34,14 +36,24 @@ interface RequestItem {
|
||||||
medias: Media[];
|
medias: Media[];
|
||||||
isLiked: boolean;
|
isLiked: boolean;
|
||||||
likes: number;
|
likes: number;
|
||||||
commentsCount:number;
|
commentsCount: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RequestCardProps {
|
interface RequestCardProps {
|
||||||
item: RequestItem;
|
item: RequestItem;
|
||||||
isSelfRequest?: boolean;
|
isSelfRequest?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Define the post violation function type
|
||||||
|
type PostViolationArgs = {
|
||||||
|
id: string;
|
||||||
|
payload: {
|
||||||
|
instanceId: number;
|
||||||
|
violationTypeId: number;
|
||||||
|
description: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const RequestCard: React.FC<RequestCardProps> = ({ item, isSelfRequest }) => {
|
const RequestCard: React.FC<RequestCardProps> = ({ item, isSelfRequest }) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
|
@ -50,6 +62,15 @@ const RequestCard: React.FC<RequestCardProps> = ({ item, isSelfRequest }) => {
|
||||||
router.push(`/User/MyRequest/${item.id}`);
|
router.push(`/User/MyRequest/${item.id}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Correctly wrapped function
|
||||||
|
const wrappedPostReportViolation = async ({
|
||||||
|
id,
|
||||||
|
payload,
|
||||||
|
}: PostViolationArgs) => {
|
||||||
|
return postReportViolation(id, payload);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
// <div className="overflow-x-hidden overflow-y-scroll pl-5 scrollbar-thin scrollbar-thumb-yellow scrollbar-track-white">
|
// <div className="overflow-x-hidden overflow-y-scroll pl-5 scrollbar-thin scrollbar-thumb-yellow scrollbar-track-white">
|
||||||
<>
|
<>
|
||||||
|
|
@ -105,13 +126,22 @@ const RequestCard: React.FC<RequestCardProps> = ({ item, isSelfRequest }) => {
|
||||||
<div className="w-full flex items-center justify-between mb-[10px]">
|
<div className="w-full flex items-center justify-between mb-[10px]">
|
||||||
<RequestProcessIcon />
|
<RequestProcessIcon />
|
||||||
<div className="flex items-center justify-center">
|
<div className="flex items-center justify-center">
|
||||||
<RequestViolations />
|
{/* <RequestViolations reportId={item.id} /> */}
|
||||||
|
|
||||||
|
<RequestViolations
|
||||||
|
reportId={item.id}
|
||||||
|
mutationFn={wrappedPostReportViolation}
|
||||||
|
/>
|
||||||
|
|
||||||
<RequestLike
|
<RequestLike
|
||||||
reportId={item.id}
|
reportId={item.id}
|
||||||
initialIsLiked={item.isLiked}
|
initialIsLiked={item.isLiked}
|
||||||
initialLikes={item.likes}
|
initialLikes={item.likes}
|
||||||
/>
|
/>
|
||||||
<RequestComments reportId={item.id} commentsCount={item.commentsCount}/>
|
<RequestComments
|
||||||
|
reportId={item.id}
|
||||||
|
commentsCount={item.commentsCount}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,10 @@ import RequestViolation from "./RequestViolation";
|
||||||
import { BsTrash3 } from "react-icons/bs";
|
import { BsTrash3 } from "react-icons/bs";
|
||||||
import ph from "@/assets/images/ph.png";
|
import ph from "@/assets/images/ph.png";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { useMutation } from "@tanstack/react-query";
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||||
import { deleteComment } from "@/utils/CitizenReport";
|
import { deleteComment, postCommentViolation } from "@/utils/CitizenReport";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
|
import RequestViolations from "./RequestViolations";
|
||||||
|
|
||||||
interface RequestCommentProps {
|
interface RequestCommentProps {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
@ -15,9 +16,21 @@ interface RequestCommentProps {
|
||||||
dateTime: string;
|
dateTime: string;
|
||||||
user: any;
|
user: any;
|
||||||
canDelete: boolean;
|
canDelete: boolean;
|
||||||
onDeleteCommentSuccess:any
|
onDeleteCommentSuccess: any;
|
||||||
|
commentsCount: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Define the post violation function type
|
||||||
|
type PostViolationArgs = {
|
||||||
|
id: string;
|
||||||
|
payload: {
|
||||||
|
instanceId: number;
|
||||||
|
violationTypeId: number;
|
||||||
|
description: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
const getUserTitle = (user: any) => {
|
const getUserTitle = (user: any) => {
|
||||||
if (user.firstName || user.lastName)
|
if (user.firstName || user.lastName)
|
||||||
return `${user.firstName || ""} ${user.lastName || ""}`;
|
return `${user.firstName || ""} ${user.lastName || ""}`;
|
||||||
|
|
@ -32,14 +45,18 @@ const RequestComment: React.FC<RequestCommentProps> = ({
|
||||||
user,
|
user,
|
||||||
canDelete,
|
canDelete,
|
||||||
onDeleteCommentSuccess,
|
onDeleteCommentSuccess,
|
||||||
|
commentsCount,
|
||||||
}) => {
|
}) => {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
const DeleteComment = useMutation({
|
const DeleteComment = useMutation({
|
||||||
mutationKey: ["deleteComment"],
|
mutationKey: ["deleteComment"],
|
||||||
mutationFn: deleteComment,
|
mutationFn: deleteComment,
|
||||||
onSuccess: (res) => {
|
onSuccess: (res) => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: ["Comments"] });
|
||||||
|
commentsCount();
|
||||||
toast(<>{res.message}</>, {
|
toast(<>{res.message}</>, {
|
||||||
className: "!bg-green !text-black",
|
className: "!bg-green !text-black flex justify-end",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onError: (error: any | string) => {
|
onError: (error: any | string) => {
|
||||||
|
|
@ -53,6 +70,13 @@ const RequestComment: React.FC<RequestCommentProps> = ({
|
||||||
const handelDelete = () => {
|
const handelDelete = () => {
|
||||||
DeleteComment.mutate(id);
|
DeleteComment.mutate(id);
|
||||||
};
|
};
|
||||||
|
// Correctly wrapped function
|
||||||
|
const wrappedPostCommentViolation = async ({
|
||||||
|
id,
|
||||||
|
payload,
|
||||||
|
}: PostViolationArgs) => {
|
||||||
|
return postCommentViolation(id, payload);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex w-full items-stretch mb-3 p-2 border-b-[1px] border-b-gray-200 last:border-b-0">
|
<div className="flex w-full items-stretch mb-3 p-2 border-b-[1px] border-b-gray-200 last:border-b-0">
|
||||||
|
|
@ -88,9 +112,15 @@ const RequestComment: React.FC<RequestCommentProps> = ({
|
||||||
{comment}
|
{comment}
|
||||||
</p>
|
</p>
|
||||||
{canDelete && (
|
{canDelete && (
|
||||||
<BsTrash3 className="text-red cursor-pointer" onClick={handelDelete} />
|
<BsTrash3
|
||||||
|
className="text-red cursor-pointer"
|
||||||
|
onClick={handelDelete}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
<RequestViolation />
|
<RequestViolations
|
||||||
|
reportId={id}
|
||||||
|
mutationFn={wrappedPostCommentViolation}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,9 @@ interface Comment {
|
||||||
id: string;
|
id: string;
|
||||||
text: string;
|
text: string;
|
||||||
dateTime: string;
|
dateTime: string;
|
||||||
user:any;
|
user: any;
|
||||||
canDelete:boolean;
|
canDelete: boolean;
|
||||||
onDeleteCommentSuccess:any
|
onDeleteCommentSuccess: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define the post comment function type
|
// Define the post comment function type
|
||||||
|
|
@ -75,8 +75,8 @@ const RequestComments: React.FC<RequestCommentsProps> = ({
|
||||||
setCommentText("");
|
setCommentText("");
|
||||||
// Increment the comments count
|
// Increment the comments count
|
||||||
setCommentsCounts((prevCount) => prevCount + 1);
|
setCommentsCounts((prevCount) => prevCount + 1);
|
||||||
toast("successfully", {
|
toast("نظر شما با موفقیت ثبت شد", {
|
||||||
className: "!bg-green !text-black",
|
className: "!bg-green !text-black flex justify-end",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
|
|
@ -126,9 +126,12 @@ const RequestComments: React.FC<RequestCommentsProps> = ({
|
||||||
id={comment.id}
|
id={comment.id}
|
||||||
comment={comment.text}
|
comment={comment.text}
|
||||||
dateTime={comment.dateTime}
|
dateTime={comment.dateTime}
|
||||||
user={comment.user}
|
user={comment.user}
|
||||||
canDelete={comment.canDelete}
|
canDelete={comment.canDelete}
|
||||||
onDeleteCommentSuccess={refetch()}
|
onDeleteCommentSuccess={refetch()}
|
||||||
|
commentsCount={() =>
|
||||||
|
setCommentsCounts((prev) => prev - 1)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
))}
|
))}
|
||||||
|
|
@ -151,7 +154,7 @@ const RequestComments: React.FC<RequestCommentsProps> = ({
|
||||||
wrapperClass=""
|
wrapperClass=""
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<MdSend className="w-5 h-5 text-green"/>
|
<MdSend className="w-5 h-5 text-green" />
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
<Textarea
|
<Textarea
|
||||||
|
|
|
||||||
|
|
@ -29,27 +29,54 @@ import {
|
||||||
import {
|
import {
|
||||||
Select,
|
Select,
|
||||||
SelectContent,
|
SelectContent,
|
||||||
|
SelectGroup,
|
||||||
SelectItem,
|
SelectItem,
|
||||||
|
SelectLabel,
|
||||||
SelectTrigger,
|
SelectTrigger,
|
||||||
SelectValue,
|
SelectValue,
|
||||||
} from "../ui/select";
|
} from "../ui/select";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
import { postReportViolation } from "@/utils/CitizenReport";
|
||||||
|
import { toast } from "sonner";
|
||||||
|
import { FaCheckCircle } from "react-icons/fa";
|
||||||
|
|
||||||
const formSchema = z.object({
|
interface RequestViolationsProps {
|
||||||
violationTypeId: z.string({
|
reportId: string;
|
||||||
required_error: "لطفا دسته بندی را انتخاب نمایید.",
|
mutationFn: ({ id, payload }: PostViolationArgs) => Promise<any>;
|
||||||
}),
|
}
|
||||||
description: z.string(),
|
|
||||||
});
|
|
||||||
|
|
||||||
const RequestViolations = ({ request = {}, comment = {}, type = "" }) => {
|
// Define the post violation function type
|
||||||
|
type PostViolationArgs = {
|
||||||
|
id: string;
|
||||||
|
payload: {
|
||||||
|
instanceId: number;
|
||||||
|
violationTypeId: number;
|
||||||
|
description: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const RequestViolations: React.FC<RequestViolationsProps> = ({
|
||||||
|
reportId,
|
||||||
|
mutationFn,
|
||||||
|
}) => {
|
||||||
// states
|
// states
|
||||||
const [currentStep, setCurrentStep] = useState<number>(1);
|
|
||||||
const [violationType, setViolationType] = useState("");
|
const [violationType, setViolationType] = useState("");
|
||||||
|
const [instanceId, setInstanceId] = useState<number>(1);
|
||||||
const [violationDescription, setViolationDescription] = useState("");
|
const [violationDescription, setViolationDescription] = useState("");
|
||||||
const [charCount, setCharCount] = useState(0);
|
const [charCount, setCharCount] = useState(0);
|
||||||
|
const [currentStep, setCurrentStep] = useState<number>(1);
|
||||||
|
const [open, setOpen] = useState<boolean>();
|
||||||
|
const [open2, setOpen2] = useState<boolean>(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const CtizenInstances = localStorage.getItem("SH_CT_INSTANCE");
|
||||||
|
if (CtizenInstances) {
|
||||||
|
const parsedItem = JSON.parse(CtizenInstances);
|
||||||
|
setInstanceId(parsedItem.id);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: violationTypes,
|
data: violationTypes,
|
||||||
|
|
@ -64,11 +91,16 @@ const RequestViolations = ({ request = {}, comment = {}, type = "" }) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// functions
|
// functions
|
||||||
const onSelectType = (vT: string) => (e: any) => {
|
// const onSelectType = (vT: string) => (e: any) => {
|
||||||
e.stopPropagation();
|
// e.stopPropagation();
|
||||||
setViolationType(vT);
|
// setViolationType(vT);
|
||||||
setCurrentStep((prev) => prev + 1);
|
// setCurrentStep((prev) => prev + 1);
|
||||||
};
|
// };
|
||||||
|
|
||||||
|
const formSchema = z.object({
|
||||||
|
violationTypeId: z.string().nonempty("لطفا دسته بندی را انتخاب نمایید."),
|
||||||
|
description: z.string(),
|
||||||
|
});
|
||||||
|
|
||||||
// 1. Define your form.
|
// 1. Define your form.
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
|
|
@ -83,83 +115,165 @@ const RequestViolations = ({ request = {}, comment = {}, type = "" }) => {
|
||||||
setCharCount(form.watch("description").length);
|
setCharCount(form.watch("description").length);
|
||||||
}, [form.watch("description")]);
|
}, [form.watch("description")]);
|
||||||
|
|
||||||
// 2. Define a submit handler.
|
const violationMutation = useMutation({
|
||||||
function onSubmit(values: z.infer<typeof formSchema>) {
|
mutationKey: ["violationMutation"],
|
||||||
// Do something with the form values.
|
// mutationFn: ({ id, payload }: PostViolationArgs) =>
|
||||||
// ✅ This will be type-safe and validated.
|
// postReportViolation(id, payload),
|
||||||
console.log(values);
|
mutationFn: mutationFn,
|
||||||
|
onSuccess: (res) => {
|
||||||
|
// toast(<>{"گزارش شما با موفقیت ثبت شد"}</>, {
|
||||||
|
// className: "!bg-green !text-white flex justify-end",
|
||||||
|
// });
|
||||||
|
setOpen(false);
|
||||||
|
setOpen2(true);
|
||||||
|
},
|
||||||
|
onError: (err: any | string) => {
|
||||||
|
toast(<>{err.response.data.detail}</>, {
|
||||||
|
className: "!bg-rose-800 !text-white",
|
||||||
|
});
|
||||||
|
refetch();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Function to search for an ID based on the title
|
||||||
|
function findViolationTypeIdByTitle(title: string) {
|
||||||
|
if (violationTypes?.data) {
|
||||||
|
const foundItem = violationTypes.data.find(
|
||||||
|
(item: any) => item.title === title
|
||||||
|
);
|
||||||
|
return foundItem ? foundItem.id : null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSubmit = () => {};
|
// 2. Define a submit handler.
|
||||||
return (
|
function onSubmit(values: z.infer<typeof formSchema>) {
|
||||||
<Dialog>
|
console.log(values);
|
||||||
<DialogTrigger asChild>
|
setViolationType(values.violationTypeId);
|
||||||
{/* <Button variant="outline">Share</Button> */}
|
setViolationDescription(values.description);
|
||||||
<FaRegFlag className="text-lg mx-1 cursor-pointer" />
|
|
||||||
</DialogTrigger>
|
|
||||||
|
|
||||||
<DialogContent className="sm:max-w-md">
|
const violationId = findViolationTypeIdByTitle(values.violationTypeId);
|
||||||
<div className="">
|
|
||||||
<Form {...form}>
|
violationMutation.mutate({
|
||||||
<form
|
id: reportId,
|
||||||
onSubmit={form.handleSubmit(onSubmit)}
|
payload: {
|
||||||
className="flex flex-col w-full mt-6"
|
instanceId: instanceId,
|
||||||
>
|
violationTypeId: violationId,
|
||||||
<FormField
|
description: values.description,
|
||||||
control={form.control}
|
},
|
||||||
name="violationTypeId"
|
});
|
||||||
render={({ field }) => (
|
}
|
||||||
<FormItem className="w-full">
|
|
||||||
{/* <FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
return (
|
||||||
|
<>
|
||||||
|
<Dialog open={open} onOpenChange={setOpen}>
|
||||||
|
<DialogTrigger asChild>
|
||||||
|
{/* <Button variant="outline">Share</Button> */}
|
||||||
|
<FaRegFlag className="text-lg mx-1 cursor-pointer" />
|
||||||
|
</DialogTrigger>
|
||||||
|
|
||||||
|
<DialogContent className="sm:max-w-xl">
|
||||||
|
<div className="">
|
||||||
|
<Form {...form}>
|
||||||
|
<form
|
||||||
|
onSubmit={form.handleSubmit(onSubmit)}
|
||||||
|
className="flex flex-col gap-8 w-full mt-6"
|
||||||
|
>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="violationTypeId"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem className="w-full mb-4">
|
||||||
|
{/* <FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||||
عنوان تخلف
|
عنوان تخلف
|
||||||
</FormLabel> */}
|
</FormLabel> */}
|
||||||
<Select
|
<Select
|
||||||
onValueChange={field.onChange}
|
onValueChange={field.onChange}
|
||||||
defaultValue={field.value}
|
defaultValue={field.value}
|
||||||
dir="rtl"
|
dir="rtl"
|
||||||
>
|
>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<SelectTrigger className="bg-slate-200">
|
<SelectTrigger className="bg-white">
|
||||||
<SelectValue placeholder=" عنوان تخلف" />
|
<SelectValue placeholder=" عنوان تخلف" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{violationTypes?.data.map((Items: any, index: any) => (
|
<SelectGroup>
|
||||||
<SelectItem key={index} value={Items.id}>
|
{/* <SelectLabel>Fruits</SelectLabel> */}
|
||||||
{Items.title}
|
{violationTypes?.data.map(
|
||||||
</SelectItem>
|
(Items: any, index: any) => (
|
||||||
))}
|
<SelectItem key={index} value={Items.title}>
|
||||||
</SelectContent>
|
{Items.title}
|
||||||
</Select>
|
</SelectItem>
|
||||||
<FormMessage className="mt-2 " />
|
)
|
||||||
</FormItem>
|
)}
|
||||||
)}
|
</SelectGroup>
|
||||||
/>
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
<FormMessage className="mt-2 " />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="description"
|
name="description"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel className="text-[#7C838A] text-sm font-medium ">
|
<FormLabel className="text-[#7C838A] text-sm font-medium">
|
||||||
توضیحات ({charCount}/1024)
|
توضیحات ({charCount}/1024)
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Textarea
|
<Textarea
|
||||||
placeholder=" توضیحات خود را بنویسید"
|
placeholder=" توضیحات خود را بنویسید"
|
||||||
className="mb-3 resize-none"
|
className=" resize-none bg-white text-black text-sm "
|
||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</form>
|
{/* <DialogClose asChild> */}
|
||||||
</Form>
|
<Button
|
||||||
</div>
|
type="submit"
|
||||||
</DialogContent>
|
className="w-1/2 p-2 text-center text-black sm:w-1/3 lg:w-1/4 bg-yellow hover:bg-yellow rounded-xl self-end"
|
||||||
</Dialog>
|
>
|
||||||
|
{/* {complaintSubmitMutation.isPending ? (
|
||||||
|
<div className="flex items-center justify-center gap-2">
|
||||||
|
<Oval
|
||||||
|
visible={true}
|
||||||
|
height="20"
|
||||||
|
width="20"
|
||||||
|
color="#fff"
|
||||||
|
ariaLabel="oval-loading"
|
||||||
|
wrapperStyle={{}}
|
||||||
|
wrapperClass=""
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
"ارسال گزارش"
|
||||||
|
)} */}
|
||||||
|
ارسال
|
||||||
|
</Button>
|
||||||
|
{/* </DialogClose> */}
|
||||||
|
</form>
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
|
<Dialog open={open2} onOpenChange={setOpen2}>
|
||||||
|
<DialogContent>
|
||||||
|
<div className="flex flex-col justify-center items-center gap-8">
|
||||||
|
<FaCheckCircle className="text-green w-12 h-12 " />
|
||||||
|
<p className="text-green text-sm">
|
||||||
|
شهروند گرامی، گزارش تخلف شما ثبت شد و در اسرع وقت بررسی میگردد.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,10 +133,9 @@ export async function postCommentViolation(
|
||||||
id: string,
|
id: string,
|
||||||
payload: { instanceId: number; violationTypeId: number; description: string }
|
payload: { instanceId: number; violationTypeId: number; description: string }
|
||||||
) {
|
) {
|
||||||
const data = await axios.post(`/api/CitizenReport/CommentViolation/${id}`, {
|
const data = await axios.post(`/api/CitizenReport/CommentViolation/${id}`,payload);
|
||||||
payload,
|
|
||||||
});
|
|
||||||
return data.data;
|
return data.data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Post CitizenReport ReportViolation {id}
|
// Post CitizenReport ReportViolation {id}
|
||||||
|
|
@ -144,8 +143,6 @@ export async function postReportViolation(
|
||||||
id: string,
|
id: string,
|
||||||
payload: { instanceId: number; violationTypeId: number; description: string }
|
payload: { instanceId: number; violationTypeId: number; description: string }
|
||||||
) {
|
) {
|
||||||
const data = await axios.post(`/api/CitizenReport/ReportViolation/${id}`, {
|
const data = await axios.post(`/api/CitizenReport/ReportViolation/${id}`,payload);
|
||||||
payload,
|
|
||||||
});
|
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue