fl more info

This commit is contained in:
Nastya 2024-04-13 02:42:30 +03:00
parent cf169c0d58
commit 541dc1610e
2 changed files with 37 additions and 15 deletions

@ -30,6 +30,8 @@ export type GetPromocodeListBody = {
export type Promocode = CreatePromocodeBody & {
id: string;
dueTo: number;
activationLimit: number;
outdated: boolean;
offLimit: boolean;
delete: boolean;

@ -53,8 +53,7 @@ const COLUMNS: GridColDef<Row, string>[] = [
<IconButton
onClick={() =>
navigator.clipboard.writeText(
`https://${isTest ? "s" : ""}hub.pena.digital/?fl=${
params.row.link
`https://${isTest ? "s" : ""}hub.pena.digital/?fl=${params.row.link
}`
)
}
@ -108,10 +107,11 @@ export const StatisticsModal = ({
const { privileges } = usePrivilegeStore();
const currentPrivilegeId = promocodes.find((promocode) => promocode.id === id)
?.bonus.privilege.privilegeID;
const privilegeName =
privileges.find((item) => item.privilegeId === currentPrivilegeId)?.name ??
"Нет привилегии";
const privilege =
privileges.find((item) => item.privilegeId === currentPrivilegeId);
const promocode =
promocodes.find((item) => item.id === id);
console.log(promocode)
const createFastlink = async () => {
await createFastLink(id);
@ -298,15 +298,35 @@ export const StatisticsModal = ({
rowsPerPageOptions={[10, 25, 50, 100]}
autoHeight
/>
<Typography
sx={{
margin: "10px 0 0",
textAlign: "center",
color: theme.palette.secondary.main,
}}
>
{privilegeName}
</Typography>
{
privilege === undefined ?
<Typography
sx={{
margin: "10px 0 0",
textAlign: "center",
color: theme.palette.secondary.main,
}}
>
Нет привилегии
</Typography>
:
<Box
sx={{
color: "#e6e8ec",
display: "flex",
flexDirection: "column",
margin: "20px 0",
}}
>
<Typography>название привилегии: {privilege.name}</Typography>
<Typography>{promocode?.activationCount} активаций из {promocode?.activationLimit}</Typography>
<Typography>приветствие: "{promocode?.greetings}"</Typography>
{promocode?.bonus?.discount?.factor !== undefined && <Typography>скидка: {100 - (promocode?.bonus?.discount?.factor * 100)}%</Typography>}
{<Typography>количество привилегии: {promocode?.bonus?.privilege?.amount}</Typography>}
{promocode?.dueTo !== undefined && promocode.dueTo > 0 && <Typography>действует до: {new Date(promocode.dueTo).toLocaleString()}</Typography>}
</Box>
}
</Box>
</Modal>
);