2019-06-19 14:40:52 +00:00
|
|
|
import Card from "@material-ui/core/Card";
|
|
|
|
import CardContent from "@material-ui/core/CardContent";
|
|
|
|
import {
|
|
|
|
createStyles,
|
|
|
|
Theme,
|
|
|
|
WithStyles,
|
|
|
|
withStyles
|
|
|
|
} from "@material-ui/core/styles";
|
|
|
|
import TextField from "@material-ui/core/TextField";
|
2019-08-09 10:26:22 +00:00
|
|
|
import React from "react";
|
2019-06-19 14:40:52 +00:00
|
|
|
|
|
|
|
import CardTitle from "@saleor/components/CardTitle";
|
|
|
|
import i18n from "../../../i18n";
|
|
|
|
import { FormData } from "../SaleDetailsPage";
|
|
|
|
|
|
|
|
export interface SaleInfoProps {
|
|
|
|
data: FormData;
|
|
|
|
disabled: boolean;
|
|
|
|
errors: {
|
|
|
|
name?: string;
|
|
|
|
};
|
|
|
|
onChange: (event: React.ChangeEvent<any>) => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
const styles = (theme: Theme) =>
|
|
|
|
createStyles({
|
|
|
|
root: {
|
|
|
|
display: "grid",
|
|
|
|
gridColumnGap: theme.spacing.unit * 2 + "px",
|
|
|
|
gridTemplateColumns: "3fr 1fr"
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
const SaleInfo = withStyles(styles, {
|
|
|
|
name: "SaleInfo"
|
|
|
|
})(
|
|
|
|
({
|
|
|
|
classes,
|
|
|
|
data,
|
|
|
|
disabled,
|
|
|
|
errors,
|
|
|
|
onChange
|
|
|
|
}: SaleInfoProps & WithStyles<typeof styles>) => (
|
|
|
|
<Card>
|
|
|
|
<CardTitle title={i18n.t("General Information")} />
|
|
|
|
<CardContent className={classes.root}>
|
|
|
|
<TextField
|
|
|
|
disabled={disabled}
|
|
|
|
error={!!errors.name}
|
|
|
|
helperText={errors.name}
|
|
|
|
name={"name" as keyof FormData}
|
|
|
|
onChange={onChange}
|
|
|
|
label={i18n.t("Name")}
|
|
|
|
value={data.name}
|
|
|
|
fullWidth
|
|
|
|
/>
|
|
|
|
</CardContent>
|
|
|
|
</Card>
|
|
|
|
)
|
|
|
|
);
|
|
|
|
SaleInfo.displayName = "SaleInfo";
|
|
|
|
export default SaleInfo;
|