import React from 'react'; import { Item, Grid, Button } from 'semantic-ui-react'; import VerifyAdminModal from './VerifyAdminModal'; import Server from '../lib/Server'; export default class AdminVacancy extends React.Component { static propTypes = { data: React.PropTypes.object.isRequired, updateStatus: React.PropTypes.func.isRequired, }; changeVerifiedStatus() { let data = {}; if (this.props.data.verified) { data = { verified: false }; } else { data = { verified: true }; } Server.patch(`/vacancies/${this.props.data.id}/verify/`, data).then((status) => { this.props.updateStatus(this.props.data.id, status.status); }); } generateButton() { const unverifyButton = ; const verifyButton = ; if (this.props.data.verified) { return unverifyButton; } return verifyButton; } render() { const defaultImage = 'http://semantic-ui.com/images/wireframe/image.png'; return ( {this.props.data.name}

{this.props.data.company.name}

{this.props.data.company.address}
{this.generateButton()}
); } }