Added part of RequestViolation Component
parent
da8fd4a1ca
commit
d82592c189
|
|
@ -13,6 +13,7 @@ import { useQuery } from "@tanstack/react-query";
|
|||
import { getCitizenReport } from "@/utils/CitizenReport";
|
||||
import { convertFullTime } from "@/lib/utils";
|
||||
import { useRouter } from "next/navigation";
|
||||
import RequestViolations from "./RequestViolations";
|
||||
|
||||
// interface RequestCardProps {
|
||||
// isSelfRequest?: boolean;
|
||||
|
|
@ -104,7 +105,7 @@ const RequestCard: React.FC<RequestCardProps> = ({ item, isSelfRequest }) => {
|
|||
<div className="w-full flex items-center justify-between mb-[10px]">
|
||||
<RequestProcessIcon />
|
||||
<div className="flex items-center justify-center">
|
||||
<RequestViolation />
|
||||
<RequestViolations />
|
||||
<RequestLike
|
||||
reportId={item.id}
|
||||
initialIsLiked={item.isLiked}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ interface RequestCommentProps {
|
|||
dateTime: string;
|
||||
user: any;
|
||||
canDelete: boolean;
|
||||
onDeleteCommentSuccess:any
|
||||
}
|
||||
|
||||
const getUserTitle = (user: any) => {
|
||||
|
|
@ -30,7 +31,9 @@ const RequestComment: React.FC<RequestCommentProps> = ({
|
|||
dateTime,
|
||||
user,
|
||||
canDelete,
|
||||
onDeleteCommentSuccess,
|
||||
}) => {
|
||||
|
||||
const DeleteComment = useMutation({
|
||||
mutationKey: ["deleteComment"],
|
||||
mutationFn: deleteComment,
|
||||
|
|
@ -43,6 +46,7 @@ const RequestComment: React.FC<RequestCommentProps> = ({
|
|||
toast(<>{error.message}</>, {
|
||||
className: "!bg-red-500 !text-white",
|
||||
});
|
||||
onDeleteCommentSuccess();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -84,7 +88,7 @@ const RequestComment: React.FC<RequestCommentProps> = ({
|
|||
{comment}
|
||||
</p>
|
||||
{canDelete && (
|
||||
<BsTrash3 className="text-red" onClick={handelDelete} />
|
||||
<BsTrash3 className="text-red cursor-pointer" onClick={handelDelete} />
|
||||
)}
|
||||
<RequestViolation />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ interface Comment {
|
|||
dateTime: string;
|
||||
user:any;
|
||||
canDelete:boolean;
|
||||
onDeleteCommentSuccess:any
|
||||
}
|
||||
|
||||
// Define the post comment function type
|
||||
|
|
@ -127,6 +128,7 @@ const RequestComments: React.FC<RequestCommentsProps> = ({
|
|||
dateTime={comment.dateTime}
|
||||
user={comment.user}
|
||||
canDelete={comment.canDelete}
|
||||
onDeleteCommentSuccess={refetch()}
|
||||
/>
|
||||
</>
|
||||
))}
|
||||
|
|
@ -159,14 +161,6 @@ const RequestComments: React.FC<RequestCommentsProps> = ({
|
|||
id="comment"
|
||||
value={commentText}
|
||||
/>
|
||||
{/* <input
|
||||
className="w-full pr-10"
|
||||
type="text"
|
||||
id="comment"
|
||||
value={comment}
|
||||
placeholder="نظر جدید..."
|
||||
onChange={(e) => setComment(e.target.value)}
|
||||
/> */}
|
||||
</form>
|
||||
|
||||
{/* <DrawerFooter>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,166 @@
|
|||
"use client";
|
||||
import React, { MouseEventHandler, useEffect, useState } from "react";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { getViolationTypes } from "@/utils/CitizenCommon";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Dialog,
|
||||
DialogClose,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@/components/ui/dialog";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { Textarea } from "../ui/textarea";
|
||||
import { Oval } from "react-loader-spinner";
|
||||
import { FaRegFlag } from "react-icons/fa";
|
||||
import {
|
||||
Form,
|
||||
FormControl,
|
||||
FormField,
|
||||
FormItem,
|
||||
FormLabel,
|
||||
FormMessage,
|
||||
} from "../ui/form";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "../ui/select";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
|
||||
const formSchema = z.object({
|
||||
violationTypeId: z.string({
|
||||
required_error: "لطفا دسته بندی را انتخاب نمایید.",
|
||||
}),
|
||||
description: z.string(),
|
||||
});
|
||||
|
||||
const RequestViolations = ({ request = {}, comment = {}, type = "" }) => {
|
||||
// states
|
||||
const [currentStep, setCurrentStep] = useState<number>(1);
|
||||
const [violationType, setViolationType] = useState("");
|
||||
const [violationDescription, setViolationDescription] = useState("");
|
||||
const [charCount, setCharCount] = useState(0);
|
||||
|
||||
const {
|
||||
data: violationTypes,
|
||||
isLoading,
|
||||
isError,
|
||||
isSuccess,
|
||||
refetch,
|
||||
} = useQuery({
|
||||
queryKey: ["Violation"],
|
||||
queryFn: () => getViolationTypes(),
|
||||
// refetchOnWindowFocus: false,
|
||||
});
|
||||
|
||||
// functions
|
||||
const onSelectType = (vT: string) => (e: any) => {
|
||||
e.stopPropagation();
|
||||
setViolationType(vT);
|
||||
setCurrentStep((prev) => prev + 1);
|
||||
};
|
||||
|
||||
// 1. Define your form.
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues: {
|
||||
violationTypeId: "",
|
||||
description: "",
|
||||
},
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
setCharCount(form.watch("description").length);
|
||||
}, [form.watch("description")]);
|
||||
|
||||
// 2. Define a submit handler.
|
||||
function onSubmit(values: z.infer<typeof formSchema>) {
|
||||
// Do something with the form values.
|
||||
// ✅ This will be type-safe and validated.
|
||||
console.log(values);
|
||||
}
|
||||
|
||||
const handleSubmit = () => {};
|
||||
return (
|
||||
<Dialog>
|
||||
<DialogTrigger asChild>
|
||||
{/* <Button variant="outline">Share</Button> */}
|
||||
<FaRegFlag className="text-lg mx-1 cursor-pointer" />
|
||||
</DialogTrigger>
|
||||
|
||||
<DialogContent className="sm:max-w-md">
|
||||
<div className="">
|
||||
<Form {...form}>
|
||||
<form
|
||||
onSubmit={form.handleSubmit(onSubmit)}
|
||||
className="flex flex-col w-full mt-6"
|
||||
>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="violationTypeId"
|
||||
render={({ field }) => (
|
||||
<FormItem className="w-full">
|
||||
{/* <FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||
عنوان تخلف
|
||||
</FormLabel> */}
|
||||
<Select
|
||||
onValueChange={field.onChange}
|
||||
defaultValue={field.value}
|
||||
dir="rtl"
|
||||
>
|
||||
<FormControl>
|
||||
<SelectTrigger className="bg-slate-200">
|
||||
<SelectValue placeholder=" عنوان تخلف" />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
{violationTypes?.data.map((Items: any, index: any) => (
|
||||
<SelectItem key={index} value={Items.id}>
|
||||
{Items.title}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormMessage className="mt-2 " />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="description"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium ">
|
||||
توضیحات ({charCount}/1024)
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Textarea
|
||||
placeholder=" توضیحات خود را بنویسید"
|
||||
className="mb-3 resize-none"
|
||||
{...field}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</form>
|
||||
</Form>
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
|
||||
export default RequestViolations;
|
||||
|
|
@ -1,13 +1,8 @@
|
|||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import {
|
||||
CaretSortIcon,
|
||||
CheckIcon,
|
||||
ChevronDownIcon,
|
||||
ChevronUpIcon,
|
||||
} from "@radix-ui/react-icons"
|
||||
import * as SelectPrimitive from "@radix-ui/react-select"
|
||||
import { Check, ChevronDown, ChevronUp } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
|
|
@ -24,14 +19,14 @@ const SelectTrigger = React.forwardRef<
|
|||
<SelectPrimitive.Trigger
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
||||
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
<SelectPrimitive.Icon asChild>
|
||||
<CaretSortIcon className="h-4 w-4 opacity-50" />
|
||||
<ChevronDown className="h-4 w-4 opacity-50" />
|
||||
</SelectPrimitive.Icon>
|
||||
</SelectPrimitive.Trigger>
|
||||
))
|
||||
|
|
@ -49,7 +44,7 @@ const SelectScrollUpButton = React.forwardRef<
|
|||
)}
|
||||
{...props}
|
||||
>
|
||||
<ChevronUpIcon />
|
||||
<ChevronUp className="h-4 w-4" />
|
||||
</SelectPrimitive.ScrollUpButton>
|
||||
))
|
||||
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
|
||||
|
|
@ -66,7 +61,7 @@ const SelectScrollDownButton = React.forwardRef<
|
|||
)}
|
||||
{...props}
|
||||
>
|
||||
<ChevronDownIcon />
|
||||
<ChevronDown className="h-4 w-4" />
|
||||
</SelectPrimitive.ScrollDownButton>
|
||||
))
|
||||
SelectScrollDownButton.displayName =
|
||||
|
|
@ -110,7 +105,7 @@ const SelectLabel = React.forwardRef<
|
|||
>(({ className, ...props }, ref) => (
|
||||
<SelectPrimitive.Label
|
||||
ref={ref}
|
||||
className={cn("px-2 py-1.5 text-sm font-semibold", className)}
|
||||
className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
|
||||
{...props}
|
||||
/>
|
||||
))
|
||||
|
|
@ -123,16 +118,17 @@ const SelectItem = React.forwardRef<
|
|||
<SelectPrimitive.Item
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
||||
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
||||
<SelectPrimitive.ItemIndicator>
|
||||
<CheckIcon className="h-4 w-4" />
|
||||
<Check className="h-4 w-4" />
|
||||
</SelectPrimitive.ItemIndicator>
|
||||
</span>
|
||||
|
||||
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
||||
</SelectPrimitive.Item>
|
||||
))
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.3.4",
|
||||
"@radix-ui/react-label": "^2.0.2",
|
||||
"@radix-ui/react-select": "^2.0.0",
|
||||
"@radix-ui/react-slot": "^1.0.2",
|
||||
"@radix-ui/react-tabs": "^1.0.4",
|
||||
"@radix-ui/react-toast": "^1.1.5",
|
||||
|
|
@ -162,6 +163,40 @@
|
|||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@floating-ui/core": {
|
||||
"version": "1.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.2.tgz",
|
||||
"integrity": "sha512-+2XpQV9LLZeanU4ZevzRnGFg2neDeKHgFLjP6YLW+tly0IvrhqT4u8enLGjLH3qeh85g19xY5rsAusfwTdn5lg==",
|
||||
"dependencies": {
|
||||
"@floating-ui/utils": "^0.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@floating-ui/dom": {
|
||||
"version": "1.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.6.5.tgz",
|
||||
"integrity": "sha512-Nsdud2X65Dz+1RHjAIP0t8z5e2ff/IRbei6BqFrl1urT8sDVzM1HMQ+R0XcU5ceRfyO3I6ayeqIfh+6Wb8LGTw==",
|
||||
"dependencies": {
|
||||
"@floating-ui/core": "^1.0.0",
|
||||
"@floating-ui/utils": "^0.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@floating-ui/react-dom": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.0.tgz",
|
||||
"integrity": "sha512-lNzj5EQmEKn5FFKc04+zasr09h/uX8RtJRNj5gUXsSQIXHVWTVh+hVAg1vOMCexkX8EgvemMvIFpQfkosnVNyA==",
|
||||
"dependencies": {
|
||||
"@floating-ui/dom": "^1.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@floating-ui/utils": {
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.2.tgz",
|
||||
"integrity": "sha512-J4yDIIthosAsRZ5CPYP/jQvUAQtlZTTD/4suA08/FEnlxqW3sKS9iAhgsa9VYLZ6vDHn/ixJgIqRQPotoBjxIw=="
|
||||
},
|
||||
"node_modules/@hookform/resolvers": {
|
||||
"version": "3.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@hookform/resolvers/-/resolvers-3.3.4.tgz",
|
||||
|
|
@ -533,6 +568,14 @@
|
|||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/number": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/number/-/number-1.0.1.tgz",
|
||||
"integrity": "sha512-T5gIdVO2mmPW3NNhjNgEP3cqMXjXL9UbO0BzWcXfvdBs+BohbQxvd/K5hSVKmn9/lbTdsQVKbUcP5WLCwvUbBg==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.13.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/primitive": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.0.1.tgz",
|
||||
|
|
@ -541,6 +584,29 @@
|
|||
"@babel/runtime": "^7.13.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-arrow": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.0.3.tgz",
|
||||
"integrity": "sha512-wSP+pHsB/jQRaL6voubsQ/ZlrGBHHrOjmBnr19hxYgtS0WvAFwZhK2WP/YY5yF9uKECCEEDGxuLxq1NBK51wFA==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.13.10",
|
||||
"@radix-ui/react-primitive": "1.0.3"
|
||||
},
|
||||
"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-collection": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.0.3.tgz",
|
||||
|
|
@ -764,6 +830,38 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-popper": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.1.3.tgz",
|
||||
"integrity": "sha512-cKpopj/5RHZWjrbF2846jBNacjQVwkP068DfmgrNJXpvVWrOvlAmE9xSiy5OqeE+Gi8D9fP+oDhUnPqNMY8/5w==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.13.10",
|
||||
"@floating-ui/react-dom": "^2.0.0",
|
||||
"@radix-ui/react-arrow": "1.0.3",
|
||||
"@radix-ui/react-compose-refs": "1.0.1",
|
||||
"@radix-ui/react-context": "1.0.1",
|
||||
"@radix-ui/react-primitive": "1.0.3",
|
||||
"@radix-ui/react-use-callback-ref": "1.0.1",
|
||||
"@radix-ui/react-use-layout-effect": "1.0.1",
|
||||
"@radix-ui/react-use-rect": "1.0.1",
|
||||
"@radix-ui/react-use-size": "1.0.1",
|
||||
"@radix-ui/rect": "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-portal": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.0.4.tgz",
|
||||
|
|
@ -865,6 +963,49 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-select": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-select/-/react-select-2.0.0.tgz",
|
||||
"integrity": "sha512-RH5b7af4oHtkcHS7pG6Sgv5rk5Wxa7XI8W5gvB1N/yiuDGZxko1ynvOiVhFM7Cis2A8zxF9bTOUVbRDzPepe6w==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.13.10",
|
||||
"@radix-ui/number": "1.0.1",
|
||||
"@radix-ui/primitive": "1.0.1",
|
||||
"@radix-ui/react-collection": "1.0.3",
|
||||
"@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-dismissable-layer": "1.0.5",
|
||||
"@radix-ui/react-focus-guards": "1.0.1",
|
||||
"@radix-ui/react-focus-scope": "1.0.4",
|
||||
"@radix-ui/react-id": "1.0.1",
|
||||
"@radix-ui/react-popper": "1.1.3",
|
||||
"@radix-ui/react-portal": "1.0.4",
|
||||
"@radix-ui/react-primitive": "1.0.3",
|
||||
"@radix-ui/react-slot": "1.0.2",
|
||||
"@radix-ui/react-use-callback-ref": "1.0.1",
|
||||
"@radix-ui/react-use-controllable-state": "1.0.1",
|
||||
"@radix-ui/react-use-layout-effect": "1.0.1",
|
||||
"@radix-ui/react-use-previous": "1.0.1",
|
||||
"@radix-ui/react-visually-hidden": "1.0.3",
|
||||
"aria-hidden": "^1.1.1",
|
||||
"react-remove-scroll": "2.5.5"
|
||||
},
|
||||
"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-slot": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.0.2.tgz",
|
||||
|
|
@ -1017,6 +1158,59 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-use-previous": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-previous/-/react-use-previous-1.0.1.tgz",
|
||||
"integrity": "sha512-cV5La9DPwiQ7S0gf/0qiD6YgNqM5Fk97Kdrlc5yBcrF3jyEZQwm7vYFqMo4IfeHgJXsRaMvLABFtd0OVEmZhDw==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.13.10"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-use-rect": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-rect/-/react-use-rect-1.0.1.tgz",
|
||||
"integrity": "sha512-Cq5DLuSiuYVKNU8orzJMbl15TXilTnJKUCltMVQg53BQOF1/C5toAaGrowkgksdBQ9H+SRL23g0HDmg9tvmxXw==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.13.10",
|
||||
"@radix-ui/rect": "1.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-use-size": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-size/-/react-use-size-1.0.1.tgz",
|
||||
"integrity": "sha512-ibay+VqrgcaI6veAojjofPATwledXiSmX+C0KrBk/xgpX9rBzPV3OsfwlhQdUOFbh+LKQorLYT+xTXW9V8yd0g==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.13.10",
|
||||
"@radix-ui/react-use-layout-effect": "1.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-visually-hidden": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-visually-hidden/-/react-visually-hidden-1.0.3.tgz",
|
||||
|
|
@ -1040,6 +1234,14 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/rect": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/rect/-/rect-1.0.1.tgz",
|
||||
"integrity": "sha512-fyrgCaedtvMg9NK3en0pnOYJdtfwxUcNolezkNPUsoX57X8oQk+NkqcvzHXD2uKNij6GXmWU9NDru2IWjrO4BQ==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.13.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@rushstack/eslint-patch": {
|
||||
"version": "1.10.1",
|
||||
"resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.10.1.tgz",
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.3.4",
|
||||
"@radix-ui/react-label": "^2.0.2",
|
||||
"@radix-ui/react-select": "^2.0.0",
|
||||
"@radix-ui/react-slot": "^1.0.2",
|
||||
"@radix-ui/react-tabs": "^1.0.4",
|
||||
"@radix-ui/react-toast": "^1.1.5",
|
||||
|
|
|
|||
|
|
@ -3,10 +3,14 @@ axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
|||
|
||||
// Get Instances
|
||||
export async function getInstances() {
|
||||
const data = await axios.get(`/api/CitizenCommon/ShahrbinInstances`, {
|
||||
|
||||
});
|
||||
const data = await axios.get(`/api/CitizenCommon/ShahrbinInstances`, {});
|
||||
console.log(data);
|
||||
|
||||
return data.data;
|
||||
}
|
||||
|
||||
// Get ViolationTypes
|
||||
export async function getViolationTypes() {
|
||||
const data = await axios.get(`/api/CitizenCommon/ViolationTypes`, {});
|
||||
return data.data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ export async function postCitizenReport(payload: {
|
|||
return data.data;
|
||||
}
|
||||
|
||||
|
||||
// Get CitizenReport Nearest
|
||||
export async function getCitizenReportNearest({
|
||||
PageNumber = 1,
|
||||
|
|
@ -63,7 +62,6 @@ export async function getCitizenReportNearest({
|
|||
return data.data;
|
||||
}
|
||||
|
||||
|
||||
// Get Location
|
||||
export async function getLocations() {
|
||||
const data = await axios.get(`/api/CitizenReport/Locations?instanceId=1`);
|
||||
|
|
@ -76,7 +74,6 @@ export async function getSingleLocations(id: any) {
|
|||
return data.data;
|
||||
}
|
||||
|
||||
|
||||
// Get CitizenReport Mine
|
||||
export async function getCitizenReportMine({
|
||||
PageNumber = 1,
|
||||
|
|
@ -97,7 +94,6 @@ export async function getSingleCitizenReportMine(id: string) {
|
|||
return data.data;
|
||||
}
|
||||
|
||||
|
||||
// Put CitizenReport Like
|
||||
export async function SetLike({
|
||||
id,
|
||||
|
|
@ -106,14 +102,17 @@ export async function SetLike({
|
|||
id: string;
|
||||
isLiked: boolean;
|
||||
}) {
|
||||
const data = await axios.put(`/api/CitizenReport/Like/${id}?isLiked=${isLiked}`);
|
||||
const data = await axios.put(
|
||||
`/api/CitizenReport/Like/${id}?isLiked=${isLiked}`
|
||||
);
|
||||
return data.data;
|
||||
}
|
||||
|
||||
|
||||
// Post CitizenReport Comment {id}
|
||||
export async function postComment(id: string, comment: string) {
|
||||
const data = await axios.post(`/api/CitizenReport/Comment/${id}`, { comment });
|
||||
const data = await axios.post(`/api/CitizenReport/Comment/${id}`, {
|
||||
comment,
|
||||
});
|
||||
return data.data;
|
||||
}
|
||||
|
||||
|
|
@ -128,3 +127,25 @@ export async function deleteComment(id: string) {
|
|||
const data = await axios.delete(`/api/CitizenReport/Comment/${id}`);
|
||||
return data.data;
|
||||
}
|
||||
|
||||
// Post CitizenReport CommentViolation {id}
|
||||
export async function postCommentViolation(
|
||||
id: string,
|
||||
payload: { instanceId: number; violationTypeId: number; description: string }
|
||||
) {
|
||||
const data = await axios.post(`/api/CitizenReport/CommentViolation/${id}`, {
|
||||
payload,
|
||||
});
|
||||
return data.data;
|
||||
}
|
||||
|
||||
// Post CitizenReport ReportViolation {id}
|
||||
export async function postReportViolation(
|
||||
id: string,
|
||||
payload: { instanceId: number; violationTypeId: number; description: string }
|
||||
) {
|
||||
const data = await axios.post(`/api/CitizenReport/ReportViolation/${id}`, {
|
||||
payload,
|
||||
});
|
||||
return data.data;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue