-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrma.jsx
More file actions
117 lines (102 loc) · 3.05 KB
/
rma.jsx
File metadata and controls
117 lines (102 loc) · 3.05 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { IndexLink, Link } from 'components/link';
import Notes from '../notes/notes';
import { PageTitle } from '../section-title';
import { PrimaryButton } from 'components/core/button';
import PageNav from 'components/core/page-nav';
import { PanelList, PanelListItem } from '../panel/panel-list';
import ContentBox from 'components/core/content-box';
import State from '../common/state';
import * as rmaActions from '../../modules/rmas/details';
@connect((state, props) => ({
rma: state.rmas.details
}), rmaActions)
export default class Rma extends React.Component {
static propTypes = {
params: PropTypes.shape({
rma: PropTypes.string.isRequired
}).isRequired,
rma: PropTypes.shape({
currentRma: PropTypes.object
}),
children: PropTypes.node,
fetchRma: PropTypes.func.isRequired
};
get rma() {
return this.props.rma.currentRma;
}
componentDidMount() {
let { rma } = this.props.params;
this.props.fetchRma(rma);
}
get notes() {
if (!this.rma.entityId) return null;
return (
<div className="fc-grid fc-grid-gutter">
<div className="fc-col-md-1-1">
<Notes entity={this.rma} />
</div>
</div>
);
}
get subNav() {
const rma = this.rma;
if (rma.id) {
const params = { rma: rma && rma.referenceNumber || '' };
const content = React.cloneElement(this.props.children, { ...this.props, entity: rma });
return (
<div>
<PageNav gutter={true}>
<IndexLink to="rma-details" params={params}>Details</IndexLink>
<Link to="rma-notifications" params={params}>Transaction Notifications</Link>
<Link to="rma-activity-trail" params={params}>Activity Trail</Link>
</PageNav>
{content}
</div>
);
}
}
get itemsCount() {
return this.rma.lineItems.skus.length;
}
get orderSubtitle() {
return `for order ${this.rma.orderRefNum}`;
}
render() {
const rma = this.rma;
if (!rma.id) {
return null;
}
return (
<div>
<PageTitle title={`Return ${rma.referenceNumber}`} subtitle={this.orderSubtitle}>
<PrimaryButton onClick={this.cancelReturn}>Cancel Return</PrimaryButton>
</PageTitle>
<div className="fc-grid fc-grid-match">
<div className="fc-col-md-3-4">
<PanelList>
<PanelListItem title="Return State">
<State value={this.rma.state} model="rma" />
</PanelListItem>
<PanelListItem title="Return Type">
{rma.rmaType}
</PanelListItem>
<PanelListItem title="Items">
0
</PanelListItem>
</PanelList>
</div>
<div className="fc-col-md-1-4">
<ContentBox title="Assignees">
<div>1</div>
</ContentBox>
</div>
</div>
{this.notes}
{this.subNav}
</div>
);
}
}