Bugs fixed

Kahdooei
Hossein Rahmani 2024-01-29 20:29:26 +03:30
parent 525cd00055
commit 13fafbf9a8
8 changed files with 159 additions and 68 deletions

View File

@ -14,16 +14,21 @@ import { useQuery } from "@tanstack/react-query";
export default function CallUs(props: any) {
const { position, zoom } = props;
const { data, isLoading, isError, refetch } = useQuery({
queryKey: ["WebContents", "CallUs"],
queryFn: () => getSingleWebContents("CallUs"),
refetchOnWindowFocus: false,
});
console.log(data);
const fetchedContent = data?.content || "";
return (
<div className="bg-white dark:bg-gray-900 w-screen">
<div className="bg-white dark:bg-gray-900 pt-8 3xl:w-[60%] w-[80%] ">
<div className="w-full">
{/* <div className="w-full mt-6"> */}
{/* <Map /> */}
{/* </div> */}
<div className="container flex items-center h-[90vh]">
<div dangerouslySetInnerHTML={{ __html: fetchedContent }} />
{/* <div className="container flex items-center h-[90vh]">
<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) => {
return (
@ -59,7 +64,7 @@ export default function CallUs(props: any) {
);
})}
</div>
</div>
</div> */}
</div>
</div>
);

View File

@ -116,6 +116,8 @@ export default function ComplainsDetails({
mutationFn: postComplaintTracking,
onSuccess: (res) => {
setOpen(false);
localStorage.removeItem("trackingNumber2");
localStorage.removeItem("password2");
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}</>, {

View File

@ -78,7 +78,6 @@ export default function FollowResult() {
<ComplainsDetails
role="Citizen"
state="FollowResult"
Data={complaintPrintMutation?.data}
/>
</>
</div>

View File

@ -3,13 +3,13 @@
import React, { useEffect, useState } from "react";
import { Input } from "./ui/input";
import Image from "next/image";
import { menuItems } from "@/constants";
import { authorizedMenuItems, menuItems } from "@/constants";
import Link from "next/link";
import Login from "./Login";
import { Button } from "./ui/button";
import { usePathname } from "next/navigation";
import TopNav from "./TopNav";
import { isAuthorized } from "@/lib/utils";
import { cn, isAuthorized } from "@/lib/utils";
import useToken from "@/store/useToken";
import { DropdownMenu } from "@radix-ui/react-dropdown-menu";
import ProfileDropDown from "./ProfileDropDown";
@ -30,7 +30,7 @@ export default function Navbar() {
setAuth(false);
}
}, [isAuth, token]);
console.log(pathname);
return (
<div className={` left-0 right-0 top-0 z-20 fixed`}>
{/* <TopNav /> */}
@ -53,6 +53,41 @@ export default function Navbar() {
className="fixed z-[100] left-0 shadow-4xl right-0 top-[4rem] p-5 bg-white border-b-2 shadow-md"
>
<ul className="grid gap-2 ">
{auth ? (
<>
{authorizedMenuItems.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-yellow" : "bg-blue"} `}
href={item.href}
>
<span className="flex gap-1 text-sm">
{item.name}
</span>
{/* <Icon className="text-xl" /> */}
</Link>
</motion.li>
);
})}
</>
) : (
<>
{menuItems.map((item, idx, array) => {
// const { Icon } = item;
const lastItem = array.length - 1;
@ -83,6 +118,8 @@ export default function Navbar() {
</motion.li>
);
})}
</>
)}
</ul>
</motion.div>
)}
@ -107,17 +144,45 @@ export default function Navbar() {
</div>
</div>
<div className=" flex gap-5 items-center mr-8 max-md:hidden">
{menuItems.map((item, index, array) => {
if (array.length - 1 !== index) {
{auth ? (
<>
{authorizedMenuItems.map((item, index, array) => {
return (
<Link key={item.id} href={item.href}>
<Link
className={cn(
" p-2 rounded-md",
pathname == item.href && "bg-gray-200"
)}
key={item.id}
href={item.href}
>
<div className=" text-sm font-bold">{item.name}</div>
</Link>
);
} else {
return <></>;
})}
</>
) : (
<>
{menuItems.map((item, index, array) => {
if (array.length - 1 !== index) {
return (
<Link
className={cn(
" p-1 rounded-md",
pathname == item.href && "bg-gray-200"
)}
key={item.id}
href={item.href}
>
<div className=" text-sm font-bold p-2">
{item.name}
</div>
</Link>
);
}
})}
</>
)}
</div>
</div>
{auth ? (

View File

@ -6,6 +6,7 @@ import { useQuery } from "@tanstack/react-query";
import Image from "next/image";
import Link from "next/link";
import { convertFullTime } from "@/lib/utils";
import { useRouter } from "next/navigation";
interface News {
id: string;
image: {
@ -27,12 +28,12 @@ interface News {
}
export default function News() {
const router = useRouter();
const { data, isLoading, isError, refetch } = useQuery({
queryKey: ["News"],
queryFn: () => getNews(),
});
return (
<div className="bg-white dark:bg-gray-900 pt-8 3xl:w-[60%] w-[80%] ">
<h2 className=" w-full font-bold mb-2">اخبار</h2>
@ -44,8 +45,9 @@ export default function News() {
return (
<div
key={item.id}
onClick={() => router.push(`/News/${item.id}`)}
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]"
h-[20em] sm:h-[15em] max-sm:flex-col max-sm:gap-[3px] cursor-pointer"
>
<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

View File

@ -70,12 +70,18 @@ export default function ProfileDropDown() {
const saveToken = useToken((state) => state.saveToken);
return (
<DropdownMenu dir="rtl">
<DropdownMenuTrigger className=" max-sm:-mr-8 max-sm:text-xs" asChild>
<Button variant="outline">
<DropdownMenuTrigger
className=" max-sm:-mr-8 max-sm:text-xs w-12"
asChild
>
<Button variant="outline" className=" truncate w-32 grid place-content-center">
{/* {profileData?.title ? profileData?.title : profileData?.userName} */}
<p className=" truncate w-full">
{" "}
{profileData?.firstName || profileData?.lastName
? profileData?.firstName + " " + profileData?.lastName
: profileData?.userName}
</p>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent className="w-56 sm:ml-10">

View File

@ -21,7 +21,7 @@ import {
} from "@/components/ui/dialog";
import { ControllerTableItems } from "@/constants";
import Link from "next/link";
import { Decrypt, convertDate } from "@/lib/utils";
import { Decrypt, convertDate, convertFullTime } from "@/lib/utils";
import useData from "@/store/useData";
import { Label } from "./ui/label";
import { Input } from "./ui/input";
@ -76,8 +76,9 @@ export default function TableController({ data }: { data: Complaint[] }) {
<TableHeader>
<TableRow>
<TableHead>ردیف</TableHead>
<TableHead>تاریخ</TableHead>
<TableHead>کد پیگیری</TableHead>
<TableHead>تاریخ ثبت</TableHead>
<TableHead>تاریخ آخرین تغییر</TableHead>
<TableHead>موضوع</TableHead>
<TableHead>وضعیت</TableHead>
<TableHead>دستگاه مربوطه</TableHead>
@ -104,19 +105,22 @@ export default function TableController({ data }: { data: Complaint[] }) {
<TableCell className="w-1/12 font-medium ">
{index + 1}
</TableCell>
<TableCell className="w-1/12">{item.trackingNumber}</TableCell>
<TableCell className="w-2/12">
{convertDate(item.registeredAt)}
{convertFullTime(item.registeredAt)}
</TableCell>
<TableCell className="w-2/12">{item.trackingNumber}</TableCell>
<TableCell className="w-2/12">
{convertFullTime(item.lastChanged)}
</TableCell>
<TableCell className="w-1/12">
{item?.title ? item.title : "-"}
</TableCell>
<TableCell className="w-2/12">
<TableCell className="w-3/12">
{item?.statusWithDescription
? item.statusWithDescription.description
: "-"}
</TableCell>
<TableCell className="w-3/12">
<TableCell className="w-4/12">
{item?.complaintOrganization
? item?.complaintOrganization.title
: "-"}

View File

@ -5,12 +5,20 @@ import bgimg from "../public/img/bg.png";
export const menuItems = [
{ id: 1, name: "صفحه اصلی", href: "/" },
{ id: 2, name: "اخبار", href: "/News" },
{ id: 3, name: "تماس با ما", href: "/CallUs" },
{ id: 4, name: "پیگیری", href: "/FollowUp" },
{ id: 2, name: "پیگیری", href: "/FollowUp" },
{ id: 3, name: "اخبار", href: "/News" },
{ id: 4, name: "تماس با ما", href: "/CallUs" },
{ id: 5, name: "ورود به پنل کاربری", href: "/Login" },
];
export const authorizedMenuItems = [
{ id: 1, name: "صفحه اصلی", href: "/" },
{ id: 2, name: "پیگیری", href: "/FollowUp" },
{ id: 3, name: "درخواست های من", href: "/Account/Complaints" },
{ id: 4, name: "اخبار", href: "/News" },
{ id: 5, name: "تماس با ما", href: "/CallUs" },
];
export const sliderItems = [
{ id: 1, img: bgimg },
{ id: 2, img: bgimg },