Compare commits
6 Commits
4f0c4ec374
...
1e0ca5c229
| Author | SHA1 | Date |
|---|---|---|
|
|
1e0ca5c229 | |
|
|
95283d0700 | |
|
|
bc81c1cf2a | |
|
|
35c31dbb77 | |
|
|
b61278ea19 | |
|
|
abbf4c022f |
|
|
@ -0,0 +1,6 @@
|
||||||
|
import AboutUs from "@/components/AboutUs";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
export default function page() {
|
||||||
|
return <AboutUs />;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
import News from '@/components/News'
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
export default function page() {
|
||||||
|
return (
|
||||||
|
<News />
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -19,7 +19,7 @@ import "swiper/css/pagination";
|
||||||
import { Autoplay, Pagination, Navigation } from "swiper/modules";
|
import { Autoplay, Pagination, Navigation } from "swiper/modules";
|
||||||
import { sliderItems } from "@/constants";
|
import { sliderItems } from "@/constants";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { getSliders } from "@/utils/commonApi";
|
import { getSliders , getNews} from "@/utils/commonApi";
|
||||||
|
|
||||||
export default function Landing() {
|
export default function Landing() {
|
||||||
const { data, isLoading, refetch } = useQuery({
|
const { data, isLoading, refetch } = useQuery({
|
||||||
|
|
@ -27,9 +27,15 @@ export default function Landing() {
|
||||||
queryFn: () => getSliders(),
|
queryFn: () => getSliders(),
|
||||||
refetchOnWindowFocus: false,
|
refetchOnWindowFocus: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
|
const { data:NewsData, isLoading:NewsisLoading, isError:NewsisError, refetch:Newsrefetch } = useQuery({
|
||||||
|
queryKey: ["News"],
|
||||||
|
queryFn: () => getNews(),
|
||||||
|
refetchOnWindowFocus: false,
|
||||||
|
});
|
||||||
|
console.log("NewsData"+ NewsData);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="overflow-x-hidden max-md:-mt-8">
|
<div className="overflow-x-hidden max-md:-mt-8">
|
||||||
<div className="w-screen bg-top lg:bg-center bg-no-repeat h-[13rem] sm:h-[20rem] md:h-[24rem] xl:h-[33rem]">
|
<div className="w-screen bg-top lg:bg-center bg-no-repeat h-[13rem] sm:h-[20rem] md:h-[24rem] xl:h-[33rem]">
|
||||||
|
|
@ -160,10 +166,7 @@ export default function Landing() {
|
||||||
آخرین اخبار
|
آخرین اخبار
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className=" w-full mt-6 flex flex-row gap-8 mb-14
|
className=" w-full mt-6 flex flex-row gap-8 mb-14 max-lg:flex-col max-lg:gap-4 ">
|
||||||
max-lg:flex-col max-lg:gap-4
|
|
||||||
"
|
|
||||||
>
|
|
||||||
{/* Right News */}
|
{/* Right News */}
|
||||||
<div
|
<div
|
||||||
className=" w-1/2 max-lg:w-full border rounded-lg flex flex-row shadow-md hover:shadow-none transition-all
|
className=" w-1/2 max-lg:w-full border rounded-lg flex flex-row shadow-md hover:shadow-none transition-all
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { getSingleWebContents } from "@/utils/commonApi";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
export default function AboutUs() {
|
||||||
|
const [title, setTitle] = useState("AboutUs");
|
||||||
|
|
||||||
|
const { data, isLoading, isError, refetch } = useQuery({
|
||||||
|
queryKey: ["WebContents", title],
|
||||||
|
queryFn: () => getSingleWebContents(title),
|
||||||
|
refetchOnWindowFocus: false,
|
||||||
|
});
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
refetch();
|
||||||
|
}, [title, refetch]);
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return <p>Loading...</p>;
|
||||||
|
}
|
||||||
|
if (isError) {
|
||||||
|
return <p>Error fetching content.</p>;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fetchedContent = data?.content || ""; // Assuming your API response has a 'content' property
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="bg-white dark:bg-gray-900 w-screen pt-8">
|
||||||
|
<div
|
||||||
|
className="container flex font-[yekan]
|
||||||
|
text-[#7C838A] dark:text-white text-base font-medium leading-6 tracking-wide 3xl:text-lg 3xl:font-bold"
|
||||||
|
>
|
||||||
|
{/* Display fetched content */}
|
||||||
|
<div dangerouslySetInnerHTML={{ __html: fetchedContent }} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -50,7 +50,7 @@ export default function CallUs(props: any) {
|
||||||
{/* </div> */}
|
{/* </div> */}
|
||||||
|
|
||||||
<div className="container flex items-center h-[90vh]">
|
<div className="container flex items-center h-[90vh]">
|
||||||
<div className="grid gap-8 md:gap-0 grid-cols-1 md:grid-cols-3 md:h-[40vh] h-full w-full lg:px-32 xl:px-52 md:py-8 py-12">
|
<div className="grid gap-8 md:gap-0 grid-cols-1 md:grid-cols-2 md:h-[40vh] h-full w-full lg:px-32 xl:px-52 md:py-8 py-12">
|
||||||
{callUsItems.map((item) => {
|
{callUsItems.map((item) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|
|
||||||
|
|
@ -319,7 +319,8 @@ export default function ComplainsDetails({
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col">
|
<div className="bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col max-h-[50vh] lg:max-h-[39.5vh] 2xl:max-h-[43.5vh] 3xl:max-h-[41vh] min-[1920px]:max-h-[48.5vh] overflow-auto
|
||||||
|
scrollbar-thin scrollbar-thumb-gray-500 scrollbar-track-gray-100">
|
||||||
<p className="text-[#464646] text-base font-bold">روند شکایت</p>
|
<p className="text-[#464646] text-base font-bold">روند شکایت</p>
|
||||||
<div className="flex flex-col mt-4 gap-y-4">
|
<div className="flex flex-col mt-4 gap-y-4">
|
||||||
{data.contents?.map((item: any) => {
|
{data.contents?.map((item: any) => {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,151 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { getNews } from "@/utils/commonApi";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import Image from "next/image";
|
||||||
|
import Link from "next/link";
|
||||||
|
|
||||||
|
export default function News() {
|
||||||
|
const { data, isLoading, isError, refetch } = useQuery({
|
||||||
|
queryKey: ["News"],
|
||||||
|
queryFn: () => getNews(),
|
||||||
|
refetchOnWindowFocus: false,
|
||||||
|
});
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return <p>Loading...</p>;
|
||||||
|
}
|
||||||
|
if (isError) {
|
||||||
|
return <p>Error fetching content.</p>;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="bg-white dark:bg-gray-900 w-screen pt-8">
|
||||||
|
<div className="container w-full flex flex-wrap lg:flex-row gap-8 mb-14 flex-col max-lg:gap-4">
|
||||||
|
|
||||||
|
{/* {data.map((item: any, index: number) => {
|
||||||
|
return <p key={index}>News</p>;
|
||||||
|
})} */}
|
||||||
|
|
||||||
|
<div
|
||||||
|
className="w-full lg:w-[48%] border rounded-lg flex flex-row shadow-md hover:shadow-none transition-all
|
||||||
|
h-[20em] sm:h-[15em] max-sm:flex-col max-sm:gap-[3px]"
|
||||||
|
>
|
||||||
|
<div className="w-1/2 h-full rounded-r-lg max-sm:h-1/2 max-md:w-1/3 max-sm:w-full">
|
||||||
|
<Image
|
||||||
|
alt="picture"
|
||||||
|
src="/img/pic1.png"
|
||||||
|
height={500}
|
||||||
|
width={500}
|
||||||
|
quality={100}
|
||||||
|
className="w-full h-full rounded-r-lg bg-cover object-cover object-center"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className=" w-1/2 h-full flex flex-col p-8 justify-between max-lg:p-4 max-md:justify-evenly max-md:w-2/3 max-sm:h-1/2 max-sm:w-full">
|
||||||
|
<p className="text-[10px] font-bold text-right text-white bg-blue p-1 rounded ">
|
||||||
|
اخبار
|
||||||
|
</p>
|
||||||
|
<p className="text-xs font-medium text-right text-black">
|
||||||
|
24 آذر ماه 1402
|
||||||
|
</p>
|
||||||
|
<p className="text-base font-medium text-right text-black line-clamp-1">
|
||||||
|
شروع به کار سامانه عیون
|
||||||
|
</p>
|
||||||
|
<p className="text-sm font-normal text-justify text-[#3C3C43D9] line-clamp-5 max-md:line-clamp-2">
|
||||||
|
این سامانه با هدف نظارت بر عملکرد پرسنل و نهادهای مرتبط با امور
|
||||||
|
مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است
|
||||||
|
...
|
||||||
|
</p>
|
||||||
|
<Link
|
||||||
|
href="#"
|
||||||
|
className="text-[10px] font-normal text-blue text-left"
|
||||||
|
>
|
||||||
|
بیشتر بخوانید{" "}
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className="w-full lg:w-[48%] border rounded-lg flex flex-row shadow-md hover:shadow-none transition-all
|
||||||
|
h-[20em] sm:h-[15em] max-sm:flex-col max-sm:gap-[3px]"
|
||||||
|
>
|
||||||
|
<div className="w-1/2 h-full rounded-r-lg max-sm:h-1/2 max-md:w-1/3 max-sm:w-full">
|
||||||
|
<Image
|
||||||
|
alt="picture"
|
||||||
|
src="/img/pic1.png"
|
||||||
|
height={500}
|
||||||
|
width={500}
|
||||||
|
quality={100}
|
||||||
|
className="w-full h-full rounded-r-lg bg-cover object-cover object-center"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className=" w-1/2 h-full flex flex-col p-8 justify-between max-lg:p-4 max-md:justify-evenly max-md:w-2/3 max-sm:h-1/2 max-sm:w-full">
|
||||||
|
<p className="text-[10px] font-bold text-right text-white bg-blue p-1 rounded ">
|
||||||
|
اخبار
|
||||||
|
</p>
|
||||||
|
<p className="text-xs font-medium text-right text-black">
|
||||||
|
24 آذر ماه 1402
|
||||||
|
</p>
|
||||||
|
<p className="text-base font-medium text-right text-black line-clamp-1">
|
||||||
|
شروع به کار سامانه عیون
|
||||||
|
</p>
|
||||||
|
<p className="text-sm font-normal text-justify text-[#3C3C43D9] line-clamp-5 max-md:line-clamp-2">
|
||||||
|
این سامانه با هدف نظارت بر عملکرد پرسنل و نهادهای مرتبط با امور
|
||||||
|
مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است
|
||||||
|
...
|
||||||
|
</p>
|
||||||
|
<Link
|
||||||
|
href="#"
|
||||||
|
className="text-[10px] font-normal text-blue text-left"
|
||||||
|
>
|
||||||
|
بیشتر بخوانید{" "}
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className=" w-full lg:w-[48%] border rounded-lg flex flex-row shadow-md hover:shadow-none transition-all
|
||||||
|
h-[20em] sm:h-[15em] max-sm:flex-col max-sm:gap-[3px]"
|
||||||
|
>
|
||||||
|
<div className="w-1/2 h-full rounded-r-lg max-sm:h-1/2 max-md:w-1/3 max-sm:w-full">
|
||||||
|
<Image
|
||||||
|
alt="picture"
|
||||||
|
src="/img/pic1.png"
|
||||||
|
height={500}
|
||||||
|
width={500}
|
||||||
|
quality={100}
|
||||||
|
className="w-full h-full rounded-r-lg bg-cover object-cover object-center"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className=" w-1/2 h-full flex flex-col p-8 justify-between max-lg:p-4 max-md:justify-evenly max-md:w-2/3 max-sm:h-1/2 max-sm:w-full">
|
||||||
|
<p className="text-[10px] font-bold text-right text-white bg-blue p-1 rounded ">
|
||||||
|
اخبار
|
||||||
|
</p>
|
||||||
|
<p className="text-xs font-medium text-right text-black">
|
||||||
|
24 آذر ماه 1402
|
||||||
|
</p>
|
||||||
|
<p className="text-base font-medium text-right text-black line-clamp-1">
|
||||||
|
شروع به کار سامانه عیون
|
||||||
|
</p>
|
||||||
|
<p className="text-sm font-normal text-justify text-[#3C3C43D9] line-clamp-5 max-md:line-clamp-2">
|
||||||
|
این سامانه با هدف نظارت بر عملکرد پرسنل و نهادهای مرتبط با امور
|
||||||
|
مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است
|
||||||
|
...
|
||||||
|
</p>
|
||||||
|
<Link
|
||||||
|
href="#"
|
||||||
|
className="text-[10px] font-normal text-blue text-left"
|
||||||
|
>
|
||||||
|
بیشتر بخوانید{" "}
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
"use client";
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import ReactPaginate from "react-paginate";
|
||||||
|
import { MdKeyboardArrowRight, MdKeyboardArrowLeft } from "react-icons/md";
|
||||||
|
import { twMerge } from "tailwind-merge";
|
||||||
|
// Example items, to simulate fetching from another resources.
|
||||||
|
const items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14];
|
||||||
|
|
||||||
|
export default function Pagination({
|
||||||
|
itemsPerPage,
|
||||||
|
Page,
|
||||||
|
countPage,
|
||||||
|
length,
|
||||||
|
}: {
|
||||||
|
itemsPerPage?: any;
|
||||||
|
Page?: any;
|
||||||
|
countPage?: any;
|
||||||
|
length?: any;
|
||||||
|
}) {
|
||||||
|
// Here we use item offsets; we could also use page offsets
|
||||||
|
// following the API or data you're working with.
|
||||||
|
const [itemOffset, setItemOffset] = useState(0);
|
||||||
|
|
||||||
|
// Simulate fetching items from another resources.
|
||||||
|
// (This could be items from props; or items loaded in a local state
|
||||||
|
// from an API endpoint with useEffect and useState)
|
||||||
|
const endOffset = itemOffset + itemsPerPage;
|
||||||
|
// console.log(`Loading items from ${itemOffset} to ${endOffset}`);
|
||||||
|
const currentItems = items.slice(itemOffset, endOffset);
|
||||||
|
const pageCount = Math.ceil(items.length / itemsPerPage);
|
||||||
|
|
||||||
|
// Invoke when user click to request another page.
|
||||||
|
const handlePageClick = (event: any) => {
|
||||||
|
const newOffset = (event.selected * itemsPerPage) % items.length;
|
||||||
|
console.log(
|
||||||
|
`User requested page number ${event.selected}, which is offset ${newOffset}`
|
||||||
|
);
|
||||||
|
setItemOffset(newOffset);
|
||||||
|
// console.log(event.selected);
|
||||||
|
console.log(event);
|
||||||
|
Page(event.selected);
|
||||||
|
};
|
||||||
|
console.log(countPage);
|
||||||
|
// console.log(pageCount, "1111");
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* <Items currentItems={currentItems} /> */}
|
||||||
|
<ReactPaginate
|
||||||
|
breakLabel="..."
|
||||||
|
onPageActive={(e) => console.log(e)}
|
||||||
|
nextLabel={<MdKeyboardArrowLeft className="w-5 h-5 " />}
|
||||||
|
onPageChange={handlePageClick}
|
||||||
|
pageRangeDisplayed={3}
|
||||||
|
pageCount={Math.ceil(countPage / 5)}
|
||||||
|
previousLabel={<MdKeyboardArrowRight className="w-5 h-5 " />}
|
||||||
|
pageClassName=" w-10 h-10 grid place-content-center rounded-lg !text-blue shadow-md"
|
||||||
|
className={twMerge(
|
||||||
|
" flex flex-wrap gap-3 text-sm md:text-base w-full bottom-0 rounded-md p-1 bg-white/30 backdrop-blur-lg justify-center text-blue mt-5"
|
||||||
|
)}
|
||||||
|
activeClassName=" bg-blue text-blue shadow-md shadow-main"
|
||||||
|
activeLinkClassName=" text-white w-full p-1 h-full"
|
||||||
|
previousLinkClassName=" w-10 h-10 grid place-content-center rounded-lg text-sm shadow-md"
|
||||||
|
nextLinkClassName=" w-10 h-10 grid place-content-center rounded-lg text-sm shadow-md"
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -48,7 +48,6 @@ export default function ProfileDropDown() {
|
||||||
} = useQuery({
|
} = useQuery({
|
||||||
queryKey: ["Profile"],
|
queryKey: ["Profile"],
|
||||||
queryFn: () => getProfile(),
|
queryFn: () => getProfile(),
|
||||||
refetchOnWindowFocus: false,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const revokeMutation = useMutation({
|
const revokeMutation = useMutation({
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,24 @@ import {
|
||||||
} from "@/components/ui/alert-dialog";
|
} from "@/components/ui/alert-dialog";
|
||||||
import { IoMdClose } from "react-icons/io";
|
import { IoMdClose } from "react-icons/io";
|
||||||
import { useMediaQuery } from "react-responsive";
|
import { useMediaQuery } from "react-responsive";
|
||||||
export default function Search({ mode }: { mode: string }) {
|
export default function Search({
|
||||||
|
mode,
|
||||||
|
value,
|
||||||
|
action,
|
||||||
|
changeValue,
|
||||||
|
}: {
|
||||||
|
mode?: string;
|
||||||
|
value?: any;
|
||||||
|
action?: (any: any) => any;
|
||||||
|
changeValue?: (any: any) => any;
|
||||||
|
}) {
|
||||||
// useEffect(() => {
|
// useEffect(() => {
|
||||||
// const isMobile = useMediaQuery({ query: "(max-width: 768px)" });
|
// const isMobile = useMediaQuery({ query: "(max-width: 768px)" });
|
||||||
// }, []);
|
// }, []);
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{mode === "controller" || mode === "admin" ? (
|
{mode === "controller" || mode === "admin" ? (
|
||||||
<div className="relative flex bg-gray-300 rounded-xl items-center">
|
<div className="relative flex bg-gray-300 rounded-xl items-center my-2">
|
||||||
<Input
|
<Input
|
||||||
// type="search"
|
// type="search"
|
||||||
id="default-search"
|
id="default-search"
|
||||||
|
|
@ -38,6 +48,12 @@ export default function Search({ mode }: { mode: string }) {
|
||||||
"w-full min-w-full bg-white lg:min-w-full h-11"
|
"w-full min-w-full bg-white lg:min-w-full h-11"
|
||||||
}
|
}
|
||||||
`}
|
`}
|
||||||
|
value={value}
|
||||||
|
onChange={(e) => {
|
||||||
|
if (changeValue) {
|
||||||
|
changeValue(e.target.value);
|
||||||
|
}
|
||||||
|
}}
|
||||||
placeholder="جستجو..."
|
placeholder="جستجو..."
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
|
|
@ -46,7 +62,7 @@ export default function Search({ mode }: { mode: string }) {
|
||||||
>
|
>
|
||||||
<CiSearch />
|
<CiSearch />
|
||||||
</Button> */}
|
</Button> */}
|
||||||
<button className="absolute left-3">
|
<button onClick={action} className="absolute left-3">
|
||||||
<CiSearch />
|
<CiSearch />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
"use client";
|
"use client";
|
||||||
import React, { useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||||
import TableController from "./TableController";
|
import TableController from "./TableController";
|
||||||
import Search from "./Search";
|
import Search from "./Search";
|
||||||
|
|
@ -22,167 +22,50 @@ import { Decrypt } from "@/lib/utils";
|
||||||
import useData from "@/store/useData";
|
import useData from "@/store/useData";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { getComplaints } from "@/utils/citizenApi";
|
import { getComplaints } from "@/utils/citizenApi";
|
||||||
|
import Pagination from "./Pagination";
|
||||||
export default function TabController() {
|
export default function TabController() {
|
||||||
const saveData = useData((state) => state.saveData);
|
const saveData = useData((state) => state.saveData);
|
||||||
const [selectedFile, setSelectedFile] = useState<any>(null);
|
const [selectedFile, setSelectedFile] = useState<any>(null);
|
||||||
|
const [page, setPage] = useState<any>(1);
|
||||||
|
const [totalCount, setTotalCount] = useState<any>(0);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { data, isLoading } = useQuery({
|
const [search, setSearch] = useState<any>(null);
|
||||||
queryKey: ["CitizenList"],
|
|
||||||
queryFn: () => getComplaints(),
|
const { data, isLoading, refetch } = useQuery({
|
||||||
|
queryKey: ["CitizenList", page],
|
||||||
|
queryFn: () =>
|
||||||
|
getComplaints({
|
||||||
|
TrackingNumber: search,
|
||||||
|
PageNumber: page,
|
||||||
|
}),
|
||||||
refetchOnWindowFocus: false,
|
refetchOnWindowFocus: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const checkKey = (item: any) => {
|
console.log(data);
|
||||||
const dcKey = Decrypt(item.cipherKeyInspector, selectedFile);
|
useEffect(() => {
|
||||||
if (dcKey != false && dcKey != null) {
|
if (data) {
|
||||||
saveData({
|
const headersData = JSON.parse(data.headers["x-pagination"]);
|
||||||
trackingNumber: item.trackingNumber,
|
setTotalCount(headersData.TotalCount);
|
||||||
password: Decrypt(item.cipherKeyInspector, selectedFile),
|
|
||||||
});
|
|
||||||
router.push(`/UserPanel/ControllerDashboard/Complaints/${item.id}`);
|
|
||||||
} else {
|
|
||||||
toast("کلید شما معتبر نمی باشد.", {
|
|
||||||
className: "!bg-red-500 !text-white",
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
}, [data]);
|
||||||
|
|
||||||
|
const handelSearch = (event: any) => {
|
||||||
|
refetch();
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(data);
|
|
||||||
const newComplaints = data?.filter((item: any) => item.status == 0);
|
|
||||||
const inProgressComplaints = data?.filter((item: any) => item.status == 1);
|
|
||||||
const waitingForCitizenResponseComplaints = data?.filter(
|
|
||||||
(item: any) => item.status == 2
|
|
||||||
);
|
|
||||||
const citizenRepliedComplaints = data?.filter(
|
|
||||||
(item: any) => item.status == 3
|
|
||||||
);
|
|
||||||
const finishedComplaints = data?.filter((item: any) => item.status == 4);
|
|
||||||
console.log(newComplaints);
|
|
||||||
return (
|
return (
|
||||||
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-16 pt-9">
|
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-16 pt-9">
|
||||||
<Dialog>
|
<Search
|
||||||
{/* <DialogTrigger className=" appearance-none" asChild>
|
value={search}
|
||||||
<Button
|
changeValue={(data: any) => setSearch(data)}
|
||||||
// onClick={handelVerify}
|
mode="controller"
|
||||||
type="submit"
|
action={handelSearch}
|
||||||
className="bg-brown hover:bg-brown/90 text-white w-36 p-2 rounded-xl mt-6 md:mt-12 mb-2"
|
/>
|
||||||
>
|
<TableController data={data?.data} />
|
||||||
+ بارگذاری کلید جدید
|
<Pagination
|
||||||
</Button>
|
countPage={totalCount}
|
||||||
</DialogTrigger> */}
|
Page={(num: number) => setPage(num + 1)}
|
||||||
<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"
|
|
||||||
>
|
|
||||||
ثبت شده
|
|
||||||
</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>
|
|
||||||
|
|
||||||
{/* 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="tab3">
|
|
||||||
<TableController
|
|
||||||
checkKey={(item: any) => checkKey(item)}
|
|
||||||
data={inProgressComplaints}
|
|
||||||
/>
|
|
||||||
</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>
|
|
||||||
<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>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,19 +41,17 @@ interface Complaint {
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
};
|
};
|
||||||
|
statusWithDescription: {
|
||||||
|
value: number;
|
||||||
|
description: string;
|
||||||
|
};
|
||||||
status: number;
|
status: number;
|
||||||
registeredAt: string;
|
registeredAt: string;
|
||||||
lastChanged: string;
|
lastChanged: string;
|
||||||
lastActor: number;
|
lastActor: number;
|
||||||
cipherKeyInspector: string;
|
cipherKeyInspector: string;
|
||||||
}
|
}
|
||||||
export default function TableController({
|
export default function TableController({ data }: { data: Complaint[] }) {
|
||||||
data,
|
|
||||||
checkKey,
|
|
||||||
}: {
|
|
||||||
data: Complaint[];
|
|
||||||
checkKey: (item: any) => any;
|
|
||||||
}) {
|
|
||||||
console.log(data);
|
console.log(data);
|
||||||
const saveData = useData((state) => state.saveData);
|
const saveData = useData((state) => state.saveData);
|
||||||
const [selectedFile, setSelectedFile] = useState<any>(null);
|
const [selectedFile, setSelectedFile] = useState<any>(null);
|
||||||
|
|
@ -71,17 +69,7 @@ export default function TableController({
|
||||||
|
|
||||||
reader.readAsText(file);
|
reader.readAsText(file);
|
||||||
};
|
};
|
||||||
// const checkKey = (item: any) => {
|
|
||||||
// const dcKey = Decrypt(item.cipherKeyInspector, selectedFile);
|
|
||||||
// if (dcKey != false && dcKey != null) {
|
|
||||||
// saveData({
|
|
||||||
// trackingNumber: item.trackingNumber,
|
|
||||||
// password: Decrypt(item.cipherKeyInspector, selectedFile),
|
|
||||||
// });
|
|
||||||
// router.push(`/UserPanel/ControllerDashboard/Complaints/${item.id}`);
|
|
||||||
// } else {
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Table className="border-[1px] border-solid border-muted rounded-md ">
|
<Table className="border-[1px] border-solid border-muted rounded-md ">
|
||||||
|
|
@ -92,6 +80,7 @@ export default function TableController({
|
||||||
<TableHead>تاریخ</TableHead>
|
<TableHead>تاریخ</TableHead>
|
||||||
<TableHead>کد پیگیری</TableHead>
|
<TableHead>کد پیگیری</TableHead>
|
||||||
<TableHead>موضوع</TableHead>
|
<TableHead>موضوع</TableHead>
|
||||||
|
<TableHead>وضعیت</TableHead>
|
||||||
<TableHead>دستگاه مربوطه</TableHead>
|
<TableHead>دستگاه مربوطه</TableHead>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHeader>
|
</TableHeader>
|
||||||
|
|
@ -123,12 +112,18 @@ 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-5/12">
|
<TableCell className="w-2/12">
|
||||||
|
{item?.statusWithDescription
|
||||||
|
? item.statusWithDescription.description
|
||||||
|
: "-"}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell className="w-3/12">
|
||||||
{item?.complaintOrganization
|
{item?.complaintOrganization
|
||||||
? item?.complaintOrganization.title
|
? item?.complaintOrganization.title
|
||||||
: "-"}
|
: "-"}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
{/* </Link> */}
|
{/* </Link> */}
|
||||||
|
|
||||||
</TableRow>
|
</TableRow>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ import bgimg from "../public/img/bg.png";
|
||||||
|
|
||||||
export const menuItems = [
|
export const menuItems = [
|
||||||
{ id: 1, name: "صفحه اصلی", href: "/" },
|
{ id: 1, name: "صفحه اصلی", href: "/" },
|
||||||
{ id: 2, name: "اخبار", href: "/" },
|
{ id: 2, name: "اخبار", href: "/News" },
|
||||||
{ id: 3, name: "درباره ما", href: "/" },
|
{ id: 3, name: "درباره ما", href: "/AboutUs" },
|
||||||
{ id: 4, name: "تماس با ما", href: "/CallUs" },
|
{ id: 4, name: "تماس با ما", href: "/CallUs" },
|
||||||
{ id: 5, name: "پیگیری", href: "/FollowUp" },
|
{ id: 5, name: "پیگیری", href: "/FollowUp" },
|
||||||
{ id: 6, name: "ورود به پنل کاربری", href: "/Login" },
|
{ id: 6, name: "ورود به پنل کاربری", href: "/Login" },
|
||||||
|
|
@ -106,13 +106,13 @@ export const footerItems = [
|
||||||
];
|
];
|
||||||
|
|
||||||
export const callUsItems = [
|
export const callUsItems = [
|
||||||
{
|
// {
|
||||||
id: 1,
|
// id: 1,
|
||||||
title: "نشانی",
|
// title: "نشانی",
|
||||||
icon: <LuMapPin size="full" />,
|
// icon: <LuMapPin size="full" />,
|
||||||
description: " نشانی ما جهت ارتباط ",
|
// description: " نشانی ما جهت ارتباط ",
|
||||||
description2: "google map",
|
// description2: "google map",
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
title: "نشانی الکترونیک",
|
title: "نشانی الکترونیک",
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@
|
||||||
"react-leaflet": "^4.2.1",
|
"react-leaflet": "^4.2.1",
|
||||||
"react-loader-spinner": "^6.1.6",
|
"react-loader-spinner": "^6.1.6",
|
||||||
"react-otp-input": "^3.1.1",
|
"react-otp-input": "^3.1.1",
|
||||||
|
"react-paginate": "^8.2.0",
|
||||||
"react-responsive": "^9.0.2",
|
"react-responsive": "^9.0.2",
|
||||||
"react-spinners": "^0.13.8",
|
"react-spinners": "^0.13.8",
|
||||||
"react-to-print": "^2.14.15",
|
"react-to-print": "^2.14.15",
|
||||||
|
|
@ -72,6 +73,7 @@
|
||||||
"eslint": "^8",
|
"eslint": "^8",
|
||||||
"eslint-config-next": "14.0.3",
|
"eslint-config-next": "14.0.3",
|
||||||
"postcss": "^8",
|
"postcss": "^8",
|
||||||
|
"tailwind-scrollbar": "^3.0.5",
|
||||||
"tailwindcss": "^3.3.0",
|
"tailwindcss": "^3.3.0",
|
||||||
"typescript": "^5"
|
"typescript": "^5"
|
||||||
}
|
}
|
||||||
|
|
@ -8158,6 +8160,17 @@
|
||||||
"react-dom": ">=16.8.6 || ^17.0.0 || ^18.0.0"
|
"react-dom": ">=16.8.6 || ^17.0.0 || ^18.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/react-paginate": {
|
||||||
|
"version": "8.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-paginate/-/react-paginate-8.2.0.tgz",
|
||||||
|
"integrity": "sha512-sJCz1PW+9PNIjUSn919nlcRVuleN2YPoFBOvL+6TPgrH/3lwphqiSOgdrLafLdyLDxsgK+oSgviqacF4hxsDIw==",
|
||||||
|
"dependencies": {
|
||||||
|
"prop-types": "^15"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^16 || ^17 || ^18"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/react-remove-scroll": {
|
"node_modules/react-remove-scroll": {
|
||||||
"version": "2.5.5",
|
"version": "2.5.5",
|
||||||
"resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.5.5.tgz",
|
"resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.5.5.tgz",
|
||||||
|
|
@ -8987,6 +9000,18 @@
|
||||||
"url": "https://github.com/sponsors/dcastil"
|
"url": "https://github.com/sponsors/dcastil"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/tailwind-scrollbar": {
|
||||||
|
"version": "3.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/tailwind-scrollbar/-/tailwind-scrollbar-3.0.5.tgz",
|
||||||
|
"integrity": "sha512-0ZwxTivevqq9BY9fRP9zDjHl7Tu+J5giBGbln+0O1R/7nHtBUKnjQcA1aTIhK7Oyjp6Uc/Dj6/dn8Dq58k5Uww==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.13.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"tailwindcss": "3.x"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/tailwindcss": {
|
"node_modules/tailwindcss": {
|
||||||
"version": "3.3.5",
|
"version": "3.3.5",
|
||||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.5.tgz",
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@
|
||||||
"react-leaflet": "^4.2.1",
|
"react-leaflet": "^4.2.1",
|
||||||
"react-loader-spinner": "^6.1.6",
|
"react-loader-spinner": "^6.1.6",
|
||||||
"react-otp-input": "^3.1.1",
|
"react-otp-input": "^3.1.1",
|
||||||
|
"react-paginate": "^8.2.0",
|
||||||
"react-responsive": "^9.0.2",
|
"react-responsive": "^9.0.2",
|
||||||
"react-spinners": "^0.13.8",
|
"react-spinners": "^0.13.8",
|
||||||
"react-to-print": "^2.14.15",
|
"react-to-print": "^2.14.15",
|
||||||
|
|
@ -73,6 +74,7 @@
|
||||||
"eslint": "^8",
|
"eslint": "^8",
|
||||||
"eslint-config-next": "14.0.3",
|
"eslint-config-next": "14.0.3",
|
||||||
"postcss": "^8",
|
"postcss": "^8",
|
||||||
|
"tailwind-scrollbar": "^3.0.5",
|
||||||
"tailwindcss": "^3.3.0",
|
"tailwindcss": "^3.3.0",
|
||||||
"typescript": "^5"
|
"typescript": "^5"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ module.exports = {
|
||||||
blue50: "#335F9380",
|
blue50: "#335F9380",
|
||||||
yellow: "#F7A600",
|
yellow: "#F7A600",
|
||||||
brown: "#D28249",
|
brown: "#D28249",
|
||||||
gray: "#BFBFBF",
|
|
||||||
border: "hsl(var(--border))",
|
border: "hsl(var(--border))",
|
||||||
input: "hsl(var(--input))",
|
input: "hsl(var(--input))",
|
||||||
ring: "hsl(var(--ring))",
|
ring: "hsl(var(--ring))",
|
||||||
|
|
@ -95,5 +94,5 @@ module.exports = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [require("tailwindcss-animate")],
|
plugins: [require("tailwindcss-animate"), require("tailwind-scrollbar")],
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,19 @@ export async function postComplaintsDetails(payload: FormData) {
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getComplaints() {
|
export async function getComplaints({
|
||||||
const data = await axios.get("api/Citizen/List");
|
states = 0,
|
||||||
return data.data;
|
TrackingNumber,
|
||||||
|
PageNumber = 1,
|
||||||
|
PageSize = 5,
|
||||||
|
}: {
|
||||||
|
states?: number;
|
||||||
|
TrackingNumber?: string;
|
||||||
|
PageNumber?: number;
|
||||||
|
PageSize?: number;
|
||||||
|
}) {
|
||||||
|
const data = await axios.get("api/Citizen/List", {
|
||||||
|
params: { TrackingNumber: TrackingNumber, PageNumber, PageSize },
|
||||||
|
});
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,3 +36,12 @@ export async function getSingleWebContents( title: string ) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// News
|
||||||
|
export async function getNews() {
|
||||||
|
const data = await axios.get("api/Common/News");
|
||||||
|
console.log(data);
|
||||||
|
return data.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue