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