diff --git a/app/UserPanel/(Citizen)/CitizenDashboard/layout.tsx b/app/UserPanel/(Citizen)/CitizenDashboard/layout.tsx new file mode 100644 index 0000000..1c0558a --- /dev/null +++ b/app/UserPanel/(Citizen)/CitizenDashboard/layout.tsx @@ -0,0 +1,16 @@ +import NavbarPanel from "@/components/NavbarPanel"; + +export default function RootLayout({ + children, + }: { + children: React.ReactNode; + }) { + return ( + <> + + + {children} + + ) + +} \ No newline at end of file diff --git a/app/UserPanel/(Citizen)/CitizenDashboard/page.tsx b/app/UserPanel/(Citizen)/CitizenDashboard/page.tsx new file mode 100644 index 0000000..cb2be10 --- /dev/null +++ b/app/UserPanel/(Citizen)/CitizenDashboard/page.tsx @@ -0,0 +1,7 @@ +import React from 'react' + +export default function page() { + return ( +
page
+ ) +} diff --git a/app/components/Landing.tsx b/app/components/Landing.tsx index 983fd0d..933c4e9 100644 --- a/app/components/Landing.tsx +++ b/app/components/Landing.tsx @@ -47,7 +47,7 @@ export default function Landing() { // width={20} // height={20} quality={100} - className=" w-full h-full bg-cover" + className=" w-full h-full object-cover" /> ); diff --git a/app/globals.css b/app/globals.css index ea64c18..94b427c 100644 --- a/app/globals.css +++ b/app/globals.css @@ -91,3 +91,14 @@ } +.printPage{ + background-color: antiquewhite; + color: black; + direction: rtl; + font-family: sans-serif; + font-size: medium; + padding: 1em; + border: 2px solid black; +} + + diff --git a/app/print-styles.css b/app/print-styles.css new file mode 100644 index 0000000..80d5fc1 --- /dev/null +++ b/app/print-styles.css @@ -0,0 +1,13 @@ +/* styles/print-styles.css */ + +@media print { + + /* Add styles for the print window */ + body { + font-size: larger; + color: red; + background-color: aquamarine; + padding: 2em; + /* Add any other print-specific styles */ + } +} \ No newline at end of file diff --git a/components/FollowResult.tsx b/components/FollowResult.tsx index ca789fc..a955e20 100644 --- a/components/FollowResult.tsx +++ b/components/FollowResult.tsx @@ -1,5 +1,5 @@ "use client"; -import React, { useEffect, useState } from "react"; +import React, { useEffect, useState, useRef } from "react"; import Image from "next/image"; import Resultimg from "../public/img/followResult.png"; import Link from "next/link"; @@ -21,12 +21,23 @@ 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'; export default function FollowResult() { const router = useRouter(); const [trackingNumber, setTrackingNumber] = useState(); const [password, setPassword] = useState(); - const [complaintData, setComplaintData] = useState(); + const [complaintData, setComplaintData] = useState(); + + + // Print component Data + const componentRef = useRef(null); + const handlePrint = useReactToPrint({ + content: () => componentRef.current + }); + useEffect(() => { setTrackingNumber(localStorage.getItem("trackingNumber2")); @@ -40,7 +51,7 @@ export default function FollowResult() { onSuccess: (res) => { console.log(res); // alert("SuccessPrint"); - console.log("Success Folllow Result"); + console.log("Success Folllow Result"); console.log(res); setComplaintData(res); @@ -60,12 +71,9 @@ export default function FollowResult() { }); } - function handlePrint() { - var prtContent = document.getElementById("details"); - // document.body.innerHTML= printContents; - // window.document.write(prtContent?.innerHTML); - window.print(); - } + +const printableContent = 'This is the content to be printed.'; + return (
@@ -121,7 +129,7 @@ export default function FollowResult() { />
) : ( -
+

{" "} موضوع شکایت:{" "} @@ -151,6 +159,7 @@ export default function FollowResult() { در دست بررسی و اقدام می باشد. در صورت تمایل می توانید با شماره تلفن 0353286545 جهت پشتیبانی تماس حاصل کنید.

+
)} @@ -163,11 +172,12 @@ export default function FollowResult() { > پرینت گزارش +
- + icon) { - toast({ - title: "You submitted the following values:", - description: ( -
-          {JSON.stringify(data, null, 2)}
-        
- ), - }); + // toast({ + // title: "You submitted the following values:", + // description: ( + //
+    //       {JSON.stringify(data, null, 2)}
+    //     
+ // ), + // }); console.log(data); diff --git a/components/Navbar.tsx b/components/Navbar.tsx index 30af78a..a402645 100644 --- a/components/Navbar.tsx +++ b/components/Navbar.tsx @@ -18,7 +18,7 @@ export default function Navbar() {
-
+
-
{item.name}
+
{item.name}
); }else{ diff --git a/components/NavbarPanel.tsx b/components/NavbarPanel.tsx index 0b9042b..94963f2 100644 --- a/components/NavbarPanel.tsx +++ b/components/NavbarPanel.tsx @@ -22,11 +22,11 @@ export default function NavbarPanel() {
-

+

پنل کاربری |

@@ -38,7 +38,7 @@ export default function NavbarPanel() { return (

diff --git a/components/PrintPage.tsx b/components/PrintPage.tsx deleted file mode 100644 index c4e1a12..0000000 --- a/components/PrintPage.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react' -import { Button } from './ui/button' - -export default function PrintPage() { - function handlePrint() { - window.print() - //the window.print() command is what is telling the browser to print the page - } - return ( - -//the onClick function is built into React to look for a click event! - - ) -} - \ No newline at end of file diff --git a/components/RequestStep2.tsx b/components/RequestStep2.tsx index 88f30c2..d0933f1 100644 --- a/components/RequestStep2.tsx +++ b/components/RequestStep2.tsx @@ -368,20 +368,7 @@ export default function RequestStep2() {

{/* Captcha */}
-
- {!isLoading && ( - icon - )} - {/* 1 */} -
- + )} /> + +
+ {!isLoading && ( + icon + )} + {/* 1 */} +
+
diff --git a/components/TopNav.tsx b/components/TopNav.tsx index 0584e50..6eb1042 100644 --- a/components/TopNav.tsx +++ b/components/TopNav.tsx @@ -11,17 +11,17 @@ export default function TopNav() { return (
-

+

سال 1402 | مهارم تورم، رشد تولید -

+

{/*

Current pathname: {pathname}

*/}
-

+

امروز: چهارشنبه 24 آبان 1402

diff --git a/components/ui/input.tsx b/components/ui/input.tsx index fe2cd6d..5b1aeeb 100644 --- a/components/ui/input.tsx +++ b/components/ui/input.tsx @@ -13,7 +13,7 @@ const Input = React.forwardRef( className={cn( `flex w-full rounded-md border border-input px-3 py-2 ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 text-black text-opacity-50 text-xs font-normal bg-slate-200 mb-3 - 3xl:h-12 h-10 transition-all + 3xl:h-9 h-10 transition-all hover:bg-slate-300 hover:cursor-pointer focus:cursor-auto focus:outline-4 focus:outline-slate-300 focus:bg-slate-200 diff --git a/package-lock.json b/package-lock.json index b7796b1..d607247 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,6 +50,7 @@ "react-otp-input": "^3.1.1", "react-responsive": "^9.0.2", "react-spinners": "^0.13.8", + "react-to-print": "^2.14.15", "react-use": "^17.4.2", "sonner": "^1.3.1", "swiper": "^11.0.5", @@ -7740,6 +7741,15 @@ } } }, + "node_modules/react-to-print": { + "version": "2.14.15", + "resolved": "https://registry.npmjs.org/react-to-print/-/react-to-print-2.14.15.tgz", + "integrity": "sha512-SKnwOzU2cJ8eaAkoJO7+gNhvfEDmm+Y34IdcHsjtHioUevUPhprqbVtvNJlZ2JkGJ8ExK2QNWM9pXECTDR5D8w==", + "peerDependencies": { + "react": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/react-universal-interface": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/react-universal-interface/-/react-universal-interface-0.6.2.tgz", diff --git a/package.json b/package.json index 91919e2..63427a8 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "react-otp-input": "^3.1.1", "react-responsive": "^9.0.2", "react-spinners": "^0.13.8", + "react-to-print": "^2.14.15", "react-use": "^17.4.2", "sonner": "^1.3.1", "swiper": "^11.0.5", diff --git a/tsconfig.json b/tsconfig.json index 8782d6b..4142e37 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,6 +22,6 @@ "@/*": ["./*"] } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "tailwind.config.js"], + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "tailwind.config.js", "components/Resume.jsx"], "exclude": ["node_modules"] }