diff --git a/assets/js/VacancyPage.jsx b/assets/js/VacancyPage.jsx index 786a9ab349b55a5f2bba6d6c1bc1493ee93d0ffe..c44a382094ef412dca3a072f83ed96f1352161be 100644 --- a/assets/js/VacancyPage.jsx +++ b/assets/js/VacancyPage.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import { Container } from 'semantic-ui-react'; import Tabs from './components/Tabs'; import Pane from './components/Pane'; import VacancyList from './components/VacancyList'; @@ -77,17 +78,20 @@ export default class VacancyPage extends React.Component { ); } else if (this.props.user.role === 'company' || this.props.user.role === 'admin') { return ( - <Pagination - url={`/companies/${this.state.id}/vacancies/`} - child={ - <VacancyList - key={1} - user={this.props.user} - userId={this.state.id} - /> - } - error="Anda belum diverifikasi. Harap hubungi admin" - /> + <Container className="vacancies"> + <Pagination + key={1} + url={`/companies/${this.state.id}/vacancies/`} + child={ + <VacancyList + key={1} + user={this.props.user} + userId={this.state.id} + /> + } + error="Anda belum diverifikasi. Harap hubungi admin" + /> + </Container> ); } diff --git a/assets/js/__test__/components/VacancyList-test.jsx b/assets/js/__test__/components/VacancyList-test.jsx index ee03b113fff1b6f9ef3e9a037a87f8c6c0ab2118..a3fdb795594a595e2e3b1bc61d53f06b2fa5360a 100644 --- a/assets/js/__test__/components/VacancyList-test.jsx +++ b/assets/js/__test__/components/VacancyList-test.jsx @@ -316,6 +316,7 @@ describe('VacancyList', () => { it('fails delete vacancy', () => { fetchMock.restore(); fetchMock.delete('*', 404); + fetchMock.get('*', response2); const vacancyList = ReactTestUtils.renderIntoDocument( <VacancyList userId={1} items={newResponse} user={companyUser} deleteCallback={() => {}} />, ); diff --git a/assets/js/components/CompanyVacancy.jsx b/assets/js/components/CompanyVacancy.jsx index 8ff71d10692b46767974fb15ae97d2c61abdb424..d935ff7f095833e41d76aa6b9319edd30bab50d0 100644 --- a/assets/js/components/CompanyVacancy.jsx +++ b/assets/js/components/CompanyVacancy.jsx @@ -2,6 +2,7 @@ import React from 'react'; import moment from 'moment'; import { Button, Icon, Item, Grid } from 'semantic-ui-react'; import { Link } from 'react-router'; +import Server from '../lib/Server'; const defaultImage = 'http://semantic-ui.com/images/wireframe/image.png'; @@ -15,8 +16,12 @@ export default class CompanyVacancy extends React.Component { constructor(props) { super(props); + /* istanbul ignore next */ moment.locale('id'); - this.state = { deleteLoading: false }; + this.state = { deleteLoading: false, count: 0, countNew: 0 }; + Server.get(`/vacancies/${this.props.data.id}/count/`, false).then((data) => { + this.setState({ count: data.count, countNew: data.count_new }); + }); } getLink = `/buat-lowongan/${this.props.data.id}`; @@ -25,12 +30,13 @@ export default class CompanyVacancy extends React.Component { return ( <Item className="applicantItems"> <Item.Image src={this.props.data.company.logo ? this.props.data.company.logo : defaultImage} size="small" /> - <Item.Content> + <Item.Content verticalAlign="middle" style={{ wordWrap: 'break-word', width: '100%' }} > <Item.Header as="a">{this.props.data.name}</Item.Header> <Grid.Row> <Grid.Column floated="left"> - <h5> 105 Pendaftar </h5> - Ditutup {moment(moment(this.props.data.close_time)).fromNow()} + <p>{ this.state.count } Pendaftar<br/> + { this.state.countNew } Pendaftar Baru<br/><br/> + Ditutup {moment(moment(this.props.data.close_time)).fromNow()}</p> </Grid.Column> <Grid.Column floated="right"> {this.props.data.verified ?