Fakultas Ilmu Komputer UI

CompanyVacancy.jsx 1.81 KB
Newer Older
1
import React from 'react';
2
import moment from 'moment';
3
import { Button, Icon, Item, Grid } from 'semantic-ui-react';
4
import { Link } from 'react-router';
5

6
7
const defaultImage = 'http://semantic-ui.com/images/wireframe/image.png';

8
export default class CompanyVacancy extends React.Component {
9
  static propTypes = {
10
    data: React.PropTypes.object.isRequired,
11
    deleteCallback: React.PropTypes.func.isRequired,
12
13
  };

14
15
16
  constructor(props) {
    super(props);
    moment.locale('id');
17
    this.state = { deleteLoading: false };
18
19
20
21
  }

  getLink = `/buat-lowongan/${this.props.data.id}`;

22
23
  render() {
    return (
24
25
26
27
      <Item className="applicantItems">
        <Item.Image src={this.props.data.company.logo ? this.props.data.company.logo : defaultImage} size="small" />
        <Item.Content>
          <Item.Header as="a">{this.props.data.name}</Item.Header>
28
29
30
          <Grid.Row>
            <Grid.Column floated="left">
              <h5> 105 Pendaftar </h5>
31
              Ditutup {moment(moment(this.props.data.close_time)).fromNow()}
32
33
34
35
36
37
38
39
40
41
42
43
44
            </Grid.Column>
            <Grid.Column floated="right">
              {this.props.data.verified ?
                (<h4> <Icon name="checkmark box" size="large" color="green" /> Terverifikasi </h4>) :
                (<h4> <Icon name="remove circle" size="large" color="red" /> Belum Terverifikasi </h4>)}
              <Button color="blue" floated="right" as={Link} to={this.getLink}>
                Ubah <Icon name="right chevron" />
              </Button>
              <Button loading={this.state.deleteLoading} color="red" floated="right" onClick={() => { this.setState({ deleteLoading : true }); this.props.deleteCallback(); }} >
                Hapus <Icon name="delete" />
              </Button>
            </Grid.Column>
          </Grid.Row>
45
46
        </Item.Content>
      </Item>
47
48
    );
  }
49
}