2015-10-12 17:12:38 -07:00
|
|
|
import React, { PropTypes } from 'react';
|
2015-10-15 22:24:05 -07:00
|
|
|
import { Panel, Button, Row, Col } from 'react-bootstrap';
|
2015-09-26 22:23:56 -07:00
|
|
|
import { contain } from 'thundercats-react';
|
2015-10-19 22:51:30 -07:00
|
|
|
|
2015-09-26 22:23:56 -07:00
|
|
|
import ShowJob from './ShowJob.jsx';
|
2015-10-19 22:51:30 -07:00
|
|
|
import JobNotFound from './JobNotFound.jsx';
|
2015-09-26 22:23:56 -07:00
|
|
|
|
|
|
|
export default contain(
|
|
|
|
{
|
|
|
|
store: 'JobsStore',
|
2015-10-13 23:05:31 -07:00
|
|
|
actions: [
|
|
|
|
'appActions',
|
|
|
|
'jobActions'
|
|
|
|
],
|
2015-09-26 22:23:56 -07:00
|
|
|
map({ form: job = {} }) {
|
|
|
|
return { job };
|
|
|
|
}
|
|
|
|
},
|
2015-10-12 17:12:38 -07:00
|
|
|
React.createClass({
|
|
|
|
displayName: 'Preview',
|
|
|
|
|
|
|
|
propTypes: {
|
2015-10-13 23:05:31 -07:00
|
|
|
appActions: PropTypes.object,
|
|
|
|
job: PropTypes.object,
|
|
|
|
jobActions: PropTypes.object
|
2015-10-12 17:12:38 -07:00
|
|
|
},
|
|
|
|
|
2015-10-19 22:51:30 -07:00
|
|
|
componentDidMount() {
|
|
|
|
const { appActions, job } = this.props;
|
|
|
|
// redirect user in client
|
|
|
|
if (!job || !job.position || !job.description) {
|
|
|
|
appActions.goTo('/jobs/new');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-10-12 17:12:38 -07:00
|
|
|
render() {
|
2015-10-13 23:05:31 -07:00
|
|
|
const { appActions, job, jobActions } = this.props;
|
2015-10-19 22:51:30 -07:00
|
|
|
|
2015-10-20 15:01:05 -07:00
|
|
|
if (!job || !job.position || !job.description) {
|
2015-10-19 22:51:30 -07:00
|
|
|
return <JobNotFound />;
|
|
|
|
}
|
|
|
|
|
2015-10-12 17:12:38 -07:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<ShowJob job={ job } />
|
|
|
|
<Row>
|
2015-10-15 22:24:05 -07:00
|
|
|
<Col
|
|
|
|
md={ 10 }
|
|
|
|
mdOffset={ 1 }
|
|
|
|
xs={ 12 }>
|
|
|
|
<Panel>
|
|
|
|
<Button
|
|
|
|
block={ true }
|
|
|
|
className='signup-btn'
|
|
|
|
onClick={ () => {
|
2015-10-21 20:38:11 -07:00
|
|
|
// jobActions.clearSavedForm();
|
2015-10-15 22:24:05 -07:00
|
|
|
jobActions.saveJobToDb({
|
|
|
|
goTo: '/jobs/new/check-out',
|
|
|
|
job
|
|
|
|
});
|
|
|
|
}}>
|
|
|
|
|
|
|
|
Looks great! Let's Check Out
|
|
|
|
</Button>
|
|
|
|
<Button
|
|
|
|
block={ true }
|
|
|
|
onClick={ () => appActions.goBack() } >
|
|
|
|
Head back and make edits
|
|
|
|
</Button>
|
|
|
|
</Panel>
|
|
|
|
</Col>
|
2015-10-12 17:12:38 -07:00
|
|
|
</Row>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
})
|
2015-09-26 22:23:56 -07:00
|
|
|
);
|