2020-04-20 09:37:32 +00:00
|
|
|
import { storiesOf } from "@storybook/react";
|
|
|
|
import React from "react";
|
|
|
|
|
|
|
|
import Decorator from "@saleor/storybook/Decorator";
|
|
|
|
import { warehouseList } from "@saleor/warehouses/fixtures";
|
2020-04-28 01:09:31 +00:00
|
|
|
import { OrderErrorCode } from "@saleor/types/globalTypes";
|
2020-04-20 09:37:32 +00:00
|
|
|
import OrderFulfillPage, { OrderFulfillPageProps } from "./OrderFulfillPage";
|
|
|
|
import { orderToFulfill } from "./fixtures";
|
|
|
|
|
|
|
|
const props: OrderFulfillPageProps = {
|
|
|
|
disabled: false,
|
2020-04-28 01:09:31 +00:00
|
|
|
errors: [],
|
2020-04-20 09:37:32 +00:00
|
|
|
onBack: () => undefined,
|
|
|
|
onSubmit: () => undefined,
|
|
|
|
order: orderToFulfill,
|
|
|
|
saveButtonBar: "default",
|
|
|
|
warehouses: warehouseList
|
|
|
|
};
|
|
|
|
|
|
|
|
storiesOf("Views / Orders / Fulfill order", module)
|
|
|
|
.addDecorator(Decorator)
|
|
|
|
.add("default", () => <OrderFulfillPage {...props} />)
|
|
|
|
.add("loading", () => (
|
|
|
|
<OrderFulfillPage
|
|
|
|
{...props}
|
|
|
|
disabled={true}
|
|
|
|
order={undefined}
|
|
|
|
warehouses={undefined}
|
|
|
|
/>
|
2020-04-28 01:09:31 +00:00
|
|
|
))
|
|
|
|
.add("error", () => (
|
|
|
|
<OrderFulfillPage
|
|
|
|
{...props}
|
|
|
|
errors={[
|
|
|
|
{
|
|
|
|
__typename: "OrderError",
|
|
|
|
code: OrderErrorCode.INSUFFICIENT_STOCK,
|
|
|
|
field: null,
|
|
|
|
orderLine: orderToFulfill.lines[0].id,
|
|
|
|
warehouse: warehouseList[0].id
|
|
|
|
}
|
|
|
|
]}
|
|
|
|
/>
|
2020-04-29 14:14:20 +00:00
|
|
|
))
|
|
|
|
.add("one warehouse", () => (
|
|
|
|
<OrderFulfillPage {...props} warehouses={warehouseList.slice(0, 1)} />
|
2020-04-20 09:37:32 +00:00
|
|
|
));
|