import React from 'react'
import {Link} from 'react-router'
import {Table} from 'react-bootstrap'

import moment from 'moment'

export default class ReportTable extends React.Component {
	static propTypes = {
		showAuthors: React.PropTypes.bool,
		reports: React.PropTypes.array.isRequired,
	}

	constructor(props) {
		super(props)

		this.state = {
			reports: []
		}
	}

	render() {
		let {showAuthors} = this.props

		return <Table striped>
			<thead>
				<tr>
					{showAuthors && <th>Author</th>}
					<th>Summary</th>
					<th>Status</th>
					<th>Last updated</th>
				</tr>
			</thead>

			<tbody>
				{this.props.reports.map(report =>
					<tr key={report.id}>
						{showAuthors && <td><Link to={"/people/" + report.author.id}>{report.author.name}</Link></td>}
						<td><Link to={"/reports/" + report.id}>{report.intent}</Link></td>
						<td>{report.state}</td>
						<td>{moment(report.updatedAt).fromNow()}</td>
					</tr>
				)}
			</tbody>
		</Table>
	}
}

@@ -495,16 +495,33 @@
 r%3C/th%3E%7D%0A
+%09%09%09%09%09%3Cth%3EAO%3C/th%3E%0A
 %09%09%09%09%09%3Cth
@@ -781,16 +781,118 @@
 %3E%3C/td%3E%7D%0A
+%09%09%09%09%09%09%3Ctd%3E%7Breport.organization && %3CLink to=%7B%22/organizations/%22 + report.organization.id%7D%3E%3C/Link%3E%7D%3C/td%3E%0A
 %09%09%09%09%09%09%3Ct

Add AO column to ReportTable