65 lines
1.6 KiB
TypeScript
65 lines
1.6 KiB
TypeScript
"use client";
|
||
import React, { useEffect } from "react";
|
||
// import { convertDate } from "@/lib/utils";
|
||
import dayjs from "dayjs";
|
||
|
||
interface PrintPageProps {
|
||
contentRef: React.RefObject<any>;
|
||
fetchedContent: string;
|
||
trackingNumber: string;
|
||
password: string;
|
||
}
|
||
|
||
// Convert Date
|
||
function convertDate(date: string) {
|
||
const convertedDate = dayjs(date)
|
||
.calendar("jalali")
|
||
.locale("fa")
|
||
.format("YYYY/M/DD");
|
||
return convertedDate;
|
||
}
|
||
// const registeredAt = localStorage.getItem("registeredAt");
|
||
// const convertedDate = registeredAt ? convertDate(registeredAt) : "Invalid Date";
|
||
|
||
|
||
const currentDate = new Date();
|
||
const formattedDate = currentDate.toISOString();
|
||
const convertedDate = convertDate(formattedDate);
|
||
|
||
const PrintPage: React.FC<PrintPageProps> = ({
|
||
contentRef,
|
||
fetchedContent,
|
||
trackingNumber,
|
||
password,
|
||
}) => {
|
||
return (
|
||
<div
|
||
ref={contentRef}
|
||
className="w-screen h-screen border-2 border-spacing-6 p-36 bg-slate-200 bg-[url('/img/bg-print.jpg')] bg-no-repeat bg-bottom bg-cover font-[yekan]"
|
||
dir="rtl"
|
||
>
|
||
<div className="flex flex-col absolute top-7 left-28 text-xs gap-1">
|
||
<p>سامانه نظارت شهرداری یزد</p>
|
||
<p>
|
||
تاریخ: <span>{convertedDate}</span>
|
||
</p>
|
||
</div>
|
||
|
||
<div
|
||
dangerouslySetInnerHTML={{ __html: fetchedContent }}
|
||
className=" mt-16 text-justify"
|
||
/>
|
||
|
||
<p>
|
||
کد پیگیری : <span>{trackingNumber}</span>
|
||
</p>
|
||
|
||
<p>
|
||
رمز عبور : <span>{password}</span>
|
||
</p>
|
||
</div>
|
||
);
|
||
};
|
||
|
||
export default PrintPage;
|