Compare commits
6 Commits
a11f743013
...
39c90f95f1
| Author | SHA1 | Date |
|---|---|---|
|
|
39c90f95f1 | |
|
|
600e6be7ee | |
|
|
cfcd0a89af | |
|
|
e53b00b3f0 | |
|
|
13adfa55df | |
|
|
85b14ee5e8 |
|
|
@ -0,0 +1,7 @@
|
|||
Dockerfile
|
||||
.dockerignore
|
||||
node_modules
|
||||
npm-debug.log
|
||||
README.md
|
||||
.next
|
||||
.git
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
name: build
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
# list of Docker images to use as base name for tags
|
||||
images: |
|
||||
${{ secrets.DOCKER_REGISTRY }}oyoon
|
||||
|
||||
# generate Docker tags based on the following events/attributes
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{major}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{version}}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ secrets.DOCKER_REGISTRY }}
|
||||
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
push: true
|
||||
context: "{{defaultContext}}"
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
FROM node:18-alpine AS base
|
||||
|
||||
# Install dependencies only when needed
|
||||
FROM base AS deps
|
||||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
||||
RUN apk add --no-cache libc6-compat
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies based on the preferred package manager
|
||||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
|
||||
RUN \
|
||||
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
||||
elif [ -f package-lock.json ]; then npm ci; \
|
||||
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
|
||||
else echo "Lockfile not found." && exit 1; \
|
||||
fi
|
||||
|
||||
|
||||
# Rebuild the source code only when needed
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
# Next.js collects completely anonymous telemetry data about general usage.
|
||||
# Learn more here: https://nextjs.org/telemetry
|
||||
# Uncomment the following line in case you want to disable telemetry during the build.
|
||||
# ENV NEXT_TELEMETRY_DISABLED 1
|
||||
|
||||
RUN yarn build
|
||||
|
||||
# If using npm comment out above and use below instead
|
||||
# RUN npm run build
|
||||
|
||||
# Production image, copy all the files and run next
|
||||
FROM base AS runner
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV production
|
||||
# Uncomment the following line in case you want to disable telemetry during runtime.
|
||||
# ENV NEXT_TELEMETRY_DISABLED 1
|
||||
|
||||
RUN addgroup --system --gid 1001 nodejs
|
||||
RUN adduser --system --uid 1001 nextjs
|
||||
|
||||
COPY --from=builder /app/public ./public
|
||||
|
||||
# Automatically leverage output traces to reduce image size
|
||||
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 6678
|
||||
|
||||
ENV PORT 6678
|
||||
|
||||
CMD ["node", "server.js"]
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import ComplainsDetails from "@/components/ComplainsDetails";
|
||||
import React from "react";
|
||||
|
||||
export default function page({ params }: { params: any }) {
|
||||
const id = params.id;
|
||||
return <ComplainsDetails role="Inspector" id={id} />;
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
import TabController from "@/components/TabController";
|
||||
import React from "react";
|
||||
|
||||
export default function page() {
|
||||
return <TabController />;
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
import React from "react";
|
||||
|
||||
export default function page() {
|
||||
return <div>page</div>;
|
||||
}
|
||||
|
|
@ -1,6 +1,13 @@
|
|||
import CitizenLogin from "@/components/CitizenLogin";
|
||||
import React from "react";
|
||||
import { redirect } from "next/navigation";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
export default function page() {
|
||||
const cookieStore = cookies();
|
||||
const token = cookieStore.get("Sootzani_Token");
|
||||
if (token) {
|
||||
redirect("/RequestStep2");
|
||||
}
|
||||
return <CitizenLogin />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,14 @@
|
|||
import CitizenLogin from "@/components/CitizenLogin";
|
||||
import Login from "@/components/Login";
|
||||
import { cookies } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
import React from "react";
|
||||
|
||||
export default function page() {
|
||||
return (
|
||||
<Login />
|
||||
);
|
||||
const cookieStore = cookies();
|
||||
const token = cookieStore.get("Sootzani_Token");
|
||||
if (token) {
|
||||
redirect("/");
|
||||
}
|
||||
return <CitizenLogin />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
import React from 'react'
|
||||
|
||||
export default function page() {
|
||||
return (
|
||||
<div>page</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import AdminCategories from '@/components/AdminCategories'
|
||||
import React from 'react'
|
||||
|
||||
export default function page() {
|
||||
return (
|
||||
<AdminCategories/>
|
||||
)
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import AdminKeysManagement from '@/components/AdminKeysManagement'
|
||||
import React from 'react'
|
||||
|
||||
export default function page() {
|
||||
return (
|
||||
<AdminKeysManagement />
|
||||
)
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
import React from 'react'
|
||||
|
||||
export default function page() {
|
||||
return (
|
||||
<div>page</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import AdminOrganizations from '@/components/AdminOrganizations'
|
||||
import React from 'react'
|
||||
|
||||
export default function page() {
|
||||
return (
|
||||
<AdminOrganizations />
|
||||
)
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import AdminUserManagement from '@/components/AdminUserManagement'
|
||||
import React from 'react'
|
||||
|
||||
export default function page() {
|
||||
return (
|
||||
<AdminUserManagement />
|
||||
)
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
import NavbarPanel from "@/components/NavbarPanel";
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
|
||||
<NavbarPanel />
|
||||
{children}
|
||||
</>
|
||||
)
|
||||
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import AdminDashboard from "@/components/AdminDashboard";
|
||||
import React from "react";
|
||||
|
||||
export default function page() {
|
||||
return (
|
||||
<AdminDashboard />
|
||||
);
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
import NavbarPanel from "@/components/NavbarPanel";
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
|
||||
<NavbarPanel />
|
||||
{children}
|
||||
</>
|
||||
)
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
import React from 'react'
|
||||
|
||||
export default function page() {
|
||||
return (
|
||||
<div>page</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
import ComplainsDetails from "@/components/ComplainsDetails";
|
||||
import React from "react";
|
||||
|
||||
export default function page({ params }: { params: any }) {
|
||||
const id = params.id;
|
||||
{
|
||||
console.log(params);
|
||||
}
|
||||
{
|
||||
console.log(id);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="w-[90vw] sm:w-[90vw] lg:w-[85vw] xl:w-[75vw] 3xl:w-[70vw] mt-16 sm:mt-8 pt-9 mx-auto mb-10">
|
||||
<ComplainsDetails role="Inspector" id={id} />;
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import TabController from '@/components/TabController'
|
||||
import React from 'react'
|
||||
|
||||
export default function page() {
|
||||
return (
|
||||
<TabController />
|
||||
)
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import ReportsController from '@/components/ReportsController'
|
||||
import React from 'react'
|
||||
|
||||
export default function page() {
|
||||
return (
|
||||
<ReportsController />
|
||||
)
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
import NavbarPanel from "@/components/NavbarPanel";
|
||||
import { cookies } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
// const cookieStore = cookies();
|
||||
// const token = cookieStore.get("Sootzani-Token");
|
||||
// if (!token.value) {
|
||||
// return redirect("/");
|
||||
// }
|
||||
return (
|
||||
<>
|
||||
<NavbarPanel />
|
||||
{children}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import ControllerDashboard from "@/components/ControllerDashboard";
|
||||
import React from "react";
|
||||
|
||||
export default function page() {
|
||||
return (
|
||||
<ControllerDashboard />
|
||||
);
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
import React from 'react'
|
||||
|
||||
export default function page() {
|
||||
return (
|
||||
<div>Userpage</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -35,7 +35,6 @@ export default function Landing() {
|
|||
clickable: true,
|
||||
}}
|
||||
modules={[Autoplay]}
|
||||
|
||||
className="mySwiper w-full h-full"
|
||||
>
|
||||
{sliderItems.map((item) => {
|
||||
|
|
@ -118,14 +117,14 @@ export default function Landing() {
|
|||
className=" w-1/2 max-lg:w-full border rounded-lg flex flex-row shadow-md hover:shadow-none transition-all
|
||||
max-lg:h-[14em] max-md:h-[12em] max-sm:h-[22em] max-sm:flex-col max-sm:gap-[3px]"
|
||||
>
|
||||
<div className="w-1/2 h-full rounded-r-lg bg-rose-400 max-sm:h-1/2 max-md:w-1/3 max-sm:w-full">
|
||||
<div className="w-1/2 h-full rounded-r-lg max-sm:h-1/2 max-md:w-1/3 max-sm:w-full">
|
||||
<Image
|
||||
alt="picture"
|
||||
src="/img/pic1.png"
|
||||
height={500}
|
||||
width={500}
|
||||
style={{ objectFit: "fill", objectPosition: "center" }}
|
||||
className="w-full h-full rounded-r-lg"
|
||||
quality={100}
|
||||
className="w-full h-full rounded-r-lg bg-cover object-cover object-top"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
@ -137,7 +136,7 @@ export default function Landing() {
|
|||
24 آذر ماه 1402
|
||||
</p>
|
||||
<p className="text-base font-medium text-right text-black line-clamp-1">
|
||||
شروع به کار سامانه سوت زنی
|
||||
شروع به کار سامانه عیون
|
||||
</p>
|
||||
<p className="text-sm font-normal text-justify text-[#3C3C43D9] line-clamp-5 max-md:line-clamp-2">
|
||||
این سامانه با هدف نظارت بر عملکرد پرستل و نهادهای مرتبط با امور
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
import React from 'react'
|
||||
|
||||
export default function AdminCategories() {
|
||||
return (
|
||||
<div>AdminCategories</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
import React from "react";
|
||||
import BoxDashboard from "./BoxDashboard";
|
||||
import LineChart from "./LineChart";
|
||||
import { HorizontalChart } from "./HorizontalChart";
|
||||
import { VerticalChart } from "./VerticalChart";
|
||||
import { PieChart } from "./PieChart";
|
||||
|
||||
export default function AdminDashboard() {
|
||||
return (
|
||||
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-8 max-sm:mt-16 pt-9">
|
||||
|
||||
<div className="w-full mb-6 flex flex-col gap-4 ">
|
||||
|
||||
<div className="w-full md:h-36 flex flex-row max-md:flex-wrap justify-center md:justify-between gap-3 ">
|
||||
<BoxDashboard />
|
||||
<BoxDashboard />
|
||||
<BoxDashboard />
|
||||
<BoxDashboard />
|
||||
<BoxDashboard />
|
||||
<BoxDashboard />
|
||||
</div>
|
||||
|
||||
<div className="w-full flex flex-col md:flex-row gap-12 md:gap-1 ">
|
||||
<div className="w-full md:w-1/3 h-full flex justify-center">
|
||||
<PieChart />
|
||||
</div>
|
||||
<hr />
|
||||
<div className="w-full md:w-2/3 h-full flex justify-center">
|
||||
<VerticalChart />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,556 +0,0 @@
|
|||
"use client";
|
||||
|
||||
import React, { useState, useRef } from "react";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { GenerateKeyPair, GetKeys, AddKey, ChangeKey } from "@/utils/adminApi";
|
||||
import { FaRegEdit } from "react-icons/fa";
|
||||
import { IoMdClose } from "react-icons/io";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
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";
|
||||
import { toast } from "sonner";
|
||||
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
import * as z from "zod";
|
||||
|
||||
const MAX_FILE_SIZE = 5242880; // 5 MB
|
||||
// Edit Key Form
|
||||
const FormSchemaEditKey = z.object({
|
||||
uploadPrivateKey: z.any(),
|
||||
// .instanceof(File)
|
||||
|
||||
// .custom<FileList>((val) => val instanceof FileList, "Required")
|
||||
// .refine((files) => files.length <= 1, "Maximum of 1 file is allowed.")
|
||||
// .refine(
|
||||
// (files) =>
|
||||
// Array.from(files).every((file) => file.size <= MAX_IMAGE_SIZE),
|
||||
// "Each file size should be less than 5 MB."
|
||||
// ),
|
||||
|
||||
// .refine((files) => files?.length === 0, "File is required.")
|
||||
// .refine((files) => files?.length >= 1, "Maximum of 1 file is allowed.")
|
||||
// .refine((files) => files?.[0]?.size <= MAX_FILE_SIZE, `Max file size is 5MB.`)
|
||||
|
||||
// publicKeyId: z
|
||||
// .string()
|
||||
// .nullable(),
|
||||
});
|
||||
|
||||
// Add Key Form
|
||||
const FormSchemaAddKey = z.object({
|
||||
title: z.string().min(2, {
|
||||
message: "عنوان کلید را وارد کنید",
|
||||
}),
|
||||
publicKey: z.string().min(4, {
|
||||
message: "کلید عمومی را وارد کنید",
|
||||
}),
|
||||
});
|
||||
|
||||
export default function AdminKeysManagement() {
|
||||
const router = useRouter();
|
||||
const [keyId, setKeyId] = useState("");
|
||||
const [openAdd, setOpenAdd] = React.useState(false);
|
||||
const [openEdit, setOpenEdit] = React.useState(false);
|
||||
|
||||
|
||||
|
||||
const inputPubRef = useRef<HTMLInputElement | null>(null);;
|
||||
const inputPrvRef = useRef<HTMLInputElement | null>(null);;
|
||||
|
||||
// ..............Read .txt
|
||||
const [selectedFile, setSelectedFile] = useState<any>(null);
|
||||
const handleFileChange = (event: any) => {
|
||||
const file = event.target.files[0];
|
||||
const reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
const contents = e?.target?.result;
|
||||
// Process the contents of the file here
|
||||
setSelectedFile(contents);
|
||||
console.log(contents);
|
||||
};
|
||||
reader?.readAsText(file);
|
||||
|
||||
console.log(reader);
|
||||
console.log(selectedFile);
|
||||
};
|
||||
|
||||
// Edit Form
|
||||
const formEdit = useForm<z.infer<typeof FormSchemaEditKey>>({
|
||||
resolver: zodResolver(FormSchemaEditKey),
|
||||
defaultValues: {
|
||||
// publicKeyId: "",
|
||||
// uploadFile: null,
|
||||
},
|
||||
});
|
||||
|
||||
// ............'Mutation' Change Key Submit
|
||||
const ChangeKeyMutation = useMutation({
|
||||
mutationKey: ["ChangeKey"],
|
||||
mutationFn: ChangeKey,
|
||||
onSuccess: (res) => {
|
||||
console.log(res);
|
||||
// alert("Success");
|
||||
console.log("Success ChangeKey");
|
||||
setOpenEdit(false);
|
||||
|
||||
|
||||
toast("عملیات شما با موفقیت انجام شد. ", {
|
||||
className: "!bg-green-500 !text-white",
|
||||
});
|
||||
|
||||
// router.refresh()
|
||||
},
|
||||
onError: (error) => {
|
||||
console.log(error);
|
||||
console.log(error?.message);
|
||||
|
||||
setOpenEdit(false);
|
||||
|
||||
toast(error?.message, {
|
||||
className: "!bg-red-500 !text-black",
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
function onSubmitEdit(data: z.infer<typeof FormSchemaEditKey>) {
|
||||
console.log("bcbcbbcbcbc" + data);
|
||||
console.log("bcbcbbcbcbccc" + selectedFile);
|
||||
console.log("bcbcbbcbcbccccc" + data1[0]?.id);
|
||||
|
||||
// if (keyId) {
|
||||
ChangeKeyMutation.mutate({
|
||||
privateKey: selectedFile,
|
||||
publicKeyId: keyId,
|
||||
|
||||
// publicKeyId: data1?.id,
|
||||
});
|
||||
// }
|
||||
// else{
|
||||
// console.error("keyId is undefined");
|
||||
// }
|
||||
}
|
||||
|
||||
// Add Form
|
||||
const formAdd = useForm<z.infer<typeof FormSchemaAddKey>>({
|
||||
resolver: zodResolver(FormSchemaAddKey),
|
||||
defaultValues: {
|
||||
title: "",
|
||||
publicKey: "",
|
||||
},
|
||||
});
|
||||
|
||||
// ............'Mutation' Add Key Submit
|
||||
const AddKeyMutation = useMutation({
|
||||
mutationKey: ["AddKey"],
|
||||
mutationFn: AddKey,
|
||||
onSuccess: (res) => {
|
||||
console.log(res);
|
||||
console.log("Success AddKey");
|
||||
|
||||
setOpenAdd(false);
|
||||
|
||||
refetch1();
|
||||
formAdd.reset();
|
||||
|
||||
if (inputPubRef.current && inputPrvRef.current) {
|
||||
inputPrvRef.current.value = "";
|
||||
inputPubRef.current.value = "";
|
||||
}
|
||||
|
||||
toast("عملیات شما با موفقیت انجام شد. ", {
|
||||
className: "!bg-green-500 !text-white",
|
||||
});
|
||||
|
||||
// inputPubRef.current.clear();
|
||||
// router.refresh()
|
||||
},
|
||||
onError: (error) => {
|
||||
console.log(error);
|
||||
console.log(error?.message);
|
||||
setOpenAdd(false);
|
||||
|
||||
toast(error?.message, {
|
||||
className: "!bg-red-500 !text-black",
|
||||
});
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
function onSubmitAdd(data: z.infer<typeof FormSchemaAddKey>) {
|
||||
AddKeyMutation.mutate({
|
||||
title: data.title,
|
||||
publicKey: data.publicKey,
|
||||
});
|
||||
}
|
||||
const { resetField } = useForm();
|
||||
|
||||
// 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 handleClickGenerate = () => {
|
||||
refetch2();
|
||||
|
||||
if (inputPubRef.current && inputPrvRef.current) {
|
||||
inputPubRef.current.value = data2?.publicKey ?? '';
|
||||
inputPrvRef.current.value = data2?.privateKey ?? '';
|
||||
}
|
||||
console.log(data2);
|
||||
};
|
||||
|
||||
const handleClickAddKey = () => {
|
||||
// refetch2();
|
||||
console.log(data1);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="w-full bg-[#F5F5F5] min-h-[85vh] flex justify-center">
|
||||
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
||||
{/* 1 */}
|
||||
<AlertDialog open={openAdd} onOpenChange={setOpenAdd}>
|
||||
<AlertDialogTrigger asChild>
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={handleClickAddKey}
|
||||
className="bg-orange-500 text-white"
|
||||
// disabled={isNewKeyLoading}
|
||||
>
|
||||
افزودن کلید جدید
|
||||
</Button>
|
||||
</AlertDialogTrigger>
|
||||
<AlertDialogContent className=" w-full max-w-6xl h-full max-h-[90vh] lg:max-h-[70vh]">
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>
|
||||
<p className="text-[#464646] text-base font-bold">
|
||||
افزودن کلید جدید
|
||||
</p>
|
||||
<AlertDialogCancel className="p-0 border-0 h-auto">
|
||||
<IoMdClose />
|
||||
</AlertDialogCancel>
|
||||
</AlertDialogTitle>
|
||||
|
||||
<AlertDialogDescription>
|
||||
<div className="w-full ">
|
||||
<div className="w-full text-right text-neutral-600 text-lg font-bold mb-4">
|
||||
ایجاد جفت کلید جدید
|
||||
</div>
|
||||
|
||||
{isNewKeyLoading ? (
|
||||
<div className="felx justify-center items-center self-center">
|
||||
<ThreeDots
|
||||
visible={true}
|
||||
height="50"
|
||||
width="100"
|
||||
color="#003778"
|
||||
radius="9"
|
||||
ariaLabel="three-dots-loading"
|
||||
wrapperStyle={{}}
|
||||
wrapperClass=""
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={handleClickGenerate}
|
||||
disabled={isNewKeyLoading}
|
||||
className="my-2"
|
||||
>
|
||||
{" "}
|
||||
ایجاد جفت کلید
|
||||
</Button>
|
||||
{isNewKeyLoading ? (
|
||||
<div className="felx justify-center items-center self-center h-full">
|
||||
<ThreeDots
|
||||
visible={true}
|
||||
height="20"
|
||||
width="50"
|
||||
color="#003778"
|
||||
radius="9"
|
||||
ariaLabel="three-dots-loading"
|
||||
wrapperStyle={{}}
|
||||
wrapperClass=""
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div
|
||||
className="flex flex-row flex-wrap justify-between"
|
||||
id="KeyFetch"
|
||||
>
|
||||
<div className=" w-full lg:w-[48%]">
|
||||
<p className="text-[#7C838A] text-sm font-semibold">
|
||||
کلید عمومی :
|
||||
</p>
|
||||
{/* <p className="text-slate-700 text-sm text-left mb-4">
|
||||
{data2?.publicKey}
|
||||
</p> */}
|
||||
<Input
|
||||
name="pubKey"
|
||||
ref={inputPubRef}
|
||||
// value={data2?.publicKey}
|
||||
readOnly={true}
|
||||
className="text-slate-700 text-sm text-left mb-4 w-full bg-white"
|
||||
/>
|
||||
</div>
|
||||
<div className=" w-full lg:w-[48%]">
|
||||
<p className="text-[#7C838A] text-sm font-semibold">
|
||||
کلید خصوصی :
|
||||
</p>
|
||||
{/* <p className="text-slate-700 text-sm text-left mb-4">
|
||||
{data2?.privateKey}
|
||||
</p> */}
|
||||
<Input
|
||||
ref={inputPrvRef}
|
||||
name="privKey"
|
||||
// value={data2?.privateKey}
|
||||
readOnly={true}
|
||||
className="text-slate-700 text-sm text-left mb-4 w-full bg-white"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="w-full text-right text-neutral-600 text-lg font-bold mt-4 mb-2">
|
||||
افزودن کلید جدید
|
||||
</div>
|
||||
|
||||
<Form {...formAdd}>
|
||||
<form
|
||||
onSubmit={formAdd.handleSubmit(onSubmitAdd)}
|
||||
className="w-full flex flex-col mt-6 "
|
||||
>
|
||||
<div className="flex flex-row flex-wrap justify-between">
|
||||
<FormField
|
||||
control={formAdd.control}
|
||||
name="title"
|
||||
render={({ field }) => (
|
||||
<FormItem className=" w-full lg:w-[48%]">
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium">
|
||||
عنوان کلید
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
placeholder="عنوان کلید را وارد نمایید"
|
||||
{...field}
|
||||
className="bg-white"
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={formAdd.control}
|
||||
name="publicKey"
|
||||
render={({ field }) => (
|
||||
<FormItem className=" w-full lg:w-[48%]">
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium ">
|
||||
کلید عمومی
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
placeholder="کلید عمومی را وارد کنید"
|
||||
{...field}
|
||||
className="bg-white"
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
|
||||
<Button
|
||||
type="submit"
|
||||
className="bg-blue text-white min-w-max w-1/2 sm:w-1/3 lg:w-1/4 p-2 rounded-xl text-center"
|
||||
>
|
||||
افزودن کلید
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Form>
|
||||
</div>
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
{/* <AlertDialogCancel>بستن</AlertDialogCancel> */}
|
||||
{/* <AlertDialogAction>Continue</AlertDialogAction> */}
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
|
||||
{/* 2 */}
|
||||
<div className="w-full text-right text-neutral-600 text-lg font-bold my-4">
|
||||
لیست کلیدها
|
||||
</div>
|
||||
<div className="w-full flex flex-row flex-wrap justify-between gap-8 md:gap-4 ">
|
||||
{data1?.map((item: any) => {
|
||||
return (
|
||||
<div
|
||||
key={item.id}
|
||||
className={`flex flex-col justify-center gap-2 w-full lg:w-[49%] h-28 px-5 rounded-md shadow-md items-start
|
||||
`}
|
||||
>
|
||||
<p className=" text-slate-500 text-sm font-normal leading-normal">
|
||||
عنوان کلید :
|
||||
<span className=" text-slate-800">{item.title}</span>
|
||||
</p>
|
||||
<p className=" text-slate-500 text-sm font-normal leading-normal">
|
||||
آی دی بازرس :
|
||||
<span className=" text-slate-800 self-end">
|
||||
{item.inspectorId}
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<AlertDialog open={openEdit} onOpenChange={setOpenEdit}>
|
||||
<AlertDialogTrigger asChild>
|
||||
{/* <Button variant="outline">Show Dialog</Button> */}
|
||||
<FaRegEdit
|
||||
aria-hidden="true"
|
||||
className="w-6 h-6 text-slate-600 hover:cursor-pointer self-end"
|
||||
onClick={() => setKeyId(item?.id)}
|
||||
/>
|
||||
</AlertDialogTrigger>
|
||||
<AlertDialogContent className=" w-full max-w-3xl h-full lg:max-h-[20em] max-h-[23em]">
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>تغییر کلید</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
<Form {...formEdit}>
|
||||
<form
|
||||
onSubmit={formEdit.handleSubmit(onSubmitEdit)}
|
||||
className="w-full flex flex-col mt-6 "
|
||||
>
|
||||
<div className="flex flex-row flex-wrap justify-between">
|
||||
<FormField
|
||||
control={formEdit.control}
|
||||
name="uploadPrivateKey"
|
||||
render={({ field }) => (
|
||||
<FormItem className=" w-full">
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium mb-2">
|
||||
پیوست (کلید خصوصی)
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
required={true}
|
||||
type="file"
|
||||
accept=".txt"
|
||||
className="bg-slate-300 mt-2"
|
||||
// {...field}
|
||||
onChange={handleFileChange}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
{/* <FormField
|
||||
control={formEdit.control}
|
||||
name="publicKeyId"
|
||||
render={({ field }) => (
|
||||
<FormItem className=" w-full lg:w-[48%]">
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium ">
|
||||
آی دی کلید عمومی
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
className="bg-slate-300 mt-2"
|
||||
value={item?.id}
|
||||
readOnly={true}
|
||||
// {...field}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/> */}
|
||||
</div>
|
||||
|
||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
|
||||
<Button
|
||||
// href="/FollowResult"
|
||||
type="submit"
|
||||
className="bg-blue text-white min-w-max p-2 rounded-xl text-center hover:bg-white hover:text-slate-800"
|
||||
>
|
||||
تغییر کلید
|
||||
</Button>
|
||||
|
||||
{/* <AlertDialogAction
|
||||
type="submit"
|
||||
className="bg-blue text-white min-w-max p-2 rounded-xl text-center hover:bg-white hover:text-slate-800"
|
||||
>
|
||||
تغییر کلید
|
||||
</AlertDialogAction> */}
|
||||
|
||||
<AlertDialogCancel className="bg-blue text-white rounded-xl mt-0">
|
||||
بستن
|
||||
</AlertDialogCancel>
|
||||
</div>
|
||||
</form>
|
||||
</Form>
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
{/* <AlertDialogAction>Continue</AlertDialogAction> */}
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
import React from 'react'
|
||||
|
||||
export default function AdminOrganizations() {
|
||||
return (
|
||||
<div>AdminOrganizations</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -1,134 +0,0 @@
|
|||
"use client";
|
||||
import React from "react";
|
||||
import Search from "./Search";
|
||||
import { MdOutlineManageSearch } from "react-icons/md";
|
||||
import { IoIosArrowDown } from "react-icons/io";
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuGroup,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuLabel,
|
||||
DropdownMenuPortal,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuShortcut,
|
||||
DropdownMenuSub,
|
||||
DropdownMenuSubContent,
|
||||
DropdownMenuSubTrigger,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
|
||||
import { Button } from "./ui/button";
|
||||
import { AdminCardItems } from "@/constants";
|
||||
import TableAdmin from "./TableAdmin";
|
||||
|
||||
export default function AdminUserManagement() {
|
||||
return (
|
||||
<div className="w-full bg-[#F5F5F5] min-h-[85vh] flex justify-center">
|
||||
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
||||
<div className="w-full flex flex-col gap-5 ">
|
||||
{/* 1 */}
|
||||
<div className="w-full flex flex-col justify-start gap-3">
|
||||
<div className="w-full text-right text-neutral-600 text-lg font-bold">
|
||||
مدیریت کاربران
|
||||
</div>
|
||||
|
||||
<div className="w-full flex flex-col lg:flex-row justify-center items-center gap-6 ">
|
||||
<div className="w-full lg:w-3/5 h-11 bg-white rounded-[5px] block">
|
||||
<Search mode="admin" />
|
||||
</div>
|
||||
|
||||
<div className="w-full lg:w-2/5 flex flex-row justify-between items-center gap-2 ">
|
||||
<MdOutlineManageSearch size="1.5em" />
|
||||
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button
|
||||
variant="link"
|
||||
className="gap-3 hover:no-underline focus-visible:ring-0"
|
||||
>
|
||||
<IoIosArrowDown /> جستجوی پیشرفته
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent className="w-56">
|
||||
<DropdownMenuLabel>My Account</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuGroup>
|
||||
<DropdownMenuItem>
|
||||
Profile
|
||||
<DropdownMenuShortcut>⇧P</DropdownMenuShortcut>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem>
|
||||
Billing
|
||||
<DropdownMenuShortcut>⇧B</DropdownMenuShortcut>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuGroup>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button
|
||||
variant="link"
|
||||
className="gap-3 hover:no-underline focus-visible:ring-0"
|
||||
>
|
||||
<IoIosArrowDown /> مرتب سازی
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent className="w-56">
|
||||
<DropdownMenuLabel>My Account</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuGroup>
|
||||
<DropdownMenuItem>
|
||||
Profile
|
||||
<DropdownMenuShortcut>⇧P</DropdownMenuShortcut>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem>
|
||||
Billing
|
||||
<DropdownMenuShortcut>⇧B</DropdownMenuShortcut>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuGroup>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
|
||||
<Button className=" bg-blue hover:bg-blue/90 rounded-lg">
|
||||
+ افزودن کاربر
|
||||
</Button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 2 */}
|
||||
<div className="w-full flex flex-row max-md:flex-wrap justify-center gap-3">
|
||||
{AdminCardItems.map((item) => {
|
||||
return (
|
||||
<div
|
||||
key={item.id}
|
||||
className=" flex flex-col justify-center items-end gap-2 w-2/5 lg:w-1/4 h-28 px-5 bg-white rounded-md shadow-md"
|
||||
>
|
||||
<p className=" text-slate-400 text-sm font-normal leading-none">
|
||||
{item.name}
|
||||
</p>
|
||||
<p className=" text-slate-800 text-xl font-bold leading-normal">
|
||||
{item.count}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
{/* 3 */}
|
||||
<div className="w-full flex flex-col justify-start bg-white rounded-md">
|
||||
<div className="w-full text-right text-neutral-600 text-lg font-bold py-5 pr-4">
|
||||
لیست کاربران
|
||||
</div>
|
||||
|
||||
<TableAdmin />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
"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";
|
||||
const Map = dynamic(() => import("./Map"), {
|
||||
ssr: false,
|
||||
});
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
export default function CallUs(props: any) {
|
||||
const { position, zoom } = props;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import React, { useEffect } from "react";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
import * as z from "zod";
|
||||
|
|
@ -26,6 +26,7 @@ import { getCaptcha } from "@/utils/commonApi";
|
|||
import { useRouter } from "next/navigation";
|
||||
import { Oval, ThreeDots } from "react-loader-spinner";
|
||||
import useData from "@/store/useData";
|
||||
import { getCookie } from "cookies-next";
|
||||
const FormSchema = z.object({
|
||||
phoneNumber: z.string().min(1, {
|
||||
message: "لطفا شماره موبایل خود را وارد نمایید.",
|
||||
|
|
@ -73,6 +74,7 @@ export default function CitizenLogin() {
|
|||
value: data.captcha,
|
||||
},
|
||||
};
|
||||
refetch()
|
||||
loginMutation.mutate(payload);
|
||||
saveData({
|
||||
phoneNumber: data.phoneNumber,
|
||||
|
|
@ -83,6 +85,7 @@ export default function CitizenLogin() {
|
|||
? URL.createObjectURL(CaptchaData.data)
|
||||
: null;
|
||||
|
||||
|
||||
return (
|
||||
<div
|
||||
className="w-full mt-12 sm:w-2/3 md:w-2/4 xl:w-1/3 bg-white rounded-lg dark:border xl:p-0 dark:bg-gray-800 dark:border-gray-700 shadow-[0px_0px_15px_0px_#00000040]
|
||||
|
|
|
|||
|
|
@ -1,17 +1,29 @@
|
|||
"use client";
|
||||
import React, { useEffect } from "react";
|
||||
import React, { useEffect, useState } 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";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Dialog,
|
||||
DialogClose,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@/components/ui/dialog";
|
||||
import { Input } from "./ui/input";
|
||||
import { toast } from "sonner";
|
||||
import { useRouter } from "next/navigation";
|
||||
export default function ComplainsDetails({
|
||||
id,
|
||||
role,
|
||||
|
|
@ -21,45 +33,83 @@ export default function ComplainsDetails({
|
|||
role: string;
|
||||
Data?: any;
|
||||
}) {
|
||||
const [open, setOpen] = useState<boolean>(true);
|
||||
const [password, setPassword] = useState<any>(true);
|
||||
const router = useRouter();
|
||||
const storeData = useData((state) => state.data);
|
||||
let data;
|
||||
|
||||
const getComplaintMutation = useMutation<
|
||||
any,
|
||||
Error,
|
||||
{ trackingNumber: string; password: string }
|
||||
>({
|
||||
const getComplaintMutation = useMutation({
|
||||
mutationKey: ["Complaint", id],
|
||||
mutationFn:
|
||||
role == "Inspector"
|
||||
? (getComplaint as any)
|
||||
: (postComplaintTracking as any),
|
||||
onSuccess: (res) => {},
|
||||
onError: (err) => {},
|
||||
mutationFn: postComplaintTracking,
|
||||
onSuccess: (res) => {
|
||||
setOpen(false);
|
||||
},
|
||||
onError: (err) => {
|
||||
toast("رمز عبور شما صحیح نمیباشد.", {
|
||||
className: "!bg-red-500 !text-white",
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const handelPassword = () => {
|
||||
const payload = { ...storeData, password: password };
|
||||
getComplaintMutation.mutate({ Data: payload });
|
||||
};
|
||||
console.log(storeData);
|
||||
|
||||
useEffect(() => {
|
||||
if (role == "Inspector") {
|
||||
useData.persist.rehydrate();
|
||||
}
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
if (storeData && role == "Inspector") {
|
||||
getComplaintMutation.mutate(storeData);
|
||||
}
|
||||
// if (storeData && role == "Inspector") {
|
||||
// getComplaintMutation.mutate(storeData);
|
||||
// }
|
||||
}, [storeData]);
|
||||
|
||||
if (getComplaintMutation.isSuccess) {
|
||||
data = getComplaintMutation.data;
|
||||
} else if (Data) {
|
||||
data = Data;
|
||||
}
|
||||
console.log(Data);
|
||||
if (open) {
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
<DialogContent dir="rtl" className="sm:max-w-[425px]">
|
||||
<DialogHeader dir="rtl">
|
||||
<DialogTitle dir="rtl">رمز عبور</DialogTitle>
|
||||
<DialogDescription>
|
||||
برای مشاهده درخواست پسورد خود را وارد نمایید.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div className="grid w-full max-w-sm items-center gap-1.5">
|
||||
{/* <Label htmlFor="picture">Picture</Label> */}
|
||||
<Input
|
||||
dir="rtl"
|
||||
id="picture"
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<Button
|
||||
onClick={() => router.push("/Account/Complaints")}
|
||||
type="button"
|
||||
variant="outline"
|
||||
className=" ml-2"
|
||||
>
|
||||
بازگشت
|
||||
</Button>
|
||||
{/* <DialogClose asChild> */}
|
||||
<Button onClick={handelPassword} type="submit">
|
||||
تایید
|
||||
</Button>
|
||||
{/* </DialogClose> */}
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<>
|
||||
{data ? (
|
||||
<div className="w-full flex max-lg:flex-col gap-3 items-start">
|
||||
<div className=" w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] flex max-lg:flex-col gap-3 items-start mt-5">
|
||||
<div className="flex flex-col w-full lg:w-1/3 lg:order-2 gap-3 lg:sticky top-40">
|
||||
<div className=" bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col">
|
||||
<p className="text-[#464646] text-base font-bold">گزارش شکایت</p>
|
||||
|
|
@ -73,7 +123,9 @@ export default function ComplainsDetails({
|
|||
<p className="text-[#464646] text-sm font-medium">
|
||||
دستگاه مربوطه:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{/* {data.title} */}
|
||||
{data?.complaintOrganization
|
||||
? data?.complaintOrganization.title
|
||||
: "-"}
|
||||
</span>
|
||||
</p>
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
|
|
|
|||
|
|
@ -1,73 +0,0 @@
|
|||
"use client";
|
||||
import React from "react";
|
||||
import BoxDashboard from "./BoxDashboard";
|
||||
import LineChart from "./LineChart";
|
||||
import { HorizontalChart } from "./HorizontalChart";
|
||||
import { getComplaintsList } from "@/utils/inspectorApi";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import useDecrypt from "@/hooks/useDecrypt";
|
||||
|
||||
export default function ControllerDashboard() {
|
||||
const { data, isLoading, refetch } = useQuery({
|
||||
queryKey: ["ComplaintsList"],
|
||||
queryFn: () => getComplaintsList(),
|
||||
refetchOnWindowFocus: false,
|
||||
});
|
||||
console.log(data);
|
||||
const [decryptedMessage, errorMessage] = useDecrypt(
|
||||
"gJoT9AqK7wk1MZFSD04yXXfF36fzsOL+RYtJfySrEnQeJ7VoaL7pmOU6nB3+0+PQcaxIi3hf1AHjzIB0Cn5oHgKROeoI4XslhAezZk23QhtIU4HUF1wpeOJfA+4hWyRfbh4fI9774sa/KL47VaBbrNM/rvBxk6hjlKx5mTb3hqM="
|
||||
);
|
||||
console.log(decryptedMessage);
|
||||
if (data) {
|
||||
}
|
||||
console.log(errorMessage);
|
||||
if (data) {
|
||||
}
|
||||
return (
|
||||
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-8 max-sm:mt-16 pt-9">
|
||||
{/* Lg Show */}
|
||||
<div className="w-full h-[45vh] mb-6 flex-row gap-0 hidden lg:flex">
|
||||
<div className="w-1/5 flex flex-col gap-8 pl-6">
|
||||
<BoxDashboard />
|
||||
<BoxDashboard />
|
||||
</div>
|
||||
|
||||
<div className="w-4/5 bg-[#EFEFEF80] rounded-lg flex justify-center">
|
||||
<LineChart />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="w-full flex-row gap-6 h-[20vh] hidden lg:flex">
|
||||
<div className="w-3/5 flex flex-row gap-7">
|
||||
<BoxDashboard />
|
||||
<BoxDashboard />
|
||||
<BoxDashboard />
|
||||
</div>
|
||||
<div className="w-2/5 flex justify-end">
|
||||
<HorizontalChart />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* max Lg show */}
|
||||
<div className="w-full mb-6 flex-col gap-12 flex lg:hidden">
|
||||
<div className="w-full flex flex-row flex-wrap justify-center gap-4 ">
|
||||
<BoxDashboard />
|
||||
<BoxDashboard />
|
||||
<BoxDashboard />
|
||||
<BoxDashboard />
|
||||
<BoxDashboard />
|
||||
</div>
|
||||
|
||||
<div className="w-full flex flex-col gap-12 ">
|
||||
<div className="h-1/2">
|
||||
<LineChart />
|
||||
</div>
|
||||
<hr />
|
||||
<div className="h-1/2">
|
||||
<HorizontalChart />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -195,7 +195,7 @@ export default function FollowResult() {
|
|||
</div>
|
||||
<ComplainsDetails
|
||||
role="Citizen"
|
||||
Data={complaintPrintMutation?.data}
|
||||
// Data={complaintPrintMutation?.data}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
|
|
|
|||
|
|
@ -11,20 +11,20 @@ export default function Footer() {
|
|||
// <div classNameName="flex justify-center items-center w-full bg-blue ">
|
||||
|
||||
<footer className="bg-blue dark:bg-gray-900">
|
||||
<div
|
||||
className="mx-auto w-full max-w-screen-3xl px-4 py-7 md:px-8 md:py-8 lg:pt-14 lg:pb-7 lg:px-11 "
|
||||
>
|
||||
<div className="mx-auto w-full max-w-screen-3xl px-4 py-7 md:px-8 md:py-8 lg:pt-14 lg:pb-7 lg:px-11 ">
|
||||
<div className="md:flex md:justify-between w-full ">
|
||||
<div className="grid gap-10 sm:gap-16 md:gap-20 lg:gap-28 grid-cols-1 w-full md:grid-cols-2 md:w-3/4 lg:w-2/4">
|
||||
<div>
|
||||
<h2 className="text-white text-sm sm:text-base font-bold mb-4 ">
|
||||
درباره سامانه سوت زنی
|
||||
درباره سامانه عیون
|
||||
</h2>
|
||||
|
||||
{aboutFooterItems.map((item) => {
|
||||
return (
|
||||
<div key={item.id}>
|
||||
<p className=" text-white text-xs md:text-sm font-normal md:leading-7">{item.name}</p>
|
||||
<p className=" text-white text-xs md:text-sm font-normal md:leading-7">
|
||||
{item.name}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
|
@ -38,7 +38,9 @@ export default function Footer() {
|
|||
{footerItems.map((item, index, array) => {
|
||||
return (
|
||||
<Link key={item.id} href={item.href}>
|
||||
<div className=" text-white text-xs md:text-sm font-normal leading-6 mb-3">{item.name}</div>
|
||||
<div className=" text-white text-xs md:text-sm font-normal leading-6 mb-3">
|
||||
{item.name}
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
|
|
@ -73,7 +75,7 @@ export default function Footer() {
|
|||
<hr className=" border-gray-200 sm:mx-auto dark:border-gray-700 mt-5 sm:mt-10" />
|
||||
<div className="sm:flex sm:items-center sm:justify-between">
|
||||
<p className="text-white text-xs font-normal mt-4">
|
||||
تمامی حقوق مادی و معنوی این وب سایت متعلق به سوت زنی میباشد.
|
||||
تمامی حقوق مادی و معنوی این وب سایت متعلق به عیون میباشد.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,68 +0,0 @@
|
|||
"use client"
|
||||
|
||||
import React from 'react';
|
||||
import {
|
||||
Chart as ChartJS,
|
||||
CategoryScale,
|
||||
LinearScale,
|
||||
BarElement,
|
||||
Title,
|
||||
Tooltip,
|
||||
Legend,
|
||||
} from 'chart.js';
|
||||
import { Bar } from 'react-chartjs-2';
|
||||
import { faker } from "@faker-js/faker";
|
||||
|
||||
ChartJS.register(
|
||||
CategoryScale,
|
||||
LinearScale,
|
||||
BarElement,
|
||||
Title,
|
||||
Tooltip,
|
||||
Legend
|
||||
);
|
||||
|
||||
export const options = {
|
||||
indexAxis: 'y' as const,
|
||||
elements: {
|
||||
bar: {
|
||||
borderWidth: 2,
|
||||
},
|
||||
},
|
||||
responsive: true,
|
||||
plugins: {
|
||||
legend: {
|
||||
position: 'right' as const,
|
||||
},
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Chart.js Horizontal Bar Chart',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July'];
|
||||
|
||||
export const data = {
|
||||
labels,
|
||||
datasets: [
|
||||
{
|
||||
label: 'Dataset 1',
|
||||
data: labels.map(() => faker.datatype.number({ min: 0, max: 1000 })),
|
||||
borderColor: 'rgb(255, 99, 132)',
|
||||
backgroundColor: 'rgba(255, 99, 132, 0.5)',
|
||||
},
|
||||
{
|
||||
label: 'Dataset 2',
|
||||
data: labels.map(() => faker.datatype.number({ min: 0, max: 1000 })),
|
||||
borderColor: 'rgb(53, 162, 235)',
|
||||
backgroundColor: 'rgba(53, 162, 235, 0.5)',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export function HorizontalChart() {
|
||||
return (
|
||||
<Bar options={options} data={data} className='!w-full !h-full'/>
|
||||
)
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ export default function InspectorOperations({
|
|||
.nullish(),
|
||||
});
|
||||
const password = useData((state) => state.data.password);
|
||||
const possibleOperations = complaintData?.possibleOperations;
|
||||
const possibleOperations = complaintData?.possibleOperationsWithDescription;
|
||||
const selectOptions = Operations.filter((item, index) =>
|
||||
possibleOperations.includes(index)
|
||||
);
|
||||
|
|
@ -76,7 +76,9 @@ export default function InspectorOperations({
|
|||
resolver: zodResolver(FormSchema),
|
||||
defaultValues: {
|
||||
operation:
|
||||
selectOptions.length == 1 ? String(selectOptions[0].value) : undefined,
|
||||
possibleOperations.length == 1
|
||||
? String(possibleOperations[0].value)
|
||||
: undefined,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -172,7 +174,7 @@ export default function InspectorOperations({
|
|||
<FormControl dir="rtl">
|
||||
<RadioGroup
|
||||
onValueChange={field.onChange}
|
||||
defaultValue={field.value}
|
||||
// defaultValue={field?.value}
|
||||
className="flex space-y-1 text-sm"
|
||||
>
|
||||
<FormItem className="flex items-center space-x-3 space-y-0">
|
||||
|
|
@ -221,10 +223,13 @@ export default function InspectorOperations({
|
|||
<SelectContent dir="rtl">
|
||||
<SelectGroup>
|
||||
<SelectLabel>عملیات</SelectLabel>
|
||||
{selectOptions.map((item) => {
|
||||
{possibleOperations.map((item: any) => {
|
||||
return (
|
||||
<SelectItem value={String(item.value)}>
|
||||
{item.name}
|
||||
<SelectItem
|
||||
key={item.value}
|
||||
value={String(item.value)}
|
||||
>
|
||||
{item.description}
|
||||
</SelectItem>
|
||||
);
|
||||
})}
|
||||
|
|
|
|||
|
|
@ -1,64 +0,0 @@
|
|||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import {
|
||||
Chart as ChartJS,
|
||||
CategoryScale,
|
||||
LinearScale,
|
||||
PointElement,
|
||||
LineElement,
|
||||
Title,
|
||||
Tooltip,
|
||||
Legend,
|
||||
} from "chart.js";
|
||||
import { Line } from "react-chartjs-2";
|
||||
import { faker } from "@faker-js/faker";
|
||||
|
||||
ChartJS.register(
|
||||
CategoryScale,
|
||||
LinearScale,
|
||||
PointElement,
|
||||
LineElement,
|
||||
Title,
|
||||
Tooltip,
|
||||
Legend
|
||||
);
|
||||
|
||||
export const options = {
|
||||
responsive: true,
|
||||
plugins: {
|
||||
legend: {
|
||||
position: "top" as const,
|
||||
},
|
||||
title: {
|
||||
display: true,
|
||||
text: "Chart.js Line Chart",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const labels = ["January", "February", "March", "April", "May", "June", "July"];
|
||||
|
||||
export const data = {
|
||||
labels,
|
||||
datasets: [
|
||||
{
|
||||
label: "Dataset 1",
|
||||
data: labels.map(() => faker.datatype.number({ min: -1000, max: 1000 })),
|
||||
borderColor: "rgb(255, 99, 132)",
|
||||
backgroundColor: "rgba(255, 99, 132, 0.5)",
|
||||
},
|
||||
{
|
||||
label: "Dataset 2",
|
||||
data: labels.map(() => faker.datatype.number({ min: -1000, max: 1000 })),
|
||||
borderColor: "rgb(53, 162, 235)",
|
||||
backgroundColor: "rgba(53, 162, 235, 0.5)",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default function LineChart() {
|
||||
return (
|
||||
<Line options={options} data={data} className=' '/>
|
||||
);
|
||||
}
|
||||
|
|
@ -26,6 +26,7 @@ import { getCaptcha } from "@/utils/commonApi";
|
|||
import { useRouter } from "next/navigation";
|
||||
import { Oval, ThreeDots } from "react-loader-spinner";
|
||||
import useData from "@/store/useData";
|
||||
import useToken from "@/store/useToken";
|
||||
const FormSchema = z.object({
|
||||
username: z.string().min(1, {
|
||||
message: "لطفا نام کاربری را وارد نمایید.",
|
||||
|
|
@ -44,6 +45,7 @@ export default function Login() {
|
|||
const router = useRouter();
|
||||
const saveData = useData((state) => state.saveData);
|
||||
|
||||
|
||||
const {
|
||||
data: CaptchaData,
|
||||
isLoading,
|
||||
|
|
|
|||
|
|
@ -1,22 +1,33 @@
|
|||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Input } from "./ui/input";
|
||||
import Image from "next/image";
|
||||
import { menuItems } from "@/constants";
|
||||
import Link from "next/link";
|
||||
import Login from "./Login";
|
||||
import { Button } from "./ui/button";
|
||||
import { usePathname } from 'next/navigation'
|
||||
import { usePathname } from "next/navigation";
|
||||
import TopNav from "./TopNav";
|
||||
|
||||
import { isAuthorized } from "@/lib/utils";
|
||||
import useToken from "@/store/useToken";
|
||||
import { DropdownMenu } from "@radix-ui/react-dropdown-menu";
|
||||
import ProfileDropDown from "./ProfileDropDown";
|
||||
|
||||
export default function Navbar() {
|
||||
const pathname = usePathname()
|
||||
|
||||
const pathname = usePathname();
|
||||
const isAuth = useToken((state) => state.token);
|
||||
const [auth, setAuth] = useState<boolean>(isAuth);
|
||||
useEffect(() => {
|
||||
useToken.persist.rehydrate();
|
||||
setAuth(isAuth);
|
||||
}, [isAuth]);
|
||||
return (
|
||||
<div className={`max-md:hidden left-0 right-0 top-0 z-10 ${pathname === "/" ? "absolute" : "sticky"}`}>
|
||||
|
||||
<div
|
||||
className={`max-md:hidden left-0 right-0 top-0 z-10 ${
|
||||
pathname === "/" ? "absolute" : "sticky"
|
||||
}`}
|
||||
>
|
||||
<TopNav />
|
||||
<div className=" bg-white h-16 shadow-md flex items-center justify-between py-2 px-8">
|
||||
<div className=" flex ">
|
||||
|
|
@ -29,13 +40,12 @@ export default function Navbar() {
|
|||
height={32}
|
||||
/>
|
||||
<div className=" text-brown flex flex-col text-center w-40">
|
||||
<h1 className="text-[21px] w-full">ســــــــوت زن</h1>
|
||||
<h1 className="text-[23px] w-full">عیــون</h1>
|
||||
<h1 className="text-[9px]">سامانه افشار فساد شهرداری</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div className=" flex gap-5 items-center mr-8">
|
||||
{menuItems.map((item, index, array) => {
|
||||
|
||||
if (array.length - 1 !== index) {
|
||||
return (
|
||||
<Link key={item.id} href={item.href}>
|
||||
|
|
@ -43,20 +53,25 @@ export default function Navbar() {
|
|||
</Link>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<></>
|
||||
);
|
||||
return <></>;
|
||||
}
|
||||
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{auth ? (
|
||||
<ProfileDropDown />
|
||||
) : (
|
||||
<Link href="/Login">
|
||||
<Button className=" bg-blue hover:bg-blue/90 rounded-lg">
|
||||
<Button
|
||||
onClick={() =>
|
||||
localStorage.setItem("Sootzani_Login_State", "true")
|
||||
}
|
||||
className=" bg-blue hover:bg-blue/90 rounded-lg"
|
||||
>
|
||||
ورود به پنل کاربری
|
||||
</Button>
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -11,12 +11,19 @@ import Link from "next/link";
|
|||
import { Button } from "./ui/button";
|
||||
import TopNav from "./TopNav";
|
||||
import { usePathname } from "next/navigation";
|
||||
import useToken from "@/store/useToken";
|
||||
import ProfileDropDown from "./ProfileDropDown";
|
||||
|
||||
// import { routes } from "../routes";
|
||||
|
||||
export default function NavbarSm() {
|
||||
const pathname = usePathname();
|
||||
|
||||
const isAuth = useToken((state) => state.token);
|
||||
const [auth, setAuth] = useState<boolean>(isAuth);
|
||||
useEffect(() => {
|
||||
useToken.persist.rehydrate();
|
||||
setAuth(isAuth);
|
||||
}, [isAuth]);
|
||||
// useClickAway(ref, () => setOpen(false));
|
||||
|
||||
const [isOpen, setOpen] = useState(false);
|
||||
|
|
@ -26,12 +33,12 @@ export default function NavbarSm() {
|
|||
<>
|
||||
<div
|
||||
ref={ref}
|
||||
className={`md:hidden w-full bg-white z-[100] flex flex-row justify-between items-center px-4
|
||||
className={`md:hidden w-full bg-white z-[100] flex flex-row justify-between items-center pr-1 pl-4
|
||||
sticky top-0
|
||||
shadow-md`}
|
||||
>
|
||||
<Hamburger toggled={isOpen} size={20} toggle={setOpen} />
|
||||
|
||||
<Hamburger toggled={isOpen} size={20} toggle={setOpen} direction="right"/>
|
||||
{auth && <ProfileDropDown />}
|
||||
{/* <Link href="/Login">
|
||||
<Button className=" bg-blue hover:bg-blue/90 rounded-lg text-xs ">
|
||||
ورود به پنل کاربری
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
"use client"
|
||||
import React from 'react';
|
||||
import { Chart as ChartJS, ArcElement, Tooltip, Legend } from 'chart.js';
|
||||
import { Pie } from 'react-chartjs-2';
|
||||
|
||||
ChartJS.register(ArcElement, Tooltip, Legend);
|
||||
|
||||
export const data = {
|
||||
labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
|
||||
datasets: [
|
||||
{
|
||||
label: '# of Votes',
|
||||
data: [12, 19, 3, 5, 2, 3],
|
||||
backgroundColor: [
|
||||
'rgba(255, 99, 132, 0.2)',
|
||||
'rgba(54, 162, 235, 0.2)',
|
||||
'rgba(255, 206, 86, 0.2)',
|
||||
'rgba(75, 192, 192, 0.2)',
|
||||
'rgba(153, 102, 255, 0.2)',
|
||||
'rgba(255, 159, 64, 0.2)',
|
||||
],
|
||||
borderColor: [
|
||||
'rgba(255, 99, 132, 1)',
|
||||
'rgba(54, 162, 235, 1)',
|
||||
'rgba(255, 206, 86, 1)',
|
||||
'rgba(75, 192, 192, 1)',
|
||||
'rgba(153, 102, 255, 1)',
|
||||
'rgba(255, 159, 64, 1)',
|
||||
],
|
||||
borderWidth: 1,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export function PieChart() {
|
||||
return <Pie data={data} />;
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
import React from "react";
|
||||
|
||||
import {
|
||||
Cloud,
|
||||
CreditCard,
|
||||
Github,
|
||||
Keyboard,
|
||||
LifeBuoy,
|
||||
LogOut,
|
||||
Mail,
|
||||
MessageSquare,
|
||||
Plus,
|
||||
PlusCircle,
|
||||
Settings,
|
||||
User,
|
||||
UserPlus,
|
||||
Users,
|
||||
} from "lucide-react";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuGroup,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuLabel,
|
||||
DropdownMenuPortal,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuShortcut,
|
||||
DropdownMenuSub,
|
||||
DropdownMenuSubContent,
|
||||
DropdownMenuSubTrigger,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import { getProfile } from "@/utils/authenticateApi";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import Link from "next/link";
|
||||
import useToken from "@/store/useToken";
|
||||
import { deleteCookie } from "cookies-next";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export default function ProfileDropDown() {
|
||||
const router = useRouter();
|
||||
const {
|
||||
data: profileData,
|
||||
isLoading,
|
||||
refetch,
|
||||
} = useQuery({
|
||||
queryKey: ["Profile"],
|
||||
queryFn: () => getProfile(),
|
||||
refetchOnWindowFocus: false,
|
||||
});
|
||||
const saveToken = useToken((state) => state.saveToken);
|
||||
return (
|
||||
<DropdownMenu dir="rtl">
|
||||
<DropdownMenuTrigger className=" max-sm:-mr-8 max-sm:text-xs" asChild>
|
||||
<Button variant="outline">{profileData?.userName}</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent className="w-56 sm:ml-10">
|
||||
<DropdownMenuGroup>
|
||||
<DropdownMenuItem>
|
||||
<User className="ml-2 h-4 w-4" />
|
||||
<span>مشاهده پروفایل</span>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={() => router.push("/Account/Complaints")}>
|
||||
<CreditCard className="ml-2 h-4 w-4" />
|
||||
<span>درخواست های اخیر</span>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuGroup>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem
|
||||
onClick={() => {
|
||||
saveToken(false);
|
||||
deleteCookie("Sootzani_Token");
|
||||
router.replace("/");
|
||||
}}
|
||||
>
|
||||
<LogOut className="ml-2 h-4 w-4" />
|
||||
<span>خروج</span>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
"use client"
|
||||
import React from "react";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import LineChart from "./LineChart";
|
||||
|
||||
import { BsBarChartLineFill } from "react-icons/bs";
|
||||
import { BsBarChartLine } from "react-icons/bs";
|
||||
import { VerticalChart } from "./VerticalChart";
|
||||
import { HorizontalChart } from "./HorizontalChart";
|
||||
|
||||
export default function ReportsController() {
|
||||
return (
|
||||
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9">
|
||||
<Tabs
|
||||
defaultValue="tab1"
|
||||
className="w-full flex flex-col md:flex-row gap-16"
|
||||
dir="rtl"
|
||||
>
|
||||
<div className="w-full md:w-1/4 flex flex-col justify-between items-center ">
|
||||
{/* Tab Title */}
|
||||
<TabsList className="w-full h-full flex flex-row md:flex-col max-md:flex-wrap max-md:justify-between bg-transparent gap-4">
|
||||
<TabsTrigger
|
||||
className="w-[45%] md:w-full h-12 bg-muted text-[#555353] shadow-md hover:shadow-none text-sm md:text-lg font-bold py-3 gap-2 justify-start"
|
||||
value="tab1"
|
||||
>
|
||||
{" "}
|
||||
<BsBarChartLineFill /> نمودار شماره یک
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
className="w-[45%] md:w-full h-12 bg-muted text-[#555353] shadow-md hover:shadow-none text-sm md:text-lg font-bold py-3 gap-2 justify-start"
|
||||
value="tab2"
|
||||
>
|
||||
{" "}
|
||||
<BsBarChartLineFill /> نمودار شماره 2
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
className="w-[45%] md:w-full h-12 bg-muted text-[#555353] shadow-md hover:shadow-none text-sm md:text-lg font-bold py-3 gap-2 justify-start"
|
||||
value="tab3"
|
||||
>
|
||||
{" "}
|
||||
<BsBarChartLineFill /> نمودار شماره 3
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
className="w-[45%] md:w-full h-12 bg-muted text-[#555353] shadow-md hover:shadow-none text-sm md:text-lg font-bold py-3 gap-2 justify-start"
|
||||
value="tab4"
|
||||
>
|
||||
{" "}
|
||||
<BsBarChartLineFill /> نمودار شماره 4
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
className="w-[45%] md:w-full h-12 bg-muted text-[#555353] shadow-md hover:shadow-none text-sm md:text-lg font-bold py-3 gap-2 justify-start"
|
||||
value="tab5"
|
||||
>
|
||||
{" "}
|
||||
<BsBarChartLineFill /> نمودار شماره 5
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
className="w-[45%] md:w-full h-12 bg-muted text-[#555353] shadow-md hover:shadow-none text-sm md:text-lg font-bold py-3 gap-2 justify-start"
|
||||
value="tab6"
|
||||
>
|
||||
{" "}
|
||||
<BsBarChartLineFill /> نمودار شماره 6
|
||||
</TabsTrigger>
|
||||
|
||||
<TabsTrigger
|
||||
className="w-[45%] md:w-full h-12 bg-muted text-[#555353] shadow-md hover:shadow-none text-sm md:text-lg font-bold py-3 gap-2 justify-start"
|
||||
value="tab7"
|
||||
>
|
||||
{" "}
|
||||
<BsBarChartLineFill /> نمودار شماره 7
|
||||
</TabsTrigger>
|
||||
|
||||
<TabsTrigger
|
||||
className="w-[45%] md:w-full h-12 bg-muted text-[#555353] shadow-md hover:shadow-none text-sm md:text-lg font-bold py-3 gap-2 justify-start"
|
||||
value="tab8"
|
||||
>
|
||||
{" "}
|
||||
<BsBarChartLineFill /> نمودار شماره 8
|
||||
</TabsTrigger>
|
||||
|
||||
|
||||
</TabsList>
|
||||
</div>
|
||||
|
||||
<div className="w-full md:w-3/4 flex justify-between items-center ">
|
||||
{/* Tab Content */}
|
||||
<TabsContent value="tab1" className="w-full h-full ">
|
||||
<VerticalChart />
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="tab2" className="w-full h-full ">
|
||||
<HorizontalChart />
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="tab3" className="w-full h-full ">
|
||||
<LineChart />
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="tab4" className="w-full h-full ">
|
||||
<HorizontalChart />
|
||||
</TabsContent>
|
||||
</div>
|
||||
</Tabs>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,46 +1,45 @@
|
|||
"use client";
|
||||
|
||||
import React, { useEffect } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import Image from "next/image";
|
||||
import Resultimg from "../public/img/result.png";
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { Button } from "./ui/button";
|
||||
|
||||
export default function Result() {
|
||||
const trackingNumber = localStorage.getItem("trackingNumber");
|
||||
const password = localStorage.getItem("password");
|
||||
const [trackingNumber, setTrackingNumber] = useState<any>();
|
||||
const [password, setPassword] = useState<any>();
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
localStorage.removeItem("trackingNumber")
|
||||
localStorage.removeItem("password")
|
||||
}, [router]);
|
||||
const tn = localStorage.getItem("trackingNumber");
|
||||
const pw = localStorage.getItem("password");
|
||||
setTrackingNumber(tn);
|
||||
setPassword(pw);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="w-full h-full sm:w-2/3 md:w-3/4 lg:w-1/2 max-sm:p-8 pt-12 ">
|
||||
<div className="h-full flex flex-col justify-center">
|
||||
<p
|
||||
className="text-sm font-medium leading-6 tracking-wide text-[#7C838A] dark:text-white
|
||||
3xl:text-base 3xl:font-bold ">
|
||||
3xl:text-base 3xl:font-bold "
|
||||
>
|
||||
با تشکر از شما
|
||||
</p>
|
||||
|
||||
<p
|
||||
className="text-sm font-medium leading-6 tracking-wide text-[#7C838A] dark:text-white
|
||||
3xl:text-base 3xl:font-bold ">
|
||||
3xl:text-base 3xl:font-bold "
|
||||
>
|
||||
درخواست شما با کد پیگیری
|
||||
<span className="text-slate-500 mx-2">
|
||||
{`${trackingNumber}`}
|
||||
</span>
|
||||
و رمز عبور
|
||||
<span className="text-slate-500 mx-2">
|
||||
{`${password}`}
|
||||
</span>
|
||||
در سامانه سوت زنی ثبت شده و شما می توانید نتیجه درخواست خود را از صفحه
|
||||
<span className="text-slate-500 mx-2">{`${trackingNumber}`}</span>و
|
||||
رمز عبور
|
||||
<span className="text-slate-500 mx-2">{`${password}`}</span>
|
||||
در سامانه عیون ثبت شده و شما می توانید نتیجه درخواست خود را از صفحه
|
||||
پیگیری درخواست، با استفاده از کد رهگیری و رمز عبور مشاهده کنید.
|
||||
</p>
|
||||
|
||||
<Image
|
||||
alt="icon"
|
||||
src={Resultimg}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
"use client";
|
||||
import React from "react";
|
||||
import React, { useEffect } from "react";
|
||||
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
|
|
@ -19,43 +19,84 @@ import { Input } from "@/components/ui/input";
|
|||
import { toast } from "@/components/ui/use-toast";
|
||||
import Link from "next/link";
|
||||
import RequestStep2 from "./RequestStep2";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { editProfile, getProfile } from "@/utils/authenticateApi";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
const FormSchema = z.object({
|
||||
firstName: z.string().min(2, {
|
||||
message: "firstName must be at least 2 characters.",
|
||||
firstName: z.string().min(1, {
|
||||
message: "لطفا نام خود را وارد نمایید.",
|
||||
}),
|
||||
lastName: z.string().min(2, {
|
||||
message: "lastName must be at least 2 characters.",
|
||||
lastName: z.string().min(1, {
|
||||
message: "لطفا نام خانوادگی خود را وارد نمایید.",
|
||||
}),
|
||||
nationalCode: z.number().min(10, {
|
||||
message: "nationalCode must be at least 10 characters.",
|
||||
}),
|
||||
phoneNumber: z.number().min(11, {
|
||||
message: "phoneNumber must be at least 11 characters.",
|
||||
nationalId: z
|
||||
.string()
|
||||
.length(10, { message: "کد ملی معتبر نمی باشد." })
|
||||
.transform((value) => {
|
||||
const parsedNumber = Number(value);
|
||||
if (Number.isNaN(parsedNumber)) {
|
||||
throw new Error("کد ملی معتبر نمی باشد.");
|
||||
} else if (
|
||||
Number(parsedNumber) > 100000000 &&
|
||||
Number(parsedNumber) < 999999999
|
||||
) {
|
||||
throw new Error("کد ملی معتبر نمی باشد.");
|
||||
}
|
||||
return parsedNumber;
|
||||
}),
|
||||
});
|
||||
|
||||
export default function RequestStep1() {
|
||||
const form = useForm<z.infer<typeof FormSchema>>({
|
||||
resolver: zodResolver(FormSchema),
|
||||
defaultValues: {
|
||||
firstName: "",
|
||||
lastName: "",
|
||||
// nationalCode: ,
|
||||
// phoneNumber: ,
|
||||
},
|
||||
const router = useRouter();
|
||||
const {
|
||||
data: profileData,
|
||||
isLoading,
|
||||
refetch,
|
||||
} = useQuery({
|
||||
queryKey: ["Profile"],
|
||||
queryFn: () => getProfile(),
|
||||
refetchOnWindowFocus: false,
|
||||
});
|
||||
|
||||
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||
toast({
|
||||
title: "You submitted the following values:",
|
||||
description: (
|
||||
<pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
|
||||
<code className="text-white">{JSON.stringify(data, null, 2)}</code>
|
||||
</pre>
|
||||
),
|
||||
const editProfileMutation = useMutation({
|
||||
mutationKey: ["editProfile"],
|
||||
mutationFn: editProfile,
|
||||
onSuccess: (res) => {
|
||||
router.push("/RequestStep2");
|
||||
localStorage.setItem("authorized", "true");
|
||||
},
|
||||
onError: (error) => {},
|
||||
});
|
||||
|
||||
const form = useForm<z.infer<typeof FormSchema>>({
|
||||
resolver: zodResolver(FormSchema),
|
||||
});
|
||||
if (profileData?.firstName) {
|
||||
console.log(111);
|
||||
}
|
||||
useEffect(() => {
|
||||
if (profileData) {
|
||||
form.setValue("firstName", profileData.firstName);
|
||||
form.setValue("lastName", profileData.lastName);
|
||||
form.setValue("nationalId", profileData.nationalId);
|
||||
}
|
||||
}, [profileData]);
|
||||
|
||||
console.log(form.getValues());
|
||||
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||
// toast({
|
||||
// title: "You submitted the following values:",
|
||||
// description: (
|
||||
// <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
|
||||
// <code className="text-white">{JSON.stringify(data, null, 2)}</code>
|
||||
// </pre>
|
||||
// ),
|
||||
// });
|
||||
const strNationalId = String(data.nationalId);
|
||||
const payload = { ...data, nationalId: strNationalId };
|
||||
console.log(data);
|
||||
editProfileMutation.mutate(payload);
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
@ -64,9 +105,11 @@ export default function RequestStep1() {
|
|||
<p className="text-sm md:text-base font-bold leading-tight tracking-tight text-blue dark:text-white">
|
||||
لطفا جهت ارسال درخواست فرم زیر را تکمیل نمایید.
|
||||
</p>
|
||||
<p className="text-sm md:text-base font-bold leading-tight tracking-tight text-red-500 dark:text-white">
|
||||
در صورت عدم تمایل به ثبت مشخصات شخصی می توانید به صفحه ی بعد مراجعه کنید.
|
||||
</p>
|
||||
{/* <p className="text-sm md:text-base font-bold leading-tight tracking-tight text-red-500 dark:text-white">
|
||||
در صورت عدم تمایل به ثبت مشخصات شخصی می توانید به صفحه ی بعد مراجعه
|
||||
کنید.
|
||||
</p> */}
|
||||
{profileData && (
|
||||
<Form {...form}>
|
||||
<form
|
||||
onSubmit={form.handleSubmit(onSubmit)}
|
||||
|
|
@ -82,7 +125,10 @@ export default function RequestStep1() {
|
|||
نام
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="نام خود را وارد نمایید" {...field} />
|
||||
<Input
|
||||
placeholder="نام خود را وارد نمایید"
|
||||
{...field}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
|
@ -108,7 +154,7 @@ export default function RequestStep1() {
|
|||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="nationalCode"
|
||||
name="nationalId"
|
||||
render={({ field }) => (
|
||||
<FormItem className="w-full sm:w-[48%]">
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||
|
|
@ -116,7 +162,7 @@ export default function RequestStep1() {
|
|||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
type="number"
|
||||
type="text"
|
||||
placeholder="کد ملی خود را وارد نمایید "
|
||||
{...field}
|
||||
/>
|
||||
|
|
@ -125,41 +171,19 @@ export default function RequestStep1() {
|
|||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="phoneNumber"
|
||||
render={({ field }) => (
|
||||
<FormItem className=" w-full sm:w-[48%]">
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||
شماره تماس
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
type="number"
|
||||
placeholder="شماره تماس خود را وارد نمایید "
|
||||
{...field}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
|
||||
{/* <Button> */}
|
||||
<Link
|
||||
href="/RequestStep2"
|
||||
<Button
|
||||
type="submit"
|
||||
className="w-1/2 sm:w-1/3 lg:w-1/4 bg-blue text-white p-2 rounded-xl text-center"
|
||||
>
|
||||
صفحه ی بعد
|
||||
</Link>
|
||||
{/* </Button> */}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Form>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
"use client";
|
||||
import React, { useState } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
|
|
@ -36,9 +36,14 @@ import Image from "next/image";
|
|||
import Img1 from "../public/img/logo.png";
|
||||
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { postComplaintSubmit } from "@/utils/citizenApi";
|
||||
import {
|
||||
postAuthorizedComplaintSubmit,
|
||||
postComplaintSubmit,
|
||||
} from "@/utils/citizenApi";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { getCaptcha, getCategory } from "@/utils/commonApi";
|
||||
import { getCaptcha, getCategory, getOrganizations } from "@/utils/commonApi";
|
||||
import { ThreeDots } from "react-loader-spinner";
|
||||
import useToken from "@/store/useToken";
|
||||
|
||||
const MAX_IMAGE_SIZE = 5242880; // 5 MB
|
||||
const ALLOWED_IMAGE_TYPES = [
|
||||
|
|
@ -49,22 +54,20 @@ const ALLOWED_IMAGE_TYPES = [
|
|||
];
|
||||
|
||||
const FormSchema = z.object({
|
||||
subject: z.string().min(2, {
|
||||
message: "subject must be at least 2 characters.",
|
||||
title: z.string().min(1, {
|
||||
message: "لطفا موضوع شکایت را وارد نمایید.",
|
||||
}),
|
||||
organisation: z.string().min(2, {
|
||||
message: "organisation must be at least 2 characters.",
|
||||
}),
|
||||
person: z.string().min(2, {
|
||||
message: "personName must be at least 2 characters.",
|
||||
OrganizationId: z.string({
|
||||
required_error: "لطفا دستگاه مربوطه را انتخاب نمایید.",
|
||||
}),
|
||||
person: z.string().optional(),
|
||||
description: z
|
||||
.string()
|
||||
.min(5, {
|
||||
message: "description must be at least 5 characters.",
|
||||
.min(1, {
|
||||
message: "لطفا توضیحات خود را بنویسید.",
|
||||
})
|
||||
.max(200, {
|
||||
message: "description must not be longer than 200 characters.",
|
||||
.max(300, {
|
||||
message: "تعداد کاراکترها بیشتر از حد مجاز میباشد.",
|
||||
}),
|
||||
uploadFile: z
|
||||
.custom<FileList>((val) => val instanceof FileList, "Required")
|
||||
|
|
@ -73,7 +76,8 @@ const FormSchema = z.object({
|
|||
.refine(
|
||||
(files) => Array.from(files).every((file) => file.size <= MAX_IMAGE_SIZE),
|
||||
`Each file size should be less than 5 MB.`
|
||||
),
|
||||
)
|
||||
.nullish(),
|
||||
// .refine(
|
||||
// (files) =>
|
||||
// Array.from(files).every((file) =>
|
||||
|
|
@ -82,38 +86,49 @@ const FormSchema = z.object({
|
|||
// "Only these types are allowed .jpg, .jpeg, .png and .webp"
|
||||
// ),
|
||||
categoryId: z.string({
|
||||
required_error: "Please select an category to display.",
|
||||
required_error: "لطفا دسته بندی را انتخاب نمایید.",
|
||||
}),
|
||||
captchaValue: z.string().min(4, {
|
||||
message: "captcha must be at least 4 characters.",
|
||||
captchaValue: z.string().min(1, {
|
||||
message: "لطفا کد امنیتی را وارد نمایید.ئ",
|
||||
}),
|
||||
});
|
||||
|
||||
interface Organization {
|
||||
title: string;
|
||||
description: string;
|
||||
isDeleted: string;
|
||||
id: string;
|
||||
}
|
||||
|
||||
// Form Hook
|
||||
export default function RequestStep2() {
|
||||
// const [trackingComplaint, setTrackingComplaint] = useState({});
|
||||
|
||||
const isAuth = useToken((state) => state.token);
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
useToken.persist.rehydrate();
|
||||
}, []);
|
||||
const complaintSubmitMutation = useMutation({
|
||||
mutationKey: ["complaintSubmit"],
|
||||
mutationFn: postComplaintSubmit,
|
||||
|
||||
onSuccess: (res) => {
|
||||
console.log(res);
|
||||
localStorage.setItem("trackingNumber", res.trackingNumber);
|
||||
localStorage.setItem("password", res.password);
|
||||
|
||||
// alert("Success");
|
||||
console.log("Success Step2");
|
||||
router.push("/RequestResult");
|
||||
// router.push("/RequestResult", { data: trackingComplaint });
|
||||
// return (res)
|
||||
},
|
||||
onError: (error) => {
|
||||
console.log(error);
|
||||
console.log(error?.message);
|
||||
onError: (error) => {},
|
||||
});
|
||||
|
||||
const authorizedComplaintSubmitMutation = useMutation({
|
||||
mutationKey: ["authorizedComplaintSubmit"],
|
||||
mutationFn: postAuthorizedComplaintSubmit,
|
||||
onSuccess: (res) => {
|
||||
localStorage.setItem("trackingNumber", res.trackingNumber);
|
||||
localStorage.setItem("password", res.password);
|
||||
localStorage.removeItem("authorized");
|
||||
router.push("/RequestResult");
|
||||
},
|
||||
onError: (error) => {},
|
||||
});
|
||||
|
||||
// All Category
|
||||
|
|
@ -122,8 +137,17 @@ export default function RequestStep2() {
|
|||
queryFn: () => getCategory(),
|
||||
});
|
||||
|
||||
const { data: organizationsData } = useQuery({
|
||||
queryKey: ["organizations"],
|
||||
queryFn: () => getOrganizations(),
|
||||
});
|
||||
|
||||
// Captcha
|
||||
const { data: CaptchaData, isLoading } = useQuery({
|
||||
const {
|
||||
data: CaptchaData,
|
||||
isLoading,
|
||||
refetch,
|
||||
} = useQuery({
|
||||
queryKey: ["Captcha"],
|
||||
queryFn: () => getCaptcha(),
|
||||
});
|
||||
|
|
@ -136,8 +160,7 @@ export default function RequestStep2() {
|
|||
const form = useForm<z.infer<typeof FormSchema>>({
|
||||
resolver: zodResolver(FormSchema),
|
||||
defaultValues: {
|
||||
subject: "",
|
||||
organisation: "",
|
||||
title: "",
|
||||
person: "",
|
||||
description: "",
|
||||
captchaValue: "",
|
||||
|
|
@ -146,34 +169,34 @@ export default function RequestStep2() {
|
|||
});
|
||||
|
||||
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||
// toast({
|
||||
// title: "You submitted the following values:",
|
||||
// description: (
|
||||
// <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
|
||||
// <code className="text-white">{JSON.stringify(data, null, 2)}</code>
|
||||
// </pre>
|
||||
// ),
|
||||
// });
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("Title", data.subject);
|
||||
formData.append("Title", data.title);
|
||||
formData.append("Text", data.description);
|
||||
formData.append("CategoryId", data.categoryId);
|
||||
formData.append("Medias", data.uploadFile[0]);
|
||||
if (data?.uploadFile && data?.uploadFile?.length > 0) {
|
||||
for (let i = 0; i < data.uploadFile.length; i++) {
|
||||
formData.append("Medias", data.uploadFile[i]);
|
||||
}
|
||||
}
|
||||
formData.append("Captcha.Value", data.captchaValue);
|
||||
formData.append("Captcha.Key", CaptchaData?.headers["captcha-key"]);
|
||||
|
||||
formData.append("Complaining", data.person ? data.person : "");
|
||||
formData.append("OrganizationId", data.OrganizationId);
|
||||
if (isAuth) {
|
||||
authorizedComplaintSubmitMutation.mutate({
|
||||
Data: formData,
|
||||
});
|
||||
} else {
|
||||
complaintSubmitMutation.mutate({
|
||||
Data: formData,
|
||||
});
|
||||
}
|
||||
refetch();
|
||||
resetField("Title");
|
||||
resetField("Text");
|
||||
resetField("Medias");
|
||||
resetField("CategoryId");
|
||||
resetField("Captcha.Value");
|
||||
|
||||
console.log("submited");
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
const { resetField } = useForm();
|
||||
|
|
@ -192,7 +215,7 @@ export default function RequestStep2() {
|
|||
>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="subject"
|
||||
name="title"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||
|
|
@ -211,19 +234,41 @@ export default function RequestStep2() {
|
|||
<div className="flex flex-row flex-wrap justify-between">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="organisation"
|
||||
name="OrganizationId"
|
||||
render={({ field }) => (
|
||||
<FormItem className=" w-full sm:w-[48%]">
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||
*دستگاه مربوطه
|
||||
</FormLabel>
|
||||
<Select
|
||||
onValueChange={field.onChange}
|
||||
defaultValue={field.value}
|
||||
dir="rtl"
|
||||
>
|
||||
<FormControl>
|
||||
<Input
|
||||
placeholder="دستگاه مربوطه را انتخاب کنید"
|
||||
{...field}
|
||||
<SelectTrigger
|
||||
className=" bg-slate-200 !text-[#7C838A]"
|
||||
dir="rtl"
|
||||
>
|
||||
<SelectValue
|
||||
className=""
|
||||
placeholder="دستگاه مربوطه را انتخاب نمایید."
|
||||
/>
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
<SelectContent dir="rtl">
|
||||
<SelectGroup>
|
||||
{organizationsData?.map((item: any) => {
|
||||
return (
|
||||
<SelectItem key={item.id} value={item.id}>
|
||||
{item.title}
|
||||
</SelectItem>
|
||||
);
|
||||
})}
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormMessage className=" mt-2" />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
|
@ -281,6 +326,7 @@ export default function RequestStep2() {
|
|||
<Select
|
||||
onValueChange={field.onChange}
|
||||
defaultValue={field.value}
|
||||
dir="rtl"
|
||||
>
|
||||
<FormControl>
|
||||
<SelectTrigger className="bg-slate-200">
|
||||
|
|
@ -295,7 +341,7 @@ export default function RequestStep2() {
|
|||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormMessage />
|
||||
<FormMessage className=" mt-2" />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
|
@ -324,7 +370,7 @@ export default function RequestStep2() {
|
|||
return (
|
||||
<FormItem className="w-full sm:w-[48%]">
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||
آپلود تصویر
|
||||
پیوست
|
||||
</FormLabel>
|
||||
{/* File Upload */}
|
||||
<FormControl>
|
||||
|
|
@ -367,12 +413,12 @@ export default function RequestStep2() {
|
|||
/>
|
||||
</div>
|
||||
{/* Captcha */}
|
||||
<div className="flex flex-row flex-wrap justify-between">
|
||||
<div className="flex flex-row justify-between items-center w-full lg:w-[48%] gap-2">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="captchaValue"
|
||||
render={({ field }) => (
|
||||
<FormItem className="w-full sm:w-[48%]">
|
||||
<FormItem className="w-full ">
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||
*کد امنیتی
|
||||
</FormLabel>
|
||||
|
|
@ -387,31 +433,40 @@ export default function RequestStep2() {
|
|||
)}
|
||||
/>
|
||||
|
||||
<div className="w-full sm:w-[48%] flex items-center justify-start">
|
||||
{!isLoading && (
|
||||
{isLoading ? (
|
||||
<div className=" w-2/3 max-w[11rem] flex justify-center text-center">
|
||||
<ThreeDots
|
||||
visible={true}
|
||||
height="50"
|
||||
width="50"
|
||||
color="#003778"
|
||||
radius="9"
|
||||
ariaLabel="three-dots-loading"
|
||||
wrapperStyle={{}}
|
||||
wrapperClass=""
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div className=" w-2/3 max-w[11rem] flex justify-end text-center">
|
||||
<Image
|
||||
alt="icon"
|
||||
src={srcForImage as string}
|
||||
className="w-3/5 h-12 rounded-md shadow-md"
|
||||
className=" h-12 rounded-md shadow-md w-36"
|
||||
width={150}
|
||||
height={20}
|
||||
quality={100}
|
||||
/>
|
||||
)}
|
||||
{/* <Image src={Img1} alt="1" width={50} height={50} /> */}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex justify-center sm:justify-end gap-2 w-full mt-4">
|
||||
{/* <Link> */}
|
||||
<Button
|
||||
// href="/RequestResult"
|
||||
type="submit"
|
||||
className="w-1/2 sm:w-1/3 lg:w-1/4 bg-blue text-white p-2 rounded-xl text-center mb-4"
|
||||
>
|
||||
ارسال درخواست
|
||||
</Button>
|
||||
{/* </Link> */}
|
||||
</div>
|
||||
</form>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
"use client"
|
||||
import React from 'react'
|
||||
import Link from 'next/link'
|
||||
import { requestItems } from '@/constants'
|
||||
import Image from 'next/image'
|
||||
import svg1 from '../public/img/Connector line.svg'
|
||||
import { cn } from '@/lib/utils'
|
||||
"use client";
|
||||
import React from "react";
|
||||
import Link from "next/link";
|
||||
import { requestItems } from "@/constants";
|
||||
import Image from "next/image";
|
||||
import svg1 from "../public/img/Connector line.svg";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { IoArrowDown } from "react-icons/io5";
|
||||
|
||||
export default function SubmitRequest() {
|
||||
return (
|
||||
|
||||
<div className="3xl:w-[60%] w-[75%] mx-auto pb-24">
|
||||
<div className=" border my-6 mx-auto py-3 px-4 rounded-lg">
|
||||
<p className="text-sm font-normal text-right text-black">
|
||||
درباره سامانه سوت زنی
|
||||
درباره سامانه عیون
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className=" w-full flex flex-row gap-12 max-lg:flex-col-reverse items-center">
|
||||
<div className='w-1/3 flex flex-col justify-between gap-8 max-lg:w-full'>
|
||||
|
||||
<div className="w-1/3 flex flex-col justify-between gap-8 max-lg:w-full">
|
||||
<p className="pr-6 font-normal text-sm leading-6 text-justify text-black line-clamp-5 tracking-wider max-sm:pr-0 ">
|
||||
این سامانه با هدف بررسی درخواست های مردمی و شکایت های ایشان از پرسنل شهرداری و رسیدگی به آن ایجاد شده است.
|
||||
فلوچارت روبرو نحوه ارسال درخواست و پیگیری آن را مشاهده می کنید.
|
||||
این سامانه با هدف بررسی درخواست های مردمی و شکایت های ایشان از پرسنل
|
||||
شهرداری و رسیدگی به آن ایجاد شده است. فلوچارت روبرو نحوه ارسال
|
||||
درخواست و پیگیری آن را مشاهده می کنید.
|
||||
</p>
|
||||
<Link
|
||||
href="#"
|
||||
|
|
@ -31,29 +30,33 @@ export default function SubmitRequest() {
|
|||
برای شروع ارسال درخواست کلیک کنید.
|
||||
</Link>
|
||||
</div>
|
||||
<div className='w-2/3 flex items-center max-lg:w-full max-sm:flex-wrap justify-center'>
|
||||
<div className="w-2/3 flex items-center max-lg:w-full max-sm:flex-wrap justify-center">
|
||||
{requestItems.map((item) => {
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
key={item.id}
|
||||
className='min-w-3/12 w-3/12 h-full min-h-[11em] bg-blue transform -skew-x-[12deg] rounded-md flex items-center justify-center
|
||||
max-md:min-h-[8em] max-sm:w-full max-sm:min-h-[3em]'>
|
||||
<p className='text-white text-center text-sm font-bold px-6 max-md:px-3 max-md:font-medium max-sm:text-xs max-sm:font-normal '>
|
||||
{item.name}</p>
|
||||
className="min-w-3/12 w-3/12 h-full min-h-[11em] bg-blue transform -skew-x-[12deg] rounded-md flex items-center justify-center
|
||||
max-md:min-h-[8em] max-sm:w-full max-sm:min-h-[3em]"
|
||||
>
|
||||
<p className="text-white text-center text-sm font-bold px-6 max-md:px-3 max-md:font-medium max-sm:text-xs max-sm:font-normal ">
|
||||
{item.name}
|
||||
</p>
|
||||
</div>
|
||||
<div className={cn("flex justify-center ",
|
||||
<div
|
||||
className={cn(
|
||||
"flex justify-center ",
|
||||
item.id == 4 && "hidden"
|
||||
)}>
|
||||
<Image alt='!' src={svg1} className=" max-sm:hidden "/>
|
||||
)}
|
||||
>
|
||||
<Image alt="!" src={svg1} className=" max-sm:hidden " />
|
||||
<IoArrowDown className="hidden max-sm:flex text-slate-600" />
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
);
|
||||
})}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,22 +21,17 @@ import { useRouter } from "next/navigation";
|
|||
import { Decrypt } from "@/lib/utils";
|
||||
import useData from "@/store/useData";
|
||||
import { toast } from "sonner";
|
||||
import { getComplaints } from "@/utils/citizenApi";
|
||||
export default function TabController() {
|
||||
const saveData = useData((state) => state.saveData);
|
||||
const [selectedFile, setSelectedFile] = useState<any>(null);
|
||||
const router = useRouter();
|
||||
const handleFileChange = (event: any) => {
|
||||
const file = event.target.files[0];
|
||||
const reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
const contents = e?.target?.result;
|
||||
// Process the contents of the file here
|
||||
setSelectedFile(contents);
|
||||
console.log(contents);
|
||||
};
|
||||
const { data, isLoading } = useQuery({
|
||||
queryKey: ["CitizenList"],
|
||||
queryFn: () => getComplaints(),
|
||||
refetchOnWindowFocus: false,
|
||||
});
|
||||
|
||||
reader.readAsText(file);
|
||||
};
|
||||
const checkKey = (item: any) => {
|
||||
const dcKey = Decrypt(item.cipherKeyInspector, selectedFile);
|
||||
if (dcKey != false && dcKey != null) {
|
||||
|
|
@ -51,11 +46,7 @@ export default function TabController() {
|
|||
});
|
||||
}
|
||||
};
|
||||
const { data, isLoading, refetch } = useQuery({
|
||||
queryKey: ["ComplaintsList"],
|
||||
queryFn: () => getComplaintsList(),
|
||||
refetchOnWindowFocus: false,
|
||||
});
|
||||
|
||||
console.log(data);
|
||||
const newComplaints = data?.filter((item: any) => item.status == 0);
|
||||
const inProgressComplaints = data?.filter((item: any) => item.status == 1);
|
||||
|
|
@ -70,7 +61,7 @@ export default function TabController() {
|
|||
return (
|
||||
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-8 pt-9">
|
||||
<Dialog>
|
||||
<DialogTrigger className=" appearance-none" asChild>
|
||||
{/* <DialogTrigger className=" appearance-none" asChild>
|
||||
<Button
|
||||
// onClick={handelVerify}
|
||||
type="submit"
|
||||
|
|
@ -78,7 +69,7 @@ export default function TabController() {
|
|||
>
|
||||
+ بارگذاری کلید جدید
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
</DialogTrigger> */}
|
||||
<Tabs defaultValue="tab1" className="" dir="rtl">
|
||||
<div className="w-full flex flex-col-reverse lg:flex-row gap-4 lg:gap-5 justify-between items-center mb-10">
|
||||
{/* Tab Title */}
|
||||
|
|
@ -91,7 +82,7 @@ export default function TabController() {
|
|||
value="tab1"
|
||||
className="hover:border-b-2 border-b-blue"
|
||||
>
|
||||
جدید (2)
|
||||
ثبت شده
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
value="tab2"
|
||||
|
|
@ -168,13 +159,13 @@ export default function TabController() {
|
|||
</DialogHeader>
|
||||
<div className="grid w-full max-w-sm items-center gap-1.5">
|
||||
{/* <Label htmlFor="picture">Picture</Label> */}
|
||||
<Input
|
||||
{/* <Input
|
||||
dir="rtl"
|
||||
id="picture"
|
||||
onChange={handleFileChange}
|
||||
type="file"
|
||||
accept=".txt"
|
||||
/>
|
||||
/> */}
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<DialogClose asChild>
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
import React from "react";
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCaption,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@/components/ui/table";
|
||||
import { AdminTableItems } from "@/constants";
|
||||
import Link from "next/link";
|
||||
import { BiEditAlt } from "react-icons/bi";
|
||||
import { HiOutlineTrash } from "react-icons/hi";
|
||||
|
||||
export default function TableAdmin() {
|
||||
return (
|
||||
<Table className="border-[1px] border-solid border-muted rounded-md ">
|
||||
{/* <TableCaption>A list of your recent invoices.</TableCaption> */}
|
||||
<TableHeader>
|
||||
<TableRow className="bg-[#EFF4FA] ">
|
||||
<TableHead className="text-[#8F9BB3] text-right pr-4">نام و نام خانوادگی</TableHead>
|
||||
<TableHead className="text-[#8F9BB3] text-right">نقش کاربر</TableHead>
|
||||
<TableHead className="text-[#8F9BB3] text-right">تاریخ عضویت</TableHead>
|
||||
<TableHead className="text-[#8F9BB3] text-right">توضیحات</TableHead>
|
||||
<TableHead className="text-[#8F9BB3] text-right">ویرایش</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody className="bg-white ">
|
||||
{AdminTableItems.map((item) => {
|
||||
return (
|
||||
<TableRow key={item.id}>
|
||||
<Link
|
||||
href={`#`}
|
||||
className="contents h-14"
|
||||
>
|
||||
<TableCell className="w-3/12 font-medium text-black text-right pr-4">
|
||||
{item.name}
|
||||
<p className="text-slate-500 text-xs">{item.phone}</p>
|
||||
</TableCell>
|
||||
<TableCell className="w-2/12 text-black text-right">
|
||||
<p className="bg-blue rounded-lg text-white w-1/2 text-center">
|
||||
{item.useRole}
|
||||
</p>
|
||||
</TableCell>
|
||||
<TableCell className="w-2/12 text-black text-right">
|
||||
{item.date}
|
||||
</TableCell>
|
||||
<TableCell className="w-4/12 text-black text-right">
|
||||
{item.desc}
|
||||
</TableCell>
|
||||
<TableCell className="w-1/12 min-w-full flex gap-2 pt-4 text-muted-foreground text-right">
|
||||
<HiOutlineTrash size="20px"/>
|
||||
<BiEditAlt size="20px"/>
|
||||
</TableCell>
|
||||
</Link>
|
||||
</TableRow>
|
||||
);
|
||||
})}
|
||||
</TableBody>
|
||||
</Table>
|
||||
);
|
||||
}
|
||||
|
|
@ -36,6 +36,11 @@ interface Complaint {
|
|||
title: string;
|
||||
description: string;
|
||||
};
|
||||
complaintOrganization: {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
};
|
||||
status: number;
|
||||
registeredAt: string;
|
||||
lastChanged: string;
|
||||
|
|
@ -52,6 +57,7 @@ export default function TableController({
|
|||
console.log(data);
|
||||
const saveData = useData((state) => state.saveData);
|
||||
const [selectedFile, setSelectedFile] = useState<any>(null);
|
||||
const [open, setOpen] = useState<boolean>(false);
|
||||
const router = useRouter();
|
||||
const handleFileChange = (event: any) => {
|
||||
const file = event.target.files[0];
|
||||
|
|
@ -78,17 +84,6 @@ export default function TableController({
|
|||
// };
|
||||
return (
|
||||
<div>
|
||||
<Dialog>
|
||||
{/* <DialogTrigger className=" appearance-none" asChild>
|
||||
<Button
|
||||
// onClick={handelVerify}
|
||||
type="submit"
|
||||
className="bg-blue hover:bg-blue/90 text-white w-36 p-2 rounded-xl"
|
||||
>
|
||||
بارگذاری کلید جدید
|
||||
</Button>
|
||||
</DialogTrigger> */}
|
||||
|
||||
<Table className="border-[1px] border-solid border-muted rounded-md ">
|
||||
{/* <TableCaption>A list of your recent invoices.</TableCaption> */}
|
||||
<TableHeader>
|
||||
|
|
@ -103,15 +98,15 @@ export default function TableController({
|
|||
{data?.map((item: Complaint, index: number) => {
|
||||
return (
|
||||
<TableRow
|
||||
onClick={
|
||||
() => checkKey(item)
|
||||
// saveData({
|
||||
// trackingNumber: item.trackingNumber,
|
||||
// password: Decrypt(item.cipherKeyInspector),
|
||||
// })
|
||||
}
|
||||
className=" hover:bg-gray-200 cursor-pointer"
|
||||
key={item.id}
|
||||
onClick={() => {
|
||||
router.push(`/Account/Complaints/${item.id}`);
|
||||
// setOpen(true);
|
||||
saveData({
|
||||
trackingNumber: item.trackingNumber,
|
||||
});
|
||||
}}
|
||||
>
|
||||
{/* <Link
|
||||
href={`/UserPanel/ControllerDashboard/Complaints/${item.id}`}
|
||||
|
|
@ -124,51 +119,19 @@ export default function TableController({
|
|||
{convertDate(item.registeredAt)}
|
||||
</TableCell>
|
||||
<TableCell className="w-2/12">
|
||||
{item?.category ? item.category.title : "-"}
|
||||
{item?.title ? item.title : "-"}
|
||||
</TableCell>
|
||||
<TableCell className="w-7/12">
|
||||
{item?.complaintOrganization
|
||||
? item?.complaintOrganization.title
|
||||
: "-"}
|
||||
</TableCell>
|
||||
<TableCell className="w-7/12">-</TableCell>
|
||||
{/* </Link> */}
|
||||
</TableRow>
|
||||
);
|
||||
})}
|
||||
</TableBody>
|
||||
</Table>
|
||||
{/* <DialogTrigger asChild>
|
||||
<Button variant="outline">Edit Profile</Button>
|
||||
</DialogTrigger> */}
|
||||
<DialogContent dir="rtl" className="sm:max-w-[425px]">
|
||||
<DialogHeader dir="rtl">
|
||||
<DialogTitle dir="rtl">بارگذاری کلید خصوصی</DialogTitle>
|
||||
<DialogDescription>
|
||||
لطفا کلید خصوصی خود را آپلود نمایید.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div className="grid w-full max-w-sm items-center gap-1.5">
|
||||
{/* <Label htmlFor="picture">Picture</Label> */}
|
||||
<Input
|
||||
dir="rtl"
|
||||
id="picture"
|
||||
onChange={handleFileChange}
|
||||
type="file"
|
||||
accept=".txt"
|
||||
/>
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<DialogClose asChild>
|
||||
<Button
|
||||
onClick={() => {
|
||||
if (selectedFile) {
|
||||
toast("کلید شما با موفقیت بارگذاری شد.");
|
||||
}
|
||||
}}
|
||||
type="submit"
|
||||
>
|
||||
ذخیره
|
||||
</Button>
|
||||
</DialogClose>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ export default function TopNav() {
|
|||
pathname === "/" ? "bg-transparent" : "bg-white"
|
||||
} `}
|
||||
>
|
||||
<p className="bg-gradient-to-r from-gradient1 to-gradient2 inline-block text-transparent bg-clip-text text-xs max-md:hidden font-bold">
|
||||
<p className="bg-gradient-to-r from-gradient1 to-gradient2 inline-block text-transparent bg-clip-text text-xs max-md:hidden font-bold max-sm:text-xs">
|
||||
سال 1402 | مهارم تورم، رشد تولید
|
||||
</p>
|
||||
{/* <p>Current pathname: {pathname}</p> */}
|
||||
<div className="flex items-center gap-10">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className=" flex items-center gap-3 md:ml-4">
|
||||
<p className="bg-gradient-to-r from-gradient1 to-gradient2 inline-block text-transparent bg-clip-text text-xs max-md:text-xs font-bold">
|
||||
امروز: چهارشنبه 24 آبان 1402
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import useData from "@/store/useData";
|
|||
import { JwtPayload, jwtDecode } from "jwt-decode";
|
||||
import { setCookie } from "cookies-next";
|
||||
import { Oval } from "react-loader-spinner";
|
||||
import useToken from "@/store/useToken";
|
||||
|
||||
export default function Verify() {
|
||||
const [otp, setOtp] = useState("");
|
||||
|
|
@ -18,29 +19,31 @@ export default function Verify() {
|
|||
const router = useRouter();
|
||||
const userData = useData((state) => state.data);
|
||||
const [VerifyRole, setVerifyRole] = useState<any>("");
|
||||
const verifyMutation = useMutation({
|
||||
mutationFn: verifyStaff,
|
||||
onSuccess: (res) => {
|
||||
const decodedToken = jwtDecode<any>(res);
|
||||
setCookie("Sootzani_Token", res);
|
||||
const userRole =
|
||||
decodedToken[
|
||||
"http://schemas.microsoft.com/ws/2008/06/identity/claims/role"
|
||||
];
|
||||
localStorage.setItem("Sootzani_Role", userRole);
|
||||
if (userRole == "Inspector") {
|
||||
router.push("/UserPanel/ControllerDashboard");
|
||||
} else if (userRole == "Admin") {
|
||||
router.push("/UserPanel/AdminDashboard");
|
||||
} else {
|
||||
router.push("/UserPanel/CitizenDashboard");
|
||||
}
|
||||
},
|
||||
onError: (err: any) => {},
|
||||
});
|
||||
const saveToken = useToken((state) => state.saveToken);
|
||||
// const verifyMutation = useMutation({
|
||||
// mutationFn: verifyStaff,
|
||||
// onSuccess: (res) => {
|
||||
// const decodedToken = jwtDecode<any>(res);
|
||||
// setCookie("Sootzani_Token", res);
|
||||
// const userRole =
|
||||
// decodedToken[
|
||||
// "http://schemas.microsoft.com/ws/2008/06/identity/claims/role"
|
||||
// ];
|
||||
// localStorage.setItem("Sootzani_Role", userRole);
|
||||
// if (userRole == "Inspector") {
|
||||
// router.push("/UserPanel/ControllerDashboard");
|
||||
// } else if (userRole == "Admin") {
|
||||
// router.push("/UserPanel/AdminDashboard");
|
||||
// } else {
|
||||
// router.push("/UserPanel/CitizenDashboard");
|
||||
// }
|
||||
// },
|
||||
// onError: (err: any) => {},
|
||||
// });
|
||||
const CitizenVerifyMutation = useMutation({
|
||||
mutationFn: verifyCitizen,
|
||||
onSuccess: (res) => {
|
||||
saveToken(true);
|
||||
const decodedToken = jwtDecode<any>(res);
|
||||
setCookie("Sootzani_Token", res);
|
||||
const userRole =
|
||||
|
|
@ -48,7 +51,13 @@ export default function Verify() {
|
|||
"http://schemas.microsoft.com/ws/2008/06/identity/claims/role"
|
||||
];
|
||||
localStorage.setItem("Sootzani_Role", userRole);
|
||||
router.push("/UserPanel/CitizenDashboard");
|
||||
const justLogin = localStorage.getItem("Sootzani_Login_State");
|
||||
if (justLogin) {
|
||||
router.push("/");
|
||||
localStorage.removeItem("Sootzani_Login_State");
|
||||
} else {
|
||||
router.push("/RequestStep1");
|
||||
}
|
||||
},
|
||||
onError: (err: any) => {},
|
||||
});
|
||||
|
|
@ -57,11 +66,7 @@ export default function Verify() {
|
|||
console.log(otp);
|
||||
const payload = { ...userData, verificationCode: otp };
|
||||
console.log(userData);
|
||||
if (userData?.phoneNumber) {
|
||||
CitizenVerifyMutation.mutate(payload);
|
||||
} else {
|
||||
verifyMutation.mutate(payload);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -87,7 +92,6 @@ export default function Verify() {
|
|||
renderInput={(props, idx) => (
|
||||
<input
|
||||
autoFocus={idx == 0}
|
||||
inputMode="decimal"
|
||||
pattern="[0-9]*"
|
||||
{...props}
|
||||
/>
|
||||
|
|
@ -103,12 +107,12 @@ export default function Verify() {
|
|||
</label>
|
||||
<div className="flex justify-end gap-2 w-full mt-14">
|
||||
<Button
|
||||
disabled={verifyMutation.isPending}
|
||||
disabled={CitizenVerifyMutation.isPending}
|
||||
onClick={handelVerify}
|
||||
type="submit"
|
||||
className="bg-blue hover:bg-blue/90 text-white w-1/2 md:w-1/3 p-2 rounded-xl"
|
||||
>
|
||||
{verifyMutation.isPending ? (
|
||||
{CitizenVerifyMutation.isPending ? (
|
||||
<div className="flex justify-center items-center gap-2">
|
||||
<Oval
|
||||
visible={true}
|
||||
|
|
|
|||
|
|
@ -1,60 +0,0 @@
|
|||
"use client"
|
||||
|
||||
import React from 'react';
|
||||
import {
|
||||
Chart as ChartJS,
|
||||
CategoryScale,
|
||||
LinearScale,
|
||||
BarElement,
|
||||
Title,
|
||||
Tooltip,
|
||||
Legend,
|
||||
} from 'chart.js';
|
||||
import { Bar } from 'react-chartjs-2';
|
||||
import { faker } from "@faker-js/faker";
|
||||
|
||||
ChartJS.register(
|
||||
CategoryScale,
|
||||
LinearScale,
|
||||
BarElement,
|
||||
Title,
|
||||
Tooltip,
|
||||
Legend
|
||||
);
|
||||
|
||||
export const options = {
|
||||
responsive: true,
|
||||
plugins: {
|
||||
legend: {
|
||||
position: 'top' as const,
|
||||
},
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Chart.js Bar Chart',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July'];
|
||||
|
||||
export const data = {
|
||||
labels,
|
||||
datasets: [
|
||||
{
|
||||
label: 'Dataset 1',
|
||||
data: labels.map(() => faker.datatype.number({ min: 0, max: 1000 })),
|
||||
backgroundColor: 'rgba(255, 99, 132, 0.5)',
|
||||
},
|
||||
{
|
||||
label: 'Dataset 2',
|
||||
data: labels.map(() => faker.datatype.number({ min: 0, max: 1000 })),
|
||||
backgroundColor: 'rgba(53, 162, 235, 0.5)',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export function VerticalChart() {
|
||||
return (
|
||||
<Bar options={options} data={data} className='!w-full !h-full'/>
|
||||
)
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ export const boxItems = [
|
|||
icon: "/img/box1.svg",
|
||||
icon2: "/img/box1-hover.svg",
|
||||
description: "ارسال درخواست نارضایتی از پرسنل",
|
||||
link: "/RequestStep1",
|
||||
link: "/RequestStep2",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
|
|
@ -56,21 +56,21 @@ export const boxItems = [
|
|||
export const newsItems = [
|
||||
{
|
||||
id: 1,
|
||||
title: "شروع به کار سامانه سوت زنی",
|
||||
title: "شروع به کار سامانه عیون",
|
||||
content:
|
||||
"این سامانه با هدف نظارت بر عملکرد پرستل و نهادهای مرتبط با امور مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است ...",
|
||||
date: "24 آذر ماه 1402",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: "شروع به کار سامانه سوت زنی",
|
||||
title: "شروع به کار سامانه عیون",
|
||||
content:
|
||||
"این سامانه با هدف نظارت بر عملکرد پرستل و نهادهای مرتبط با امور مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است ...",
|
||||
date: "24 آذر ماه 1402",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: "شروع به کار سامانه سوت زنی ",
|
||||
title: "شروع به کار سامانه عیون ",
|
||||
content:
|
||||
"این سامانه با هدف نظارت بر عملکرد پرستل و نهادهای مرتبط با امور مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است ...",
|
||||
date: "24 آذر ماه 1402",
|
||||
|
|
@ -99,8 +99,8 @@ export const aboutFooterItems = [
|
|||
},
|
||||
];
|
||||
export const footerItems = [
|
||||
{ id: 1, name: "قوانین مربوط به سوت زنی", href: "/" },
|
||||
{ id: 2, name: "ارسال گزارش در سامانه سوت زنی قوه قضاییه", href: "/" },
|
||||
{ id: 1, name: "قوانین مربوط به عیون", href: "/" },
|
||||
{ id: 2, name: "ارسال گزارش در سامانه عیون قوه قضاییه", href: "/" },
|
||||
{ id: 3, name: "وب سایت قوه قضاییه", href: "/" },
|
||||
{ id: 4, name: " وب سایت ریاست جمهوری", href: "/" },
|
||||
];
|
||||
|
|
@ -143,8 +143,8 @@ export const AdminMenuItems = [
|
|||
{ id: 1, name: "داشبورد", href: "/UserPanel/AdminDashboard" },
|
||||
{ id: 2, name: "مدیریت کاربران", href: "/UserPanel/AdminDashboard/UserManagement" },
|
||||
{ id: 3, name: "مدیریت کلید ها", href: "/UserPanel/AdminDashboard/KeysManagement" },
|
||||
{ id: 4, name: "سازمان ها", href: "/UserPanel/AdminDashboard/Organizations" },
|
||||
{ id: 5, name: "دسته بندی ها", href: "/UserPanel/AdminDashboard/Categories" },
|
||||
{ id: 4, name: "گزارشات و آمار", href: "/UserPanel/AdminDashboard/#" },
|
||||
{ id: 5, name: "تنظیمات", href: "/UserPanel/AdminDashboard/#" },
|
||||
];
|
||||
|
||||
export const ControllerTableItems = [
|
||||
|
|
@ -235,3 +235,11 @@ export const Operations = [
|
|||
{ value: 6, name: "پایان درخواست" },
|
||||
{ value: 7, name: "شروع مجدد درخواست" },
|
||||
];
|
||||
|
||||
|
||||
export const errorMessages = {
|
||||
500: "خطایی رخ داد. لطفا از اتصال اینترنت خود اطمینان حاصل نمایید.",
|
||||
400: "مشکلی در ارسال درخواست به وجود آمد.",
|
||||
480: "لطفا تمام اطلاعات خواسته شده را وارد نمایید.",
|
||||
428: "کد فعالسازی را وارد نمایید.",
|
||||
};
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
version: '3.8'
|
||||
services:
|
||||
web:
|
||||
image: ${DOCKER_REGISTRY:-docker.shetabdahi.ir/}oyoon
|
||||
restart: always
|
||||
ports:
|
||||
- "127.0.0.1:6678:6678"
|
||||
|
||||
11
lib/utils.ts
11
lib/utils.ts
|
|
@ -4,6 +4,7 @@ import dayjs from "dayjs";
|
|||
import utc from "dayjs/plugin/utc";
|
||||
import jalaliday from "jalaliday";
|
||||
import JSEncrypt from "jsencrypt";
|
||||
import { getCookie } from "cookies-next";
|
||||
|
||||
dayjs.extend(jalaliday);
|
||||
dayjs.extend(utc);
|
||||
|
|
@ -40,3 +41,13 @@ dEqG/38xFdYTFEekexcHnT/Vt1MW4/j76vBJHYWuAJU=
|
|||
const decrypted = decryptor.decrypt(encryptedData);
|
||||
return decrypted;
|
||||
}
|
||||
|
||||
|
||||
export function isAuthorized() {
|
||||
const token = getCookie("Sootzani_Token");
|
||||
if (token) {
|
||||
return true;
|
||||
} else {
|
||||
false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {}
|
||||
const nextConfig = { output: "standalone" };
|
||||
|
||||
module.exports = nextConfig
|
||||
module.exports = nextConfig;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ type Store = {
|
|||
const useToken = create<Store>()(
|
||||
persist(
|
||||
(set) => ({
|
||||
token: "",
|
||||
saveToken: (payload) => {
|
||||
token: false,
|
||||
saveToken: (payload: any) => {
|
||||
set({ token: payload });
|
||||
},
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ module.exports = {
|
|||
backgroundImage: {
|
||||
mainBg: "url('/img/bg.png')",
|
||||
},
|
||||
objectPosition: {
|
||||
"custom": "top 10px right 10px",
|
||||
},
|
||||
screens: {
|
||||
"3xl": "1600px",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
import axios from "axios";
|
||||
import { CookieValueTypes, getCookie } from "cookies-next";
|
||||
|
||||
axios.defaults.baseURL = "https://sootzaniapi.shetabdahi.ir/";
|
||||
|
||||
axios.interceptors.request.use(function (config) {
|
||||
const token = getCookie("Sootzani_Token");
|
||||
config.headers.Authorization = token ? `Bearer ${token}` : "";
|
||||
return config;
|
||||
});
|
||||
|
||||
|
||||
export async function GenerateKeyPair() {
|
||||
const data = await axios.get("api/Admin/GenerateKeyPair");
|
||||
return data.data;
|
||||
}
|
||||
|
||||
export async function GetKeys() {
|
||||
const data = await axios.get("api/Admin/GetKeys");
|
||||
return data.data;
|
||||
}
|
||||
|
||||
export async function AddKey(payload: { title: string; publicKey: string }) {
|
||||
const data = await axios.post("api/Admin/AddKey", payload);
|
||||
return data.data;
|
||||
}
|
||||
|
||||
export async function ChangeKey(payload: {
|
||||
privateKey: string;
|
||||
publicKeyId: string;
|
||||
}) {
|
||||
const data = await axios.post("api/Admin/ChangeKey", payload);
|
||||
return data.data;
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import axios from "axios";
|
||||
import { CookieValueTypes } from "cookies-next";
|
||||
import { CookieValueTypes, getCookie } from "cookies-next";
|
||||
|
||||
axios.defaults.baseURL = "https://sootzaniapi.shetabdahi.ir/";
|
||||
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
||||
|
||||
export async function loginStaff(payload: {
|
||||
username: string;
|
||||
|
|
@ -52,7 +52,10 @@ export async function changePassword(payload: {
|
|||
}
|
||||
|
||||
export async function getProfile() {
|
||||
const data = await axios.get("api/Authenticate/Profile");
|
||||
const token = getCookie("Sootzani_Token");
|
||||
const data = await axios.get("api/Authenticate/Profile", {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
return data.data;
|
||||
}
|
||||
|
||||
|
|
@ -60,9 +63,11 @@ export async function editProfile(payload: {
|
|||
firstName: string;
|
||||
lastName: string;
|
||||
nationalId: string;
|
||||
phoneNumber2: string;
|
||||
title: string;
|
||||
title?: string;
|
||||
}) {
|
||||
const data = await axios.put("api/Authenticate/Profile", payload);
|
||||
const token = getCookie("Sootzani_Token");
|
||||
const data = await axios.put("api/Authenticate/Profile", payload, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
return data.data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,29 @@
|
|||
import axios from "axios";
|
||||
import { CookieValueTypes } from "cookies-next";
|
||||
import { CookieValueTypes, getCookie } from "cookies-next";
|
||||
|
||||
axios.defaults.baseURL = "https://sootzaniapi.shetabdahi.ir/";
|
||||
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
||||
|
||||
axios.interceptors.request.use(function (config) {
|
||||
const token = getCookie("Sootzani_Token");
|
||||
config.headers.Authorization = token ? `Bearer ${token}` : "";
|
||||
return config;
|
||||
});
|
||||
// Post Complaints
|
||||
export async function postComplaintSubmit({ Data }: { Data: FormData }) {
|
||||
const data = await axios.post(`api/Citizen`, Data);
|
||||
return data.data;
|
||||
}
|
||||
export async function postAuthorizedComplaintSubmit({
|
||||
Data,
|
||||
}: {
|
||||
Data: FormData;
|
||||
}) {
|
||||
const token = getCookie("Sootzani_Token");
|
||||
const data = await axios.post(`api/Citizen/Authorized`, Data, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
return data.data;
|
||||
}
|
||||
|
||||
// Post 1 Complaints
|
||||
export async function postComplaintTracking({
|
||||
|
|
@ -24,3 +40,8 @@ export async function postComplaintsDetails(payload: FormData) {
|
|||
const data = await axios.post(`api/Citizen/Operate`, payload);
|
||||
return data.data;
|
||||
}
|
||||
|
||||
export async function getComplaints() {
|
||||
const data = await axios.get("api/Citizen/List");
|
||||
return data.data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,20 @@
|
|||
import axios from "axios";
|
||||
import { CookieValueTypes } from "cookies-next";
|
||||
|
||||
|
||||
// Get Category
|
||||
export async function getCategory() {
|
||||
const data = await axios.get(
|
||||
"api/Common/Categories",
|
||||
);
|
||||
const data = await axios.get("api/Common/Categories");
|
||||
return data.data;
|
||||
}
|
||||
|
||||
export async function getOrganizations() {
|
||||
const data = await axios.get("api/Common/Organizations");
|
||||
return data.data;
|
||||
}
|
||||
|
||||
// Get Captcha
|
||||
export async function getCaptcha() {
|
||||
const data = await axios.get(
|
||||
"api/Common/Captcha", {responseType:'blob'}
|
||||
);
|
||||
console.log(data)
|
||||
const data = await axios.get("api/Common/Captcha", { responseType: "blob" });
|
||||
console.log(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
import axios from "axios";
|
||||
import { CookieValueTypes, getCookie } from "cookies-next";
|
||||
|
||||
axios.defaults.baseURL = "https://sootzaniapi.shetabdahi.ir/";
|
||||
Loading…
Reference in New Issue