From f7078d588e7ae3e697456071462e808ed3f10eec Mon Sep 17 00:00:00 2001 From: Hossein Rahmani Date: Tue, 2 Jan 2024 17:22:01 +0330 Subject: [PATCH] First Commit --- .env | 1 + .eslintrc.json | 3 + .gitignore | 36 + .vscode/settings.json | 7 + README.md | 36 + app/CallUs/page.tsx | 8 + app/CitizenLogin/page.tsx | 6 + app/FollowResult/page.tsx | 8 + app/FollowUp/page.tsx | 8 + app/Login/page.tsx | 8 + app/RequestResult/page.tsx | 8 + app/RequestStep1/page.tsx | 8 + app/RequestStep2/page.tsx | 8 + .../AdminDashboard/KeysManagement/page.tsx | 8 + .../AdminDashboard/UserManagement/page.tsx | 8 + .../(Admin)/AdminDashboard/layout.tsx | 16 + app/UserPanel/(Admin)/AdminDashboard/page.tsx | 8 + .../(Citizen)/CitizenDashboard/layout.tsx | 16 + .../(Citizen)/CitizenDashboard/page.tsx | 7 + .../Complaints/[id]/page.tsx | 18 + .../ControllerDashboard/Complaints/page.tsx | 8 + .../ControllerDashboard/Reports/page.tsx | 8 + .../ControllerDashboard/layout.tsx | 21 + .../(Controller)/ControllerDashboard/page.tsx | 8 + app/UserPanel/page.tsx | 7 + app/Verify/page.tsx | 6 + app/components/Landing.tsx | 189 + app/favicon.ico | Bin 0 -> 25931 bytes app/globals.css | 104 + app/layout.tsx | 36 + app/page.tsx | 6 + app/print-styles.css | 13 + components.json | 16 + components/AdminDashboard.tsx | 35 + components/AdminKeysManagement.tsx | 257 + components/AdminUserManagement.tsx | 134 + components/BoxDashboard.tsx | 16 + components/CallUs.tsx | 68 + components/CitizenLogin.tsx | 199 + components/ComplainsDetails.tsx | 202 + components/ControllerDashboard.tsx | 73 + components/Counter.tsx | 84 + components/FollowResult.tsx | 214 + components/FollowUp.tsx | 172 + components/Footer.tsx | 84 + components/HorizontalChart.tsx | 68 + components/InspectorOperations.tsx | 252 + components/LineChart.tsx | 64 + components/Login.tsx | 226 + components/Map.tsx | 48 + components/Navbar.tsx | 63 + components/NavbarPanel.tsx | 77 + components/NavbarSm.tsx | 89 + components/PieChart.tsx | 37 + components/ReportsController.tsx | 106 + components/RequestResult.tsx | 52 + components/RequestStep1.tsx | 166 + components/RequestStep2.tsx | 421 + components/Search.tsx | 120 + components/SubmitRequest.tsx | 59 + components/TabController.tsx | 197 + components/TableAdmin.tsx | 63 + components/TableController.tsx | 174 + components/TopNav.tsx | 61 + components/Verify.tsx | 186 + components/VerticalChart.tsx | 60 + components/ui/alert-dialog.tsx | 147 + components/ui/badge.tsx | 36 + components/ui/button.tsx | 56 + components/ui/dialog.tsx | 122 + components/ui/dropdown-menu.tsx | 205 + components/ui/form.tsx | 176 + components/ui/input.tsx | 31 + components/ui/label.tsx | 26 + components/ui/radio-group.tsx | 44 + components/ui/select.tsx | 164 + components/ui/sonner.tsx | 31 + components/ui/table.tsx | 120 + components/ui/tabs.tsx | 55 + components/ui/textarea.tsx | 26 + components/ui/toast.tsx | 127 + components/ui/toaster.tsx | 35 + components/ui/use-toast.ts | 192 + constants/index.tsx | 237 + fonts/DMSans-Medium.ttf | Bin 0 -> 63880 bytes fonts/IRANYekanWebMedium.ttf | Bin 0 -> 59356 bytes fonts/LibreBaskerville-Italic.ttf | Bin 0 -> 172212 bytes fonts/Roboto-Medium.ttf | Bin 0 -> 168644 bytes fonts/Vazir-Medium-FD-WOL.ttf | Bin 0 -> 55800 bytes fonts/iranyekanwebmediumfanum.ttf | Bin 0 -> 60404 bytes fonts/iranyekanwebregularfanum.ttf | Bin 0 -> 60268 bytes hooks/useDecrypt.tsx | 47 + lib/utils.ts | 42 + next.config.js | 4 + package-lock.json | 8961 +++++++++++++++++ package.json | 76 + postcss.config.js | 6 + public/img/Connector line.svg | 3 + public/img/bg.png | Bin 0 -> 2178940 bytes public/img/bluepoint.svg | 3 + public/img/box1-hover.svg | 17 + public/img/box1.svg | 17 + public/img/box2-hover.svg | 19 + public/img/box2.svg | 21 + public/img/box3-hover.svg | 18 + public/img/box3.svg | 18 + public/img/followResult.png | Bin 0 -> 38948 bytes public/img/footerImg1.png | Bin 0 -> 6949 bytes public/img/footerImg2.png | Bin 0 -> 5603 bytes public/img/greenPoint.png | Bin 0 -> 647 bytes public/img/greenPoint.svg | 3 + public/img/login-icon.svg | 14 + public/img/logo.png | Bin 0 -> 2062 bytes public/img/map.png | Bin 0 -> 794457 bytes public/img/patern.svg | 40 + public/img/paternSvg.png | Bin 0 -> 150604 bytes public/img/pic1.png | Bin 0 -> 69160 bytes public/img/result.png | Bin 0 -> 46718 bytes public/img/tracker-event.png | Bin 0 -> 6820 bytes public/next.svg | 1 + public/vercel.svg | 1 + store/useData.ts | 30 + store/useToken.ts | 22 + tailwind.config.js | 89 + tsconfig.json | 27 + utils/Provider.jsx | 18 + utils/adminApi.ts | 34 + utils/authenticateApi.ts | 68 + utils/citizenApi.ts | 26 + utils/commonApi.ts | 22 + utils/getQueryClient.jsx | 5 + utils/hydrate.client.jsx | 9 + utils/inspectorApi.ts | 32 + 133 files changed, 16298 insertions(+) create mode 100644 .env create mode 100644 .eslintrc.json create mode 100644 .gitignore create mode 100644 .vscode/settings.json create mode 100644 README.md create mode 100644 app/CallUs/page.tsx create mode 100644 app/CitizenLogin/page.tsx create mode 100644 app/FollowResult/page.tsx create mode 100644 app/FollowUp/page.tsx create mode 100644 app/Login/page.tsx create mode 100644 app/RequestResult/page.tsx create mode 100644 app/RequestStep1/page.tsx create mode 100644 app/RequestStep2/page.tsx create mode 100644 app/UserPanel/(Admin)/AdminDashboard/KeysManagement/page.tsx create mode 100644 app/UserPanel/(Admin)/AdminDashboard/UserManagement/page.tsx create mode 100644 app/UserPanel/(Admin)/AdminDashboard/layout.tsx create mode 100644 app/UserPanel/(Admin)/AdminDashboard/page.tsx create mode 100644 app/UserPanel/(Citizen)/CitizenDashboard/layout.tsx create mode 100644 app/UserPanel/(Citizen)/CitizenDashboard/page.tsx create mode 100644 app/UserPanel/(Controller)/ControllerDashboard/Complaints/[id]/page.tsx create mode 100644 app/UserPanel/(Controller)/ControllerDashboard/Complaints/page.tsx create mode 100644 app/UserPanel/(Controller)/ControllerDashboard/Reports/page.tsx create mode 100644 app/UserPanel/(Controller)/ControllerDashboard/layout.tsx create mode 100644 app/UserPanel/(Controller)/ControllerDashboard/page.tsx create mode 100644 app/UserPanel/page.tsx create mode 100644 app/Verify/page.tsx create mode 100644 app/components/Landing.tsx create mode 100644 app/favicon.ico create mode 100644 app/globals.css create mode 100644 app/layout.tsx create mode 100644 app/page.tsx create mode 100644 app/print-styles.css create mode 100644 components.json create mode 100644 components/AdminDashboard.tsx create mode 100644 components/AdminKeysManagement.tsx create mode 100644 components/AdminUserManagement.tsx create mode 100644 components/BoxDashboard.tsx create mode 100644 components/CallUs.tsx create mode 100644 components/CitizenLogin.tsx create mode 100644 components/ComplainsDetails.tsx create mode 100644 components/ControllerDashboard.tsx create mode 100644 components/Counter.tsx create mode 100644 components/FollowResult.tsx create mode 100644 components/FollowUp.tsx create mode 100644 components/Footer.tsx create mode 100644 components/HorizontalChart.tsx create mode 100644 components/InspectorOperations.tsx create mode 100644 components/LineChart.tsx create mode 100644 components/Login.tsx create mode 100644 components/Map.tsx create mode 100644 components/Navbar.tsx create mode 100644 components/NavbarPanel.tsx create mode 100644 components/NavbarSm.tsx create mode 100644 components/PieChart.tsx create mode 100644 components/ReportsController.tsx create mode 100644 components/RequestResult.tsx create mode 100644 components/RequestStep1.tsx create mode 100644 components/RequestStep2.tsx create mode 100644 components/Search.tsx create mode 100644 components/SubmitRequest.tsx create mode 100644 components/TabController.tsx create mode 100644 components/TableAdmin.tsx create mode 100644 components/TableController.tsx create mode 100644 components/TopNav.tsx create mode 100644 components/Verify.tsx create mode 100644 components/VerticalChart.tsx create mode 100644 components/ui/alert-dialog.tsx create mode 100644 components/ui/badge.tsx create mode 100644 components/ui/button.tsx create mode 100644 components/ui/dialog.tsx create mode 100644 components/ui/dropdown-menu.tsx create mode 100644 components/ui/form.tsx create mode 100644 components/ui/input.tsx create mode 100644 components/ui/label.tsx create mode 100644 components/ui/radio-group.tsx create mode 100644 components/ui/select.tsx create mode 100644 components/ui/sonner.tsx create mode 100644 components/ui/table.tsx create mode 100644 components/ui/tabs.tsx create mode 100644 components/ui/textarea.tsx create mode 100644 components/ui/toast.tsx create mode 100644 components/ui/toaster.tsx create mode 100644 components/ui/use-toast.ts create mode 100644 constants/index.tsx create mode 100644 fonts/DMSans-Medium.ttf create mode 100644 fonts/IRANYekanWebMedium.ttf create mode 100644 fonts/LibreBaskerville-Italic.ttf create mode 100644 fonts/Roboto-Medium.ttf create mode 100644 fonts/Vazir-Medium-FD-WOL.ttf create mode 100644 fonts/iranyekanwebmediumfanum.ttf create mode 100644 fonts/iranyekanwebregularfanum.ttf create mode 100644 hooks/useDecrypt.tsx create mode 100644 lib/utils.ts create mode 100644 next.config.js create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 postcss.config.js create mode 100644 public/img/Connector line.svg create mode 100644 public/img/bg.png create mode 100644 public/img/bluepoint.svg create mode 100644 public/img/box1-hover.svg create mode 100644 public/img/box1.svg create mode 100644 public/img/box2-hover.svg create mode 100644 public/img/box2.svg create mode 100644 public/img/box3-hover.svg create mode 100644 public/img/box3.svg create mode 100644 public/img/followResult.png create mode 100644 public/img/footerImg1.png create mode 100644 public/img/footerImg2.png create mode 100644 public/img/greenPoint.png create mode 100644 public/img/greenPoint.svg create mode 100644 public/img/login-icon.svg create mode 100644 public/img/logo.png create mode 100644 public/img/map.png create mode 100644 public/img/patern.svg create mode 100644 public/img/paternSvg.png create mode 100644 public/img/pic1.png create mode 100644 public/img/result.png create mode 100644 public/img/tracker-event.png create mode 100644 public/next.svg create mode 100644 public/vercel.svg create mode 100644 store/useData.ts create mode 100644 store/useToken.ts create mode 100644 tailwind.config.js create mode 100644 tsconfig.json create mode 100644 utils/Provider.jsx create mode 100644 utils/adminApi.ts create mode 100644 utils/authenticateApi.ts create mode 100644 utils/citizenApi.ts create mode 100644 utils/commonApi.ts create mode 100644 utils/getQueryClient.jsx create mode 100644 utils/hydrate.client.jsx create mode 100644 utils/inspectorApi.ts 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 0000000000000000000000000000000000000000..718d6fea4835ec2d246af9800eddb7ffb276240c GIT binary patch literal 25931 zcmeHv30#a{`}aL_*G&7qml|y<+KVaDM2m#dVr!KsA!#An?kSQM(q<_dDNCpjEux83 zLb9Z^XxbDl(w>%i@8hT6>)&Gu{h#Oeyszu?xtw#Zb1mO{pgX9699l+Qppw7jXaYf~-84xW z)w4x8?=youko|}Vr~(D$UXIbiXABHh`p1?nn8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j1M=hu4#Aw173YxIVbISaoc z-nLZC*6Tgivd5V`K%GxhBsp@SUU60-rfc$=wb>zdJzXS&-5(NRRodFk;Kxk!S(O(a0e7oY=E( zAyS;Ow?6Q&XA+cnkCb{28_1N8H#?J!*$MmIwLq^*T_9-z^&UE@A(z9oGYtFy6EZef LrJugUA?W`A8`#=m literal 0 HcmV?d00001 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 ( +
+ + ( + + متن + +