Compare commits
No commits in common. "4eba3d1c16a2c88be57c202da2665db3111d6002" and "0e80cc7264c2be540b004d847e09d08f0417b596" have entirely different histories.
4eba3d1c16
...
0e80cc7264
|
|
@ -0,0 +1,8 @@
|
||||||
|
import React from "react";
|
||||||
|
import CallUs from "@/components/CallUs";
|
||||||
|
|
||||||
|
export default function page() {
|
||||||
|
return (
|
||||||
|
<CallUs />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
import CitizenLogin from "@/components/CitizenLogin";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
export default function page() {
|
||||||
|
return <CitizenLogin />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
import React from "react";
|
||||||
|
import FollowResult from "@/components/FollowResult";
|
||||||
|
|
||||||
|
export default function page() {
|
||||||
|
return (
|
||||||
|
<FollowResult />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
import React from "react";
|
||||||
|
import FollowUp from "@/components/FollowUp";
|
||||||
|
|
||||||
|
export default function page() {
|
||||||
|
return (
|
||||||
|
<FollowUp />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
import React from "react";
|
||||||
|
import Result from "@/components/RequestResult";
|
||||||
|
|
||||||
|
export default function page() {
|
||||||
|
return (
|
||||||
|
<Result />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
import React from "react";
|
||||||
|
import RequestStep1 from "@/components/RequestStep1";
|
||||||
|
|
||||||
|
export default function page() {
|
||||||
|
return (
|
||||||
|
<RequestStep1 />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
import React from "react";
|
||||||
|
import RequestStep2 from "@/components/RequestStep2";
|
||||||
|
|
||||||
|
export default function page() {
|
||||||
|
return (
|
||||||
|
<RequestStep2 />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
import NavbarPanel from "@/components/NavbarPanel";
|
||||||
|
|
||||||
|
export default function RootLayout({
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
|
||||||
|
<NavbarPanel />
|
||||||
|
{children}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
export default function page() {
|
||||||
|
return (
|
||||||
|
<div>page</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import NavbarPanel from "@/components/NavbarPanel";
|
import NavbarPanel from "@/components/NavbarPanel";
|
||||||
import { cookies } from "next/headers";
|
import { cookies } from "next/headers";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
|
|
||||||
export default function RootLayout({
|
export default function RootLayout({
|
||||||
children,
|
children,
|
||||||
}: {
|
}: {
|
||||||
|
|
@ -14,7 +15,7 @@ export default function RootLayout({
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<NavbarPanel />
|
<NavbarPanel />
|
||||||
<div className="mt-10 mx-auto px-2">{children}</div>
|
<div className="mt-10 mx-auto container">{children}</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,189 @@
|
||||||
|
"use client";
|
||||||
|
import React from "react";
|
||||||
|
import Navbar from "../../components/Navbar";
|
||||||
|
import Counter from "../../components/Counter";
|
||||||
|
import SubmitRequest from "../../components/SubmitRequest";
|
||||||
|
import { boxItems, newsItems } from "@/constants";
|
||||||
|
import Image from "next/image";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
import Link from "next/link";
|
||||||
|
import bgimg from "../../public/img/bg.png";
|
||||||
|
import Footer from "@/components/Footer";
|
||||||
|
|
||||||
|
// Import Swiper React components
|
||||||
|
import { Swiper, SwiperSlide } from "swiper/react";
|
||||||
|
// Import Swiper styles
|
||||||
|
import "swiper/css";
|
||||||
|
import "swiper/css/pagination";
|
||||||
|
// import required modules
|
||||||
|
import { Autoplay, Pagination, Navigation} from "swiper/modules";
|
||||||
|
import { sliderItems } from "@/constants";
|
||||||
|
|
||||||
|
export default function Landing() {
|
||||||
|
return (
|
||||||
|
<div className="overflow-x-hidden">
|
||||||
|
<div className="w-screen bg-top lg:bg-center bg-no-repeat h-[13rem] sm:h-[20rem] md:h-[24rem] xl:h-[33rem]">
|
||||||
|
<Swiper
|
||||||
|
slidesPerView={1}
|
||||||
|
spaceBetween={0}
|
||||||
|
autoplay={{
|
||||||
|
delay: 2500,
|
||||||
|
disableOnInteraction: false,
|
||||||
|
}}
|
||||||
|
loop={false}
|
||||||
|
pagination={{
|
||||||
|
clickable: true,
|
||||||
|
}}
|
||||||
|
modules={[Autoplay]}
|
||||||
|
|
||||||
|
className="mySwiper w-full h-full"
|
||||||
|
>
|
||||||
|
{sliderItems.map((item) => {
|
||||||
|
return (
|
||||||
|
<SwiperSlide key={item.id}>
|
||||||
|
<Image
|
||||||
|
alt="bg"
|
||||||
|
src={bgimg}
|
||||||
|
// width={20}
|
||||||
|
// height={20}
|
||||||
|
quality={100}
|
||||||
|
className=" w-full h-full object-cover max-sm:object-[70%]"
|
||||||
|
/>
|
||||||
|
</SwiperSlide>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</Swiper>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="3xl:w-[60%] w-[75%] mx-auto max-md:mt-5">
|
||||||
|
<div className="flex justify-between gap-6 w-full mx-auto -mt-24 max-md:mt-0 max-sm:flex-wrap max-sm:justify-around ">
|
||||||
|
{boxItems.map((item, index) => {
|
||||||
|
return (
|
||||||
|
<Link
|
||||||
|
className="group bg-white shadow-md rounded-lg p-10 h-64 w-64 flex items-end justify-center z-10 relative
|
||||||
|
hover:bg-blue transition-all duration-700 ease-in-out text-center
|
||||||
|
hover:flex-col-reverse hover:justify-evenly hover:items-center hover:cursor-pointer
|
||||||
|
max-lg:w-52 max-lg:h-52 max-md:w-40 max-md:h-40
|
||||||
|
max-lg:p-8 max-md:p-5 max-sm:p-2 hover:max-lg:p-2
|
||||||
|
max-md:shadow-[0px_0px_8px_0px_#00000040]
|
||||||
|
"
|
||||||
|
key={index}
|
||||||
|
href={item.link}
|
||||||
|
>
|
||||||
|
<p className="text-xs text-center font-medium text-gray hidden group-hover:flex ">
|
||||||
|
{item.description}
|
||||||
|
</p>
|
||||||
|
<p className=" z-10 text-base text-black group-hover:text-white max-md:text-sm">
|
||||||
|
{item.name}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<Image
|
||||||
|
alt="icon"
|
||||||
|
src={item.icon}
|
||||||
|
width={20}
|
||||||
|
height={20}
|
||||||
|
quality={100}
|
||||||
|
key={index}
|
||||||
|
className={cn(
|
||||||
|
" w-[80%] h-[80%] absolute left-2 top-6 group-hover:hidden max-md:h-[60%] max-md:w-[60%] max-md:left-auto",
|
||||||
|
item.id == 1 && "left-8"
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Image
|
||||||
|
alt="icon"
|
||||||
|
src={item.icon2}
|
||||||
|
width={20}
|
||||||
|
height={20}
|
||||||
|
quality={100}
|
||||||
|
key={index}
|
||||||
|
className=" w-[45%] h-[45%] hidden group-hover:flex"
|
||||||
|
/>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* News */}
|
||||||
|
<div className=" border mt-6 mx-auto py-3 px-4 rounded-lg">
|
||||||
|
آخرین اخبار
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className=" w-full mt-6 flex flex-row gap-8 mb-14
|
||||||
|
max-lg:flex-col max-lg:gap-4
|
||||||
|
"
|
||||||
|
>
|
||||||
|
{/* Right News */}
|
||||||
|
<div
|
||||||
|
className=" w-1/2 max-lg:w-full border rounded-lg flex flex-row shadow-md hover:shadow-none transition-all
|
||||||
|
max-lg:h-[14em] max-md:h-[12em] max-sm:h-[22em] max-sm:flex-col max-sm:gap-[3px]"
|
||||||
|
>
|
||||||
|
<div className="w-1/2 h-full rounded-r-lg bg-rose-400 max-sm:h-1/2 max-md:w-1/3 max-sm:w-full">
|
||||||
|
<Image
|
||||||
|
alt="picture"
|
||||||
|
src="/img/pic1.png"
|
||||||
|
height={500}
|
||||||
|
width={500}
|
||||||
|
style={{ objectFit: "fill", objectPosition: "center" }}
|
||||||
|
className="w-full h-full rounded-r-lg"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className=" w-1/2 h-full flex flex-col p-8 justify-between max-lg:p-4 max-md:justify-evenly max-md:w-2/3 max-sm:h-1/2 max-sm:w-full">
|
||||||
|
<p className="text-[10px] font-bold text-right text-white bg-blue p-1 rounded ">
|
||||||
|
اخبار
|
||||||
|
</p>
|
||||||
|
<p className="text-xs font-medium text-right text-black">
|
||||||
|
24 آذر ماه 1402
|
||||||
|
</p>
|
||||||
|
<p className="text-base font-medium text-right text-black line-clamp-1">
|
||||||
|
شروع به کار سامانه سوت زنی
|
||||||
|
</p>
|
||||||
|
<p className="text-sm font-normal text-justify text-[#3C3C43D9] line-clamp-5 max-md:line-clamp-2">
|
||||||
|
این سامانه با هدف نظارت بر عملکرد پرستل و نهادهای مرتبط با امور
|
||||||
|
مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده
|
||||||
|
است ...
|
||||||
|
</p>
|
||||||
|
<Link
|
||||||
|
href="#"
|
||||||
|
className="text-[10px] font-normal text-blue text-left"
|
||||||
|
>
|
||||||
|
بیشتر بخوانید{" "}
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/* Left News */}
|
||||||
|
<div className=" w-1/2 max-lg:w-full flex flex-col gap-[2px] max-lg:gap-4">
|
||||||
|
{newsItems.map((item, index) => {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className=" w-full h-1/3 flex flex-col border rounded-lg justify-between px-8 py-[10px] hover:shadow-[0px_0px_8px_0px_#00000040] transition-all
|
||||||
|
max-lg:px-4 max-lg:gap-3"
|
||||||
|
key={index}
|
||||||
|
>
|
||||||
|
<div className="flex flex-row justify-between items-center max-sm:flex-col-reverse">
|
||||||
|
<p className="text-base font-medium text-right text-black max-sm:self-start">
|
||||||
|
{item.title}
|
||||||
|
</p>
|
||||||
|
<p className="text-xs font-medium text-right text-black max-sm:self-end">
|
||||||
|
{item.date}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<p className="text-sm font-normal text-justify text-[#3C3C43D9] max-md:line-clamp-2">
|
||||||
|
{item.content}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/* Counter */}
|
||||||
|
<Counter />
|
||||||
|
{/*SubmitRequest */}
|
||||||
|
<SubmitRequest />
|
||||||
|
{/* Footer */}
|
||||||
|
<Footer />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -9,7 +9,7 @@ import { Toaster as SonnerToaster } from "@/components/ui/sonner";
|
||||||
const inter = Inter({ subsets: ["latin"] });
|
const inter = Inter({ subsets: ["latin"] });
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: "سوت زنی",
|
title: "Create Next App",
|
||||||
description: "Generated by create next app",
|
description: "Generated by create next app",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,16 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
export default function BoxDashboard({
|
export default function BoxDashboard() {
|
||||||
value,
|
|
||||||
title,
|
|
||||||
}: {
|
|
||||||
value: string;
|
|
||||||
title: string;
|
|
||||||
}) {
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className=" px-7 py-8 bg-zinc-100 rounded-lg shadow flex flex-col justify-end items-center text-black
|
className="w-full h-full px-7 py-8 bg-zinc-100 rounded-lg shadow flex flex-col justify-end items-center text-black
|
||||||
transition duration-200
|
transition-all duration-300 hover:transition-all hover:duration-300
|
||||||
hover:text-white hover:bg-blue
|
hover:text-white hover:bg-blue hover:pb-10
|
||||||
group h-44 w-44"
|
max-lg:min-h-[10em] max-lg:max-w-[10em]"
|
||||||
>
|
>
|
||||||
<div className="group-hover:-translate-y-2 transition-all duration-300">
|
<p className="text-center text-sm font-medium ">
|
||||||
<p className="text-center text-xs font-medium">
|
تعداد درخواست ها 30 روز گذشته
|
||||||
{value}
|
</p>
|
||||||
</p>
|
|
||||||
<p className="text-center text-xs font-medium">{title}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
"use client";
|
||||||
|
import Image from "next/image";
|
||||||
|
import React from "react";
|
||||||
|
import mapImg from "../public/img/map.png";
|
||||||
|
|
||||||
|
import { callUsItems } from "@/constants";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
import Map from "./Map";
|
||||||
|
|
||||||
|
export default function CallUs(props: any) {
|
||||||
|
const { position, zoom } = props;
|
||||||
|
return (
|
||||||
|
<div className="bg-white dark:bg-gray-900 w-screen">
|
||||||
|
<div className="w-full">
|
||||||
|
<div className="w-full h-[42vh]">
|
||||||
|
{/* <Image
|
||||||
|
src={mapImg}
|
||||||
|
className="object-cover w-full h-full "
|
||||||
|
alt=" Logo1"
|
||||||
|
quality={100}
|
||||||
|
width={100}
|
||||||
|
height={100}
|
||||||
|
/> */}
|
||||||
|
|
||||||
|
<Map />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="container">
|
||||||
|
<div className="grid gap-8 md:gap-0 grid-cols-1 md:grid-cols-3 md:h-[40vh] h-full w-full lg:px-32 xl:px-52 md:py-8 py-12">
|
||||||
|
{callUsItems.map((item) => {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
key={item.id}
|
||||||
|
className={cn(
|
||||||
|
" px-4 md:px-6 gap-4 flex justify-center items-center lg:border-l-[1px] border-black h-full",
|
||||||
|
item.id == 3 && " lg:border-l-0 backdrop:"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
key={item.id}
|
||||||
|
className="p-4 lg:p-6 dark:bg-gray-800 gap-4 flex flex-col justify-between items-center
|
||||||
|
border-black max-md:rounded-lg h-full w-full lg:bg-transparent bg-[#EBEBEB]
|
||||||
|
rounded-lg hover:bg-[#EBEBEB] hover:shadow-[0px_4px_4px_0px_#00000026]
|
||||||
|
hover:transition-all transition-all delay-300 cursor-default"
|
||||||
|
>
|
||||||
|
<span className="inline-block text-orange-500 w-14 h-14">
|
||||||
|
{item.icon}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<p className=" text-center text-neutral-700 text-lg font-bold dark:text-white">
|
||||||
|
{item.title}
|
||||||
|
</p>
|
||||||
|
<p className="text-center text-neutral-500 text-base dark:text-gray-400 line-clamp-2">
|
||||||
|
{item.description}
|
||||||
|
</p>
|
||||||
|
<p className="text-center text-orange-500 text-lg font-bold">
|
||||||
|
{item.description2}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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-[20rem] 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"
|
||||||
|
>
|
||||||
|
<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>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -11,8 +11,6 @@ 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";
|
import { postComplaintTracking } from "@/utils/citizenApi";
|
||||||
import { ArrowDownToLine, File } from "lucide-react";
|
|
||||||
import { Separator } from "./ui/separator";
|
|
||||||
|
|
||||||
export default function ComplainsDetails({
|
export default function ComplainsDetails({
|
||||||
id,
|
id,
|
||||||
|
|
@ -57,82 +55,12 @@ export default function ComplainsDetails({
|
||||||
} else if (Data) {
|
} else if (Data) {
|
||||||
data = Data;
|
data = Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleOpenFile = (file) => {
|
|
||||||
const fileURL = URL.createObjectURL(
|
|
||||||
new Blob([atob(file.data)], { type: file.mimeType })
|
|
||||||
);
|
|
||||||
window.open(fileURL, "_blank");
|
|
||||||
};
|
|
||||||
const openFileInNewTab = (base64Data: any, fileType: any) => {
|
|
||||||
const blob = b64toBlob(base64Data, fileType);
|
|
||||||
const blobUrl = URL.createObjectURL(blob);
|
|
||||||
const newTab = window.open();
|
|
||||||
if (newTab) {
|
|
||||||
newTab.document.write(
|
|
||||||
'<html style="height: 100%;"><head><title>File Preview</title></head><body style="margin: 0; padding: 0; height: 100%; overflow: hidden;">'
|
|
||||||
);
|
|
||||||
|
|
||||||
// Check the file type and handle accordingly
|
|
||||||
if (fileType.includes("image")) {
|
|
||||||
newTab.document.write(
|
|
||||||
`<img src="data:${fileType};base64,${base64Data}" alt="File Preview"/>`
|
|
||||||
);
|
|
||||||
} else if (fileType === "application/pdf") {
|
|
||||||
newTab.document.write(
|
|
||||||
`<iframe width="100%" height="100%" src="${blobUrl}"></iframe>`
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
newTab.document.write(
|
|
||||||
`<a href="${blobUrl}" target="_blank">Open in New Tab</a>`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
newTab.document.write("</body></html>");
|
|
||||||
newTab.document.close();
|
|
||||||
|
|
||||||
URL.revokeObjectURL(blobUrl);
|
|
||||||
} else {
|
|
||||||
console.error("Unable to open a new tab.");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const downloadFile = (base64Data, fileName, fileType) => {
|
|
||||||
const blob = b64toBlob(base64Data, fileType);
|
|
||||||
const blobUrl = URL.createObjectURL(blob);
|
|
||||||
|
|
||||||
const link = document.createElement("a");
|
|
||||||
link.href = blobUrl;
|
|
||||||
link.download = fileName;
|
|
||||||
link.click();
|
|
||||||
|
|
||||||
URL.revokeObjectURL(blobUrl);
|
|
||||||
};
|
|
||||||
|
|
||||||
const b64toBlob = (b64Data, contentType = "", sliceSize = 512) => {
|
|
||||||
const byteCharacters = atob(b64Data);
|
|
||||||
const byteArrays = [];
|
|
||||||
|
|
||||||
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
|
|
||||||
const slice = byteCharacters.slice(offset, offset + sliceSize);
|
|
||||||
|
|
||||||
const byteNumbers = new Array(slice.length);
|
|
||||||
for (let i = 0; i < slice.length; i++) {
|
|
||||||
byteNumbers[i] = slice.charCodeAt(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
const byteArray = new Uint8Array(byteNumbers);
|
|
||||||
byteArrays.push(byteArray);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Blob(byteArrays, { type: contentType });
|
|
||||||
};
|
|
||||||
console.log(Data);
|
console.log(Data);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{data ? (
|
{data ? (
|
||||||
<div className="w-full flex max-lg:flex-col gap-3 items-start">
|
<div className="w-full flex max-lg:flex-col gap-3 items-start">
|
||||||
<div className="flex flex-col w-full lg:w-1/3 lg:order-2 gap-3 lg:sticky top-20">
|
<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">
|
||||||
|
|
@ -206,40 +134,11 @@ export default function ComplainsDetails({
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className=" text-[#464646] mt-2">
|
<div className=" text-[#464646] mt-2">
|
||||||
|
متن:{" "}
|
||||||
<span className="text-[#7C838A]">
|
<span className="text-[#7C838A]">
|
||||||
{item.text ? item.text : "-"}
|
{item.text ? item.text : "-"}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{item.media.length !== 0 && <Separator className=" mt-2" />}
|
|
||||||
<div className=" text-[#464646] mt-2">
|
|
||||||
<div className=" flex flex-wrap max-md:flex-col w-full items-center gap-2 text-xs mt-2">
|
|
||||||
{item?.media.map((item: any) => {
|
|
||||||
return (
|
|
||||||
<div className=" bg-gray-100 text-[#7C838A] w-full md:w-40 rounded-md p-2 flex justify-between gap-2 ">
|
|
||||||
<a
|
|
||||||
onClick={() =>
|
|
||||||
openFileInNewTab(item.data, item.mimeType)
|
|
||||||
}
|
|
||||||
className=" cursor-pointer flex gap-2 truncate items-center"
|
|
||||||
>
|
|
||||||
<File />
|
|
||||||
<p className=" truncate">{item.title}</p>
|
|
||||||
</a>
|
|
||||||
<ArrowDownToLine
|
|
||||||
className=" cursor-pointer"
|
|
||||||
onClick={() =>
|
|
||||||
downloadFile(
|
|
||||||
item.data,
|
|
||||||
item.title,
|
|
||||||
item.mimeType
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
|
||||||
|
|
@ -6,49 +6,50 @@ import { HorizontalChart } from "./HorizontalChart";
|
||||||
import { getComplaintsList } from "@/utils/inspectorApi";
|
import { getComplaintsList } from "@/utils/inspectorApi";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import useDecrypt from "@/hooks/useDecrypt";
|
import useDecrypt from "@/hooks/useDecrypt";
|
||||||
import { getInfo } from "@/utils/infoApi";
|
|
||||||
|
|
||||||
export default function ControllerDashboard() {
|
export default function ControllerDashboard() {
|
||||||
const { data, isLoading, refetch } = useQuery({
|
const { data, isLoading, refetch } = useQuery({
|
||||||
queryKey: ["Infos"],
|
queryKey: ["ComplaintsList"],
|
||||||
queryFn: () => getInfo(),
|
queryFn: () => getComplaintsList(),
|
||||||
refetchOnWindowFocus: false,
|
refetchOnWindowFocus: false,
|
||||||
});
|
});
|
||||||
console.log(data);
|
console.log(data);
|
||||||
const [decryptedMessage, errorMessage] = useDecrypt(
|
const [decryptedMessage, errorMessage] = useDecrypt(
|
||||||
"gJoT9AqK7wk1MZFSD04yXXfF36fzsOL+RYtJfySrEnQeJ7VoaL7pmOU6nB3+0+PQcaxIi3hf1AHjzIB0Cn5oHgKROeoI4XslhAezZk23QhtIU4HUF1wpeOJfA+4hWyRfbh4fI9774sa/KL47VaBbrNM/rvBxk6hjlKx5mTb3hqM="
|
"gJoT9AqK7wk1MZFSD04yXXfF36fzsOL+RYtJfySrEnQeJ7VoaL7pmOU6nB3+0+PQcaxIi3hf1AHjzIB0Cn5oHgKROeoI4XslhAezZk23QhtIU4HUF1wpeOJfA+4hWyRfbh4fI9774sa/KL47VaBbrNM/rvBxk6hjlKx5mTb3hqM="
|
||||||
);
|
);
|
||||||
|
console.log(decryptedMessage);
|
||||||
|
if (data) {
|
||||||
|
}
|
||||||
|
console.log(errorMessage);
|
||||||
|
if (data) {
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-12 pt-9 mx-auto px-2">
|
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-8 pt-9 mx-auto">
|
||||||
{/* Lg Show */}
|
{/* Lg Show */}
|
||||||
<div className="w-full mb-6 flex-col gap-0 flex">
|
<div className="w-full h-[45vh] mb-6 flex-row gap-0 hidden lg:flex">
|
||||||
<div className="w-full flex flex-row flex-wrap mx-auto justify-center gap-8 mb-10">
|
<div className="w-1/5 flex flex-col gap-8 pl-6">
|
||||||
{data?.singletons.map((item: any) => {
|
<BoxDashboard />
|
||||||
return <BoxDashboard value={item.value} title={item.title} />;
|
<BoxDashboard />
|
||||||
})}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className=" bg-[#EFEFEF80] rounded-lg flex justify-center shadow-md">
|
<div className="w-4/5 bg-[#EFEFEF80] rounded-lg flex justify-center">
|
||||||
{data?.charts.map((item: any) => {
|
<LineChart />
|
||||||
return (
|
|
||||||
<LineChart chartTitle={item.chartTitle} chartData={item.series} />
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* <div className="w-full flex-row gap-6 h-[20vh] hidden lg:flex">
|
<div className="w-full flex-row gap-6 h-[20vh] hidden lg:flex">
|
||||||
<div className="w-3/5 flex flex-row gap-7">
|
<div className="w-3/5 flex flex-row gap-7">
|
||||||
<BoxDashboard />
|
<BoxDashboard />
|
||||||
<BoxDashboard />
|
<BoxDashboard />
|
||||||
<BoxDashboard />
|
<BoxDashboard />
|
||||||
</div>
|
</div>
|
||||||
|
<div className="w-2/5 flex justify-end">
|
||||||
</div> */}
|
<HorizontalChart />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* max Lg show */}
|
{/* max Lg show */}
|
||||||
{/* <div className="w-full mb-6 flex-col gap-12 flex lg:hidden">
|
<div className="w-full mb-6 flex-col gap-12 flex lg:hidden">
|
||||||
<div className="w-full flex flex-row flex-wrap justify-center gap-4 ">
|
<div className="w-full flex flex-row flex-wrap justify-center gap-4 ">
|
||||||
<BoxDashboard />
|
<BoxDashboard />
|
||||||
<BoxDashboard />
|
<BoxDashboard />
|
||||||
|
|
@ -66,7 +67,7 @@ export default function ControllerDashboard() {
|
||||||
<HorizontalChart />
|
<HorizontalChart />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div> */}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
import React from 'react'
|
||||||
|
import { counterItems } from '@/constants'
|
||||||
|
// import patern from "../public/img/paternSvg.png"
|
||||||
|
|
||||||
|
// Import Swiper React components
|
||||||
|
import { Swiper, SwiperSlide } from 'swiper/react';
|
||||||
|
// Import Swiper styles
|
||||||
|
import 'swiper/css';
|
||||||
|
import 'swiper/css/pagination';
|
||||||
|
// import required modules
|
||||||
|
import { Pagination } from 'swiper/modules';
|
||||||
|
|
||||||
|
export default function Counter() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className="flex justify-center items-center w-full bg-blue bg-[url('../public/img/patern.svg')]"
|
||||||
|
>
|
||||||
|
<div className='3xl:w-[70%] w-[80%] flex flex-row py-24 gap-9 justify-between items-center
|
||||||
|
max-md:gap-4 max-lg:flex-wrap max-lg:justify-center'>
|
||||||
|
{counterItems.map((item) => {
|
||||||
|
return (
|
||||||
|
<div className='h-48 flex flex-col justify-end items-center gap-1 px-7 py-6 rounded-lg bg-blue50
|
||||||
|
hover:bg-[#002A5B] transition-all duration-500 text-center
|
||||||
|
max-md:px-1 max-md:py-1 max-lg:h-36 max-md:h-32'
|
||||||
|
key={item.id}>
|
||||||
|
<p className='text-yellow font-bold text-base'>{item.count}</p>
|
||||||
|
<p className='text-white font-normal text-sm'>{item.name}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
{/*
|
||||||
|
<Swiper
|
||||||
|
slidesPerView={1}
|
||||||
|
// spaceBetween={30}
|
||||||
|
// spaceBetween={10}
|
||||||
|
// slidesPerView="auto"
|
||||||
|
breakpoints={{
|
||||||
|
1920: {
|
||||||
|
width: 1920,
|
||||||
|
slidesPerView: 5,
|
||||||
|
},
|
||||||
|
1024: {
|
||||||
|
width: 1024,
|
||||||
|
slidesPerView: 3,
|
||||||
|
},
|
||||||
|
768: {
|
||||||
|
width: 768,
|
||||||
|
slidesPerView: 2,
|
||||||
|
},
|
||||||
|
425: {
|
||||||
|
width: 425,
|
||||||
|
slidesPerView: 2,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
pagination={{
|
||||||
|
clickable: true,
|
||||||
|
}}
|
||||||
|
modules={[Pagination]}
|
||||||
|
className="mySwiper"
|
||||||
|
>
|
||||||
|
{counterItems.map((item) => {
|
||||||
|
return (
|
||||||
|
<SwiperSlide className='h-48 flex flex-col justify-end items-center gap-1 px-7 py-6 rounded-lg
|
||||||
|
hover:bg-[#002A5B] transition-all duration-500 text-center
|
||||||
|
max-md:px-1 max-md:py-1'
|
||||||
|
key={item.id}>
|
||||||
|
<p className='text-yellow font-bold text-base'>{item.count}</p>
|
||||||
|
<p className='text-white font-normal text-sm'>{item.name}</p>
|
||||||
|
</SwiperSlide>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
|
||||||
|
{/* <SwiperSlide>Slide 1</SwiperSlide> */}
|
||||||
|
|
||||||
|
{/* </Swiper> */}
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,172 @@
|
||||||
|
"use client";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
|
import { useForm } from "react-hook-form";
|
||||||
|
import * as z from "zod";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useMutation } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
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 { Textarea } from "@/components/ui/textarea";
|
||||||
|
|
||||||
|
import Image from "next/image";
|
||||||
|
import Link from "next/link";
|
||||||
|
import FollowResult from "./FollowResult";
|
||||||
|
import { postComplaintTracking } from "@/utils/citizenApi";
|
||||||
|
|
||||||
|
const FormSchema = z.object({
|
||||||
|
trackingNumber: z.string().min(2, {
|
||||||
|
message: "trackingNumber must be at least 2 characters.",
|
||||||
|
}),
|
||||||
|
password: z.string().min(4, {
|
||||||
|
message: "Password must be at least 4 characters.",
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default function FollowUp() {
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
const complaintTrackingMutation = useMutation({
|
||||||
|
mutationKey: ["complaintTracking"],
|
||||||
|
mutationFn: postComplaintTracking,
|
||||||
|
|
||||||
|
onSuccess: (res) => {
|
||||||
|
const result = res;
|
||||||
|
console.log(res);
|
||||||
|
console.log(result);
|
||||||
|
|
||||||
|
// alert("Success");
|
||||||
|
console.log("Success FollowUp");
|
||||||
|
|
||||||
|
// router.push("/FollowResult");
|
||||||
|
router.push("/FollowResult", {data: JSON.stringify( result ) });
|
||||||
|
|
||||||
|
// router.push(
|
||||||
|
// "/FollowResult",
|
||||||
|
// {
|
||||||
|
// data: JSON.stringify(result),
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
|
||||||
|
// router.push({
|
||||||
|
// pathname : '/FollowResult',
|
||||||
|
// query : {
|
||||||
|
// data: JSON.stringify( result ) ;
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
|
||||||
|
// return (res)
|
||||||
|
},
|
||||||
|
onError: (error) => {
|
||||||
|
console.log(error);
|
||||||
|
console.log(error?.message);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const form = useForm<z.infer<typeof FormSchema>>({
|
||||||
|
resolver: zodResolver(FormSchema),
|
||||||
|
defaultValues: {
|
||||||
|
trackingNumber: "",
|
||||||
|
password: "",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||||
|
// toast({
|
||||||
|
// title: "You submitted the following values:",
|
||||||
|
// description: (
|
||||||
|
// <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4 pt-12">
|
||||||
|
// <code className="text-white">{JSON.stringify(data, null, 2)}</code>
|
||||||
|
// </pre>
|
||||||
|
// ),
|
||||||
|
// });
|
||||||
|
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
localStorage.setItem("trackingNumber2", data.trackingNumber);
|
||||||
|
localStorage.setItem("password2", data.password);
|
||||||
|
|
||||||
|
complaintTrackingMutation.mutate({
|
||||||
|
Data: { trackingNumber: data.trackingNumber, password: data.password },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div className="w-full h-full sm:w-2/3 md:w-2/4 max-sm:p-8 pt-12">
|
||||||
|
<div className="space-y-3 md:space-y-4 h-full flex flex-col justify-start ">
|
||||||
|
<p className="text-sm md:text-base 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 mt-6 "
|
||||||
|
>
|
||||||
|
<div className="flex flex-row flex-wrap justify-between">
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="trackingNumber"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem className=" w-full lg:w-[48%]">
|
||||||
|
<FormLabel className="text-[#7C838A] text-sm font-medium">
|
||||||
|
کد پیگیری
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input
|
||||||
|
placeholder="کد پیگیری خود را وارد نمایید"
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="password"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem className=" w-full lg:w-[48%]">
|
||||||
|
<FormLabel className="text-[#7C838A] text-sm font-medium ">
|
||||||
|
رمز عبور
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input
|
||||||
|
placeholder="رمز عبور خود را وارد کنید"
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
|
||||||
|
<Button
|
||||||
|
// href="/FollowResult"
|
||||||
|
type="submit"
|
||||||
|
className="bg-blue text-white min-w-max w-1/2 sm:w-1/3 lg:w-1/4 p-2 rounded-xl text-center"
|
||||||
|
>
|
||||||
|
پیگیری درخواست
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -10,18 +10,10 @@ import {
|
||||||
Title,
|
Title,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Legend,
|
Legend,
|
||||||
ChartOptions,
|
|
||||||
} from "chart.js";
|
} from "chart.js";
|
||||||
import { Line } from "react-chartjs-2";
|
import { Line } from "react-chartjs-2";
|
||||||
import { faker } from "@faker-js/faker";
|
import { faker } from "@faker-js/faker";
|
||||||
import dayjs from "dayjs";
|
|
||||||
import utc from "dayjs/plugin/utc";
|
|
||||||
import jalaliday from "jalaliday";
|
|
||||||
import { backgroundColor, borderColor } from "@/constants/colors";
|
|
||||||
import ChartDataLabels from "chartjs-plugin-datalabels";
|
|
||||||
dayjs.extend(jalaliday);
|
|
||||||
dayjs.extend(utc);
|
|
||||||
ChartJS.defaults.font.family = "Yekan";
|
|
||||||
ChartJS.register(
|
ChartJS.register(
|
||||||
CategoryScale,
|
CategoryScale,
|
||||||
LinearScale,
|
LinearScale,
|
||||||
|
|
@ -29,22 +21,21 @@ ChartJS.register(
|
||||||
LineElement,
|
LineElement,
|
||||||
Title,
|
Title,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Legend,
|
Legend
|
||||||
ChartDataLabels
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// export const options = {
|
export const options = {
|
||||||
// responsive: true,
|
responsive: true,
|
||||||
// plugins: {
|
plugins: {
|
||||||
// legend: {
|
legend: {
|
||||||
// position: "top" as const,
|
position: "top" as const,
|
||||||
// },
|
},
|
||||||
// title: {
|
title: {
|
||||||
// display: true,
|
display: true,
|
||||||
// text: "Chart.js Line Chart",
|
text: "Chart.js Line Chart",
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// };
|
};
|
||||||
|
|
||||||
const labels = ["January", "February", "March", "April", "May", "June", "July"];
|
const labels = ["January", "February", "March", "April", "May", "June", "July"];
|
||||||
|
|
||||||
|
|
@ -66,61 +57,8 @@ export const data = {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
interface Values {
|
export default function LineChart() {
|
||||||
title: string;
|
return (
|
||||||
value: string;
|
<Line options={options} data={data} className=' '/>
|
||||||
displayValue: string;
|
);
|
||||||
parameters: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function LineChart({
|
|
||||||
chartData,
|
|
||||||
chartTitle,
|
|
||||||
}: {
|
|
||||||
chartData: { title: string; icon: string; values: Values[] }[];
|
|
||||||
chartTitle: string;
|
|
||||||
}) {
|
|
||||||
const options: ChartOptions<"line"> = {
|
|
||||||
responsive: true,
|
|
||||||
maintainAspectRatio: false,
|
|
||||||
scales: { x: { ticks: { autoSkip: false } } },
|
|
||||||
plugins: {
|
|
||||||
legend: {
|
|
||||||
position: "top" as const,
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
display: true,
|
|
||||||
text: chartTitle,
|
|
||||||
position: "bottom",
|
|
||||||
},
|
|
||||||
datalabels: {
|
|
||||||
display: true,
|
|
||||||
color: "black",
|
|
||||||
align: "end",
|
|
||||||
anchor: "end",
|
|
||||||
font: { size: 12 },
|
|
||||||
formatter: function (value, context) {
|
|
||||||
console.log(context.dataset);
|
|
||||||
return value == 0 ? "" : value;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const data = {
|
|
||||||
labels: chartData[0].values.map((item) => {
|
|
||||||
return item.title;
|
|
||||||
}),
|
|
||||||
datasets: chartData.map((item: any, index: number) => {
|
|
||||||
return {
|
|
||||||
label: item.title,
|
|
||||||
data: item.values.map((item) => item.value),
|
|
||||||
backgroundColor: backgroundColor[index],
|
|
||||||
borderColor: borderColor[index],
|
|
||||||
borderWidth: 1,
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
|
|
||||||
return <Line options={options} data={data} className="h-[20rem] " />;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
"use client";
|
||||||
|
import React, { useEffect, useRef } from "react";
|
||||||
|
import { MapContainer, TileLayer, Marker, Popup } from "react-leaflet";
|
||||||
|
import L from "leaflet";
|
||||||
|
// import MarkerIcon from "../../node_modules/leaflet/dist/images/marker-icon.png";
|
||||||
|
// import MarkerShadow from "../../node_modules/leaflet/dist/images/marker-shadow.png";
|
||||||
|
import "leaflet/dist/leaflet.css";
|
||||||
|
import { any } from "zod";
|
||||||
|
|
||||||
|
const Map = () => {
|
||||||
|
const markerRef = useRef<any>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (markerRef.current) {
|
||||||
|
markerRef.current.openPopup()
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<MapContainer
|
||||||
|
center={[31.8974, 54.3569]}
|
||||||
|
zoom={13}
|
||||||
|
style={{ height: "300px" }}
|
||||||
|
className=" rounded-lg max-w-full"
|
||||||
|
>
|
||||||
|
<TileLayer url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" />
|
||||||
|
<Marker
|
||||||
|
position={[31.8974, 54.3569]}
|
||||||
|
// icon={
|
||||||
|
// new L.Icon({
|
||||||
|
// iconUrl: MarkerIcon.src,
|
||||||
|
// iconRetinaUrl: MarkerIcon.src,
|
||||||
|
// iconSize: [25, 41],
|
||||||
|
// iconAnchor: [12.5, 41],
|
||||||
|
// popupAnchor: [0, -41],
|
||||||
|
// shadowUrl: MarkerShadow.src,
|
||||||
|
// shadowSize: [41, 41],
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
ref={markerRef}
|
||||||
|
>
|
||||||
|
<Popup className=" font-[Yekan] font-bold">داروخانه چمران</Popup>
|
||||||
|
</Marker>
|
||||||
|
</MapContainer>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Map;
|
||||||
|
|
@ -1,87 +0,0 @@
|
||||||
"use client";
|
|
||||||
import React, { useEffect, useState } from "react";
|
|
||||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
||||||
import LineChart from "./LineChart";
|
|
||||||
|
|
||||||
import { BsBarChartLineFill } from "react-icons/bs";
|
|
||||||
import { BsBarChartLine } from "react-icons/bs";
|
|
||||||
import VerticalChart from "./VerticalChart";
|
|
||||||
import { HorizontalChart } from "./HorizontalChart";
|
|
||||||
import { getInfo, getInfoList } from "@/utils/infoApi";
|
|
||||||
import { useQueries, useQuery } from "@tanstack/react-query";
|
|
||||||
import useChart from "@/hooks/useChart";
|
|
||||||
|
|
||||||
export default function Reports({ data }) {
|
|
||||||
console.log(data);
|
|
||||||
const [first, setfirst] = useState<any>(false);
|
|
||||||
const Queries: any = useQueries({
|
|
||||||
queries: data?.map((item: any) => ({
|
|
||||||
queryKey: ["user", item.code],
|
|
||||||
queryFn: () => getInfo(item.code),
|
|
||||||
})),
|
|
||||||
});
|
|
||||||
const codes = data.map((item: any) => item.code);
|
|
||||||
console.log(codes);
|
|
||||||
console.log(Queries[0]);
|
|
||||||
const charts = Queries.map((item: any) => item.data);
|
|
||||||
const successfulRequests = Queries.filter((item) => item.isSuccess == true);
|
|
||||||
return (
|
|
||||||
<div className="">
|
|
||||||
{successfulRequests.length == data.length && (
|
|
||||||
<Tabs
|
|
||||||
defaultValue={data[0].code}
|
|
||||||
className="w-full flex flex-col md:flex-row gap-12 items-center"
|
|
||||||
dir="rtl"
|
|
||||||
>
|
|
||||||
<div className="w-full md:w-2/5 flex flex-col justify-between items-center ">
|
|
||||||
{/* Tab Title */}
|
|
||||||
<TabsList className="w-full h-full flex flex-row md:flex-col max-md:flex-wrap max-md:justify-between bg-transparent gap-4">
|
|
||||||
{data?.map((item: any) => {
|
|
||||||
return (
|
|
||||||
<TabsTrigger
|
|
||||||
key={item.code}
|
|
||||||
className="w-[45%] md:w-full h-12 bg-muted text-[#555353] shadow-md hover:shadow-none text-xs lg:text-sm font-bold py-3 gap-2 justify-center whitespace-pre-line"
|
|
||||||
value={item.code}
|
|
||||||
>
|
|
||||||
{item.title}
|
|
||||||
{/* <BsBarChartLineFill /> نمودار شماره یک */}
|
|
||||||
</TabsTrigger>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</TabsList>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="w-full md:w-3/5 flex justify-between items-center ">
|
|
||||||
{charts?.map((item: any, index) => {
|
|
||||||
return (
|
|
||||||
<TabsContent value={codes[index]} className="w-full">
|
|
||||||
<VerticalChart
|
|
||||||
chartTitle={item.charts[0].chartTitle}
|
|
||||||
chartData={item.charts[0].series}
|
|
||||||
chart={2}
|
|
||||||
/>
|
|
||||||
</TabsContent>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
{/* Tab Content */}
|
|
||||||
{/* <TabsContent value="tab1" className="w-full h-full ">
|
|
||||||
<VerticalChart />
|
|
||||||
</TabsContent>
|
|
||||||
|
|
||||||
<TabsContent value="tab2" className="w-full h-full ">
|
|
||||||
<HorizontalChart />
|
|
||||||
</TabsContent>
|
|
||||||
|
|
||||||
<TabsContent value="tab3" className="w-full h-full ">
|
|
||||||
<LineChart />
|
|
||||||
</TabsContent>
|
|
||||||
|
|
||||||
<TabsContent value="tab4" className="w-full h-full ">
|
|
||||||
<HorizontalChart />
|
|
||||||
</TabsContent> */}
|
|
||||||
</div>
|
|
||||||
</Tabs>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
"use client";
|
"use client"
|
||||||
import React, { useEffect, useState } from "react";
|
import React from "react";
|
||||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||||
import LineChart from "./LineChart";
|
import LineChart from "./LineChart";
|
||||||
|
|
||||||
|
|
@ -7,23 +7,100 @@ import { BsBarChartLineFill } from "react-icons/bs";
|
||||||
import { BsBarChartLine } from "react-icons/bs";
|
import { BsBarChartLine } from "react-icons/bs";
|
||||||
import { VerticalChart } from "./VerticalChart";
|
import { VerticalChart } from "./VerticalChart";
|
||||||
import { HorizontalChart } from "./HorizontalChart";
|
import { HorizontalChart } from "./HorizontalChart";
|
||||||
import { getInfo, getInfoList } from "@/utils/infoApi";
|
|
||||||
import { useQueries, useQuery } from "@tanstack/react-query";
|
|
||||||
import useChart from "@/hooks/useChart";
|
|
||||||
import Reports from "./Reports";
|
|
||||||
|
|
||||||
export default function ReportsController() {
|
export default function ReportsController() {
|
||||||
const { data, isLoading, refetch, isSuccess } = useQuery({
|
|
||||||
queryKey: ["InfoList"],
|
|
||||||
queryFn: () => getInfoList(),
|
|
||||||
refetchOnWindowFocus: false,
|
|
||||||
});
|
|
||||||
const [first, setfirst] = useState<any>(false);
|
|
||||||
|
|
||||||
console.log(data);
|
|
||||||
return (
|
return (
|
||||||
<div className="w-[95vw] lg:w-[82vw] xl:w-[75vw] 3xl:w-[65vw] max-sm:mt-16 mt-8 pt-9 mx-auto">
|
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9">
|
||||||
{data && <Reports data={data} />}
|
<Tabs
|
||||||
|
defaultValue="tab1"
|
||||||
|
className="w-full flex flex-col md:flex-row gap-16"
|
||||||
|
dir="rtl"
|
||||||
|
>
|
||||||
|
<div className="w-full md:w-1/4 flex flex-col justify-between items-center ">
|
||||||
|
{/* Tab Title */}
|
||||||
|
<TabsList className="w-full h-full flex flex-row md:flex-col max-md:flex-wrap max-md:justify-between bg-transparent gap-4">
|
||||||
|
<TabsTrigger
|
||||||
|
className="w-[45%] md:w-full h-12 bg-muted text-[#555353] shadow-md hover:shadow-none text-sm md:text-lg font-bold py-3 gap-2 justify-start"
|
||||||
|
value="tab1"
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
<BsBarChartLineFill /> نمودار شماره یک
|
||||||
|
</TabsTrigger>
|
||||||
|
<TabsTrigger
|
||||||
|
className="w-[45%] md:w-full h-12 bg-muted text-[#555353] shadow-md hover:shadow-none text-sm md:text-lg font-bold py-3 gap-2 justify-start"
|
||||||
|
value="tab2"
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
<BsBarChartLineFill /> نمودار شماره 2
|
||||||
|
</TabsTrigger>
|
||||||
|
<TabsTrigger
|
||||||
|
className="w-[45%] md:w-full h-12 bg-muted text-[#555353] shadow-md hover:shadow-none text-sm md:text-lg font-bold py-3 gap-2 justify-start"
|
||||||
|
value="tab3"
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
<BsBarChartLineFill /> نمودار شماره 3
|
||||||
|
</TabsTrigger>
|
||||||
|
<TabsTrigger
|
||||||
|
className="w-[45%] md:w-full h-12 bg-muted text-[#555353] shadow-md hover:shadow-none text-sm md:text-lg font-bold py-3 gap-2 justify-start"
|
||||||
|
value="tab4"
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
<BsBarChartLineFill /> نمودار شماره 4
|
||||||
|
</TabsTrigger>
|
||||||
|
<TabsTrigger
|
||||||
|
className="w-[45%] md:w-full h-12 bg-muted text-[#555353] shadow-md hover:shadow-none text-sm md:text-lg font-bold py-3 gap-2 justify-start"
|
||||||
|
value="tab5"
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
<BsBarChartLineFill /> نمودار شماره 5
|
||||||
|
</TabsTrigger>
|
||||||
|
<TabsTrigger
|
||||||
|
className="w-[45%] md:w-full h-12 bg-muted text-[#555353] shadow-md hover:shadow-none text-sm md:text-lg font-bold py-3 gap-2 justify-start"
|
||||||
|
value="tab6"
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
<BsBarChartLineFill /> نمودار شماره 6
|
||||||
|
</TabsTrigger>
|
||||||
|
|
||||||
|
<TabsTrigger
|
||||||
|
className="w-[45%] md:w-full h-12 bg-muted text-[#555353] shadow-md hover:shadow-none text-sm md:text-lg font-bold py-3 gap-2 justify-start"
|
||||||
|
value="tab7"
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
<BsBarChartLineFill /> نمودار شماره 7
|
||||||
|
</TabsTrigger>
|
||||||
|
|
||||||
|
<TabsTrigger
|
||||||
|
className="w-[45%] md:w-full h-12 bg-muted text-[#555353] shadow-md hover:shadow-none text-sm md:text-lg font-bold py-3 gap-2 justify-start"
|
||||||
|
value="tab8"
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
<BsBarChartLineFill /> نمودار شماره 8
|
||||||
|
</TabsTrigger>
|
||||||
|
|
||||||
|
|
||||||
|
</TabsList>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="w-full md:w-3/4 flex justify-between items-center ">
|
||||||
|
{/* Tab Content */}
|
||||||
|
<TabsContent value="tab1" className="w-full h-full ">
|
||||||
|
<VerticalChart />
|
||||||
|
</TabsContent>
|
||||||
|
|
||||||
|
<TabsContent value="tab2" className="w-full h-full ">
|
||||||
|
<HorizontalChart />
|
||||||
|
</TabsContent>
|
||||||
|
|
||||||
|
<TabsContent value="tab3" className="w-full h-full ">
|
||||||
|
<LineChart />
|
||||||
|
</TabsContent>
|
||||||
|
|
||||||
|
<TabsContent value="tab4" className="w-full h-full ">
|
||||||
|
<HorizontalChart />
|
||||||
|
</TabsContent>
|
||||||
|
</div>
|
||||||
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import React, { useEffect } from "react";
|
||||||
|
import Image from "next/image";
|
||||||
|
import Resultimg from "../public/img/result.png";
|
||||||
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
|
export default function Result() {
|
||||||
|
const trackingNumber = localStorage.getItem("trackingNumber");
|
||||||
|
const password = localStorage.getItem("password");
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
localStorage.removeItem("trackingNumber")
|
||||||
|
localStorage.removeItem("password")
|
||||||
|
}, [router]);
|
||||||
|
|
||||||
|
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">
|
||||||
|
<p
|
||||||
|
className="text-sm font-medium leading-6 tracking-wide text-[#7C838A] dark:text-white
|
||||||
|
3xl:text-base 3xl:font-bold ">
|
||||||
|
با تشکر از شما
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p
|
||||||
|
className="text-sm font-medium leading-6 tracking-wide text-[#7C838A] dark:text-white
|
||||||
|
3xl:text-base 3xl:font-bold ">
|
||||||
|
درخواست شما با کد پیگیری
|
||||||
|
<span className="text-slate-500 mx-2">
|
||||||
|
{`${trackingNumber}`}
|
||||||
|
</span>
|
||||||
|
و رمز عبور
|
||||||
|
<span className="text-slate-500 mx-2">
|
||||||
|
{`${password}`}
|
||||||
|
</span>
|
||||||
|
در سامانه سوت زنی ثبت شده و شما می توانید نتیجه درخواست خود را از صفحه
|
||||||
|
پیگیری درخواست، با استفاده از کد رهگیری و رمز عبور مشاهده کنید.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<Image
|
||||||
|
alt="icon"
|
||||||
|
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"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,166 @@
|
||||||
|
"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 Link from "next/link";
|
||||||
|
import RequestStep2 from "./RequestStep2";
|
||||||
|
|
||||||
|
const FormSchema = z.object({
|
||||||
|
firstName: z.string().min(2, {
|
||||||
|
message: "firstName must be at least 2 characters.",
|
||||||
|
}),
|
||||||
|
lastName: z.string().min(2, {
|
||||||
|
message: "lastName must be at least 2 characters.",
|
||||||
|
}),
|
||||||
|
nationalCode: z.number().min(10, {
|
||||||
|
message: "nationalCode must be at least 10 characters.",
|
||||||
|
}),
|
||||||
|
phoneNumber: z.number().min(11, {
|
||||||
|
message: "phoneNumber must be at least 11 characters.",
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default function RequestStep1() {
|
||||||
|
const form = useForm<z.infer<typeof FormSchema>>({
|
||||||
|
resolver: zodResolver(FormSchema),
|
||||||
|
defaultValues: {
|
||||||
|
firstName: "",
|
||||||
|
lastName: "",
|
||||||
|
// nationalCode: ,
|
||||||
|
// phoneNumber: ,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||||
|
toast({
|
||||||
|
title: "You submitted the following values:",
|
||||||
|
description: (
|
||||||
|
<pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
|
||||||
|
<code className="text-white">{JSON.stringify(data, null, 2)}</code>
|
||||||
|
</pre>
|
||||||
|
),
|
||||||
|
});
|
||||||
|
console.log(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="w-full h-full sm:w-2/3 md:w-2/4 max-sm:p-8 pt-12">
|
||||||
|
<div className="space-y-4 md:space-y-4 h-full flex flex-col justify-center">
|
||||||
|
<p className="text-sm md:text-base font-bold leading-tight tracking-tight text-blue dark:text-white">
|
||||||
|
لطفا جهت ارسال درخواست فرم زیر را تکمیل نمایید.
|
||||||
|
</p>
|
||||||
|
<p className="text-sm md:text-base font-bold leading-tight tracking-tight text-red-500 dark:text-white">
|
||||||
|
در صورت عدم تمایل به ثبت مشخصات شخصی می توانید به صفحه ی بعد مراجعه کنید.
|
||||||
|
</p>
|
||||||
|
<Form {...form}>
|
||||||
|
<form
|
||||||
|
onSubmit={form.handleSubmit(onSubmit)}
|
||||||
|
className="w-full flex flex-col mt-6 "
|
||||||
|
>
|
||||||
|
<div className="flex flex-row flex-wrap justify-between">
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="firstName"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem className="w-full sm:w-[48%]">
|
||||||
|
<FormLabel className="text-[#7C838A] text-sm font-medium">
|
||||||
|
نام
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input placeholder="نام خود را وارد نمایید" {...field} />
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="lastName"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem className="w-full sm:w-[48%] ">
|
||||||
|
<FormLabel className="text-[#7C838A] text-sm font-medium">
|
||||||
|
نام خانوادگی
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input
|
||||||
|
placeholder="نام خانوادگی خود را وارد نمایید"
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="nationalCode"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem className="w-full sm:w-[48%]">
|
||||||
|
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||||
|
کد ملی
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input
|
||||||
|
type="number"
|
||||||
|
placeholder="کد ملی خود را وارد نمایید "
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="phoneNumber"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem className=" w-full sm:w-[48%]">
|
||||||
|
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||||
|
شماره تماس
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input
|
||||||
|
type="number"
|
||||||
|
placeholder="شماره تماس خود را وارد نمایید "
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
|
||||||
|
{/* <Button> */}
|
||||||
|
<Link
|
||||||
|
href="/RequestStep2"
|
||||||
|
type="submit"
|
||||||
|
className="w-1/2 sm:w-1/3 lg:w-1/4 bg-blue text-white p-2 rounded-xl text-center"
|
||||||
|
>
|
||||||
|
صفحه ی بعد
|
||||||
|
</Link>
|
||||||
|
{/* </Button> */}
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,421 @@
|
||||||
|
"use client";
|
||||||
|
import React, { useState } 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 {
|
||||||
|
Select,
|
||||||
|
SelectContent,
|
||||||
|
SelectGroup,
|
||||||
|
SelectItem,
|
||||||
|
SelectLabel,
|
||||||
|
SelectTrigger,
|
||||||
|
SelectValue,
|
||||||
|
} from "@/components/ui/select";
|
||||||
|
|
||||||
|
import { Input } from "@/components/ui/input";
|
||||||
|
import { toast } from "@/components/ui/use-toast";
|
||||||
|
import { Textarea } from "@/components/ui/textarea";
|
||||||
|
import { Label } from "@/components/ui/label";
|
||||||
|
import Link from "next/link";
|
||||||
|
import RequestResult from "./RequestResult";
|
||||||
|
import Image from "next/image";
|
||||||
|
import Img1 from "../public/img/logo.png";
|
||||||
|
|
||||||
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
|
import { postComplaintSubmit } from "@/utils/citizenApi";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { getCaptcha, getCategory } from "@/utils/commonApi";
|
||||||
|
|
||||||
|
const MAX_IMAGE_SIZE = 5242880; // 5 MB
|
||||||
|
const ALLOWED_IMAGE_TYPES = [
|
||||||
|
"image/jpeg",
|
||||||
|
"image/png",
|
||||||
|
"image/webp",
|
||||||
|
"image/jpg",
|
||||||
|
];
|
||||||
|
|
||||||
|
const FormSchema = z.object({
|
||||||
|
subject: z.string().min(2, {
|
||||||
|
message: "subject must be at least 2 characters.",
|
||||||
|
}),
|
||||||
|
organisation: z.string().min(2, {
|
||||||
|
message: "organisation must be at least 2 characters.",
|
||||||
|
}),
|
||||||
|
person: z.string().min(2, {
|
||||||
|
message: "personName must be at least 2 characters.",
|
||||||
|
}),
|
||||||
|
description: z
|
||||||
|
.string()
|
||||||
|
.min(5, {
|
||||||
|
message: "description must be at least 5 characters.",
|
||||||
|
})
|
||||||
|
.max(200, {
|
||||||
|
message: "description must not be longer than 200 characters.",
|
||||||
|
}),
|
||||||
|
uploadFile: 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.`)
|
||||||
|
.refine(
|
||||||
|
(files) => Array.from(files).every((file) => file.size <= MAX_IMAGE_SIZE),
|
||||||
|
`Each file size should be less than 5 MB.`
|
||||||
|
),
|
||||||
|
// .refine(
|
||||||
|
// (files) =>
|
||||||
|
// Array.from(files).every((file) =>
|
||||||
|
// ALLOWED_IMAGE_TYPES.includes(file.type)
|
||||||
|
// ),
|
||||||
|
// "Only these types are allowed .jpg, .jpeg, .png and .webp"
|
||||||
|
// ),
|
||||||
|
categoryId: z.string({
|
||||||
|
required_error: "Please select an category to display.",
|
||||||
|
}),
|
||||||
|
captchaValue: z.string().min(4, {
|
||||||
|
message: "captcha must be at least 4 characters.",
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
// Form Hook
|
||||||
|
export default function RequestStep2() {
|
||||||
|
// const [trackingComplaint, setTrackingComplaint] = useState({});
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
const complaintSubmitMutation = useMutation({
|
||||||
|
mutationKey: ["complaintSubmit"],
|
||||||
|
mutationFn: postComplaintSubmit,
|
||||||
|
|
||||||
|
onSuccess: (res) => {
|
||||||
|
console.log(res);
|
||||||
|
localStorage.setItem("trackingNumber", res.trackingNumber);
|
||||||
|
localStorage.setItem("password", res.password);
|
||||||
|
|
||||||
|
// alert("Success");
|
||||||
|
console.log("Success Step2");
|
||||||
|
router.push("/RequestResult");
|
||||||
|
// router.push("/RequestResult", { data: trackingComplaint });
|
||||||
|
// return (res)
|
||||||
|
},
|
||||||
|
onError: (error) => {
|
||||||
|
console.log(error);
|
||||||
|
console.log(error?.message);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// All Category
|
||||||
|
const { data: categoryData } = useQuery({
|
||||||
|
queryKey: ["Category"],
|
||||||
|
queryFn: () => getCategory(),
|
||||||
|
});
|
||||||
|
|
||||||
|
// Captcha
|
||||||
|
const { data: CaptchaData, isLoading } = useQuery({
|
||||||
|
queryKey: ["Captcha"],
|
||||||
|
queryFn: () => getCaptcha(),
|
||||||
|
});
|
||||||
|
// console.log(captchaData);
|
||||||
|
|
||||||
|
const srcForImage = CaptchaData
|
||||||
|
? URL.createObjectURL(CaptchaData.data)
|
||||||
|
: null;
|
||||||
|
|
||||||
|
const form = useForm<z.infer<typeof FormSchema>>({
|
||||||
|
resolver: zodResolver(FormSchema),
|
||||||
|
defaultValues: {
|
||||||
|
subject: "",
|
||||||
|
organisation: "",
|
||||||
|
person: "",
|
||||||
|
description: "",
|
||||||
|
captchaValue: "",
|
||||||
|
// uploadFile: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||||
|
// toast({
|
||||||
|
// title: "You submitted the following values:",
|
||||||
|
// description: (
|
||||||
|
// <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
|
||||||
|
// <code className="text-white">{JSON.stringify(data, null, 2)}</code>
|
||||||
|
// </pre>
|
||||||
|
// ),
|
||||||
|
// });
|
||||||
|
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append("Title", data.subject);
|
||||||
|
formData.append("Text", data.description);
|
||||||
|
formData.append("CategoryId", data.categoryId);
|
||||||
|
formData.append("Medias", data.uploadFile[0]);
|
||||||
|
formData.append("Captcha.Value", data.captchaValue);
|
||||||
|
formData.append("Captcha.Key", CaptchaData?.headers["captcha-key"]);
|
||||||
|
|
||||||
|
complaintSubmitMutation.mutate({
|
||||||
|
Data: formData,
|
||||||
|
});
|
||||||
|
resetField("Title");
|
||||||
|
resetField("Text");
|
||||||
|
resetField("Medias");
|
||||||
|
resetField("CategoryId");
|
||||||
|
resetField("Captcha.Value");
|
||||||
|
|
||||||
|
console.log("submited");
|
||||||
|
console.log(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
const { resetField } = useForm();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="w-full h-full sm:w-2/3 md:w-2/4 max-sm:p-8 pt-12">
|
||||||
|
<div className="space-y-3 md:space-y-4 h-full flex flex-col justify-center">
|
||||||
|
<p className="text-sm md:text-base 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 mt-6"
|
||||||
|
>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="subject"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||||
|
*موضوع شکایت
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input
|
||||||
|
placeholder="موضوع شکایت خود را بنویسید"
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<div className="flex flex-row flex-wrap justify-between">
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="organisation"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem className="w-full sm:w-[48%]">
|
||||||
|
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||||
|
*دستگاه مربوطه
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input
|
||||||
|
placeholder="دستگاه مربوطه را انتخاب کنید"
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="person"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem className=" w-full sm:w-[48%]">
|
||||||
|
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||||
|
فرد مربوطه
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input
|
||||||
|
placeholder="نام فرد مورد نظر خود را بنویسید"
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="description"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||||
|
توضیحات
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Textarea
|
||||||
|
placeholder="متن توضیحات خود را بنویسید"
|
||||||
|
className="resize-none mb-3"
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div className="flex flex-row flex-wrap justify-between">
|
||||||
|
{/* Select Option */}
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="categoryId"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem className="w-full sm:w-[48%] flex-row-reverse">
|
||||||
|
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||||
|
انتخاب دسته بندی
|
||||||
|
</FormLabel>
|
||||||
|
<Select
|
||||||
|
onValueChange={field.onChange}
|
||||||
|
defaultValue={field.value}
|
||||||
|
>
|
||||||
|
<FormControl>
|
||||||
|
<SelectTrigger className="bg-slate-200">
|
||||||
|
<SelectValue placeholder=" دسته بندی ها" />
|
||||||
|
</SelectTrigger>
|
||||||
|
</FormControl>
|
||||||
|
<SelectContent>
|
||||||
|
{categoryData?.map((catItems: any, index: any) => (
|
||||||
|
<SelectItem key={index} value={catItems.id}>
|
||||||
|
{catItems.title}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* uploadFile */}
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="uploadFile"
|
||||||
|
render={({ field: { onChange }, ...field }) => {
|
||||||
|
// Get current uploadFile value (always watched updated)
|
||||||
|
const uploadFile = form.watch("uploadFile");
|
||||||
|
{
|
||||||
|
console.log(uploadFile);
|
||||||
|
}
|
||||||
|
var filenames: string[] | undefined = undefined;
|
||||||
|
if (uploadFile) {
|
||||||
|
// 1. covert to File[] using Array.from
|
||||||
|
const files: File[] = Array.from(uploadFile);
|
||||||
|
// 2. now you can use array methods on files;
|
||||||
|
filenames = files.map((file) => file?.name);
|
||||||
|
{
|
||||||
|
console.log(filenames);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<FormItem className="w-full sm:w-[48%]">
|
||||||
|
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||||
|
آپلود تصویر
|
||||||
|
</FormLabel>
|
||||||
|
{/* File Upload */}
|
||||||
|
<FormControl>
|
||||||
|
<Input
|
||||||
|
type="file"
|
||||||
|
className="mb-3"
|
||||||
|
accept="image/* , .pdf"
|
||||||
|
multiple={true}
|
||||||
|
disabled={form.formState.isSubmitting}
|
||||||
|
{...field}
|
||||||
|
onChange={(event) => {
|
||||||
|
// Triggered when user uploaded a new file
|
||||||
|
// FileList is immutable, so we need to create a new one
|
||||||
|
const dataTransfer = new DataTransfer();
|
||||||
|
|
||||||
|
// Add old images
|
||||||
|
// if (images) {
|
||||||
|
// Array.from(images).forEach((image) =>
|
||||||
|
// dataTransfer.items.add(image)
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Add newly uploaded images
|
||||||
|
Array.from(event.target.files!).forEach((image) =>
|
||||||
|
dataTransfer.items.add(image)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Validate and update uploaded file
|
||||||
|
const newFiles = dataTransfer.files;
|
||||||
|
onChange(newFiles);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
{/* Show File Name */}
|
||||||
|
{/* <FormDescription>{`${filenames}`}</FormDescription> */}
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{/* Captcha */}
|
||||||
|
<div className="flex flex-row flex-wrap justify-between">
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="captchaValue"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem className="w-full sm:w-[48%]">
|
||||||
|
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||||
|
*کد امنیتی
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input
|
||||||
|
placeholder="کد تصویر روبرو را وارد کنید "
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div className="w-full sm:w-[48%] flex items-center justify-start">
|
||||||
|
{!isLoading && (
|
||||||
|
<Image
|
||||||
|
alt="icon"
|
||||||
|
src={srcForImage as string}
|
||||||
|
className="w-3/5 h-12 rounded-md shadow-md"
|
||||||
|
width={150}
|
||||||
|
height={20}
|
||||||
|
quality={100}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{/* <Image src={Img1} alt="1" width={50} height={50} /> */}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex justify-center sm:justify-end gap-2 w-full mt-4">
|
||||||
|
{/* <Link> */}
|
||||||
|
<Button
|
||||||
|
// href="/RequestResult"
|
||||||
|
type="submit"
|
||||||
|
className="w-1/2 sm:w-1/3 lg:w-1/4 bg-blue text-white p-2 rounded-xl text-center mb-4"
|
||||||
|
>
|
||||||
|
ارسال درخواست
|
||||||
|
</Button>
|
||||||
|
{/* </Link> */}
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
"use client"
|
||||||
|
import React from 'react'
|
||||||
|
import Link from 'next/link'
|
||||||
|
import { requestItems } from '@/constants'
|
||||||
|
import Image from 'next/image'
|
||||||
|
import svg1 from '../public/img/Connector line.svg'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
import { IoArrowDown } from "react-icons/io5";
|
||||||
|
|
||||||
|
export default function SubmitRequest() {
|
||||||
|
return (
|
||||||
|
|
||||||
|
<div className="3xl:w-[60%] w-[75%] mx-auto pb-24">
|
||||||
|
<div className=" border my-6 mx-auto py-3 px-4 rounded-lg">
|
||||||
|
<p className="text-sm font-normal text-right text-black">
|
||||||
|
درباره سامانه سوت زنی
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className=" w-full flex flex-row gap-12 max-lg:flex-col-reverse items-center">
|
||||||
|
<div className='w-1/3 flex flex-col justify-between gap-8 max-lg:w-full'>
|
||||||
|
|
||||||
|
<p className="pr-6 font-normal text-sm leading-6 text-justify text-black line-clamp-5 tracking-wider max-sm:pr-0 ">
|
||||||
|
این سامانه با هدف بررسی درخواست های مردمی و شکایت های ایشان از پرسنل شهرداری و رسیدگی به آن ایجاد شده است.
|
||||||
|
فلوچارت روبرو نحوه ارسال درخواست و پیگیری آن را مشاهده می کنید.
|
||||||
|
</p>
|
||||||
|
<Link
|
||||||
|
href="#"
|
||||||
|
className="text-sm font-bold text-blue text-left underline underline-offset-4"
|
||||||
|
>
|
||||||
|
برای شروع ارسال درخواست کلیک کنید.
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
<div className='w-2/3 flex items-center max-lg:w-full max-sm:flex-wrap justify-center'>
|
||||||
|
{requestItems.map((item) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div
|
||||||
|
key={item.id}
|
||||||
|
className='min-w-3/12 w-3/12 h-full min-h-[11em] bg-blue transform -skew-x-[12deg] rounded-md flex items-center justify-center
|
||||||
|
max-md:min-h-[8em] max-sm:w-full max-sm:min-h-[3em]'>
|
||||||
|
<p className='text-white text-center text-sm font-bold px-6 max-md:px-3 max-md:font-medium max-sm:text-xs max-sm:font-normal '>
|
||||||
|
{item.name}</p>
|
||||||
|
</div>
|
||||||
|
<div className={cn("flex justify-center ",
|
||||||
|
item.id == 4 && "hidden"
|
||||||
|
)}>
|
||||||
|
<Image alt='!' src={svg1} className=" max-sm:hidden "/>
|
||||||
|
<IoArrowDown className="hidden max-sm:flex text-slate-600"/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -91,7 +91,7 @@ export default function TabController() {
|
||||||
value="tab1"
|
value="tab1"
|
||||||
className="hover:border-b-2 border-b-blue"
|
className="hover:border-b-2 border-b-blue"
|
||||||
>
|
>
|
||||||
جدید
|
جدید (2)
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
<TabsTrigger
|
<TabsTrigger
|
||||||
value="tab2"
|
value="tab2"
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ import { Label } from "./ui/label";
|
||||||
import { Input } from "./ui/input";
|
import { Input } from "./ui/input";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { ScrollArea } from "./ui/scroll-area";
|
|
||||||
interface Complaint {
|
interface Complaint {
|
||||||
id: string;
|
id: string;
|
||||||
trackingNumber: string;
|
trackingNumber: string;
|
||||||
|
|
@ -48,15 +47,12 @@ export default function TableController({
|
||||||
checkKey,
|
checkKey,
|
||||||
}: {
|
}: {
|
||||||
data: Complaint[];
|
data: Complaint[];
|
||||||
checkKey: (item: any) => any;
|
checkKey: (item:any) => any;
|
||||||
}) {
|
}) {
|
||||||
|
console.log(data);
|
||||||
const saveData = useData((state) => state.saveData);
|
const saveData = useData((state) => state.saveData);
|
||||||
const [selectedFile, setSelectedFile] = useState<any>(null);
|
const [selectedFile, setSelectedFile] = useState<any>(null);
|
||||||
const [open, setOpen] = useState<boolean>(false);
|
|
||||||
const [roData, setRowData] = useState<boolean>(false);
|
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const handleFileChange = (event: any) => {
|
const handleFileChange = (event: any) => {
|
||||||
const file = event.target.files[0];
|
const file = event.target.files[0];
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
|
|
@ -69,65 +65,77 @@ export default function TableController({
|
||||||
|
|
||||||
reader.readAsText(file);
|
reader.readAsText(file);
|
||||||
};
|
};
|
||||||
const checkKey2 = (item: any) => {
|
// const checkKey = (item: any) => {
|
||||||
const dcKey = Decrypt(item.cipherKeyInspector, selectedFile);
|
// const dcKey = Decrypt(item.cipherKeyInspector, selectedFile);
|
||||||
if (dcKey != false && dcKey != null) {
|
// if (dcKey != false && dcKey != null) {
|
||||||
saveData({
|
// saveData({
|
||||||
trackingNumber: item.trackingNumber,
|
// trackingNumber: item.trackingNumber,
|
||||||
password: Decrypt(item.cipherKeyInspector, selectedFile),
|
// password: Decrypt(item.cipherKeyInspector, selectedFile),
|
||||||
});
|
// });
|
||||||
router.push(`/UserPanel/ControllerDashboard/Complaints/${item.id}`);
|
// router.push(`/UserPanel/ControllerDashboard/Complaints/${item.id}`);
|
||||||
} else {
|
// } else {
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Table className="border-[1px] border-solid border-muted rounded-md w-full min-w-[40rem] overflow-y-auto scrollbar-thumb-gray-600 scrollbar-track-gray-100 scrollbar-thin">
|
<Dialog>
|
||||||
{/* <TableCaption>A list of your recent invoices.</TableCaption> */}
|
{/* <DialogTrigger className=" appearance-none" asChild>
|
||||||
<TableHeader>
|
<Button
|
||||||
<TableRow>
|
// onClick={handelVerify}
|
||||||
<TableHead>ردیف</TableHead>
|
type="submit"
|
||||||
<TableHead>تاریخ</TableHead>
|
className="bg-blue hover:bg-blue/90 text-white w-36 p-2 rounded-xl"
|
||||||
<TableHead>موضوع</TableHead>
|
>
|
||||||
<TableHead>دستگاه مربوطه</TableHead>
|
بارگذاری کلید جدید
|
||||||
</TableRow>
|
</Button>
|
||||||
</TableHeader>
|
</DialogTrigger> */}
|
||||||
<TableBody className="bg-[#F5F5F5]">
|
|
||||||
{data?.map((item: Complaint, index: number) => {
|
<Table className="border-[1px] border-solid border-muted rounded-md ">
|
||||||
return (
|
{/* <TableCaption>A list of your recent invoices.</TableCaption> */}
|
||||||
<TableRow
|
<TableHeader>
|
||||||
onClick={
|
<TableRow>
|
||||||
() => checkKey(item)
|
<TableHead>ردیف</TableHead>
|
||||||
// saveData({
|
<TableHead>تاریخ</TableHead>
|
||||||
// trackingNumber: item.trackingNumber,
|
<TableHead>موضوع</TableHead>
|
||||||
// password: Decrypt(item.cipherKeyInspector),
|
<TableHead>دستگاه مربوطه</TableHead>
|
||||||
// })
|
</TableRow>
|
||||||
}
|
</TableHeader>
|
||||||
className=" hover:bg-gray-200 cursor-pointer"
|
<TableBody className="bg-[#F5F5F5]">
|
||||||
key={item.id}
|
{data?.map((item: Complaint, index: number) => {
|
||||||
>
|
return (
|
||||||
{/* <Link
|
<TableRow
|
||||||
|
onClick={
|
||||||
|
() => checkKey(item)
|
||||||
|
// saveData({
|
||||||
|
// trackingNumber: item.trackingNumber,
|
||||||
|
// password: Decrypt(item.cipherKeyInspector),
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
className=" hover:bg-gray-200 cursor-pointer"
|
||||||
|
key={item.id}
|
||||||
|
>
|
||||||
|
{/* <Link
|
||||||
href={`/UserPanel/ControllerDashboard/Complaints/${item.id}`}
|
href={`/UserPanel/ControllerDashboard/Complaints/${item.id}`}
|
||||||
className="contents"
|
className="contents"
|
||||||
> */}
|
> */}
|
||||||
<TableCell className="w-1/12 font-medium ">
|
<TableCell className="w-1/12 font-medium ">
|
||||||
{index + 1}
|
{index + 1}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className="w-2/12">
|
<TableCell className="w-2/12">
|
||||||
{convertDate(item.registeredAt)}
|
{convertDate(item.registeredAt)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className="w-2/12">
|
<TableCell className="w-2/12">
|
||||||
{item?.title ? item.title : "-"}
|
{item?.category ? item.category.title : "-"}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className="w-7/12">-</TableCell>
|
<TableCell className="w-7/12">-</TableCell>
|
||||||
{/* </Link> */}
|
{/* </Link> */}
|
||||||
</TableRow>
|
</TableRow>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</TableBody>
|
</TableBody>
|
||||||
</Table>
|
</Table>
|
||||||
<Dialog open={open} onOpenChange={setOpen}>
|
{/* <DialogTrigger asChild>
|
||||||
|
<Button variant="outline">Edit Profile</Button>
|
||||||
|
</DialogTrigger> */}
|
||||||
<DialogContent dir="rtl" className="sm:max-w-[425px]">
|
<DialogContent dir="rtl" className="sm:max-w-[425px]">
|
||||||
<DialogHeader dir="rtl">
|
<DialogHeader dir="rtl">
|
||||||
<DialogTitle dir="rtl">بارگذاری کلید خصوصی</DialogTitle>
|
<DialogTitle dir="rtl">بارگذاری کلید خصوصی</DialogTitle>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
"use client";
|
"use client"
|
||||||
import React, { useState } from "react";
|
|
||||||
|
import React from 'react';
|
||||||
import {
|
import {
|
||||||
Chart as ChartJS,
|
Chart as ChartJS,
|
||||||
CategoryScale,
|
CategoryScale,
|
||||||
|
|
@ -8,19 +9,10 @@ import {
|
||||||
Title,
|
Title,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Legend,
|
Legend,
|
||||||
ChartOptions,
|
} from 'chart.js';
|
||||||
ScaleChartOptions,
|
import { Bar } from 'react-chartjs-2';
|
||||||
} from "chart.js";
|
import { faker } from "@faker-js/faker";
|
||||||
import { Bar, Line } from "react-chartjs-2";
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
|
||||||
import { getCookie } from "cookies-next";
|
|
||||||
import dayjs from "dayjs";
|
|
||||||
import utc from "dayjs/plugin/utc";
|
|
||||||
import jalaliday from "jalaliday";
|
|
||||||
import { backgroundColor, borderColor } from "@/constants/colors";
|
|
||||||
dayjs.extend(jalaliday);
|
|
||||||
dayjs.extend(utc);
|
|
||||||
// import faker from "faker";
|
|
||||||
ChartJS.register(
|
ChartJS.register(
|
||||||
CategoryScale,
|
CategoryScale,
|
||||||
LinearScale,
|
LinearScale,
|
||||||
|
|
@ -29,119 +21,40 @@ ChartJS.register(
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Legend
|
Legend
|
||||||
);
|
);
|
||||||
ChartJS.defaults.font.family = "Yekan";
|
|
||||||
interface Values {
|
|
||||||
displayValue: string;
|
|
||||||
parameters: string;
|
|
||||||
title: string;
|
|
||||||
value: string;
|
|
||||||
}
|
|
||||||
function getRandomColor(n) {
|
|
||||||
var letters = "0123456789ABCDEF".split("");
|
|
||||||
var color = "#";
|
|
||||||
var colors = [];
|
|
||||||
for (var j = 0; j < n; j++) {
|
|
||||||
for (var i = 0; i < 6; i++) {
|
|
||||||
color += letters[Math.floor(Math.random() * 16)];
|
|
||||||
}
|
|
||||||
colors.push(color);
|
|
||||||
color = "#";
|
|
||||||
}
|
|
||||||
return colors;
|
|
||||||
}
|
|
||||||
function BarChart({
|
|
||||||
chartData,
|
|
||||||
chart,
|
|
||||||
chartTitle,
|
|
||||||
}: {
|
|
||||||
chartData: { title: string; icon: string; values: Values[] }[];
|
|
||||||
chart?: number;
|
|
||||||
chartTitle: string;
|
|
||||||
}) {
|
|
||||||
const DataSets = [];
|
|
||||||
// if (chartTitle == "درخواست های سی روز گذشته") {
|
|
||||||
// var labels = chartData[1].values.map((item) => {
|
|
||||||
// return item.title;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// var label1 = chartData[0].title;
|
export const options = {
|
||||||
// var label2 = chartData[1].title;
|
responsive: true,
|
||||||
// var value1 = chartData[0].values.map((item) => Number(item.value));
|
plugins: {
|
||||||
// var value2 = chartData[1].values.map((item) => Number(item.value));
|
legend: {
|
||||||
// DataSets.push({ label: label1, data: value1 });
|
position: 'top' as const,
|
||||||
// DataSets.push({ label: label2, data: value2 });
|
|
||||||
// // console.log(labels);
|
|
||||||
// // console.log(value1);
|
|
||||||
// } else if ("گزارش تعداد درخواست ها بر اساس نوع بیمه") {
|
|
||||||
// var labels = chartData[0].values.map((item) => {
|
|
||||||
// return item.title;
|
|
||||||
// });
|
|
||||||
// var label1 = "";
|
|
||||||
// var value1 = chartData[0].values.map((item) => Number(item.value));
|
|
||||||
// DataSets.push({ label: label1, data: value1 });
|
|
||||||
// console.log(value1);
|
|
||||||
// }
|
|
||||||
console.log(chartData);
|
|
||||||
const options: ChartOptions<"bar"> = {
|
|
||||||
scales: { x: { ticks: { autoSkip: false } }, y: { stacked: false } },
|
|
||||||
responsive: true,
|
|
||||||
maintainAspectRatio: false,
|
|
||||||
plugins: {
|
|
||||||
title: {
|
|
||||||
display: true,
|
|
||||||
text: chartTitle,
|
|
||||||
position: "bottom",
|
|
||||||
},
|
|
||||||
tooltip: {
|
|
||||||
textDirection: "rtl",
|
|
||||||
},
|
|
||||||
datalabels: {
|
|
||||||
display: true,
|
|
||||||
color: "black",
|
|
||||||
align: "end",
|
|
||||||
anchor: "end",
|
|
||||||
font: { size: 12 },
|
|
||||||
formatter: function (value, context) {
|
|
||||||
return value == 0 ? "" : value;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
// scales: {
|
|
||||||
// x: { ticks: { autoSkip: false } },
|
|
||||||
// y: {
|
|
||||||
// stacked: false,
|
|
||||||
// // suggestedMax:
|
|
||||||
// // Math.max(
|
|
||||||
// // ...chartData.map((l, j) => {
|
|
||||||
// // console.log(l);
|
|
||||||
// // const a = l.values.map((v) => {
|
|
||||||
// // return Number(v.value);
|
|
||||||
// // });
|
|
||||||
// // const b = Math.max(...a);
|
|
||||||
// // console.log(b);
|
|
||||||
// // return l.values.map((v) => Number(v.value));
|
|
||||||
// // })
|
|
||||||
// // ) * 1.2,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
},
|
},
|
||||||
};
|
title: {
|
||||||
|
display: true,
|
||||||
|
text: 'Chart.js Bar Chart',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const data = {
|
const labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July'];
|
||||||
labels: chartData[0]?.values?.map((item) => {
|
|
||||||
return item.title;
|
export const data = {
|
||||||
}),
|
labels,
|
||||||
datasets: chartData.map((item: any, index: number) => {
|
datasets: [
|
||||||
return {
|
{
|
||||||
label: item.title,
|
label: 'Dataset 1',
|
||||||
data: item.values.map((item) => item.value),
|
data: labels.map(() => faker.datatype.number({ min: 0, max: 1000 })),
|
||||||
backgroundColor: backgroundColor[index],
|
backgroundColor: 'rgba(255, 99, 132, 0.5)',
|
||||||
borderColor: borderColor[index],
|
},
|
||||||
borderWidth: 1,
|
{
|
||||||
};
|
label: 'Dataset 2',
|
||||||
}),
|
data: labels.map(() => faker.datatype.number({ min: 0, max: 1000 })),
|
||||||
};
|
backgroundColor: 'rgba(53, 162, 235, 0.5)',
|
||||||
// console.log(data);
|
},
|
||||||
return <Bar dir="rtl" className="min-h-[20rem]" options={options} data={data} />;
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
export function VerticalChart() {
|
||||||
|
return (
|
||||||
|
<Bar options={options} data={data} className='!w-full !h-full'/>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default BarChart;
|
|
||||||
|
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
"use client"
|
|
||||||
|
|
||||||
import * as React from "react"
|
|
||||||
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"
|
|
||||||
|
|
||||||
import { cn } from "@/lib/utils"
|
|
||||||
|
|
||||||
const ScrollArea = React.forwardRef<
|
|
||||||
React.ElementRef<typeof ScrollAreaPrimitive.Root>,
|
|
||||||
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
|
|
||||||
>(({ className, children, ...props }, ref) => (
|
|
||||||
<ScrollAreaPrimitive.Root
|
|
||||||
ref={ref}
|
|
||||||
className={cn("relative overflow-hidden", className)}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
<ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
|
|
||||||
{children}
|
|
||||||
</ScrollAreaPrimitive.Viewport>
|
|
||||||
<ScrollBar />
|
|
||||||
<ScrollAreaPrimitive.Corner />
|
|
||||||
</ScrollAreaPrimitive.Root>
|
|
||||||
))
|
|
||||||
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName
|
|
||||||
|
|
||||||
const ScrollBar = React.forwardRef<
|
|
||||||
React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
|
|
||||||
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
||||||
>(({ className, orientation = "vertical", ...props }, ref) => (
|
|
||||||
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
||||||
ref={ref}
|
|
||||||
orientation={orientation}
|
|
||||||
className={cn(
|
|
||||||
"flex touch-none select-none transition-colors",
|
|
||||||
orientation === "vertical" &&
|
|
||||||
"h-full w-2.5 border-l border-l-transparent p-[1px]",
|
|
||||||
orientation === "horizontal" &&
|
|
||||||
"h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
|
||||||
className
|
|
||||||
)}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
<ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />
|
|
||||||
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
||||||
))
|
|
||||||
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName
|
|
||||||
|
|
||||||
export { ScrollArea, ScrollBar }
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
"use client"
|
|
||||||
|
|
||||||
import * as React from "react"
|
|
||||||
import * as SeparatorPrimitive from "@radix-ui/react-separator"
|
|
||||||
|
|
||||||
import { cn } from "@/lib/utils"
|
|
||||||
|
|
||||||
const Separator = React.forwardRef<
|
|
||||||
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
|
||||||
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
|
||||||
>(
|
|
||||||
(
|
|
||||||
{ className, orientation = "horizontal", decorative = true, ...props },
|
|
||||||
ref
|
|
||||||
) => (
|
|
||||||
<SeparatorPrimitive.Root
|
|
||||||
ref={ref}
|
|
||||||
decorative={decorative}
|
|
||||||
orientation={orientation}
|
|
||||||
className={cn(
|
|
||||||
"shrink-0 bg-border",
|
|
||||||
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
||||||
className
|
|
||||||
)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
)
|
|
||||||
Separator.displayName = SeparatorPrimitive.Root.displayName
|
|
||||||
|
|
||||||
export { Separator }
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
export const backgroundColor = [
|
|
||||||
"rgba(255, 99, 132, 0.2)",
|
|
||||||
"rgba(54, 162, 235, 0.2)",
|
|
||||||
"rgba(255, 206, 86, 0.2)",
|
|
||||||
"rgba(75, 192, 192, 0.2)",
|
|
||||||
"rgba(153, 102, 255, 0.2)",
|
|
||||||
"rgba(255, 159, 64, 0.2)",
|
|
||||||
"rgba(255, 0, 0, 0.2)",
|
|
||||||
"rgba(0, 255, 0, 0.2)",
|
|
||||||
"rgba(0, 0, 255, 0.2)",
|
|
||||||
"rgba(255, 255, 0, 0.2)",
|
|
||||||
"rgba(255, 0, 255, 0.2)",
|
|
||||||
"rgba(0, 255, 255, 0.2)",
|
|
||||||
"rgba(128, 0, 0, 0.2)",
|
|
||||||
"rgba(0, 128, 0, 0.2)",
|
|
||||||
"rgba(0, 0, 128, 0.2)",
|
|
||||||
"rgba(128, 128, 0, 0.2)",
|
|
||||||
"rgba(128, 0, 128, 0.2)",
|
|
||||||
"rgba(0, 128, 128, 0.2)",
|
|
||||||
"rgba(255, 128, 0, 0.2)",
|
|
||||||
"rgba(128, 255, 0, 0.2)",
|
|
||||||
"rgba(0, 255, 128, 0.2)",
|
|
||||||
"rgba(0, 128, 255, 0.2)",
|
|
||||||
"rgba(128, 0, 255, 0.2)",
|
|
||||||
"rgba(255, 0, 128, 0.2)",
|
|
||||||
"rgba(255, 128, 128, 0.2)",
|
|
||||||
"rgba(128, 255, 128, 0.2)",
|
|
||||||
"rgba(128, 128, 255, 0.2)",
|
|
||||||
"rgba(192, 192, 192, 0.2)",
|
|
||||||
"rgba(128, 128, 128, 0.2)",
|
|
||||||
"rgba(0, 0, 0, 0.2)",
|
|
||||||
];
|
|
||||||
|
|
||||||
export const borderColor = [
|
|
||||||
"rgba(255, 99, 132, 1)",
|
|
||||||
"rgba(54, 162, 235, 1)",
|
|
||||||
"rgba(255, 206, 86, 1)",
|
|
||||||
"rgba(75, 192, 192, 1)",
|
|
||||||
"rgba(153, 102, 255, 1)",
|
|
||||||
"rgba(255, 159, 64, 1)",
|
|
||||||
"rgba(255, 0, 0, 1)",
|
|
||||||
"rgba(0, 255, 0, 1)",
|
|
||||||
"rgba(0, 0, 255, 1)",
|
|
||||||
"rgba(255, 255, 0, 1)",
|
|
||||||
"rgba(255, 0, 255, 1)",
|
|
||||||
"rgba(0, 255, 255, 1)",
|
|
||||||
"rgba(128, 0, 0, 1)",
|
|
||||||
"rgba(0, 128, 0, 1)",
|
|
||||||
"rgba(0, 0, 128, 1)",
|
|
||||||
"rgba(128, 128, 0, 1)",
|
|
||||||
"rgba(128, 0, 128, 1)",
|
|
||||||
"rgba(0, 128, 128, 1)",
|
|
||||||
"rgba(255, 128, 0, 1)",
|
|
||||||
"rgba(128, 255, 0, 1)",
|
|
||||||
"rgba(0, 255, 128, 1)",
|
|
||||||
"rgba(0, 128, 255, 1)",
|
|
||||||
"rgba(128, 0, 255, 1)",
|
|
||||||
"rgba(255, 0, 128, 1)",
|
|
||||||
"rgba(255, 128, 128, 1)",
|
|
||||||
"rgba(128, 255, 128, 1)",
|
|
||||||
"rgba(128, 128, 255, 1)",
|
|
||||||
"rgba(192, 192, 192, 1)",
|
|
||||||
"rgba(128, 128, 128, 1)",
|
|
||||||
"rgba(0, 0, 0, 1)",
|
|
||||||
];
|
|
||||||
|
|
@ -15,9 +15,7 @@
|
||||||
"@radix-ui/react-icons": "^1.3.0",
|
"@radix-ui/react-icons": "^1.3.0",
|
||||||
"@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-radio-group": "^1.1.3",
|
||||||
"@radix-ui/react-scroll-area": "^1.0.5",
|
|
||||||
"@radix-ui/react-select": "^2.0.0",
|
"@radix-ui/react-select": "^2.0.0",
|
||||||
"@radix-ui/react-separator": "^1.0.3",
|
|
||||||
"@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",
|
||||||
"@radix-ui/react-toast": "^1.1.5",
|
"@radix-ui/react-toast": "^1.1.5",
|
||||||
|
|
@ -26,7 +24,6 @@
|
||||||
"@uidotdev/usehooks": "^2.4.1",
|
"@uidotdev/usehooks": "^2.4.1",
|
||||||
"axios": "^1.6.2",
|
"axios": "^1.6.2",
|
||||||
"chart.js": "^4.4.1",
|
"chart.js": "^4.4.1",
|
||||||
"chartjs-plugin-datalabels": "^2.2.0",
|
|
||||||
"class-variance-authority": "^0.7.0",
|
"class-variance-authority": "^0.7.0",
|
||||||
"clsx": "^2.0.0",
|
"clsx": "^2.0.0",
|
||||||
"cookies-next": "^4.1.0",
|
"cookies-next": "^4.1.0",
|
||||||
|
|
@ -42,7 +39,6 @@
|
||||||
"lucide-react": "^0.292.0",
|
"lucide-react": "^0.292.0",
|
||||||
"next": "14.0.3",
|
"next": "14.0.3",
|
||||||
"next-themes": "^0.2.1",
|
"next-themes": "^0.2.1",
|
||||||
"nextjs-toploader": "^1.6.4",
|
|
||||||
"npm": "^10.2.5",
|
"npm": "^10.2.5",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-chartjs-2": "^5.2.0",
|
"react-chartjs-2": "^5.2.0",
|
||||||
|
|
@ -73,7 +69,6 @@
|
||||||
"eslint": "^8",
|
"eslint": "^8",
|
||||||
"eslint-config-next": "14.0.3",
|
"eslint-config-next": "14.0.3",
|
||||||
"postcss": "^8",
|
"postcss": "^8",
|
||||||
"tailwind-scrollbar": "^3.0.5",
|
|
||||||
"tailwindcss": "^3.3.0",
|
"tailwindcss": "^3.3.0",
|
||||||
"typescript": "^5"
|
"typescript": "^5"
|
||||||
}
|
}
|
||||||
|
|
@ -1046,37 +1041,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@radix-ui/react-scroll-area": {
|
|
||||||
"version": "1.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-scroll-area/-/react-scroll-area-1.0.5.tgz",
|
|
||||||
"integrity": "sha512-b6PAgH4GQf9QEn8zbT2XUHpW5z8BzqEc7Kl11TwDrvuTrxlkcjTD5qa/bxgKr+nmuXKu4L/W5UZ4mlP/VG/5Gw==",
|
|
||||||
"dependencies": {
|
|
||||||
"@babel/runtime": "^7.13.10",
|
|
||||||
"@radix-ui/number": "1.0.1",
|
|
||||||
"@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-use-callback-ref": "1.0.1",
|
|
||||||
"@radix-ui/react-use-layout-effect": "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-select": {
|
"node_modules/@radix-ui/react-select": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-select/-/react-select-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@radix-ui/react-select/-/react-select-2.0.0.tgz",
|
||||||
|
|
@ -1120,29 +1084,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@radix-ui/react-separator": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-separator/-/react-separator-1.0.3.tgz",
|
|
||||||
"integrity": "sha512-itYmTy/kokS21aiV5+Z56MZB54KrhPgn6eHDKkFeOLR34HMN2s8PaN47qZZAGnvupcjxHaFZnW4pQEh0BvvVuw==",
|
|
||||||
"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-slot": {
|
"node_modules/@radix-ui/react-slot": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.0.2.tgz",
|
||||||
|
|
@ -1492,11 +1433,6 @@
|
||||||
"undici-types": "~5.26.4"
|
"undici-types": "~5.26.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/nprogress": {
|
|
||||||
"version": "0.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/nprogress/-/nprogress-0.2.3.tgz",
|
|
||||||
"integrity": "sha512-k7kRA033QNtC+gLc4VPlfnue58CM1iQLgn1IMAU8VPHGOj7oIHPp9UlhedEnD/Gl8evoCjwkZjlBORtZ3JByUA=="
|
|
||||||
},
|
|
||||||
"node_modules/@types/prop-types": {
|
"node_modules/@types/prop-types": {
|
||||||
"version": "15.7.11",
|
"version": "15.7.11",
|
||||||
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz",
|
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz",
|
||||||
|
|
@ -2156,14 +2092,6 @@
|
||||||
"pnpm": ">=7"
|
"pnpm": ">=7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/chartjs-plugin-datalabels": {
|
|
||||||
"version": "2.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/chartjs-plugin-datalabels/-/chartjs-plugin-datalabels-2.2.0.tgz",
|
|
||||||
"integrity": "sha512-14ZU30lH7n89oq+A4bWaJPnAG8a7ZTk7dKf48YAzMvJjQtjrgg5Dpk9f+LbjCF6bpx3RAGTeL13IXpKQYyRvlw==",
|
|
||||||
"peerDependencies": {
|
|
||||||
"chart.js": ">=3.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/chokidar": {
|
"node_modules/chokidar": {
|
||||||
"version": "3.5.3",
|
"version": "3.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
|
||||||
|
|
@ -4409,21 +4337,6 @@
|
||||||
"react-dom": "*"
|
"react-dom": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/nextjs-toploader": {
|
|
||||||
"version": "1.6.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/nextjs-toploader/-/nextjs-toploader-1.6.4.tgz",
|
|
||||||
"integrity": "sha512-KYLQ+0MvGdFk9JwOQfRtaYBAsyuX67Ca5QTa51RGNO4gQx64KLSE+ryHjUQ5LcDczHotp0l32GgksQW9vucUkw==",
|
|
||||||
"dependencies": {
|
|
||||||
"@types/nprogress": "^0.2.1",
|
|
||||||
"nprogress": "^0.2.0",
|
|
||||||
"prop-types": "^15.8.1"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"next": ">= 6.0.0",
|
|
||||||
"react": ">= 16.0.0",
|
|
||||||
"react-dom": ">= 16.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/node-releases": {
|
"node_modules/node-releases": {
|
||||||
"version": "2.0.13",
|
"version": "2.0.13",
|
||||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz",
|
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz",
|
||||||
|
|
@ -7178,11 +7091,6 @@
|
||||||
"inBundle": true,
|
"inBundle": true,
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
"node_modules/nprogress": {
|
|
||||||
"version": "0.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/nprogress/-/nprogress-0.2.0.tgz",
|
|
||||||
"integrity": "sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA=="
|
|
||||||
},
|
|
||||||
"node_modules/object-assign": {
|
"node_modules/object-assign": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||||
|
|
@ -8523,18 +8431,6 @@
|
||||||
"url": "https://github.com/sponsors/dcastil"
|
"url": "https://github.com/sponsors/dcastil"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/tailwind-scrollbar": {
|
|
||||||
"version": "3.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/tailwind-scrollbar/-/tailwind-scrollbar-3.0.5.tgz",
|
|
||||||
"integrity": "sha512-0ZwxTivevqq9BY9fRP9zDjHl7Tu+J5giBGbln+0O1R/7nHtBUKnjQcA1aTIhK7Oyjp6Uc/Dj6/dn8Dq58k5Uww==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12.13.0"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"tailwindcss": "3.x"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/tailwindcss": {
|
"node_modules/tailwindcss": {
|
||||||
"version": "3.3.5",
|
"version": "3.3.5",
|
||||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.5.tgz",
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,7 @@
|
||||||
"@radix-ui/react-icons": "^1.3.0",
|
"@radix-ui/react-icons": "^1.3.0",
|
||||||
"@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-radio-group": "^1.1.3",
|
||||||
"@radix-ui/react-scroll-area": "^1.0.5",
|
|
||||||
"@radix-ui/react-select": "^2.0.0",
|
"@radix-ui/react-select": "^2.0.0",
|
||||||
"@radix-ui/react-separator": "^1.0.3",
|
|
||||||
"@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",
|
||||||
"@radix-ui/react-toast": "^1.1.5",
|
"@radix-ui/react-toast": "^1.1.5",
|
||||||
|
|
@ -27,7 +25,6 @@
|
||||||
"@uidotdev/usehooks": "^2.4.1",
|
"@uidotdev/usehooks": "^2.4.1",
|
||||||
"axios": "^1.6.2",
|
"axios": "^1.6.2",
|
||||||
"chart.js": "^4.4.1",
|
"chart.js": "^4.4.1",
|
||||||
"chartjs-plugin-datalabels": "^2.2.0",
|
|
||||||
"class-variance-authority": "^0.7.0",
|
"class-variance-authority": "^0.7.0",
|
||||||
"clsx": "^2.0.0",
|
"clsx": "^2.0.0",
|
||||||
"cookies-next": "^4.1.0",
|
"cookies-next": "^4.1.0",
|
||||||
|
|
@ -43,7 +40,6 @@
|
||||||
"lucide-react": "^0.292.0",
|
"lucide-react": "^0.292.0",
|
||||||
"next": "14.0.3",
|
"next": "14.0.3",
|
||||||
"next-themes": "^0.2.1",
|
"next-themes": "^0.2.1",
|
||||||
"nextjs-toploader": "^1.6.4",
|
|
||||||
"npm": "^10.2.5",
|
"npm": "^10.2.5",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-chartjs-2": "^5.2.0",
|
"react-chartjs-2": "^5.2.0",
|
||||||
|
|
@ -74,7 +70,6 @@
|
||||||
"eslint": "^8",
|
"eslint": "^8",
|
||||||
"eslint-config-next": "14.0.3",
|
"eslint-config-next": "14.0.3",
|
||||||
"postcss": "^8",
|
"postcss": "^8",
|
||||||
"tailwind-scrollbar": "^3.0.5",
|
|
||||||
"tailwindcss": "^3.3.0",
|
"tailwindcss": "^3.3.0",
|
||||||
"typescript": "^5"
|
"typescript": "^5"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,5 +85,5 @@ module.exports = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [require("tailwindcss-animate"), require("tailwind-scrollbar")],
|
plugins: [require("tailwindcss-animate")],
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
import axios from "axios";
|
|
||||||
import { CookieValueTypes, getCookie } from "cookies-next";
|
|
||||||
|
|
||||||
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
|
||||||
|
|
||||||
axios.interceptors.request.use(function (config) {
|
|
||||||
const token = getCookie("Sootzani_Token");
|
|
||||||
config.headers.Authorization = token ? `Bearer ${token}` : "";
|
|
||||||
return config;
|
|
||||||
});
|
|
||||||
|
|
||||||
export async function getInfoList() {
|
|
||||||
const data = await axios.get("api/Info/List");
|
|
||||||
return data.data;
|
|
||||||
}
|
|
||||||
export async function getInfo(id: string = "0") {
|
|
||||||
const data = await axios.get(`api/Info/${id}`);
|
|
||||||
return data.data;
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue