First Commit

Kahdooie
Hossein Rahmani 2024-01-02 17:22:01 +03:30
commit f7078d588e
133 changed files with 16298 additions and 0 deletions

1
.env Normal file
View File

@ -0,0 +1 @@
NEXT_PUBLIC_BASE_URL_APP="https://sootzaniapi.shetabdahi.ir/"

3
.eslintrc.json Normal file
View File

@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}

36
.gitignore vendored Normal file
View File

@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env*.local
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts

7
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
"workbench.colorCustomizations": {
"activityBar.background": "#580D3A",
"titleBar.activeBackground": "#7B1251",
"titleBar.activeForeground": "#FFFCFD"
}
}

36
README.md Normal file
View File

@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

8
app/CallUs/page.tsx Normal file
View File

@ -0,0 +1,8 @@
import React from "react";
import CallUs from "@/components/CallUs";
export default function page() {
return (
<CallUs />
);
}

View File

@ -0,0 +1,6 @@
import CitizenLogin from "@/components/CitizenLogin";
import React from "react";
export default function page() {
return <CitizenLogin />;
}

View File

@ -0,0 +1,8 @@
import React from "react";
import FollowResult from "@/components/FollowResult";
export default function page() {
return (
<FollowResult />
);
}

8
app/FollowUp/page.tsx Normal file
View File

@ -0,0 +1,8 @@
import React from "react";
import FollowUp from "@/components/FollowUp";
export default function page() {
return (
<FollowUp />
);
}

8
app/Login/page.tsx Normal file
View File

@ -0,0 +1,8 @@
import Login from "@/components/Login";
import React from "react";
export default function page() {
return (
<Login />
);
}

View File

@ -0,0 +1,8 @@
import React from "react";
import Result from "@/components/RequestResult";
export default function page() {
return (
<Result />
);
}

View File

@ -0,0 +1,8 @@
import React from "react";
import RequestStep1 from "@/components/RequestStep1";
export default function page() {
return (
<RequestStep1 />
);
}

View File

@ -0,0 +1,8 @@
import React from "react";
import RequestStep2 from "@/components/RequestStep2";
export default function page() {
return (
<RequestStep2 />
);
}

View File

@ -0,0 +1,8 @@
import AdminKeysManagement from '@/components/AdminKeysManagement'
import React from 'react'
export default function page() {
return (
<AdminKeysManagement />
)
}

View File

@ -0,0 +1,8 @@
import AdminUserManagement from '@/components/AdminUserManagement'
import React from 'react'
export default function page() {
return (
<AdminUserManagement />
)
}

View File

@ -0,0 +1,16 @@
import NavbarPanel from "@/components/NavbarPanel";
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<NavbarPanel />
{children}
</>
)
}

View File

@ -0,0 +1,8 @@
import AdminDashboard from "@/components/AdminDashboard";
import React from "react";
export default function page() {
return (
<AdminDashboard />
);
}

View File

@ -0,0 +1,16 @@
import NavbarPanel from "@/components/NavbarPanel";
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<NavbarPanel />
{children}
</>
)
}

View File

@ -0,0 +1,7 @@
import React from 'react'
export default function page() {
return (
<div>page</div>
)
}

View File

@ -0,0 +1,18 @@
import ComplainsDetails from "@/components/ComplainsDetails";
import React from "react";
export default function page({ params }: { params: any }) {
const id = params.id;
{
console.log(params);
}
{
console.log(id);
}
return (
<div className="w-[90vw] sm:w-[90vw] lg:w-[85vw] xl:w-[75vw] 3xl:w-[70vw] mt-16 sm:mt-8 pt-9 mx-auto mb-10">
<ComplainsDetails role="Inspector" id={id} />;
</div>
);
}

View File

@ -0,0 +1,8 @@
import TabController from '@/components/TabController'
import React from 'react'
export default function page() {
return (
<TabController />
)
}

View File

@ -0,0 +1,8 @@
import ReportsController from '@/components/ReportsController'
import React from 'react'
export default function page() {
return (
<ReportsController />
)
}

View File

@ -0,0 +1,21 @@
import NavbarPanel from "@/components/NavbarPanel";
import { cookies } from "next/headers";
import { redirect } from "next/navigation";
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
// const cookieStore = cookies();
// const token = cookieStore.get("Sootzani-Token");
// if (!token.value) {
// return redirect("/");
// }
return (
<>
<NavbarPanel />
{children}
</>
);
}

View File

@ -0,0 +1,8 @@
import ControllerDashboard from "@/components/ControllerDashboard";
import React from "react";
export default function page() {
return (
<ControllerDashboard />
);
}

7
app/UserPanel/page.tsx Normal file
View File

@ -0,0 +1,7 @@
import React from 'react'
export default function page() {
return (
<div>Userpage</div>
)
}

6
app/Verify/page.tsx Normal file
View File

@ -0,0 +1,6 @@
import Verify from "@/components/Verify";
import React from "react";
export default function page() {
return <Verify />;
}

189
app/components/Landing.tsx Normal file
View File

@ -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>
);
}

BIN
app/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

104
app/globals.css Normal file
View File

@ -0,0 +1,104 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;
--card: 0 0% 100%;
--card-foreground: 222.2 84% 4.9%;
--popover: 0 0% 100%;
--popover-foreground: 222.2 84% 4.9%;
--primary: 222.2 47.4% 11.2%;
--primary-foreground: 210 40% 98%;
--secondary: 210 40% 96.1%;
--secondary-foreground: 222.2 47.4% 11.2%;
--muted: 210 40% 96.1%;
--muted-foreground: 215.4 16.3% 46.9%;
--accent: 210 40% 96.1%;
--accent-foreground: 222.2 47.4% 11.2%;
--destructive: 0 84.2% 60.2%;
--destructive-foreground: 210 40% 98%;
--border: 214.3 31.8% 91.4%;
--input: 214.3 31.8% 91.4%;
--ring: 222.2 84% 4.9%;
--radius: 0.5rem;
}
.dark {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;
--card: 222.2 84% 4.9%;
--card-foreground: 210 40% 98%;
--popover: 222.2 84% 4.9%;
--popover-foreground: 210 40% 98%;
--primary: 210 40% 98%;
--primary-foreground: 222.2 47.4% 11.2%;
--secondary: 217.2 32.6% 17.5%;
--secondary-foreground: 210 40% 98%;
--muted: 217.2 32.6% 17.5%;
--muted-foreground: 215 20.2% 65.1%;
--accent: 217.2 32.6% 17.5%;
--accent-foreground: 210 40% 98%;
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 210 40% 98%;
--border: 217.2 32.6% 17.5%;
--input: 217.2 32.6% 17.5%;
--ring: 212.7 26.8% 83.9%;
}
}
@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}
@font-face {
font-family: "yekan";
src: url(../fonts/iranyekanwebregularfanum.ttf);
}
@font-face {
font-family: "yekan-m";
src: url(../fonts/iranyekanwebmediumfanum.ttf);
}
.leaflet-container {
width: 100%;
height: 100vh;
}
.printPage{
background-color: antiquewhite;
color: black;
direction: rtl;
font-family: sans-serif;
font-size: medium;
padding: 1em;
border: 2px solid black;
}

36
app/layout.tsx Normal file
View File

@ -0,0 +1,36 @@
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
import { Toaster } from "@/components/ui/toaster";
import Navbar from "@/components/Navbar";
import NavbarSm from "@/components/NavbarSm";
import Provider from "../utils/Provider";
import { Toaster as SonnerToaster } from "@/components/ui/sonner";
const inter = Inter({ subsets: ["latin"] });
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="fa" dir="rtl">
<body className="font-[yekan] ">
<Provider>
<Navbar />
<NavbarSm />
<div className="flex justify-center">{children}</div>
<Toaster />
<SonnerToaster />
</Provider>
</body>
</html>
);
}

6
app/page.tsx Normal file
View File

@ -0,0 +1,6 @@
import Landing from "@/app/components/Landing";
import Image from "next/image";
export default function Home() {
return <Landing />;
}

13
app/print-styles.css Normal file
View File

@ -0,0 +1,13 @@
/* styles/print-styles.css */
@media print {
/* Add styles for the print window */
body {
font-size: larger;
color: red;
background-color: aquamarine;
padding: 2em;
/* Add any other print-specific styles */
}
}

16
components.json Normal file
View File

@ -0,0 +1,16 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "app/globals.css",
"baseColor": "slate",
"cssVariables": true
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}

View File

@ -0,0 +1,35 @@
import React from "react";
import BoxDashboard from "./BoxDashboard";
import LineChart from "./LineChart";
import { HorizontalChart } from "./HorizontalChart";
import { VerticalChart } from "./VerticalChart";
import { PieChart } from "./PieChart";
export default function AdminDashboard() {
return (
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-8 max-sm:mt-16 pt-9">
<div className="w-full mb-6 flex flex-col gap-4 ">
<div className="w-full md:h-36 flex flex-row max-md:flex-wrap justify-center md:justify-between gap-3 ">
<BoxDashboard />
<BoxDashboard />
<BoxDashboard />
<BoxDashboard />
<BoxDashboard />
<BoxDashboard />
</div>
<div className="w-full flex flex-col md:flex-row gap-12 md:gap-1 ">
<div className="w-full md:w-1/3 h-full flex justify-center">
<PieChart />
</div>
<hr />
<div className="w-full md:w-2/3 h-full flex justify-center">
<VerticalChart />
</div>
</div>
</div>
</div>
);
}

View File

@ -0,0 +1,257 @@
"use client";
import React, { useState } from "react";
import { useQuery } from "@tanstack/react-query";
import { GenerateKeyPair, GetKeys } from "@/utils/adminApi";
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/components/ui/alert-dialog";
import { Button } from "@/components/ui/button";
import { ThreeDots } from "react-loader-spinner";
import {
Form,
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
FormMessage,
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
// const FormSchema = z.object({
// title: 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 AdminKeysManagement() {
// List Keys
const {
data: data1,
error: Error1,
isLoading: isListLoading,
refetch: refetch1,
} = useQuery({
queryKey: ["KeysList"],
queryFn: () => GetKeys(),
// refetchOnWindowFocus: false,
});
console.log(data1);
// GenerateKeyPair
const {
data: data2,
error: Error2,
isLoading: isNewKeyLoading,
refetch: refetch2,
} = useQuery({
queryKey: ["GenerateKey"],
queryFn: () => GenerateKeyPair(),
enabled: false, // Disable automatic fetching
});
const handleClick = () => {
refetch2();
console.log(data2);
// Manually trigger the query when the button is clicked
};
// }
return (
<div className="w-full bg-[#F5F5F5] min-h-[82vh] flex justify-center">
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
{/* 1 */}
<AlertDialog>
<AlertDialogTrigger asChild>
<Button
variant="outline"
onClick={handleClick}
disabled={isNewKeyLoading}
>
{" "}
ایجاد جفت کلید
</Button>
</AlertDialogTrigger>
<AlertDialogContent className=" w-full max-w-6xl h-full max-h-[80vh]">
<AlertDialogHeader>
<AlertDialogTitle>اطلاعات کلید جدید</AlertDialogTitle>
<AlertDialogDescription>
{isNewKeyLoading ? (
<div className="felx justify-center items-center self-center h-full">
<ThreeDots
visible={true}
height="80"
width="100"
color="#003778"
radius="9"
ariaLabel="three-dots-loading"
wrapperStyle={{}}
wrapperClass=""
/>
</div>
) : (
<div className=" " id="KeyFetch">
<p className="text-black text-sm font-semibold">
کلید عمومی :
</p>
<p className="text-slate-700 text-sm text-left mb-4">
{data2?.publicKey}
</p>
<p className="text-black text-sm font-semibold">
کلید خصوصی :
</p>
<p className="text-slate-700 text-sm text-left mb-4">
{data2?.privateKey}
</p>
</div>
)}
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>بستن</AlertDialogCancel>
{/* <AlertDialogAction>Continue</AlertDialogAction> */}
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
{/* 1 */}
<AlertDialog>
<AlertDialogTrigger asChild>
<Button
variant="outline"
onClick={handleClick}
disabled={isNewKeyLoading}
>
افزودن کلید جدید
</Button>
</AlertDialogTrigger>
<AlertDialogContent className=" w-full max-w-6xl h-full max-h-[80vh]">
<AlertDialogHeader>
<AlertDialogTitle>افزودن کلید جدید</AlertDialogTitle>
<AlertDialogDescription>
{isNewKeyLoading ? (
<div className="felx justify-center items-center self-center h-full">
<ThreeDots
visible={true}
height="80"
width="100"
color="#003778"
radius="9"
ariaLabel="three-dots-loading"
wrapperStyle={{}}
wrapperClass=""
/>
</div>
) : (
<></>
// <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>
)}
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>بستن</AlertDialogCancel>
{/* <AlertDialogAction>Continue</AlertDialogAction> */}
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
<div className="w-full text-right text-neutral-600 text-lg font-bold my-4">
لیست کلیدها
</div>
{/* 2 */}
<div className="w-full flex flex-row max-md:flex-wrap justify-between gap-3">
{data1?.map((item: any) => {
return (
<div
key={item.id}
className={`flex flex-col justify-center gap-2 w-full lg:w-1/2 h-28 px-5 bg-white rounded-md shadow-md items-start
`}
>
<p className=" text-slate-500 text-sm font-normal leading-normal">
عنوان کلید :
<span className=" text-slate-800">{item.title}</span>
</p>
<p className=" text-slate-500 text-sm font-normal leading-normal">
آی دی بازرس :
<span className=" text-slate-800 self-end">
{item.inspectorId}
</span>
</p>
</div>
);
})}
</div>
</div>
</div>
);
}

View File

@ -0,0 +1,134 @@
"use client";
import React from "react";
import Search from "./Search";
import { MdOutlineManageSearch } from "react-icons/md";
import { IoIosArrowDown } from "react-icons/io";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuGroup,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuPortal,
DropdownMenuSeparator,
DropdownMenuShortcut,
DropdownMenuSub,
DropdownMenuSubContent,
DropdownMenuSubTrigger,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { Button } from "./ui/button";
import { AdminCardItems } from "@/constants";
import TableAdmin from "./TableAdmin";
export default function AdminUserManagement() {
return (
<div className="w-full bg-[#F5F5F5] min-h-[82vh] flex justify-center">
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
<div className="w-full flex flex-col gap-5 ">
{/* 1 */}
<div className="w-full flex flex-col justify-start gap-3">
<div className="w-full text-right text-neutral-600 text-lg font-bold">
مدیریت کاربران
</div>
<div className="w-full flex flex-col lg:flex-row justify-center items-center gap-6 ">
<div className="w-full lg:w-3/5 h-11 bg-white rounded-[5px] block">
<Search mode="admin" />
</div>
<div className="w-full lg:w-2/5 flex flex-row justify-between items-center gap-2 ">
<MdOutlineManageSearch size="1.5em" />
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
variant="link"
className="gap-3 hover:no-underline focus-visible:ring-0"
>
<IoIosArrowDown /> جستجوی پیشرفته
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent className="w-56">
<DropdownMenuLabel>My Account</DropdownMenuLabel>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuItem>
Profile
<DropdownMenuShortcut>⇧P</DropdownMenuShortcut>
</DropdownMenuItem>
<DropdownMenuItem>
Billing
<DropdownMenuShortcut>⇧B</DropdownMenuShortcut>
</DropdownMenuItem>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
variant="link"
className="gap-3 hover:no-underline focus-visible:ring-0"
>
<IoIosArrowDown /> مرتب سازی
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent className="w-56">
<DropdownMenuLabel>My Account</DropdownMenuLabel>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuItem>
Profile
<DropdownMenuShortcut>⇧P</DropdownMenuShortcut>
</DropdownMenuItem>
<DropdownMenuItem>
Billing
<DropdownMenuShortcut>⇧B</DropdownMenuShortcut>
</DropdownMenuItem>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
<Button className=" bg-blue hover:bg-blue/90 rounded-lg">
+ افزودن کاربر
</Button>
</div>
</div>
</div>
{/* 2 */}
<div className="w-full flex flex-row max-md:flex-wrap justify-center gap-3">
{AdminCardItems.map((item) => {
return (
<div
key={item.id}
className=" flex flex-col justify-center items-end gap-2 w-2/5 lg:w-1/4 h-28 px-5 bg-white rounded-md shadow-md"
>
<p className=" text-slate-400 text-sm font-normal leading-none">
{item.name}
</p>
<p className=" text-slate-800 text-xl font-bold leading-normal">
{item.count}
</p>
</div>
);
})}
</div>
{/* 3 */}
<div className="w-full flex flex-col justify-start bg-white rounded-md">
<div className="w-full text-right text-neutral-600 text-lg font-bold py-5 pr-4">
لیست کاربران
</div>
<TableAdmin />
</div>
</div>
</div>
</div>
);
}

View File

@ -0,0 +1,16 @@
import React from "react";
export default function BoxDashboard() {
return (
<div
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-all duration-300 hover:transition-all hover:duration-300
hover:text-white hover:bg-blue hover:pb-10
max-lg:min-h-[10em] max-lg:max-w-[10em]"
>
<p className="text-center text-sm font-medium ">
تعداد درخواست ها 30 روز گذشته
</p>
</div>
);
}

68
components/CallUs.tsx Normal file
View File

@ -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>
);
}

199
components/CitizenLogin.tsx Normal file
View File

@ -0,0 +1,199 @@
"use client";
import React from "react";
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
import * as z from "zod";
import { Button } from "@/components/ui/button";
import {
Form,
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
FormMessage,
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
import { toast } from "@/components/ui/use-toast";
import Image from "next/image";
import LoginIcon from "../public/img/login-icon.svg";
import { useMutation, useQuery } from "@tanstack/react-query";
import { loginStaff, logisterCitizen } from "@/utils/authenticateApi";
import { getCaptcha } from "@/utils/commonApi";
import { useRouter } from "next/navigation";
import { Oval, ThreeDots } from "react-loader-spinner";
import useData from "@/store/useData";
const FormSchema = z.object({
phoneNumber: z.string().min(1, {
message: "لطفا شماره موبایل خود را وارد نمایید.",
}),
captcha: z
.string({ required_error: "لطفا کد امنیتی را وارد نمایید." })
.length(5, { message: "لطفا کد امنیتی را به طور کامل وارد نمایید." }),
});
export default function CitizenLogin() {
const router = useRouter();
const saveData = useData((state) => state.saveData);
const {
data: CaptchaData,
isLoading,
refetch,
} = useQuery({
queryKey: ["Captcha"],
queryFn: () => getCaptcha(),
refetchOnWindowFocus: false,
});
const loginMutation = useMutation({
mutationFn: logisterCitizen,
onSuccess: (res) => {},
onError: (err: any) => {
if (err.response.status == 428) {
console.log(useData);
router.push("/Verify");
localStorage.setItem("VerifyRole", "citizen");
}
},
});
const form = useForm<z.infer<typeof FormSchema>>({
resolver: zodResolver(FormSchema),
});
function onSubmit(data: z.infer<typeof FormSchema>) {
const payload = {
phoneNumber: data.phoneNumber,
captcha: {
key: CaptchaData?.headers["captcha-key"],
value: data.captcha,
},
};
loginMutation.mutate(payload);
saveData({
phoneNumber: data.phoneNumber,
});
}
const srcForImage = CaptchaData
? URL.createObjectURL(CaptchaData.data)
: null;
return (
<div
className="w-full mt-12 sm:w-2/3 md:w-2/4 xl:w-1/3 bg-white rounded-lg dark:border xl:p-0 dark:bg-gray-800 dark:border-gray-700 shadow-[0px_0px_15px_0px_#00000040]
h-full max-md:p-8 pt-12 mb-10"
>
<div className="space-y-3 md:space-y-4 flex flex-col md:py-10 md:px-12 lg:px-16 h-full justify-center">
<Image alt="icon" src={LoginIcon} className="self-center w-1/3 " />
<p className="text-lg font-bold leading-tight tracking-tight text-blue dark:text-white">
احراز هویت
</p>
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
className="w-full flex flex-col "
>
<FormField
control={form.control}
name="phoneNumber"
rules={{ required: true }}
render={({ field }) => (
<FormItem>
<FormLabel className="text-[#7C838A] text-sm font-medium">
شماره موبایل
</FormLabel>
<FormControl>
<Input
className="mb-4"
placeholder="شماره موبایل خود را وارد نمایید"
{...field}
/>
</FormControl>
{/* <FormDescription>
This is your public display name.
</FormDescription> */}
<FormMessage />
</FormItem>
)}
/>
<div className="flex gap-4 mt-4 items-center">
<FormField
control={form.control}
name="captcha"
rules={{ required: true }}
render={({ field }) => (
<FormItem className=" items-center h-10 flex-1">
{/* <FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
رمز عبور
</FormLabel> */}
<FormControl>
<Input placeholder="کد امنیتی" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
{isLoading ? (
<div className=" w-36 flex justify-center text-center">
<ThreeDots
visible={true}
height="50"
width="50"
color="#003778"
radius="9"
ariaLabel="three-dots-loading"
wrapperStyle={{}}
wrapperClass=""
/>
</div>
) : (
<div className=" flex justify-center text-center">
<Image
alt="icon"
src={srcForImage as string}
className=" h-12 rounded-md shadow-md w-36"
width={150}
height={20}
quality={100}
/>
</div>
)}
</div>
<div className="flex justify-end gap-2 w-full mt-14">
<Button
disabled={loginMutation.isPending}
type="submit"
className="bg-blue hover:bg-blue/90 transition text-white w-1/2 md:w-1/3 p-2 rounded-xl"
>
{loginMutation.isPending ? (
<div className="flex justify-center items-center gap-2">
<Oval
visible={true}
height="20"
width="20"
color="#fff"
ariaLabel="oval-loading"
wrapperStyle={{}}
wrapperClass=""
/>
{/* <p>در حال انجام ...</p> */}
</div>
) : (
"تایید"
)}
{/* ورود */}
</Button>
</div>
</form>
</Form>
</div>
</div>
);
}

View File

@ -0,0 +1,202 @@
"use client";
import React, { useEffect } from "react";
import greenIcon from "../public/img/greenPoint.svg";
import blueIcon from "../public/img/bluepoint.svg";
import Image from "next/image";
import { ComplainDetailsItems } from "@/constants";
import { useMutation } from "@tanstack/react-query";
import { OperateByInspector, getComplaint } from "@/utils/inspectorApi";
import useData from "@/store/useData";
import { convertDate } from "@/lib/utils";
import { Badge } from "./ui/badge";
import InspectorOperations from "./InspectorOperations";
import { postComplaintTracking } from "@/utils/citizenApi";
export default function ComplainsDetails({
id,
role,
Data,
}: {
id?: number;
role: string;
Data?: any;
}) {
const storeData = useData((state) => state.data);
let data;
const getComplaintMutation = useMutation<
any,
Error,
{ trackingNumber: string; password: string }
>({
mutationKey: ["Complaint", id],
mutationFn:
role == "Inspector"
? (getComplaint as any)
: (postComplaintTracking as any),
onSuccess: (res) => {},
onError: (err) => {},
});
console.log(storeData);
useEffect(() => {
if (role == "Inspector") {
useData.persist.rehydrate();
}
}, []);
useEffect(() => {
if (storeData && role == "Inspector") {
getComplaintMutation.mutate(storeData);
}
}, [storeData]);
if (getComplaintMutation.isSuccess) {
data = getComplaintMutation.data;
} else if (Data) {
data = Data;
}
console.log(Data);
return (
<>
{data ? (
<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-40">
<div className=" bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col">
<p className="text-[#464646] text-base font-bold">گزارش شکایت</p>
<div className="mt-2">
<p className="text-[#2e2a2a] text-sm font-medium">
موضوع شکایت:{" "}
<span className="text-[#7C838A] text-sm font-medium">
{data.title}
</span>
</p>
<p className="text-[#464646] text-sm font-medium">
دستگاه مربوطه:{" "}
<span className="text-[#7C838A] text-sm font-medium">
{/* {data.title} */}
</span>
</p>
<p className="text-[#464646] text-sm font-medium">
پرسنل مربوطه:{" "}
<span className="text-[#7C838A] text-sm font-medium">
{/* {data.title} */}
</span>
</p>
<p className="text-[#464646] text-sm font-medium">
زمان ثبت:{" "}
<span className="text-[#7C838A] text-sm font-medium">
{convertDate(data.registeredAt)}
</span>
</p>
{/* <p className="text-[#464646] text-sm font-medium">
{" "}
موضوع شکایت:{" "}
<span className="text-[#7C838A] text-sm font-medium">
متن تستی
</span>
</p> */}
</div>
{/* <p className="text-[#464646] text-sm font-medium text-justify">
درخواست شما با کد رهگیری {data.trackingNumber} و رمز عبور 12422 در
دست بررسی و اقدام می باشد. در صورت تمایل می توانید با شماره تلفن
0353286545 جهت پشتیبانی تماس حاصل کنید.{" "}
</p> */}
</div>
<div className=" max-lg:hidden order-2 bg-[#E9E9E9] rounded-md p-4 px-10 flex flex-col">
<p className="text-[#464646] text-base font-bold mb-1">
انجام عملیات
</p>
<InspectorOperations
updateData={() => getComplaintMutation.mutate(storeData)}
role={role}
complaintData={data}
/>
</div>
</div>
<div className="w-full lg:w-2/3 self-stretch bg-[#E9E9E9] p-4 px-10 rounded-lg">
<p className="text-[#464646] text-base font-bold">روند شکایت</p>
<div className=" flex flex-col gap-y-4 mt-4">
{data.contents?.map((item: any) => {
return (
<div
key={item.id}
className=" bg-white p-4 rounded-lg shadow-md"
>
<div className=" flex gap-4 items-center">
<p className="">
<Badge>{item.sender == 0 ? "شهروند" : "بازرس"}</Badge>
</p>
<p className="">
تاریخ :
<span className="text-[#7C838A]">
{convertDate(item.dateTime)}
</span>
</p>
</div>
<div className=" text-[#464646] mt-2">
متن:{" "}
<span className="text-[#7C838A]">
{item.text ? item.text : "-"}
</span>
</div>
</div>
);
})}
</div>
</div>
<div className=" lg:hidden order-2 w-full bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col">
<p className="text-[#464646] text-base font-bold mb-1">
انجام عملیات
</p>
<InspectorOperations
updateData={() => getComplaintMutation.mutate(storeData)}
role={role}
complaintData={data}
/>
</div>
{/* Left */}
{/* <div className="w-full md:w-1/3 bg-white shadow-lg rounded-md pt-3 px-4 flex flex-row md:flex-col max-md:flex-wrap">
<p className="text-[#464646] text-base font-bold mb-3">
وضعیت درخواست
</p>
{ComplainDetailsItems.map((item, index, array) => {
return (
<div
className="w-full justify-start items-start gap-4 inline-flex "
key={item.id}
>
<div className="grow shrink basis-0 pb-2 flex-col justify-start items-start gap-1 inline-flex">
<div className="self-stretch text-right text-lime-800 text-lg font-semibold leading-[30px]">
{item.title}
</div>
<div className="self-stretch text-right text-zinc-700 text-base font-normal uppercase">
{item.desc}
</div>
<div className="self-stretch text-right text-zinc-700 text-base font-normal">
{item.date} <br /> {item.time}
</div>
</div>
<div className="w-6 self-stretch flex-col justify-start items-center gap-1 inline-flex">
<div className="py-0.5 justify-start items-start gap-2.5 inline-flex">
<Image
src={greenIcon}
alt="greenIcon"
width={100}
height={100}
/>
</div>
<div className="w-1 grow shrink basis-0 bg-lime-800 rounded-[1px]"></div>
</div>
</div>
);
})}
</div> */}
</div>
) : (
""
)}
</>
);
}

View File

@ -0,0 +1,73 @@
"use client";
import React from "react";
import BoxDashboard from "./BoxDashboard";
import LineChart from "./LineChart";
import { HorizontalChart } from "./HorizontalChart";
import { getComplaintsList } from "@/utils/inspectorApi";
import { useQuery } from "@tanstack/react-query";
import useDecrypt from "@/hooks/useDecrypt";
export default function ControllerDashboard() {
const { data, isLoading, refetch } = useQuery({
queryKey: ["ComplaintsList"],
queryFn: () => getComplaintsList(),
refetchOnWindowFocus: false,
});
console.log(data);
const [decryptedMessage, errorMessage] = useDecrypt(
"gJoT9AqK7wk1MZFSD04yXXfF36fzsOL+RYtJfySrEnQeJ7VoaL7pmOU6nB3+0+PQcaxIi3hf1AHjzIB0Cn5oHgKROeoI4XslhAezZk23QhtIU4HUF1wpeOJfA+4hWyRfbh4fI9774sa/KL47VaBbrNM/rvBxk6hjlKx5mTb3hqM="
);
console.log(decryptedMessage);
if (data) {
}
console.log(errorMessage);
if (data) {
}
return (
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-8 max-sm:mt-16 pt-9">
{/* Lg Show */}
<div className="w-full h-[45vh] mb-6 flex-row gap-0 hidden lg:flex">
<div className="w-1/5 flex flex-col gap-8 pl-6">
<BoxDashboard />
<BoxDashboard />
</div>
<div className="w-4/5 bg-[#EFEFEF80] rounded-lg flex justify-center">
<LineChart />
</div>
</div>
<div className="w-full flex-row gap-6 h-[20vh] hidden lg:flex">
<div className="w-3/5 flex flex-row gap-7">
<BoxDashboard />
<BoxDashboard />
<BoxDashboard />
</div>
<div className="w-2/5 flex justify-end">
<HorizontalChart />
</div>
</div>
{/* max Lg show */}
<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 ">
<BoxDashboard />
<BoxDashboard />
<BoxDashboard />
<BoxDashboard />
<BoxDashboard />
</div>
<div className="w-full flex flex-col gap-12 ">
<div className="h-1/2">
<LineChart />
</div>
<hr />
<div className="h-1/2">
<HorizontalChart />
</div>
</div>
</div>
</div>
);
}

84
components/Counter.tsx Normal file
View File

@ -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>
)
}

214
components/FollowResult.tsx Normal file
View File

@ -0,0 +1,214 @@
"use client";
import React, { useEffect, useState, useRef } from "react";
import Image from "next/image";
import Resultimg from "../public/img/followResult.png";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { ThreeDots } from "react-loader-spinner";
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/components/ui/alert-dialog";
import { Button } from "@/components/ui/button";
import { IoMdClose } from "react-icons/io";
import { postComplaintTracking } from "@/utils/citizenApi";
import { useMutation } from "@tanstack/react-query";
import { useReactToPrint } from "react-to-print";
import "../app/print-styles.css";
import ComplainsDetails from "./ComplainsDetails";
export default function FollowResult() {
const router = useRouter();
const [trackingNumber, setTrackingNumber] = useState<any>();
const [password, setPassword] = useState<any>();
const [complaintData, setComplaintData] = useState<any>();
const [printStyle, setPrintStyle] = useState<boolean>(true);
// Print component Data
const componentRef = useRef<HTMLDivElement>(null);
const handlePrint = useReactToPrint({
content: () => componentRef.current,
// onBeforePrint() {
// setPrintStyle(!printStyle);
// },
// onAfterPrint() {
// setPrintStyle(!printStyle)
// },
});
useEffect(() => {
setTrackingNumber(localStorage.getItem("trackingNumber2"));
setPassword(localStorage.getItem("password2"));
}, []);
useEffect(() => {
if (trackingNumber && password) {
complaintPrintMutation.mutate({
Data: { trackingNumber: trackingNumber, password: password },
});
}
}, [trackingNumber, password]);
const complaintPrintMutation = useMutation({
mutationKey: ["complaintPrint"],
mutationFn: postComplaintTracking,
onSuccess: (res) => {
setComplaintData(res);
},
onError: (error) => {
console.log(error);
console.log(error?.message);
},
});
function onSubmit() {
console.log("SuccessPrinttttttttttt");
// complaintPrintMutation.mutate({
// Data: { trackingNumber: trackingNumber, password: password },
// });
}
// const possibleOperations = complaintPrintMutation.data?.possibleOperations;
// const selectOptions = Operations.filter((item, index) =>
// possibleOperations.includes(index)
// );
const printableContent = "This is the content to be printed.";
console.log(complaintPrintMutation?.data);
return (
<>
<div className="w-[90vw] sm:w-[90vw] lg:w-[85vw] xl:w-[75vw] 3xl:w-[70vw] max-sm:mt-16 pt-4 mx-auto mb-10">
{/* <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"
>
درخواست شما با کد رهگیری
<span className="text-slate-500 mx-2">{`${trackingNumber}`}</span>و
رمز عبور
<span className="text-slate-500 mx-2">{`${password}`}</span>
در دست بررسی و اقدام می باشد. در صورت تمایل می توانید با شماره تلفن
0353286545 جهت پشتیبانی تماس حاصل کنید.
</p> */}
{complaintPrintMutation?.data ? (
<>
<div className="flex justify-center sm:justify-end gap-2 mb-2">
<AlertDialog>
<AlertDialogTrigger asChild>
<Button
variant="outline"
type="submit"
onClick={() => onSubmit()}
className="w-fit bg-blue text-white p-2 rounded-xl text-center"
>
پرینت درخواست
</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>
<p className="text-[#464646] text-base font-bold">
گزارش شکایات
</p>
<AlertDialogCancel className="p-0 border-0 h-auto">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
<AlertDialogDescription className="h-full px-0 py-0 sm:px-0 sm:pt-0 ">
{complaintPrintMutation.isPending ? (
<div className="felx justify-center items-center self-center h-full">
<ThreeDots
visible={true}
height="80"
width="100"
color="#003778"
radius="9"
ariaLabel="three-dots-loading"
wrapperStyle={{}}
wrapperClass=""
/>
</div>
) : (
<div
dir="rtl"
className=" font-[yekan] px-10 py-4 sm:px-28 sm:pt-9 "
id="details"
ref={componentRef}
// style={{ border: printStyle ? 'none' : '5px solid black' , margin: printStyle ? 'auto': '1em' }}
>
<p className="text-[#464646] text-sm font-medium">
{" "}
موضوع شکایت:{" "}
<span className="text-[#7C838A] text-sm font-medium">
{`${complaintData?.title}`}
</span>
</p>
<p className="text-[#464646] text-sm font-medium">
{" "}
متن شکایت:{" "}
<span className="text-[#7C838A] text-sm font-medium">
{`${complaintData?.contents[0]?.text}`}
</span>
</p>
<br />
<p className="text-[#464646] text-sm font-medium">
{" "}
جزئیات شکایت:
</p>
<br />
<p className="text-[#464646] text-sm font-medium">
درخواست شما با کد رهگیری
<span className="text-slate-500 mx-2">{`${trackingNumber}`}</span>
و رمز عبور
<span className="text-slate-500 mx-2">{`${password}`}</span>
در دست بررسی و اقدام می باشد. در صورت تمایل می
توانید با شماره تلفن 0353286545 جهت پشتیبانی تماس
حاصل کنید.
</p>
</div>
)}
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<Button
className="bg-blue text-white w-1/2 sm:w-1/6"
onClick={handlePrint}
>
پرینت گزارش
</Button>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div>
<ComplainsDetails
role="Citizen"
Data={complaintPrintMutation?.data}
/>
</>
) : (
""
)}
{/* <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>
</>
);
}

172
components/FollowUp.tsx Normal file
View File

@ -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>
);
}

84
components/Footer.tsx Normal file
View File

@ -0,0 +1,84 @@
import React from "react";
import Image from "next/image";
import img1 from "../public/img/footerImg1.png";
import img2 from "../public/img/footerImg2.png";
import { footerItems } from "@/constants";
import { aboutFooterItems } from "@/constants";
import Link from "next/link";
export default function Footer() {
return (
// <div classNameName="flex justify-center items-center w-full bg-blue ">
<footer className="bg-blue dark:bg-gray-900">
<div
className="mx-auto w-full max-w-screen-3xl px-4 py-7 md:px-8 md:py-8 lg:pt-14 lg:pb-7 lg:px-11 "
>
<div className="md:flex md:justify-between w-full ">
<div className="grid gap-10 sm:gap-16 md:gap-20 lg:gap-28 grid-cols-1 w-full md:grid-cols-2 md:w-3/4 lg:w-2/4" >
<div>
<h2 className="text-white text-sm sm:text-base font-bold mb-4 ">
درباره سامانه سوت زنی
</h2>
{aboutFooterItems.map((item) => {
return (
<div key={item.id}>
<p className=" text-white text-xs md:text-sm font-normal md:leading-7">{item.name}</p>
</div>
);
})}
</div>
<div>
<h2 className="text-white text-sm sm:text-base font-bold mb-4">
دسترسی سریع
</h2>
<ul className="text-gray-500 dark:text-gray-400 font-medium text-right">
{footerItems.map((item, index, array) => {
return (
<Link key={item.id} href={item.href}>
<div className=" text-white text-xs md:text-sm font-normal leading-6 mb-3">{item.name}</div>
</Link>
);
})}
</ul>
</div>
</div>
<div className=" max-md:mt-6 flex flex-row justify-center md:justify-end items-start w-full md:w-1/4 ">
<div className="w-23 h-23 sm:w-36 sm:h-36 ">
<Image
src={img1}
className="h-full w-full object-contain"
alt=" Logo1"
quality={100}
width={100}
height={100}
/>
</div>
<div className="w-23 h-23 sm:w-36 sm:h-36 ">
<Image
src={img2}
className="h-full w-full object-contain"
alt=" Logo2"
quality={100}
width={100}
height={100}
/>
</div>
</div>
</div>
<hr className=" border-gray-200 sm:mx-auto dark:border-gray-700 mt-5 sm:mt-10" />
<div className="sm:flex sm:items-center sm:justify-between">
<p className="text-white text-xs font-normal mt-4">
تمامی حقوق مادی و معنوی این وب سایت متعلق به سوت زنی میباشد.
</p>
</div>
</div>
</footer>
// </div>
);
}

View File

@ -0,0 +1,68 @@
"use client"
import React from 'react';
import {
Chart as ChartJS,
CategoryScale,
LinearScale,
BarElement,
Title,
Tooltip,
Legend,
} from 'chart.js';
import { Bar } from 'react-chartjs-2';
import { faker } from "@faker-js/faker";
ChartJS.register(
CategoryScale,
LinearScale,
BarElement,
Title,
Tooltip,
Legend
);
export const options = {
indexAxis: 'y' as const,
elements: {
bar: {
borderWidth: 2,
},
},
responsive: true,
plugins: {
legend: {
position: 'right' as const,
},
title: {
display: true,
text: 'Chart.js Horizontal Bar Chart',
},
},
};
const labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July'];
export const data = {
labels,
datasets: [
{
label: 'Dataset 1',
data: labels.map(() => faker.datatype.number({ min: 0, max: 1000 })),
borderColor: 'rgb(255, 99, 132)',
backgroundColor: 'rgba(255, 99, 132, 0.5)',
},
{
label: 'Dataset 2',
data: labels.map(() => faker.datatype.number({ min: 0, max: 1000 })),
borderColor: 'rgb(53, 162, 235)',
backgroundColor: 'rgba(53, 162, 235, 0.5)',
},
],
};
export function HorizontalChart() {
return (
<Bar options={options} data={data} className='!w-full !h-full'/>
)
}

View File

@ -0,0 +1,252 @@
"use client";
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 { Textarea } from "@/components/ui/textarea";
import { Label } from "./ui/label";
import { Input } from "./ui/input";
import { RadioGroup, RadioGroupItem } from "./ui/radio-group";
import {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectLabel,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { Operations } from "@/constants";
import useData from "@/store/useData";
import { useMutation } from "@tanstack/react-query";
import { OperateByInspector } from "@/utils/inspectorApi";
import { toast } from "sonner";
import { postComplaintsDetails } from "@/utils/citizenApi";
export default function InspectorOperations({
complaintData,
role,
updateData,
}: {
complaintData: any;
role: string;
updateData: () => any;
}) {
const FormSchema = z.object({
text: z
.string({ required_error: "لطفا متن خود را وارد نمایید." })
.min(8, {
message: "Bio must be at least 8 characters.",
})
.max(260, {
message: "Bio must not be longer than 30 characters.",
}),
...(role == "Inspector" && {
type: z.enum(["private", "public"], {
required_error: "لطفا وضعیت عملیات را انتخاب نمایید.",
}),
}),
operation: z.string({
required_error: "Please select an email to display.",
}),
media: z
.custom<FileList>((val) => val instanceof FileList, "Required")
// .refine((files) => files.length > 0, `Required`)
.refine((files) => files.length <= 5, `Maximum of 5 File are allowed.`)
.nullish(),
});
const password = useData((state) => state.data.password);
const possibleOperations = complaintData?.possibleOperations;
const selectOptions = Operations.filter((item, index) =>
possibleOperations.includes(index)
);
const form = useForm<z.infer<typeof FormSchema>>({
resolver: zodResolver(FormSchema),
defaultValues: {
operation:
selectOptions.length == 1 ? String(selectOptions[0].value) : undefined,
},
});
const OperationMutation = useMutation({
mutationKey: ["Operation"],
mutationFn:
role == "Inspector" ? OperateByInspector : postComplaintsDetails,
onSuccess: (res) => {
toast("عملیات شما با موفقیت انجام شد. ", {
className: "!bg-green-500 !text-white",
});
},
onError: (err) => {},
});
function onSubmit(data: z.infer<typeof FormSchema>) {
console.log(data);
const formData = new FormData();
formData.append("text", data.text);
formData.append("trackingNumber", complaintData.trackingNumber);
formData.append("Operation", data.operation);
if (data.type) {
formData.append("IsPublic", data.type == "public" ? "true" : "false");
}
if (role == "Inspector") {
formData.append("EncodedKey", password);
} else {
formData.append("password", localStorage.getItem("password2") as string);
}
if (data?.media && data?.media?.length > 0) {
for (let i = 0; i < data.media.length; i++) {
formData.append("Medias", data.media[i]);
}
}
OperationMutation.mutate(formData);
}
return (
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="">
<FormField
control={form.control}
name="text"
render={({ field }) => (
<FormItem>
<FormLabel className="">متن</FormLabel>
<FormControl>
<Textarea
placeholder="متن خود را وارد نمایید"
className="resize-none bg-white"
{...field}
/>
</FormControl>
{/* <FormDescription>
You can <span>@mention</span> other users and organizations.
</FormDescription> */}
<FormMessage />
</FormItem>
)}
/>
{/* <div className="grid w-full max-w-sm items-center gap-1.5 mt-1">
<Label htmlFor="picture">پیوست</Label>
<Input multiple id="picture" type="file" className=" bg-white" />
</div> */}
<FormField
control={form.control}
name="media"
render={({ field }) => (
<FormItem>
<FormLabel>پیوست</FormLabel>
<FormControl>
<Input
accept=".jpg, .jpeg, .png, .svg, .gif, .mp4 , .pdf"
type="file"
onChange={(e) => {
field.onChange(e.target.files ? e.target.files : null);
console.log(e.target.files);
}}
multiple
className=" bg-white"
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
{role == "Inspector" && (
<FormField
control={form.control}
name="type"
render={({ field }) => (
<FormItem className="space-y-3">
<FormControl dir="rtl">
<RadioGroup
onValueChange={field.onChange}
defaultValue={field.value}
className="flex space-y-1 text-sm"
>
<FormItem className="flex items-center space-x-3 space-y-0">
<FormControl>
<RadioGroupItem value="private" className=" ml-2" />
</FormControl>
<FormLabel className="font-normal">خصوصی</FormLabel>
</FormItem>
<FormItem className="flex items-center space-x-3 space-y-0">
<FormControl>
<RadioGroupItem value="public" className=" ml-2" />
</FormControl>
<FormLabel className="font-normal">عمومی</FormLabel>
</FormItem>
</RadioGroup>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
)}
<div className=" flex justify-between mt-3 gap-2">
<FormField
control={form.control}
name="operation"
render={({ field }) => (
<FormItem className=" flex-1">
{/* <FormLabel>Email</FormLabel> */}
<Select
onValueChange={field.onChange}
defaultValue={field.value}
dir="rtl"
>
<FormControl>
<SelectTrigger
className=" bg-white h-10 !placeholder:text-xs text-xs"
dir="rtl"
>
<SelectValue
className=" text-xs"
placeholder="نوع عملیات را انتخاب نمایید."
/>
</SelectTrigger>
</FormControl>
<SelectContent dir="rtl">
<SelectGroup>
<SelectLabel>عملیات</SelectLabel>
{selectOptions.map((item) => {
return (
<SelectItem value={String(item.value)}>
{item.name}
</SelectItem>
);
})}
</SelectGroup>
</SelectContent>
</Select>
{/* <FormDescription>
You can manage email addresses in your{" "}
</FormDescription> */}
<FormMessage />
</FormItem>
)}
/>
<Button
disabled={possibleOperations.length == 0}
className=" bg-blue w-1/3"
type="submit"
>
ثبت
</Button>
</div>
</form>
</Form>
);
}

64
components/LineChart.tsx Normal file
View File

@ -0,0 +1,64 @@
"use client";
import React from "react";
import {
Chart as ChartJS,
CategoryScale,
LinearScale,
PointElement,
LineElement,
Title,
Tooltip,
Legend,
} from "chart.js";
import { Line } from "react-chartjs-2";
import { faker } from "@faker-js/faker";
ChartJS.register(
CategoryScale,
LinearScale,
PointElement,
LineElement,
Title,
Tooltip,
Legend
);
export const options = {
responsive: true,
plugins: {
legend: {
position: "top" as const,
},
title: {
display: true,
text: "Chart.js Line Chart",
},
},
};
const labels = ["January", "February", "March", "April", "May", "June", "July"];
export const data = {
labels,
datasets: [
{
label: "Dataset 1",
data: labels.map(() => faker.datatype.number({ min: -1000, max: 1000 })),
borderColor: "rgb(255, 99, 132)",
backgroundColor: "rgba(255, 99, 132, 0.5)",
},
{
label: "Dataset 2",
data: labels.map(() => faker.datatype.number({ min: -1000, max: 1000 })),
borderColor: "rgb(53, 162, 235)",
backgroundColor: "rgba(53, 162, 235, 0.5)",
},
],
};
export default function LineChart() {
return (
<Line options={options} data={data} className=' '/>
);
}

226
components/Login.tsx Normal file
View File

@ -0,0 +1,226 @@
"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 } 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({
username: z.string().min(1, {
message: "لطفا نام کاربری را وارد نمایید.",
}),
password: z
.string({ required_error: "لطفا رمز عبور را وارد نمایید." })
.min(1, {
message: "لطفا رمز عبور را وارد نمایید.",
}),
captcha: z
.string({ required_error: "لطفا کد امنیتی را وارد نمایید." })
.length(5, { message: "لطفا کد امنیتی را به طور کامل وارد نمایید." }),
});
export default function Login() {
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: loginStaff,
onSuccess: (res) => {},
onError: (err: any) => {
if (err.response.status == 428) {
console.log(useData);
router.push("/Verify");
}
},
});
const form = useForm<z.infer<typeof FormSchema>>({
resolver: zodResolver(FormSchema),
});
function onSubmit(data: z.infer<typeof FormSchema>) {
const payload = {
username: data.username,
password: data.password,
captcha: {
key: CaptchaData?.headers["captcha-key"],
value: data.captcha,
},
};
loginMutation.mutate(payload);
saveData({
username: data.username,
password: data.password,
});
}
const srcForImage = CaptchaData
? URL.createObjectURL(CaptchaData.data)
: null;
return (
<div
className="w-full mt-12 sm:w-2/3 md:w-2/4 xl:w-1/3 bg-white rounded-lg dark:border xl:p-0 dark:bg-gray-800 dark:border-gray-700 shadow-[0px_0px_15px_0px_#00000040]
h-full max-md:p-8 pt-12 mb-10"
>
<div className="space-y-3 md:space-y-4 flex flex-col md:py-10 md:px-12 lg:px-16 h-full justify-center">
<Image alt="icon" src={LoginIcon} className="self-center w-1/3 " />
<p className="text-lg font-bold leading-tight tracking-tight text-blue dark:text-white">
ورود به پنل کاربری
</p>
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
className="w-full flex flex-col "
>
<FormField
control={form.control}
name="username"
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>
)}
/>
<FormField
control={form.control}
name="password"
rules={{ required: true }}
render={({ field }) => (
<FormItem>
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
رمز عبور
</FormLabel>
<FormControl>
<Input
type="password"
placeholder="رمز عبور خود را وارد کنید"
{...field}
/>
</FormControl>
<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>
);
}

48
components/Map.tsx Normal file
View File

@ -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;

63
components/Navbar.tsx Normal file
View File

@ -0,0 +1,63 @@
"use client";
import React from "react";
import { Input } from "./ui/input";
import Image from "next/image";
import { menuItems } from "@/constants";
import Link from "next/link";
import Login from "./Login";
import { Button } from "./ui/button";
import { usePathname } from 'next/navigation'
import TopNav from "./TopNav";
export default function Navbar() {
const pathname = usePathname()
return (
<div className={`max-md:hidden left-0 right-0 top-0 z-10 ${pathname === "/" ? "absolute" : "sticky"}`}>
<TopNav />
<div className=" bg-white h-16 shadow-md flex items-center justify-between py-2 px-8">
<div className=" flex ">
<div className=" flex items-center ">
<Image
src="/img/logo.png"
quality={100}
alt="log"
width={32}
height={32}
/>
<div className=" text-brown flex flex-col text-center w-40">
<h1 className="text-[21px] w-full">ســــــــوت زن</h1>
<h1 className="text-[9px]">سامانه افشار فساد شهرداری</h1>
</div>
</div>
<div className=" flex gap-5 items-center mr-8">
{menuItems.map((item, index, array) => {
if (array.length - 1 !== index){
return (
<Link key={item.id} href={item.href}>
<div className=" text-sm font-bold">{item.name}</div>
</Link>
);
}else{
return (
<></>
);
}
})}
</div>
</div>
<Link href="/Login" >
<Button className=" bg-blue hover:bg-blue/90 rounded-lg">
ورود به پنل کاربری
</Button>
</Link>
</div>
</div>
);
}

View File

@ -0,0 +1,77 @@
"use client";
import React, { useEffect, useState } from "react";
import Link from "next/link";
import { AdminMenuItems, ControllerMenuItems } from "@/constants";
import { usePathname } from "next/navigation";
export default function NavbarPanel() {
const pathname = usePathname();
const [role, setRole] = useState<string | null>("");
useEffect(() => {
const userRole = localStorage.getItem("Sootzani_Role");
setRole(userRole);
}, []);
console.log(role);
const menus = {
Admin: AdminMenuItems,
Inspector: ControllerMenuItems,
};
const selectedMenu = menus[role as keyof typeof menus];
return (
<div
className="fixed flex flex-col-reverse justify-between items-start gap-3
sm:flex-row sm:items-center sm:gap-0
w-full px-8 py-1 z-10 bg-blue max-md:px-4
"
>
<div className=" flex items-center gap-8 max-md:gap-4">
<p className="text-white inline-block bg-clip-text text-sm font-bold max-md:text-xs max-md:font-medium">
پنل کاربری |
</p>
<div className="flex flex-row gap-7 max-md:gap-3">
{role && (
<>
{selectedMenu.map(
(item: { id: number; name: string; href: string }) => {
return (
<Link key={item.id} href={item.href}>
<p
className="text-white font-normal text-sm max-md:text-xs
hover:bg-white/50 rounded-sm p-1
animate-out duration-300 "
>
{item.name}
</p>
</Link>
);
}
)}
</>
)}
{/* {AdminMenuItems.map((item) => {
return (
<Link key={item.id} href={item.href}>
<p
className="text-white font-normal text-sm max-md:text-xs
hover:bg-white/50 rounded-sm p-1
animate-out duration-300 "
>
{item.name}
</p>
</Link>
);
})} */}
</div>
</div>
<h1 className="text-white inline-block bg-clip-text before:max-md:hidden text-sm font-bold max-md:text-xs max-md:font-medium">
{role === 'Admin' ? 'نام و نام خانوادگی (ادمین)' : 'نام و نام خانوادگی (بازرس)'}
</h1>
</div>
);
}

89
components/NavbarSm.tsx Normal file
View File

@ -0,0 +1,89 @@
"use client";
import React from "react";
import { useRef } from "react";
import { useState, useEffect } from "react";
// import { useClickAway } from "react-use/lib/useClickAway";
import { AnimatePresence, motion } from "framer-motion";
import { Squash as Hamburger } from "hamburger-react";
import { menuItems } from "@/constants";
import Link from "next/link";
import { Button } from "./ui/button";
import TopNav from "./TopNav";
import { usePathname } from "next/navigation";
// import { routes } from "../routes";
export default function NavbarSm() {
const pathname = usePathname();
// useClickAway(ref, () => setOpen(false));
const [isOpen, setOpen] = useState(false);
const ref = useRef(null);
return (
<>
<div
ref={ref}
className={`md:hidden w-full bg-white z-[100] flex flex-row justify-between items-center px-4
sticky top-0
shadow-md`}
>
<Hamburger toggled={isOpen} size={20} toggle={setOpen} />
{/* <Link href="/Login">
<Button className=" bg-blue hover:bg-blue/90 rounded-lg text-xs ">
ورود به پنل کاربری
</Button>
</Link> */}
<div className="md:hidden">
<TopNav />
</div>
<AnimatePresence>
{isOpen && (
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.2 }}
className="fixed z-[100] left-0 shadow-4xl right-0 top-[3rem] p-5 bg-gradient-to-b from-blue to-white border-b border-b-white/20"
>
<ul className="grid gap-2 ">
{menuItems.map((item, idx, array) => {
// const { Icon } = item;
const lastItem = array.length - 1;
return (
<motion.li
initial={{ scale: 0, opacity: 0 }}
animate={{ scale: 1, opacity: 1 }}
transition={{
type: "spring",
stiffness: 260,
damping: 20,
delay: 0.1 + idx / 10,
}}
key={item.name}
className=" w-full p-[0.08rem] rounded-xl bg-gradient-to-tr from-neutral-800 via-white to-neutral-700"
>
<Link
onClick={() => setOpen((prev) => !prev)}
className={`flex items-center justify-between w-full p-3 rounded-xl text-white
${lastItem === idx ? "bg-yellow" : "bg-blue"} `}
href={item.href}
>
<span className="flex gap-1 text-sm">{item.name}</span>
{/* <Icon className="text-xl" /> */}
</Link>
</motion.li>
);
})}
</ul>
</motion.div>
)}
</AnimatePresence>
</div>
</>
);
}

37
components/PieChart.tsx Normal file
View File

@ -0,0 +1,37 @@
"use client"
import React from 'react';
import { Chart as ChartJS, ArcElement, Tooltip, Legend } from 'chart.js';
import { Pie } from 'react-chartjs-2';
ChartJS.register(ArcElement, Tooltip, Legend);
export const data = {
labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
datasets: [
{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
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)',
],
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)',
],
borderWidth: 1,
},
],
};
export function PieChart() {
return <Pie data={data} />;
}

View File

@ -0,0 +1,106 @@
"use client"
import React 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";
export default function ReportsController() {
return (
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9">
<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>
);
}

View File

@ -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>
);
}

166
components/RequestStep1.tsx Normal file
View File

@ -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>
);
}

421
components/RequestStep2.tsx Normal file
View File

@ -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>
);
}

120
components/Search.tsx Normal file
View File

@ -0,0 +1,120 @@
"use client";
import React, { useState, useEffect } from "react";
import { Input } from "./ui/input";
import { Label } from "./ui/label";
import { Button } from "./ui/button";
import { CiSearch } from "react-icons/ci";
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/components/ui/alert-dialog";
import { IoMdClose } from "react-icons/io";
import { useMediaQuery } from "react-responsive";
export default function Search({ mode }: { mode: string }) {
// useEffect(() => {
// const isMobile = useMediaQuery({ query: "(max-width: 768px)" });
// }, []);
return (
<div>
{mode === "controller" || mode === "admin" ? (
<div className="relative flex bg-gray-300 rounded-xl items-center">
<Input
// type="search"
id="default-search"
className={`mb-0 h-8 bg-[#D6D8DE66] border-none focus-visible:none rounded-lg
block w-full min-w-[13rem] lg:min-w-[16rem] text-xs text-black
text-opacity-60 dark:text-white
${mode === "controller" && "h-14 max-lg:min-w-[95vw]"}
${
mode === "admin" &&
"w-full min-w-full bg-white lg:min-w-full h-11"
}
`}
placeholder="جستجو..."
required
/>
{/* <Button
className="absolute left-0 bg-transparent h-auto w-auto text-slate-800"
>
<CiSearch />
</Button> */}
<button className="absolute left-3">
<CiSearch />
</button>
</div>
) : (
<>
<div className=" max-md:hidden relative flex bg-gray-300 rounded-xl items-center">
<Input
// type="search"
id="default-search"
className={`mb-0 h-8 bg-[#D6D8DE66] border-none focus-visible:none rounded-lg
block w-full min-w-[13rem] lg:min-w-[16rem] text-xs text-black
text-opacity-60 dark:text-white
${mode === "controller" && "h-12 max-lg:min-w-[95vw]"}
${
mode === "admin" &&
"w-full min-w-full bg-white lg:min-w-full h-11"
}
`}
placeholder="جستجو..."
required
/>
<button className="absolute left-3">
<CiSearch />
</button>
</div>
<div className="md:hidden">
<AlertDialog>
<AlertDialogTrigger asChild>
<button
// variant="outline"
// type="submit"
className=" bg-gradient2 text-white font-bold rounded-md p-1"
>
<CiSearch />
</button>
</AlertDialogTrigger>
<AlertDialogContent className=" h-1/5 min-w-[80%] max-w-fit">
<AlertDialogHeader className="w-full">
<AlertDialogTitle className=" py-1">
<p className="text-[#464646] text-base font-bold">
فرم جستجو
</p>
<AlertDialogCancel className="p-0 border-0 h-auto">
<IoMdClose />
</AlertDialogCancel>
</AlertDialogTitle>
<AlertDialogDescription className="justify-center sm:px-14 sm:py-6">
<Input
// type="search"
id="default-search"
className="mb-0 h-12 bg-gray border-none focus-visible:none rounded-lg
block w-full min-w-[13rem] lg:min-w-[16rem] text-xs text-black text-opacity-60 dark:text-white "
placeholder="جستجو..."
required
/>
<button className="absolute left-16 text-black">
<CiSearch />
</button>
</AlertDialogDescription>
</AlertDialogHeader>
</AlertDialogContent>
</AlertDialog>
</div>
</>
)}
</div>
);
}

View File

@ -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>
)
}

View File

@ -0,0 +1,197 @@
"use client";
import React, { useState } from "react";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import TableController from "./TableController";
import Search from "./Search";
import { useQuery } from "@tanstack/react-query";
import { getComplaintsList } from "@/utils/inspectorApi";
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
import { Input } from "./ui/input";
import { useRouter } from "next/navigation";
import { Decrypt } from "@/lib/utils";
import useData from "@/store/useData";
import { toast } from "sonner";
export default function TabController() {
const saveData = useData((state) => state.saveData);
const [selectedFile, setSelectedFile] = useState<any>(null);
const router = useRouter();
const handleFileChange = (event: any) => {
const file = event.target.files[0];
const reader = new FileReader();
reader.onload = (e) => {
const contents = e?.target?.result;
// Process the contents of the file here
setSelectedFile(contents);
console.log(contents);
};
reader.readAsText(file);
};
const checkKey = (item: any) => {
const dcKey = Decrypt(item.cipherKeyInspector, selectedFile);
if (dcKey != false && dcKey != null) {
saveData({
trackingNumber: item.trackingNumber,
password: Decrypt(item.cipherKeyInspector, selectedFile),
});
router.push(`/UserPanel/ControllerDashboard/Complaints/${item.id}`);
} else {
toast("کلید شما معتبر نمی باشد.", {
className: "!bg-red-500 !text-white",
});
}
};
const { data, isLoading, refetch } = useQuery({
queryKey: ["ComplaintsList"],
queryFn: () => getComplaintsList(),
refetchOnWindowFocus: false,
});
console.log(data);
const newComplaints = data?.filter((item: any) => item.status == 0);
const inProgressComplaints = data?.filter((item: any) => item.status == 1);
const waitingForCitizenResponseComplaints = data?.filter(
(item: any) => item.status == 2
);
const citizenRepliedComplaints = data?.filter(
(item: any) => item.status == 3
);
const finishedComplaints = data?.filter((item: any) => item.status == 4);
console.log(newComplaints);
return (
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-8 pt-9">
<Dialog>
<DialogTrigger className=" appearance-none" asChild>
<Button
// onClick={handelVerify}
type="submit"
className="bg-brown hover:bg-brown/90 text-white w-36 p-2 rounded-xl mt-6 md:mt-12 mb-2"
>
+ بارگذاری کلید جدید
</Button>
</DialogTrigger>
<Tabs defaultValue="tab1" className="" dir="rtl">
<div className="w-full flex flex-col-reverse lg:flex-row gap-4 lg:gap-5 justify-between items-center mb-10">
{/* Tab Title */}
<TabsList className="w-full flex gap-1 md:gap-4 lg:gap-7">
<p className="3xl:ml-6 text-xs sm:text-sm font-bold">
لیست شکایت ها |
</p>
<TabsTrigger
value="tab1"
className="hover:border-b-2 border-b-blue"
>
جدید (2)
</TabsTrigger>
<TabsTrigger
value="tab2"
className="hover:border-b-2 border-b-blue"
>
در انتظار پاسخ
</TabsTrigger>
<TabsTrigger
value="tab3"
className="hover:border-b-2 border-b-blue"
>
در حال بررسی
</TabsTrigger>
<TabsTrigger
value="tab4"
className="hover:border-b-2 border-b-blue"
>
پاسخ داده شده
</TabsTrigger>
<TabsTrigger
value="tab5"
className="hover:border-b-2 border-b-blue"
>
پایان یافته
</TabsTrigger>
</TabsList>
{/* Search Box */}
<Search mode="controller" />
</div>
{/* Tab Content */}
<TabsContent value="tab1">
<TableController
checkKey={(item: any) => checkKey(item)}
data={newComplaints}
/>
</TabsContent>
<TabsContent value="tab2">
<TableController
checkKey={(item: any) => checkKey(item)}
data={waitingForCitizenResponseComplaints}
/>
</TabsContent>
<TabsContent value="tab3">
<TableController
checkKey={(item: any) => checkKey(item)}
data={inProgressComplaints}
/>
</TabsContent>
<TabsContent value="tab4">
<TableController
checkKey={(item: any) => checkKey(item)}
data={citizenRepliedComplaints}
/>
</TabsContent>
<TabsContent value="tab5">
<TableController
checkKey={(item: any) => checkKey(item)}
data={finishedComplaints}
/>
</TabsContent>
</Tabs>
<DialogContent dir="rtl" className="sm:max-w-[425px]">
<DialogHeader dir="rtl">
<DialogTitle dir="rtl">بارگذاری کلید خصوصی</DialogTitle>
<DialogDescription>
لطفا کلید خصوصی خود را آپلود نمایید.
</DialogDescription>
</DialogHeader>
<div className="grid w-full max-w-sm items-center gap-1.5">
{/* <Label htmlFor="picture">Picture</Label> */}
<Input
dir="rtl"
id="picture"
onChange={handleFileChange}
type="file"
accept=".txt"
/>
</div>
<DialogFooter>
<DialogClose asChild>
<Button
onClick={() => {
toast("کلید شما با موفقیت ذخیره شد.", {
className: "!bg-green-500 !text-white",
});
}}
type="submit"
>
ذخیره
</Button>
</DialogClose>
</DialogFooter>
</DialogContent>
</Dialog>
</div>
);
}

63
components/TableAdmin.tsx Normal file
View File

@ -0,0 +1,63 @@
import React from "react";
import {
Table,
TableBody,
TableCaption,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";
import { AdminTableItems } from "@/constants";
import Link from "next/link";
import { BiEditAlt } from "react-icons/bi";
import { HiOutlineTrash } from "react-icons/hi";
export default function TableAdmin() {
return (
<Table className="border-[1px] border-solid border-muted rounded-md ">
{/* <TableCaption>A list of your recent invoices.</TableCaption> */}
<TableHeader>
<TableRow className="bg-[#EFF4FA] ">
<TableHead className="text-[#8F9BB3] text-right pr-4">نام و نام خانوادگی</TableHead>
<TableHead className="text-[#8F9BB3] text-right">نقش کاربر</TableHead>
<TableHead className="text-[#8F9BB3] text-right">تاریخ عضویت</TableHead>
<TableHead className="text-[#8F9BB3] text-right">توضیحات</TableHead>
<TableHead className="text-[#8F9BB3] text-right">ویرایش</TableHead>
</TableRow>
</TableHeader>
<TableBody className="bg-white ">
{AdminTableItems.map((item) => {
return (
<TableRow key={item.id}>
<Link
href={`#`}
className="contents h-14"
>
<TableCell className="w-3/12 font-medium text-black text-right pr-4">
{item.name}
<p className="text-slate-500 text-xs">{item.phone}</p>
</TableCell>
<TableCell className="w-2/12 text-black text-right">
<p className="bg-blue rounded-lg text-white w-1/2 text-center">
{item.useRole}
</p>
</TableCell>
<TableCell className="w-2/12 text-black text-right">
{item.date}
</TableCell>
<TableCell className="w-4/12 text-black text-right">
{item.desc}
</TableCell>
<TableCell className="w-1/12 min-w-full flex gap-2 pt-4 text-muted-foreground text-right">
<HiOutlineTrash size="20px"/>
<BiEditAlt size="20px"/>
</TableCell>
</Link>
</TableRow>
);
})}
</TableBody>
</Table>
);
}

View File

@ -0,0 +1,174 @@
import React, { useState } from "react";
import {
Table,
TableBody,
TableCaption,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
import { ControllerTableItems } from "@/constants";
import Link from "next/link";
import { Decrypt, convertDate } from "@/lib/utils";
import useData from "@/store/useData";
import { Label } from "./ui/label";
import { Input } from "./ui/input";
import { useRouter } from "next/navigation";
import { toast } from "sonner";
interface Complaint {
id: string;
trackingNumber: string;
title: string;
category: {
id: string;
title: string;
description: string;
};
status: number;
registeredAt: string;
lastChanged: string;
lastActor: number;
cipherKeyInspector: string;
}
export default function TableController({
data,
checkKey,
}: {
data: Complaint[];
checkKey: (item:any) => any;
}) {
console.log(data);
const saveData = useData((state) => state.saveData);
const [selectedFile, setSelectedFile] = useState<any>(null);
const router = useRouter();
const handleFileChange = (event: any) => {
const file = event.target.files[0];
const reader = new FileReader();
reader.onload = (e) => {
const contents = e?.target?.result;
// Process the contents of the file here
setSelectedFile(contents);
console.log(contents);
};
reader.readAsText(file);
};
// const checkKey = (item: any) => {
// const dcKey = Decrypt(item.cipherKeyInspector, selectedFile);
// if (dcKey != false && dcKey != null) {
// saveData({
// trackingNumber: item.trackingNumber,
// password: Decrypt(item.cipherKeyInspector, selectedFile),
// });
// router.push(`/UserPanel/ControllerDashboard/Complaints/${item.id}`);
// } else {
// }
// };
return (
<div>
<Dialog>
{/* <DialogTrigger className=" appearance-none" asChild>
<Button
// onClick={handelVerify}
type="submit"
className="bg-blue hover:bg-blue/90 text-white w-36 p-2 rounded-xl"
>
بارگذاری کلید جدید
</Button>
</DialogTrigger> */}
<Table className="border-[1px] border-solid border-muted rounded-md ">
{/* <TableCaption>A list of your recent invoices.</TableCaption> */}
<TableHeader>
<TableRow>
<TableHead>ردیف</TableHead>
<TableHead>تاریخ</TableHead>
<TableHead>موضوع</TableHead>
<TableHead>دستگاه مربوطه</TableHead>
</TableRow>
</TableHeader>
<TableBody className="bg-[#F5F5F5]">
{data?.map((item: Complaint, index: number) => {
return (
<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}`}
className="contents"
> */}
<TableCell className="w-1/12 font-medium ">
{index + 1}
</TableCell>
<TableCell className="w-2/12">
{convertDate(item.registeredAt)}
</TableCell>
<TableCell className="w-2/12">
{item?.category ? item.category.title : "-"}
</TableCell>
<TableCell className="w-7/12">-</TableCell>
{/* </Link> */}
</TableRow>
);
})}
</TableBody>
</Table>
{/* <DialogTrigger asChild>
<Button variant="outline">Edit Profile</Button>
</DialogTrigger> */}
<DialogContent dir="rtl" className="sm:max-w-[425px]">
<DialogHeader dir="rtl">
<DialogTitle dir="rtl">بارگذاری کلید خصوصی</DialogTitle>
<DialogDescription>
لطفا کلید خصوصی خود را آپلود نمایید.
</DialogDescription>
</DialogHeader>
<div className="grid w-full max-w-sm items-center gap-1.5">
{/* <Label htmlFor="picture">Picture</Label> */}
<Input
dir="rtl"
id="picture"
onChange={handleFileChange}
type="file"
accept=".txt"
/>
</div>
<DialogFooter>
<DialogClose asChild>
<Button
onClick={() => {
if (selectedFile) {
toast("کلید شما با موفقیت بارگذاری شد.");
}
}}
type="submit"
>
ذخیره
</Button>
</DialogClose>
</DialogFooter>
</DialogContent>
</Dialog>
</div>
);
}

61
components/TopNav.tsx Normal file
View File

@ -0,0 +1,61 @@
"use client";
import React from "react";
import { Input } from "./ui/input";
import Link from "next/link";
import Search from "./Search";
import { usePathname } from "next/navigation";
export default function TopNav() {
const pathname = usePathname();
return (
<div
className={`flex justify-between items-center w-full px-8 py-1 z-10 border-b-[#C9CFD7] border-b-[1px] border-solid max-md:bg-gray max-md:bg-transparent max-md:px-0 max-md:justify-end max-md:border-b-0 ${
pathname === "/" ? "bg-transparent" : "bg-white"
} `}
>
<p className="bg-gradient-to-r from-gradient1 to-gradient2 inline-block text-transparent bg-clip-text text-xs max-md:hidden font-bold">
سال 1402 | مهارم تورم، رشد تولید
</p>
{/* <p>Current pathname: {pathname}</p> */}
<div className="flex items-center gap-10">
<div className=" flex items-center gap-3 md:ml-4">
<p className="bg-gradient-to-r from-gradient1 to-gradient2 inline-block text-transparent bg-clip-text text-xs max-md:text-xs font-bold">
امروز: چهارشنبه 24 آبان 1402
</p>
<svg
className="max-md:hidden"
xmlns="http://www.w3.org/2000/svg"
width="18"
height="19"
viewBox="0 0 18 19"
fill="none"
>
<g clip-path="url(#clip0_113_99)">
<path
d="M11.2875 4.25C12.02 4.39292 12.6932 4.75119 13.221 5.27895C13.7488 5.80671 14.107 6.47995 14.2499 7.2125L11.2875 4.25ZM11.2875 1.25C12.8094 1.41908 14.2286 2.10063 15.3121 3.18276C16.3956 4.26488 17.079 5.68326 17.2499 7.205L11.2875 1.25ZM16.4999 13.19V15.44C16.5008 15.6489 16.458 15.8556 16.3743 16.047C16.2907 16.2384 16.1679 16.4102 16.014 16.5514C15.8601 16.6926 15.6784 16.8001 15.4805 16.867C15.2826 16.9339 15.073 16.9588 14.8649 16.94C12.5571 16.6892 10.3402 15.9006 8.39245 14.6375C6.58032 13.486 5.04395 11.9496 3.89245 10.1375C2.62493 8.1809 1.83613 5.95325 1.58995 3.635C1.57121 3.4276 1.59586 3.21857 1.66233 3.02122C1.72879 2.82387 1.83563 2.64252 1.97602 2.48872C2.11642 2.33491 2.2873 2.21203 2.47779 2.12789C2.66828 2.04375 2.87421 2.0002 3.08245 2H5.33245C5.69643 1.99642 6.04929 2.12531 6.32527 2.36265C6.60125 2.59999 6.78151 2.92959 6.83245 3.29C6.92742 4.01005 7.10354 4.71705 7.35745 5.3975C7.45836 5.66594 7.4802 5.95769 7.42038 6.23816C7.36056 6.51863 7.2216 6.77608 7.01995 6.98L6.06745 7.9325C7.13512 9.81016 8.68979 11.3648 10.5675 12.4325L11.5199 11.48C11.7239 11.2784 11.9813 11.1394 12.2618 11.0796C12.5423 11.0198 12.834 11.0416 13.1024 11.1425C13.7829 11.3964 14.4899 11.5725 15.21 11.6675C15.5743 11.7189 15.907 11.9024 16.1448 12.1831C16.3827 12.4638 16.5091 12.8222 16.4999 13.19Z"
stroke="black"
stroke-linecap="round"
stroke-linejoin="round"
/>
</g>
<defs>
<clipPath id="clip0_113_99">
<rect
width="18"
height="18"
fill="white"
transform="translate(0 0.5)"
/>
</clipPath>
</defs>
</svg>
</div>
<Search mode="landing" />
</div>
</div>
);
}

186
components/Verify.tsx Normal file
View File

@ -0,0 +1,186 @@
"use client";
import Image from "next/image";
import React, { useEffect, useState } from "react";
import LoginIcon from "../public/img/login-icon.svg";
import OtpInput from "react-otp-input";
import { Button } from "./ui/button";
import { verifyCitizen, verifyStaff } from "@/utils/authenticateApi";
import { useMutation } from "@tanstack/react-query";
import { useRouter } from "next/navigation";
import useData from "@/store/useData";
import { JwtPayload, jwtDecode } from "jwt-decode";
import { setCookie } from "cookies-next";
import { Oval } from "react-loader-spinner";
export default function Verify() {
const [otp, setOtp] = useState("");
const space = "\xa0";
const router = useRouter();
const userData = useData((state) => state.data);
const [VerifyRole, setVerifyRole] = useState<any>("");
const verifyMutation = useMutation({
mutationFn: verifyStaff,
onSuccess: (res) => {
const decodedToken = jwtDecode<any>(res);
setCookie("Sootzani_Token", res);
const userRole =
decodedToken[
"http://schemas.microsoft.com/ws/2008/06/identity/claims/role"
];
localStorage.setItem("Sootzani_Role", userRole);
if (userRole == "Inspector") {
router.push("/UserPanel/ControllerDashboard");
} else if (userRole == "Admin") {
router.push("/UserPanel/AdminDashboard");
} else {
router.push("/UserPanel/CitizenDashboard");
}
},
onError: (err: any) => {},
});
const CitizenVerifyMutation = useMutation({
mutationFn: verifyCitizen,
onSuccess: (res) => {
const decodedToken = jwtDecode<any>(res);
setCookie("Sootzani_Token", res);
const userRole =
decodedToken[
"http://schemas.microsoft.com/ws/2008/06/identity/claims/role"
];
localStorage.setItem("Sootzani_Role", userRole);
router.push("/UserPanel/CitizenDashboard");
},
onError: (err: any) => {},
});
const handelVerify = () => {
console.log(otp);
const payload = { ...userData, verificationCode: otp };
console.log(userData);
if (userData?.phoneNumber) {
CitizenVerifyMutation.mutate(payload);
} else {
verifyMutation.mutate(payload);
}
};
useEffect(() => {
useData.persist.rehydrate();
}, []);
return (
<div
className="w-full my-12 sm:w-2/3 md:w-2/4 xl:w-1/3 bg-white rounded-lg dark:border xl:p-0 dark:bg-gray-800 dark:border-gray-700 shadow-[0px_0px_15px_0px_#00000040]
h-full max-md:p-8 pt-12"
>
<div className="space-y-3 md:space-y-4 flex flex-col md:py-12 md:px-20 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>
<div className="w-full " dir="ltr">
<OtpInput
value={otp}
onChange={setOtp}
numInputs={6}
renderSeparator={<span>{space}</span>}
renderInput={(props, idx) => (
<input
autoFocus={idx == 0}
inputMode="decimal"
pattern="[0-9]*"
{...props}
/>
)}
containerStyle=" flex justify-center"
inputStyle=" !w-10 rounded-md h-10 bg-[#F5F5F5] border border-blue/30 text-black"
/>
</div>
<label className="label text-center">
<span className="text-xs text-blue/70 label-text text-center">
کد دریافت شده توسط پیامک را وارد نمایید.
</span>
</label>
<div className="flex justify-end gap-2 w-full mt-14">
<Button
disabled={verifyMutation.isPending}
onClick={handelVerify}
type="submit"
className="bg-blue hover:bg-blue/90 text-white w-1/2 md:w-1/3 p-2 rounded-xl"
>
{verifyMutation.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}>
<form
onSubmit={form.handleSubmit(onSubmit)}
className="w-full flex flex-col "
>
<FormField
control={form.control}
name="username"
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>
)}
/>
<FormField
control={form.control}
name="password"
render={({ field }) => (
<FormItem>
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
رمز عبور
</FormLabel>
<FormControl>
<Input placeholder="رمز عبور خود را وارد کنید" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<div className="flex justify-end gap-2 w-full mt-14">
<Button
type="submit"
className="bg-blue text-white w-1/2 md:w-1/3 p-2 rounded-xl"
>
ورود
</Button>
</div>
</form>
</Form> */}
</div>
</div>
);
}

View File

@ -0,0 +1,60 @@
"use client"
import React from 'react';
import {
Chart as ChartJS,
CategoryScale,
LinearScale,
BarElement,
Title,
Tooltip,
Legend,
} from 'chart.js';
import { Bar } from 'react-chartjs-2';
import { faker } from "@faker-js/faker";
ChartJS.register(
CategoryScale,
LinearScale,
BarElement,
Title,
Tooltip,
Legend
);
export const options = {
responsive: true,
plugins: {
legend: {
position: 'top' as const,
},
title: {
display: true,
text: 'Chart.js Bar Chart',
},
},
};
const labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July'];
export const data = {
labels,
datasets: [
{
label: 'Dataset 1',
data: labels.map(() => faker.datatype.number({ min: 0, max: 1000 })),
backgroundColor: 'rgba(255, 99, 132, 0.5)',
},
{
label: 'Dataset 2',
data: labels.map(() => faker.datatype.number({ min: 0, max: 1000 })),
backgroundColor: 'rgba(53, 162, 235, 0.5)',
},
],
};
export function VerticalChart() {
return (
<Bar options={options} data={data} className='!w-full !h-full'/>
)
}

View File

@ -0,0 +1,147 @@
"use client"
import * as React from "react"
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
import { cn } from "@/lib/utils"
import { buttonVariants } from "@/components/ui/button"
const AlertDialog = AlertDialogPrimitive.Root
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
const AlertDialogPortal = AlertDialogPrimitive.Portal
const AlertDialogOverlay = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Overlay
className={cn(
"fixed inset-0 z-50 bg-[#95959580] backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className
)}
{...props}
ref={ref}
/>
))
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
const AlertDialogContent = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
>(({ className, ...props }, ref) => (
<AlertDialogPortal>
<AlertDialogOverlay />
<AlertDialogPrimitive.Content
ref={ref}
className={cn(
`fixed left-[50%] top-[50%] z-50 grid w-full max-w-4xl translate-x-[-50%] translate-y-[-50%] gap-4 border duration-200
data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95
data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2
data-[state=open]:slide-in-from-top-[48%] rounded-lg
h-full max-h-[32em] content-between p-0 bg-opacity-30 bg-[#FFFFF999] filter
shadow-[0px_0px_30px_0px_rgba(0,0,0,0.3)]
`,
className
)}
{...props}
/>
</AlertDialogPortal>
))
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
const AlertDialogHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col space-y-2 text-center sm:text-left",
className
)}
{...props}
/>
)
AlertDialogHeader.displayName = "AlertDialogHeader"
const AlertDialogFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-row justify-center sm:justify-end px-14 pb-6 sm:pb-12 ",
className
)}
{...props}
/>
)
AlertDialogFooter.displayName = "AlertDialogFooter"
const AlertDialogTitle = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Title
ref={ref}
className={cn("text-lg font-semibold bg-white flex justify-between items-center px-6 py-3 rounded-t-lg border-b-[0.5px] border-[#8F8F8F] border-solid", className)}
{...props}
/>
))
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
const AlertDialogDescription = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Description
ref={ref}
className={cn("text-sm text-muted-foreground flex flex-col items-start text-justify px-10 py-4 sm:px-28 sm:pt-9 ", className)}
{...props}
/>
))
AlertDialogDescription.displayName =
AlertDialogPrimitive.Description.displayName
const AlertDialogAction = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Action>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Action
ref={ref}
className={cn(buttonVariants(), className)}
{...props}
/>
))
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
const AlertDialogCancel = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Cancel
ref={ref}
className={cn(
buttonVariants({ variant: "outline" }),
"mt-2 sm:mt-0",
className
)}
{...props}
/>
))
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
export {
AlertDialog,
AlertDialogPortal,
AlertDialogOverlay,
AlertDialogTrigger,
AlertDialogContent,
AlertDialogHeader,
AlertDialogFooter,
AlertDialogTitle,
AlertDialogDescription,
AlertDialogAction,
AlertDialogCancel,
}

36
components/ui/badge.tsx Normal file
View File

@ -0,0 +1,36 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const badgeVariants = cva(
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
{
variants: {
variant: {
default:
"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
secondary:
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
destructive:
"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
outline: "text-foreground",
},
},
defaultVariants: {
variant: "default",
},
}
)
export interface BadgeProps
extends React.HTMLAttributes<HTMLDivElement>,
VariantProps<typeof badgeVariants> {}
function Badge({ className, variant, ...props }: BadgeProps) {
return (
<div className={cn(badgeVariants({ variant }), className)} {...props} />
)
}
export { Badge, badgeVariants }

56
components/ui/button.tsx Normal file
View File

@ -0,0 +1,56 @@
import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const buttonVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive:
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline:
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
secondary:
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-10 px-4 py-2",
sm: "h-9 rounded-md px-3",
lg: "h-11 rounded-md px-8",
icon: "h-10 w-10",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
}
)
export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean
}
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button"
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
)
}
)
Button.displayName = "Button"
export { Button, buttonVariants }

122
components/ui/dialog.tsx Normal file
View File

@ -0,0 +1,122 @@
"use client"
import * as React from "react"
import * as DialogPrimitive from "@radix-ui/react-dialog"
import { X } from "lucide-react"
import { cn } from "@/lib/utils"
const Dialog = DialogPrimitive.Root
const DialogTrigger = DialogPrimitive.Trigger
const DialogPortal = DialogPrimitive.Portal
const DialogClose = DialogPrimitive.Close
const DialogOverlay = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Overlay
ref={ref}
className={cn(
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className
)}
{...props}
/>
))
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
>(({ className, children, ...props }, ref) => (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
ref={ref}
className={cn(
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
className
)}
{...props}
>
{children}
<DialogPrimitive.Close className="absolute left-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<X className="h-4 w-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
</DialogPrimitive.Content>
</DialogPortal>
))
DialogContent.displayName = DialogPrimitive.Content.displayName
const DialogHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col space-y-1.5 text-center sm:text-right",
className
)}
{...props}
/>
)
DialogHeader.displayName = "DialogHeader"
const DialogFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
className
)}
{...props}
/>
)
DialogFooter.displayName = "DialogFooter"
const DialogTitle = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Title
ref={ref}
className={cn(
"text-lg font-semibold leading-none tracking-tight",
className
)}
{...props}
/>
))
DialogTitle.displayName = DialogPrimitive.Title.displayName
const DialogDescription = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Description
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
DialogDescription.displayName = DialogPrimitive.Description.displayName
export {
Dialog,
DialogPortal,
DialogOverlay,
DialogClose,
DialogTrigger,
DialogContent,
DialogHeader,
DialogFooter,
DialogTitle,
DialogDescription,
}

View File

@ -0,0 +1,205 @@
"use client"
import * as React from "react"
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
import {
CheckIcon,
ChevronRightIcon,
DotFilledIcon,
} from "@radix-ui/react-icons"
import { cn } from "@/lib/utils"
const DropdownMenu = DropdownMenuPrimitive.Root
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
const DropdownMenuGroup = DropdownMenuPrimitive.Group
const DropdownMenuPortal = DropdownMenuPrimitive.Portal
const DropdownMenuSub = DropdownMenuPrimitive.Sub
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
const DropdownMenuSubTrigger = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
inset?: boolean
}
>(({ className, inset, children, ...props }, ref) => (
<DropdownMenuPrimitive.SubTrigger
ref={ref}
className={cn(
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
inset && "pl-8",
className
)}
{...props}
>
{children}
<ChevronRightIcon className="ml-auto h-4 w-4" />
</DropdownMenuPrimitive.SubTrigger>
))
DropdownMenuSubTrigger.displayName =
DropdownMenuPrimitive.SubTrigger.displayName
const DropdownMenuSubContent = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
>(({ className, ...props }, ref) => (
<DropdownMenuPrimitive.SubContent
ref={ref}
className={cn(
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className
)}
{...props}
/>
))
DropdownMenuSubContent.displayName =
DropdownMenuPrimitive.SubContent.displayName
const DropdownMenuContent = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
>(({ className, sideOffset = 4, ...props }, ref) => (
<DropdownMenuPrimitive.Portal>
<DropdownMenuPrimitive.Content
ref={ref}
sideOffset={sideOffset}
className={cn(
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className
)}
{...props}
/>
</DropdownMenuPrimitive.Portal>
))
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
const DropdownMenuItem = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
inset?: boolean
}
>(({ className, inset, ...props }, ref) => (
<DropdownMenuPrimitive.Item
ref={ref}
className={cn(
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
inset && "pl-8",
className
)}
{...props}
/>
))
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
const DropdownMenuCheckboxItem = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
>(({ className, children, checked, ...props }, ref) => (
<DropdownMenuPrimitive.CheckboxItem
ref={ref}
className={cn(
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
className
)}
checked={checked}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<DropdownMenuPrimitive.ItemIndicator>
<CheckIcon className="h-4 w-4" />
</DropdownMenuPrimitive.ItemIndicator>
</span>
{children}
</DropdownMenuPrimitive.CheckboxItem>
))
DropdownMenuCheckboxItem.displayName =
DropdownMenuPrimitive.CheckboxItem.displayName
const DropdownMenuRadioItem = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
>(({ className, children, ...props }, ref) => (
<DropdownMenuPrimitive.RadioItem
ref={ref}
className={cn(
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
className
)}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<DropdownMenuPrimitive.ItemIndicator>
<DotFilledIcon className="h-4 w-4 fill-current" />
</DropdownMenuPrimitive.ItemIndicator>
</span>
{children}
</DropdownMenuPrimitive.RadioItem>
))
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
const DropdownMenuLabel = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Label>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
inset?: boolean
}
>(({ className, inset, ...props }, ref) => (
<DropdownMenuPrimitive.Label
ref={ref}
className={cn(
"px-2 py-1.5 text-sm font-semibold",
inset && "pl-8",
className
)}
{...props}
/>
))
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
const DropdownMenuSeparator = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
>(({ className, ...props }, ref) => (
<DropdownMenuPrimitive.Separator
ref={ref}
className={cn("-mx-1 my-1 h-px bg-muted", className)}
{...props}
/>
))
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
const DropdownMenuShortcut = ({
className,
...props
}: React.HTMLAttributes<HTMLSpanElement>) => {
return (
<span
className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
{...props}
/>
)
}
DropdownMenuShortcut.displayName = "DropdownMenuShortcut"
export {
DropdownMenu,
DropdownMenuTrigger,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuCheckboxItem,
DropdownMenuRadioItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuShortcut,
DropdownMenuGroup,
DropdownMenuPortal,
DropdownMenuSub,
DropdownMenuSubContent,
DropdownMenuSubTrigger,
DropdownMenuRadioGroup,
}

176
components/ui/form.tsx Normal file
View File

@ -0,0 +1,176 @@
import * as React from "react"
import * as LabelPrimitive from "@radix-ui/react-label"
import { Slot } from "@radix-ui/react-slot"
import {
Controller,
ControllerProps,
FieldPath,
FieldValues,
FormProvider,
useFormContext,
} from "react-hook-form"
import { cn } from "@/lib/utils"
import { Label } from "@/components/ui/label"
const Form = FormProvider
type FormFieldContextValue<
TFieldValues extends FieldValues = FieldValues,
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
> = {
name: TName
}
const FormFieldContext = React.createContext<FormFieldContextValue>(
{} as FormFieldContextValue
)
const FormField = <
TFieldValues extends FieldValues = FieldValues,
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
>({
...props
}: ControllerProps<TFieldValues, TName>) => {
return (
<FormFieldContext.Provider value={{ name: props.name }}>
<Controller {...props} />
</FormFieldContext.Provider>
)
}
const useFormField = () => {
const fieldContext = React.useContext(FormFieldContext)
const itemContext = React.useContext(FormItemContext)
const { getFieldState, formState } = useFormContext()
const fieldState = getFieldState(fieldContext.name, formState)
if (!fieldContext) {
throw new Error("useFormField should be used within <FormField>")
}
const { id } = itemContext
return {
id,
name: fieldContext.name,
formItemId: `${id}-form-item`,
formDescriptionId: `${id}-form-item-description`,
formMessageId: `${id}-form-item-message`,
...fieldState,
}
}
type FormItemContextValue = {
id: string
}
const FormItemContext = React.createContext<FormItemContextValue>(
{} as FormItemContextValue
)
const FormItem = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => {
const id = React.useId()
return (
<FormItemContext.Provider value={{ id }}>
<div ref={ref} className={cn(" ", className)} {...props} />
</FormItemContext.Provider>
)
})
FormItem.displayName = "FormItem"
const FormLabel = React.forwardRef<
React.ElementRef<typeof LabelPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
>(({ className, ...props }, ref) => {
const { error, formItemId } = useFormField()
return (
<Label
ref={ref}
className={cn(error && "text-destructive", className)}
htmlFor={formItemId}
{...props}
/>
)
})
FormLabel.displayName = "FormLabel"
const FormControl = React.forwardRef<
React.ElementRef<typeof Slot>,
React.ComponentPropsWithoutRef<typeof Slot>
>(({ ...props }, ref) => {
const { error, formItemId, formDescriptionId, formMessageId } = useFormField()
return (
<Slot
ref={ref}
id={formItemId}
aria-describedby={
!error
? `${formDescriptionId}`
: `${formDescriptionId} ${formMessageId}`
}
aria-invalid={!!error}
{...props}
/>
)
})
FormControl.displayName = "FormControl"
const FormDescription = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLParagraphElement>
>(({ className, ...props }, ref) => {
const { formDescriptionId } = useFormField()
return (
<p
ref={ref}
id={formDescriptionId}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
)
})
FormDescription.displayName = "FormDescription"
const FormMessage = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLParagraphElement>
>(({ className, children, ...props }, ref) => {
const { error, formMessageId } = useFormField()
const body = error ? String(error?.message) : children
if (!body) {
return null
}
return (
<p
ref={ref}
id={formMessageId}
className={cn("text-xs font-medium text-destructive", className)}
{...props}
>
{body}
</p>
)
})
FormMessage.displayName = "FormMessage"
export {
useFormField,
Form,
FormItem,
FormLabel,
FormControl,
FormDescription,
FormMessage,
FormField,
}

31
components/ui/input.tsx Normal file
View File

@ -0,0 +1,31 @@
import * as React from "react";
import { cn } from "@/lib/utils";
export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> {}
const Input = React.forwardRef<HTMLInputElement, InputProps>(
({ className, type, ...props }, ref) => {
return (
<input
type={type}
className={cn(
`flex w-full rounded-md border border-input px-3 py-2 ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50
text-black text-opacity-50 text-xs font-normal bg-slate-200 mb-3
3xl:h-9 h-10 transition-all
hover:bg-slate-300 hover:cursor-pointer focus:cursor-auto
focus:outline-4 focus:outline-slate-300 focus:bg-slate-200
`,
className
)}
ref={ref}
{...props}
/>
);
}
);
Input.displayName = "Input";
export { Input };

26
components/ui/label.tsx Normal file
View File

@ -0,0 +1,26 @@
"use client"
import * as React from "react"
import * as LabelPrimitive from "@radix-ui/react-label"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const labelVariants = cva(
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
)
const Label = React.forwardRef<
React.ElementRef<typeof LabelPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
VariantProps<typeof labelVariants>
>(({ className, ...props }, ref) => (
<LabelPrimitive.Root
ref={ref}
className={cn(labelVariants(), className)}
{...props}
/>
))
Label.displayName = LabelPrimitive.Root.displayName
export { Label }

View File

@ -0,0 +1,44 @@
"use client"
import * as React from "react"
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
import { Circle } from "lucide-react"
import { cn } from "@/lib/utils"
const RadioGroup = React.forwardRef<
React.ElementRef<typeof RadioGroupPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
>(({ className, ...props }, ref) => {
return (
<RadioGroupPrimitive.Root
className={cn("grid gap-2", className)}
{...props}
ref={ref}
/>
)
})
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName
const RadioGroupItem = React.forwardRef<
React.ElementRef<typeof RadioGroupPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
>(({ className, ...props }, ref) => {
return (
<RadioGroupPrimitive.Item
ref={ref}
className={cn(
"aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
className
)}
{...props}
>
<RadioGroupPrimitive.Indicator className="flex items-center justify-center">
<Circle className="h-2.5 w-2.5 fill-current text-current" />
</RadioGroupPrimitive.Indicator>
</RadioGroupPrimitive.Item>
)
})
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName
export { RadioGroup, RadioGroupItem }

164
components/ui/select.tsx Normal file
View File

@ -0,0 +1,164 @@
"use client"
import * as React from "react"
import {
CaretSortIcon,
CheckIcon,
ChevronDownIcon,
ChevronUpIcon,
} from "@radix-ui/react-icons"
import * as SelectPrimitive from "@radix-ui/react-select"
import { cn } from "@/lib/utils"
const Select = SelectPrimitive.Root
const SelectGroup = SelectPrimitive.Group
const SelectValue = SelectPrimitive.Value
const SelectTrigger = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Trigger>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
>(({ className, children, ...props }, ref) => (
<SelectPrimitive.Trigger
ref={ref}
className={cn(
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
className
)}
{...props}
>
{children}
<SelectPrimitive.Icon asChild>
<CaretSortIcon className="h-4 w-4 opacity-50" />
</SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
))
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
const SelectScrollUpButton = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
>(({ className, ...props }, ref) => (
<SelectPrimitive.ScrollUpButton
ref={ref}
className={cn(
"flex cursor-default items-center justify-center py-1",
className
)}
{...props}
>
<ChevronUpIcon />
</SelectPrimitive.ScrollUpButton>
))
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
const SelectScrollDownButton = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
>(({ className, ...props }, ref) => (
<SelectPrimitive.ScrollDownButton
ref={ref}
className={cn(
"flex cursor-default items-center justify-center py-1",
className
)}
{...props}
>
<ChevronDownIcon />
</SelectPrimitive.ScrollDownButton>
))
SelectScrollDownButton.displayName =
SelectPrimitive.ScrollDownButton.displayName
const SelectContent = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
>(({ className, children, position = "popper", ...props }, ref) => (
<SelectPrimitive.Portal>
<SelectPrimitive.Content
ref={ref}
className={cn(
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
position === "popper" &&
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
className
)}
position={position}
{...props}
>
<SelectScrollUpButton />
<SelectPrimitive.Viewport
className={cn(
"p-1",
position === "popper" &&
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
)}
>
{children}
</SelectPrimitive.Viewport>
<SelectScrollDownButton />
</SelectPrimitive.Content>
</SelectPrimitive.Portal>
))
SelectContent.displayName = SelectPrimitive.Content.displayName
const SelectLabel = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Label>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
>(({ className, ...props }, ref) => (
<SelectPrimitive.Label
ref={ref}
className={cn("px-2 py-1.5 text-sm font-semibold", className)}
{...props}
/>
))
SelectLabel.displayName = SelectPrimitive.Label.displayName
const SelectItem = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
>(({ className, children, ...props }, ref) => (
<SelectPrimitive.Item
ref={ref}
className={cn(
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
className
)}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<SelectPrimitive.ItemIndicator>
<CheckIcon className="h-4 w-4" />
</SelectPrimitive.ItemIndicator>
</span>
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
</SelectPrimitive.Item>
))
SelectItem.displayName = SelectPrimitive.Item.displayName
const SelectSeparator = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Separator>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
>(({ className, ...props }, ref) => (
<SelectPrimitive.Separator
ref={ref}
className={cn("-mx-1 my-1 h-px bg-muted", className)}
{...props}
/>
))
SelectSeparator.displayName = SelectPrimitive.Separator.displayName
export {
Select,
SelectGroup,
SelectValue,
SelectTrigger,
SelectContent,
SelectLabel,
SelectItem,
SelectSeparator,
SelectScrollUpButton,
SelectScrollDownButton,
}

31
components/ui/sonner.tsx Normal file
View File

@ -0,0 +1,31 @@
"use client"
import { useTheme } from "next-themes"
import { Toaster as Sonner } from "sonner"
type ToasterProps = React.ComponentProps<typeof Sonner>
const Toaster = ({ ...props }: ToasterProps) => {
const { theme = "system" } = useTheme()
return (
<Sonner
theme={theme as ToasterProps["theme"]}
className="toaster group !font-[yekan]"
toastOptions={{
classNames: {
toast:
"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
description: "group-[.toast]:text-muted-foreground",
actionButton:
"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
cancelButton:
"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
},
}}
{...props}
/>
)
}
export { Toaster }

120
components/ui/table.tsx Normal file
View File

@ -0,0 +1,120 @@
import * as React from "react"
import { cn } from "@/lib/utils"
const Table = React.forwardRef<
HTMLTableElement,
React.HTMLAttributes<HTMLTableElement>
>(({ className, ...props }, ref) => (
<div className="relative w-full overflow-auto">
<table
ref={ref}
className={cn("w-full caption-bottom text-sm", className)}
{...props}
/>
</div>
))
Table.displayName = "Table"
const TableHeader = React.forwardRef<
HTMLTableSectionElement,
React.HTMLAttributes<HTMLTableSectionElement>
>(({ className, ...props }, ref) => (
<thead ref={ref} className={cn("[&_tr]:border-b border-b-2", className)} {...props} />
))
TableHeader.displayName = "TableHeader"
const TableBody = React.forwardRef<
HTMLTableSectionElement,
React.HTMLAttributes<HTMLTableSectionElement>
>(({ className, ...props }, ref) => (
<tbody
ref={ref}
className={cn("[&_tr:last-child]:border-0", className)}
{...props}
/>
))
TableBody.displayName = "TableBody"
const TableFooter = React.forwardRef<
HTMLTableSectionElement,
React.HTMLAttributes<HTMLTableSectionElement>
>(({ className, ...props }, ref) => (
<tfoot
ref={ref}
className={cn(
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
className
)}
{...props}
/>
))
TableFooter.displayName = "TableFooter"
const TableRow = React.forwardRef<
HTMLTableRowElement,
React.HTMLAttributes<HTMLTableRowElement>
>(({ className, ...props }, ref) => (
<tr
ref={ref}
className={cn(
"border-b transition-colors data-[state=selected]:bg-muted h-12",
className
)}
{...props}
/>
))
TableRow.displayName = "TableRow"
const TableHead = React.forwardRef<
HTMLTableCellElement,
React.ThHTMLAttributes<HTMLTableCellElement>
>(({ className, ...props }, ref) => (
<th
ref={ref}
className={cn(
"h-10 px-2 text-center align-middle font-medium text-black [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
className
)}
{...props}
/>
))
TableHead.displayName = "TableHead"
const TableCell = React.forwardRef<
HTMLTableCellElement,
React.TdHTMLAttributes<HTMLTableCellElement>
>(({ className, ...props }, ref) => (
<td
ref={ref}
className={cn(
"p-2 text-center text-muted-foreground align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
className
)}
{...props}
/>
))
TableCell.displayName = "TableCell"
const TableCaption = React.forwardRef<
HTMLTableCaptionElement,
React.HTMLAttributes<HTMLTableCaptionElement>
>(({ className, ...props }, ref) => (
<caption
ref={ref}
className={cn("mt-4 text-sm text-muted-foreground", className)}
{...props}
/>
))
TableCaption.displayName = "TableCaption"
export {
Table,
TableHeader,
TableBody,
TableFooter,
TableHead,
TableRow,
TableCell,
TableCaption,
}

55
components/ui/tabs.tsx Normal file
View File

@ -0,0 +1,55 @@
"use client"
import * as React from "react"
import * as TabsPrimitive from "@radix-ui/react-tabs"
import { cn } from "@/lib/utils"
const Tabs = TabsPrimitive.Root
const TabsList = React.forwardRef<
React.ElementRef<typeof TabsPrimitive.List>,
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
>(({ className, ...props }, ref) => (
<TabsPrimitive.List
ref={ref}
className={cn(
"inline-flex h-14 items-center justify-start rounded-md bg-[#E9E9E9] p-2 text-muted-foreground",
className
)}
{...props}
/>
))
TabsList.displayName = TabsPrimitive.List.displayName
const TabsTrigger = React.forwardRef<
React.ElementRef<typeof TabsPrimitive.Trigger>,
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
>(({ className, ...props }, ref) => (
<TabsPrimitive.Trigger
ref={ref}
className={cn(
"inline-flex items-center justify-center h-full whitespace-nowrap rounded-sm px-1 sm:px-3 py-1.5 text-xs sm:text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-blue data-[state=active]:text-white data-[state=active]:shadow-sm",
className
)}
{...props}
/>
))
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
const TabsContent = React.forwardRef<
React.ElementRef<typeof TabsPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
>(({ className, ...props }, ref) => (
<TabsPrimitive.Content
ref={ref}
className={cn(
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
className
)}
{...props}
/>
))
TabsContent.displayName = TabsPrimitive.Content.displayName
export { Tabs, TabsList, TabsTrigger, TabsContent }

View File

@ -0,0 +1,26 @@
import * as React from "react"
import { cn } from "@/lib/utils"
export interface TextareaProps
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
({ className, ...props }, ref) => {
return (
<textarea
className={cn(
`flex w-full rounded-md border border-input px-3 py-2 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50
text-black text-opacity-50 text-xs font-normal bg-slate-200
3xl:min-h-[150px] min-h-[100px]`,
className
)}
ref={ref}
{...props}
/>
)
}
)
Textarea.displayName = "Textarea"
export { Textarea }

127
components/ui/toast.tsx Normal file
View File

@ -0,0 +1,127 @@
import * as React from "react"
import * as ToastPrimitives from "@radix-ui/react-toast"
import { cva, type VariantProps } from "class-variance-authority"
import { X } from "lucide-react"
import { cn } from "@/lib/utils"
const ToastProvider = ToastPrimitives.Provider
const ToastViewport = React.forwardRef<
React.ElementRef<typeof ToastPrimitives.Viewport>,
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>
>(({ className, ...props }, ref) => (
<ToastPrimitives.Viewport
ref={ref}
className={cn(
"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",
className
)}
{...props}
/>
))
ToastViewport.displayName = ToastPrimitives.Viewport.displayName
const toastVariants = cva(
"group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
{
variants: {
variant: {
default: "border bg-background text-foreground",
destructive:
"destructive group border-destructive bg-destructive text-destructive-foreground",
},
},
defaultVariants: {
variant: "default",
},
}
)
const Toast = React.forwardRef<
React.ElementRef<typeof ToastPrimitives.Root>,
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &
VariantProps<typeof toastVariants>
>(({ className, variant, ...props }, ref) => {
return (
<ToastPrimitives.Root
ref={ref}
className={cn(toastVariants({ variant }), className)}
{...props}
/>
)
})
Toast.displayName = ToastPrimitives.Root.displayName
const ToastAction = React.forwardRef<
React.ElementRef<typeof ToastPrimitives.Action>,
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>
>(({ className, ...props }, ref) => (
<ToastPrimitives.Action
ref={ref}
className={cn(
"inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",
className
)}
{...props}
/>
))
ToastAction.displayName = ToastPrimitives.Action.displayName
const ToastClose = React.forwardRef<
React.ElementRef<typeof ToastPrimitives.Close>,
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>
>(({ className, ...props }, ref) => (
<ToastPrimitives.Close
ref={ref}
className={cn(
"absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
className
)}
toast-close=""
{...props}
>
<X className="h-4 w-4" />
</ToastPrimitives.Close>
))
ToastClose.displayName = ToastPrimitives.Close.displayName
const ToastTitle = React.forwardRef<
React.ElementRef<typeof ToastPrimitives.Title>,
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>
>(({ className, ...props }, ref) => (
<ToastPrimitives.Title
ref={ref}
className={cn("text-sm font-semibold", className)}
{...props}
/>
))
ToastTitle.displayName = ToastPrimitives.Title.displayName
const ToastDescription = React.forwardRef<
React.ElementRef<typeof ToastPrimitives.Description>,
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>
>(({ className, ...props }, ref) => (
<ToastPrimitives.Description
ref={ref}
className={cn("text-sm opacity-90", className)}
{...props}
/>
))
ToastDescription.displayName = ToastPrimitives.Description.displayName
type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>
type ToastActionElement = React.ReactElement<typeof ToastAction>
export {
type ToastProps,
type ToastActionElement,
ToastProvider,
ToastViewport,
Toast,
ToastTitle,
ToastDescription,
ToastClose,
ToastAction,
}

35
components/ui/toaster.tsx Normal file
View File

@ -0,0 +1,35 @@
"use client"
import {
Toast,
ToastClose,
ToastDescription,
ToastProvider,
ToastTitle,
ToastViewport,
} from "@/components/ui/toast"
import { useToast } from "@/components/ui/use-toast"
export function Toaster() {
const { toasts } = useToast()
return (
<ToastProvider>
{toasts.map(function ({ id, title, description, action, ...props }) {
return (
<Toast key={id} {...props}>
<div className="grid gap-1">
{title && <ToastTitle>{title}</ToastTitle>}
{description && (
<ToastDescription>{description}</ToastDescription>
)}
</div>
{action}
<ToastClose />
</Toast>
)
})}
<ToastViewport />
</ToastProvider>
)
}

192
components/ui/use-toast.ts Normal file
View File

@ -0,0 +1,192 @@
// Inspired by react-hot-toast library
import * as React from "react"
import type {
ToastActionElement,
ToastProps,
} from "@/components/ui/toast"
const TOAST_LIMIT = 1
const TOAST_REMOVE_DELAY = 1000000
type ToasterToast = ToastProps & {
id: string
title?: React.ReactNode
description?: React.ReactNode
action?: ToastActionElement
}
const actionTypes = {
ADD_TOAST: "ADD_TOAST",
UPDATE_TOAST: "UPDATE_TOAST",
DISMISS_TOAST: "DISMISS_TOAST",
REMOVE_TOAST: "REMOVE_TOAST",
} as const
let count = 0
function genId() {
count = (count + 1) % Number.MAX_SAFE_INTEGER
return count.toString()
}
type ActionType = typeof actionTypes
type Action =
| {
type: ActionType["ADD_TOAST"]
toast: ToasterToast
}
| {
type: ActionType["UPDATE_TOAST"]
toast: Partial<ToasterToast>
}
| {
type: ActionType["DISMISS_TOAST"]
toastId?: ToasterToast["id"]
}
| {
type: ActionType["REMOVE_TOAST"]
toastId?: ToasterToast["id"]
}
interface State {
toasts: ToasterToast[]
}
const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()
const addToRemoveQueue = (toastId: string) => {
if (toastTimeouts.has(toastId)) {
return
}
const timeout = setTimeout(() => {
toastTimeouts.delete(toastId)
dispatch({
type: "REMOVE_TOAST",
toastId: toastId,
})
}, TOAST_REMOVE_DELAY)
toastTimeouts.set(toastId, timeout)
}
export const reducer = (state: State, action: Action): State => {
switch (action.type) {
case "ADD_TOAST":
return {
...state,
toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
}
case "UPDATE_TOAST":
return {
...state,
toasts: state.toasts.map((t) =>
t.id === action.toast.id ? { ...t, ...action.toast } : t
),
}
case "DISMISS_TOAST": {
const { toastId } = action
// ! Side effects ! - This could be extracted into a dismissToast() action,
// but I'll keep it here for simplicity
if (toastId) {
addToRemoveQueue(toastId)
} else {
state.toasts.forEach((toast) => {
addToRemoveQueue(toast.id)
})
}
return {
...state,
toasts: state.toasts.map((t) =>
t.id === toastId || toastId === undefined
? {
...t,
open: false,
}
: t
),
}
}
case "REMOVE_TOAST":
if (action.toastId === undefined) {
return {
...state,
toasts: [],
}
}
return {
...state,
toasts: state.toasts.filter((t) => t.id !== action.toastId),
}
}
}
const listeners: Array<(state: State) => void> = []
let memoryState: State = { toasts: [] }
function dispatch(action: Action) {
memoryState = reducer(memoryState, action)
listeners.forEach((listener) => {
listener(memoryState)
})
}
type Toast = Omit<ToasterToast, "id">
function toast({ ...props }: Toast) {
const id = genId()
const update = (props: ToasterToast) =>
dispatch({
type: "UPDATE_TOAST",
toast: { ...props, id },
})
const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id })
dispatch({
type: "ADD_TOAST",
toast: {
...props,
id,
open: true,
onOpenChange: (open) => {
if (!open) dismiss()
},
},
})
return {
id: id,
dismiss,
update,
}
}
function useToast() {
const [state, setState] = React.useState<State>(memoryState)
React.useEffect(() => {
listeners.push(setState)
return () => {
const index = listeners.indexOf(setState)
if (index > -1) {
listeners.splice(index, 1)
}
}
}, [state])
return {
...state,
toast,
dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),
}
}
export { useToast, toast }

237
constants/index.tsx Normal file
View File

@ -0,0 +1,237 @@
import { LuMapPin } from "react-icons/lu";
import { HiOutlineMail } from "react-icons/hi";
import { FiPhone } from "react-icons/fi";
import bgimg from "../public/img/bg.png";
export const menuItems = [
{ id: 1, name: "صفحه اصلی", href: "/" },
{ id: 2, name: "اخبار", href: "/" },
{ id: 3, name: "درباره ما", href: "/" },
{ id: 4, name: "تماس با ما", href: "/CallUs" },
{ id: 5, name: "پیگیری", href: "/" },
{ id: 6, name: "ورود به پنل کاربری", href: "/Login" },
];
export const sliderItems = [
{ id: 1, img: bgimg },
{ id: 2, img: bgimg },
{ id: 3, img: bgimg },
];
export const boxItems = [
{
id: 1,
name: "ثبت شکایت",
icon: "/img/box1.svg",
icon2: "/img/box1-hover.svg",
description: "ارسال درخواست نارضایتی از پرسنل",
link: "/RequestStep1",
},
{
id: 2,
name: "پیگیری شکایت",
icon: "/img/box2.svg",
icon2: "/img/box2-hover.svg",
description: "پیگیری درخواست ارسال شده",
link: "/FollowUp",
},
{
id: 3,
name: "ثبت شکایت(شناس)",
icon: "/img/box1.svg",
icon2: "/img/box1-hover.svg",
description: "ارسال درخواست نارضایتی از پرسنل",
link: "/CitizenLogin",
},
// {
// id: 3,
// name: "مشاهده آمار",
// icon: "/img/box3.svg",
// icon2: "/img/box3-hover.svg",
// description: "مشاهده آمار و گزارشات درخواست ها",
// link: "/",
// },
];
export const newsItems = [
{
id: 1,
title: "شروع به کار سامانه سوت زنی",
content:
"این سامانه با هدف نظارت بر عملکرد پرستل و نهادهای مرتبط با امور مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است ...",
date: "24 آذر ماه 1402",
},
{
id: 2,
title: "شروع به کار سامانه سوت زنی",
content:
"این سامانه با هدف نظارت بر عملکرد پرستل و نهادهای مرتبط با امور مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است ...",
date: "24 آذر ماه 1402",
},
{
id: 3,
title: "شروع به کار سامانه سوت زنی ",
content:
"این سامانه با هدف نظارت بر عملکرد پرستل و نهادهای مرتبط با امور مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است ...",
date: "24 آذر ماه 1402",
},
];
export const counterItems = [
{ id: 1, name: "تعداد گزارشات ارسال شده", count: "1041+" },
{ id: 2, name: "تعداد گزارشات ارسال شده", count: "1041+" },
{ id: 3, name: "تعداد گزارشات ارسال شده", count: "1041+" },
{ id: 4, name: "تعداد گزارشات ارسال شده", count: "1041+" },
{ id: 5, name: "تعداد گزارشات ارسال شده", count: "1041+" },
];
export const requestItems = [
{ id: 1, name: "درخواست از طرف شهروند" },
{ id: 2, name: "دریافت کد رهگیری" },
{ id: 3, name: "بررسی توسط بازرس شهرداری" },
{ id: 4, name: " اعلام نتیجه درخواست" },
];
export const aboutFooterItems = [
{
id: 1,
name: "لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و بااستفاده از طراحان گرافیک است. چاپگرها و متون بلکه روزنامه و مجلهدر ستون و سطرآنچنان که لازم است لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ ",
},
];
export const footerItems = [
{ id: 1, name: "قوانین مربوط به سوت زنی", href: "/" },
{ id: 2, name: "ارسال گزارش در سامانه سوت زنی قوه قضاییه", href: "/" },
{ id: 3, name: "وب سایت قوه قضاییه", href: "/" },
{ id: 4, name: " وب سایت ریاست جمهوری", href: "/" },
];
export const callUsItems = [
{
id: 1,
title: "نشانی",
icon: <LuMapPin size="full" />,
description: " نشانی ما جهت ارتباط ",
description2: "google map",
},
{
id: 2,
title: "نشانی الکترونیک",
icon: <HiOutlineMail size="full" />,
description: "جهت ارتباط ما با باا شماره",
description2: "sotzani@gamil.com",
},
{
id: 3,
title: "تماس با ما ",
icon: <FiPhone size="full" />,
description: "جهت ارتباط ما با باا شماره",
description2: "03531234567",
},
];
export const ControllerMenuItems = [
{ id: 1, name: "داشبورد", href: "/UserPanel/ControllerDashboard" },
{ id: 2, name: "شکایات", href: "/UserPanel/ControllerDashboard/Complaints" },
{
id: 3,
name: "گزارشات و آمار",
href: "/UserPanel/ControllerDashboard/Reports",
},
];
export const AdminMenuItems = [
{ id: 1, name: "داشبورد", href: "/UserPanel/AdminDashboard" },
{ id: 2, name: "مدیریت کاربران", href: "/UserPanel/AdminDashboard/UserManagement" },
{ id: 3, name: "مدیریت کلید ها", href: "/UserPanel/AdminDashboard/KeysManagement" },
{ id: 4, name: "گزارشات و آمار", href: "/UserPanel/AdminDashboard/#" },
{ id: 5, name: "تنظیمات", href: "/UserPanel/AdminDashboard/#" },
];
export const ControllerTableItems = [
{
id: 1,
date: "1402/09/05",
title: "درخواست رشوه ",
content: "واحد روابط عمومی شهرداری",
},
{
id: 2,
date: "1402/09/05",
title: "درخواست رشوه ",
content: "واحد روابط عمومی شهرداری",
},
{
id: 3,
date: "1402/09/05",
title: "درخواست رشوه ",
content: "واحد روابط عمومی شهرداری",
},
];
export const ComplainDetailsItems = [
{
id: 1,
title: "ثبت شکایت",
desc: "سند 54841",
date: "1402/09/05",
time: " 12:58 ",
},
{
id: 2,
title: "تایید توسط بازرس ...",
desc: "سند 54841",
date: "1402/09/05",
time: " 12:58 ",
},
{
id: 3,
title: "ارجاع به واحد...",
desc: "سند 54841",
date: "1402/09/05",
time: " 12:58 ",
},
{
id: 4,
title: "پاسخ",
desc: "سند 54841",
date: "1402/09/05",
time: " 12:58 ",
},
];
export const AdminCardItems = [
{ id: 1, name: "تعداد گزارشات ارسال شده", count: "100" },
{ id: 2, name: "تعداد گزارشات ارسال شده", count: "200" },
{ id: 3, name: "تعداد گزارشات ارسال شده", count: "300" },
{ id: 4, name: "تعداد گزارشات ارسال شده", count: "400" },
];
export const AdminTableItems = [
{
id: 1,
name: "محمد یزدی زاده",
phone: "09134504190",
useRole: "ادمین",
date: "1402/09/05",
desc: "واحد روابط عمومی شهرداری",
},
{
id: 2,
name: "محسن یزدی پناه",
phone: "09134504190",
useRole: "ادمین",
date: "1402/09/05",
desc: "واحد روابط عمومی شهرداری",
},
];
export const Operations = [
{value:0,name:"ثبت شده"},
{value:1,name:"دیدن"},
{value:2,name:"درخواست توضیحات"},
{value:3,name:"پاسخ شهروند"},
{value:4,name:"لغو درخواست"},
{value:5,name:"افزودن جزییات"},
{value:6,name:"پایان درخواست"},
{value:7,name:"شروع مجدد درخواست"},
];

BIN
fonts/DMSans-Medium.ttf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
fonts/Roboto-Medium.ttf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

47
hooks/useDecrypt.tsx Normal file
View File

@ -0,0 +1,47 @@
"use client";
import React, { useState, useEffect } from "react";
import JSEncrypt from "jsencrypt";
interface UseDecryptWithPrivateKeyHookResult {
decryptedData: string;
error: Error | null;
}
export default function useDecrypt(encryptedData: any) {
const [decryptedData, setDecryptedData] = useState<any>("");
const [error, setError] = useState<any>(null);
const privateKey = `-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQCfmb1aGcWsqJPp+v6e72CPngE6P6FoCZCJESwDTXUXiJiAKshB
WZ9nlN+IIpQr6h8gmxi8SWbofPWmSKZgTyU2MddxUanneuywPTTUj4HQ6/DUaDwF
0Vr6Fk0x4yi1GKpBzhRFPyOYBWVXKIw23j0l+EWw6+JIpR9Kwu0TezHHFQIDAQAB
AoGBAIVxegy3t7vhR6s/HV2uMEJkjgox4banKJ4yKWapgNmocDnZi454bPuiUjP1
FYaSPmx4wXnMtap1sL7Tx6iHBEi10KB1AghDZP5wJHz6nm9ugcrGSSWhVJM74x6C
ThVztAV/rydaZ6/DLaqsBg5lHlo1DjMKq4sxnqrw/LUMGtOBAkEAzt8bnM1Ij/rF
i8oSP3gI0H914vf/0N2xxGGdQvMmJK0oijIm5j8dFDZf02Ft34SFeVJfXyVPapDE
vQ6TRw+1HQJBAMWAwvbypbtl65Dn4qCj3oJUmmnjjxm5080idF1S6ufo34p2gHMF
qLtWjmnGqjh2Shs7ahnfbLF+cxzgBg7yEFkCQFYGl1/0Sel9uepwpHf6PYgeiPJS
ePHtTwBAK3pszH7R9xrI0j5LHpeKKP0o9dzOKgcShxB03nqNKxMHXZ1eXc0CQFhD
Ot3xgm9FFQklF/qCQSYtePRpZcIxcZ3zD93E+IW7ZGsUmkLM/KL8A5jx15B0DJou
6zO0zXZk9DyrQQnc08ECQGy5ti89HmQ6I6Wqq5ADglCY6YPISsNwScVyvu/WxQsX
dEqG/38xFdYTFEekexcHnT/Vt1MW4/j76vBJHYWuAJU=
-----END RSA PRIVATE KEY-----`;
useEffect(() => {
try {
const decryptor = new JSEncrypt();
decryptor.setPrivateKey(privateKey);
console.log(decryptor);
console.log(privateKey);
console.log(encryptedData);
const decrypted = decryptor.decrypt(
"FLjMFDdOUjeJDhBdTXjqkKDx81H6gWwXxvx0sQHTgDFiUoggMwCoJbn+eruMdjnppksh8zhm3rUPCIKeWe6SEuw1PX1MaKpDvZd7wNphKgWb6pLafTQTxsB0eLmTurYHkvtOyJkMHhdRravaEeoGSKmMeC9G2ahYpVYgobicBAU="
);
console.log(decrypted);
setDecryptedData(decrypted);
} catch (error) {
console.log(error);
setError(error);
}
}, [encryptedData]);
return [decryptedData, error];
}

42
lib/utils.ts Normal file
View File

@ -0,0 +1,42 @@
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
import jalaliday from "jalaliday";
import JSEncrypt from "jsencrypt";
dayjs.extend(jalaliday);
dayjs.extend(utc);
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
export function convertDate(date: string) {
const convertedDate = dayjs(date)
.calendar("jalali")
.locale("fa")
.format("YYYY/M/DD");
return convertedDate;
}
export function Decrypt(encryptedData: string , privateKey: string) {
const Key = `-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQCfmb1aGcWsqJPp+v6e72CPngE6P6FoCZCJESwDTXUXiJiAKshB
WZ9nlN+IIpQr6h8gmxi8SWbofPWmSKZgTyU2MddxUanneuywPTTUj4HQ6/DUaDwF
0Vr6Fk0x4yi1GKpBzhRFPyOYBWVXKIw23j0l+EWw6+JIpR9Kwu0TezHHFQIDAQAB
AoGBAIVxegy3t7vhR6s/HV2uMEJkjgox4banKJ4yKWapgNmocDnZi454bPuiUjP1
FYaSPmx4wXnMtap1sL7Tx6iHBEi10KB1AghDZP5wJHz6nm9ugcrGSSWhVJM74x6C
ThVztAV/rydaZ6/DLaqsBg5lHlo1DjMKq4sxnqrw/LUMGtOBAkEAzt8bnM1Ij/rF
i8oSP3gI0H914vf/0N2xxGGdQvMmJK0oijIm5j8dFDZf02Ft34SFeVJfXyVPapDE
vQ6TRw+1HQJBAMWAwvbypbtl65Dn4qCj3oJUmmnjjxm5080idF1S6ufo34p2gHMF
qLtWjmnGqjh2Shs7ahnfbLF+cxzgBg7yEFkCQFYGl1/0Sel9uepwpHf6PYgeiPJS
ePHtTwBAK3pszH7R9xrI0j5LHpeKKP0o9dzOKgcShxB03nqNKxMHXZ1eXc0CQFhD
Ot3xgm9FFQklF/qCQSYtePRpZcIxcZ3zD93E+IW7ZGsUmkLM/KL8A5jx15B0DJou
6zO0zXZk9DyrQQnc08ECQGy5ti89HmQ6I6Wqq5ADglCY6YPISsNwScVyvu/WxQsX
dEqG/38xFdYTFEekexcHnT/Vt1MW4/j76vBJHYWuAJU=
-----END RSA PRIVATE KEY-----`;
const decryptor = new JSEncrypt();
decryptor.setPrivateKey(privateKey);
const decrypted = decryptor.decrypt(encryptedData);
return decrypted;
}

4
next.config.js Normal file
View File

@ -0,0 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {}
module.exports = nextConfig

8961
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

76
package.json Normal file
View File

@ -0,0 +1,76 @@
{
"name": "sootzani",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@hookform/resolvers": "^3.3.2",
"@radix-ui/react-alert-dialog": "^1.0.5",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-radio-group": "^1.1.3",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-tabs": "^1.0.4",
"@radix-ui/react-toast": "^1.1.5",
"@tanstack/react-query": "^5.8.7",
"@tanstack/react-query-devtools": "^5.14.7",
"@uidotdev/usehooks": "^2.4.1",
"axios": "^1.6.2",
"chart.js": "^4.4.1",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"cookies-next": "^4.1.0",
"dayjs": "^1.11.10",
"framer-motion": "^10.16.16",
"hamburger-react": "^2.5.0",
"i": "^0.3.7",
"jalaliday": "^2.3.0",
"jsencrypt": "^3.3.2",
"jwt-decode": "^4.0.0",
"leaflet": "^1.9.4",
"leaflet-geosearch": "^3.11.0",
"lucide-react": "^0.292.0",
"next": "14.0.3",
"next-themes": "^0.2.1",
"npm": "^10.2.5",
"react": "^18.2.0",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.48.2",
"react-icons": "^4.12.0",
"react-leaflet": "^4.2.1",
"react-loader-spinner": "^6.1.6",
"react-otp-input": "^3.1.1",
"react-responsive": "^9.0.2",
"react-spinners": "^0.13.8",
"react-to-print": "^2.14.15",
"react-use": "^17.4.2",
"sonner": "^1.3.1",
"swiper": "^11.0.5",
"tailwind-merge": "^2.1.0",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.22.4",
"zustand": "^4.4.7"
},
"devDependencies": {
"@faker-js/faker": "^8.3.1",
"@types/leaflet": "^1.9.8",
"@types/node": "^20",
"@types/react": "^18.2.43",
"@types/react-dom": "^18",
"autoprefixer": "^10.0.1",
"eslint": "^8",
"eslint-config-next": "14.0.3",
"postcss": "^8",
"tailwindcss": "^3.3.0",
"typescript": "^5"
}
}

6
postcss.config.js Normal file
View File

@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}

View File

@ -0,0 +1,3 @@
<svg width="64" height="24" viewBox="0 0 64 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M62.4516 13.5C63.28 13.5 63.9516 12.8284 63.9516 12C63.9516 11.1716 63.28 10.5 62.4516 10.5V13.5ZM0.48768 10.9393C-0.0981068 11.5251 -0.0981068 12.4749 0.48768 13.0607L10.0336 22.6066C10.6194 23.1924 11.5692 23.1924 12.1549 22.6066C12.7407 22.0208 12.7407 21.0711 12.1549 20.4853L3.66966 12L12.1549 3.51472C12.7407 2.92893 12.7407 1.97918 12.1549 1.3934C11.5692 0.807612 10.6194 0.807612 10.0336 1.3934L0.48768 10.9393ZM62.4516 10.5H1.54834V13.5H62.4516V10.5Z" fill="#B3B3B3"/>
</svg>

After

Width:  |  Height:  |  Size: 590 B

BIN
public/img/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

3
public/img/bluepoint.svg Normal file
View File

@ -0,0 +1,3 @@
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="6" cy="6" r="6" fill="#126DA0"/>
</svg>

After

Width:  |  Height:  |  Size: 148 B

Some files were not shown because too many files have changed in this diff Show More