2024-09-24 17:35:35 -05:00
|
|
|
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
|
|
|
|
import PersonIcon from "@mui/icons-material/Person";
|
|
|
|
|
import { Card, CardContent, IconButton, Typography } from "@mui/material";
|
|
|
|
|
import Grid from "@mui/material/Grid2";
|
|
|
|
|
import React, { useEffect, useState } from "react";
|
|
|
|
|
import { useTranslation } from "react-i18next";
|
2024-09-19 19:22:43 -05:00
|
|
|
|
|
|
|
|
interface HeaderProps {
|
2024-09-24 17:35:35 -05:00
|
|
|
sx?: object;
|
|
|
|
|
onToggleButtonPanel: () => void;
|
2024-09-19 19:22:43 -05:00
|
|
|
}
|
|
|
|
|
|
2024-09-24 17:35:35 -05:00
|
|
|
const Header: React.FC<HeaderProps> = ({ sx, onToggleButtonPanel }) => {
|
|
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
|
|
|
|
const [currentDateTime, setCurrentDateTime] = useState(new Date());
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const interval = setInterval(() => {
|
|
|
|
|
setCurrentDateTime(new Date());
|
|
|
|
|
}, 60000);
|
|
|
|
|
|
|
|
|
|
return () => clearInterval(interval);
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
const formattedDate = currentDateTime.toLocaleDateString(undefined, {
|
|
|
|
|
weekday: "short",
|
|
|
|
|
day: "numeric",
|
|
|
|
|
month: "short",
|
|
|
|
|
});
|
|
|
|
|
const formattedTime = currentDateTime.toLocaleTimeString(undefined, {
|
|
|
|
|
hour: "2-digit",
|
|
|
|
|
minute: "2-digit",
|
|
|
|
|
});
|
|
|
|
|
|
2024-09-19 19:22:43 -05:00
|
|
|
return (
|
2024-09-24 17:35:35 -05:00
|
|
|
<Card sx={{ ...sx, p: 0 }}>
|
|
|
|
|
<CardContent sx={{ padding: "1px 8px" }}>
|
2024-09-19 19:22:43 -05:00
|
|
|
<Grid container alignItems="center" justifyContent="space-between">
|
|
|
|
|
<Grid>
|
2024-09-24 17:35:35 -05:00
|
|
|
<Typography variant="body2" color="text.primary" sx={{ fontWeight: "bold" }}>
|
|
|
|
|
Generic user
|
2024-09-19 19:22:43 -05:00
|
|
|
</Typography>
|
|
|
|
|
<Typography variant="body2" color="text.secondary">
|
2024-09-24 17:35:35 -05:00
|
|
|
Add Member
|
2024-09-19 19:22:43 -05:00
|
|
|
</Typography>
|
|
|
|
|
</Grid>
|
2024-09-24 17:35:35 -05:00
|
|
|
|
2024-09-19 19:22:43 -05:00
|
|
|
<Grid>
|
|
|
|
|
<Typography variant="body2" color="text.secondary">
|
2024-09-24 17:35:35 -05:00
|
|
|
{formattedDate} - {formattedTime}
|
2024-09-19 19:22:43 -05:00
|
|
|
</Typography>
|
|
|
|
|
</Grid>
|
2024-09-24 17:35:35 -05:00
|
|
|
|
2024-09-19 19:22:43 -05:00
|
|
|
<Grid>
|
|
|
|
|
<Typography variant="body2" color="text.secondary">
|
2024-09-24 17:35:35 -05:00
|
|
|
{t("lbl_Store")}: <strong>8004</strong> | {t("lbl_register")}: <strong>317</strong>
|
2024-09-19 19:22:43 -05:00
|
|
|
</Typography>
|
|
|
|
|
</Grid>
|
2024-09-24 17:35:35 -05:00
|
|
|
|
|
|
|
|
<Grid>
|
|
|
|
|
<Grid container alignItems="center">
|
|
|
|
|
<PersonIcon sx={{ color: "text.secondary", fontSize: "18px", mr: 0.5 }} />
|
|
|
|
|
<Typography variant="body2" color="text.secondary">
|
|
|
|
|
{t("lbl_associate")} <strong>2</strong>
|
|
|
|
|
</Typography>
|
|
|
|
|
</Grid>
|
2024-09-19 19:22:43 -05:00
|
|
|
</Grid>
|
2024-09-24 17:35:35 -05:00
|
|
|
|
2024-09-19 19:22:43 -05:00
|
|
|
<Grid>
|
2024-09-24 17:35:35 -05:00
|
|
|
<IconButton size="small" onClick={onToggleButtonPanel}>
|
2024-09-19 19:22:43 -05:00
|
|
|
<MoreVertIcon color="action" sx={{ fontSize: "18px" }} />
|
|
|
|
|
</IconButton>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
2024-09-24 17:35:35 -05:00
|
|
|
);
|
|
|
|
|
};
|
2024-09-19 19:22:43 -05:00
|
|
|
|
2024-09-24 17:35:35 -05:00
|
|
|
export default Header;
|