add total field

This commit is contained in:
nflnkr 2023-03-07 20:43:44 +03:00
parent d17ce53427
commit 383725b641

@ -14,6 +14,7 @@ const columns: GridColDef[] = [
{ field: 'type', headerName: 'Единица', width: 100 }, { field: 'type', headerName: 'Единица', width: 100 },
{ field: 'pricePerUnit', headerName: 'Цена за ед.', width: 100 }, { field: 'pricePerUnit', headerName: 'Цена за ед.', width: 100 },
{ field: 'isCustomPrice', headerName: 'Кастомная цена', width: 130 }, { field: 'isCustomPrice', headerName: 'Кастомная цена', width: 130 },
{ field: 'total', headerName: 'Сумма', width: 130 },
]; ];
interface Props { interface Props {
@ -32,6 +33,7 @@ export default function TariffsDG({ handleSelectionChange }: Props) {
type: tariff.privilege.type === "count" ? "день" : "шт.", type: tariff.privilege.type === "count" ? "день" : "шт.",
pricePerUnit: tariff.customPricePerUnit ?? tariff.privilege.pricePerUnit, pricePerUnit: tariff.customPricePerUnit ?? tariff.privilege.pricePerUnit,
isCustomPrice: tariff.customPricePerUnit === undefined ? "Нет" : "Да", isCustomPrice: tariff.customPricePerUnit === undefined ? "Нет" : "Да",
total: tariff.amount * (tariff.customPricePerUnit ?? tariff.privilege.pricePerUnit),
})); }));
return ( return (