-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathorder-coupons.jsx
More file actions
44 lines (35 loc) · 1006 Bytes
/
order-coupons.jsx
File metadata and controls
44 lines (35 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* @flow */
import React, { Component, Element } from 'react';
import _ from 'lodash';
import ContentBox from 'components/core/content-box';
import CouponsPanel from 'components/coupons-panel/coupons-panel';
import PanelHeader from 'components/panel-header/panel-header';
type Props = {
order: {
coupon: Object,
},
};
const columns = [
{ field: 'name', text: 'Name' },
{ field: 'storefrontName', text: 'Storefront Name' },
{ field: 'code', text: 'Code' },
];
export default class OrderCoupons extends Component {
props: Props;
get coupons(): Array<Object> {
const coupon = _.get(this.props, 'order.coupon');
if (!coupon) return [];
return [coupon];
}
render() {
const title = <PanelHeader showStatus={false} isOptional={true} text="Coupons" />;
const content = <CouponsPanel coupons={this.coupons} columns={columns} />;
return (
<ContentBox
title={title}
indentContent={false}
viewContent={content}
/>
);
}
}