Bugs fixed + docker added
parent
7c2493dcb3
commit
9bfe565da3
|
|
@ -0,0 +1,7 @@
|
||||||
|
Dockerfile
|
||||||
|
.dockerignore
|
||||||
|
node_modules
|
||||||
|
npm-debug.log
|
||||||
|
README.md
|
||||||
|
.next
|
||||||
|
.git
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
name: build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*.*.*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
# list of Docker images to use as base name for tags
|
||||||
|
images: |
|
||||||
|
${{ secrets.DOCKER_REGISTRY }}oyoon-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 }}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
FROM node:18-alpine AS base
|
||||||
|
|
||||||
|
# Install dependencies only when needed
|
||||||
|
FROM base AS deps
|
||||||
|
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
||||||
|
RUN apk add --no-cache libc6-compat
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install dependencies based on the preferred package manager
|
||||||
|
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
|
||||||
|
RUN \
|
||||||
|
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
||||||
|
elif [ -f package-lock.json ]; then npm ci; \
|
||||||
|
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
|
||||||
|
else echo "Lockfile not found." && exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Rebuild the source code only when needed
|
||||||
|
FROM base AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Next.js collects completely anonymous telemetry data about general usage.
|
||||||
|
# Learn more here: https://nextjs.org/telemetry
|
||||||
|
# Uncomment the following line in case you want to disable telemetry during the build.
|
||||||
|
# ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
|
|
||||||
|
RUN yarn build
|
||||||
|
|
||||||
|
# If using npm comment out above and use below instead
|
||||||
|
# RUN npm run build
|
||||||
|
|
||||||
|
# Production image, copy all the files and run next
|
||||||
|
FROM base AS runner
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV NODE_ENV production
|
||||||
|
# Uncomment the following line in case you want to disable telemetry during runtime.
|
||||||
|
# ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
|
|
||||||
|
RUN addgroup --system --gid 1001 nodejs
|
||||||
|
RUN adduser --system --uid 1001 nextjs
|
||||||
|
|
||||||
|
COPY --from=builder /app/public ./public
|
||||||
|
|
||||||
|
# Automatically leverage output traces to reduce image size
|
||||||
|
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||||
|
|
||||||
|
USER nextjs
|
||||||
|
|
||||||
|
EXPOSE 6679
|
||||||
|
|
||||||
|
ENV PORT 6679
|
||||||
|
|
||||||
|
CMD ["node", "server.js"]
|
||||||
|
|
@ -9,7 +9,7 @@ import { Toaster as SonnerToaster } from "@/components/ui/sonner";
|
||||||
const inter = Inter({ subsets: ["latin"] });
|
const inter = Inter({ subsets: ["latin"] });
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: "سوت زنی",
|
title: "عیون",
|
||||||
description: "Generated by create next app",
|
description: "Generated by create next app",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import CitizenLogin from "../components/CitizenLogin";
|
|
||||||
import Login from "@/components/Login";
|
import Login from "@/components/Login";
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import React, { useState, useRef, useEffect } from "react";
|
import React, { useState, useRef, useEffect } from "react";
|
||||||
import { useMutation, useQuery, RefetchOptions } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import {
|
import {
|
||||||
GetAllCategories,
|
GetAllCategories,
|
||||||
GetSingleCategory,
|
GetSingleCategory,
|
||||||
|
|
@ -11,7 +11,6 @@ import {
|
||||||
} from "@/utils/adminApi";
|
} from "@/utils/adminApi";
|
||||||
import { FaRegEdit } from "react-icons/fa";
|
import { FaRegEdit } from "react-icons/fa";
|
||||||
import { IoMdClose } from "react-icons/io";
|
import { IoMdClose } from "react-icons/io";
|
||||||
import { RiDeleteBin6Line } from "react-icons/ri";
|
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { ThreeDots } from "react-loader-spinner";
|
import { ThreeDots } from "react-loader-spinner";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
|
@ -232,7 +231,7 @@ export default function AdminCategories() {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className="w-full bg-[#F5F5F5] min-h-[85vh] flex justify-center">
|
<div className="w-full min-h-[85vh] flex justify-center">
|
||||||
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
||||||
<div className="flex w-full justify-between flex-row ">
|
<div className="flex w-full justify-between flex-row ">
|
||||||
{/* 1 */}
|
{/* 1 */}
|
||||||
|
|
@ -418,7 +417,7 @@ export default function AdminCategories() {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={item.id}
|
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
|
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]
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
<p className=" text-slate-500 text-sm font-normal leading-normal">
|
<p className=" text-slate-500 text-sm font-normal leading-normal">
|
||||||
|
|
@ -435,7 +434,7 @@ export default function AdminCategories() {
|
||||||
<div className="w-full flex justify-end items-end gap-2">
|
<div className="w-full flex justify-end items-end gap-2">
|
||||||
<Switch
|
<Switch
|
||||||
dir="ltr"
|
dir="ltr"
|
||||||
checked={item.isDeleted}
|
checked={!item.isDeleted}
|
||||||
onCheckedChange={() => {
|
onCheckedChange={() => {
|
||||||
DeleteCatMutation.mutate({
|
DeleteCatMutation.mutate({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ export default function AdminOrganizations() {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className="w-full bg-[#F5F5F5] min-h-[85vh] flex justify-center">
|
<div className="w-full min-h-[85vh] flex justify-center">
|
||||||
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
<div className="w-[95vw] lg:w-[85vw] 3xl:w-[70vw] mt-8 max-sm:mt-16 pt-9 ">
|
||||||
<div className="flex w-full justify-between flex-row ">
|
<div className="flex w-full justify-between flex-row ">
|
||||||
{/* 1 */}
|
{/* 1 */}
|
||||||
|
|
@ -421,7 +421,7 @@ export default function AdminOrganizations() {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={item.id}
|
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
|
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]
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
<p className=" text-slate-500 text-sm font-normal leading-normal">
|
<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">
|
<div className="w-full flex justify-end items-end gap-2">
|
||||||
<Switch
|
<Switch
|
||||||
dir="ltr"
|
dir="ltr"
|
||||||
checked={item.isDeleted}
|
checked={!item.isDeleted}
|
||||||
onCheckedChange={() => {
|
onCheckedChange={() => {
|
||||||
DeleteOrgMutation.mutate({
|
DeleteOrgMutation.mutate({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ export default function ComplainsDetails({
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const downloadFile = (base64Data, fileName, fileType) => {
|
const downloadFile = (base64Data: any, fileName: any, fileType: any) => {
|
||||||
const blob = b64toBlob(base64Data, fileType);
|
const blob = b64toBlob(base64Data, fileType);
|
||||||
const blobUrl = URL.createObjectURL(blob);
|
const blobUrl = URL.createObjectURL(blob);
|
||||||
|
|
||||||
|
|
@ -122,7 +122,7 @@ export default function ComplainsDetails({
|
||||||
URL.revokeObjectURL(blobUrl);
|
URL.revokeObjectURL(blobUrl);
|
||||||
};
|
};
|
||||||
|
|
||||||
const b64toBlob = (b64Data, contentType = "", sliceSize = 512) => {
|
const b64toBlob = (b64Data: any, contentType = "", sliceSize = 512) => {
|
||||||
const byteCharacters = atob(b64Data);
|
const byteCharacters = atob(b64Data);
|
||||||
const byteArrays = [];
|
const byteArrays = [];
|
||||||
|
|
||||||
|
|
@ -318,9 +318,12 @@ export default function ComplainsDetails({
|
||||||
)}
|
)}
|
||||||
<div className=" text-[#464646] 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">
|
<div className=" flex flex-wrap max-md:flex-col w-full items-center gap-2 text-xs mt-2">
|
||||||
{item?.media.map((item: any) => {
|
{item?.media.map((item: any, index: number) => {
|
||||||
return (
|
return (
|
||||||
<div className=" bg-gray-100 text-[#7C838A] w-full md:w-[30%] rounded-md h-12 p-2 flex justify-between gap-3 items-center">
|
<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
|
<a
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
openFileInNewTab(item.data, item.mimeType)
|
openFileInNewTab(item.data, item.mimeType)
|
||||||
|
|
@ -361,7 +364,7 @@ export default function ComplainsDetails({
|
||||||
role={role}
|
role={role}
|
||||||
complaintData={data}
|
complaintData={data}
|
||||||
id={id}
|
id={id}
|
||||||
key={key}
|
key2={key}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/* Left */}
|
{/* Left */}
|
||||||
|
|
|
||||||
|
|
@ -24,15 +24,21 @@ export default function ControllerDashboard() {
|
||||||
{/* Lg Show */}
|
{/* Lg Show */}
|
||||||
<div className="w-full mb-6 flex-col gap-0 flex">
|
<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">
|
<div className="w-full flex flex-row flex-wrap mx-auto justify-center gap-8 mb-10">
|
||||||
{data?.singletons.map((item: any) => {
|
{data?.singletons.map((item: any, index: number) => {
|
||||||
return <BoxDashboard value={item.value} title={item.title} />;
|
return (
|
||||||
|
<BoxDashboard key={index} value={item.value} title={item.title} />
|
||||||
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className=" bg-[#EFEFEF80] rounded-lg flex justify-center shadow-md">
|
<div className=" bg-[#EFEFEF80] rounded-lg flex justify-center shadow-md">
|
||||||
{data?.charts.map((item: any) => {
|
{data?.charts.map((item: any, index: number) => {
|
||||||
return (
|
return (
|
||||||
<LineChart chartTitle={item.chartTitle} chartData={item.series} />
|
<LineChart
|
||||||
|
key={index}
|
||||||
|
chartTitle={item.chartTitle}
|
||||||
|
chartData={item.series}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -11,20 +11,20 @@ export default function Footer() {
|
||||||
// <div classNameName="flex justify-center items-center w-full bg-blue ">
|
// <div classNameName="flex justify-center items-center w-full bg-blue ">
|
||||||
|
|
||||||
<footer className="bg-blue dark:bg-gray-900">
|
<footer className="bg-blue dark:bg-gray-900">
|
||||||
<div
|
<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 ">
|
||||||
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="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>
|
<div>
|
||||||
<h2 className="text-white text-sm sm:text-base font-bold mb-4 ">
|
<h2 className="text-white text-sm sm:text-base font-bold mb-4 ">
|
||||||
درباره سامانه سوت زنی
|
درباره سامانه عیون
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
{aboutFooterItems.map((item) => {
|
{aboutFooterItems.map((item) => {
|
||||||
return (
|
return (
|
||||||
<div key={item.id}>
|
<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>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
@ -38,7 +38,9 @@ export default function Footer() {
|
||||||
{footerItems.map((item, index, array) => {
|
{footerItems.map((item, index, array) => {
|
||||||
return (
|
return (
|
||||||
<Link key={item.id} href={item.href}>
|
<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>
|
</Link>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
@ -69,11 +71,11 @@ export default function Footer() {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr className=" border-gray-200 sm:mx-auto dark:border-gray-700 mt-5 sm:mt-10" />
|
<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">
|
<div className="sm:flex sm:items-center sm:justify-between">
|
||||||
<p className="text-white text-xs font-normal mt-4">
|
<p className="text-white text-xs font-normal mt-4">
|
||||||
تمامی حقوق مادی و معنوی این وب سایت متعلق به سوت زنی میباشد.
|
تمامی حقوق مادی و معنوی این وب سایت متعلق به عیون میباشد.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,9 @@ export default function InspectorOperations({
|
||||||
});
|
});
|
||||||
|
|
||||||
function onSubmit(data: z.infer<typeof FormSchema>) {
|
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||||
const storedData = JSON.parse(localStorage.getItem("CompliantData"));
|
const storedData = JSON.parse(
|
||||||
|
localStorage.getItem("CompliantData") as string
|
||||||
|
);
|
||||||
console.log(storedData);
|
console.log(storedData);
|
||||||
console.log(key2);
|
console.log(key2);
|
||||||
const dcKey = Decrypt(storedData.cipherKeyInspector, key2);
|
const dcKey = Decrypt(storedData.cipherKeyInspector, key2);
|
||||||
|
|
@ -172,7 +174,7 @@ export default function InspectorOperations({
|
||||||
<FormControl dir="rtl">
|
<FormControl dir="rtl">
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
onValueChange={field.onChange}
|
onValueChange={field.onChange}
|
||||||
defaultValue={field.value}
|
// defaultValue={field.value}
|
||||||
className="flex space-y-1 text-sm"
|
className="flex space-y-1 text-sm"
|
||||||
>
|
>
|
||||||
<FormItem className="flex items-center space-x-3 space-y-0">
|
<FormItem className="flex items-center space-x-3 space-y-0">
|
||||||
|
|
@ -221,9 +223,12 @@ export default function InspectorOperations({
|
||||||
<SelectContent dir="rtl">
|
<SelectContent dir="rtl">
|
||||||
<SelectGroup>
|
<SelectGroup>
|
||||||
<SelectLabel>عملیات</SelectLabel>
|
<SelectLabel>عملیات</SelectLabel>
|
||||||
{possibleOperations.map((item) => {
|
{possibleOperations.map((item: any) => {
|
||||||
return (
|
return (
|
||||||
<SelectItem value={String(item.value)}>
|
<SelectItem
|
||||||
|
key={item.value}
|
||||||
|
value={String(item.value)}
|
||||||
|
>
|
||||||
{item.description}
|
{item.description}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ export default function LineChart({
|
||||||
datasets: chartData.map((item: any, index: number) => {
|
datasets: chartData.map((item: any, index: number) => {
|
||||||
return {
|
return {
|
||||||
label: item.title,
|
label: item.title,
|
||||||
data: item.values.map((item) => item.value),
|
data: item.values.map((item: any) => item.value),
|
||||||
backgroundColor: backgroundColor[index],
|
backgroundColor: backgroundColor[index],
|
||||||
borderColor: borderColor[index],
|
borderColor: borderColor[index],
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ import {
|
||||||
} from "@/components/ui/form";
|
} from "@/components/ui/form";
|
||||||
|
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { toast } from "@/components/ui/use-toast";
|
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import LoginIcon from "../public/img/login-icon.svg";
|
import LoginIcon from "../public/img/login-icon.svg";
|
||||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
|
|
@ -26,6 +25,8 @@ import { getCaptcha } from "@/utils/commonApi";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { Oval, ThreeDots } from "react-loader-spinner";
|
import { Oval, ThreeDots } from "react-loader-spinner";
|
||||||
import useData from "@/store/useData";
|
import useData from "@/store/useData";
|
||||||
|
import { toast } from "sonner";
|
||||||
|
import { errorMessages } from "@/constants";
|
||||||
const FormSchema = z.object({
|
const FormSchema = z.object({
|
||||||
username: z.string().min(1, {
|
username: z.string().min(1, {
|
||||||
message: "لطفا نام کاربری را وارد نمایید.",
|
message: "لطفا نام کاربری را وارد نمایید.",
|
||||||
|
|
@ -57,10 +58,14 @@ export default function Login() {
|
||||||
const loginMutation = useMutation({
|
const loginMutation = useMutation({
|
||||||
mutationFn: loginStaff,
|
mutationFn: loginStaff,
|
||||||
onSuccess: (res) => {},
|
onSuccess: (res) => {},
|
||||||
onError: (err: any) => {
|
onError: (err: any | string) => {
|
||||||
if (err.response.status == 428) {
|
if (err.response.status == 428) {
|
||||||
console.log(useData);
|
console.log(useData);
|
||||||
router.push("/Verify");
|
router.push("/Verify");
|
||||||
|
} else {
|
||||||
|
toast("مشکلی در ارسال درخواست به وجود آمد.", {
|
||||||
|
className: "!bg-red-500 !text-white",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ export default function NavbarPanel() {
|
||||||
deleteCookie("Sootzani_Token");
|
deleteCookie("Sootzani_Token");
|
||||||
router.push("/");
|
router.push("/");
|
||||||
}}
|
}}
|
||||||
className=" text-white "
|
className=" text-white cursor-pointer"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,8 @@ import VerticalChart from "./VerticalChart";
|
||||||
import { HorizontalChart } from "./HorizontalChart";
|
import { HorizontalChart } from "./HorizontalChart";
|
||||||
import { getInfo, getInfoList } from "@/utils/infoApi";
|
import { getInfo, getInfoList } from "@/utils/infoApi";
|
||||||
import { useQueries, useQuery } from "@tanstack/react-query";
|
import { useQueries, useQuery } from "@tanstack/react-query";
|
||||||
import useChart from "@/hooks/useChart";
|
|
||||||
|
|
||||||
export default function Reports({ data }) {
|
export default function Reports({ data }: { data: any }) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
const [first, setfirst] = useState<any>(false);
|
const [first, setfirst] = useState<any>(false);
|
||||||
const Queries: any = useQueries({
|
const Queries: any = useQueries({
|
||||||
|
|
@ -24,7 +23,9 @@ export default function Reports({ data }) {
|
||||||
console.log(codes);
|
console.log(codes);
|
||||||
console.log(Queries[0]);
|
console.log(Queries[0]);
|
||||||
const charts = Queries.map((item: any) => item.data);
|
const charts = Queries.map((item: any) => item.data);
|
||||||
const successfulRequests = Queries.filter((item) => item.isSuccess == true);
|
const successfulRequests = Queries.filter(
|
||||||
|
(item: any) => item.isSuccess == true
|
||||||
|
);
|
||||||
return (
|
return (
|
||||||
<div className="">
|
<div className="">
|
||||||
{successfulRequests.length == data.length && (
|
{successfulRequests.length == data.length && (
|
||||||
|
|
@ -52,9 +53,13 @@ export default function Reports({ data }) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="w-full md:w-3/5 flex justify-between items-center ">
|
<div className="w-full md:w-3/5 flex justify-between items-center ">
|
||||||
{charts?.map((item: any, index) => {
|
{charts?.map((item: any, index: number) => {
|
||||||
return (
|
return (
|
||||||
<TabsContent value={codes[index]} className="w-full">
|
<TabsContent
|
||||||
|
key={index}
|
||||||
|
value={codes[index]}
|
||||||
|
className="w-full"
|
||||||
|
>
|
||||||
<VerticalChart
|
<VerticalChart
|
||||||
chartTitle={item.charts[0].chartTitle}
|
chartTitle={item.charts[0].chartTitle}
|
||||||
chartData={item.charts[0].series}
|
chartData={item.charts[0].series}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,7 @@
|
||||||
"use client";
|
"use client";
|
||||||
import React, { useEffect, useState } from "react";
|
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 { getInfo, getInfoList } from "@/utils/infoApi";
|
||||||
import { useQueries, useQuery } from "@tanstack/react-query";
|
import { useQueries, useQuery } from "@tanstack/react-query";
|
||||||
import useChart from "@/hooks/useChart";
|
|
||||||
import Reports from "./Reports";
|
import Reports from "./Reports";
|
||||||
|
|
||||||
export default function ReportsController() {
|
export default function ReportsController() {
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,11 @@ interface Complaint {
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
};
|
};
|
||||||
|
complaintOrganization: {
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
};
|
||||||
status: number;
|
status: number;
|
||||||
registeredAt: string;
|
registeredAt: string;
|
||||||
lastChanged: string;
|
lastChanged: string;
|
||||||
|
|
@ -126,7 +131,11 @@ export default function TableController({
|
||||||
<TableCell className="w-2/12">
|
<TableCell className="w-2/12">
|
||||||
{item?.title ? item.title : "-"}
|
{item?.title ? item.title : "-"}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className="w-7/12">-</TableCell>
|
<TableCell className="w-7/12">
|
||||||
|
{item?.complaintOrganization
|
||||||
|
? item?.complaintOrganization.title
|
||||||
|
: "-"}
|
||||||
|
</TableCell>
|
||||||
{/* </Link> */}
|
{/* </Link> */}
|
||||||
</TableRow>
|
</TableRow>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,6 @@ export default function Verify() {
|
||||||
renderInput={(props, idx) => (
|
renderInput={(props, idx) => (
|
||||||
<input
|
<input
|
||||||
autoFocus={idx == 0}
|
autoFocus={idx == 0}
|
||||||
inputMode="decimal"
|
|
||||||
pattern="[0-9]*"
|
pattern="[0-9]*"
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ interface Values {
|
||||||
title: string;
|
title: string;
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
function getRandomColor(n) {
|
function getRandomColor(n: number) {
|
||||||
var letters = "0123456789ABCDEF".split("");
|
var letters = "0123456789ABCDEF".split("");
|
||||||
var color = "#";
|
var color = "#";
|
||||||
var colors = [];
|
var colors = [];
|
||||||
|
|
@ -133,7 +133,7 @@ function BarChart({
|
||||||
datasets: chartData.map((item: any, index: number) => {
|
datasets: chartData.map((item: any, index: number) => {
|
||||||
return {
|
return {
|
||||||
label: item.title,
|
label: item.title,
|
||||||
data: item.values.map((item) => item.value),
|
data: item.values.map((item: any) => item.value),
|
||||||
backgroundColor: backgroundColor[index],
|
backgroundColor: backgroundColor[index],
|
||||||
borderColor: borderColor[index],
|
borderColor: borderColor[index],
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
|
|
@ -141,7 +141,9 @@ function BarChart({
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
// console.log(data);
|
// 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;
|
export default BarChart;
|
||||||
|
|
|
||||||
|
|
@ -56,21 +56,21 @@ export const boxItems = [
|
||||||
export const newsItems = [
|
export const newsItems = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
title: "شروع به کار سامانه سوت زنی",
|
title: "شروع به کار سامانه عیون",
|
||||||
content:
|
content:
|
||||||
"این سامانه با هدف نظارت بر عملکرد پرستل و نهادهای مرتبط با امور مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است ...",
|
"این سامانه با هدف نظارت بر عملکرد پرستل و نهادهای مرتبط با امور مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است ...",
|
||||||
date: "24 آذر ماه 1402",
|
date: "24 آذر ماه 1402",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
title: "شروع به کار سامانه سوت زنی",
|
title: "شروع به کار سامانه عیون",
|
||||||
content:
|
content:
|
||||||
"این سامانه با هدف نظارت بر عملکرد پرستل و نهادهای مرتبط با امور مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است ...",
|
"این سامانه با هدف نظارت بر عملکرد پرستل و نهادهای مرتبط با امور مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است ...",
|
||||||
date: "24 آذر ماه 1402",
|
date: "24 آذر ماه 1402",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
title: "شروع به کار سامانه سوت زنی ",
|
title: "شروع به کار سامانه عیون ",
|
||||||
content:
|
content:
|
||||||
"این سامانه با هدف نظارت بر عملکرد پرستل و نهادهای مرتبط با امور مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است ...",
|
"این سامانه با هدف نظارت بر عملکرد پرستل و نهادهای مرتبط با امور مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است ...",
|
||||||
date: "24 آذر ماه 1402",
|
date: "24 آذر ماه 1402",
|
||||||
|
|
@ -99,8 +99,8 @@ export const aboutFooterItems = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
export const footerItems = [
|
export const footerItems = [
|
||||||
{ id: 1, name: "قوانین مربوط به سوت زنی", href: "/" },
|
{ id: 1, name: "قوانین مربوط به عیون", href: "/" },
|
||||||
{ id: 2, name: "ارسال گزارش در سامانه سوت زنی قوه قضاییه", href: "/" },
|
{ id: 2, name: "ارسال گزارش در سامانه عیون قوه قضاییه", href: "/" },
|
||||||
{ id: 3, name: "وب سایت قوه قضاییه", href: "/" },
|
{ id: 3, name: "وب سایت قوه قضاییه", href: "/" },
|
||||||
{ id: 4, name: " وب سایت ریاست جمهوری", href: "/" },
|
{ id: 4, name: " وب سایت ریاست جمهوری", href: "/" },
|
||||||
];
|
];
|
||||||
|
|
@ -141,8 +141,12 @@ export const ControllerMenuItems = [
|
||||||
|
|
||||||
export const AdminMenuItems = [
|
export const AdminMenuItems = [
|
||||||
{ id: 1, name: "داشبورد", href: "/UserPanel/AdminDashboard" },
|
{ id: 1, name: "داشبورد", href: "/UserPanel/AdminDashboard" },
|
||||||
{ id: 2, name: "مدیریت کاربران", href: "/UserPanel/AdminDashboard/UserManagement" },
|
// { id: 2, name: "مدیریت کاربران", href: "/UserPanel/AdminDashboard/UserManagement" },
|
||||||
{ id: 3, name: "مدیریت کلید ها", href: "/UserPanel/AdminDashboard/KeysManagement" },
|
{
|
||||||
|
id: 3,
|
||||||
|
name: "مدیریت کلید ها",
|
||||||
|
href: "/UserPanel/AdminDashboard/KeysManagement",
|
||||||
|
},
|
||||||
{ id: 4, name: "سازمان ها", href: "/UserPanel/AdminDashboard/Organizations" },
|
{ id: 4, name: "سازمان ها", href: "/UserPanel/AdminDashboard/Organizations" },
|
||||||
{ id: 5, name: "دسته بندی ها", href: "/UserPanel/AdminDashboard/Categories" },
|
{ id: 5, name: "دسته بندی ها", href: "/UserPanel/AdminDashboard/Categories" },
|
||||||
];
|
];
|
||||||
|
|
@ -226,12 +230,19 @@ export const AdminTableItems = [
|
||||||
];
|
];
|
||||||
|
|
||||||
export const Operations = [
|
export const Operations = [
|
||||||
{value:0,name:"ثبت شده"},
|
{ value: 0, name: "ثبت شده" },
|
||||||
{value:1,name:"دیدن"},
|
{ value: 1, name: "دیدن" },
|
||||||
{value:2,name:"درخواست توضیحات"},
|
{ value: 2, name: "درخواست توضیحات" },
|
||||||
{value:3,name:"پاسخ شهروند"},
|
{ value: 3, name: "پاسخ شهروند" },
|
||||||
{value:4,name:"لغو درخواست"},
|
{ value: 4, name: "لغو درخواست" },
|
||||||
{value:5,name:"افزودن جزییات"},
|
{ value: 5, name: "افزودن جزییات" },
|
||||||
{value:6,name:"پایان درخواست"},
|
{ value: 6, name: "پایان درخواست" },
|
||||||
{value:7,name:"شروع مجدد درخواست"},
|
{ value: 7, name: "شروع مجدد درخواست" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export const errorMessages = {
|
||||||
|
500: "خطایی رخ داد. لطفا از اتصال اینترنت خود اطمینان حاصل نمایید.",
|
||||||
|
400: "مشکلی در ارسال درخواست به وجود آمد.",
|
||||||
|
480: "لطفا تمام اطلاعات خواسته شده را وارد نمایید.",
|
||||||
|
428: "کد فعالسازی را وارد نمایید.",
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
version: '3.8'
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
image: oyoon-admin
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "127.0.0.1:6679:6679"
|
||||||
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { CookieValueTypes, getCookie } from "cookies-next";
|
import { CookieValueTypes, getCookie } from "cookies-next";
|
||||||
|
|
||||||
axios.defaults.baseURL = "https://sootzaniapi.shetabdahi.ir/";
|
axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
||||||
|
|
||||||
axios.interceptors.request.use(function (config) {
|
axios.interceptors.request.use(function (config) {
|
||||||
const token = getCookie("Sootzani_Token");
|
const token = getCookie("Sootzani_Token");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue