part of "RecentRequest" Added
parent
ec8afb4aa7
commit
3c868ec00f
|
|
@ -7,11 +7,11 @@ export default function RequestLayout({
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<section>
|
<section className="flex justify-end">
|
||||||
{/* Include shared UI here e.g. a header or sidebar */}
|
{/* Include shared UI here e.g. a header or sidebar */}
|
||||||
<SideMenu />
|
<SideMenu />
|
||||||
<UserHeader />
|
<UserHeader />
|
||||||
<div className=" w-[calc(100%-208px)] bg-rose-200">{children}</div>
|
<div className=" w-[calc(100%-208px)] bg-rose-200 mt-8">{children}</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ import React from 'react'
|
||||||
import RecentRequests from '@/components/RecentRequest/RecentRequests'
|
import RecentRequests from '@/components/RecentRequest/RecentRequests'
|
||||||
function page() {
|
function page() {
|
||||||
return (
|
return (
|
||||||
<>
|
<div>
|
||||||
<RecentRequests />
|
<RecentRequests />
|
||||||
</>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,8 +79,8 @@
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
direction: rtl;
|
/* direction: rtl; */
|
||||||
font-family: "iranyekan";
|
font-family: iranyekan;
|
||||||
-webkit-tap-highlight-color: transparent;
|
-webkit-tap-highlight-color: transparent;
|
||||||
--d-header-height: 70px;
|
--d-header-height: 70px;
|
||||||
--d-sideMenu-width-open: 200px;
|
--d-sideMenu-width-open: 200px;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,42 @@
|
||||||
import React from 'react'
|
"use client";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import { GoArrowLeft } from "react-icons/go";
|
||||||
|
import { menuItems } from "@/constants";
|
||||||
|
import Link from "next/link";
|
||||||
|
|
||||||
const SideMenu = () => {
|
const SideMenu = () => {
|
||||||
return (
|
const [open, setOpen] = useState(false);
|
||||||
<div className='flex flex-col items-start justify-start bg-gradient-to-b from-yellow to-orange-400 w-52 h-screen rounded-l-[30px] fixed right-0 top-0'>SideMenu</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default SideMenu
|
return (
|
||||||
|
<div
|
||||||
|
className={`flex flex-col items-start justify-start bg-gradient-to-b from-yellow to-orange-400 h-screen rounded-l-[30px] fixed right-0 top-0 transition-all duration-700 ease-in-out
|
||||||
|
${open === true ? "w-[200px]" : "w-20"} `}
|
||||||
|
>
|
||||||
|
SideMenu
|
||||||
|
<div
|
||||||
|
onClick={() => setOpen(!open)}
|
||||||
|
className={`flex items-center aspect-square bg-white rounded-full shadow-sm text-yellow cursor-pointer h-7 justify-center -left-3 absolute top-5 transition-all duration-700 ease-in-out w-7 z-[400]
|
||||||
|
${open === true ? "rotate-180" : "rotate-0"} `}
|
||||||
|
>
|
||||||
|
<GoArrowLeft className="text-yellow" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<ul>
|
||||||
|
{menuItems.map((menuItem) => (
|
||||||
|
<Link
|
||||||
|
href={menuItem.href}
|
||||||
|
key={menuItem.id}
|
||||||
|
className="flex justify-start items-center mb-3 p-2 text-white"
|
||||||
|
>
|
||||||
|
<span className="w-4 h-4">{menuItem.icon}</span>
|
||||||
|
<span>{menuItem.title}</span>
|
||||||
|
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SideMenu;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import UserContainer from "../User/UserContainer";
|
||||||
function RecentRequests() {
|
function RecentRequests() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<UserContainer />
|
<UserContainer />
|
||||||
<div id="all" aria-label="همه">
|
<div id="all" aria-label="همه">
|
||||||
<AllRequests />
|
<AllRequests />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ import { useRouter } from "next/navigation";
|
||||||
import useData from "@/store/useData";
|
import useData from "@/store/useData";
|
||||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import { logisterCitizen } from "@/utils/authenticateApi";
|
import { logisterCitizen } from "@/utils/authenticateApi";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
import { appConstants } from "@/utils/variables";
|
||||||
|
|
||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
phoneNumber: z.string({ required_error: "*فیلد اجباری*" }).max(11, {
|
phoneNumber: z.string({ required_error: "*فیلد اجباری*" }).max(11, {
|
||||||
|
|
@ -40,6 +42,13 @@ function LoginForm() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const saveData = useData((state) => state.saveData);
|
const saveData = useData((state) => state.saveData);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
localStorage.removeItem("countdownTime");
|
||||||
|
localStorage.removeItem("CountDownCompleted");
|
||||||
|
localStorage.removeItem(appConstants.SH_CT_OTP_TOKEN);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: CaptchaData,
|
data: CaptchaData,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
|
@ -56,6 +65,8 @@ function LoginForm() {
|
||||||
router.push("/Verify");
|
router.push("/Verify");
|
||||||
localStorage.setItem("VerifyRole", "citizen");
|
localStorage.setItem("VerifyRole", "citizen");
|
||||||
localStorage.setItem("verificationToken", res);
|
localStorage.setItem("verificationToken", res);
|
||||||
|
localStorage.setItem(appConstants.SH_CT_OTP_TOKEN,res.data);
|
||||||
|
console.log(res.data);
|
||||||
},
|
},
|
||||||
onError: (err: any | string) => {
|
onError: (err: any | string) => {
|
||||||
refetch();
|
refetch();
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,8 @@ const CountdownTimer = ({ isShow, setIsShow }) => {
|
||||||
const handleTick = (time) => {
|
const handleTick = (time) => {
|
||||||
// Store remaining time in local storage on each tick
|
// Store remaining time in local storage on each tick
|
||||||
localStorage.setItem("countdownTime", time.total);
|
localStorage.setItem("countdownTime", time.total);
|
||||||
|
console.log("handleTick");
|
||||||
|
|
||||||
};
|
};
|
||||||
const renderer = ({ hours, minutes, seconds, completed }) => {
|
const renderer = ({ hours, minutes, seconds, completed }) => {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ export const VerifyInput = () => {
|
||||||
const justLogin = localStorage.getItem("Shahrbin_Login_State");
|
const justLogin = localStorage.getItem("Shahrbin_Login_State");
|
||||||
if (justLogin) {
|
if (justLogin) {
|
||||||
// router.push("/Account/Complaints");
|
// router.push("/Account/Complaints");
|
||||||
router.push("/After");
|
router.push("/RecentRequest");
|
||||||
localStorage.removeItem("Shahrbin_Login_State");
|
localStorage.removeItem("Shahrbin_Login_State");
|
||||||
console.log("justLogin");
|
console.log("justLogin");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -93,26 +93,41 @@ export const VerifyInput = () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//Handle Verify
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log(otp);
|
console.log(otp);
|
||||||
|
|
||||||
if (otp.length == 6) {
|
if (otp.length == 6) {
|
||||||
|
console.log("Lenght 6");
|
||||||
if (localStorage.getItem("CountDownCompleted")) {
|
if (localStorage.getItem("CountDownCompleted")) {
|
||||||
const otpTokenString = localStorage.getItem(
|
const otpTokenString = localStorage.getItem(
|
||||||
appConstants.SH_CT_OTP_TOKEN
|
appConstants.SH_CT_OTP_TOKEN
|
||||||
);
|
)
|
||||||
|
// if (otpTokenString !== null) {
|
||||||
|
// resendOtpMutation.mutate({
|
||||||
|
// otpToken: JSON.parse(otpTokenString),
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
if (otpTokenString !== null) {
|
if (otpTokenString !== null) {
|
||||||
resendOtpMutation.mutate({
|
try {
|
||||||
otpToken: JSON.parse(otpTokenString),
|
const otpToken = JSON.parse(otpTokenString);
|
||||||
});
|
resendOtpMutation.mutate({
|
||||||
|
otpToken: otpToken,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error parsing otpTokenString:', error);
|
||||||
|
// Handle the error accordingly, e.g., notify the user or handle it gracefully.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log(2);
|
console.log(2);
|
||||||
// makeRequest();
|
// makeRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
otpToken: localStorage.getItem("verificationToken"),
|
// otpToken: localStorage.getItem("verificationToken"),
|
||||||
|
otpToken: localStorage.getItem(appConstants.SH_CT_OTP_TOKEN),
|
||||||
verificationCode: otp,
|
verificationCode: otp,
|
||||||
};
|
};
|
||||||
CitizenVerifyMutation.mutate(payload);
|
CitizenVerifyMutation.mutate(payload);
|
||||||
|
|
@ -194,6 +209,7 @@ export const VerifyInput = () => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* <input type="text" className="w-full"/> */}
|
||||||
<div className="mx-auto w-full text-center text-xl mt-6">
|
<div className="mx-auto w-full text-center text-xl mt-6">
|
||||||
{" "}
|
{" "}
|
||||||
<CountdownTimer
|
<CountdownTimer
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { FaList } from "react-icons/fa";
|
||||||
|
import { FaPlus } from "react-icons/fa6";
|
||||||
|
import { PiSquaresFourFill } from "react-icons/pi";
|
||||||
|
import { FaChartBar } from "react-icons/fa";
|
||||||
|
import { TbWorld } from "react-icons/tb";
|
||||||
|
import { FaCogs } from "react-icons/fa";
|
||||||
|
|
||||||
|
export const menuItems = [
|
||||||
|
{ id: 1, title: "صفحه اصلی", href: "/", icon: <FaList size="full" />},
|
||||||
|
{ id: 2, title: "ثبت درخواست", href: "/", icon: <FaPlus size="full" /> },
|
||||||
|
{ id: 3, title: "درخواست های من", href: "/", icon: <PiSquaresFourFill size="full" /> },
|
||||||
|
{ id: 4, title: "نظرسنجی ها ", href: "/", icon: <FaChartBar size="full" /> },
|
||||||
|
{ id: 5, title: "اخبار", href: "/" , icon: <TbWorld size="full" /> },
|
||||||
|
{ id: 6, title: "تنظیمات", href: "/", icon: <FaCogs size="full" /> },
|
||||||
|
];
|
||||||
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
"react-countdown": "^2.3.5",
|
"react-countdown": "^2.3.5",
|
||||||
"react-dom": "^18",
|
"react-dom": "^18",
|
||||||
"react-hook-form": "^7.51.2",
|
"react-hook-form": "^7.51.2",
|
||||||
|
"react-icons": "^5.1.0",
|
||||||
"react-loader-spinner": "^6.1.6",
|
"react-loader-spinner": "^6.1.6",
|
||||||
"react-otp-input": "^3.1.1",
|
"react-otp-input": "^3.1.1",
|
||||||
"sonner": "^1.4.41",
|
"sonner": "^1.4.41",
|
||||||
|
|
@ -4406,6 +4407,14 @@
|
||||||
"react": "^16.8.0 || ^17 || ^18"
|
"react": "^16.8.0 || ^17 || ^18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/react-icons": {
|
||||||
|
"version": "5.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-icons/-/react-icons-5.1.0.tgz",
|
||||||
|
"integrity": "sha512-D3zug1270S4hbSlIRJ0CUS97QE1yNNKDjzQe3HqY0aefp2CBn9VgzgES27sRR2gOvFK+0CNx/BW0ggOESp6fqQ==",
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/react-is": {
|
"node_modules/react-is": {
|
||||||
"version": "16.13.1",
|
"version": "16.13.1",
|
||||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
"react-countdown": "^2.3.5",
|
"react-countdown": "^2.3.5",
|
||||||
"react-dom": "^18",
|
"react-dom": "^18",
|
||||||
"react-hook-form": "^7.51.2",
|
"react-hook-form": "^7.51.2",
|
||||||
|
"react-icons": "^5.1.0",
|
||||||
"react-loader-spinner": "^6.1.6",
|
"react-loader-spinner": "^6.1.6",
|
||||||
"react-otp-input": "^3.1.1",
|
"react-otp-input": "^3.1.1",
|
||||||
"sonner": "^1.4.41",
|
"sonner": "^1.4.41",
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ export async function logisterCitizen(payload: {
|
||||||
value: string;
|
value: string;
|
||||||
};
|
};
|
||||||
}) {
|
}) {
|
||||||
const data = await axios.post(`api/${instance.id}/Authenticate/LogisterCitizen`,payload);
|
const data = await axios.post(`api/Authenticate/LogisterCitizen`,payload);
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -27,7 +27,7 @@ export async function verifyCitizen(payload: {
|
||||||
otpToken: string | null;
|
otpToken: string | null;
|
||||||
verificationCode: string;
|
verificationCode: string;
|
||||||
}) {
|
}) {
|
||||||
const data = await axios.post(`api/${instance.id}/Authenticate/VerifyCitizen`, payload);
|
const data = await axios.post(`api/Authenticate/VerifyCitizen`, payload);
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7,7 +7,7 @@ axios.defaults.baseURL = process.env.NEXT_PUBLIC_BASE_URL_APP;
|
||||||
|
|
||||||
// Get Captcha
|
// Get Captcha
|
||||||
export async function getCaptcha() {
|
export async function getCaptcha() {
|
||||||
const data = await axios.get(`/api/${instance.id}/Authenticate/Captcha`, {
|
const data = await axios.get(`/api/Authenticate/Captcha`, {
|
||||||
responseType: "blob",
|
responseType: "blob",
|
||||||
});
|
});
|
||||||
return data;
|
return data;
|
||||||
|
|
@ -15,7 +15,7 @@ export async function getCaptcha() {
|
||||||
|
|
||||||
export async function resendOtp(payload: { otpToken: string | any}) {
|
export async function resendOtp(payload: { otpToken: string | any}) {
|
||||||
const data = await axios.post(
|
const data = await axios.post(
|
||||||
`/api/${instance.id}/Authenticate/ResendOtp`,
|
`/api/Authenticate/ResendOtp`,
|
||||||
payload
|
payload
|
||||||
);
|
);
|
||||||
return data.data;
|
return data.data;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue