saleor-dashboard/src/orders/components/OrderListPage/OrderListPage.tsx

81 lines
2.3 KiB
TypeScript
Raw Normal View History

2019-06-19 14:40:52 +00:00
import Button from "@material-ui/core/Button";
import Card from "@material-ui/core/Card";
2019-09-10 12:11:47 +00:00
2019-08-09 10:26:22 +00:00
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
2019-06-19 14:40:52 +00:00
import Container from "@saleor/components/Container";
import PageHeader from "@saleor/components/PageHeader";
import { sectionNames } from "@saleor/intl";
import { OrderFilterKeys } from "@saleor/orders/components/OrderListFilter";
2019-06-19 14:40:52 +00:00
import { FilterPageProps, ListActions, PageListProps } from "@saleor/types";
import { OrderList_orders_edges_node } from "../../types/OrderList";
import OrderList from "../OrderList";
import OrderListFilter from "../OrderListFilter";
export interface OrderListPageProps
extends PageListProps,
ListActions,
2019-09-10 15:14:11 +00:00
FilterPageProps {
2019-06-19 14:40:52 +00:00
orders: OrderList_orders_edges_node[];
}
const OrderListPage: React.FC<OrderListPageProps> = ({
currencySymbol,
currentTab,
filtersList,
initialSearch,
2019-09-10 15:14:11 +00:00
tabs,
2019-06-19 14:40:52 +00:00
onAdd,
onAll,
onSearchChange,
onFilterAdd,
onTabChange,
2019-09-10 15:39:33 +00:00
onTabDelete,
onTabSave,
2019-06-19 14:40:52 +00:00
...listProps
}) => {
const intl = useIntl();
return (
<Container>
<PageHeader title={intl.formatMessage(sectionNames.orders)}>
<Button color="primary" variant="contained" onClick={onAdd}>
<FormattedMessage
defaultMessage="Create order"
description="button"
/>
</Button>
</PageHeader>
<Card>
<OrderListFilter
allTabLabel={intl.formatMessage({
defaultMessage: "All Orders",
description: "tab name"
})}
currencySymbol={currencySymbol}
currentTab={currentTab}
filterLabel={intl.formatMessage({
defaultMessage: "Select all orders where:"
})}
2019-09-10 15:39:33 +00:00
tabs={tabs}
filtersList={filtersList}
initialSearch={initialSearch}
searchPlaceholder={intl.formatMessage({
defaultMessage: "Search Orders..."
})}
onAll={onAll}
onSearchChange={onSearchChange}
onFilterAdd={onFilterAdd}
onTabChange={onTabChange}
2019-09-10 15:39:33 +00:00
onTabDelete={onTabDelete}
onTabSave={onTabSave}
/>
<OrderList {...listProps} />
</Card>
</Container>
);
};
2019-06-19 14:40:52 +00:00
OrderListPage.displayName = "OrderListPage";
export default OrderListPage;