day
parent
e4b91a557f
commit
564ab216c7
|
@ -15,6 +15,7 @@ import { Doughnut, Pie } from "react-chartjs-2";
|
||||||
import BottomSheetChangeRole from "plugins/BottomSheet/BottomSheetChangeRole";
|
import BottomSheetChangeRole from "plugins/BottomSheet/BottomSheetChangeRole";
|
||||||
import HasPermission from "plugins/HasPermission/page";
|
import HasPermission from "plugins/HasPermission/page";
|
||||||
import Avatar from "boring-avatars";
|
import Avatar from "boring-avatars";
|
||||||
|
import moment from "jalali-moment";
|
||||||
|
|
||||||
ChartJS.register(ArcElement, Tooltip, Legend);
|
ChartJS.register(ArcElement, Tooltip, Legend);
|
||||||
|
|
||||||
|
@ -25,16 +26,6 @@ const Home = (props) => {
|
||||||
|
|
||||||
const profile = CTX.state.profile;
|
const profile = CTX.state.profile;
|
||||||
|
|
||||||
// useEffect(() => {
|
|
||||||
// if (!HasPermission("ViewDashboard")) {
|
|
||||||
// // You can customize the redirect path as needed
|
|
||||||
// router.replace("/activity");
|
|
||||||
// return null; // Prevent rendering the rest of the component
|
|
||||||
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }, [profile]);
|
|
||||||
|
|
||||||
console.log(profile);
|
console.log(profile);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -81,12 +72,25 @@ const Home = (props) => {
|
||||||
CTX.setBottomSheetReportOpen(true);
|
CTX.setBottomSheetReportOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(
|
const formatJalaliDate = (date) => {
|
||||||
new Intl.DateTimeFormat("fa-IR-u-nu-latn", {
|
const jalaliDateDay = moment(date).locale("fa").format("jD");
|
||||||
dateStyle: "full",
|
const jalaliDateYear = moment(date).locale("fa").format("jYYYY");
|
||||||
timeStyle: "long",
|
|
||||||
}).format(new Date())
|
// Extract day name
|
||||||
);
|
const dayName = moment(date).locale("fa").format("dddd");
|
||||||
|
|
||||||
|
// Map English day names to Persian
|
||||||
|
|
||||||
|
// Get the Persian day name
|
||||||
|
|
||||||
|
// Extract month name
|
||||||
|
const monthName = moment(date).locale("fa").format("jMMMM");
|
||||||
|
|
||||||
|
return `${dayName} ${jalaliDateDay} ${monthName} ${jalaliDateYear}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const today = new Date();
|
||||||
|
const formattedDate = formatJalaliDate(today);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="pb-20">
|
<div className="pb-20">
|
||||||
|
@ -144,7 +148,9 @@ const Home = (props) => {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="mt-5">
|
<div className="mt-5">
|
||||||
<h3 className="text-right p-3 font-medium">شنبه 20 فروردین 1403</h3>
|
<h3 className="text-right p-3 text-sm font-bold">
|
||||||
|
<PersianNumber number={formattedDate} />
|
||||||
|
</h3>
|
||||||
<div className="grid xs:grid-cols-2 gap-4 rtl">
|
<div className="grid xs:grid-cols-2 gap-4 rtl">
|
||||||
<div>
|
<div>
|
||||||
<div className="bg-dahs-chart rounded-2xl p-2 h-[195px]">
|
<div className="bg-dahs-chart rounded-2xl p-2 h-[195px]">
|
||||||
|
|
Loading…
Reference in New Issue