the Print Page Added ,

Some styles of sliders and menus have been changed
Kahdooei
yasaman 2023-12-31 16:33:05 +03:30
parent fc5c0a4f76
commit 96144c8c77
16 changed files with 185 additions and 60 deletions

View File

@ -0,0 +1,16 @@
import NavbarPanel from "@/components/NavbarPanel";
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<NavbarPanel />
{children}
</>
)
}

View File

@ -0,0 +1,7 @@
import React from 'react'
export default function page() {
return (
<div>page</div>
)
}

View File

@ -47,7 +47,7 @@ export default function Landing() {
// width={20} // width={20}
// height={20} // height={20}
quality={100} quality={100}
className=" w-full h-full bg-cover" className=" w-full h-full object-cover"
/> />
</SwiperSlide> </SwiperSlide>
); );

View File

@ -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;
}

13
app/print-styles.css Normal file
View File

@ -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 */
}
}

View File

@ -1,5 +1,5 @@
"use client"; "use client";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState, useRef } from "react";
import Image from "next/image"; import Image from "next/image";
import Resultimg from "../public/img/followResult.png"; import Resultimg from "../public/img/followResult.png";
import Link from "next/link"; import Link from "next/link";
@ -21,6 +21,9 @@ import { Button } from "@/components/ui/button";
import { IoMdClose } from "react-icons/io"; import { IoMdClose } from "react-icons/io";
import { postComplaintTracking } from "@/utils/citizenApi"; import { postComplaintTracking } from "@/utils/citizenApi";
import { useMutation } from "@tanstack/react-query"; import { useMutation } from "@tanstack/react-query";
import { useReactToPrint } from "react-to-print";
import '../app/print-styles.css';
export default function FollowResult() { export default function FollowResult() {
const router = useRouter(); const router = useRouter();
@ -28,6 +31,14 @@ export default function FollowResult() {
const [password, setPassword] = useState<any>(); const [password, setPassword] = useState<any>();
const [complaintData, setComplaintData] = useState<any>(); const [complaintData, setComplaintData] = useState<any>();
// Print component Data
const componentRef = useRef<HTMLDivElement>(null);
const handlePrint = useReactToPrint({
content: () => componentRef.current
});
useEffect(() => { useEffect(() => {
setTrackingNumber(localStorage.getItem("trackingNumber2")); setTrackingNumber(localStorage.getItem("trackingNumber2"));
setPassword(localStorage.getItem("password2")); setPassword(localStorage.getItem("password2"));
@ -60,12 +71,9 @@ export default function FollowResult() {
}); });
} }
function handlePrint() {
var prtContent = document.getElementById("details"); const printableContent = 'This is the content to be printed.';
// document.body.innerHTML= printContents;
// window.document.write(prtContent?.innerHTML);
window.print();
}
return ( return (
<div className="w-full h-full sm:w-2/3 md:w-3/4 lg:w-1/2 max-sm:p-8 pt-12"> <div className="w-full h-full sm:w-2/3 md:w-3/4 lg:w-1/2 max-sm:p-8 pt-12">
<div className="h-full flex flex-col justify-center"> <div className="h-full flex flex-col justify-center">
@ -121,7 +129,7 @@ export default function FollowResult() {
/> />
</div> </div>
) : ( ) : (
<div id="details"> <div dir="rtl" className=" font-[yekan]" id="details" ref={componentRef} >
<p className="text-[#464646] text-sm font-medium"> <p className="text-[#464646] text-sm font-medium">
{" "} {" "}
موضوع شکایت:{" "} موضوع شکایت:{" "}
@ -151,6 +159,7 @@ export default function FollowResult() {
در دست بررسی و اقدام می باشد. در صورت تمایل می توانید با در دست بررسی و اقدام می باشد. در صورت تمایل می توانید با
شماره تلفن 0353286545 جهت پشتیبانی تماس حاصل کنید. شماره تلفن 0353286545 جهت پشتیبانی تماس حاصل کنید.
</p> </p>
</div> </div>
)} )}
</AlertDialogDescription> </AlertDialogDescription>
@ -163,6 +172,7 @@ export default function FollowResult() {
> >
پرینت گزارش پرینت گزارش
</Button> </Button>
</AlertDialogFooter> </AlertDialogFooter>
</AlertDialogContent> </AlertDialogContent>
</AlertDialog> </AlertDialog>

View File

@ -84,14 +84,14 @@ export default function FollowUp() {
}); });
function onSubmit(data: z.infer<typeof FormSchema>) { function onSubmit(data: z.infer<typeof FormSchema>) {
toast({ // toast({
title: "You submitted the following values:", // title: "You submitted the following values:",
description: ( // description: (
<pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4 pt-12"> // <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4 pt-12">
<code className="text-white">{JSON.stringify(data, null, 2)}</code> // <code className="text-white">{JSON.stringify(data, null, 2)}</code>
</pre> // </pre>
), // ),
}); // });
console.log(data); console.log(data);

View File

@ -18,7 +18,7 @@ export default function Navbar() {
<div className={`max-md:hidden left-0 right-0 top-0 z-10 ${pathname === "/" ? "absolute" : "sticky"}`}> <div className={`max-md:hidden left-0 right-0 top-0 z-10 ${pathname === "/" ? "absolute" : "sticky"}`}>
<TopNav /> <TopNav />
<div className=" bg-white h-20 shadow-md flex items-center justify-between py-2 px-8"> <div className=" bg-white h-16 shadow-md flex items-center justify-between py-2 px-8">
<div className=" flex "> <div className=" flex ">
<div className=" flex items-center "> <div className=" flex items-center ">
<Image <Image
@ -39,7 +39,7 @@ export default function Navbar() {
if (array.length - 1 !== index){ if (array.length - 1 !== index){
return ( return (
<Link key={item.id} href={item.href}> <Link key={item.id} href={item.href}>
<div className=" text-sm">{item.name}</div> <div className=" text-sm font-bold">{item.name}</div>
</Link> </Link>
); );
}else{ }else{

View File

@ -22,11 +22,11 @@ export default function NavbarPanel() {
<div <div
className="fixed flex flex-col-reverse justify-between items-start gap-3 className="fixed flex flex-col-reverse justify-between items-start gap-3
sm:flex-row sm:items-center sm:gap-0 sm:flex-row sm:items-center sm:gap-0
w-full px-8 py-2 z-10 bg-blue max-md:px-4 w-full px-8 py-1 z-10 bg-blue max-md:px-4
" "
> >
<div className=" flex items-center gap-8 max-md:gap-4"> <div className=" flex items-center gap-8 max-md:gap-4">
<p className="text-white inline-block bg-clip-text text-lg font-bold max-md:text-base max-md:font-medium"> <p className="text-white inline-block bg-clip-text text-sm font-bold max-md:text-xs max-md:font-medium">
پنل کاربری | پنل کاربری |
</p> </p>
@ -38,7 +38,7 @@ export default function NavbarPanel() {
return ( return (
<Link key={item.id} href={item.href}> <Link key={item.id} href={item.href}>
<p <p
className="text-white font-normal text-sm max-md:text-xs className="text-white font-normal text-sm max-md:text-xs
hover:bg-white/50 rounded-sm p-1 hover:bg-white/50 rounded-sm p-1
animate-out duration-300 " animate-out duration-300 "
> >

View File

@ -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 (
<Button onClick={handlePrint}> Print </Button>
//the onClick function is built into React to look for a click event!
)
}

View File

@ -368,19 +368,6 @@ export default function RequestStep2() {
</div> </div>
{/* Captcha */} {/* Captcha */}
<div className="flex flex-row flex-wrap justify-between"> <div className="flex flex-row flex-wrap justify-between">
<div className="w-full sm:w-[48%] flex items-center justify-start">
{!isLoading && (
<Image
alt="icon"
src={srcForImage as string}
className="w-3/5 h-12 rounded-md shadow-md"
width={150}
height={20}
quality={100}
/>
)}
{/* <Image src={Img1} alt="1" width={50} height={50} /> */}
</div>
<FormField <FormField
control={form.control} control={form.control}
@ -400,6 +387,21 @@ export default function RequestStep2() {
</FormItem> </FormItem>
)} )}
/> />
<div className="w-full sm:w-[48%] flex items-center justify-start">
{!isLoading && (
<Image
alt="icon"
src={srcForImage as string}
className="w-3/5 h-12 rounded-md shadow-md"
width={150}
height={20}
quality={100}
/>
)}
{/* <Image src={Img1} alt="1" width={50} height={50} /> */}
</div>
</div> </div>
<div className="flex justify-center sm:justify-end gap-2 w-full mt-4"> <div className="flex justify-center sm:justify-end gap-2 w-full mt-4">

View File

@ -11,17 +11,17 @@ export default function TopNav() {
return ( return (
<div <div
className={`flex justify-between items-center w-full px-8 py-2 z-10 border-b-[#C9CFD7] border-b-[1px] border-solid max-md:bg-gray max-md:bg-transparent max-md:px-0 max-md:justify-end max-md:border-b-0 ${ className={`flex justify-between items-center w-full px-8 py-1 z-10 border-b-[#C9CFD7] border-b-[1px] border-solid max-md:bg-gray max-md:bg-transparent max-md:px-0 max-md:justify-end max-md:border-b-0 ${
pathname === "/" ? "bg-transparent" : "bg-white" pathname === "/" ? "bg-transparent" : "bg-white"
} `} } `}
> >
<h1 className="bg-gradient-to-r from-gradient1 to-gradient2 inline-block text-transparent bg-clip-text max-md:hidden"> <p className="bg-gradient-to-r from-gradient1 to-gradient2 inline-block text-transparent bg-clip-text text-xs max-md:hidden font-bold">
سال 1402 | مهارم تورم، رشد تولید سال 1402 | مهارم تورم، رشد تولید
</h1> </p>
{/* <p>Current pathname: {pathname}</p> */} {/* <p>Current pathname: {pathname}</p> */}
<div className="flex items-center gap-10"> <div className="flex items-center gap-10">
<div className=" flex items-center gap-3 md:ml-4"> <div className=" flex items-center gap-3 md:ml-4">
<p className="bg-gradient-to-r from-gradient1 to-gradient2 inline-block text-transparent bg-clip-text text-sm max-md:text-xs"> <p className="bg-gradient-to-r from-gradient1 to-gradient2 inline-block text-transparent bg-clip-text text-xs max-md:text-xs font-bold">
امروز: چهارشنبه 24 آبان 1402 امروز: چهارشنبه 24 آبان 1402
</p> </p>

View File

@ -13,7 +13,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
className={cn( 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 `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 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 hover:bg-slate-300 hover:cursor-pointer focus:cursor-auto
focus:outline-4 focus:outline-slate-300 focus:bg-slate-200 focus:outline-4 focus:outline-slate-300 focus:bg-slate-200

80
package-lock.json generated
View File

@ -45,6 +45,7 @@
"react-otp-input": "^3.1.1", "react-otp-input": "^3.1.1",
"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-use": "^17.4.2", "react-use": "^17.4.2",
"swiper": "^11.0.5", "swiper": "^11.0.5",
"tailwind-merge": "^2.1.0", "tailwind-merge": "^2.1.0",
@ -2217,6 +2218,21 @@
"hyphenate-style-name": "^1.0.3" "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": { "node_modules/css-tree": {
"version": "1.1.3", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.1.3.tgz", "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": { "node_modules/react-universal-interface": {
"version": "0.6.2", "version": "0.6.2",
"resolved": "https://registry.npmjs.org/react-universal-interface/-/react-universal-interface-0.6.2.tgz", "resolved": "https://registry.npmjs.org/react-universal-interface/-/react-universal-interface-0.6.2.tgz",
@ -7958,6 +7983,16 @@
"node": ">=6.9" "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": { "node_modules/shebang-command": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
@ -8164,6 +8199,51 @@
"url": "https://github.com/sponsors/sindresorhus" "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": { "node_modules/styled-jsx": {
"version": "5.1.1", "version": "5.1.1",
"resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz", "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz",

View File

@ -46,6 +46,7 @@
"react-otp-input": "^3.1.1", "react-otp-input": "^3.1.1",
"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-use": "^17.4.2", "react-use": "^17.4.2",
"swiper": "^11.0.5", "swiper": "^11.0.5",
"tailwind-merge": "^2.1.0", "tailwind-merge": "^2.1.0",

View File

@ -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"] "exclude": ["node_modules"]
} }