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

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

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

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