Compare commits
3 Commits
38c23c9063
...
b5c5d2963d
| Author | SHA1 | Date |
|---|---|---|
|
|
b5c5d2963d | |
|
|
e1d9413e99 | |
|
|
cd8c85a6a2 |
|
|
@ -0,0 +1,6 @@
|
||||||
|
import CitizenLogin from "@/components/CitizenLogin";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
export default function page() {
|
||||||
|
return <CitizenLogin />;
|
||||||
|
}
|
||||||
|
|
@ -1,13 +1,18 @@
|
||||||
import ComplainsDetails from '@/components/ComplainsDetails'
|
import ComplainsDetails from "@/components/ComplainsDetails";
|
||||||
import React from 'react'
|
import React from "react";
|
||||||
|
|
||||||
export default function page({params}:{params:any}) {
|
|
||||||
|
|
||||||
|
export default function page({ params }: { params: any }) {
|
||||||
const id = params.id;
|
const id = params.id;
|
||||||
{ console.log(params);}
|
{
|
||||||
{ console.log(id);}
|
console.log(params);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
console.log(id);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ComplainsDetails id={id} />
|
<div className="w-[90vw] sm:w-[90vw] lg:w-[85vw] xl:w-[75vw] 3xl:w-[70vw] mt-16 sm:mt-8 pt-9 mx-auto mb-10">
|
||||||
)
|
<ComplainsDetails role="Inspector" id={id} />;
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,199 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import React from "react";
|
||||||
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
|
import { useForm } from "react-hook-form";
|
||||||
|
import * as z from "zod";
|
||||||
|
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import {
|
||||||
|
Form,
|
||||||
|
FormControl,
|
||||||
|
FormDescription,
|
||||||
|
FormField,
|
||||||
|
FormItem,
|
||||||
|
FormLabel,
|
||||||
|
FormMessage,
|
||||||
|
} from "@/components/ui/form";
|
||||||
|
|
||||||
|
import { Input } from "@/components/ui/input";
|
||||||
|
import { toast } from "@/components/ui/use-toast";
|
||||||
|
import Image from "next/image";
|
||||||
|
import LoginIcon from "../public/img/login-icon.svg";
|
||||||
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
|
import { loginStaff, logisterCitizen } from "@/utils/authenticateApi";
|
||||||
|
import { getCaptcha } from "@/utils/commonApi";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { Oval, ThreeDots } from "react-loader-spinner";
|
||||||
|
import useData from "@/store/useData";
|
||||||
|
const FormSchema = z.object({
|
||||||
|
phoneNumber: z.string().min(1, {
|
||||||
|
message: "لطفا شماره موبایل خود را وارد نمایید.",
|
||||||
|
}),
|
||||||
|
captcha: z
|
||||||
|
.string({ required_error: "لطفا کد امنیتی را وارد نمایید." })
|
||||||
|
.length(5, { message: "لطفا کد امنیتی را به طور کامل وارد نمایید." }),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default function CitizenLogin() {
|
||||||
|
const router = useRouter();
|
||||||
|
const saveData = useData((state) => state.saveData);
|
||||||
|
|
||||||
|
const {
|
||||||
|
data: CaptchaData,
|
||||||
|
isLoading,
|
||||||
|
refetch,
|
||||||
|
} = useQuery({
|
||||||
|
queryKey: ["Captcha"],
|
||||||
|
queryFn: () => getCaptcha(),
|
||||||
|
refetchOnWindowFocus: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const loginMutation = useMutation({
|
||||||
|
mutationFn: logisterCitizen,
|
||||||
|
onSuccess: (res) => {},
|
||||||
|
onError: (err: any) => {
|
||||||
|
if (err.response.status == 428) {
|
||||||
|
console.log(useData);
|
||||||
|
router.push("/Verify");
|
||||||
|
localStorage.setItem("VerifyRole", "citizen");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const form = useForm<z.infer<typeof FormSchema>>({
|
||||||
|
resolver: zodResolver(FormSchema),
|
||||||
|
});
|
||||||
|
|
||||||
|
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||||
|
const payload = {
|
||||||
|
phoneNumber: data.phoneNumber,
|
||||||
|
captcha: {
|
||||||
|
key: CaptchaData?.headers["captcha-key"],
|
||||||
|
value: data.captcha,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
loginMutation.mutate(payload);
|
||||||
|
saveData({
|
||||||
|
phoneNumber: data.phoneNumber,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const srcForImage = CaptchaData
|
||||||
|
? URL.createObjectURL(CaptchaData.data)
|
||||||
|
: null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="w-full mt-12 sm:w-2/3 md:w-2/4 xl:w-1/3 bg-white rounded-lg dark:border xl:p-0 dark:bg-gray-800 dark:border-gray-700 shadow-[0px_0px_15px_0px_#00000040]
|
||||||
|
h-full max-md:p-8 pt-12 mb-10"
|
||||||
|
>
|
||||||
|
<div className="space-y-3 md:space-y-4 flex flex-col md:py-10 md:px-12 lg:px-16 h-full justify-center">
|
||||||
|
<Image alt="icon" src={LoginIcon} className="self-center w-1/3 " />
|
||||||
|
|
||||||
|
<p className="text-lg font-bold leading-tight tracking-tight text-blue dark:text-white">
|
||||||
|
احراز هویت
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<Form {...form}>
|
||||||
|
<form
|
||||||
|
onSubmit={form.handleSubmit(onSubmit)}
|
||||||
|
className="w-full flex flex-col "
|
||||||
|
>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="phoneNumber"
|
||||||
|
rules={{ required: true }}
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel className="text-[#7C838A] text-sm font-medium">
|
||||||
|
شماره موبایل
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input
|
||||||
|
className="mb-4"
|
||||||
|
placeholder="شماره موبایل خود را وارد نمایید"
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
{/* <FormDescription>
|
||||||
|
This is your public display name.
|
||||||
|
</FormDescription> */}
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<div className="flex gap-4 mt-4 items-center">
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="captcha"
|
||||||
|
rules={{ required: true }}
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem className=" items-center h-10 flex-1">
|
||||||
|
{/* <FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||||
|
رمز عبور
|
||||||
|
</FormLabel> */}
|
||||||
|
<FormControl>
|
||||||
|
<Input placeholder="کد امنیتی" {...field} />
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
{isLoading ? (
|
||||||
|
<div className=" w-36 flex justify-center text-center">
|
||||||
|
<ThreeDots
|
||||||
|
visible={true}
|
||||||
|
height="50"
|
||||||
|
width="50"
|
||||||
|
color="#003778"
|
||||||
|
radius="9"
|
||||||
|
ariaLabel="three-dots-loading"
|
||||||
|
wrapperStyle={{}}
|
||||||
|
wrapperClass=""
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className=" flex justify-center text-center">
|
||||||
|
<Image
|
||||||
|
alt="icon"
|
||||||
|
src={srcForImage as string}
|
||||||
|
className=" h-12 rounded-md shadow-md w-36"
|
||||||
|
width={150}
|
||||||
|
height={20}
|
||||||
|
quality={100}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="flex justify-end gap-2 w-full mt-14">
|
||||||
|
<Button
|
||||||
|
disabled={loginMutation.isPending}
|
||||||
|
type="submit"
|
||||||
|
className="bg-blue hover:bg-blue/90 transition text-white w-1/2 md:w-1/3 p-2 rounded-xl"
|
||||||
|
>
|
||||||
|
{loginMutation.isPending ? (
|
||||||
|
<div className="flex justify-center items-center gap-2">
|
||||||
|
<Oval
|
||||||
|
visible={true}
|
||||||
|
height="20"
|
||||||
|
width="20"
|
||||||
|
color="#fff"
|
||||||
|
ariaLabel="oval-loading"
|
||||||
|
wrapperStyle={{}}
|
||||||
|
wrapperClass=""
|
||||||
|
/>
|
||||||
|
{/* <p>در حال انجام ...</p> */}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
"تایید"
|
||||||
|
)}
|
||||||
|
{/* ورود */}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -5,40 +5,62 @@ import blueIcon from "../public/img/bluepoint.svg";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { ComplainDetailsItems } from "@/constants";
|
import { ComplainDetailsItems } from "@/constants";
|
||||||
import { useMutation } from "@tanstack/react-query";
|
import { useMutation } from "@tanstack/react-query";
|
||||||
import { getComplaint } from "@/utils/inspectorApi";
|
import { OperateByInspector, getComplaint } from "@/utils/inspectorApi";
|
||||||
import useData from "@/store/useData";
|
import useData from "@/store/useData";
|
||||||
import { convertDate } from "@/lib/utils";
|
import { convertDate } from "@/lib/utils";
|
||||||
import { Badge } from "./ui/badge";
|
import { Badge } from "./ui/badge";
|
||||||
import InspectorOperations from "./InspectorOperations";
|
import InspectorOperations from "./InspectorOperations";
|
||||||
|
import { postComplaintTracking } from "@/utils/citizenApi";
|
||||||
|
|
||||||
export default function ComplainsDetails({ id }: { id: number }) {
|
export default function ComplainsDetails({
|
||||||
const complainData = useData((state) => state.data);
|
id,
|
||||||
const getComplaintMutation = useMutation({
|
role,
|
||||||
|
Data,
|
||||||
|
}: {
|
||||||
|
id?: number;
|
||||||
|
role: string;
|
||||||
|
Data?: any;
|
||||||
|
}) {
|
||||||
|
const storeData = useData((state) => state.data);
|
||||||
|
let data;
|
||||||
|
|
||||||
|
const getComplaintMutation = useMutation<
|
||||||
|
any,
|
||||||
|
Error,
|
||||||
|
{ trackingNumber: string; password: string }
|
||||||
|
>({
|
||||||
mutationKey: ["Complaint", id],
|
mutationKey: ["Complaint", id],
|
||||||
mutationFn: getComplaint,
|
mutationFn:
|
||||||
|
role == "Inspector"
|
||||||
|
? (getComplaint as any)
|
||||||
|
: (postComplaintTracking as any),
|
||||||
onSuccess: (res) => {},
|
onSuccess: (res) => {},
|
||||||
onError: (err) => {},
|
onError: (err) => {},
|
||||||
});
|
});
|
||||||
console.log(complainData);
|
|
||||||
|
console.log(storeData);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (role == "Inspector") {
|
||||||
useData.persist.rehydrate();
|
useData.persist.rehydrate();
|
||||||
|
}
|
||||||
}, []);
|
}, []);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (complainData) {
|
if (storeData && role == "Inspector") {
|
||||||
getComplaintMutation.mutate(complainData);
|
getComplaintMutation.mutate(storeData);
|
||||||
}
|
}
|
||||||
}, [complainData]);
|
}, [storeData]);
|
||||||
let data;
|
|
||||||
if (getComplaintMutation.isSuccess) {
|
if (getComplaintMutation.isSuccess) {
|
||||||
console.log(getComplaintMutation.data);
|
|
||||||
data = getComplaintMutation.data;
|
data = getComplaintMutation.data;
|
||||||
console.log(data);
|
} else if (Data) {
|
||||||
|
data = Data;
|
||||||
}
|
}
|
||||||
|
console.log(Data);
|
||||||
return (
|
return (
|
||||||
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-16 sm:mt-8 pt-9 mx-auto mb-10">
|
<>
|
||||||
{data ? (
|
{data ? (
|
||||||
<div className="w-full flex gap-3 items-start">
|
<div className="w-full flex max-lg:flex-col gap-3 items-start">
|
||||||
<div className="flex flex-col w-1/3 order-2 gap-3 !sticky top-40 ">
|
<div className="flex flex-col w-full lg:w-1/3 lg:order-2 gap-3 lg:sticky top-40">
|
||||||
<div className=" bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col">
|
<div className=" bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col">
|
||||||
<p className="text-[#464646] text-base font-bold">گزارش شکایت</p>
|
<p className="text-[#464646] text-base font-bold">گزارش شکایت</p>
|
||||||
<div className="mt-2">
|
<div className="mt-2">
|
||||||
|
|
@ -80,17 +102,26 @@ export default function ComplainsDetails({ id }: { id: number }) {
|
||||||
0353286545 جهت پشتیبانی تماس حاصل کنید.{" "}
|
0353286545 جهت پشتیبانی تماس حاصل کنید.{" "}
|
||||||
</p> */}
|
</p> */}
|
||||||
</div>
|
</div>
|
||||||
<div className=" order-2 bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col">
|
<div className=" max-lg:hidden order-2 bg-[#E9E9E9] rounded-md p-4 px-10 flex flex-col">
|
||||||
<p className="text-[#464646] text-base font-bold">انجام عملیات</p>
|
<p className="text-[#464646] text-base font-bold mb-1">
|
||||||
<InspectorOperations />
|
انجام عملیات
|
||||||
|
</p>
|
||||||
|
<InspectorOperations
|
||||||
|
updateData={() => getComplaintMutation.mutate(storeData)}
|
||||||
|
role={role}
|
||||||
|
complaintData={data}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className=" w-2/3 bg-[#E9E9E9] p-4 px-10 rounded-lg">
|
<div className="w-full lg:w-2/3 self-stretch bg-[#E9E9E9] p-4 px-10 rounded-lg">
|
||||||
<p className="text-[#464646] text-base font-bold">روند شکایت</p>
|
<p className="text-[#464646] text-base font-bold">روند شکایت</p>
|
||||||
<div className=" flex flex-col gap-y-4 mt-4">
|
<div className=" flex flex-col gap-y-4 mt-4">
|
||||||
{data.contents?.map((item: any) => {
|
{data.contents?.map((item: any) => {
|
||||||
return (
|
return (
|
||||||
<div key={item.id} className=" bg-white p-4 rounded-lg shadow-md">
|
<div
|
||||||
|
key={item.id}
|
||||||
|
className=" bg-white p-4 rounded-lg shadow-md"
|
||||||
|
>
|
||||||
<div className=" flex gap-4 items-center">
|
<div className=" flex gap-4 items-center">
|
||||||
<p className="">
|
<p className="">
|
||||||
<Badge>{item.sender == 0 ? "شهروند" : "بازرس"}</Badge>
|
<Badge>{item.sender == 0 ? "شهروند" : "بازرس"}</Badge>
|
||||||
|
|
@ -102,114 +133,27 @@ export default function ComplainsDetails({ id }: { id: number }) {
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className=" text-[#7C838A] mt-2">
|
<div className=" text-[#464646] mt-2">
|
||||||
متن: {item.text ? item.text : "-"}
|
متن:{" "}
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
{data.contents?.map((item: any) => {
|
|
||||||
return (
|
|
||||||
<div key={item.id} className=" bg-white p-4 rounded-lg shadow-md">
|
|
||||||
<div className=" flex gap-4 items-center">
|
|
||||||
<p className="">
|
|
||||||
<Badge>{item.sender == 0 ? "شهروند" : "بازرس"}</Badge>
|
|
||||||
</p>
|
|
||||||
<p className="">
|
|
||||||
تاریخ :
|
|
||||||
<span className="text-[#7C838A]">
|
<span className="text-[#7C838A]">
|
||||||
{convertDate(item.dateTime)}
|
{item.text ? item.text : "-"}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div className=" text-[#7C838A] mt-2">
|
|
||||||
متن: {item.text ? item.text : "-"}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
{data.contents?.map((item: any) => {
|
|
||||||
return (
|
|
||||||
<div key={item.id} className=" bg-white p-4 rounded-lg shadow-md">
|
|
||||||
<div className=" flex gap-4 items-center">
|
|
||||||
<p className="">
|
|
||||||
<Badge>{item.sender == 0 ? "شهروند" : "بازرس"}</Badge>
|
|
||||||
</p>
|
|
||||||
<p className="">
|
|
||||||
تاریخ :
|
|
||||||
<span className="text-[#7C838A]">
|
|
||||||
{convertDate(item.dateTime)}
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div className=" text-[#7C838A] mt-2">
|
|
||||||
متن: {item.text ? item.text : "-"}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
{data.contents?.map((item: any) => {
|
|
||||||
return (
|
|
||||||
<div key={item.id} className=" bg-white p-4 rounded-lg shadow-md">
|
|
||||||
<div className=" flex gap-4 items-center">
|
|
||||||
<p className="">
|
|
||||||
<Badge>{item.sender == 0 ? "شهروند" : "بازرس"}</Badge>
|
|
||||||
</p>
|
|
||||||
<p className="">
|
|
||||||
تاریخ :
|
|
||||||
<span className="text-[#7C838A]">
|
|
||||||
{convertDate(item.dateTime)}
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div className=" text-[#7C838A] mt-2">
|
|
||||||
متن: {item.text ? item.text : "-"}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
{data.contents?.map((item: any) => {
|
|
||||||
return (
|
|
||||||
<div key={item.id} className=" bg-white p-4 rounded-lg shadow-md">
|
|
||||||
<div className=" flex gap-4 items-center">
|
|
||||||
<p className="">
|
|
||||||
<Badge>{item.sender == 0 ? "شهروند" : "بازرس"}</Badge>
|
|
||||||
</p>
|
|
||||||
<p className="">
|
|
||||||
تاریخ :
|
|
||||||
<span className="text-[#7C838A]">
|
|
||||||
{convertDate(item.dateTime)}
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div className=" text-[#7C838A] mt-2">
|
|
||||||
متن: {item.text ? item.text : "-"}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
{data.contents?.map((item: any) => {
|
|
||||||
return (
|
|
||||||
<div key={item.id} className=" bg-white p-4 rounded-lg shadow-md">
|
|
||||||
<div className=" flex gap-4 items-center">
|
|
||||||
<p className="">
|
|
||||||
<Badge>{item.sender == 0 ? "شهروند" : "بازرس"}</Badge>
|
|
||||||
</p>
|
|
||||||
<p className="">
|
|
||||||
تاریخ :
|
|
||||||
<span className="text-[#7C838A]">
|
|
||||||
{convertDate(item.dateTime)}
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div className=" text-[#7C838A] mt-2">
|
|
||||||
متن: {item.text ? item.text : "-"}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className=" lg:hidden order-2 w-full bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col">
|
||||||
|
<p className="text-[#464646] text-base font-bold mb-1">
|
||||||
|
انجام عملیات
|
||||||
|
</p>
|
||||||
|
<InspectorOperations
|
||||||
|
updateData={() => getComplaintMutation.mutate(storeData)}
|
||||||
|
role={role}
|
||||||
|
complaintData={data}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
{/* Left */}
|
{/* Left */}
|
||||||
{/* <div className="w-full md:w-1/3 bg-white shadow-lg rounded-md pt-3 px-4 flex flex-row md:flex-col max-md:flex-wrap">
|
{/* <div className="w-full md:w-1/3 bg-white shadow-lg rounded-md pt-3 px-4 flex flex-row md:flex-col max-md:flex-wrap">
|
||||||
<p className="text-[#464646] text-base font-bold mb-3">
|
<p className="text-[#464646] text-base font-bold mb-3">
|
||||||
|
|
@ -253,6 +197,6 @@ export default function ComplainsDetails({ id }: { id: number }) {
|
||||||
) : (
|
) : (
|
||||||
""
|
""
|
||||||
)}
|
)}
|
||||||
</div>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,8 @@ import { postComplaintTracking } from "@/utils/citizenApi";
|
||||||
import { useMutation } from "@tanstack/react-query";
|
import { useMutation } from "@tanstack/react-query";
|
||||||
import { useReactToPrint } from "react-to-print";
|
import { useReactToPrint } from "react-to-print";
|
||||||
|
|
||||||
import '../app/print-styles.css';
|
import "../app/print-styles.css";
|
||||||
|
import ComplainsDetails from "./ComplainsDetails";
|
||||||
|
|
||||||
export default function FollowResult() {
|
export default function FollowResult() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
@ -32,7 +33,6 @@ export default function FollowResult() {
|
||||||
const [complaintData, setComplaintData] = useState<any>();
|
const [complaintData, setComplaintData] = useState<any>();
|
||||||
const [printStyle, setPrintStyle] = useState<boolean>(true);
|
const [printStyle, setPrintStyle] = useState<boolean>(true);
|
||||||
|
|
||||||
|
|
||||||
// Print component Data
|
// Print component Data
|
||||||
const componentRef = useRef<HTMLDivElement>(null);
|
const componentRef = useRef<HTMLDivElement>(null);
|
||||||
const handlePrint = useReactToPrint({
|
const handlePrint = useReactToPrint({
|
||||||
|
|
@ -50,19 +50,19 @@ export default function FollowResult() {
|
||||||
setPassword(localStorage.getItem("password2"));
|
setPassword(localStorage.getItem("password2"));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (trackingNumber && password) {
|
||||||
|
complaintPrintMutation.mutate({
|
||||||
|
Data: { trackingNumber: trackingNumber, password: password },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [trackingNumber, password]);
|
||||||
|
|
||||||
const complaintPrintMutation = useMutation({
|
const complaintPrintMutation = useMutation({
|
||||||
mutationKey: ["complaintPrint"],
|
mutationKey: ["complaintPrint"],
|
||||||
mutationFn: postComplaintTracking,
|
mutationFn: postComplaintTracking,
|
||||||
|
|
||||||
onSuccess: (res) => {
|
onSuccess: (res) => {
|
||||||
console.log(res);
|
|
||||||
// alert("SuccessPrint");
|
|
||||||
console.log("Success Folllow Result");
|
|
||||||
console.log(res);
|
|
||||||
|
|
||||||
setComplaintData(res);
|
setComplaintData(res);
|
||||||
console.log(complaintData);
|
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|
@ -73,15 +73,22 @@ export default function FollowResult() {
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
console.log("SuccessPrinttttttttttt");
|
console.log("SuccessPrinttttttttttt");
|
||||||
|
|
||||||
complaintPrintMutation.mutate({
|
// complaintPrintMutation.mutate({
|
||||||
Data: { trackingNumber: trackingNumber, password: password },
|
// Data: { trackingNumber: trackingNumber, password: password },
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
|
// const possibleOperations = complaintPrintMutation.data?.possibleOperations;
|
||||||
|
// const selectOptions = Operations.filter((item, index) =>
|
||||||
|
// possibleOperations.includes(index)
|
||||||
|
// );
|
||||||
|
|
||||||
|
const printableContent = "This is the content to be printed.";
|
||||||
|
console.log(complaintPrintMutation?.data);
|
||||||
return (
|
return (
|
||||||
<div className="w-full h-full sm:w-2/3 md:w-3/4 lg:w-1/2 max-sm:p-8 pt-12">
|
<>
|
||||||
<div className="h-full flex flex-col justify-center">
|
<div className="w-[90vw] sm:w-[90vw] lg:w-[85vw] xl:w-[75vw] 3xl:w-[70vw] max-sm:mt-16 pt-4 mx-auto mb-10">
|
||||||
<p
|
{/* <div className="h-full flex flex-col justify-center"> */}
|
||||||
|
{/* <p
|
||||||
className="text-sm font-medium leading-6 tracking-wide text-[#7C838A] dark:text-white
|
className="text-sm font-medium leading-6 tracking-wide text-[#7C838A] dark:text-white
|
||||||
3xl:text-base 3xl:font-bold"
|
3xl:text-base 3xl:font-bold"
|
||||||
>
|
>
|
||||||
|
|
@ -91,16 +98,17 @@ export default function FollowResult() {
|
||||||
<span className="text-slate-500 mx-2">{`${password}`}</span>
|
<span className="text-slate-500 mx-2">{`${password}`}</span>
|
||||||
در دست بررسی و اقدام می باشد. در صورت تمایل می توانید با شماره تلفن
|
در دست بررسی و اقدام می باشد. در صورت تمایل می توانید با شماره تلفن
|
||||||
0353286545 جهت پشتیبانی تماس حاصل کنید.
|
0353286545 جهت پشتیبانی تماس حاصل کنید.
|
||||||
</p>
|
</p> */}
|
||||||
|
{complaintPrintMutation?.data ? (
|
||||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
|
<>
|
||||||
|
<div className="flex justify-center sm:justify-end gap-2 mb-2">
|
||||||
<AlertDialog>
|
<AlertDialog>
|
||||||
<AlertDialogTrigger asChild>
|
<AlertDialogTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
type="submit"
|
type="submit"
|
||||||
onClick={() => onSubmit()}
|
onClick={() => onSubmit()}
|
||||||
className="w-1/2 sm:w-1/3 lg:w-1/4 bg-blue text-white p-2 rounded-xl text-center"
|
className="w-fit bg-blue text-white p-2 rounded-xl text-center"
|
||||||
>
|
>
|
||||||
پرینت درخواست
|
پرینت درخواست
|
||||||
</Button>
|
</Button>
|
||||||
|
|
@ -133,7 +141,11 @@ export default function FollowResult() {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div dir="rtl" className=" font-[yekan] px-10 py-4 sm:px-28 sm:pt-9 " id="details" ref={componentRef}
|
<div
|
||||||
|
dir="rtl"
|
||||||
|
className=" font-[yekan] px-10 py-4 sm:px-28 sm:pt-9 "
|
||||||
|
id="details"
|
||||||
|
ref={componentRef}
|
||||||
// style={{ border: printStyle ? 'none' : '5px solid black' , margin: printStyle ? 'auto': '1em' }}
|
// style={{ border: printStyle ? 'none' : '5px solid black' , margin: printStyle ? 'auto': '1em' }}
|
||||||
>
|
>
|
||||||
<p className="text-[#464646] text-sm font-medium">
|
<p className="text-[#464646] text-sm font-medium">
|
||||||
|
|
@ -162,34 +174,41 @@ export default function FollowResult() {
|
||||||
<span className="text-slate-500 mx-2">{`${trackingNumber}`}</span>
|
<span className="text-slate-500 mx-2">{`${trackingNumber}`}</span>
|
||||||
و رمز عبور
|
و رمز عبور
|
||||||
<span className="text-slate-500 mx-2">{`${password}`}</span>
|
<span className="text-slate-500 mx-2">{`${password}`}</span>
|
||||||
در دست بررسی و اقدام می باشد. در صورت تمایل می توانید با
|
در دست بررسی و اقدام می باشد. در صورت تمایل می
|
||||||
شماره تلفن 0353286545 جهت پشتیبانی تماس حاصل کنید.
|
توانید با شماره تلفن 0353286545 جهت پشتیبانی تماس
|
||||||
|
حاصل کنید.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</AlertDialogDescription>
|
</AlertDialogDescription>
|
||||||
</AlertDialogHeader>
|
</AlertDialogHeader>
|
||||||
<AlertDialogFooter>
|
<AlertDialogFooter>
|
||||||
{/* <AlertDialogCancel>Cancel</AlertDialogCancel> */}
|
|
||||||
<Button
|
<Button
|
||||||
className="bg-blue text-white w-1/2 sm:w-1/6"
|
className="bg-blue text-white w-1/2 sm:w-1/6"
|
||||||
onClick={handlePrint}
|
onClick={handlePrint}
|
||||||
>
|
>
|
||||||
پرینت گزارش
|
پرینت گزارش
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
</AlertDialogFooter>
|
</AlertDialogFooter>
|
||||||
</AlertDialogContent>
|
</AlertDialogContent>
|
||||||
</AlertDialog>
|
</AlertDialog>
|
||||||
</div>
|
</div>
|
||||||
|
<ComplainsDetails
|
||||||
|
role="Citizen"
|
||||||
|
Data={complaintPrintMutation?.data}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
|
|
||||||
<Image
|
{/* <Image
|
||||||
alt="icon"
|
alt="icon"
|
||||||
src={Resultimg}
|
src={Resultimg}
|
||||||
className="self-center w-3/5 mt-5 sm:w-[23em] sm:h-[20em] 3xl:w-3/5 3xl:h-[30em] object-contain"
|
className="self-center w-3/5 mt-5 sm:w-[23em] sm:h-[20em] 3xl:w-3/5 3xl:h-[30em] object-contain"
|
||||||
/>
|
/> */}
|
||||||
</div>
|
{/* </div> */}
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,36 +15,103 @@ import {
|
||||||
FormMessage,
|
FormMessage,
|
||||||
} from "@/components/ui/form";
|
} from "@/components/ui/form";
|
||||||
import { Textarea } from "@/components/ui/textarea";
|
import { Textarea } from "@/components/ui/textarea";
|
||||||
import { toast } from "@/components/ui/use-toast";
|
|
||||||
import { Label } from "./ui/label";
|
import { Label } from "./ui/label";
|
||||||
import { Input } from "./ui/input";
|
import { Input } from "./ui/input";
|
||||||
import { RadioGroup, RadioGroupItem } from "./ui/radio-group";
|
import { RadioGroup, RadioGroupItem } from "./ui/radio-group";
|
||||||
|
import {
|
||||||
|
Select,
|
||||||
|
SelectContent,
|
||||||
|
SelectGroup,
|
||||||
|
SelectItem,
|
||||||
|
SelectLabel,
|
||||||
|
SelectTrigger,
|
||||||
|
SelectValue,
|
||||||
|
} from "@/components/ui/select";
|
||||||
|
import { Operations } from "@/constants";
|
||||||
|
import useData from "@/store/useData";
|
||||||
|
import { useMutation } from "@tanstack/react-query";
|
||||||
|
import { OperateByInspector } from "@/utils/inspectorApi";
|
||||||
|
import { toast } from "sonner";
|
||||||
|
import { postComplaintsDetails } from "@/utils/citizenApi";
|
||||||
|
|
||||||
const FormSchema = z.object({
|
export default function InspectorOperations({
|
||||||
bio: z
|
complaintData,
|
||||||
.string()
|
role,
|
||||||
.min(10, {
|
updateData,
|
||||||
message: "Bio must be at least 10 characters.",
|
}: {
|
||||||
|
complaintData: any;
|
||||||
|
role: string;
|
||||||
|
updateData: () => any;
|
||||||
|
}) {
|
||||||
|
const FormSchema = z.object({
|
||||||
|
text: z
|
||||||
|
.string({ required_error: "لطفا متن خود را وارد نمایید." })
|
||||||
|
.min(8, {
|
||||||
|
message: "Bio must be at least 8 characters.",
|
||||||
})
|
})
|
||||||
.max(160, {
|
.max(260, {
|
||||||
message: "Bio must not be longer than 30 characters.",
|
message: "Bio must not be longer than 30 characters.",
|
||||||
}),
|
}),
|
||||||
});
|
...(role == "Inspector" && {
|
||||||
|
type: z.enum(["private", "public"], {
|
||||||
|
required_error: "لطفا وضعیت عملیات را انتخاب نمایید.",
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
operation: z.string({
|
||||||
|
required_error: "Please select an email to display.",
|
||||||
|
}),
|
||||||
|
media: z
|
||||||
|
.custom<FileList>((val) => val instanceof FileList, "Required")
|
||||||
|
// .refine((files) => files.length > 0, `Required`)
|
||||||
|
.refine((files) => files.length <= 5, `Maximum of 5 File are allowed.`)
|
||||||
|
.nullish(),
|
||||||
|
});
|
||||||
|
const password = useData((state) => state.data.password);
|
||||||
|
const possibleOperations = complaintData?.possibleOperations;
|
||||||
|
const selectOptions = Operations.filter((item, index) =>
|
||||||
|
possibleOperations.includes(index)
|
||||||
|
);
|
||||||
|
|
||||||
export default function InspectorOperations() {
|
|
||||||
const form = useForm<z.infer<typeof FormSchema>>({
|
const form = useForm<z.infer<typeof FormSchema>>({
|
||||||
resolver: zodResolver(FormSchema),
|
resolver: zodResolver(FormSchema),
|
||||||
|
defaultValues: {
|
||||||
|
operation:
|
||||||
|
selectOptions.length == 1 ? String(selectOptions[0].value) : undefined,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const OperationMutation = useMutation({
|
||||||
|
mutationKey: ["Operation"],
|
||||||
|
mutationFn:
|
||||||
|
role == "Inspector" ? OperateByInspector : postComplaintsDetails,
|
||||||
|
onSuccess: (res) => {
|
||||||
|
toast("عملیات شما با موفقیت انجام شد. ", {
|
||||||
|
className: "!bg-green-500 !text-white",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onError: (err) => {},
|
||||||
});
|
});
|
||||||
|
|
||||||
function onSubmit(data: z.infer<typeof FormSchema>) {
|
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||||
toast({
|
console.log(data);
|
||||||
title: "You submitted the following values:",
|
const formData = new FormData();
|
||||||
description: (
|
formData.append("text", data.text);
|
||||||
<pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
|
formData.append("trackingNumber", complaintData.trackingNumber);
|
||||||
<code className="text-white">{JSON.stringify(data, null, 2)}</code>
|
formData.append("Operation", data.operation);
|
||||||
</pre>
|
if (data.type) {
|
||||||
),
|
formData.append("IsPublic", data.type == "public" ? "true" : "false");
|
||||||
});
|
}
|
||||||
|
if (role == "Inspector") {
|
||||||
|
formData.append("EncodedKey", password);
|
||||||
|
} else {
|
||||||
|
formData.append("password", localStorage.getItem("password2") as string);
|
||||||
|
}
|
||||||
|
if (data?.media && data?.media?.length > 0) {
|
||||||
|
for (let i = 0; i < data.media.length; i++) {
|
||||||
|
formData.append("Medias", data.media[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OperationMutation.mutate(formData);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -52,13 +119,13 @@ export default function InspectorOperations() {
|
||||||
<form onSubmit={form.handleSubmit(onSubmit)} className="">
|
<form onSubmit={form.handleSubmit(onSubmit)} className="">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="bio"
|
name="text"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel className="">متن</FormLabel>
|
<FormLabel className="">متن</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Textarea
|
<Textarea
|
||||||
placeholder="Tell us a little bit about yourself"
|
placeholder="متن خود را وارد نمایید"
|
||||||
className="resize-none bg-white"
|
className="resize-none bg-white"
|
||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
|
|
@ -70,10 +137,33 @@ export default function InspectorOperations() {
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<div className="grid w-full max-w-sm items-center gap-1.5 mt-1">
|
{/* <div className="grid w-full max-w-sm items-center gap-1.5 mt-1">
|
||||||
<Label htmlFor="picture">پیوست</Label>
|
<Label htmlFor="picture">پیوست</Label>
|
||||||
<Input multiple id="picture" type="file" className=" bg-white" />
|
<Input multiple id="picture" type="file" className=" bg-white" />
|
||||||
</div>
|
</div> */}
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="media"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>پیوست</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input
|
||||||
|
accept=".jpg, .jpeg, .png, .svg, .gif, .mp4 , .pdf"
|
||||||
|
type="file"
|
||||||
|
onChange={(e) => {
|
||||||
|
field.onChange(e.target.files ? e.target.files : null);
|
||||||
|
console.log(e.target.files);
|
||||||
|
}}
|
||||||
|
multiple
|
||||||
|
className=" bg-white"
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
{role == "Inspector" && (
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="type"
|
name="type"
|
||||||
|
|
@ -103,8 +193,56 @@ export default function InspectorOperations() {
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<div className=" flex justify-end mt-1">
|
)}
|
||||||
<Button className=" bg-blue" type="submit">
|
|
||||||
|
<div className=" flex justify-between mt-3 gap-2">
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="operation"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem className=" flex-1">
|
||||||
|
{/* <FormLabel>Email</FormLabel> */}
|
||||||
|
<Select
|
||||||
|
onValueChange={field.onChange}
|
||||||
|
defaultValue={field.value}
|
||||||
|
dir="rtl"
|
||||||
|
>
|
||||||
|
<FormControl>
|
||||||
|
<SelectTrigger
|
||||||
|
className=" bg-white h-10 !placeholder:text-xs text-xs"
|
||||||
|
dir="rtl"
|
||||||
|
>
|
||||||
|
<SelectValue
|
||||||
|
className=" text-xs"
|
||||||
|
placeholder="نوع عملیات را انتخاب نمایید."
|
||||||
|
/>
|
||||||
|
</SelectTrigger>
|
||||||
|
</FormControl>
|
||||||
|
<SelectContent dir="rtl">
|
||||||
|
<SelectGroup>
|
||||||
|
<SelectLabel>عملیات</SelectLabel>
|
||||||
|
{selectOptions.map((item) => {
|
||||||
|
return (
|
||||||
|
<SelectItem value={String(item.value)}>
|
||||||
|
{item.name}
|
||||||
|
</SelectItem>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</SelectGroup>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
{/* <FormDescription>
|
||||||
|
You can manage email addresses in your{" "}
|
||||||
|
</FormDescription> */}
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
disabled={possibleOperations.length == 0}
|
||||||
|
className=" bg-blue w-1/3"
|
||||||
|
type="submit"
|
||||||
|
>
|
||||||
ثبت
|
ثبت
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -368,7 +368,6 @@ export default function RequestStep2() {
|
||||||
</div>
|
</div>
|
||||||
{/* Captcha */}
|
{/* Captcha */}
|
||||||
<div className="flex flex-row flex-wrap justify-between">
|
<div className="flex flex-row flex-wrap justify-between">
|
||||||
|
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="captchaValue"
|
name="captchaValue"
|
||||||
|
|
@ -401,7 +400,6 @@ export default function RequestStep2() {
|
||||||
)}
|
)}
|
||||||
{/* <Image src={Img1} alt="1" width={50} height={50} /> */}
|
{/* <Image src={Img1} alt="1" width={50} height={50} /> */}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-4">
|
<div className="flex justify-center sm:justify-end gap-2 w-full mt-4">
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ export default function Search({ mode }: { mode: string }) {
|
||||||
className={`mb-0 h-8 bg-[#D6D8DE66] border-none focus-visible:none rounded-lg
|
className={`mb-0 h-8 bg-[#D6D8DE66] border-none focus-visible:none rounded-lg
|
||||||
block w-full min-w-[13rem] lg:min-w-[16rem] text-xs text-black
|
block w-full min-w-[13rem] lg:min-w-[16rem] text-xs text-black
|
||||||
text-opacity-60 dark:text-white
|
text-opacity-60 dark:text-white
|
||||||
${mode === "controller" && "h-12 max-lg:min-w-[95vw]"}
|
${mode === "controller" && "h-14 max-lg:min-w-[95vw]"}
|
||||||
${
|
${
|
||||||
mode === "admin" &&
|
mode === "admin" &&
|
||||||
"w-full min-w-full bg-white lg:min-w-full h-11"
|
"w-full min-w-full bg-white lg:min-w-full h-11"
|
||||||
|
|
|
||||||
|
|
@ -80,9 +80,9 @@ export default function TabController() {
|
||||||
</Button>
|
</Button>
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
<Tabs defaultValue="tab1" className="" dir="rtl">
|
<Tabs defaultValue="tab1" className="" dir="rtl">
|
||||||
<div className="w-full flex flex-col-reverse lg:flex-row gap-4 lg:gap-12 justify-between items-center mb-10">
|
<div className="w-full flex flex-col-reverse lg:flex-row gap-4 lg:gap-5 justify-between items-center mb-10">
|
||||||
{/* Tab Title */}
|
{/* Tab Title */}
|
||||||
<TabsList className="w-full lg:w-2/3 flex gap-1 md:gap-4 lg:gap-7">
|
<TabsList className="w-full flex gap-1 md:gap-4 lg:gap-7">
|
||||||
<p className="3xl:ml-6 text-xs sm:text-sm font-bold">
|
<p className="3xl:ml-6 text-xs sm:text-sm font-bold">
|
||||||
لیست شکایت ها |
|
لیست شکایت ها |
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -108,6 +108,12 @@ export default function TabController() {
|
||||||
<TabsTrigger
|
<TabsTrigger
|
||||||
value="tab4"
|
value="tab4"
|
||||||
className="hover:border-b-2 border-b-blue"
|
className="hover:border-b-2 border-b-blue"
|
||||||
|
>
|
||||||
|
پاسخ داده شده
|
||||||
|
</TabsTrigger>
|
||||||
|
<TabsTrigger
|
||||||
|
value="tab5"
|
||||||
|
className="hover:border-b-2 border-b-blue"
|
||||||
>
|
>
|
||||||
پایان یافته
|
پایان یافته
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
|
|
@ -140,6 +146,13 @@ export default function TabController() {
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
|
|
||||||
<TabsContent value="tab4">
|
<TabsContent value="tab4">
|
||||||
|
<TableController
|
||||||
|
checkKey={(item: any) => checkKey(item)}
|
||||||
|
data={citizenRepliedComplaints}
|
||||||
|
/>
|
||||||
|
</TabsContent>
|
||||||
|
|
||||||
|
<TabsContent value="tab5">
|
||||||
<TableController
|
<TableController
|
||||||
checkKey={(item: any) => checkKey(item)}
|
checkKey={(item: any) => checkKey(item)}
|
||||||
data={finishedComplaints}
|
data={finishedComplaints}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import React, { useEffect, useState } from "react";
|
||||||
import LoginIcon from "../public/img/login-icon.svg";
|
import LoginIcon from "../public/img/login-icon.svg";
|
||||||
import OtpInput from "react-otp-input";
|
import OtpInput from "react-otp-input";
|
||||||
import { Button } from "./ui/button";
|
import { Button } from "./ui/button";
|
||||||
import { verifyStaff } from "@/utils/authenticateApi";
|
import { verifyCitizen, verifyStaff } from "@/utils/authenticateApi";
|
||||||
import { useMutation } from "@tanstack/react-query";
|
import { useMutation } from "@tanstack/react-query";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import useData from "@/store/useData";
|
import useData from "@/store/useData";
|
||||||
|
|
@ -17,7 +17,7 @@ export default function Verify() {
|
||||||
const space = "\xa0";
|
const space = "\xa0";
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const userData = useData((state) => state.data);
|
const userData = useData((state) => state.data);
|
||||||
|
const [VerifyRole, setVerifyRole] = useState<any>("");
|
||||||
const verifyMutation = useMutation({
|
const verifyMutation = useMutation({
|
||||||
mutationFn: verifyStaff,
|
mutationFn: verifyStaff,
|
||||||
onSuccess: (res) => {
|
onSuccess: (res) => {
|
||||||
|
|
@ -38,11 +38,30 @@ export default function Verify() {
|
||||||
},
|
},
|
||||||
onError: (err: any) => {},
|
onError: (err: any) => {},
|
||||||
});
|
});
|
||||||
|
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 = () => {
|
const handelVerify = () => {
|
||||||
console.log(otp);
|
console.log(otp);
|
||||||
const payload = { ...userData, verificationCode: otp };
|
const payload = { ...userData, verificationCode: otp };
|
||||||
|
console.log(userData);
|
||||||
|
if (userData?.phoneNumber) {
|
||||||
|
CitizenVerifyMutation.mutate(payload);
|
||||||
|
} else {
|
||||||
verifyMutation.mutate(payload);
|
verifyMutation.mutate(payload);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -68,7 +87,7 @@ export default function Verify() {
|
||||||
renderInput={(props, idx) => (
|
renderInput={(props, idx) => (
|
||||||
<input
|
<input
|
||||||
autoFocus={idx == 0}
|
autoFocus={idx == 0}
|
||||||
inputmode="decimal"
|
inputMode="decimal"
|
||||||
pattern="[0-9]*"
|
pattern="[0-9]*"
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -123,12 +123,12 @@ const SelectItem = React.forwardRef<
|
||||||
<SelectPrimitive.Item
|
<SelectPrimitive.Item
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(
|
className={cn(
|
||||||
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-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 pr-2 pl-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
|
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
||||||
<SelectPrimitive.ItemIndicator>
|
<SelectPrimitive.ItemIndicator>
|
||||||
<CheckIcon className="h-4 w-4" />
|
<CheckIcon className="h-4 w-4" />
|
||||||
</SelectPrimitive.ItemIndicator>
|
</SelectPrimitive.ItemIndicator>
|
||||||
|
|
|
||||||
|
|
@ -37,12 +37,20 @@ export const boxItems = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
name: "مشاهده آمار",
|
name: "ثبت شکایت(شناس)",
|
||||||
icon: "/img/box3.svg",
|
icon: "/img/box1.svg",
|
||||||
icon2: "/img/box3-hover.svg",
|
icon2: "/img/box1-hover.svg",
|
||||||
description: "مشاهده آمار و گزارشات درخواست ها",
|
description: "ارسال درخواست نارضایتی از پرسنل",
|
||||||
link: "/",
|
link: "/CitizenLogin",
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// id: 3,
|
||||||
|
// name: "مشاهده آمار",
|
||||||
|
// icon: "/img/box3.svg",
|
||||||
|
// icon2: "/img/box3-hover.svg",
|
||||||
|
// description: "مشاهده آمار و گزارشات درخواست ها",
|
||||||
|
// link: "/",
|
||||||
|
// },
|
||||||
];
|
];
|
||||||
|
|
||||||
export const newsItems = [
|
export const newsItems = [
|
||||||
|
|
@ -191,7 +199,6 @@ export const ComplainDetailsItems = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
export const AdminCardItems = [
|
export const AdminCardItems = [
|
||||||
{ id: 1, name: "تعداد گزارشات ارسال شده", count: "100" },
|
{ id: 1, name: "تعداد گزارشات ارسال شده", count: "100" },
|
||||||
{ id: 2, name: "تعداد گزارشات ارسال شده", count: "200" },
|
{ id: 2, name: "تعداد گزارشات ارسال شده", count: "200" },
|
||||||
|
|
@ -203,7 +210,7 @@ export const AdminTableItems = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
name: "محمد یزدی زاده",
|
name: "محمد یزدی زاده",
|
||||||
phone:"09134504190",
|
phone: "09134504190",
|
||||||
useRole: "ادمین",
|
useRole: "ادمین",
|
||||||
date: "1402/09/05",
|
date: "1402/09/05",
|
||||||
desc: "واحد روابط عمومی شهرداری",
|
desc: "واحد روابط عمومی شهرداری",
|
||||||
|
|
@ -211,9 +218,20 @@ export const AdminTableItems = [
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
name: "محسن یزدی پناه",
|
name: "محسن یزدی پناه",
|
||||||
phone:"09134504190",
|
phone: "09134504190",
|
||||||
useRole: "ادمین",
|
useRole: "ادمین",
|
||||||
date: "1402/09/05",
|
date: "1402/09/05",
|
||||||
desc: "واحد روابط عمومی شهرداری",
|
desc: "واحد روابط عمومی شهرداری",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export const Operations = [
|
||||||
|
{value:0,name:"ثبت شده"},
|
||||||
|
{value:1,name:"دیدن"},
|
||||||
|
{value:2,name:"درخواست توضیحات"},
|
||||||
|
{value:3,name:"پاسخ شهروند"},
|
||||||
|
{value:4,name:"لغو درخواست"},
|
||||||
|
{value:5,name:"افزودن جزییات"},
|
||||||
|
{value:6,name:"پایان درخواست"},
|
||||||
|
{value:7,name:"شروع مجدد درخواست"},
|
||||||
|
];
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ export function convertDate(date: string) {
|
||||||
.calendar("jalali")
|
.calendar("jalali")
|
||||||
.locale("fa")
|
.locale("fa")
|
||||||
.format("YYYY/M/DD");
|
.format("YYYY/M/DD");
|
||||||
console.log(convertDate);
|
|
||||||
return convertedDate;
|
return convertedDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,7 @@ export async function verifyStaff(payload: {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function logisterCitizen(payload: {
|
export async function logisterCitizen(payload: {
|
||||||
username: string;
|
phoneNumber: string;
|
||||||
password: string;
|
|
||||||
captcha: {
|
captcha: {
|
||||||
key: string;
|
key: string;
|
||||||
value: string;
|
value: string;
|
||||||
|
|
@ -38,10 +37,7 @@ export async function logisterCitizen(payload: {
|
||||||
|
|
||||||
export async function verifyCitizen(payload: {
|
export async function verifyCitizen(payload: {
|
||||||
phoneNumber: string;
|
phoneNumber: string;
|
||||||
captcha: {
|
verificationCode: string;
|
||||||
key: string;
|
|
||||||
value: string;
|
|
||||||
};
|
|
||||||
}) {
|
}) {
|
||||||
const data = await axios.post("api/Authenticate/VerifyCitizen", payload);
|
const data = await axios.post("api/Authenticate/VerifyCitizen", payload);
|
||||||
return data.data;
|
return data.data;
|
||||||
|
|
|
||||||
|
|
@ -3,33 +3,24 @@ import { CookieValueTypes } from "cookies-next";
|
||||||
|
|
||||||
axios.defaults.baseURL = "https://sootzaniapi.shetabdahi.ir/";
|
axios.defaults.baseURL = "https://sootzaniapi.shetabdahi.ir/";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Post Complaints
|
// Post Complaints
|
||||||
export async function postComplaintSubmit( {Data} : {Data: FormData;}) {
|
export async function postComplaintSubmit({ Data }: { Data: FormData }) {
|
||||||
const data = await axios.post(
|
const data = await axios.post(`api/Citizen`, Data);
|
||||||
`api/Citizen`,
|
|
||||||
Data,
|
|
||||||
);
|
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Post 1 Complaints
|
// Post 1 Complaints
|
||||||
export async function postComplaintTracking({Data} : {
|
export async function postComplaintTracking({
|
||||||
Data: { trackingNumber: string; password :string;}
|
|
||||||
}) {
|
|
||||||
const data = await axios.post(
|
|
||||||
`api/Citizen/Get`,
|
|
||||||
Data,
|
Data,
|
||||||
);
|
}: {
|
||||||
|
Data: { trackingNumber: string; password: string };
|
||||||
|
}) {
|
||||||
|
const data = await axios.post(`api/Citizen/Get`, Data);
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Post Complaints Details "citizen / Oprate"
|
// Post Complaints Details "citizen / Oprate"
|
||||||
export async function postComplaintsDetails( {Data} : {Data: FormData;}) {
|
export async function postComplaintsDetails(payload: FormData) {
|
||||||
const data = await axios.post(
|
const data = await axios.post(`api/Citizen/Operate`, payload);
|
||||||
`api/Citizen/Operate`,
|
|
||||||
Data,
|
|
||||||
);
|
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
|
@ -24,10 +24,9 @@ export async function getComplaint(payload: {
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function OperateByInspector(payload: {
|
export async function OperateByInspector(payload: FormData) {
|
||||||
trackingNumber: string;
|
const data = await axios.post(`api/Inspector/Operate`, payload, {
|
||||||
password: string;
|
headers: { "Content-Type": "multipart/form-data" },
|
||||||
}) {
|
});
|
||||||
const data = await axios.post(`api/Inspector/Operate`, payload);
|
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue