Component.tsx
2.06 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
import * as React from "react";
import { Link } from "react-router-dom";
import styled from "styled-components";
import TextField from "material-ui/TextField";
import RaisedButton from "material-ui/RaisedButton";
require("./styles.scss");
const style = {
// width: "100%"
};
interface Props {
org: any;
confirm: Function;
reject: Function;
}
class Tester extends React.Component<any> {
state = { review: "" };
handleChangeReview = event => this.setState({ review: event.target.value });
public render() {
const { props, state } = this;
const { id, confirm, reject } = props;
return (
<div>
<RaisedButton
label="승인"
primary={true}
style={style}
onClick={() => confirm(id, state.review)}
/>
<hr />
<TextField
hintText="사유"
type="text"
value={state.review}
onChange={this.handleChangeReview}
style={style}
/>
<RaisedButton
label="반려"
primary={true}
style={style}
onClick={() => reject(id, state.review)}
/>
</div>
);
}
}
class JudgePage extends React.Component<Props> {
public render() {
const { props, state } = this;
const { org } = props;
return (
<div className="judge-page">
<h2>신청서</h2>
<ul>
{org.contracts
.filter(contract => contract.status === "wait")
.map(contract => (
<li key={contract.id}>
<h3>사유</h3>
<p>{contract.reason}</p>
<h3>주소</h3>
<p>{contract.address}</p>
<h3>드론</h3>
<p>
{contract.drone.name}({contract.drone.model.name})
</p>
<Tester
id={contract.id}
confirm={props.confirm}
reject={props.reject}
/>
<br />
</li>
))}
</ul>
</div>
);
}
}
export default JudgePage;