Compare commits
No commits in common. "b8cab40e70860abbc7d0b26de36cfa182c7cf199" and "6a9ea9e90b8f764b5ae1ffcd5d093ba7ae6c5be4" have entirely different histories.
b8cab40e70
...
6a9ea9e90b
|
|
@ -1,7 +0,0 @@
|
|||
Dockerfile
|
||||
.dockerignore
|
||||
node_modules
|
||||
npm-debug.log
|
||||
README.md
|
||||
.next
|
||||
.git
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
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-admin
|
||||
|
||||
# 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 }}
|
||||
59
Dockerfile
59
Dockerfile
|
|
@ -1,59 +0,0 @@
|
|||
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 6679
|
||||
|
||||
ENV PORT 6679
|
||||
|
||||
CMD ["node", "server.js"]
|
||||
|
|
@ -1,22 +1,16 @@
|
|||
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("/");
|
||||
}
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
|
||||
<NavbarPanel />
|
||||
{children}
|
||||
</>
|
||||
)
|
||||
|
||||
return (
|
||||
<>
|
||||
<NavbarPanel />
|
||||
{children}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
import AdminDashboard from "@/components/AdminDashboard";
|
||||
import ControllerDashboard from "@/components/ControllerDashboard";
|
||||
import React from "react";
|
||||
|
||||
export default function page() {
|
||||
return <ControllerDashboard />;
|
||||
return (
|
||||
<AdminDashboard />
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,16 @@ 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-10 sm:mt-8 pt-9 mx-auto mb-10">
|
||||
<ComplainsDetails role="Inspector" id={id} />
|
||||
<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>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,11 @@ export default function RootLayout({
|
|||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const cookieStore = cookies();
|
||||
const token = cookieStore.get("Sootzani_Token");
|
||||
if (!token?.value) {
|
||||
return redirect("/");
|
||||
}
|
||||
|
||||
// const cookieStore = cookies();
|
||||
// const token = cookieStore.get("Sootzani-Token");
|
||||
// if (!token.value) {
|
||||
// return redirect("/");
|
||||
// }
|
||||
return (
|
||||
<>
|
||||
<NavbarPanel />
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { Toaster as SonnerToaster } from "@/components/ui/sonner";
|
|||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "عیون",
|
||||
title: "سوت زنی",
|
||||
description: "Generated by create next app",
|
||||
};
|
||||
|
||||
|
|
@ -20,9 +20,9 @@ export default function RootLayout({
|
|||
}) {
|
||||
return (
|
||||
<html lang="fa" dir="rtl">
|
||||
<body className="font-[yekan] bg-white">
|
||||
<body className="font-[yekan] ">
|
||||
<Provider>
|
||||
{children}
|
||||
{children}
|
||||
<Toaster />
|
||||
<SonnerToaster />
|
||||
</Provider>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import Image from "next/image";
|
||||
import CitizenLogin from "../components/CitizenLogin";
|
||||
import Login from "@/components/Login";
|
||||
|
||||
export default function Home() {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"use client";
|
||||
|
||||
import React, { useState, useRef, useEffect } from "react";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { useMutation, useQuery, RefetchOptions } from "@tanstack/react-query";
|
||||
import {
|
||||
GetAllCategories,
|
||||
GetSingleCategory,
|
||||
|
|
@ -11,6 +11,7 @@ import {
|
|||
} from "@/utils/adminApi";
|
||||
import { FaRegEdit } from "react-icons/fa";
|
||||
import { IoMdClose } from "react-icons/io";
|
||||
import { RiDeleteBin6Line } from "react-icons/ri";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { ThreeDots } from "react-loader-spinner";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
|
@ -231,7 +232,7 @@ export default function AdminCategories() {
|
|||
console.log(data);
|
||||
}
|
||||
return (
|
||||
<div className="w-full min-h-[85vh] flex justify-center">
|
||||
<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="flex w-full justify-between flex-row ">
|
||||
{/* 1 */}
|
||||
|
|
@ -417,7 +418,7 @@ export default function AdminCategories() {
|
|||
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 bg-[#F5F5F5]
|
||||
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">
|
||||
|
|
@ -434,7 +435,7 @@ export default function AdminCategories() {
|
|||
<div className="w-full flex justify-end items-end gap-2">
|
||||
<Switch
|
||||
dir="ltr"
|
||||
checked={!item.isDeleted}
|
||||
checked={item.isDeleted}
|
||||
onCheckedChange={() => {
|
||||
DeleteCatMutation.mutate({
|
||||
id: item.id,
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ import { toast } from "sonner";
|
|||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
import * as z from "zod";
|
||||
import { Textarea } from "./ui/textarea";
|
||||
|
||||
const MAX_FILE_SIZE = 5242880; // 5 MB
|
||||
// Edit Key Form
|
||||
|
|
@ -77,8 +76,8 @@ export default function AdminKeysManagement() {
|
|||
const [openAdd, setOpenAdd] = React.useState(false);
|
||||
const [openEdit, setOpenEdit] = React.useState(false);
|
||||
|
||||
const inputPubRef = useRef<HTMLTextAreaElement | null>(null);
|
||||
const inputPrvRef = useRef<HTMLTextAreaElement | null>(null);
|
||||
const inputPubRef = useRef<HTMLInputElement | null>(null);
|
||||
const inputPrvRef = useRef<HTMLInputElement | null>(null);
|
||||
|
||||
// ..............Read .txt
|
||||
const [selectedFile, setSelectedFile] = useState<any>(null);
|
||||
|
|
@ -139,10 +138,17 @@ export default function AdminKeysManagement() {
|
|||
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
|
||||
|
|
@ -204,7 +210,6 @@ export default function AdminKeysManagement() {
|
|||
error: Error1,
|
||||
isLoading: isListLoading,
|
||||
refetch: refetch1,
|
||||
isSuccess: isSuccess1,
|
||||
} = useQuery({
|
||||
queryKey: ["KeysList"],
|
||||
queryFn: () => GetKeys(),
|
||||
|
|
@ -218,7 +223,6 @@ export default function AdminKeysManagement() {
|
|||
error: Error2,
|
||||
isLoading: isNewKeyLoading,
|
||||
refetch: refetch2,
|
||||
isSuccess: isSuccess2,
|
||||
} = useQuery({
|
||||
queryKey: ["GenerateKey"],
|
||||
queryFn: () => GenerateKeyPair(),
|
||||
|
|
@ -232,11 +236,6 @@ export default function AdminKeysManagement() {
|
|||
refetch2();
|
||||
console.log(data2);
|
||||
};
|
||||
useEffect(() => {
|
||||
if (isSuccess2) {
|
||||
formAdd.setValue("publicKey", data2?.publicKey);
|
||||
}
|
||||
}, [isSuccess2]);
|
||||
|
||||
useEffect(() => {
|
||||
if (inputPubRef.current && inputPrvRef.current) {
|
||||
|
|
@ -245,39 +244,28 @@ export default function AdminKeysManagement() {
|
|||
}
|
||||
}, [handleClickGenerate]);
|
||||
|
||||
const saveTextFile = () => {
|
||||
const textToSave = data2?.privateKey ?? "";
|
||||
const fileName = "privateKey.txt";
|
||||
|
||||
// Create a Blob containing the file data
|
||||
const blob = new Blob([textToSave], { type: "text/plain" });
|
||||
|
||||
// Create a link element
|
||||
const link = document.createElement("a");
|
||||
|
||||
// Set the download attribute and create a URL for the Blob
|
||||
link.download = fileName;
|
||||
link.href = window.URL.createObjectURL(blob);
|
||||
|
||||
// Append the link to the document and trigger the click event
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
|
||||
// Remove the link from the document
|
||||
document.body.removeChild(link);
|
||||
const handleClickAddKey = () => {
|
||||
// refetch2();
|
||||
console.log(data1);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (AddKeyMutation.isSuccess) {
|
||||
saveTextFile();
|
||||
}
|
||||
}, [AddKeyMutation.isSuccess]);
|
||||
return (
|
||||
<div className="w-full min-h-[85vh] flex justify-center">
|
||||
<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}>
|
||||
<AlertDialogContent className=" ">
|
||||
<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">
|
||||
|
|
@ -289,79 +277,150 @@ export default function AdminKeysManagement() {
|
|||
</AlertDialogTitle>
|
||||
|
||||
<AlertDialogDescription>
|
||||
<div className=" w-full flex justify-between">
|
||||
<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>
|
||||
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={handleClickGenerate}
|
||||
disabled={isNewKeyLoading}
|
||||
className="my-2"
|
||||
>
|
||||
{" "}
|
||||
ایجاد جفت کلید
|
||||
</Button>
|
||||
<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>
|
||||
<Form {...formAdd}>
|
||||
<form
|
||||
onSubmit={formAdd.handleSubmit(onSubmitAdd)}
|
||||
className="w-full flex flex-col mt-6 "
|
||||
>
|
||||
<div className="flex flex-col flex-wrap justify-between">
|
||||
<FormField
|
||||
control={formAdd.control}
|
||||
name="title"
|
||||
render={({ field }) => (
|
||||
<FormItem className=" w-full ">
|
||||
<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">
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium ">
|
||||
کلید عمومی
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Textarea
|
||||
placeholder="کلید عمومی را وارد کنید"
|
||||
{...field}
|
||||
className="bg-white resize-none"
|
||||
dir="ltr"
|
||||
/>
|
||||
</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>
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
|
|
@ -369,84 +428,74 @@ export default function AdminKeysManagement() {
|
|||
{/* <AlertDialogAction>Continue</AlertDialogAction> */}
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
|
||||
{/* 2 */}
|
||||
<div className=" w-full flex justify-between items-center mt-1">
|
||||
<div className="w-full text-right text-neutral-600 text-lg font-bold my-4">
|
||||
لیست کلیدها
|
||||
</div>
|
||||
<AlertDialogTrigger asChild>
|
||||
<Button
|
||||
variant="outline"
|
||||
className="bg-orange-500 hover:bg-orange-500/80 text-white hover:text-white"
|
||||
// disabled={isNewKeyLoading}
|
||||
>
|
||||
افزودن کلید جدید
|
||||
</Button>
|
||||
</AlertDialogTrigger>
|
||||
</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 bg-[#F5F5F5]
|
||||
{/* 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>
|
||||
>
|
||||
<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>
|
||||
)}
|
||||
/>
|
||||
<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
|
||||
{/* <FormField
|
||||
control={formEdit.control}
|
||||
name="publicKeyId"
|
||||
render={({ field }) => (
|
||||
|
|
@ -466,42 +515,41 @@ export default function AdminKeysManagement() {
|
|||
</FormItem>
|
||||
)}
|
||||
/> */}
|
||||
</div>
|
||||
</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>
|
||||
<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
|
||||
{/* <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>
|
||||
</AlertDialog>
|
||||
<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>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ export default function AdminOrganizations() {
|
|||
console.log(data);
|
||||
}
|
||||
return (
|
||||
<div className="w-full min-h-[85vh] flex justify-center">
|
||||
<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="flex w-full justify-between flex-row ">
|
||||
{/* 1 */}
|
||||
|
|
@ -421,7 +421,7 @@ export default function AdminOrganizations() {
|
|||
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 bg-[#F5F5F5]
|
||||
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">
|
||||
|
|
@ -438,7 +438,7 @@ export default function AdminOrganizations() {
|
|||
<div className="w-full flex justify-end items-end gap-2">
|
||||
<Switch
|
||||
dir="ltr"
|
||||
checked={!item.isDeleted}
|
||||
checked={item.isDeleted}
|
||||
onCheckedChange={() => {
|
||||
DeleteOrgMutation.mutate({
|
||||
id: item.id,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
"use client";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import React, { useEffect } from "react";
|
||||
import greenIcon from "../public/img/greenPoint.svg";
|
||||
import blueIcon from "../public/img/bluepoint.svg";
|
||||
import Image from "next/image";
|
||||
|
|
@ -7,29 +7,13 @@ import { ComplainDetailsItems } from "@/constants";
|
|||
import { useMutation } from "@tanstack/react-query";
|
||||
import { OperateByInspector, getComplaint } from "@/utils/inspectorApi";
|
||||
import useData from "@/store/useData";
|
||||
import { Decrypt, convertDate, convertFullTime } from "@/lib/utils";
|
||||
import { convertDate } from "@/lib/utils";
|
||||
import { Badge } from "./ui/badge";
|
||||
import InspectorOperations from "./InspectorOperations";
|
||||
import { ArrowDownToLine, ArrowRight, File } from "lucide-react";
|
||||
import { postComplaintTracking } from "@/utils/citizenApi";
|
||||
import { ArrowDownToLine, File } from "lucide-react";
|
||||
import { Separator } from "./ui/separator";
|
||||
import secureLocalStorage from "react-secure-storage";
|
||||
import { Checkbox } from "./ui/checkbox";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
AlertDialogTrigger,
|
||||
} from "@/components/ui/alert-dialog";
|
||||
import { Input } from "./ui/input";
|
||||
import { toast } from "sonner";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { Triangle } from "react-loader-spinner";
|
||||
|
||||
export default function ComplainsDetails({
|
||||
id,
|
||||
role,
|
||||
|
|
@ -40,47 +24,46 @@ export default function ComplainsDetails({
|
|||
Data?: any;
|
||||
}) {
|
||||
const storeData = useData((state) => state.data);
|
||||
const [open, setOpen] = useState<boolean>(true);
|
||||
const [check, setCheck] = useState<any>(false);
|
||||
const [complaintData, setComplaintData] = useState<any>("");
|
||||
const [selectedFile, setSelectedFile] = useState<any>(null);
|
||||
const [key, setKey] = useState<any>(null);
|
||||
const router = useRouter();
|
||||
let data;
|
||||
|
||||
const getComplaintMutation = useMutation({
|
||||
const getComplaintMutation = useMutation<
|
||||
any,
|
||||
Error,
|
||||
{ trackingNumber: string; password: string }
|
||||
>({
|
||||
mutationKey: ["Complaint", id],
|
||||
mutationFn: getComplaint,
|
||||
onSuccess: (res) => {
|
||||
localStorage.setItem("trackingNumber", res.trackingNumber);
|
||||
},
|
||||
mutationFn:
|
||||
role == "Inspector"
|
||||
? (getComplaint as any)
|
||||
: (postComplaintTracking as any),
|
||||
onSuccess: (res) => {},
|
||||
onError: (err) => {},
|
||||
});
|
||||
|
||||
console.log(storeData);
|
||||
|
||||
useEffect(() => {
|
||||
const storedData = localStorage.getItem("CompliantData");
|
||||
const data = JSON.parse(storedData as string);
|
||||
const pw = localStorage.getItem("privateKey") as string;
|
||||
localStorage.setItem("trackingNumber", data.trackingNumber);
|
||||
if (pw != null) {
|
||||
getComplaintMutation.mutate({
|
||||
trackingNumber: data.trackingNumber,
|
||||
password: pw,
|
||||
});
|
||||
setOpen(false);
|
||||
if (role == "Inspector") {
|
||||
useData.persist.rehydrate();
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const storedData = localStorage.getItem("CompliantData");
|
||||
const data = JSON.parse(storedData as string);
|
||||
setComplaintData(data);
|
||||
}, []);
|
||||
|
||||
if (storeData && role == "Inspector") {
|
||||
getComplaintMutation.mutate(storeData);
|
||||
}
|
||||
}, [storeData]);
|
||||
if (getComplaintMutation.isSuccess) {
|
||||
data = getComplaintMutation.data;
|
||||
} else if (Data) {
|
||||
data = Data;
|
||||
}
|
||||
|
||||
const handleOpenFile = (file) => {
|
||||
const fileURL = URL.createObjectURL(
|
||||
new Blob([atob(file.data)], { type: file.mimeType })
|
||||
);
|
||||
window.open(fileURL, "_blank");
|
||||
};
|
||||
const openFileInNewTab = (base64Data: any, fileType: any) => {
|
||||
const blob = b64toBlob(base64Data, fileType);
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
|
|
@ -114,7 +97,7 @@ export default function ComplainsDetails({
|
|||
}
|
||||
};
|
||||
|
||||
const downloadFile = (base64Data: any, fileName: any, fileType: any) => {
|
||||
const downloadFile = (base64Data, fileName, fileType) => {
|
||||
const blob = b64toBlob(base64Data, fileType);
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
|
||||
|
|
@ -126,7 +109,7 @@ export default function ComplainsDetails({
|
|||
URL.revokeObjectURL(blobUrl);
|
||||
};
|
||||
|
||||
const b64toBlob = (b64Data: any, contentType = "", sliceSize = 512) => {
|
||||
const b64toBlob = (b64Data, contentType = "", sliceSize = 512) => {
|
||||
const byteCharacters = atob(b64Data);
|
||||
const byteArrays = [];
|
||||
|
||||
|
|
@ -144,441 +127,136 @@ export default function ComplainsDetails({
|
|||
|
||||
return new Blob(byteArrays, { type: contentType });
|
||||
};
|
||||
|
||||
const handleFileChange = (event: any) => {
|
||||
const file = event.target.files[0];
|
||||
const reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
const contents = e?.target?.result;
|
||||
setSelectedFile(contents);
|
||||
};
|
||||
reader.readAsText(file);
|
||||
};
|
||||
|
||||
const checkKey2 = (item: any) => {
|
||||
const dcKey = Decrypt(item.cipherKeyInspector, selectedFile);
|
||||
console.log(dcKey);
|
||||
if (dcKey != false && dcKey != null) {
|
||||
if (check) {
|
||||
localStorage.setItem("privateKey", dcKey);
|
||||
}
|
||||
localStorage.setItem("trackingNumber", item.trackingNumber);
|
||||
setKey(dcKey);
|
||||
getComplaintMutation.mutate({
|
||||
trackingNumber: item.trackingNumber,
|
||||
password: dcKey as string,
|
||||
});
|
||||
setOpen(false);
|
||||
} else {
|
||||
toast("کلید شما معتبر نمی باشد.", {
|
||||
className: "!bg-red-500 !text-white",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
data = getComplaintMutation?.data;
|
||||
console.log(Data);
|
||||
return (
|
||||
<>
|
||||
<AlertDialog open={open} onOpenChange={setOpen}>
|
||||
<AlertDialogContent dir="rtl" className="">
|
||||
<AlertDialogHeader dir="rtl">
|
||||
<AlertDialogTitle dir="rtl">بارگذاری کلید خصوصی</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
برای مشاهده شکایت لطفا کلید خود را آپلود نمایید.
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<div className="grid w-full max-w-sm items-center gap-1.5 px-8">
|
||||
<Input
|
||||
dir="rtl"
|
||||
id="picture"
|
||||
onChange={handleFileChange}
|
||||
type="file"
|
||||
accept=".txt"
|
||||
className=" bg-white hover:bg-white focus:bg-white"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2 px-8">
|
||||
<Checkbox
|
||||
checked={check}
|
||||
onCheckedChange={setCheck}
|
||||
id="terms"
|
||||
className=" ml-2"
|
||||
/>
|
||||
<label
|
||||
htmlFor="terms"
|
||||
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||
>
|
||||
ذخیره کلید برای استفاده در زمان های بعدی
|
||||
</label>
|
||||
</div>
|
||||
<AlertDialogFooter className=" gap-y-2 max-md:w-full max-md:flex max-md:flex-col">
|
||||
{/* <DialogClose asChild></DialogClose> */}
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => {
|
||||
router.push("/UserPanel/ControllerDashboard/Complaints");
|
||||
}}
|
||||
type="submit"
|
||||
className=" md:ml-2"
|
||||
>
|
||||
بازگشت
|
||||
</Button>
|
||||
<Button
|
||||
className=" bg-blue hover:bg-blue/90"
|
||||
onClick={() => {
|
||||
checkKey2(complaintData);
|
||||
}}
|
||||
type="submit"
|
||||
>
|
||||
ذخیره
|
||||
</Button>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
{getComplaintMutation.data && !getComplaintMutation.isPending ? (
|
||||
<>
|
||||
<button
|
||||
onClick={() =>
|
||||
router.push("/UserPanel/ControllerDashboard/Complaints")
|
||||
}
|
||||
className=" my-2 flex gap-1 cursor-pointer text-blue "
|
||||
>
|
||||
<span>
|
||||
<ArrowRight />
|
||||
</span>
|
||||
<p>بازگشت</p>
|
||||
</button>
|
||||
|
||||
<div className="w-full flex max-lg:flex-col items-start mt-2 gap-2">
|
||||
<div className="flex flex-col w-full lg:w-1/3 gap-3 lg:sticky top-24">
|
||||
<div className=" max-lg:hidden bg-[#E9E9E9] rounded-md p-4 px-10 flex flex-col">
|
||||
<p className="text-[#464646] text-base font-bold mb-1">
|
||||
انجام عملیات
|
||||
{data ? (
|
||||
<div className="w-full flex max-lg:flex-col gap-3 items-start">
|
||||
<div className="flex flex-col w-full lg:w-1/3 lg:order-2 gap-3 lg:sticky top-20">
|
||||
<div className=" bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col">
|
||||
<p className="text-[#464646] text-base font-bold">گزارش شکایت</p>
|
||||
<div className="mt-2">
|
||||
<p className="text-[#2e2a2a] text-sm font-medium">
|
||||
موضوع شکایت:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{data.title}
|
||||
</span>
|
||||
</p>
|
||||
<InspectorOperations
|
||||
updateData={(data) => getComplaintMutation.mutate(data)}
|
||||
role={role}
|
||||
complaintData={data}
|
||||
id={id}
|
||||
key2={key}
|
||||
/>
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
دستگاه مربوطه:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{/* {data.title} */}
|
||||
</span>
|
||||
</p>
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
پرسنل مربوطه:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{/* {data.title} */}
|
||||
</span>
|
||||
</p>
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
زمان ثبت:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{convertDate(data.registeredAt)}
|
||||
</span>
|
||||
</p>
|
||||
{/* <p className="text-[#464646] text-sm font-medium">
|
||||
{" "}
|
||||
موضوع شکایت:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
متن تستی
|
||||
</span>
|
||||
</p> */}
|
||||
</div>
|
||||
{/* <p className="text-[#464646] text-sm font-medium text-justify">
|
||||
درخواست شما با کد رهگیری {data.trackingNumber} و رمز عبور 12422 در
|
||||
دست بررسی و اقدام می باشد. در صورت تمایل می توانید با شماره تلفن
|
||||
0353286545 جهت پشتیبانی تماس حاصل کنید.{" "}
|
||||
</p> */}
|
||||
</div>
|
||||
<div className="w-full lg:w-2/3 self-stretch rounded-lg flex flex-col gap-2 ">
|
||||
<div className=" bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col md:flex-row gap-2 items-center justify-center">
|
||||
{data.user == null ? (
|
||||
<>
|
||||
<div className="mt-2 flex flex-col gap-y-1 border rounded-md border-gray-400 w-full p-5 relative">
|
||||
<p className=" absolute -top-3 right-2 bg-[#E9E9E9] px-2 text-sm text-gray-500">
|
||||
اطلاعات کلی
|
||||
</p>
|
||||
<p className="text-[#2e2a2a] text-sm font-medium">
|
||||
موضوع شکایت:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{data?.title}
|
||||
</span>
|
||||
</p>
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
دستگاه مربوطه:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{data?.complaintOrganization
|
||||
? data?.complaintOrganization.title
|
||||
: "-"}
|
||||
</span>
|
||||
</p>
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
فرد مربوطه:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{data.complaining ? data.complaining : "-"}
|
||||
</span>
|
||||
</p>
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
زمان ثبت:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{convertFullTime(data.registeredAt)}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<div className="mt-2 flex flex-col gap-y-1 border rounded-md border-gray-400 md:w-1/2 p-5 relative">
|
||||
<p className=" absolute -top-3 right-2 bg-[#E9E9E9] px-2 text-sm text-gray-500">
|
||||
اطلاعات کلی
|
||||
</p>
|
||||
<p className="text-[#2e2a2a] text-sm font-medium">
|
||||
موضوع شکایت:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{data?.title}
|
||||
</span>
|
||||
</p>
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
دستگاه مربوطه:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{data?.complaintOrganization
|
||||
? data?.complaintOrganization.title
|
||||
: "-"}
|
||||
</span>
|
||||
</p>
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
فرد مربوطه:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{data.complaining ? data.complaining : "-"}
|
||||
</span>
|
||||
</p>
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
زمان ثبت:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{convertFullTime(data.registeredAt)}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div className="mt-2 flex flex-col gap-y-1 border rounded-md border-gray-400 md:w-1/2 p-5 relative">
|
||||
<p className=" absolute -top-3 right-2 bg-[#E9E9E9] px-2 text-sm text-gray-500">
|
||||
اطلاعات شاکی
|
||||
</p>
|
||||
<p className="text-[#2e2a2a] text-sm font-medium">
|
||||
نام:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{data.user?.firstName ? data.user?.firstName : "-"}
|
||||
</span>
|
||||
</p>
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
نام خانوادگی:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{data.user?.lastName ? data.user?.lastName : "-"}
|
||||
</span>
|
||||
</p>
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
کدملی:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{data.user?.nationalId ? data.user?.nationalId : "-"}
|
||||
</span>
|
||||
</p>
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
شماره موبایل:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{data.user?.phoneNumber
|
||||
? data.user?.phoneNumber
|
||||
: "-"}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<div className="bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col">
|
||||
<p className="text-[#464646] text-base font-bold">روند شکایت</p>
|
||||
<div className=" flex flex-col gap-y-4 mt-4">
|
||||
{data.contents?.map((item: any) => {
|
||||
return (
|
||||
<div
|
||||
key={item.id}
|
||||
className=" bg-white p-4 rounded-lg shadow-md"
|
||||
>
|
||||
<div className=" flex gap-4 items-center">
|
||||
<p className="">
|
||||
<Badge>
|
||||
{item.sender == 0 ? "شهروند" : "بازرس"}
|
||||
</Badge>
|
||||
</p>
|
||||
<p className="">
|
||||
تاریخ :
|
||||
<span className="text-[#7C838A]">
|
||||
{convertDate(item.dateTime)}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div className=" text-[#464646] mt-2">
|
||||
<span className="text-[#7C838A]">
|
||||
{item.text ? item.text : "-"}
|
||||
</span>
|
||||
</div>
|
||||
{item.media.length !== 0 && (
|
||||
<Separator className=" mt-2 mb-1" />
|
||||
)}
|
||||
<div className=" text-[#464646] mt-2">
|
||||
<div className=" flex flex-wrap max-md:flex-col w-full items-center gap-2 text-xs mt-2">
|
||||
{item?.media.map((item: any, index: number) => {
|
||||
return (
|
||||
<div
|
||||
key={index}
|
||||
className=" bg-gray-100 text-[#7C838A] w-full md:w-[30%] rounded-md h-12 p-2 flex justify-between gap-3 items-center"
|
||||
>
|
||||
<a
|
||||
onClick={() =>
|
||||
openFileInNewTab(item.data, item.mimeType)
|
||||
}
|
||||
className=" cursor-pointer flex gap-2 truncate items-center"
|
||||
>
|
||||
<File className=" w-6 h-6" />
|
||||
<p className=" max-w-[5rem] truncate">
|
||||
{item.title}
|
||||
</p>
|
||||
</a>
|
||||
<ArrowDownToLine
|
||||
className=" cursor-pointer"
|
||||
onClick={() =>
|
||||
downloadFile(
|
||||
item.data,
|
||||
item.title,
|
||||
item.mimeType
|
||||
)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
{data.contents?.map((item: any) => {
|
||||
return (
|
||||
<div
|
||||
key={item.id}
|
||||
className=" bg-white p-4 rounded-lg shadow-md"
|
||||
>
|
||||
<div className=" flex gap-4 items-center">
|
||||
<p className="">
|
||||
<Badge>
|
||||
{item.sender == 0 ? "شهروند" : "بازرس"}
|
||||
</Badge>
|
||||
</p>
|
||||
<p className="">
|
||||
تاریخ :
|
||||
<span className="text-[#7C838A]">
|
||||
{convertDate(item.dateTime)}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div className=" text-[#464646] mt-2">
|
||||
<span className="text-[#7C838A]">
|
||||
{item.text ? item.text : "-"}
|
||||
</span>
|
||||
</div>
|
||||
{item.media.length !== 0 && (
|
||||
<Separator className=" mt-2 mb-1" />
|
||||
)}
|
||||
<div className=" text-[#464646] mt-2">
|
||||
<div className=" flex flex-wrap max-md:flex-col w-full items-center gap-2 text-xs mt-2">
|
||||
{item?.media.map((item: any, index: number) => {
|
||||
return (
|
||||
<div
|
||||
key={index}
|
||||
className=" bg-gray-100 text-[#7C838A] w-full md:w-[30%] rounded-md h-12 p-2 flex justify-between gap-3 items-center"
|
||||
>
|
||||
<a
|
||||
onClick={() =>
|
||||
openFileInNewTab(item.data, item.mimeType)
|
||||
}
|
||||
className=" cursor-pointer flex gap-2 truncate items-center"
|
||||
>
|
||||
<File className=" w-6 h-6" />
|
||||
<p className=" max-w-[5rem] truncate">
|
||||
{item.title}
|
||||
</p>
|
||||
</a>
|
||||
<ArrowDownToLine
|
||||
className=" cursor-pointer"
|
||||
onClick={() =>
|
||||
downloadFile(
|
||||
item.data,
|
||||
item.title,
|
||||
item.mimeType
|
||||
)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
{data.contents?.map((item: any) => {
|
||||
return (
|
||||
<div
|
||||
key={item.id}
|
||||
className=" bg-white p-4 rounded-lg shadow-md"
|
||||
>
|
||||
<div className=" flex gap-4 items-center">
|
||||
<p className="">
|
||||
<Badge>
|
||||
{item.sender == 0 ? "شهروند" : "بازرس"}
|
||||
</Badge>
|
||||
</p>
|
||||
<p className="">
|
||||
تاریخ :
|
||||
<span className="text-[#7C838A]">
|
||||
{convertDate(item.dateTime)}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div className=" text-[#464646] mt-2">
|
||||
<span className="text-[#7C838A]">
|
||||
{item.text ? item.text : "-"}
|
||||
</span>
|
||||
</div>
|
||||
{item.media.length !== 0 && (
|
||||
<Separator className=" mt-2 mb-1" />
|
||||
)}
|
||||
<div className=" text-[#464646] mt-2">
|
||||
<div className=" flex flex-wrap max-md:flex-col w-full items-center gap-2 text-xs mt-2">
|
||||
{item?.media.map((item: any, index: number) => {
|
||||
return (
|
||||
<div
|
||||
key={index}
|
||||
className=" bg-gray-100 text-[#7C838A] w-full md:w-[30%] rounded-md h-12 p-2 flex justify-between gap-3 items-center"
|
||||
>
|
||||
<a
|
||||
onClick={() =>
|
||||
openFileInNewTab(item.data, item.mimeType)
|
||||
}
|
||||
className=" cursor-pointer flex gap-2 truncate items-center"
|
||||
>
|
||||
<File className=" w-6 h-6" />
|
||||
<p className=" max-w-[5rem] truncate">
|
||||
{item.title}
|
||||
</p>
|
||||
</a>
|
||||
<ArrowDownToLine
|
||||
className=" cursor-pointer"
|
||||
onClick={() =>
|
||||
downloadFile(
|
||||
item.data,
|
||||
item.title,
|
||||
item.mimeType
|
||||
)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className=" lg:hidden order-2 w-full bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col mt-2">
|
||||
<div className=" max-lg:hidden order-2 bg-[#E9E9E9] rounded-md p-4 px-10 flex flex-col">
|
||||
<p className="text-[#464646] text-base font-bold mb-1">
|
||||
انجام عملیات
|
||||
</p>
|
||||
<InspectorOperations
|
||||
updateData={(data) => getComplaintMutation.mutate(data)}
|
||||
updateData={() => getComplaintMutation.mutate(storeData)}
|
||||
role={role}
|
||||
complaintData={data}
|
||||
id={id}
|
||||
key2={key}
|
||||
/>
|
||||
</div>
|
||||
{/* Left */}
|
||||
{/* <div className="w-full md:w-1/3 bg-white shadow-lg rounded-md pt-3 px-4 flex flex-row md:flex-col max-md:flex-wrap">
|
||||
</div>
|
||||
<div className="w-full lg:w-2/3 self-stretch bg-[#E9E9E9] p-4 px-10 rounded-lg">
|
||||
<p className="text-[#464646] text-base font-bold">روند شکایت</p>
|
||||
<div className=" flex flex-col gap-y-4 mt-4">
|
||||
{data.contents?.map((item: any) => {
|
||||
return (
|
||||
<div
|
||||
key={item.id}
|
||||
className=" bg-white p-4 rounded-lg shadow-md"
|
||||
>
|
||||
<div className=" flex gap-4 items-center">
|
||||
<p className="">
|
||||
<Badge>{item.sender == 0 ? "شهروند" : "بازرس"}</Badge>
|
||||
</p>
|
||||
<p className="">
|
||||
تاریخ :
|
||||
<span className="text-[#7C838A]">
|
||||
{convertDate(item.dateTime)}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div className=" text-[#464646] mt-2">
|
||||
<span className="text-[#7C838A]">
|
||||
{item.text ? item.text : "-"}
|
||||
</span>
|
||||
</div>
|
||||
{item.media.length !== 0 && <Separator className=" mt-2" />}
|
||||
<div className=" text-[#464646] mt-2">
|
||||
<div className=" flex flex-wrap max-md:flex-col w-full items-center gap-2 text-xs mt-2">
|
||||
{item?.media.map((item: any) => {
|
||||
return (
|
||||
<div className=" bg-gray-100 text-[#7C838A] w-full md:w-40 rounded-md p-2 flex justify-between gap-2 ">
|
||||
<a
|
||||
onClick={() =>
|
||||
openFileInNewTab(item.data, item.mimeType)
|
||||
}
|
||||
className=" cursor-pointer flex gap-2 truncate items-center"
|
||||
>
|
||||
<File />
|
||||
<p className=" truncate">{item.title}</p>
|
||||
</a>
|
||||
<ArrowDownToLine
|
||||
className=" cursor-pointer"
|
||||
onClick={() =>
|
||||
downloadFile(
|
||||
item.data,
|
||||
item.title,
|
||||
item.mimeType
|
||||
)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
<div className=" lg:hidden order-2 w-full bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col">
|
||||
<p className="text-[#464646] text-base font-bold mb-1">
|
||||
انجام عملیات
|
||||
</p>
|
||||
<InspectorOperations
|
||||
updateData={() => getComplaintMutation.mutate(storeData)}
|
||||
role={role}
|
||||
complaintData={data}
|
||||
/>
|
||||
</div>
|
||||
{/* Left */}
|
||||
{/* <div className="w-full md:w-1/3 bg-white shadow-lg rounded-md pt-3 px-4 flex flex-row md:flex-col max-md:flex-wrap">
|
||||
<p className="text-[#464646] text-base font-bold mb-3">
|
||||
وضعیت درخواست
|
||||
</p>
|
||||
|
|
@ -616,24 +294,9 @@ export default function ComplainsDetails({
|
|||
);
|
||||
})}
|
||||
</div> */}
|
||||
</div>
|
||||
</>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
{getComplaintMutation.isPending && (
|
||||
<div className="w-full h-full flex justify-center mt-20">
|
||||
<Triangle
|
||||
visible={true}
|
||||
height="100"
|
||||
width="100"
|
||||
color="#003778"
|
||||
ariaLabel="triangle-loading"
|
||||
wrapperStyle={{}}
|
||||
wrapperClass=""
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
""
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -24,21 +24,15 @@ export default function ControllerDashboard() {
|
|||
{/* Lg Show */}
|
||||
<div className="w-full mb-6 flex-col gap-0 flex">
|
||||
<div className="w-full flex flex-row flex-wrap mx-auto justify-center gap-8 mb-10">
|
||||
{data?.singletons.map((item: any, index: number) => {
|
||||
return (
|
||||
<BoxDashboard key={index} value={item.value} title={item.title} />
|
||||
);
|
||||
{data?.singletons.map((item: any) => {
|
||||
return <BoxDashboard value={item.value} title={item.title} />;
|
||||
})}
|
||||
</div>
|
||||
|
||||
<div className=" bg-[#EFEFEF80] rounded-lg flex justify-center shadow-md">
|
||||
{data?.charts.map((item: any, index: number) => {
|
||||
{data?.charts.map((item: any) => {
|
||||
return (
|
||||
<LineChart
|
||||
key={index}
|
||||
chartTitle={item.chartTitle}
|
||||
chartData={item.series}
|
||||
/>
|
||||
<LineChart chartTitle={item.chartTitle} chartData={item.series} />
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,214 @@
|
|||
"use client";
|
||||
import React, { useEffect, useState, useRef } from "react";
|
||||
import Image from "next/image";
|
||||
import Resultimg from "../public/img/followResult.png";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { ThreeDots } from "react-loader-spinner";
|
||||
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
AlertDialogTrigger,
|
||||
} from "@/components/ui/alert-dialog";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { IoMdClose } from "react-icons/io";
|
||||
import { postComplaintTracking } from "@/utils/citizenApi";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { useReactToPrint } from "react-to-print";
|
||||
|
||||
import "../app/print-styles.css";
|
||||
import ComplainsDetails from "./ComplainsDetails";
|
||||
|
||||
export default function FollowResult() {
|
||||
const router = useRouter();
|
||||
const [trackingNumber, setTrackingNumber] = useState<any>();
|
||||
const [password, setPassword] = useState<any>();
|
||||
const [complaintData, setComplaintData] = useState<any>();
|
||||
const [printStyle, setPrintStyle] = useState<boolean>(true);
|
||||
|
||||
// Print component Data
|
||||
const componentRef = useRef<HTMLDivElement>(null);
|
||||
const handlePrint = useReactToPrint({
|
||||
content: () => componentRef.current,
|
||||
// onBeforePrint() {
|
||||
// setPrintStyle(!printStyle);
|
||||
// },
|
||||
// onAfterPrint() {
|
||||
// setPrintStyle(!printStyle)
|
||||
// },
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
setTrackingNumber(localStorage.getItem("trackingNumber2"));
|
||||
setPassword(localStorage.getItem("password2"));
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (trackingNumber && password) {
|
||||
complaintPrintMutation.mutate({
|
||||
Data: { trackingNumber: trackingNumber, password: password },
|
||||
});
|
||||
}
|
||||
}, [trackingNumber, password]);
|
||||
|
||||
const complaintPrintMutation = useMutation({
|
||||
mutationKey: ["complaintPrint"],
|
||||
mutationFn: postComplaintTracking,
|
||||
onSuccess: (res) => {
|
||||
setComplaintData(res);
|
||||
},
|
||||
onError: (error) => {
|
||||
console.log(error);
|
||||
console.log(error?.message);
|
||||
},
|
||||
});
|
||||
|
||||
function onSubmit() {
|
||||
console.log("SuccessPrinttttttttttt");
|
||||
|
||||
// complaintPrintMutation.mutate({
|
||||
// Data: { trackingNumber: trackingNumber, password: password },
|
||||
// });
|
||||
}
|
||||
// const possibleOperations = complaintPrintMutation.data?.possibleOperations;
|
||||
// const selectOptions = Operations.filter((item, index) =>
|
||||
// possibleOperations.includes(index)
|
||||
// );
|
||||
|
||||
const printableContent = "This is the content to be printed.";
|
||||
console.log(complaintPrintMutation?.data);
|
||||
return (
|
||||
<>
|
||||
<div className="w-[90vw] sm:w-[90vw] lg:w-[85vw] xl:w-[75vw] 3xl:w-[70vw] max-sm:mt-16 pt-4 mx-auto mb-10">
|
||||
{/* <div className="h-full flex flex-col justify-center"> */}
|
||||
{/* <p
|
||||
className="text-sm font-medium leading-6 tracking-wide text-[#7C838A] dark:text-white
|
||||
3xl:text-base 3xl:font-bold"
|
||||
>
|
||||
درخواست شما با کد رهگیری
|
||||
<span className="text-slate-500 mx-2">{`${trackingNumber}`}</span>و
|
||||
رمز عبور
|
||||
<span className="text-slate-500 mx-2">{`${password}`}</span>
|
||||
در دست بررسی و اقدام می باشد. در صورت تمایل می توانید با شماره تلفن
|
||||
0353286545 جهت پشتیبانی تماس حاصل کنید.
|
||||
</p> */}
|
||||
{complaintPrintMutation?.data ? (
|
||||
<>
|
||||
<div className="flex justify-center sm:justify-end gap-2 mb-2">
|
||||
<AlertDialog>
|
||||
<AlertDialogTrigger asChild>
|
||||
<Button
|
||||
variant="outline"
|
||||
type="submit"
|
||||
onClick={() => onSubmit()}
|
||||
className="w-fit bg-blue text-white p-2 rounded-xl text-center"
|
||||
>
|
||||
پرینت درخواست
|
||||
</Button>
|
||||
</AlertDialogTrigger>
|
||||
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>
|
||||
<p className="text-[#464646] text-base font-bold">
|
||||
گزارش شکایات
|
||||
</p>
|
||||
|
||||
<AlertDialogCancel className="p-0 border-0 h-auto">
|
||||
<IoMdClose />
|
||||
</AlertDialogCancel>
|
||||
</AlertDialogTitle>
|
||||
|
||||
<AlertDialogDescription className="h-full px-0 py-0 sm:px-0 sm:pt-0 ">
|
||||
{complaintPrintMutation.isPending ? (
|
||||
<div className="felx justify-center items-center self-center h-full">
|
||||
<ThreeDots
|
||||
visible={true}
|
||||
height="80"
|
||||
width="100"
|
||||
color="#003778"
|
||||
radius="9"
|
||||
ariaLabel="three-dots-loading"
|
||||
wrapperStyle={{}}
|
||||
wrapperClass=""
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div
|
||||
dir="rtl"
|
||||
className=" font-[yekan] px-10 py-4 sm:px-28 sm:pt-9 "
|
||||
id="details"
|
||||
ref={componentRef}
|
||||
// style={{ border: printStyle ? 'none' : '5px solid black' , margin: printStyle ? 'auto': '1em' }}
|
||||
>
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
{" "}
|
||||
موضوع شکایت:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{`${complaintData?.title}`}
|
||||
</span>
|
||||
</p>
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
{" "}
|
||||
متن شکایت:{" "}
|
||||
<span className="text-[#7C838A] text-sm font-medium">
|
||||
{`${complaintData?.contents[0]?.text}`}
|
||||
</span>
|
||||
</p>
|
||||
<br />
|
||||
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
{" "}
|
||||
جزئیات شکایت:
|
||||
</p>
|
||||
<br />
|
||||
<p className="text-[#464646] text-sm font-medium">
|
||||
درخواست شما با کد رهگیری
|
||||
<span className="text-slate-500 mx-2">{`${trackingNumber}`}</span>
|
||||
و رمز عبور
|
||||
<span className="text-slate-500 mx-2">{`${password}`}</span>
|
||||
در دست بررسی و اقدام می باشد. در صورت تمایل می
|
||||
توانید با شماره تلفن 0353286545 جهت پشتیبانی تماس
|
||||
حاصل کنید.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<Button
|
||||
className="bg-blue text-white w-1/2 sm:w-1/6"
|
||||
onClick={handlePrint}
|
||||
>
|
||||
پرینت گزارش
|
||||
</Button>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
</div>
|
||||
<ComplainsDetails
|
||||
role="Citizen"
|
||||
Data={complaintPrintMutation?.data}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
|
||||
{/* <Image
|
||||
alt="icon"
|
||||
src={Resultimg}
|
||||
className="self-center w-3/5 mt-5 sm:w-[23em] sm:h-[20em] 3xl:w-3/5 3xl:h-[30em] object-contain"
|
||||
/> */}
|
||||
{/* </div> */}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -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 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,9 +38,7 @@ 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>
|
||||
);
|
||||
})}
|
||||
|
|
@ -75,7 +73,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>
|
||||
|
|
|
|||
|
|
@ -29,34 +29,36 @@ import {
|
|||
} from "@/components/ui/select";
|
||||
import { Operations } from "@/constants";
|
||||
import useData from "@/store/useData";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { OperateByInspector } from "@/utils/inspectorApi";
|
||||
import { toast } from "sonner";
|
||||
import secureLocalStorage from "react-secure-storage";
|
||||
import { Decrypt } from "@/lib/utils";
|
||||
import { postComplaintsDetails } from "@/utils/citizenApi";
|
||||
|
||||
export default function InspectorOperations({
|
||||
complaintData,
|
||||
role,
|
||||
updateData,
|
||||
id,
|
||||
key2,
|
||||
}: {
|
||||
complaintData: any;
|
||||
role: string;
|
||||
updateData: (data: any) => any;
|
||||
id: any;
|
||||
key2: any;
|
||||
updateData: () => any;
|
||||
}) {
|
||||
const FormSchema = z.object({
|
||||
text: z.string({ required_error: "لطفا متن خود را وارد نمایید." }),
|
||||
text: z
|
||||
.string({ required_error: "لطفا متن خود را وارد نمایید." })
|
||||
.min(8, {
|
||||
message: "Bio must be at least 8 characters.",
|
||||
})
|
||||
.max(260, {
|
||||
message: "Bio must not be longer than 30 characters.",
|
||||
}),
|
||||
...(role == "Inspector" && {
|
||||
type: z.enum(["private", "public"], {
|
||||
required_error: "لطفا وضعیت عملیات را انتخاب نمایید.",
|
||||
}),
|
||||
}),
|
||||
operation: z.string({
|
||||
required_error: "لطفا نوع عملیات را انتخاب نمایید.",
|
||||
required_error: "Please select an email to display.",
|
||||
}),
|
||||
media: z
|
||||
.custom<FileList>((val) => val instanceof FileList, "Required")
|
||||
|
|
@ -65,43 +67,33 @@ export default function InspectorOperations({
|
|||
.nullish(),
|
||||
});
|
||||
const password = useData((state) => state.data.password);
|
||||
const possibleOperations = complaintData?.possibleOperationsWithDescription;
|
||||
const queryClient = useQueryClient();
|
||||
const possibleOperations = complaintData?.possibleOperations;
|
||||
const selectOptions = Operations.filter((item, index) =>
|
||||
possibleOperations.includes(index)
|
||||
);
|
||||
|
||||
console.log(possibleOperations);
|
||||
const form = useForm<z.infer<typeof FormSchema>>({
|
||||
resolver: zodResolver(FormSchema),
|
||||
defaultValues: {
|
||||
operation:
|
||||
possibleOperations.length == 1
|
||||
? String(possibleOperations[0].value)
|
||||
: undefined,
|
||||
selectOptions.length == 1 ? String(selectOptions[0].value) : undefined,
|
||||
},
|
||||
});
|
||||
|
||||
const OperationMutation = useMutation({
|
||||
mutationKey: ["Operation"],
|
||||
mutationFn: OperateByInspector,
|
||||
mutationFn:
|
||||
role == "Inspector" ? OperateByInspector : postComplaintsDetails,
|
||||
onSuccess: (res) => {
|
||||
toast("عملیات شما با موفقیت انجام شد. ", {
|
||||
className: "!bg-green-500 !text-white",
|
||||
});
|
||||
const tk = localStorage.getItem("trackingNumber");
|
||||
updateData({
|
||||
trackingNumber: complaintData.trackingNumber,
|
||||
password: key2 ? key2 : (localStorage.getItem("privateKey") as string),
|
||||
});
|
||||
},
|
||||
onError: (err) => {},
|
||||
});
|
||||
|
||||
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||
const storedData = JSON.parse(
|
||||
localStorage.getItem("CompliantData") as string
|
||||
);
|
||||
console.log(storedData);
|
||||
console.log(key2);
|
||||
const dcKey = Decrypt(storedData.cipherKeyInspector, key2);
|
||||
console.log(data);
|
||||
const formData = new FormData();
|
||||
formData.append("text", data.text);
|
||||
formData.append("trackingNumber", complaintData.trackingNumber);
|
||||
|
|
@ -109,10 +101,11 @@ export default function InspectorOperations({
|
|||
if (data.type) {
|
||||
formData.append("IsPublic", data.type == "public" ? "true" : "false");
|
||||
}
|
||||
formData.append(
|
||||
"EncodedKey",
|
||||
key2 ? key2 : (localStorage.getItem("privateKey") as string)
|
||||
);
|
||||
if (role == "Inspector") {
|
||||
formData.append("EncodedKey", password);
|
||||
} else {
|
||||
formData.append("password", localStorage.getItem("password2") as string);
|
||||
}
|
||||
if (data?.media && data?.media?.length > 0) {
|
||||
for (let i = 0; i < data.media.length; i++) {
|
||||
formData.append("Medias", data.media[i]);
|
||||
|
|
@ -179,7 +172,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">
|
||||
|
|
@ -228,13 +221,10 @@ export default function InspectorOperations({
|
|||
<SelectContent dir="rtl">
|
||||
<SelectGroup>
|
||||
<SelectLabel>عملیات</SelectLabel>
|
||||
{possibleOperations.map((item: any) => {
|
||||
{selectOptions.map((item) => {
|
||||
return (
|
||||
<SelectItem
|
||||
key={item.value}
|
||||
value={String(item.value)}
|
||||
>
|
||||
{item.description}
|
||||
<SelectItem value={String(item.value)}>
|
||||
{item.name}
|
||||
</SelectItem>
|
||||
);
|
||||
})}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ export default function LineChart({
|
|||
datasets: chartData.map((item: any, index: number) => {
|
||||
return {
|
||||
label: item.title,
|
||||
data: item.values.map((item: any) => item.value),
|
||||
data: item.values.map((item) => item.value),
|
||||
backgroundColor: backgroundColor[index],
|
||||
borderColor: borderColor[index],
|
||||
borderWidth: 1,
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import {
|
|||
} from "@/components/ui/form";
|
||||
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { toast } from "@/components/ui/use-toast";
|
||||
import Image from "next/image";
|
||||
import LoginIcon from "../public/img/login-icon.svg";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
|
|
@ -25,9 +26,6 @@ import { getCaptcha } from "@/utils/commonApi";
|
|||
import { useRouter } from "next/navigation";
|
||||
import { Oval, ThreeDots } from "react-loader-spinner";
|
||||
import useData from "@/store/useData";
|
||||
import { toast } from "sonner";
|
||||
import { errorMessages } from "@/constants";
|
||||
import { RefreshCcw } from "lucide-react";
|
||||
const FormSchema = z.object({
|
||||
username: z.string().min(1, {
|
||||
message: "لطفا نام کاربری را وارد نمایید.",
|
||||
|
|
@ -59,14 +57,10 @@ export default function Login() {
|
|||
const loginMutation = useMutation({
|
||||
mutationFn: loginStaff,
|
||||
onSuccess: (res) => {},
|
||||
onError: (err: any | string) => {
|
||||
onError: (err: any) => {
|
||||
if (err.response.status == 428) {
|
||||
console.log(useData);
|
||||
router.push("/Verify");
|
||||
} else {
|
||||
toast("مشکلی در ارسال درخواست به وجود آمد.", {
|
||||
className: "!bg-red-500 !text-white",
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
@ -76,7 +70,6 @@ export default function Login() {
|
|||
});
|
||||
|
||||
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||
refetch();
|
||||
const payload = {
|
||||
username: data.username,
|
||||
password: data.password,
|
||||
|
|
@ -97,12 +90,12 @@ export default function Login() {
|
|||
: null;
|
||||
|
||||
return (
|
||||
<div className=" w-screen h-screen grid place-content-center bg-gray-200 ">
|
||||
<div className=" w-screen h-screen grid place-content-center ">
|
||||
<div
|
||||
className="w-full sm:[20rem] md:[20rem] xl:w-[30rem] bg-white rounded-lg dark:border xl:p-0 dark:bg-gray-800 dark:border-gray-700 shadow-[0px_0px_15px_0px_#00000040]
|
||||
h-fit"
|
||||
>
|
||||
<div className="space-y-3 md:space-y-4 flex flex-col md:py-10 p-10 md:px-12 lg:px-16 h-full justify-center">
|
||||
<div className="space-y-3 md:space-y-4 flex flex-col md:py-10 md:px-12 lg:px-16 h-full justify-center">
|
||||
<Image alt="icon" src={LoginIcon} className="self-center w-1/3 " />
|
||||
|
||||
<p className="text-lg font-bold leading-tight tracking-tight text-blue dark:text-white">
|
||||
|
|
@ -158,7 +151,7 @@ export default function Login() {
|
|||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<div className="flex gap-3 mt-4 items-center">
|
||||
<div className="flex gap-4 mt-4 items-center">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="captcha"
|
||||
|
|
@ -189,7 +182,7 @@ export default function Login() {
|
|||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div className=" flex items-center justify-center text-center gap-2">
|
||||
<div className=" flex justify-center text-center">
|
||||
<Image
|
||||
alt="icon"
|
||||
src={srcForImage as string}
|
||||
|
|
@ -198,11 +191,6 @@ export default function Login() {
|
|||
height={20}
|
||||
quality={100}
|
||||
/>
|
||||
<RefreshCcw
|
||||
className=" cursor-pointer"
|
||||
onClick={() => refetch()}
|
||||
color="#003778"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,102 +1,36 @@
|
|||
"use client";
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { AdminMenuItems, ControllerMenuItems } from "@/constants";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
import { Squash as Hamburger } from "hamburger-react";
|
||||
import { AnimatePresence, motion } from "framer-motion";
|
||||
import { getProfile } from "@/utils/authenticateApi";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { DoorOpen, LogOut } from "lucide-react";
|
||||
import { deleteCookie } from "cookies-next";
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
export default function NavbarPanel() {
|
||||
const [isOpen, setOpen] = useState(false);
|
||||
const ref = useRef(null);
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
const [role, setRole] = useState<string | null>("");
|
||||
|
||||
useEffect(() => {
|
||||
const userRole = localStorage.getItem("Sootzani_Role");
|
||||
setRole(userRole);
|
||||
}, []);
|
||||
|
||||
const { data, isLoading, refetch } = useQuery({
|
||||
queryKey: ["Profile"],
|
||||
queryFn: () => getProfile(),
|
||||
refetchOnWindowFocus: false,
|
||||
});
|
||||
|
||||
console.log(role);
|
||||
const menus = {
|
||||
Admin: AdminMenuItems,
|
||||
Inspector: ControllerMenuItems,
|
||||
};
|
||||
const selectedMenu = menus[role as keyof typeof menus];
|
||||
|
||||
return (
|
||||
<div
|
||||
className="fixed flex justify-between items-center gap-3
|
||||
flex-row sm:items-center sm:gap-0
|
||||
className="fixed flex flex-col-reverse justify-between items-start gap-3
|
||||
sm:flex-row sm:items-center sm:gap-0
|
||||
w-full px-8 py-4 z-10 top-0 bg-blue max-md:px-4 shadow-md
|
||||
"
|
||||
>
|
||||
<div className=" flex items-center gap-8 max-md:gap-4">
|
||||
<div className=" md:hidden">
|
||||
<Hamburger
|
||||
toggled={isOpen}
|
||||
size={20}
|
||||
toggle={setOpen}
|
||||
direction="right"
|
||||
color="#fff"
|
||||
/>
|
||||
</div>
|
||||
<p className="text-white inline-block bg-clip-text text-sm font-bold max-md:text-sm max-md:font-medium">
|
||||
پنل کاربری {<span className=" max-md:hidden">|</span>}
|
||||
<p className="text-white inline-block bg-clip-text text-sm font-bold max-md:text-xs max-md:font-medium">
|
||||
پنل کاربری |
|
||||
</p>
|
||||
|
||||
<AnimatePresence>
|
||||
{isOpen && (
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
transition={{ duration: 0.2 }}
|
||||
className="fixed z-[100] left-0 shadow-4xl right-0 top-[3rem] p-5 bg-gradient-to-b from-blue to-white border-b border-b-white/20"
|
||||
>
|
||||
<ul className="grid gap-2 ">
|
||||
{selectedMenu.map((item, idx, array) => {
|
||||
// const { Icon } = item;
|
||||
const lastItem = array.length - 1;
|
||||
return (
|
||||
<motion.li
|
||||
initial={{ scale: 0, opacity: 0 }}
|
||||
animate={{ scale: 1, opacity: 1 }}
|
||||
transition={{
|
||||
type: "spring",
|
||||
stiffness: 260,
|
||||
damping: 20,
|
||||
delay: 0.1 + idx / 10,
|
||||
}}
|
||||
key={item.name}
|
||||
className=" w-full p-[0.08rem] rounded-xl bg-gradient-to-tr from-neutral-800 via-white to-neutral-700"
|
||||
>
|
||||
<Link
|
||||
onClick={() => setOpen((prev) => !prev)}
|
||||
className={`flex items-center justify-between w-full p-3 rounded-xl text-white
|
||||
${lastItem === idx ? "bg-blue" : "bg-blue"} `}
|
||||
href={item.href}
|
||||
>
|
||||
<span className="flex gap-1 text-sm">{item.name}</span>
|
||||
{/* <Icon className="text-xl" /> */}
|
||||
</Link>
|
||||
</motion.li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
<div className="flex flex-row gap-7 max-md:gap-3 max-md:hidden">
|
||||
<div className="flex flex-row gap-7 max-md:gap-3">
|
||||
{role && (
|
||||
<>
|
||||
{selectedMenu.map(
|
||||
|
|
@ -116,29 +50,28 @@ export default function NavbarPanel() {
|
|||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* {AdminMenuItems.map((item) => {
|
||||
return (
|
||||
<Link key={item.id} href={item.href}>
|
||||
<p
|
||||
className="text-white font-normal text-sm max-md:text-xs
|
||||
hover:bg-white/50 rounded-sm p-1
|
||||
animate-out duration-300 "
|
||||
>
|
||||
{item.name}
|
||||
</p>
|
||||
</Link>
|
||||
);
|
||||
})} */}
|
||||
</div>
|
||||
</div>
|
||||
<div className=" flex gap-4 items-center">
|
||||
<h1 className="text-white inline-block bg-clip-text before:max-md:hidden text-sm font-bold max-md:text-xs max-md:font-medium">
|
||||
{data && (
|
||||
<>
|
||||
{role === "Admin"
|
||||
? `${data?.title ? data.title : data.username} (ادمین)`
|
||||
: `${data?.title ? data.title : data.username} (بازرس)`}
|
||||
</>
|
||||
)}
|
||||
</h1>
|
||||
<div className="hover:bg-white/50 p-1 rounded-md">
|
||||
<LogOut
|
||||
onClick={() => {
|
||||
deleteCookie("Sootzani_Token");
|
||||
localStorage.removeItem("privateKey");
|
||||
router.push("/");
|
||||
}}
|
||||
className=" text-white cursor-pointer"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h1 className="text-white inline-block bg-clip-text before:max-md:hidden text-sm font-bold max-md:text-xs max-md:font-medium">
|
||||
{role === "Admin"
|
||||
? "نام و نام خانوادگی (ادمین)"
|
||||
: "نام و نام خانوادگی (بازرس)"}
|
||||
</h1>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@ import VerticalChart from "./VerticalChart";
|
|||
import { HorizontalChart } from "./HorizontalChart";
|
||||
import { getInfo, getInfoList } from "@/utils/infoApi";
|
||||
import { useQueries, useQuery } from "@tanstack/react-query";
|
||||
import useChart from "@/hooks/useChart";
|
||||
|
||||
export default function Reports({ data }: { data: any }) {
|
||||
export default function Reports({ data }) {
|
||||
console.log(data);
|
||||
const [first, setfirst] = useState<any>(false);
|
||||
const Queries: any = useQueries({
|
||||
|
|
@ -23,9 +24,7 @@ export default function Reports({ data }: { data: any }) {
|
|||
console.log(codes);
|
||||
console.log(Queries[0]);
|
||||
const charts = Queries.map((item: any) => item.data);
|
||||
const successfulRequests = Queries.filter(
|
||||
(item: any) => item.isSuccess == true
|
||||
);
|
||||
const successfulRequests = Queries.filter((item) => item.isSuccess == true);
|
||||
return (
|
||||
<div className="">
|
||||
{successfulRequests.length == data.length && (
|
||||
|
|
@ -53,13 +52,9 @@ export default function Reports({ data }: { data: any }) {
|
|||
</div>
|
||||
|
||||
<div className="w-full md:w-3/5 flex justify-between items-center ">
|
||||
{charts?.map((item: any, index: number) => {
|
||||
{charts?.map((item: any, index) => {
|
||||
return (
|
||||
<TabsContent
|
||||
key={index}
|
||||
value={codes[index]}
|
||||
className="w-full"
|
||||
>
|
||||
<TabsContent value={codes[index]} className="w-full">
|
||||
<VerticalChart
|
||||
chartTitle={item.charts[0].chartTitle}
|
||||
chartData={item.charts[0].series}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,15 @@
|
|||
"use client";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import LineChart from "./LineChart";
|
||||
|
||||
import { BsBarChartLineFill } from "react-icons/bs";
|
||||
import { BsBarChartLine } from "react-icons/bs";
|
||||
import { VerticalChart } from "./VerticalChart";
|
||||
import { HorizontalChart } from "./HorizontalChart";
|
||||
import { getInfo, getInfoList } from "@/utils/infoApi";
|
||||
import { useQueries, useQuery } from "@tanstack/react-query";
|
||||
import useChart from "@/hooks/useChart";
|
||||
import Reports from "./Reports";
|
||||
|
||||
export default function ReportsController() {
|
||||
|
|
|
|||
|
|
@ -68,90 +68,130 @@ export default function TabController() {
|
|||
const finishedComplaints = data?.filter((item: any) => item.status == 4);
|
||||
console.log(newComplaints);
|
||||
return (
|
||||
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-16 pt-9 mx-auto">
|
||||
<p className="3xl:ml-6 text-xs sm:text-sm font-bold md:hidden my-2">
|
||||
لیست شکایت ها
|
||||
</p>
|
||||
<Tabs defaultValue="tab1" className="" dir="rtl">
|
||||
<div className="w-full flex flex-col-reverse lg:flex-row gap-4 lg:gap-5 justify-between items-center mb-10">
|
||||
{/* Tab Title */}
|
||||
<TabsList className="w-full flex gap-1 md:gap-4 lg:gap-7">
|
||||
<p className="3xl:ml-6 text-xs sm:text-sm font-bold max-md:hidden">
|
||||
لیست شکایت ها |
|
||||
</p>
|
||||
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-8 pt-9 mx-auto">
|
||||
<Dialog>
|
||||
<DialogTrigger className=" appearance-none" asChild>
|
||||
<Button
|
||||
// onClick={handelVerify}
|
||||
type="submit"
|
||||
className="bg-brown hover:bg-brown/90 text-white w-36 p-2 rounded-xl mt-6 md:mt-12 mb-2"
|
||||
>
|
||||
+ بارگذاری کلید جدید
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
<Tabs defaultValue="tab1" className="" dir="rtl">
|
||||
<div className="w-full flex flex-col-reverse lg:flex-row gap-4 lg:gap-5 justify-between items-center mb-10">
|
||||
{/* Tab Title */}
|
||||
<TabsList className="w-full flex gap-1 md:gap-4 lg:gap-7">
|
||||
<p className="3xl:ml-6 text-xs sm:text-sm font-bold">
|
||||
لیست شکایت ها |
|
||||
</p>
|
||||
|
||||
<TabsTrigger
|
||||
value="tab1"
|
||||
className="hover:border-b-2 border-b-blue max-md:flex-1"
|
||||
>
|
||||
جدید
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
value="tab2"
|
||||
className="hover:border-b-2 border-b-blue max-md:flex-1"
|
||||
>
|
||||
در انتظار پاسخ
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
value="tab3"
|
||||
className="hover:border-b-2 border-b-blue max-md:flex-1"
|
||||
>
|
||||
در حال بررسی
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
value="tab4"
|
||||
className="hover:border-b-2 border-b-blue max-md:flex-1"
|
||||
>
|
||||
پاسخ داده شده
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
value="tab5"
|
||||
className="hover:border-b-2 border-b-blue max-md:flex-1"
|
||||
>
|
||||
پایان یافته
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsTrigger
|
||||
value="tab1"
|
||||
className="hover:border-b-2 border-b-blue"
|
||||
>
|
||||
جدید
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
value="tab2"
|
||||
className="hover:border-b-2 border-b-blue"
|
||||
>
|
||||
در انتظار پاسخ
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
value="tab3"
|
||||
className="hover:border-b-2 border-b-blue"
|
||||
>
|
||||
در حال بررسی
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
value="tab4"
|
||||
className="hover:border-b-2 border-b-blue"
|
||||
>
|
||||
پاسخ داده شده
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
value="tab5"
|
||||
className="hover:border-b-2 border-b-blue"
|
||||
>
|
||||
پایان یافته
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
|
||||
{/* Search Box */}
|
||||
<Search mode="controller" />
|
||||
</div>
|
||||
{/* Search Box */}
|
||||
<Search mode="controller" />
|
||||
</div>
|
||||
|
||||
{/* Tab Content */}
|
||||
<TabsContent value="tab1">
|
||||
<TableController
|
||||
checkKey={(item: any) => checkKey(item)}
|
||||
data={newComplaints}
|
||||
/>
|
||||
</TabsContent>
|
||||
{/* Tab Content */}
|
||||
<TabsContent value="tab1">
|
||||
<TableController
|
||||
checkKey={(item: any) => checkKey(item)}
|
||||
data={newComplaints}
|
||||
/>
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="tab2">
|
||||
<TableController
|
||||
checkKey={(item: any) => checkKey(item)}
|
||||
data={waitingForCitizenResponseComplaints}
|
||||
/>
|
||||
</TabsContent>
|
||||
<TabsContent value="tab2">
|
||||
<TableController
|
||||
checkKey={(item: any) => checkKey(item)}
|
||||
data={waitingForCitizenResponseComplaints}
|
||||
/>
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="tab3">
|
||||
<TableController
|
||||
checkKey={(item: any) => checkKey(item)}
|
||||
data={inProgressComplaints}
|
||||
/>
|
||||
</TabsContent>
|
||||
<TabsContent value="tab3">
|
||||
<TableController
|
||||
checkKey={(item: any) => checkKey(item)}
|
||||
data={inProgressComplaints}
|
||||
/>
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="tab4">
|
||||
<TableController
|
||||
checkKey={(item: any) => checkKey(item)}
|
||||
data={citizenRepliedComplaints}
|
||||
/>
|
||||
</TabsContent>
|
||||
<TabsContent value="tab4">
|
||||
<TableController
|
||||
checkKey={(item: any) => checkKey(item)}
|
||||
data={citizenRepliedComplaints}
|
||||
/>
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="tab5">
|
||||
<TableController
|
||||
checkKey={(item: any) => checkKey(item)}
|
||||
data={finishedComplaints}
|
||||
/>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
<TabsContent value="tab5">
|
||||
<TableController
|
||||
checkKey={(item: any) => checkKey(item)}
|
||||
data={finishedComplaints}
|
||||
/>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
<DialogContent dir="rtl" className="sm:max-w-[425px]">
|
||||
<DialogHeader dir="rtl">
|
||||
<DialogTitle dir="rtl">بارگذاری کلید خصوصی</DialogTitle>
|
||||
<DialogDescription>
|
||||
لطفا کلید خصوصی خود را آپلود نمایید.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div className="grid w-full max-w-sm items-center gap-1.5">
|
||||
{/* <Label htmlFor="picture">Picture</Label> */}
|
||||
<Input
|
||||
dir="rtl"
|
||||
id="picture"
|
||||
onChange={handleFileChange}
|
||||
type="file"
|
||||
accept=".txt"
|
||||
/>
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<DialogClose asChild>
|
||||
<Button
|
||||
onClick={() => {
|
||||
toast("کلید شما با موفقیت ذخیره شد.", {
|
||||
className: "!bg-green-500 !text-white",
|
||||
});
|
||||
}}
|
||||
type="submit"
|
||||
>
|
||||
ذخیره
|
||||
</Button>
|
||||
</DialogClose>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@ import { Input } from "./ui/input";
|
|||
import { useRouter } from "next/navigation";
|
||||
import { toast } from "sonner";
|
||||
import { ScrollArea } from "./ui/scroll-area";
|
||||
import secureLocalStorage from "react-secure-storage";
|
||||
import { Checkbox } from "./ui/checkbox";
|
||||
interface Complaint {
|
||||
id: string;
|
||||
trackingNumber: string;
|
||||
|
|
@ -39,11 +37,6 @@ interface Complaint {
|
|||
title: string;
|
||||
description: string;
|
||||
};
|
||||
complaintOrganization: {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
};
|
||||
status: number;
|
||||
registeredAt: string;
|
||||
lastChanged: string;
|
||||
|
|
@ -60,8 +53,8 @@ export default function TableController({
|
|||
const saveData = useData((state) => state.saveData);
|
||||
const [selectedFile, setSelectedFile] = useState<any>(null);
|
||||
const [open, setOpen] = useState<boolean>(false);
|
||||
const [rowData, setRowData] = useState<Complaint | null>(null);
|
||||
const [check, setCheck] = useState<any>(false);
|
||||
const [roData, setRowData] = useState<boolean>(false);
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const handleFileChange = (event: any) => {
|
||||
|
|
@ -69,13 +62,13 @@ export default function TableController({
|
|||
const reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
const contents = e?.target?.result;
|
||||
// Process the contents of the file here
|
||||
setSelectedFile(contents);
|
||||
console.log(contents);
|
||||
};
|
||||
|
||||
reader.readAsText(file);
|
||||
};
|
||||
|
||||
const checkKey2 = (item: any) => {
|
||||
const dcKey = Decrypt(item.cipherKeyInspector, selectedFile);
|
||||
if (dcKey != false && dcKey != null) {
|
||||
|
|
@ -83,16 +76,11 @@ export default function TableController({
|
|||
trackingNumber: item.trackingNumber,
|
||||
password: Decrypt(item.cipherKeyInspector, selectedFile),
|
||||
});
|
||||
secureLocalStorage.setItem("trackingNumber", item.trackingNumber);
|
||||
secureLocalStorage.setItem(
|
||||
"privateKey",
|
||||
Decrypt(item.cipherKeyInspector, selectedFile)
|
||||
);
|
||||
router.push(`/UserPanel/ControllerDashboard/Complaints/${item.id}`);
|
||||
} else {
|
||||
}
|
||||
};
|
||||
console.log(check);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Table className="border-[1px] border-solid border-muted rounded-md w-full min-w-[40rem] overflow-y-auto scrollbar-thumb-gray-600 scrollbar-track-gray-100 scrollbar-thin">
|
||||
|
|
@ -101,7 +89,6 @@ export default function TableController({
|
|||
<TableRow>
|
||||
<TableHead>ردیف</TableHead>
|
||||
<TableHead>تاریخ</TableHead>
|
||||
<TableHead>کد پیگیری</TableHead>
|
||||
<TableHead>موضوع</TableHead>
|
||||
<TableHead>دستگاه مربوطه</TableHead>
|
||||
</TableRow>
|
||||
|
|
@ -110,12 +97,13 @@ export default function TableController({
|
|||
{data?.map((item: Complaint, index: number) => {
|
||||
return (
|
||||
<TableRow
|
||||
onClick={() => {
|
||||
localStorage.setItem("CompliantData", JSON.stringify(item));
|
||||
router.push(
|
||||
`/UserPanel/ControllerDashboard/Complaints/${item.id}`
|
||||
);
|
||||
}}
|
||||
onClick={
|
||||
() => checkKey(item)
|
||||
// saveData({
|
||||
// trackingNumber: item.trackingNumber,
|
||||
// password: Decrypt(item.cipherKeyInspector),
|
||||
// })
|
||||
}
|
||||
className=" hover:bg-gray-200 cursor-pointer"
|
||||
key={item.id}
|
||||
>
|
||||
|
|
@ -129,15 +117,10 @@ export default function TableController({
|
|||
<TableCell className="w-2/12">
|
||||
{convertDate(item.registeredAt)}
|
||||
</TableCell>
|
||||
<TableCell className="w-2/12">{item.trackingNumber}</TableCell>
|
||||
<TableCell className="w-2/12">
|
||||
{item?.title ? item.title : "-"}
|
||||
</TableCell>
|
||||
<TableCell className="w-5/12">
|
||||
{item?.complaintOrganization
|
||||
? item?.complaintOrganization.title
|
||||
: "-"}
|
||||
</TableCell>
|
||||
<TableCell className="w-7/12">-</TableCell>
|
||||
{/* </Link> */}
|
||||
</TableRow>
|
||||
);
|
||||
|
|
@ -162,25 +145,19 @@ export default function TableController({
|
|||
accept=".txt"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<Checkbox
|
||||
checked={check}
|
||||
onCheckedChange={setCheck}
|
||||
id="terms"
|
||||
className=" ml-2"
|
||||
/>
|
||||
<label
|
||||
htmlFor="terms"
|
||||
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||
>
|
||||
ذخیره کلید برای دفعات بعد
|
||||
</label>
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<DialogClose asChild></DialogClose>
|
||||
<Button onClick={() => checkKey2(rowData)} type="submit">
|
||||
ذخیره
|
||||
</Button>
|
||||
<DialogClose asChild>
|
||||
<Button
|
||||
onClick={() => {
|
||||
if (selectedFile) {
|
||||
toast("کلید شما با موفقیت بارگذاری شد.");
|
||||
}
|
||||
}}
|
||||
type="submit"
|
||||
>
|
||||
ذخیره
|
||||
</Button>
|
||||
</DialogClose>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import useData from "@/store/useData";
|
|||
import { JwtPayload, jwtDecode } from "jwt-decode";
|
||||
import { setCookie } from "cookies-next";
|
||||
import { Oval } from "react-loader-spinner";
|
||||
import { toast } from "sonner";
|
||||
|
||||
export default function Verify() {
|
||||
const [otp, setOtp] = useState("");
|
||||
|
|
@ -37,11 +36,7 @@ export default function Verify() {
|
|||
router.push("/UserPanel/CitizenDashboard");
|
||||
}
|
||||
},
|
||||
onError: (err: any) => {
|
||||
toast("کد تایید شما صحیح نمیباشد.", {
|
||||
className: "!bg-red-500 !text-white",
|
||||
});
|
||||
},
|
||||
onError: (err: any) => {},
|
||||
});
|
||||
const CitizenVerifyMutation = useMutation({
|
||||
mutationFn: verifyCitizen,
|
||||
|
|
@ -73,16 +68,8 @@ export default function Verify() {
|
|||
useData.persist.rehydrate();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (otp.length == 6) {
|
||||
const payload = { ...userData, verificationCode: otp };
|
||||
console.log(userData);
|
||||
verifyMutation.mutate(payload);
|
||||
}
|
||||
}, [otp]);
|
||||
|
||||
return (
|
||||
<div className=" w-screen h-screen grid place-content-center bg-gray-200">
|
||||
<div className=" w-screen h-screen grid place-content-center ">
|
||||
<div
|
||||
className="w-full sm:[20rem] md:[20rem] xl:w-[30rem] bg-white rounded-lg dark:border xl:p-0 dark:bg-gray-800 dark:border-gray-700 shadow-[0px_0px_15px_0px_#00000040]
|
||||
h-fit"
|
||||
|
|
@ -99,7 +86,12 @@ export default function Verify() {
|
|||
numInputs={6}
|
||||
renderSeparator={<span>{space}</span>}
|
||||
renderInput={(props, idx) => (
|
||||
<input autoFocus={idx == 0} pattern="[0-9]*" {...props} />
|
||||
<input
|
||||
autoFocus={idx == 0}
|
||||
inputMode="decimal"
|
||||
pattern="[0-9]*"
|
||||
{...props}
|
||||
/>
|
||||
)}
|
||||
containerStyle=" flex justify-center"
|
||||
inputStyle=" !w-10 rounded-md h-10 bg-[#F5F5F5] border border-blue/30 text-black"
|
||||
|
|
@ -110,7 +102,7 @@ export default function Verify() {
|
|||
کد دریافت شده توسط پیامک را وارد نمایید.
|
||||
</span>
|
||||
</label>
|
||||
{/* <div className="flex justify-end gap-2 w-full mt-14">
|
||||
<div className="flex justify-end gap-2 w-full mt-14">
|
||||
<Button
|
||||
disabled={verifyMutation.isPending}
|
||||
onClick={handelVerify}
|
||||
|
|
@ -128,12 +120,67 @@ export default function Verify() {
|
|||
wrapperStyle={{}}
|
||||
wrapperClass=""
|
||||
/>
|
||||
{/* <p>در حال انجام ...</p> */}
|
||||
</div>
|
||||
) : (
|
||||
"تایید"
|
||||
)}
|
||||
</Button>
|
||||
</div> */}
|
||||
</div>
|
||||
{/* <Form {...form}>
|
||||
<form
|
||||
onSubmit={form.handleSubmit(onSubmit)}
|
||||
className="w-full flex flex-col "
|
||||
>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="username"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium">
|
||||
نام کاربری
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
className="mb-4"
|
||||
placeholder="نام کاربری خود را وارد نمایید"
|
||||
{...field}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormDescription>
|
||||
This is your public display name.
|
||||
</FormDescription>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="password"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
|
||||
رمز عبور
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="رمز عبور خود را وارد کنید" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<div className="flex justify-end gap-2 w-full mt-14">
|
||||
<Button
|
||||
type="submit"
|
||||
className="bg-blue text-white w-1/2 md:w-1/3 p-2 rounded-xl"
|
||||
>
|
||||
ورود
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Form> */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ interface Values {
|
|||
title: string;
|
||||
value: string;
|
||||
}
|
||||
function getRandomColor(n: number) {
|
||||
function getRandomColor(n) {
|
||||
var letters = "0123456789ABCDEF".split("");
|
||||
var color = "#";
|
||||
var colors = [];
|
||||
|
|
@ -133,7 +133,7 @@ function BarChart({
|
|||
datasets: chartData.map((item: any, index: number) => {
|
||||
return {
|
||||
label: item.title,
|
||||
data: item.values.map((item: any) => item.value),
|
||||
data: item.values.map((item) => item.value),
|
||||
backgroundColor: backgroundColor[index],
|
||||
borderColor: borderColor[index],
|
||||
borderWidth: 1,
|
||||
|
|
@ -141,9 +141,7 @@ function BarChart({
|
|||
}),
|
||||
};
|
||||
// console.log(data);
|
||||
return (
|
||||
<Bar dir="rtl" className="min-h-[20rem]" options={options} data={data} />
|
||||
);
|
||||
return <Bar dir="rtl" className="min-h-[20rem]" options={options} data={data} />;
|
||||
}
|
||||
|
||||
export default BarChart;
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
"use client";
|
||||
"use client"
|
||||
|
||||
import * as React from "react";
|
||||
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
||||
import * as React from "react"
|
||||
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
|
||||
|
||||
import { cn } from "@/lib/utils";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils"
|
||||
import { buttonVariants } from "@/components/ui/button"
|
||||
|
||||
const AlertDialog = AlertDialogPrimitive.Root;
|
||||
const AlertDialog = AlertDialogPrimitive.Root
|
||||
|
||||
const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
||||
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
|
||||
|
||||
const AlertDialogPortal = AlertDialogPrimitive.Portal;
|
||||
const AlertDialogPortal = AlertDialogPrimitive.Portal
|
||||
|
||||
const AlertDialogOverlay = React.forwardRef<
|
||||
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
|
||||
|
|
@ -24,8 +24,8 @@ const AlertDialogOverlay = React.forwardRef<
|
|||
{...props}
|
||||
ref={ref}
|
||||
/>
|
||||
));
|
||||
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
|
||||
))
|
||||
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
|
||||
|
||||
const AlertDialogContent = React.forwardRef<
|
||||
React.ElementRef<typeof AlertDialogPrimitive.Content>,
|
||||
|
|
@ -36,10 +36,11 @@ const AlertDialogContent = React.forwardRef<
|
|||
<AlertDialogPrimitive.Content
|
||||
ref={ref}
|
||||
className={cn(
|
||||
`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border duration-200
|
||||
`fixed left-[50%] top-[50%] z-50 grid w-full max-w-4xl translate-x-[-50%] translate-y-[-50%] gap-4 border duration-200
|
||||
data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95
|
||||
data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2
|
||||
data-[state=open]:slide-in-from-top-[48%] rounded-lg content-between p-0 bg-opacity-30 bg-[#FFFFF999] filter
|
||||
data-[state=open]:slide-in-from-top-[48%] rounded-lg
|
||||
h-full max-h-[32em] content-between p-0 bg-opacity-30 bg-[#FFFFF999] filter
|
||||
shadow-[0px_0px_30px_0px_rgba(0,0,0,0.3)]
|
||||
`,
|
||||
className
|
||||
|
|
@ -47,8 +48,8 @@ const AlertDialogContent = React.forwardRef<
|
|||
{...props}
|
||||
/>
|
||||
</AlertDialogPortal>
|
||||
));
|
||||
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
|
||||
))
|
||||
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
|
||||
|
||||
const AlertDialogHeader = ({
|
||||
className,
|
||||
|
|
@ -61,8 +62,8 @@ const AlertDialogHeader = ({
|
|||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
AlertDialogHeader.displayName = "AlertDialogHeader";
|
||||
)
|
||||
AlertDialogHeader.displayName = "AlertDialogHeader"
|
||||
|
||||
const AlertDialogFooter = ({
|
||||
className,
|
||||
|
|
@ -75,8 +76,8 @@ const AlertDialogFooter = ({
|
|||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
AlertDialogFooter.displayName = "AlertDialogFooter";
|
||||
)
|
||||
AlertDialogFooter.displayName = "AlertDialogFooter"
|
||||
|
||||
const AlertDialogTitle = React.forwardRef<
|
||||
React.ElementRef<typeof AlertDialogPrimitive.Title>,
|
||||
|
|
@ -84,14 +85,11 @@ const AlertDialogTitle = React.forwardRef<
|
|||
>(({ className, ...props }, ref) => (
|
||||
<AlertDialogPrimitive.Title
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"text-lg font-semibold bg-white flex justify-between items-center px-6 py-3 rounded-t-lg border-b-[0.5px] border-[#8F8F8F] border-solid",
|
||||
className
|
||||
)}
|
||||
className={cn("text-lg font-semibold bg-white flex justify-between items-center px-6 py-3 rounded-t-lg border-b-[0.5px] border-[#8F8F8F] border-solid", className)}
|
||||
{...props}
|
||||
/>
|
||||
));
|
||||
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
|
||||
))
|
||||
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
|
||||
|
||||
const AlertDialogDescription = React.forwardRef<
|
||||
React.ElementRef<typeof AlertDialogPrimitive.Description>,
|
||||
|
|
@ -99,15 +97,12 @@ const AlertDialogDescription = React.forwardRef<
|
|||
>(({ className, ...props }, ref) => (
|
||||
<AlertDialogPrimitive.Description
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"text-sm text-muted-foreground flex flex-col items-start text-justify px-10 py-4 ",
|
||||
className
|
||||
)}
|
||||
className={cn("text-sm text-muted-foreground flex flex-col items-start text-justify px-10 py-4 sm:px-28 sm:pt-9 ", className)}
|
||||
{...props}
|
||||
/>
|
||||
));
|
||||
))
|
||||
AlertDialogDescription.displayName =
|
||||
AlertDialogPrimitive.Description.displayName;
|
||||
AlertDialogPrimitive.Description.displayName
|
||||
|
||||
const AlertDialogAction = React.forwardRef<
|
||||
React.ElementRef<typeof AlertDialogPrimitive.Action>,
|
||||
|
|
@ -118,8 +113,8 @@ const AlertDialogAction = React.forwardRef<
|
|||
className={cn(buttonVariants(), className)}
|
||||
{...props}
|
||||
/>
|
||||
));
|
||||
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
|
||||
))
|
||||
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
|
||||
|
||||
const AlertDialogCancel = React.forwardRef<
|
||||
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
|
||||
|
|
@ -134,8 +129,8 @@ const AlertDialogCancel = React.forwardRef<
|
|||
)}
|
||||
{...props}
|
||||
/>
|
||||
));
|
||||
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
|
||||
))
|
||||
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
|
||||
|
||||
export {
|
||||
AlertDialog,
|
||||
|
|
@ -149,4 +144,4 @@ export {
|
|||
AlertDialogDescription,
|
||||
AlertDialogAction,
|
||||
AlertDialogCancel,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
|
||||
import { Check } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const Checkbox = React.forwardRef<
|
||||
React.ElementRef<typeof CheckboxPrimitive.Root>,
|
||||
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<CheckboxPrimitive.Root
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-blue data-[state=checked]:text-primary-foreground",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<CheckboxPrimitive.Indicator
|
||||
className={cn("flex items-center justify-center text-current")}
|
||||
>
|
||||
<Check className="h-4 w-4" />
|
||||
</CheckboxPrimitive.Indicator>
|
||||
</CheckboxPrimitive.Root>
|
||||
))
|
||||
Checkbox.displayName = CheckboxPrimitive.Root.displayName
|
||||
|
||||
export { Checkbox }
|
||||
|
|
@ -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: "/" },
|
||||
];
|
||||
|
|
@ -141,12 +141,8 @@ export const ControllerMenuItems = [
|
|||
|
||||
export const AdminMenuItems = [
|
||||
{ id: 1, name: "داشبورد", href: "/UserPanel/AdminDashboard" },
|
||||
// { id: 2, name: "مدیریت کاربران", href: "/UserPanel/AdminDashboard/UserManagement" },
|
||||
{
|
||||
id: 3,
|
||||
name: "مدیریت کلید ها",
|
||||
href: "/UserPanel/AdminDashboard/KeysManagement",
|
||||
},
|
||||
{ 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" },
|
||||
];
|
||||
|
|
@ -230,19 +226,12 @@ export const AdminTableItems = [
|
|||
];
|
||||
|
||||
export const Operations = [
|
||||
{ value: 0, name: "ثبت شده" },
|
||||
{ value: 1, name: "دیدن" },
|
||||
{ value: 2, name: "درخواست توضیحات" },
|
||||
{ value: 3, name: "پاسخ شهروند" },
|
||||
{ value: 4, name: "لغو درخواست" },
|
||||
{ value: 5, name: "افزودن جزییات" },
|
||||
{ value: 6, name: "پایان درخواست" },
|
||||
{ value: 7, name: "شروع مجدد درخواست" },
|
||||
{value:0,name:"ثبت شده"},
|
||||
{value:1,name:"دیدن"},
|
||||
{value:2,name:"درخواست توضیحات"},
|
||||
{value:3,name:"پاسخ شهروند"},
|
||||
{value:4,name:"لغو درخواست"},
|
||||
{value:5,name:"افزودن جزییات"},
|
||||
{value:6,name:"پایان درخواست"},
|
||||
{value:7,name:"شروع مجدد درخواست"},
|
||||
];
|
||||
|
||||
export const errorMessages = {
|
||||
500: "خطایی رخ داد. لطفا از اتصال اینترنت خود اطمینان حاصل نمایید.",
|
||||
400: "مشکلی در ارسال درخواست به وجود آمد.",
|
||||
480: "لطفا تمام اطلاعات خواسته شده را وارد نمایید.",
|
||||
428: "کد فعالسازی را وارد نمایید.",
|
||||
};
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
version: '3.8'
|
||||
services:
|
||||
web:
|
||||
image: ${DOCKER_REGISTRY:-docker.shetabdahi.ir/}oyoon-admin
|
||||
restart: always
|
||||
ports:
|
||||
- "127.0.0.1:6679:6679"
|
||||
|
||||
25
lib/utils.ts
25
lib/utils.ts
|
|
@ -19,15 +19,22 @@ export function convertDate(date: string) {
|
|||
return convertedDate;
|
||||
}
|
||||
|
||||
export function convertFullTime(date: string) {
|
||||
const convertedDate = dayjs(date)
|
||||
.calendar("jalali")
|
||||
.locale("fa")
|
||||
.format(" HH:mm - YYYY/M/DD");
|
||||
return convertedDate;
|
||||
}
|
||||
|
||||
export function Decrypt(encryptedData: any, privateKey: any) {
|
||||
export function Decrypt(encryptedData: string , privateKey: string) {
|
||||
const Key = `-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXAIBAAKBgQCfmb1aGcWsqJPp+v6e72CPngE6P6FoCZCJESwDTXUXiJiAKshB
|
||||
WZ9nlN+IIpQr6h8gmxi8SWbofPWmSKZgTyU2MddxUanneuywPTTUj4HQ6/DUaDwF
|
||||
0Vr6Fk0x4yi1GKpBzhRFPyOYBWVXKIw23j0l+EWw6+JIpR9Kwu0TezHHFQIDAQAB
|
||||
AoGBAIVxegy3t7vhR6s/HV2uMEJkjgox4banKJ4yKWapgNmocDnZi454bPuiUjP1
|
||||
FYaSPmx4wXnMtap1sL7Tx6iHBEi10KB1AghDZP5wJHz6nm9ugcrGSSWhVJM74x6C
|
||||
ThVztAV/rydaZ6/DLaqsBg5lHlo1DjMKq4sxnqrw/LUMGtOBAkEAzt8bnM1Ij/rF
|
||||
i8oSP3gI0H914vf/0N2xxGGdQvMmJK0oijIm5j8dFDZf02Ft34SFeVJfXyVPapDE
|
||||
vQ6TRw+1HQJBAMWAwvbypbtl65Dn4qCj3oJUmmnjjxm5080idF1S6ufo34p2gHMF
|
||||
qLtWjmnGqjh2Shs7ahnfbLF+cxzgBg7yEFkCQFYGl1/0Sel9uepwpHf6PYgeiPJS
|
||||
ePHtTwBAK3pszH7R9xrI0j5LHpeKKP0o9dzOKgcShxB03nqNKxMHXZ1eXc0CQFhD
|
||||
Ot3xgm9FFQklF/qCQSYtePRpZcIxcZ3zD93E+IW7ZGsUmkLM/KL8A5jx15B0DJou
|
||||
6zO0zXZk9DyrQQnc08ECQGy5ti89HmQ6I6Wqq5ADglCY6YPISsNwScVyvu/WxQsX
|
||||
dEqG/38xFdYTFEekexcHnT/Vt1MW4/j76vBJHYWuAJU=
|
||||
-----END RSA PRIVATE KEY-----`;
|
||||
const decryptor = new JSEncrypt();
|
||||
decryptor.setPrivateKey(privateKey);
|
||||
const decrypted = decryptor.decrypt(encryptedData);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = { output: "standalone" };
|
||||
const nextConfig = {}
|
||||
|
||||
module.exports = nextConfig;
|
||||
module.exports = nextConfig
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
{
|
||||
"name": "sootzani",
|
||||
"version": "0.2.2",
|
||||
"version": "0.1.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "sootzani",
|
||||
"version": "0.2.2",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.3.2",
|
||||
"@radix-ui/react-alert-dialog": "^1.0.5",
|
||||
"@radix-ui/react-checkbox": "^1.0.4",
|
||||
"@radix-ui/react-dialog": "^1.0.5",
|
||||
"@radix-ui/react-dropdown-menu": "^2.0.6",
|
||||
"@radix-ui/react-icons": "^1.3.0",
|
||||
|
|
@ -56,7 +55,6 @@
|
|||
"react-loader-spinner": "^6.1.6",
|
||||
"react-otp-input": "^3.1.1",
|
||||
"react-responsive": "^9.0.2",
|
||||
"react-secure-storage": "^1.3.2",
|
||||
"react-spinners": "^0.13.8",
|
||||
"react-to-print": "^2.14.15",
|
||||
"react-use": "^17.4.2",
|
||||
|
|
@ -585,36 +583,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-checkbox": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-checkbox/-/react-checkbox-1.0.4.tgz",
|
||||
"integrity": "sha512-CBuGQa52aAYnADZVt/KBQzXrwx6TqnlwtcIPGtVt5JkkzQwMOLJjPukimhfKEr4GQNd43C+djUh5Ikopj8pSLg==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.13.10",
|
||||
"@radix-ui/primitive": "1.0.1",
|
||||
"@radix-ui/react-compose-refs": "1.0.1",
|
||||
"@radix-ui/react-context": "1.0.1",
|
||||
"@radix-ui/react-presence": "1.0.1",
|
||||
"@radix-ui/react-primitive": "1.0.3",
|
||||
"@radix-ui/react-use-controllable-state": "1.0.1",
|
||||
"@radix-ui/react-use-previous": "1.0.1",
|
||||
"@radix-ui/react-use-size": "1.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"@types/react-dom": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0",
|
||||
"react-dom": "^16.8 || ^17.0 || ^18.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"@types/react-dom": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-collection": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.0.3.tgz",
|
||||
|
|
@ -2400,11 +2368,6 @@
|
|||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/crypto-js": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz",
|
||||
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="
|
||||
},
|
||||
"node_modules/css-color-keywords": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz",
|
||||
|
|
@ -4395,11 +4358,6 @@
|
|||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/murmurhash-js": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/murmurhash-js/-/murmurhash-js-1.0.0.tgz",
|
||||
"integrity": "sha512-TvmkNhkv8yct0SVBSy+o8wYzXjE4Zz3PCesbfs8HiCXXdcTuocApFv11UWlNFWKYsP2okqrhb7JNlSm9InBhIw=="
|
||||
},
|
||||
"node_modules/mz": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz",
|
||||
|
|
@ -7900,15 +7858,6 @@
|
|||
"react": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/react-secure-storage": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/react-secure-storage/-/react-secure-storage-1.3.2.tgz",
|
||||
"integrity": "sha512-pNCyksbLXWIYRS9vCzERXdIMErtx9Ik70TPtLKivcq44+zYybbxA72wpp5ivghK9Xe0gRku2w/7zBy/9n+RtKA==",
|
||||
"dependencies": {
|
||||
"crypto-js": "^4.1.1",
|
||||
"murmurhash-js": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/react-spinners": {
|
||||
"version": "0.13.8",
|
||||
"resolved": "https://registry.npmjs.org/react-spinners/-/react-spinners-0.13.8.tgz",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "sootzani",
|
||||
"version": "0.2.2",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
|
@ -11,7 +11,6 @@
|
|||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.3.2",
|
||||
"@radix-ui/react-alert-dialog": "^1.0.5",
|
||||
"@radix-ui/react-checkbox": "^1.0.4",
|
||||
"@radix-ui/react-dialog": "^1.0.5",
|
||||
"@radix-ui/react-dropdown-menu": "^2.0.6",
|
||||
"@radix-ui/react-icons": "^1.3.0",
|
||||
|
|
@ -57,7 +56,6 @@
|
|||
"react-loader-spinner": "^6.1.6",
|
||||
"react-otp-input": "^3.1.1",
|
||||
"react-responsive": "^9.0.2",
|
||||
"react-secure-storage": "^1.3.2",
|
||||
"react-spinners": "^0.13.8",
|
||||
"react-to-print": "^2.14.15",
|
||||
"react-use": "^17.4.2",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import axios from "axios";
|
||||
import { CookieValueTypes, getCookie } from "cookies-next";
|
||||
|
||||
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
||||
axios.defaults.baseURL = "https://sootzaniapi.shetabdahi.ir/";
|
||||
|
||||
axios.interceptors.request.use(function (config) {
|
||||
const token = getCookie("Sootzani_Token");
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import axios from "axios";
|
||||
import { CookieValueTypes } from "cookies-next";
|
||||
|
||||
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
||||
axios.defaults.baseURL = "https://sootzaniapi.shetabdahi.ir/";
|
||||
|
||||
export async function loginStaff(payload: {
|
||||
username: string;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
import axios from "axios";
|
||||
import { CookieValueTypes } from "cookies-next";
|
||||
|
||||
axios.defaults.baseURL = "https://sootzaniapi.shetabdahi.ir/";
|
||||
|
||||
// Post Complaints
|
||||
export async function postComplaintSubmit({ Data }: { Data: FormData }) {
|
||||
const data = await axios.post(`api/Citizen`, Data);
|
||||
return data.data;
|
||||
}
|
||||
|
||||
// Post 1 Complaints
|
||||
export async function postComplaintTracking({
|
||||
Data,
|
||||
}: {
|
||||
Data: { trackingNumber: string; password: string };
|
||||
}) {
|
||||
const data = await axios.post(`api/Citizen/Get`, Data);
|
||||
return data.data;
|
||||
}
|
||||
|
||||
// Post Complaints Details "citizen / Oprate"
|
||||
export async function postComplaintsDetails(payload: FormData) {
|
||||
const data = await axios.post(`api/Citizen/Operate`, payload);
|
||||
return data.data;
|
||||
}
|
||||
Loading…
Reference in New Issue