commit f7078d588e7ae3e697456071462e808ed3f10eec Author: Hossein Rahmani Date: Tue Jan 2 17:22:01 2024 +0330 First Commit diff --git a/.env b/.env new file mode 100644 index 0000000..2d0c1a9 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +NEXT_PUBLIC_BASE_URL_APP="https://sootzaniapi.shetabdahi.ir/" \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..bffb357 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fd3dbb5 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4aa15a3 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "workbench.colorCustomizations": { + "activityBar.background": "#580D3A", + "titleBar.activeBackground": "#7B1251", + "titleBar.activeForeground": "#FFFCFD" + } +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..c403366 --- /dev/null +++ b/README.md @@ -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. diff --git a/app/CallUs/page.tsx b/app/CallUs/page.tsx new file mode 100644 index 0000000..fc7d628 --- /dev/null +++ b/app/CallUs/page.tsx @@ -0,0 +1,8 @@ +import React from "react"; +import CallUs from "@/components/CallUs"; + +export default function page() { + return ( + + ); +} diff --git a/app/CitizenLogin/page.tsx b/app/CitizenLogin/page.tsx new file mode 100644 index 0000000..09d9d8f --- /dev/null +++ b/app/CitizenLogin/page.tsx @@ -0,0 +1,6 @@ +import CitizenLogin from "@/components/CitizenLogin"; +import React from "react"; + +export default function page() { + return ; +} diff --git a/app/FollowResult/page.tsx b/app/FollowResult/page.tsx new file mode 100644 index 0000000..cc633c7 --- /dev/null +++ b/app/FollowResult/page.tsx @@ -0,0 +1,8 @@ +import React from "react"; +import FollowResult from "@/components/FollowResult"; + +export default function page() { + return ( + + ); +} diff --git a/app/FollowUp/page.tsx b/app/FollowUp/page.tsx new file mode 100644 index 0000000..1921e79 --- /dev/null +++ b/app/FollowUp/page.tsx @@ -0,0 +1,8 @@ +import React from "react"; +import FollowUp from "@/components/FollowUp"; + +export default function page() { + return ( + + ); +} diff --git a/app/Login/page.tsx b/app/Login/page.tsx new file mode 100644 index 0000000..ac9a555 --- /dev/null +++ b/app/Login/page.tsx @@ -0,0 +1,8 @@ +import Login from "@/components/Login"; +import React from "react"; + +export default function page() { + return ( + + ); +} diff --git a/app/RequestResult/page.tsx b/app/RequestResult/page.tsx new file mode 100644 index 0000000..ba2ecf9 --- /dev/null +++ b/app/RequestResult/page.tsx @@ -0,0 +1,8 @@ +import React from "react"; +import Result from "@/components/RequestResult"; + +export default function page() { + return ( + + ); +} diff --git a/app/RequestStep1/page.tsx b/app/RequestStep1/page.tsx new file mode 100644 index 0000000..b7916d7 --- /dev/null +++ b/app/RequestStep1/page.tsx @@ -0,0 +1,8 @@ +import React from "react"; +import RequestStep1 from "@/components/RequestStep1"; + +export default function page() { + return ( + + ); +} diff --git a/app/RequestStep2/page.tsx b/app/RequestStep2/page.tsx new file mode 100644 index 0000000..c97600b --- /dev/null +++ b/app/RequestStep2/page.tsx @@ -0,0 +1,8 @@ +import React from "react"; +import RequestStep2 from "@/components/RequestStep2"; + +export default function page() { + return ( + + ); +} diff --git a/app/UserPanel/(Admin)/AdminDashboard/KeysManagement/page.tsx b/app/UserPanel/(Admin)/AdminDashboard/KeysManagement/page.tsx new file mode 100644 index 0000000..24aea02 --- /dev/null +++ b/app/UserPanel/(Admin)/AdminDashboard/KeysManagement/page.tsx @@ -0,0 +1,8 @@ +import AdminKeysManagement from '@/components/AdminKeysManagement' +import React from 'react' + +export default function page() { + return ( + + ) +} diff --git a/app/UserPanel/(Admin)/AdminDashboard/UserManagement/page.tsx b/app/UserPanel/(Admin)/AdminDashboard/UserManagement/page.tsx new file mode 100644 index 0000000..ec7fdbb --- /dev/null +++ b/app/UserPanel/(Admin)/AdminDashboard/UserManagement/page.tsx @@ -0,0 +1,8 @@ +import AdminUserManagement from '@/components/AdminUserManagement' +import React from 'react' + +export default function page() { + return ( + + ) +} diff --git a/app/UserPanel/(Admin)/AdminDashboard/layout.tsx b/app/UserPanel/(Admin)/AdminDashboard/layout.tsx new file mode 100644 index 0000000..1c0558a --- /dev/null +++ b/app/UserPanel/(Admin)/AdminDashboard/layout.tsx @@ -0,0 +1,16 @@ +import NavbarPanel from "@/components/NavbarPanel"; + +export default function RootLayout({ + children, + }: { + children: React.ReactNode; + }) { + return ( + <> + + + {children} + + ) + +} \ No newline at end of file diff --git a/app/UserPanel/(Admin)/AdminDashboard/page.tsx b/app/UserPanel/(Admin)/AdminDashboard/page.tsx new file mode 100644 index 0000000..4119248 --- /dev/null +++ b/app/UserPanel/(Admin)/AdminDashboard/page.tsx @@ -0,0 +1,8 @@ +import AdminDashboard from "@/components/AdminDashboard"; +import React from "react"; + +export default function page() { + return ( + + ); +} diff --git a/app/UserPanel/(Citizen)/CitizenDashboard/layout.tsx b/app/UserPanel/(Citizen)/CitizenDashboard/layout.tsx new file mode 100644 index 0000000..1c0558a --- /dev/null +++ b/app/UserPanel/(Citizen)/CitizenDashboard/layout.tsx @@ -0,0 +1,16 @@ +import NavbarPanel from "@/components/NavbarPanel"; + +export default function RootLayout({ + children, + }: { + children: React.ReactNode; + }) { + return ( + <> + + + {children} + + ) + +} \ No newline at end of file diff --git a/app/UserPanel/(Citizen)/CitizenDashboard/page.tsx b/app/UserPanel/(Citizen)/CitizenDashboard/page.tsx new file mode 100644 index 0000000..cb2be10 --- /dev/null +++ b/app/UserPanel/(Citizen)/CitizenDashboard/page.tsx @@ -0,0 +1,7 @@ +import React from 'react' + +export default function page() { + return ( +
page
+ ) +} diff --git a/app/UserPanel/(Controller)/ControllerDashboard/Complaints/[id]/page.tsx b/app/UserPanel/(Controller)/ControllerDashboard/Complaints/[id]/page.tsx new file mode 100644 index 0000000..1843f83 --- /dev/null +++ b/app/UserPanel/(Controller)/ControllerDashboard/Complaints/[id]/page.tsx @@ -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 ( +
+ ; +
+ ); +} diff --git a/app/UserPanel/(Controller)/ControllerDashboard/Complaints/page.tsx b/app/UserPanel/(Controller)/ControllerDashboard/Complaints/page.tsx new file mode 100644 index 0000000..441aec1 --- /dev/null +++ b/app/UserPanel/(Controller)/ControllerDashboard/Complaints/page.tsx @@ -0,0 +1,8 @@ +import TabController from '@/components/TabController' +import React from 'react' + +export default function page() { + return ( + + ) +} diff --git a/app/UserPanel/(Controller)/ControllerDashboard/Reports/page.tsx b/app/UserPanel/(Controller)/ControllerDashboard/Reports/page.tsx new file mode 100644 index 0000000..48557be --- /dev/null +++ b/app/UserPanel/(Controller)/ControllerDashboard/Reports/page.tsx @@ -0,0 +1,8 @@ +import ReportsController from '@/components/ReportsController' +import React from 'react' + +export default function page() { + return ( + + ) +} diff --git a/app/UserPanel/(Controller)/ControllerDashboard/layout.tsx b/app/UserPanel/(Controller)/ControllerDashboard/layout.tsx new file mode 100644 index 0000000..26a0c2b --- /dev/null +++ b/app/UserPanel/(Controller)/ControllerDashboard/layout.tsx @@ -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 ( + <> + + {children} + + ); +} diff --git a/app/UserPanel/(Controller)/ControllerDashboard/page.tsx b/app/UserPanel/(Controller)/ControllerDashboard/page.tsx new file mode 100644 index 0000000..ff4fa83 --- /dev/null +++ b/app/UserPanel/(Controller)/ControllerDashboard/page.tsx @@ -0,0 +1,8 @@ +import ControllerDashboard from "@/components/ControllerDashboard"; +import React from "react"; + +export default function page() { + return ( + + ); +} diff --git a/app/UserPanel/page.tsx b/app/UserPanel/page.tsx new file mode 100644 index 0000000..346db35 --- /dev/null +++ b/app/UserPanel/page.tsx @@ -0,0 +1,7 @@ +import React from 'react' + +export default function page() { + return ( +
Userpage
+ ) +} diff --git a/app/Verify/page.tsx b/app/Verify/page.tsx new file mode 100644 index 0000000..e2a366b --- /dev/null +++ b/app/Verify/page.tsx @@ -0,0 +1,6 @@ +import Verify from "@/components/Verify"; +import React from "react"; + +export default function page() { + return ; +} diff --git a/app/components/Landing.tsx b/app/components/Landing.tsx new file mode 100644 index 0000000..48ceedd --- /dev/null +++ b/app/components/Landing.tsx @@ -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 ( +
+
+ + {sliderItems.map((item) => { + return ( + + bg + + ); + })} + +
+ +
+
+ {boxItems.map((item, index) => { + return ( + +

+ {item.description} +

+

+ {item.name} +

+ + icon + + icon + + ); + })} +
+ + {/* News */} +
+ آخرین اخبار +
+
+ {/* Right News */} +
+
+ picture +
+ +
+

+ اخبار +

+

+ 24 آذر ماه 1402 +

+

+ شروع به کار سامانه سوت زنی +

+

+ این سامانه با هدف نظارت بر عملکرد پرستل و نهادهای مرتبط با امور + مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده + است ... +

+ + بیشتر بخوانید{" "} + +
+
+ {/* Left News */} +
+ {newsItems.map((item, index) => { + return ( +
+
+

+ {item.title} +

+

+ {item.date} +

+
+

+ {item.content} +

+
+ ); + })} +
+
+
+ {/* Counter */} + + {/*SubmitRequest */} + + {/* Footer */} +
+
+ ); +} diff --git a/app/favicon.ico b/app/favicon.ico new file mode 100644 index 0000000..718d6fe Binary files /dev/null and b/app/favicon.ico differ diff --git a/app/globals.css b/app/globals.css new file mode 100644 index 0000000..94b427c --- /dev/null +++ b/app/globals.css @@ -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; +} + + diff --git a/app/layout.tsx b/app/layout.tsx new file mode 100644 index 0000000..99afec3 --- /dev/null +++ b/app/layout.tsx @@ -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 ( + + + + + + +
{children}
+ + + +
+ + + ); +} diff --git a/app/page.tsx b/app/page.tsx new file mode 100644 index 0000000..f8c8429 --- /dev/null +++ b/app/page.tsx @@ -0,0 +1,6 @@ +import Landing from "@/app/components/Landing"; +import Image from "next/image"; + +export default function Home() { + return ; +} diff --git a/app/print-styles.css b/app/print-styles.css new file mode 100644 index 0000000..80d5fc1 --- /dev/null +++ b/app/print-styles.css @@ -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 */ + } +} \ No newline at end of file diff --git a/components.json b/components.json new file mode 100644 index 0000000..48c34e4 --- /dev/null +++ b/components.json @@ -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" + } +} \ No newline at end of file diff --git a/components/AdminDashboard.tsx b/components/AdminDashboard.tsx new file mode 100644 index 0000000..066e55e --- /dev/null +++ b/components/AdminDashboard.tsx @@ -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 ( +
+ +
+ +
+ + + + + + +
+ +
+
+ +
+
+
+ +
+
+
+
+ ); +} diff --git a/components/AdminKeysManagement.tsx b/components/AdminKeysManagement.tsx new file mode 100644 index 0000000..972cd7a --- /dev/null +++ b/components/AdminKeysManagement.tsx @@ -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 ( +
+
+ {/* 1 */} + + + + + + + اطلاعات کلید جدید + + {isNewKeyLoading ? ( +
+ +
+ ) : ( +
+

+ کلید عمومی : +

+

+ {data2?.publicKey} +

+ +

+ کلید خصوصی : +

+

+ {data2?.privateKey} +

+
+ )} +
+
+ + بستن + {/* Continue */} + +
+
+ + {/* 1 */} + + + + + + + افزودن کلید جدید + + {isNewKeyLoading ? ( +
+ +
+ ) : ( + <> + //
+ // + //
+ // ( + // + // + // کد پیگیری + // + // + // + // + // + // + // )} + // /> + + // ( + // + // + // رمز عبور + // + // + // + // + // + // + // )} + // /> + //
+ + //
+ // + //
+ //
+ // + )} +
+
+ + بستن + {/* Continue */} + +
+
+ +
+ لیست کلیدها +
+ {/* 2 */} +
+ {data1?.map((item: any) => { + return ( +
+

+ عنوان کلید : + {item.title} +

+

+ آی دی بازرس : + + {item.inspectorId} + +

+
+ ); + })} +
+
+
+ ); +} diff --git a/components/AdminUserManagement.tsx b/components/AdminUserManagement.tsx new file mode 100644 index 0000000..827cd7d --- /dev/null +++ b/components/AdminUserManagement.tsx @@ -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 ( +
+
+
+ {/* 1 */} +
+
+ مدیریت کاربران +
+ +
+
+ +
+ +
+ + + + + + + + My Account + + + + Profile + ⇧P + + + Billing + ⇧B + + + + + + + + + + + My Account + + + + Profile + ⇧P + + + Billing + ⇧B + + + + + + + +
+
+
+ + {/* 2 */} +
+ {AdminCardItems.map((item) => { + return ( +
+

+ {item.name} +

+

+ {item.count} +

+
+ ); + })} +
+ + {/* 3 */} +
+
+ لیست کاربران +
+ + +
+
+
+ +
+ ); +} diff --git a/components/BoxDashboard.tsx b/components/BoxDashboard.tsx new file mode 100644 index 0000000..57c8181 --- /dev/null +++ b/components/BoxDashboard.tsx @@ -0,0 +1,16 @@ +import React from "react"; + +export default function BoxDashboard() { + return ( +
+

+ تعداد درخواست ها 30 روز گذشته +

+
+ ); +} diff --git a/components/CallUs.tsx b/components/CallUs.tsx new file mode 100644 index 0000000..8975c75 --- /dev/null +++ b/components/CallUs.tsx @@ -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 ( +
+
+
+ {/*  Logo1 */} + + +
+ +
+
+ {callUsItems.map((item) => { + return ( +
+
+ + {item.icon} + + +

+ {item.title} +

+

+ {item.description} +

+

+ {item.description2} +

+
+
+ ); + })} +
+
+
+
+ ); +} diff --git a/components/CitizenLogin.tsx b/components/CitizenLogin.tsx new file mode 100644 index 0000000..dc17ce1 --- /dev/null +++ b/components/CitizenLogin.tsx @@ -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>({ + resolver: zodResolver(FormSchema), + }); + + function onSubmit(data: z.infer) { + 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 ( +
+
+ icon + +

+ احراز هویت +

+ +
+ + ( + + + شماره موبایل + + + + + {/* + This is your public display name. + */} + + + )} + /> +
+ ( + + {/* + رمز عبور + */} + + + + + + )} + /> + {isLoading ? ( +
+ +
+ ) : ( +
+ icon +
+ )} +
+
+ +
+ + +
+
+ ); +} diff --git a/components/ComplainsDetails.tsx b/components/ComplainsDetails.tsx new file mode 100644 index 0000000..3c15e9a --- /dev/null +++ b/components/ComplainsDetails.tsx @@ -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 ? ( +
+
+
+

گزارش شکایت

+
+

+ موضوع شکایت:{" "} + + {data.title} + +

+

+ دستگاه مربوطه:{" "} + + {/* {data.title} */} + +

+

+ پرسنل مربوطه:{" "} + + {/* {data.title} */} + +

+

+ زمان ثبت:{" "} + + {convertDate(data.registeredAt)} + +

+ {/*

+ {" "} + موضوع شکایت:{" "} + + متن تستی + +

*/} +
+ {/*

+ درخواست شما با کد رهگیری {data.trackingNumber} و رمز عبور 12422 در + دست بررسی و اقدام می باشد. در صورت تمایل می توانید با شماره تلفن + 0353286545 جهت پشتیبانی تماس حاصل کنید.{" "} +

*/} +
+
+

+ انجام عملیات +

+ getComplaintMutation.mutate(storeData)} + role={role} + complaintData={data} + /> +
+
+
+

روند شکایت

+
+ {data.contents?.map((item: any) => { + return ( +
+
+

+ {item.sender == 0 ? "شهروند" : "بازرس"} +

+

+ تاریخ : + + {convertDate(item.dateTime)} + +

+
+
+ متن:{" "} + + {item.text ? item.text : "-"} + +
+
+ ); + })} +
+
+
+

+ انجام عملیات +

+ getComplaintMutation.mutate(storeData)} + role={role} + complaintData={data} + /> +
+ {/* Left */} + {/*
+

+ وضعیت درخواست +

+ + {ComplainDetailsItems.map((item, index, array) => { + return ( +
+
+
+ {item.title} +
+
+ {item.desc} +
+
+ {item.date}
{item.time} +
+
+ +
+
+ greenIcon +
+
+
+
+ ); + })} +
*/} +
+ ) : ( + "" + )} + + ); +} diff --git a/components/ControllerDashboard.tsx b/components/ControllerDashboard.tsx new file mode 100644 index 0000000..103628d --- /dev/null +++ b/components/ControllerDashboard.tsx @@ -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 ( +
+ {/* Lg Show */} +
+
+ + +
+ +
+ +
+
+ +
+
+ + + +
+
+ +
+
+ + {/* max Lg show */} +
+
+ + + + + +
+ +
+
+ +
+
+
+ +
+
+
+
+ ); +} diff --git a/components/Counter.tsx b/components/Counter.tsx new file mode 100644 index 0000000..9263b12 --- /dev/null +++ b/components/Counter.tsx @@ -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 ( +
+
+
+ {counterItems.map((item) => { + return ( +
+

{item.count}

+

{item.name}

+
+ ); + })} +{/* + + {counterItems.map((item) => { + return ( + +

{item.count}

+

{item.name}

+
+ ); + })} + + {/* Slide 1 */} + + {/*
*/} + + +
+ + +
+
+ ) +} diff --git a/components/FollowResult.tsx b/components/FollowResult.tsx new file mode 100644 index 0000000..d730fb4 --- /dev/null +++ b/components/FollowResult.tsx @@ -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(); + const [password, setPassword] = useState(); + const [complaintData, setComplaintData] = useState(); + const [printStyle, setPrintStyle] = useState(true); + + // Print component Data + const componentRef = useRef(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 ( + <> +
+ {/*
*/} + {/*

+ درخواست شما با کد رهگیری + {`${trackingNumber}`}و + رمز عبور + {`${password}`} + در دست بررسی و اقدام می باشد. در صورت تمایل می توانید با شماره تلفن + 0353286545 جهت پشتیبانی تماس حاصل کنید. +

*/} + {complaintPrintMutation?.data ? ( + <> +
+ + + + + + + + +

+ گزارش شکایات +

+ + + + +
+ + + {complaintPrintMutation.isPending ? ( +
+ +
+ ) : ( +
+

+ {" "} + موضوع شکایت:{" "} + + {`${complaintData?.title}`} + +

+

+ {" "} + متن شکایت:{" "} + + {`${complaintData?.contents[0]?.text}`} + +

+
+ +

+ {" "} + جزئیات شکایت: +

+
+

+ درخواست شما با کد رهگیری + {`${trackingNumber}`} + و رمز عبور + {`${password}`} + در دست بررسی و اقدام می باشد. در صورت تمایل می + توانید با شماره تلفن 0353286545 جهت پشتیبانی تماس + حاصل کنید. +

+
+ )} +
+
+ + + +
+
+
+ + + ) : ( + "" + )} + + {/* icon */} + {/*
*/} +
+ + ); +} diff --git a/components/FollowUp.tsx b/components/FollowUp.tsx new file mode 100644 index 0000000..3d9854e --- /dev/null +++ b/components/FollowUp.tsx @@ -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>({ + resolver: zodResolver(FormSchema), + defaultValues: { + trackingNumber: "", + password: "", + }, + }); + + function onSubmit(data: z.infer) { + // toast({ + // title: "You submitted the following values:", + // description: ( + //
+    //       {JSON.stringify(data, null, 2)}
+    //     
+ // ), + // }); + + console.log(data); + + localStorage.setItem("trackingNumber2", data.trackingNumber); + localStorage.setItem("password2", data.password); + + complaintTrackingMutation.mutate({ + Data: { trackingNumber: data.trackingNumber, password: data.password }, + }); + } + return ( +
+
+

+ لطفا جهت پیگیری درخواست و مشاهده وضعیت آن کد رهگیری و رمز عبور خود را + وارد نمایید. +

+ +
+ +
+ ( + + + کد پیگیری + + + + + + + )} + /> + + ( + + + رمز عبور + + + + + + + )} + /> +
+ +
+ +
+
+ +
+
+ ); +} diff --git a/components/Footer.tsx b/components/Footer.tsx new file mode 100644 index 0000000..722ae5f --- /dev/null +++ b/components/Footer.tsx @@ -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 ( + //
+ +
+
+
+
+
+

+ درباره سامانه سوت زنی +

+ + {aboutFooterItems.map((item) => { + return ( +
+

{item.name}

+
+ ); + })} +
+ +
+

+ دسترسی سریع +

+
    + {footerItems.map((item, index, array) => { + return ( + +
    {item.name}
    + + ); + })} +
+
+
+ +
+
+  Logo1 +
+
+  Logo2 +
+
+
+ +
+
+

+ تمامی حقوق مادی و معنوی این وب سایت متعلق به سوت زنی میباشد. +

+
+
+
+ + //
+ ); +} diff --git a/components/HorizontalChart.tsx b/components/HorizontalChart.tsx new file mode 100644 index 0000000..c724049 --- /dev/null +++ b/components/HorizontalChart.tsx @@ -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 ( + + ) +} diff --git a/components/InspectorOperations.tsx b/components/InspectorOperations.tsx new file mode 100644 index 0000000..0b5feee --- /dev/null +++ b/components/InspectorOperations.tsx @@ -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((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>({ + 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) { + 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 ( +
+ + ( + + متن + +