feat: StatisticsModal privilege
This commit is contained in:
parent
2a12526a13
commit
cf169c0d58
@ -312,16 +312,13 @@ export const CreatePromocodeForm = ({ createPromocode }: Props) => {
|
||||
name="privilegeId"
|
||||
as={Select}
|
||||
label="Привилегия"
|
||||
|
||||
onChange={({ target }: SelectChangeProps) => {
|
||||
const currentPrivilege = privileges.find(
|
||||
(item) => item.privilegeId === target.value
|
||||
);
|
||||
|
||||
setFieldValue("serviceKey", currentPrivilege?.serviceKey);
|
||||
setFieldValue("privilegeId", currentPrivilege?.privilegeId);
|
||||
|
||||
const currentPrivilege = privileges.find(
|
||||
(item) => item.privilegeId === target.value
|
||||
);
|
||||
|
||||
setFieldValue("serviceKey", currentPrivilege?.serviceKey);
|
||||
setFieldValue("privilegeId", currentPrivilege?.privilegeId);
|
||||
}}
|
||||
sx={{
|
||||
width: "100%",
|
||||
|
@ -12,6 +12,7 @@ import {
|
||||
import { DataGrid, GridLoadingOverlay, GridToolbar } from "@mui/x-data-grid";
|
||||
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
|
||||
|
||||
import { usePrivilegeStore } from "@root/stores/privilegesStore";
|
||||
import { fadeIn } from "@root/utils/style/keyframes";
|
||||
|
||||
import ContentCopyIcon from "@mui/icons-material/ContentCopy";
|
||||
@ -50,7 +51,13 @@ const COLUMNS: GridColDef<Row, string>[] = [
|
||||
renderCell: (params) => {
|
||||
return (
|
||||
<IconButton
|
||||
onClick={() => navigator.clipboard.writeText(`https://${isTest ? "s" : ""}hub.pena.digital/?fl=${params.row.link}`)}
|
||||
onClick={() =>
|
||||
navigator.clipboard.writeText(
|
||||
`https://${isTest ? "s" : ""}hub.pena.digital/?fl=${
|
||||
params.row.link
|
||||
}`
|
||||
)
|
||||
}
|
||||
>
|
||||
<ContentCopyIcon />
|
||||
</IconButton>
|
||||
@ -98,6 +105,13 @@ export const StatisticsModal = ({
|
||||
const theme = useTheme();
|
||||
const isMobile = useMediaQuery(theme.breakpoints.down(550));
|
||||
const [rows, setRows] = useState<Row[]>([]);
|
||||
const { privileges } = usePrivilegeStore();
|
||||
const currentPrivilegeId = promocodes.find((promocode) => promocode.id === id)
|
||||
?.bonus.privilege.privilegeID;
|
||||
const privilegeName =
|
||||
privileges.find((item) => item.privilegeId === currentPrivilegeId)?.name ??
|
||||
"Нет привилегии";
|
||||
|
||||
const createFastlink = async () => {
|
||||
await createFastLink(id);
|
||||
|
||||
@ -142,7 +156,9 @@ export const StatisticsModal = ({
|
||||
setStartDate(new Date());
|
||||
setEndDate(new Date());
|
||||
}}
|
||||
sx={{ "& > .MuiBox-root": { outline: "none" } }}
|
||||
sx={{
|
||||
"& > .MuiBox-root": { outline: "none", padding: "32px 32px 16px" },
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
@ -282,6 +298,15 @@ export const StatisticsModal = ({
|
||||
rowsPerPageOptions={[10, 25, 50, 100]}
|
||||
autoHeight
|
||||
/>
|
||||
<Typography
|
||||
sx={{
|
||||
margin: "10px 0 0",
|
||||
textAlign: "center",
|
||||
color: theme.palette.secondary.main,
|
||||
}}
|
||||
>
|
||||
{privilegeName}
|
||||
</Typography>
|
||||
</Box>
|
||||
</Modal>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user