<commit_before>import React, {Component} from 'react'

import TextEditor from 'components/TextEditor'
import Autocomplete from 'components/Autocomplete'
import Form from 'components/Form'
import DatePicker from 'react-bootstrap-date-picker'
import {InputGroup, Radio, Table, Button, Collapse} from 'react-bootstrap'
import RadioGroup from 'components/RadioGroup'
import LinkTo from 'components/LinkTo'
import PoamsSelector from 'components/PoamsSelector'
import autobind from 'autobind-decorator'
import {Person} from 'models'

export default class ReportForm extends Component {
	static propTypes = {
		report: React.PropTypes.object.isRequired,
		recents: React.PropTypes.object.isRequired,
		onChange: React.PropTypes.func.isRequired,
		onSubmit: React.PropTypes.func,
		edit: React.PropTypes.bool,
		actionText: React.PropTypes.string,
		error: React.PropTypes.object,
	}

	static contextTypes = {
		app: React.PropTypes.object,
	}

	constructor(props) {
		super(props)

		this.state = {
			showKeyOutcomesText: false,
			showNextStepsText: false,
			showReportText: false
		}
	}

	render() {
		let {report, recents, onChange, onSubmit, actionText, error, edit} = this.props

		return <Form formFor={report} onChange={onChange}
			onSubmit={onSubmit} horizontal
			actionText={actionText}>

			{error &&
				<fieldset>
					<p>There was a problem saving this report</p>
					<p>{error}</p>
				</fieldset>}


			<fieldset>
				<legend>Engagement details <small>Required</small></legend>

				<Form.Field id="intent" label="Meeting subject" placeholder="What happened?" data-focus>
					<Form.Field.ExtraCol>{250 - report.intent.length} characters remaining</Form.Field.ExtraCol>
				</Form.Field>

				<Form.Field id="engagementDate">
					<DatePicker placeholder="When did it happen?">
						<InputGroup.Addon>📆</InputGroup.Addon>
					</DatePicker>
				</Form.Field>

				<Form.Field id="location" addon="📍">
					<Autocomplete valueKey="name" placeholder="Where did it happen?" url="/api/locations/search" />
				</Form.Field>

				<Form.Field id="atmosphere">
					<RadioGroup bsSize="large">
						<Radio value="POSITIVE">👍</Radio>
						<Radio value="NEUTRAL">😐</Radio>
						<Radio value="NEGATIVE">👎</Radio>
					</RadioGroup>
				</Form.Field>

				{report.atmosphere && report.atmosphere !== 'POSITIVE' &&
					<Form.Field id="atmosphereDetails" />
				}
			</fieldset>

			<fieldset>
				<legend>Meeting attendance <small>Required</small></legend>

				<Form.Field id="attendees">
					<Autocomplete placeholder="Who was there?" url="/api/people/search" template={person =>
						<span>{person.name} {person.rank && person.rank.toUpperCase()}</span>
					} onChange={this.addAttendee} clearOnSelect={true} />

					<Table hover striped>
						<thead>
							<tr>
								<th></th>
								<th>Primary</th>
								<th>Name</th>
								<th>Type</th>
								<th>Position</th>
							</tr>
						</thead>
						<tbody>
							{Person.map(report.attendees, person =>
								<tr key={person.id}>
									<td onClick={this.removeAttendee.bind(this, person)}>
										<span style={{cursor: 'pointer'}}>⛔️</span>
									</td>

									<td onClick={this.setPrimaryAttendee.bind(this, person)}>
										<span style={{cursor: 'pointer'}}>
											{person.primary ? "⭐️" : "☆"}
										</span>
									</td>

									<td>{person.name} {person.rank && person.rank.toUpperCase()}</td>
									<td>{person.role}</td>
									<td><LinkTo position={person.position} /></td>
								</tr>
							)}
						</tbody>
					</Table>

					<Form.Field.ExtraCol className="shortcut-list">
						<h5>Shortcuts</h5>
						<Button bsStyle="link" onClick={this.addMyself}>Add myself</Button>
						{Person.map(recents.persons, person =>
							<Button key={person.id} bsStyle="link" onClick={this.addAttendee.bind(this, person)}>Add {person.name}</Button>
						)}
					</Form.Field.ExtraCol>
				</Form.Field>
			</fieldset>

			<PoamsSelector poams={report.poams} shortcuts={recents.poams} onChange={onChange}/>

			<fieldset>
				<legend>Meeting discussion</legend>
				<Form.Field id="keyOutcomesSummary" >
					<Form.Field.ExtraCol>{250 - report.keyOutcomesSummary.length} characters remaining</Form.Field.ExtraCol>
				</Form.Field>

				<Button bsStyle="link" onClick={this.toggleKeyOutcomesText} >
					{this.state.showKeyOutcomesText ? "Hide" : "Add" } details to Key Outcomes
				</Button>
				<Collapse in={this.state.showKeyOutcomesText} >
					<Form.Field id="keyOutcomes" label="" horizontal={false}>
						<TextEditor label="Key outcomes" />
					</Form.Field>
				</Collapse>

				<Form.Field id="nextStepsSummary" ><commit_msg>re-added 'required' to meeting attendance that @hunterp somehow removed when merging. FOR SHAME<commit_after>import React, {Component} from 'react'

import TextEditor from 'components/TextEditor'
import Autocomplete from 'components/Autocomplete'
import Form from 'components/Form'
import DatePicker from 'react-bootstrap-date-picker'
import {InputGroup, Radio, Table, Button, Collapse} from 'react-bootstrap'
import RadioGroup from 'components/RadioGroup'
import LinkTo from 'components/LinkTo'
import PoamsSelector from 'components/PoamsSelector'
import autobind from 'autobind-decorator'
import {Person} from 'models'

export default class ReportForm extends Component {
	static propTypes = {
		report: React.PropTypes.object.isRequired,
		recents: React.PropTypes.object.isRequired,
		onChange: React.PropTypes.func.isRequired,
		onSubmit: React.PropTypes.func,
		edit: React.PropTypes.bool,
		actionText: React.PropTypes.string,
		error: React.PropTypes.object,
	}

	static contextTypes = {
		app: React.PropTypes.object,
	}

	constructor(props) {
		super(props)

		this.state = {
			showKeyOutcomesText: false,
			showNextStepsText: false,
			showReportText: false
		}
	}

	render() {
		let {report, recents, onChange, onSubmit, actionText, error, edit} = this.props

		return <Form formFor={report} onChange={onChange}
			onSubmit={onSubmit} horizontal
			actionText={actionText}>

			{error &&
				<fieldset>
					<p>There was a problem saving this report</p>
					<p>{error}</p>
				</fieldset>}


			<fieldset>
				<legend>Engagement Details<small>Required</small></legend>

				<Form.Field id="intent" label="Meeting subject" placeholder="What happened?" data-focus>
					<Form.Field.ExtraCol>{250 - report.intent.length} characters remaining</Form.Field.ExtraCol>
				</Form.Field>

				<Form.Field id="engagementDate">
					<DatePicker placeholder="When did it happen?">
						<InputGroup.Addon>📆</InputGroup.Addon>
					</DatePicker>
				</Form.Field>

				<Form.Field id="location" addon="📍">
					<Autocomplete valueKey="name" placeholder="Where did it happen?" url="/api/locations/search" />
				</Form.Field>

				<Form.Field id="atmosphere">
					<RadioGroup bsSize="large">
						<Radio value="POSITIVE">👍</Radio>
						<Radio value="NEUTRAL">😐</Radio>
						<Radio value="NEGATIVE">👎</Radio>
					</RadioGroup>
				</Form.Field>

				{report.atmosphere && report.atmosphere !== 'POSITIVE' &&
					<Form.Field id="atmosphereDetails" />
				}
			</fieldset>

			<fieldset>
				<legend>Meeting Attendance<small>Required</small></legend>

				<Form.Field id="attendees">
					<Autocomplete placeholder="Who was there?" url="/api/people/search" template={person =>
						<span>{person.name} {person.rank && person.rank.toUpperCase()}</span>
					} onChange={this.addAttendee} clearOnSelect={true} />

					<Table hover striped>
						<thead>
							<tr>
								<th></th>
								<th>Primary</th>
								<th>Name</th>
								<th>Type</th>
								<th>Position</th>
							</tr>
						</thead>
						<tbody>
							{Person.map(report.attendees, person =>
								<tr key={person.id}>
									<td onClick={this.removeAttendee.bind(this, person)}>
										<span style={{cursor: 'pointer'}}>⛔️</span>
									</td>

									<td onClick={this.setPrimaryAttendee.bind(this, person)}>
										<span style={{cursor: 'pointer'}}>
											{person.primary ? "⭐️" : "☆"}
										</span>
									</td>

									<td>{person.name} {person.rank && person.rank.toUpperCase()}</td>
									<td>{person.role}</td>
									<td><LinkTo position={person.position} /></td>
								</tr>
							)}
						</tbody>
					</Table>

					<Form.Field.ExtraCol className="shortcut-list">
						<h5>Shortcuts</h5>
						<Button bsStyle="link" onClick={this.addMyself}>Add myself</Button>
						{Person.map(recents.persons, person =>
							<Button key={person.id} bsStyle="link" onClick={this.addAttendee.bind(this, person)}>Add {person.name}</Button>
						)}
					</Form.Field.ExtraCol>
				</Form.Field>
			</fieldset>

			<PoamsSelector poams={report.poams} shortcuts={recents.poams} onChange={onChange}/>

			<fieldset>
				<legend>Meeting Discussion<small>Required</small></legend>
				<Form.Field id="keyOutcomesSummary" >
					<Form.Field.ExtraCol>{250 - report.keyOutcomesSummary.length} characters remaining</Form.Field.ExtraCol>
				</Form.Field>

				<Button bsStyle="link" onClick={this.toggleKeyOutcomesText} >
					{this.state.showKeyOutcomesText ? "Hide" : "Add" } details to Key Outcomes
				</Button>
				<Collapse in={this.state.showKeyOutcomesText} >
					<Form.Field id="keyOutcomes" label="" horizontal={false}>
						<TextEditor label="Key outcomes" />
					</Form.Field>
				</Collapse>

				<Form.Field id="nextStepsSummary" >
{'fraction_non_alphanumeric': 0.15441880250983728, 'fraction_numerical': 0.001701584600659364, 'mean_word_length': 3.423330197554092, 'pattern_counts': {'":': 0, '<': 219, '<?xml version=': 0, '>': 225, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2213713', 'n_tokens_mistral': 3940, 'n_tokens_neox': 3019, 'n_words': 580}