import Button from "@material-ui/core/Button"; import Card from "@material-ui/core/Card"; import CardActions from "@material-ui/core/CardActions"; import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles"; import Table from "@material-ui/core/Table"; import TableBody from "@material-ui/core/TableBody"; import TableCell from "@material-ui/core/TableCell"; import TableHead from "@material-ui/core/TableHead"; import TableRow from "@material-ui/core/TableRow"; import React from "react"; import { FormattedMessage, useIntl } from "react-intl"; import CardTitle from "@saleor/components/CardTitle"; import Money from "@saleor/components/Money"; import Skeleton from "@saleor/components/Skeleton"; import StatusLabel from "@saleor/components/StatusLabel"; import TableCellAvatar, { AVATAR_MARGIN } from "@saleor/components/TableCellAvatar"; import { maybe } from "../../../misc"; import { OrderDetails_order_lines } from "../../types/OrderDetails"; const styles = createStyles({ clickableRow: { cursor: "pointer" }, colName: { paddingLeft: 0, width: "auto" }, colNameLabel: { marginLeft: AVATAR_MARGIN }, colPrice: { textAlign: "right", width: 120 }, colQuantity: { textAlign: "center", width: 120 }, colTotal: { textAlign: "right", width: 120 }, statusBar: { paddingTop: 0 }, table: { tableLayout: "fixed" } }); interface OrderUnfulfilledItemsProps extends WithStyles { canFulfill: boolean; lines: OrderDetails_order_lines[]; onFulfill: () => void; } const OrderUnfulfilledItems = withStyles(styles, { name: "OrderUnfulfilledItems" })(({ canFulfill, classes, lines, onFulfill }: OrderUnfulfilledItemsProps) => { const intl = useIntl(); return ( line.quantity - line.quantityFulfilled) .reduce((prev, curr) => prev + curr, 0) } )} status="error" /> } /> {lines.map(line => ( line.id)} > line.thumbnail.url)} > {maybe(() => line.productName) || } {maybe(() => line.quantity - line.quantityFulfilled) || ( )} {maybe(() => line.unitPrice.gross) ? ( ) : ( )} {maybe( () => (line.quantity - line.quantityFulfilled) * line.unitPrice.gross.amount ) ? ( ) : ( )} ))}
{canFulfill && ( )}
); }); OrderUnfulfilledItems.displayName = "OrderUnfulfilledItems"; export default OrderUnfulfilledItems;