Fakultas Ilmu Komputer UI

CompanyVacancy.jsx 1.86 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,
12
13
  };

14
15
  static defaultProps = { deleteCallback: () => {} };

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

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

24
25
  render() {
    return (
26
27
28
29
      <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>
30
31
32
          <Grid.Row>
            <Grid.Column floated="left">
              <h5> 105 Pendaftar </h5>
33
              Ditutup {moment(moment(this.props.data.close_time)).fromNow()}
34
35
36
37
38
39
40
41
            </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>
42
              <Button loading={this.state.deleteLoading} color="red" floated="right" onClick={() => { this.setState({ deleteLoading: true }); this.props.deleteCallback(); }} >
43
44
45
46
                Hapus <Icon name="delete" />
              </Button>
            </Grid.Column>
          </Grid.Row>
47
48
        </Item.Content>
      </Item>
49
50
    );
  }
51
}