Fakultas Ilmu Komputer UI

Commit cff72e99 authored by Farah Alhaniy Efendi's avatar Farah Alhaniy Efendi
Browse files

1606821886 57

parent 4ea656af
......@@ -24,6 +24,8 @@ export default class CreateVacancy extends React.Component {
this.handleResponsibilities = this.handleResponsibilities.bind(this);
this.setCloseTime = this.setCloseTime.bind(this);
this.setOpenTime = this.setOpenTime.bind(this);
this.handleDescription = this.handleDescription.bind(this);
this.handleBenefits = this.handleBenefits.bind(this);
this.state = {
formLoading: false,
......@@ -34,6 +36,7 @@ export default class CreateVacancy extends React.Component {
close_time: moment(),
name: '',
description: '',
benefits: '',
requirements: '',
salary: 0,
tag: '',
......@@ -43,6 +46,7 @@ export default class CreateVacancy extends React.Component {
Server.get(`/vacancies/${this.state.vacancyId}/`).then((r) => {
this.setState({
description: r.description,
benefits: r.benefits,
requirements : r.requirements,
responsibilities: r.responsibilities,
name: r.name,
......@@ -72,10 +76,15 @@ export default class CreateVacancy extends React.Component {
this.setState({ description: value });
}
handleBenefits(value) {
this.setState({ benefits: value });
}
handleRequirements(value) {
this.setState({ requirements: value });
}
handleResponsibilities(value) {
this.setState({ responsibilities: value });
}
......@@ -88,6 +97,7 @@ export default class CreateVacancy extends React.Component {
data.name = this.state.name;
data.tag = this.state.tag;
data.description = this.state.description;
data.benefits = this.state.benefits;
data.requirements = this.state.requirements;
data.salary = this.state.salary;
data.open_time = this.state.open_time.format();
......@@ -130,6 +140,10 @@ export default class CreateVacancy extends React.Component {
<CKEditor value={this.state.responsibilities} onChange={this.handleResponsibilities} /> }
<script>CKEDITOR.replace( 'responsibilities' );</script>
<br />
<label htmlFor="benefits"> <b> Keuntungan </b> </label>
{ !this.state.loading && <CKEditor value={this.state.benefits} onChange={this.handleBenefits} /> }
<script>CKEDITOR.replace( 'benefits' );</script>
<br />
<label htmlFor="requirements"> <b> Persyaratan </b> </label>
{ !this.state.loading &&
<CKEditor value={this.state.requirements} onChange={this.handleRequirements} /> }
......
......@@ -24,6 +24,7 @@ describe('CreateVacancy', () => {
updated: '2017-03-28T07:30:10.535000Z',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla aliquet semper neque a fermentum. Duis ac tellus vitae augue iaculis ultrices. Curabitur commodo et neque nec feugiat. Morbi ac diam vel nunc commodo cursus. Phasellus nulla sapien, hendrerit vitae bibendum at, sollicitudin eu ante. Maecenas maximus, ante eu sollicitudin convallis, mauris nunc posuere risus, eu porttitor diam lacus vitae enim. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse at lectus a elit sollicitudin tempor. Nullam condimentum, justo nec tincidunt maximus, neque mi vulputate leo, sit amet lacinia massa ex eget sem. Duis ac erat facilisis, fringilla mauris in, consequat neque. In et neque consequat, vehicula magna at, efficitur ante. Mauris ac lacinia nibh.\r\n\r\nProin sagittis, lectus quis maximus varius, libero justo sollicitudin augue, non lacinia risus orci a enim. Curabitur iaculis enim quis ullamcorper commodo. Vivamus id nisi rhoncus, dignissim tellus quis, interdum est. Fusce sollicitudin eu libero ac feugiat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas semper posuere ex, sed accumsan libero iaculis faucibus. Fusce laoreet ac ligula ut consectetur. Donec tortor mauris, rutrum at sodales et, viverra in dolor. Sed bibendum elit et maximus volutpat. Phasellus justo ipsum, laoreet sit amet faucibus eu, ultricies suscipit mauris. Nullam aliquam libero eu ante ultrices mattis. Donec non justo hendrerit neque volutpat placerat. Ut euismod est nec sem mollis, sit amet porttitor massa rhoncus. Aenean id erat sit amet nunc ultrices scelerisque non in ipsum. Curabitur sollicitudin nulla id mi accumsan venenatis.',
verified: true,
benefits: 'Makan siang gratis, Waktu kerja fleksibel, Asuransi kesehatan, Liburan berbayar',
logo: 'http://localhost:8001/files/company-logo/8a258a48-3bce-4873-b5d1-538b360d0059.png',
address: 'Jl. Kebayoran Baru nomor 13, Jakarta Barat',
},
......@@ -71,6 +72,7 @@ describe('CreateVacancy', () => {
createVacancy.setState({
name: 'stub',
description: 'stub',
benefits: 'stub',
requirements: 'stub',
responsibilities: 'stub',
});
......@@ -89,6 +91,7 @@ describe('CreateVacancy', () => {
createVacancy.setState({
name: 'stub',
description: 'stub',
benefits: 'stub',
requirements: 'stub',
responsibilities: 'stub',
});
......@@ -116,6 +119,7 @@ describe('CreateVacancy', () => {
createVacancy.setState({
name: 'stub',
description: 'stub',
benefits: 'stub',
requirements: 'stub',
responsibilities: 'stub',
});
......@@ -136,6 +140,7 @@ describe('CreateVacancy', () => {
createVacancy.setState({
name: 'stub',
description: 'stub',
benefits: 'stub',
requirements: 'stub',
responsibilities: 'stub',
});
......@@ -165,6 +170,8 @@ describe('CreateVacancy', () => {
createVacancy.setState({
name: 'stub',
description: 'stub',
benefits: 'stub',
responsibilities: 'stub',
requirements: 'stub',
responsibilities: 'stub',
});
......
......@@ -61,6 +61,7 @@ describe('VacancyPage', () => {
updated: '2017-03-28T07:30:10.535000Z',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla aliquet semper neque a fermentum. Duis ac tellus vitae augue iaculis ultrices. Curabitur commodo et neque nec feugiat. Morbi ac diam vel nunc commodo cursus. Phasellus nulla sapien, hendrerit vitae bibendum at, sollicitudin eu ante. Maecenas maximus, ante eu sollicitudin convallis, mauris nunc posuere risus, eu porttitor diam lacus vitae enim. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse at lectus a elit sollicitudin tempor. Nullam condimentum, justo nec tincidunt maximus, neque mi vulputate leo, sit amet lacinia massa ex eget sem. Duis ac erat facilisis, fringilla mauris in, consequat neque. In et neque consequat, vehicula magna at, efficitur ante. Mauris ac lacinia nibh.\r\n\r\nProin sagittis, lectus quis maximus varius, libero justo sollicitudin augue, non lacinia risus orci a enim. Curabitur iaculis enim quis ullamcorper commodo. Vivamus id nisi rhoncus, dignissim tellus quis, interdum est. Fusce sollicitudin eu libero ac feugiat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas semper posuere ex, sed accumsan libero iaculis faucibus. Fusce laoreet ac ligula ut consectetur. Donec tortor mauris, rutrum at sodales et, viverra in dolor. Sed bibendum elit et maximus volutpat. Phasellus justo ipsum, laoreet sit amet faucibus eu, ultricies suscipit mauris. Nullam aliquam libero eu ante ultrices mattis. Donec non justo hendrerit neque volutpat placerat. Ut euismod est nec sem mollis, sit amet porttitor massa rhoncus. Aenean id erat sit amet nunc ultrices scelerisque non in ipsum. Curabitur sollicitudin nulla id mi accumsan venenatis.',
verified: true,
benefits: 'Makan siang gratis, Waktu kerja fleksibel, Asuransi kesehatan, Liburan berbayar',
logo: 'http://localhost:8001/files/company-logo/8a258a48-3bce-4873-b5d1-538b360d0059.png',
address: 'Jl. Kebayoran Baru nomor 13, Jakarta Barat',
},
......
......@@ -26,6 +26,7 @@ describe('VacancyList', () => {
updated: '2017-03-28T07:30:10.535000Z',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla aliquet semper neque a fermentum. Duis ac tellus vitae augue iaculis ultrices. Curabitur commodo et neque nec feugiat. Morbi ac diam vel nunc commodo cursus. Phasellus nulla sapien, hendrerit vitae bibendum at, sollicitudin eu ante. Maecenas maximus, ante eu sollicitudin convallis, mauris nunc posuere risus, eu porttitor diam lacus vitae enim. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse at lectus a elit sollicitudin tempor. Nullam condimentum, justo nec tincidunt maximus, neque mi vulputate leo, sit amet lacinia massa ex eget sem. Duis ac erat facilisis, fringilla mauris in, consequat neque. In et neque consequat, vehicula magna at, efficitur ante. Mauris ac lacinia nibh.\r\n\r\nProin sagittis, lectus quis maximus varius, libero justo sollicitudin augue, non lacinia risus orci a enim. Curabitur iaculis enim quis ullamcorper commodo. Vivamus id nisi rhoncus, dignissim tellus quis, interdum est. Fusce sollicitudin eu libero ac feugiat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas semper posuere ex, sed accumsan libero iaculis faucibus. Fusce laoreet ac ligula ut consectetur. Donec tortor mauris, rutrum at sodales et, viverra in dolor. Sed bibendum elit et maximus volutpat. Phasellus justo ipsum, laoreet sit amet faucibus eu, ultricies suscipit mauris. Nullam aliquam libero eu ante ultrices mattis. Donec non justo hendrerit neque volutpat placerat. Ut euismod est nec sem mollis, sit amet porttitor massa rhoncus. Aenean id erat sit amet nunc ultrices scelerisque non in ipsum. Curabitur sollicitudin nulla id mi accumsan venenatis.',
verified: true,
benefits: 'Makan siang gratis, Waktu kerja fleksibel, Asuransi kesehatan, Liburan berbayar',
logo: 'http://localhost:8001/files/company-logo/8a258a48-3bce-4873-b5d1-538b360d0059.png',
address: 'Jl. Kebayoran Baru nomor 13, Jakarta Barat',
},
......@@ -129,12 +130,14 @@ describe('VacancyList', () => {
updated: '2017-05-07T13:22:19.175033Z',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla aliquet semper neque a fermentum. Duis ac tellus vitae augue iaculis ultrices. Curabitur commodo et neque nec feugiat. Morbi ac diam vel nunc commodo cursus. Phasellus nulla sapien, hendrerit vitae bibendum at, sollicitudin eu ante. Maecenas maximus, ante eu sollicitudin convallis, mauris nunc posuere risus, eu porttitor diam lacus vitae enim. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse at lectus a elit sollicitudin tempor. Nullam condimentum, justo nec tincidunt maximus, neque mi vulputate leo, sit amet lacinia massa ex eget sem. Duis ac erat facilisis, fringilla mauris in, consequat neque. In et neque consequat, vehicula magna at, efficitur ante. Mauris ac lacinia nibh.\r\n\r\nProin sagittis, lectus quis maximus varius, libero justo sollicitudin augue, non lacinia risus orci a enim. Curabitur iaculis enim quis ullamcorper commodo. Vivamus id nisi rhoncus, dignissim tellus quis, interdum est. Fusce sollicitudin eu libero ac feugiat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas semper posuere ex, sed accumsan libero iaculis faucibus. Fusce laoreet ac ligula ut consectetur. Donec tortor mauris, rutrum at sodales et, viverra in dolor. Sed bibendum elit et maximus volutpat. Phasellus justo ipsum, laoreet sit amet faucibus eu, ultricies suscipit mauris. Nullam aliquam libero eu ante ultrices mattis. Donec non justo hendrerit neque volutpat placerat. Ut euismod est nec sem mollis, sit amet porttitor massa rhoncus. Aenean id erat sit amet nunc ultrices scelerisque non in ipsum. Curabitur sollicitudin nulla id mi accumsan venenatis.',
registeredStatus: 1,
benefits: 'Makan siang gratis, Waktu kerja fleksibel, Asuransi kesehatan, Liburan berbayar',
logo: null,
address: 'Jl. Kebayoran Baru nomor 13, Jakarta Barat',
},
verified: true,
open_time: '2017-04-26T03:39:11Z',
description: 'deskripsi',
benefits: 'keuntungan',
requirements: 'requirements',
responsibilities: 'This is a responsibility.',
salary: '1',
......@@ -161,12 +164,14 @@ describe('VacancyList', () => {
updated: '2017-05-07T13:22:19.175033Z',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla aliquet semper neque a fermentum. Duis ac tellus vitae augue iaculis ultrices. Curabitur commodo et neque nec feugiat. Morbi ac diam vel nunc commodo cursus. Phasellus nulla sapien, hendrerit vitae bibendum at, sollicitudin eu ante. Maecenas maximus, ante eu sollicitudin convallis, mauris nunc posuere risus, eu porttitor diam lacus vitae enim. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse at lectus a elit sollicitudin tempor. Nullam condimentum, justo nec tincidunt maximus, neque mi vulputate leo, sit amet lacinia massa ex eget sem. Duis ac erat facilisis, fringilla mauris in, consequat neque. In et neque consequat, vehicula magna at, efficitur ante. Mauris ac lacinia nibh.\r\n\r\nProin sagittis, lectus quis maximus varius, libero justo sollicitudin augue, non lacinia risus orci a enim. Curabitur iaculis enim quis ullamcorper commodo. Vivamus id nisi rhoncus, dignissim tellus quis, interdum est. Fusce sollicitudin eu libero ac feugiat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas semper posuere ex, sed accumsan libero iaculis faucibus. Fusce laoreet ac ligula ut consectetur. Donec tortor mauris, rutrum at sodales et, viverra in dolor. Sed bibendum elit et maximus volutpat. Phasellus justo ipsum, laoreet sit amet faucibus eu, ultricies suscipit mauris. Nullam aliquam libero eu ante ultrices mattis. Donec non justo hendrerit neque volutpat placerat. Ut euismod est nec sem mollis, sit amet porttitor massa rhoncus. Aenean id erat sit amet nunc ultrices scelerisque non in ipsum. Curabitur sollicitudin nulla id mi accumsan venenatis.',
registeredStatus: 1,
benefits: 'Makan siang gratis, Waktu kerja fleksibel, Asuransi kesehatan, Liburan berbayar',
logo: 'http://localhost:8000/files/company-logo/8a258a48-3bce-4873-b5d1-538b360d0059.png',
address: 'Jl. Kebayoran Baru nomor 13, Jakarta Barat',
},
verified: true,
open_time: '2017-04-26T03:39:11Z',
description: 'deskripsi',
benefits: 'keuntungan',
requirements: 'requirements',
responsibilities: 'This is a responsibility.',
salary: '1',
......@@ -193,12 +198,14 @@ describe('VacancyList', () => {
updated: '2017-05-07T13:22:19.175033Z',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla aliquet semper neque a fermentum. Duis ac tellus vitae augue iaculis ultrices. Curabitur commodo et neque nec feugiat. Morbi ac diam vel nunc commodo cursus. Phasellus nulla sapien, hendrerit vitae bibendum at, sollicitudin eu ante. Maecenas maximus, ante eu sollicitudin convallis, mauris nunc posuere risus, eu porttitor diam lacus vitae enim. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse at lectus a elit sollicitudin tempor. Nullam condimentum, justo nec tincidunt maximus, neque mi vulputate leo, sit amet lacinia massa ex eget sem. Duis ac erat facilisis, fringilla mauris in, consequat neque. In et neque consequat, vehicula magna at, efficitur ante. Mauris ac lacinia nibh.\r\n\r\nProin sagittis, lectus quis maximus varius, libero justo sollicitudin augue, non lacinia risus orci a enim. Curabitur iaculis enim quis ullamcorper commodo. Vivamus id nisi rhoncus, dignissim tellus quis, interdum est. Fusce sollicitudin eu libero ac feugiat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas semper posuere ex, sed accumsan libero iaculis faucibus. Fusce laoreet ac ligula ut consectetur. Donec tortor mauris, rutrum at sodales et, viverra in dolor. Sed bibendum elit et maximus volutpat. Phasellus justo ipsum, laoreet sit amet faucibus eu, ultricies suscipit mauris. Nullam aliquam libero eu ante ultrices mattis. Donec non justo hendrerit neque volutpat placerat. Ut euismod est nec sem mollis, sit amet porttitor massa rhoncus. Aenean id erat sit amet nunc ultrices scelerisque non in ipsum. Curabitur sollicitudin nulla id mi accumsan venenatis.',
registeredStatus: 1,
benefits: 'Makan siang gratis, Waktu kerja fleksibel, Asuransi kesehatan, Liburan berbayar',
logo: null,
address: 'Jl. Kebayoran Baru nomor 13, Jakarta Barat',
},
verified: true,
open_time: '2017-04-26T03:39:11Z',
description: 'deskripsi',
benefits: 'keuntungan',
requirements: 'requirements',
responsibilities: 'This is a responsibility.',
salary: '1',
......@@ -225,12 +232,14 @@ describe('VacancyList', () => {
updated: '2017-05-07T13:22:19.175033Z',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla aliquet semper neque a fermentum. Duis ac tellus vitae augue iaculis ultrices. Curabitur commodo et neque nec feugiat. Morbi ac diam vel nunc commodo cursus. Phasellus nulla sapien, hendrerit vitae bibendum at, sollicitudin eu ante. Maecenas maximus, ante eu sollicitudin convallis, mauris nunc posuere risus, eu porttitor diam lacus vitae enim. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse at lectus a elit sollicitudin tempor. Nullam condimentum, justo nec tincidunt maximus, neque mi vulputate leo, sit amet lacinia massa ex eget sem. Duis ac erat facilisis, fringilla mauris in, consequat neque. In et neque consequat, vehicula magna at, efficitur ante. Mauris ac lacinia nibh.\r\n\r\nProin sagittis, lectus quis maximus varius, libero justo sollicitudin augue, non lacinia risus orci a enim. Curabitur iaculis enim quis ullamcorper commodo. Vivamus id nisi rhoncus, dignissim tellus quis, interdum est. Fusce sollicitudin eu libero ac feugiat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas semper posuere ex, sed accumsan libero iaculis faucibus. Fusce laoreet ac ligula ut consectetur. Donec tortor mauris, rutrum at sodales et, viverra in dolor. Sed bibendum elit et maximus volutpat. Phasellus justo ipsum, laoreet sit amet faucibus eu, ultricies suscipit mauris. Nullam aliquam libero eu ante ultrices mattis. Donec non justo hendrerit neque volutpat placerat. Ut euismod est nec sem mollis, sit amet porttitor massa rhoncus. Aenean id erat sit amet nunc ultrices scelerisque non in ipsum. Curabitur sollicitudin nulla id mi accumsan venenatis.',
registeredStatus: 1,
benefits: 'Makan siang gratis, Waktu kerja fleksibel, Asuransi kesehatan, Liburan berbayar',
logo: null,
address: 'Jl. Kebayoran Baru nomor 13, Jakarta Barat',
},
verified: true,
open_time: '2017-04-26T03:39:11Z',
description: 'deskripsi',
benefits: 'keuntungan',
requirements: 'requirements',
responsibilities: 'This is a responsibility.',
salary: '1',
......@@ -257,12 +266,14 @@ describe('VacancyList', () => {
updated: '2017-05-07T13:22:19.175033Z',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla aliquet semper neque a fermentum. Duis ac tellus vitae augue iaculis ultrices. Curabitur commodo et neque nec feugiat. Morbi ac diam vel nunc commodo cursus. Phasellus nulla sapien, hendrerit vitae bibendum at, sollicitudin eu ante. Maecenas maximus, ante eu sollicitudin convallis, mauris nunc posuere risus, eu porttitor diam lacus vitae enim. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse at lectus a elit sollicitudin tempor. Nullam condimentum, justo nec tincidunt maximus, neque mi vulputate leo, sit amet lacinia massa ex eget sem. Duis ac erat facilisis, fringilla mauris in, consequat neque. In et neque consequat, vehicula magna at, efficitur ante. Mauris ac lacinia nibh.\r\n\r\nProin sagittis, lectus quis maximus varius, libero justo sollicitudin augue, non lacinia risus orci a enim. Curabitur iaculis enim quis ullamcorper commodo. Vivamus id nisi rhoncus, dignissim tellus quis, interdum est. Fusce sollicitudin eu libero ac feugiat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas semper posuere ex, sed accumsan libero iaculis faucibus. Fusce laoreet ac ligula ut consectetur. Donec tortor mauris, rutrum at sodales et, viverra in dolor. Sed bibendum elit et maximus volutpat. Phasellus justo ipsum, laoreet sit amet faucibus eu, ultricies suscipit mauris. Nullam aliquam libero eu ante ultrices mattis. Donec non justo hendrerit neque volutpat placerat. Ut euismod est nec sem mollis, sit amet porttitor massa rhoncus. Aenean id erat sit amet nunc ultrices scelerisque non in ipsum. Curabitur sollicitudin nulla id mi accumsan venenatis.',
registeredStatus: 1,
benefits: 'Makan siang gratis, Waktu kerja fleksibel, Asuransi kesehatan, Liburan berbayar',
logo: null,
address: 'Jl. Kebayoran Baru nomor 13, Jakarta Barat',
},
verified: true,
open_time: '2017-04-26T03:39:11Z',
description: 'deskripsi',
benefits: 'keuntungan',
requirements: 'requirements',
responsibilities: 'This is a responsibility.',
salary: '1',
......
......@@ -83,15 +83,22 @@ export default class ApplyModal extends React.Component {
<Modal.Header> <h3> Deskripsi Perusahaan </h3></Modal.Header>
{ <div dangerouslySetInnerHTML={{ __html: this.props.data.companydescription }} /> }
</Modal.Description>
<br />
<Modal.Description>
<Modal.Header> <h3> Tanggung Jawab Lowongan </h3></Modal.Header>
{ <div dangerouslySetInnerHTML={{ __html: this.props.data.responsibilities }} /> }
</Modal.Description>
<br />
<Modal.Description>
<Modal.Header> <h3> Keuntungan test </h3></Modal.Header>
{ <div dangerouslySetInnerHTML={{ __html: this.props.data.benefits }} /> }
</Modal.Description>
<br />
<Modal.Description>
<Modal.Header> <h3> Persyaratan </h3></Modal.Header>
{ <div dangerouslySetInnerHTML={{ __html: this.props.data.requirements }} /> }
</Modal.Description>
<br />
{this.props.active && (
<div className="coverLetter">
<br />
......
......@@ -95,6 +95,7 @@ export default class Vacancy extends React.Component {
data={{
header: this.props.data.name,
description: this.props.data.description,
benefits: this.props.data.benefits,
requirements: this.props.data.requirements,
companydescription: this.props.data.company.description,
responsibilities: this.props.data.responsibilities,
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-12 15:05
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='vacancy',
name='benefits',
field=models.TextField(blank=True),
),
]
......@@ -16,6 +16,7 @@ class Vacancy(models.Model):
updated = models.DateTimeField(auto_now=True)
name = models.CharField(max_length=100, null=False)
amount = models.IntegerField(null=True)
benefits = models.TextField(blank=True)
working_period = models.CharField(max_length=100, null=True)
tag = models.TextField(blank=True)
salary = models.IntegerField(default=0)
......
......@@ -33,7 +33,7 @@ class VacancySerializer(serializers.ModelSerializer):
class Meta:
model = Vacancy
fields = ['company', 'verified', 'open_time', 'description', 'close_time', 'created','apply_before', 'updated', 'name', \
'status', 'bookmarked', 'id', 'salary', 'responsibilities', 'requirements','working_period']
'status', 'bookmarked', 'id', 'salary', 'responsibilities', 'requirements','working_period', 'benefits']
def name_position_validator(names):
for name in names.split(" "):
......
......@@ -60,6 +60,22 @@ class CreateAndUpdateVacancyTest(APITestCase):
vacancy = Vacancy.objects.first()
self.assertEqual(vacancy.responsibilities, 'new_vacancy')
def test_new_vacancy_with_benefits_success(self):
superuser = User.objects.create_superuser('dummy.company', 'dummy.company@company.com', 'lalala123')
new_company = Company.objects.create(user=superuser, description="lalalaz", status=Company.VERIFIED, logo=None,
address=None)
self.client.force_authenticate(user=superuser)
url = '/api/vacancies/'
response = self.client.post(url, {'company': new_company.pk, 'open_time': self.today,
'close_time': self.tomorrow, 'name': 'new vacancy',
'description': 'new_vacancy ', 'amount': 10, 'benefits':'new_vacancy', 'requirements': 'new_vacancy', 'working_period':'3 Bulan'}, format='json')
print(response)
self.assertEqual(response.status_code, status.HTTP_200_OK)
vacancy = Vacancy.objects.first()
self.assertEqual(vacancy.benefits, 'new_vacancy')
def test_new_vacancy_failed(self):
superuser = User.objects.create_superuser('dummy.company', 'dummy.company@company.com', 'lalala123')
new_company = Company.objects.create(user=superuser, description="lalalaz", status=Company.VERIFIED, logo=None,
......@@ -89,6 +105,21 @@ class CreateAndUpdateVacancyTest(APITestCase):
vacancies_count = Vacancy.objects.count()
self.assertEqual(vacancies_count, 0)
def test_new_vacancy_with_benefits_failed(self):
superuser = User.objects.create_superuser('dummy.company', 'dummy.company@company.com', 'lalala123')
new_company = Company.objects.create(user=superuser, description="lalalaz", status=Company.VERIFIED, logo=None,
address=None)
self.client.force_authenticate(user=superuser)
url = '/api/vacancies/'
response = self.client.post(url, {'company': new_company.pk, 'open_time': self.today,
'close_time': self.tomorrow, 'name': 'new_vacancy',
'description': 'new_vacancy ', 'amount': 'sepuluh', 'benefits':'new_vacancy', 'working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
vacancies_count = Vacancy.objects.count()
self.assertEqual(vacancies_count, 0)
def test_update_vacancy_success(self):
superuser = User.objects.create_superuser('dummy.company', 'dummy.company@company.com', 'lalala123')
new_company = Company.objects.create(user=superuser, description="lalalaz", status=Company.VERIFIED, logo=None,
......@@ -120,6 +151,23 @@ class CreateAndUpdateVacancyTest(APITestCase):
vacancy = Vacancy.objects.first()
self.assertEqual(vacancy.amount, 10)
def test_update_vacancy_with_benefits_success(self):
superuser = User.objects.create_superuser('dummy.company', 'dummy.company@company.com', 'lalala123')
new_company = Company.objects.create(user=superuser, description="lalalaz", status=Company.VERIFIED, logo=None,
address=None)
self.client.force_authenticate(user=superuser)
new_vacancy = Vacancy.objects.create(company=new_company, verified=False, open_time=self.today,
description="lalala", close_time=self.tomorrow, name='new_company')
url = '/api/vacancies/' + str(new_vacancy.pk) + '/'
response = self.client.patch(url, {'open_time': self.today, 'close_time': self.tomorrow, 'name': 'new_vacancy2', 'description': 'new_vacancy2', 'amount': 10, 'benefits':'new_vacancy2', 'responsibilities': 'new_vacancy2', 'requirements': 'new_vacancy', 'working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
vacancy = Vacancy.objects.first()
self.assertEqual(vacancy.benefits, 'new_vacancy2')
def test_update_vacancy_with_responsibilities_success(self):
superuser = User.objects.create_superuser('dummy.company', 'dummy.company@company.com', 'lalala123')
new_company = Company.objects.create(user=superuser, description="lalalaz", status=Company.VERIFIED, logo=None,
......@@ -208,7 +256,6 @@ class CreateAndUpdateVacancyTest(APITestCase):
description="lalala", close_time= self.tomorrow, name='new_company')
url = '/api/vacancies/' + str(new_vacancy.pk) + '/'
response = self.client.patch(url, {'open_time': self.today, 'close_time': self.today,
'name': 'new_vacancy2', 'description': 'new_vacancy2', 'requirements': 'new_vacancy2', 'working_period':'3 Bulan'}, format='json')
......@@ -232,6 +279,22 @@ class CreateAndUpdateVacancyTest(APITestCase):
vacancy = Vacancy.objects.first()
self.assertEqual(vacancy.amount, None)
def test_update_vacancy_with_benefits_failed(self):
superuser = User.objects.create_superuser('dummy.company', 'dummy.company@company.com', 'lalala123')
new_company = Company.objects.create(user=superuser, description="lalalaz", status=Company.VERIFIED, logo=None,
address=None)
self.client.force_authenticate(user=superuser)
new_vacancy = Vacancy.objects.create(company=new_company, verified=False, open_time=self.today,
description="lalala", close_time=self.tomorrow, name='new_company')
url = '/api/vacancies/' + str(new_vacancy.pk) + '/'
response = self.client.patch(url, {'open_time': self.today, 'close_time': self.tomorrow,'name': 'new_vacancy2', 'description': 'new_vacancy2', 'amount': 'sepuluh', 'benefits':'new_vacancy2', 'requirements': 'new_vacancy', 'working_period':'3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
vacancy = Vacancy.objects.first()
self.assertEqual(vacancy.benefits, '')
def test_update_vacancy_with_responsibilities_failed(self):
superuser = User.objects.create_superuser('dummy.company', 'dummy.company@company.com', 'lalala123')
new_company = Company.objects.create(user=superuser, description="lalalaz", status=Company.VERIFIED, logo=None,
......@@ -296,4 +359,3 @@ class CreateAndUpdateVacancyTest(APITestCase):
vacancy = Vacancy.objects.first()
self.assertEqual(vacancy.tag, VACANCY_TAG)
......@@ -775,6 +775,7 @@ class ValidationPositionNameinCreateLowonganKP(APITestCase):
def test_name_contains_only_alphabets(self):
self.payload["name"] = "Engineer"
self.payload["requirements" ] = "lalala"
response = self.client.post(
self.url,
......@@ -788,6 +789,7 @@ class ValidationPositionNameinCreateLowonganKP(APITestCase):
def test_name_contains_only_alphabets_and_spaces(self):
self.payload["name"] = "Software Engineer"
self.payload["requirements" ] = "lala la"
response = self.client.post(
self.url,
......
......@@ -105,6 +105,8 @@ class VacancyViewSet(MultiSerializerViewSetMixin, viewsets.ModelViewSet):
elif close_time == open_time:
raise ValidationError('Waktu tutup dan buka lowongan tidak boleh sama!')
vacancy = Vacancy(company=company, open_time=open_time, close_time=close_time, name=name, description=description, salary=salary, working_period=working_period, tag=tag)
if 'benefits' in data:
vacancy.benefits = data['benefits']
if 'amount' in data:
if isinstance(data['amount'], int):
vacancy.amount = data['amount']
......@@ -141,6 +143,8 @@ class VacancyViewSet(MultiSerializerViewSetMixin, viewsets.ModelViewSet):
vacancy.description = description
vacancy.working_period = working_period
vacancy.responsibilities = data.get('responsibilities')
if 'benefits' in data:
vacancy.benefits = data['benefits']
vacancy.requirements = requirements
if 'amount' in data:
if isinstance(data['amount'], int):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment