diff --git a/src/model/promocodes.ts b/src/model/promocodes.ts index e51ddd5..d3805f6 100644 --- a/src/model/promocodes.ts +++ b/src/model/promocodes.ts @@ -30,6 +30,8 @@ export type GetPromocodeListBody = { export type Promocode = CreatePromocodeBody & { id: string; + dueTo: number; + activationLimit: number; outdated: boolean; offLimit: boolean; delete: boolean; diff --git a/src/pages/dashboard/Content/PromocodeManagement/StatisticsModal.tsx b/src/pages/dashboard/Content/PromocodeManagement/StatisticsModal.tsx index 3484002..9dec31f 100644 --- a/src/pages/dashboard/Content/PromocodeManagement/StatisticsModal.tsx +++ b/src/pages/dashboard/Content/PromocodeManagement/StatisticsModal.tsx @@ -53,8 +53,7 @@ const COLUMNS: GridColDef[] = [ 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 /> - - {privilegeName} - + { + privilege === undefined ? + + + Нет привилегии + + : + + название привилегии: {privilege.name} + {promocode?.activationCount} активаций из {promocode?.activationLimit} + приветствие: "{promocode?.greetings}" + {promocode?.bonus?.discount?.factor !== undefined && скидка: {100 - (promocode?.bonus?.discount?.factor * 100)}%} + {количество привилегии: {promocode?.bonus?.privilege?.amount}} + {promocode?.dueTo !== undefined && promocode.dueTo > 0 && действует до: {new Date(promocode.dueTo).toLocaleString()}} + + } );