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 7383519..32f6702 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,6 +45,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", "swiper": "^11.0.5", "tailwind-merge": "^2.1.0", @@ -2217,6 +2218,21 @@ "hyphenate-style-name": "^1.0.3" } }, + "node_modules/css-mediaquery": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/css-mediaquery/-/css-mediaquery-0.1.2.tgz", + "integrity": "sha512-COtn4EROW5dBGlE/4PiKnh6rZpAPxDeFLaEEwt4i10jpDMFt2EhQGS79QmmrO+iKCHv0PU/HrOWEhijFd1x99Q==" + }, + "node_modules/css-to-react-native": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/css-to-react-native/-/css-to-react-native-3.2.0.tgz", + "integrity": "sha512-e8RKaLXMOFii+02mOlqwjbD00KSEKqblnpO9e++1aXS1fPQOpS1YoqdVHBqPjHNoxeF2mimzVqawm2KCbEdtHQ==", + "dependencies": { + "camelize": "^1.0.0", + "css-color-keywords": "^1.0.0", + "postcss-value-parser": "^4.0.2" + } + }, "node_modules/css-tree": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.1.3.tgz", @@ -7667,6 +7683,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", @@ -7958,6 +7983,16 @@ "node": ">=6.9" } }, + "node_modules/shallow-equal": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/shallow-equal/-/shallow-equal-1.2.1.tgz", + "integrity": "sha512-S4vJDjHHMBaiZuT9NPb616CSmLf618jawtv3sufLl6ivK8WocjAo58cXwbRV1cgqxH0Qbv+iUt6m05eqEa2IRA==" + }, + "node_modules/shallowequal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz", + "integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==" + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -8164,6 +8199,51 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/styled-components": { + "version": "6.1.6", + "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-6.1.6.tgz", + "integrity": "sha512-DgTLULSC29xpabJ24bbn1+hulU6vvGFQf4RPwBOJrm8WJFnN42yXpo5voBt3jDSJBa5tBd1L6PqswJjQ0wRKdg==", + "dependencies": { + "@emotion/is-prop-valid": "1.2.1", + "@emotion/unitless": "0.8.0", + "@types/stylis": "4.2.0", + "css-to-react-native": "3.2.0", + "csstype": "3.1.2", + "postcss": "8.4.31", + "shallowequal": "1.1.0", + "stylis": "4.3.1", + "tslib": "2.5.0" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/styled-components" + }, + "peerDependencies": { + "react": ">= 16.8.0", + "react-dom": ">= 16.8.0" + } + }, + "node_modules/styled-components/node_modules/@emotion/is-prop-valid": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.2.1.tgz", + "integrity": "sha512-61Mf7Ufx4aDxx1xlDeOm8aFFigGHE4z+0sKCa+IHCeZKiyP9RLD0Mmx7m8b9/Cf37f7NAvQOOJAbQQGVr5uERw==", + "dependencies": { + "@emotion/memoize": "^0.8.1" + } + }, + "node_modules/styled-components/node_modules/@emotion/memoize": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.8.1.tgz", + "integrity": "sha512-W2P2c/VRW1/1tLox0mVUalvnWXxavmv/Oum2aPsRcoDJuob75FC3Y8FbpfLwUegRcxINtGUMPq0tFCvYNTBXNA==" + }, + "node_modules/styled-components/node_modules/tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" + }, "node_modules/styled-jsx": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz", diff --git a/package.json b/package.json index b4996ad..8a8adaa 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,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", "swiper": "^11.0.5", "tailwind-merge": "^2.1.0", 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"] }