import React from "react"; import DeleteOutlineOutlinedIcon from "@mui/icons-material/DeleteOutlineOutlined"; import { IconButton, InputAdornment, TableRow, TextField } from "@mui/material"; import { TableCell } from "../../../components/Table/TableCell"; import { useI18n } from "../../../contexts/I18nContext"; import { Price } from "../types/contrib"; export interface PriceRowProps { price: Price; isEditing: boolean; isDisabled: boolean; onChangeAmount: (amount: string) => void; onChangeArticleCode?: (amount: string) => void; onDelete: () => void; } export const PriceRow: React.FC = ({ price, isEditing, isDisabled, onChangeAmount, onChangeArticleCode, onDelete, }) => { const { t } = useI18n(); return ( {isEditing && onChangeArticleCode ? ( onChangeArticleCode(event.target.value)} /> ) : ( price.article_code )} {isEditing ? ( {price.currency}, placeholder: t("Article Number"), }} size="small" sx={{ ".MuiInputBase-input": { textAlign: "right" } }} value={price.amount} onChange={(event) => onChangeAmount?.(event.target.value)} /> ) : ( <> {price.amount} {price.currency && ` ${price.currency}`} )} {isEditing && ( onDelete?.()}> )} ); };