2019-06-19 14:40:52 +00:00
|
|
|
import Button from "@material-ui/core/Button";
|
|
|
|
import AddIcon from "@material-ui/icons/Add";
|
2019-08-09 10:26:22 +00:00
|
|
|
import React from "react";
|
2019-06-19 14:40:52 +00:00
|
|
|
|
|
|
|
import Container from "@saleor/components/Container";
|
|
|
|
import PageHeader from "@saleor/components/PageHeader";
|
2019-08-09 11:14:35 +00:00
|
|
|
import i18n from "@saleor/i18n";
|
|
|
|
import { ListActions, PageListProps } from "@saleor/types";
|
2019-06-19 14:40:52 +00:00
|
|
|
import { VoucherList_vouchers_edges_node } from "../../types/VoucherList";
|
|
|
|
import VoucherList from "../VoucherList";
|
|
|
|
|
|
|
|
export interface VoucherListPageProps extends PageListProps, ListActions {
|
|
|
|
defaultCurrency: string;
|
|
|
|
vouchers: VoucherList_vouchers_edges_node[];
|
|
|
|
}
|
|
|
|
|
|
|
|
const VoucherListPage: React.StatelessComponent<VoucherListPageProps> = ({
|
|
|
|
defaultCurrency,
|
|
|
|
disabled,
|
2019-08-09 11:14:35 +00:00
|
|
|
settings,
|
2019-06-19 14:40:52 +00:00
|
|
|
onAdd,
|
|
|
|
onNextPage,
|
|
|
|
onPreviousPage,
|
2019-08-09 11:14:35 +00:00
|
|
|
onUpdateListSettings,
|
2019-06-19 14:40:52 +00:00
|
|
|
onRowClick,
|
|
|
|
pageInfo,
|
|
|
|
vouchers,
|
|
|
|
isChecked,
|
|
|
|
selected,
|
|
|
|
toggle,
|
|
|
|
toggleAll,
|
|
|
|
toolbar
|
|
|
|
}) => (
|
|
|
|
<Container>
|
|
|
|
<PageHeader title={i18n.t("Vouchers")}>
|
|
|
|
<Button onClick={onAdd} variant="contained" color="primary">
|
|
|
|
{i18n.t("Add voucher")}
|
|
|
|
<AddIcon />
|
|
|
|
</Button>
|
|
|
|
</PageHeader>
|
|
|
|
<VoucherList
|
|
|
|
defaultCurrency={defaultCurrency}
|
2019-08-09 11:14:35 +00:00
|
|
|
settings={settings}
|
2019-06-19 14:40:52 +00:00
|
|
|
disabled={disabled}
|
|
|
|
onNextPage={onNextPage}
|
|
|
|
onPreviousPage={onPreviousPage}
|
2019-08-09 11:14:35 +00:00
|
|
|
onUpdateListSettings={onUpdateListSettings}
|
2019-06-19 14:40:52 +00:00
|
|
|
onRowClick={onRowClick}
|
|
|
|
pageInfo={pageInfo}
|
|
|
|
vouchers={vouchers}
|
|
|
|
isChecked={isChecked}
|
|
|
|
selected={selected}
|
|
|
|
toggle={toggle}
|
|
|
|
toggleAll={toggleAll}
|
|
|
|
toolbar={toolbar}
|
|
|
|
/>
|
|
|
|
</Container>
|
|
|
|
);
|
|
|
|
VoucherListPage.displayName = "VoucherListPage";
|
|
|
|
export default VoucherListPage;
|