feat: disount badges in all places

This commit is contained in:
skeris 2023-12-15 22:49:10 +03:00
parent 18fdb74230
commit c81f700a2c
5 changed files with 10 additions and 2 deletions

@ -278,6 +278,7 @@ function Drawers() {
pt: "38px", pt: "38px",
}} }}
> >
<Badge badgeContent={(cart.priceBeforeDiscounts - cart.priceAfterDiscounts)?`${(cart.priceBeforeDiscounts - cart.priceAfterDiscounts)/(cart.priceBeforeDiscounts/100)}`:null} color={'success'}>
<Box <Box
sx={{ sx={{
display: "flex", display: "flex",
@ -308,6 +309,7 @@ function Drawers() {
{currencyFormatter.format(cart.priceAfterDiscounts / 100)} {currencyFormatter.format(cart.priceAfterDiscounts / 100)}
</Typography> </Typography>
</Box> </Box>
</Badge>
<Button <Button
variant="pena-contained-dark" variant="pena-contained-dark"
onClick={() => onClick={() =>

@ -5,6 +5,7 @@ import {
Alert, Alert,
Box, Box,
Button, Button,
Badge,
Typography, Typography,
useMediaQuery, useMediaQuery,
useTheme, useTheme,
@ -97,6 +98,7 @@ export default function TotalPrice({
pl: upMd ? "33px" : undefined, pl: upMd ? "33px" : undefined,
}} }}
> >
<Badge badgeContent={(priceAfterDiscounts - priceBeforeDiscounts) ?`${((priceBeforeDiscounts-priceAfterDiscounts)/(priceBeforeDiscounts/100)).toFixed(0)}%`:null} color={'success'}>
<Box <Box
sx={{ sx={{
display: "flex", display: "flex",
@ -122,6 +124,7 @@ export default function TotalPrice({
{currencyFormatter.format(priceAfterDiscounts / 100)} {currencyFormatter.format(priceAfterDiscounts / 100)}
</Typography> </Typography>
</Box> </Box>
</Badge>
{notEnoughMoneyAmount > 0 && ( {notEnoughMoneyAmount > 0 && (
<Alert severity="error" variant="filled"> <Alert severity="error" variant="filled">
Нехватает {currencyFormatter.format(notEnoughMoneyAmount / 100)} Нехватает {currencyFormatter.format(notEnoughMoneyAmount / 100)}

@ -1,4 +1,4 @@
import { Box, IconButton, Typography, useMediaQuery, useTheme } from "@mui/material" import { Box, IconButton, Typography, Badge, useMediaQuery, useTheme } from "@mui/material"
import SectionWrapper from "@components/SectionWrapper" import SectionWrapper from "@components/SectionWrapper"
import ArrowBackIcon from "@mui/icons-material/ArrowBack" import ArrowBackIcon from "@mui/icons-material/ArrowBack"
import TotalPrice from "@components/TotalPrice" import TotalPrice from "@components/TotalPrice"

@ -2,6 +2,7 @@ import {
Box, Box,
Button, Button,
Divider, Divider,
Badge,
Typography, Typography,
useMediaQuery, useMediaQuery,
useTheme, useTheme,
@ -116,6 +117,7 @@ export default function CustomTariffCard({ serviceKey, privileges }: Props) {
<Typography mb="20px" mt="18px"> <Typography mb="20px" mt="18px">
Сумма с учетом скидки Сумма с учетом скидки
</Typography> </Typography>
<Badge color={"success"} badgeContent={`${((priceBeforeDiscounts - priceAfterDiscounts)/priceBeforeDiscounts*100).toFixed(0)}%`}>
<Box <Box
sx={{ sx={{
display: "flex", display: "flex",
@ -131,6 +133,7 @@ export default function CustomTariffCard({ serviceKey, privileges }: Props) {
{currencyFormatter.format(priceBeforeDiscounts / 100)} {currencyFormatter.format(priceBeforeDiscounts / 100)}
</Typography> </Typography>
</Box> </Box>
</Badge>
<Button <Button
disabled={!priceBeforeDiscounts} disabled={!priceBeforeDiscounts}
variant="pena-contained-dark" variant="pena-contained-dark"

@ -102,7 +102,7 @@ function TariffPage() {
return ( return (
<TariffCard <TariffCard
key={tariff._id} key={tariff._id}
discount={`${(priceBeforeDiscounts-priceAfterDiscounts)/(priceBeforeDiscounts/100)}%`} discount={`${((priceBeforeDiscounts-priceAfterDiscounts)/(priceBeforeDiscounts/100)).toFixed(0)}%`}
icon={ icon={
<NumberIcon <NumberIcon
number={index + 1} number={index + 1}