Added Feedback component
parent
541b77630e
commit
e9a1549c21
|
|
@ -0,0 +1,10 @@
|
||||||
|
import React from 'react'
|
||||||
|
import Feedback from "@/components/Feedback/Feedback";
|
||||||
|
|
||||||
|
function page({ params }: { params: any }) {
|
||||||
|
const id = params.feedbackId;
|
||||||
|
|
||||||
|
return <Feedback id={id} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default page;
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
function page() {
|
||||||
|
return (
|
||||||
|
<div>Feedback Page</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default page
|
||||||
|
|
@ -0,0 +1,282 @@
|
||||||
|
// Feedback.tsx
|
||||||
|
"use client";
|
||||||
|
import React, { useEffect, useState, MouseEvent } from "react";
|
||||||
|
import { useForm } from "react-hook-form";
|
||||||
|
import { number, z } from "zod";
|
||||||
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { toast } from "sonner";
|
||||||
|
import Rating from "@/components/Rating/Rating";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { Input } from "@/components/ui/input";
|
||||||
|
import {
|
||||||
|
Form,
|
||||||
|
FormControl,
|
||||||
|
FormField,
|
||||||
|
FormItem,
|
||||||
|
FormLabel,
|
||||||
|
FormMessage,
|
||||||
|
} from "@/components/ui/form";
|
||||||
|
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
|
||||||
|
import { Label } from "@/components/ui/label";
|
||||||
|
import {
|
||||||
|
getSingleCitizenReportMine,
|
||||||
|
postFeedback,
|
||||||
|
postObjection,
|
||||||
|
} from "@/utils/CitizenReport";
|
||||||
|
import { convertFullTime } from "@/lib/utils";
|
||||||
|
import { ThreeDots } from "react-loader-spinner";
|
||||||
|
import { Value } from "@radix-ui/react-select";
|
||||||
|
|
||||||
|
// Define the post Feedback function type
|
||||||
|
type PostFeedbackArgs = {
|
||||||
|
id: string;
|
||||||
|
rating: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Define the post Objection function type
|
||||||
|
type PostObjectionArgs = {
|
||||||
|
id: string;
|
||||||
|
payload: {
|
||||||
|
comments: string;
|
||||||
|
attachments: string[];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const FormSchema = z.object({
|
||||||
|
comments: z.string().min(1, {
|
||||||
|
message: "لطفا توضیحات خود را وارد نمایید.",
|
||||||
|
}),
|
||||||
|
fileInput: z.string().optional(),
|
||||||
|
type: z.enum(["1", "0"], {
|
||||||
|
required_error: "لطفا یکی از دو گزینه زیر را انتخاب کنید.",
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
interface FeedbackProps {
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ReportData {
|
||||||
|
trackingNumber: string;
|
||||||
|
categoryTitle: string;
|
||||||
|
sent: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Feedback: React.FC<FeedbackProps> = ({ id }) => {
|
||||||
|
const router = useRouter();
|
||||||
|
const [satisfaction, setSatisfaction] = useState<number>(2);
|
||||||
|
const [reportData, setReportData] = useState<any | null>(null);
|
||||||
|
const [rating, setRating] = useState<number>(0); // State to hold rating value
|
||||||
|
|
||||||
|
const { data, isLoading, isSuccess } = useQuery({
|
||||||
|
queryKey: ["ReportMineId", id],
|
||||||
|
queryFn: () => getSingleCitizenReportMine(id),
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (data) {
|
||||||
|
setReportData(data.data);
|
||||||
|
}
|
||||||
|
}, [data, isSuccess]);
|
||||||
|
|
||||||
|
const form = useForm<z.infer<typeof FormSchema>>({
|
||||||
|
resolver: zodResolver(FormSchema),
|
||||||
|
defaultValues: {
|
||||||
|
comments: "",
|
||||||
|
fileInput: "",
|
||||||
|
type: "0",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const postFeedbackMutation = useMutation({
|
||||||
|
mutationKey: ["postFeedback"],
|
||||||
|
mutationFn: ({ id, rating }: PostFeedbackArgs) => postFeedback(id, rating),
|
||||||
|
onSuccess: () => {
|
||||||
|
// setValues((prev) => ({ ...prev, rating: 0 }));
|
||||||
|
// N
|
||||||
|
form.reset();
|
||||||
|
router.push("/User/MyRequest");
|
||||||
|
toast.success("بازخورد شما با موفقیت ثبت شد");
|
||||||
|
},
|
||||||
|
onError: (error: any) => {
|
||||||
|
toast.error(`خطا در ارسال بازخورد: ${error.message}`);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const postObjectionMutation = useMutation({
|
||||||
|
mutationKey: ["postObjection"],
|
||||||
|
mutationFn: ({ id, payload }: PostObjectionArgs) =>
|
||||||
|
postObjection(id, payload),
|
||||||
|
onSuccess: () => {
|
||||||
|
// N
|
||||||
|
form.reset();
|
||||||
|
toast.success("اعتراض شما با موفقیت ثبت شد");
|
||||||
|
router.push("/User/MyRequest");
|
||||||
|
},
|
||||||
|
onError: (error: any) => {
|
||||||
|
toast.error(`خطا در ارسال اعتراض: ${error.message}`);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// N
|
||||||
|
const onRatingSubmit = () => {
|
||||||
|
postFeedbackMutation.mutate({ id, rating });
|
||||||
|
};
|
||||||
|
|
||||||
|
const onObjectionSubmit = (data: z.infer<typeof FormSchema>) => {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append("comments", data.comments);
|
||||||
|
if (data.fileInput) {
|
||||||
|
formData.append("attachments", data.fileInput);
|
||||||
|
}
|
||||||
|
postObjectionMutation.mutate({
|
||||||
|
id,
|
||||||
|
payload: {
|
||||||
|
comments: data.comments,
|
||||||
|
attachments: data.fileInput ? [data.fileInput as string] : [],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="w-full max-w-[640px] mx-auto flex flex-col items-center">
|
||||||
|
{isLoading ? (
|
||||||
|
<div className="flex flex-col justify-center items-center text-center w-full h-full">
|
||||||
|
{/* Loading Spinner */}
|
||||||
|
<ThreeDots
|
||||||
|
visible={true}
|
||||||
|
height="50"
|
||||||
|
width="50"
|
||||||
|
color="#003778"
|
||||||
|
radius="9"
|
||||||
|
ariaLabel="three-dots-loading"
|
||||||
|
wrapperStyle={{}}
|
||||||
|
wrapperClass=""
|
||||||
|
/>
|
||||||
|
<div>در حال بارگذاری...</div>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<p className="text-sm text-justify leading-7">
|
||||||
|
شهروند گرامی، درخواست شما با کد رهگیری{" "}
|
||||||
|
<span className="text-green font-bold">
|
||||||
|
{reportData?.trackingNumber}
|
||||||
|
</span>{" "}
|
||||||
|
و مربوط به گروه موضوعی{" "}
|
||||||
|
<span className="text-sm text-blue font-bold">
|
||||||
|
{reportData?.categoryTitle}
|
||||||
|
</span>{" "}
|
||||||
|
ثبت شده در تاریخ{" "}
|
||||||
|
<span className="text-sm text-red font-bold">
|
||||||
|
{convertFullTime(reportData?.sent)}
|
||||||
|
</span>{" "}
|
||||||
|
پیگیری و رسیدگی شد.
|
||||||
|
</p>
|
||||||
|
<p className="text-right w-full text-sm leading-7">
|
||||||
|
لطفا میزان رضایتمندی خود را از فرآیند رسیدگی اعلام نمایید.
|
||||||
|
</p>
|
||||||
|
<p className="text-right w-full text-sm leading-7">
|
||||||
|
نظرات شما باعث ارتقای سطح خدمترسانی ما خواهد شد.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p className="text-right w-full text-sm leading-7 font-bold">
|
||||||
|
آیا از نحوه ی پاسخگویی راضی بودید؟
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<RadioGroup
|
||||||
|
onValueChange={(value) => setSatisfaction(Number(value))}
|
||||||
|
className="flex flex-row justify-end mt-4 w-full"
|
||||||
|
>
|
||||||
|
<div className="flex items-center space-x-2">
|
||||||
|
<RadioGroupItem value="1" id="r1" />
|
||||||
|
<Label htmlFor="r1">بله</Label>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center space-x-2">
|
||||||
|
<RadioGroupItem value="0" id="r2" />
|
||||||
|
<Label htmlFor="r2">خیر</Label>
|
||||||
|
</div>
|
||||||
|
</RadioGroup>
|
||||||
|
|
||||||
|
<div className="flex w-full justify-center flex-col">
|
||||||
|
{satisfaction === 1 && (
|
||||||
|
<div className="mb-3">
|
||||||
|
<Rating
|
||||||
|
name="rating"
|
||||||
|
onChange={setRating}
|
||||||
|
// onChange={(value: any) => form.setValue("fileInput", value)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
className="w-full text-black bg-yellow rounded-md hover:bg-yellow/80 mt-5"
|
||||||
|
onClick={onRatingSubmit} // Attach the onRatingSubmit function to this button
|
||||||
|
>
|
||||||
|
ثبت امتیاز
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{satisfaction === 0 && (
|
||||||
|
<>
|
||||||
|
<p className="text-sm mt-4">
|
||||||
|
باتوجه به عدم رضایت شما از نحوه رسیدگی، درخواست برای بررسی
|
||||||
|
مجدد به واحد بازرسی ارجاع داده میشود.
|
||||||
|
</p>
|
||||||
|
<Form {...form}>
|
||||||
|
<form
|
||||||
|
// onSubmit={form.handleSubmit(handleSubmit)}
|
||||||
|
onSubmit={form.handleSubmit(onObjectionSubmit)}
|
||||||
|
className="flex flex-col w-full mt-6"
|
||||||
|
>
|
||||||
|
<div className="flex flex-row flex-wrap justify-between">
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="comments"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem className="w-full">
|
||||||
|
<FormLabel className="text-[#7C838A] text-sm font-medium">
|
||||||
|
توضیحات
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input {...field} />
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="fileInput"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem className="w-full">
|
||||||
|
<FormLabel className="text-[#7C838A] text-sm font-medium">
|
||||||
|
پیوستها
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input type="file" {...field} />
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
type="submit"
|
||||||
|
className="w-full text-black bg-yellow rounded-md hover:bg-yellow/80 mt-5"
|
||||||
|
// onClick={handleSubmit}
|
||||||
|
>
|
||||||
|
ثبت
|
||||||
|
</Button>
|
||||||
|
</form>
|
||||||
|
</Form>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Feedback;
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { FaStar } from "react-icons/fa";
|
||||||
|
|
||||||
|
interface Star {
|
||||||
|
id: number;
|
||||||
|
hover: boolean;
|
||||||
|
active: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultStars: Star[] = [
|
||||||
|
{ id: 1, hover: false, active: true },
|
||||||
|
{ id: 2, hover: false, active: true },
|
||||||
|
{ id: 3, hover: false, active: true },
|
||||||
|
{ id: 4, hover: false, active: false },
|
||||||
|
{ id: 5, hover: false, active: false },
|
||||||
|
];
|
||||||
|
|
||||||
|
interface RatingProps {
|
||||||
|
onChange?: (value: number, name: string) => void;
|
||||||
|
name?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Rating: React.FC<RatingProps> = ({ onChange = () => {}, name = "" }) => {
|
||||||
|
const [stars, setStars] = useState<Star[]>(defaultStars);
|
||||||
|
const [rating, setRating] = useState<number>(3);
|
||||||
|
|
||||||
|
const onMouseEnter = (star: Star) => {
|
||||||
|
const index = stars.indexOf(star);
|
||||||
|
const modifiedStars = stars.map((s, i) => ({ ...s, hover: i <= index }));
|
||||||
|
setStars(modifiedStars);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onMouseLeave = () => {
|
||||||
|
setStars((prev) => prev.map((s) => ({ ...s, hover: false })));
|
||||||
|
};
|
||||||
|
|
||||||
|
const onClick = (star: Star) => {
|
||||||
|
const index = stars.indexOf(star);
|
||||||
|
setRating(index + 1);
|
||||||
|
onChange(index + 1, name);
|
||||||
|
const modifiedStars = stars.map((s, i) => ({ ...s, active: i <= index }));
|
||||||
|
setStars(modifiedStars);
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log("stars2", stars);
|
||||||
|
console.log("rating2", rating);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setStars(defaultStars);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="flex flex-row-reverse justify-center gap-2 mt-5 mb-4"
|
||||||
|
onMouseLeave={onMouseLeave}
|
||||||
|
>
|
||||||
|
{stars.map((star) => (
|
||||||
|
<span
|
||||||
|
key={star.id}
|
||||||
|
className="cursor-pointer text-gray-400 hover:text-yellow"
|
||||||
|
onMouseEnter={() => onMouseEnter(star)}
|
||||||
|
onClick={() => onClick(star)}
|
||||||
|
>
|
||||||
|
<FaStar
|
||||||
|
className={`text-4xl ${star.active ? "text-yellow" : ""} ${
|
||||||
|
star.hover ? "text-yellow" : ""
|
||||||
|
} `}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Rating;
|
||||||
|
|
@ -43,7 +43,7 @@ function RecentRequests() {
|
||||||
return (
|
return (
|
||||||
<section className="w-full flex flex-1 flex-row gap-8 overflow-hidden bg-white p-[10px]">
|
<section className="w-full flex flex-1 flex-row gap-8 overflow-hidden bg-white p-[10px]">
|
||||||
{/* Right */}
|
{/* Right */}
|
||||||
<div className="w-full rounded-md bg-rose-100">
|
<div className="w-full rounded-md bg-rose-100 hidden lg:flex">
|
||||||
<div id="map" aria-label="نقشه">
|
<div id="map" aria-label="نقشه">
|
||||||
{/* <OnMapRequests /> */}
|
{/* <OnMapRequests /> */}
|
||||||
{/* <ComponentMap /> */}
|
{/* <ComponentMap /> */}
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,12 @@ import NearestRequests from "./NearestRequests";
|
||||||
export function TabRequests() {
|
export function TabRequests() {
|
||||||
return (
|
return (
|
||||||
<Tabs defaultValue="all" className="">
|
<Tabs defaultValue="all" className="">
|
||||||
<TabsList className="grid w-full grid-cols-2">
|
<TabsList className="grid w-full grid-cols-3 lg:grid-cols-2">
|
||||||
<TabsTrigger value="nearest">نزدیک ترین ها </TabsTrigger>
|
<TabsTrigger value="nearest">نزدیک ترین ها </TabsTrigger>
|
||||||
<TabsTrigger value="all">همه</TabsTrigger>
|
<TabsTrigger value="all">همه</TabsTrigger>
|
||||||
|
<TabsTrigger value="Map" className="flex lg:hidden">
|
||||||
|
نقشه
|
||||||
|
</TabsTrigger>
|
||||||
</TabsList>
|
</TabsList>
|
||||||
<TabsContent value="nearest">
|
<TabsContent value="nearest">
|
||||||
<NearestRequests />
|
<NearestRequests />
|
||||||
|
|
@ -16,6 +19,10 @@ export function TabRequests() {
|
||||||
<TabsContent value="all">
|
<TabsContent value="all">
|
||||||
<RequestList />
|
<RequestList />
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
|
<TabsContent value="Map" className="flex lg:hidden">
|
||||||
|
{/* <RequestList /> */}
|
||||||
|
<p>Mapppp</p>
|
||||||
|
</TabsContent>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ import { getCitizenReport } from "@/utils/CitizenReport";
|
||||||
import { convertFullTime } from "@/lib/utils";
|
import { convertFullTime } from "@/lib/utils";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import RequestViolations from "./RequestViolations";
|
import RequestViolations from "./RequestViolations";
|
||||||
|
import { usePathname } from "next/navigation";
|
||||||
|
import { FaRegComment } from "react-icons/fa";
|
||||||
|
|
||||||
import { postReportViolation } from "@/utils/CitizenReport";
|
import { postReportViolation } from "@/utils/CitizenReport";
|
||||||
import RequestProcess from "./RequestProcess";
|
import RequestProcess from "./RequestProcess";
|
||||||
|
|
@ -37,6 +39,8 @@ interface RequestItem {
|
||||||
isLiked: boolean;
|
isLiked: boolean;
|
||||||
likes: number;
|
likes: number;
|
||||||
commentsCount: number;
|
commentsCount: number;
|
||||||
|
isFeedbacked: boolean;
|
||||||
|
reportState: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RequestCardProps {
|
interface RequestCardProps {
|
||||||
|
|
@ -56,10 +60,14 @@ type PostViolationArgs = {
|
||||||
|
|
||||||
const RequestCard: React.FC<RequestCardProps> = ({ item, isSelfRequest }) => {
|
const RequestCard: React.FC<RequestCardProps> = ({ item, isSelfRequest }) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const pathname = usePathname();
|
||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = (e:any) => {
|
||||||
if (isSelfRequest) {
|
if (isSelfRequest) {
|
||||||
router.push(`/User/MyRequest/${item.id}`);
|
router.push(`/User/MyRequest/${item.id}`);
|
||||||
|
|
||||||
|
e.stopPropagation();
|
||||||
|
console.log("clickkkk");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -72,7 +80,7 @@ const RequestCard: React.FC<RequestCardProps> = ({ item, isSelfRequest }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div
|
<div
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
className="w-full bg-white flex items-stretch mb-3 min-h-[170px] md:p-3 md:rounded-md md:border-0 md:shadow-[0_2px_5px_rgba(0,0,0,0.05)]"
|
className="w-full bg-white flex items-stretch mb-3 min-h-[170px] md:p-3 md:rounded-md md:border-0 md:shadow-[0_2px_5px_rgba(0,0,0,0.05)]"
|
||||||
|
|
@ -130,7 +138,7 @@ const RequestCard: React.FC<RequestCardProps> = ({ item, isSelfRequest }) => {
|
||||||
|
|
||||||
<RequestViolations
|
<RequestViolations
|
||||||
reportId={item.id}
|
reportId={item.id}
|
||||||
mutationFn={wrappedPostReportViolation}
|
mutationFn={wrappedPostReportViolation}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<RequestLike
|
<RequestLike
|
||||||
|
|
@ -144,6 +152,24 @@ const RequestCard: React.FC<RequestCardProps> = ({ item, isSelfRequest }) => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{item.reportState == 1 &&
|
||||||
|
!item?.isFeedbacked &&
|
||||||
|
pathname == "/User/MyRequest" && (
|
||||||
|
<div
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
// navigate(`/user/feedback/${item.id}`);
|
||||||
|
router.push(`/User/Feedback/${item.id}`);
|
||||||
|
}}
|
||||||
|
className=" flex gap-2 justify-center items-center bg-blue3 bg-opacity-40 transition delay-75 rounded-md py-1 "
|
||||||
|
>
|
||||||
|
<FaRegComment className="text-blue" />
|
||||||
|
<p className=" text-center font-bold text-blue text-xs ">
|
||||||
|
ثبت بازخورد
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ const FormLabel = React.forwardRef<
|
||||||
return (
|
return (
|
||||||
<Label
|
<Label
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(error && "text-destructive" || `text-black text-lg absolute -mt-4 bg-white mr-4`, className)}
|
className={cn(error && "text-destructive" || `text-black text-lg -mt-4 mr-4`, className)}
|
||||||
htmlFor={formItemId}
|
htmlFor={formItemId}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hookform/resolvers": "^3.3.4",
|
"@hookform/resolvers": "^3.3.4",
|
||||||
"@radix-ui/react-label": "^2.0.2",
|
"@radix-ui/react-label": "^2.0.2",
|
||||||
|
"@radix-ui/react-radio-group": "^1.1.3",
|
||||||
"@radix-ui/react-select": "^2.0.0",
|
"@radix-ui/react-select": "^2.0.0",
|
||||||
"@radix-ui/react-slot": "^1.0.2",
|
"@radix-ui/react-slot": "^1.0.2",
|
||||||
"@radix-ui/react-tabs": "^1.0.4",
|
"@radix-ui/react-tabs": "^1.0.4",
|
||||||
|
|
@ -957,6 +958,38 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@radix-ui/react-radio-group": {
|
||||||
|
"version": "1.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@radix-ui/react-radio-group/-/react-radio-group-1.1.3.tgz",
|
||||||
|
"integrity": "sha512-x+yELayyefNeKeTx4fjK6j99Fs6c4qKm3aY38G3swQVTN6xMpsrbigC0uHs2L//g8q4qR7qOcww8430jJmi2ag==",
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/runtime": "^7.13.10",
|
||||||
|
"@radix-ui/primitive": "1.0.1",
|
||||||
|
"@radix-ui/react-compose-refs": "1.0.1",
|
||||||
|
"@radix-ui/react-context": "1.0.1",
|
||||||
|
"@radix-ui/react-direction": "1.0.1",
|
||||||
|
"@radix-ui/react-presence": "1.0.1",
|
||||||
|
"@radix-ui/react-primitive": "1.0.3",
|
||||||
|
"@radix-ui/react-roving-focus": "1.0.4",
|
||||||
|
"@radix-ui/react-use-controllable-state": "1.0.1",
|
||||||
|
"@radix-ui/react-use-previous": "1.0.1",
|
||||||
|
"@radix-ui/react-use-size": "1.0.1"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@types/react": "*",
|
||||||
|
"@types/react-dom": "*",
|
||||||
|
"react": "^16.8 || ^17.0 || ^18.0",
|
||||||
|
"react-dom": "^16.8 || ^17.0 || ^18.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@types/react": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"@types/react-dom": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@radix-ui/react-roving-focus": {
|
"node_modules/@radix-ui/react-roving-focus": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-roving-focus/-/react-roving-focus-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@radix-ui/react-roving-focus/-/react-roving-focus-1.0.4.tgz",
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hookform/resolvers": "^3.3.4",
|
"@hookform/resolvers": "^3.3.4",
|
||||||
"@radix-ui/react-label": "^2.0.2",
|
"@radix-ui/react-label": "^2.0.2",
|
||||||
|
"@radix-ui/react-radio-group": "^1.1.3",
|
||||||
"@radix-ui/react-select": "^2.0.0",
|
"@radix-ui/react-select": "^2.0.0",
|
||||||
"@radix-ui/react-slot": "^1.0.2",
|
"@radix-ui/react-slot": "^1.0.2",
|
||||||
"@radix-ui/react-tabs": "^1.0.4",
|
"@radix-ui/react-tabs": "^1.0.4",
|
||||||
|
|
|
||||||
|
|
@ -133,9 +133,11 @@ 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}`,payload);
|
const data = await axios.post(
|
||||||
|
`/api/CitizenReport/CommentViolation/${id}`,
|
||||||
|
payload
|
||||||
|
);
|
||||||
return data.data;
|
return data.data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Post CitizenReport ReportViolation {id}
|
// Post CitizenReport ReportViolation {id}
|
||||||
|
|
@ -143,13 +145,35 @@ 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}`,payload);
|
const data = await axios.post(
|
||||||
|
`/api/CitizenReport/ReportViolation/${id}`,
|
||||||
|
payload
|
||||||
|
);
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get ReportHistory {ID}
|
// Get ReportHistory {ID}
|
||||||
export async function getReportHistory(id: string) {
|
export async function getReportHistory(id: string) {
|
||||||
const data = await axios.get(`/api/CitizenReport/ReportHistory/${id}`);
|
const data = await axios.get(`/api/CitizenReport/ReportHistory/${id}`);
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Post CitizenReport Feedback {id}
|
||||||
|
export async function postFeedback(id: string, rating: number) {
|
||||||
|
const data = await axios.post(`/api/CitizenReport/Feedback/${id}`, {
|
||||||
|
rating,
|
||||||
|
});
|
||||||
|
return data.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Post CitizenReport Objection {id}
|
||||||
|
export async function postObjection(
|
||||||
|
id: string,
|
||||||
|
payload: {
|
||||||
|
comments: string;
|
||||||
|
attachments: any[];
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
const data = await axios.post(`/api/CitizenReport/Objection/${id}`, payload);
|
||||||
|
return data.data;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue