Fakultas Ilmu Komputer UI

Commit da44dc59 authored by I Gusti Agung Nanda Dharma Wangsa's avatar I Gusti Agung Nanda Dharma Wangsa
Browse files

Merge branch 'master' into '1606917720-168'

# Conflicts:
#   assets/js/components/GeneralModal.jsx
parents 88340725 ae2b0b11
Pipeline #26561 passed with stages
in 5 minutes and 55 seconds
{
"extends": "airbnb",
"extends": ["airbnb", "prettier"],
"env": {
"amd": true,
"browser": true,
......@@ -14,12 +14,12 @@
"react/no-multi-comp": [0, { "ignoreStateless": 1 }],
"import/extensions": ["off", "never"],
"import/no-unresolved": 0,
"no-underscore-dangle" : 0,
"linebreak-style" : 0,
"no-extra-bind" : 0
"no-underscore-dangle": 0,
"linebreak-style": 0,
"no-extra-bind": 0
},
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module"
}
}
\ No newline at end of file
}
import React from 'react';
import { Item } from 'semantic-ui-react';
import Tabs from './components/Tabs';
import Pane from './components/Pane';
import AdminVacancy from './components/AdminVacancy';
import { Item } from 'semantic-ui-react';
export default class AdminVacancyPage extends React.Component {
render() {
......
......@@ -29,45 +29,43 @@ export default class ApplicantPage extends React.Component {
this.getVacancyList();
}
getVacancyList = () =>
Server.get(
`/companies/${this.props.user.data.company.id}/vacancies/`,
false,
).then(
(data) => {
const results = data.results;
const urls = [
{
key: 0,
value: `/companies/${this.props.user.data.company.id}/applications/`,
text: 'Semua Lowongan',
},
];
results.map((vacancy) => {
names.push(vacancy.name);
const url = `/companies/${this.props.user.data.company.id}/applications/${vacancy.id}/by_vacancy/`;
const info = {
key: vacancy.id,
value: url,
text: vacancy.name,
};
urls.push(info);
return urls;
});
this.setState({ urls });
},
(error) =>
error.then((r) => {
this.modalAlert.open('Gagal mendapatkan daftar lowongan', r.detail);
}),
);
getVacancyList = () => Server.get(
`/companies/${this.props.user.data.company.id}/vacancies/`,
false,
).then(
(data) => {
const { results } = data;
const urls = [
{
key: 0,
value: `/companies/${this.props.user.data.company.id}/applications/`,
text: 'Semua Lowongan',
},
];
results.map((vacancy) => {
names.push(vacancy.name);
const url = `/companies/${this.props.user.data.company.id}/applications/${vacancy.id}/by_vacancy/`;
const info = {
key: vacancy.id,
value: url,
text: vacancy.name,
};
urls.push(info);
return urls;
});
this.setState({ urls });
},
(error) => error.then((r) => {
this.modalAlert.open('Gagal mendapatkan daftar lowongan', r.detail);
}),
);
handleChange = (e, data) => {
this.setState({ selected: data.value, refresh: this.state.refresh + 6 });
};
render() {
const company = this.props.user.data.company;
const { company } = this.props.user.data;
return (
<div>
<div className="dropdownApplicant">
......@@ -84,78 +82,78 @@ export default class ApplicantPage extends React.Component {
key={0 + this.state.refresh}
url={`${this.state.selected}`}
label="Semua Lamaran"
child={
child={(
<ApplicantList
companyId={company.id}
status={Applicant.APPLICATION_STATUS.ALL}
/>
}
)}
/>
<Pagination
key={1 + this.state.refresh}
url={`${this.state.selected}?status=${Applicant.APPLICATION_STATUS.NEW}`}
label="Lamaran Baru"
child={
child={(
<ApplicantList
companyId={company.id}
status={Applicant.APPLICATION_STATUS.NEW}
/>
}
)}
/>
<Pagination
key={2 + this.state.refresh}
url={`${this.state.selected}?status=${Applicant.APPLICATION_STATUS.READ}`}
label="Lamaran Dibaca"
child={
child={(
<ApplicantList
companyId={company.id}
status={Applicant.APPLICATION_STATUS.READ}
/>
}
)}
/>
<Pagination
key={3 + this.state.refresh}
url={`${this.state.selected}?status=${Applicant.APPLICATION_STATUS.BOOKMARKED}`}
label="Lamaran Ditandai"
child={
child={(
<ApplicantList
companyId={company.id}
status={Applicant.APPLICATION_STATUS.BOOKMARKED}
/>
}
)}
/>
<Pagination
key={4 + this.state.refresh}
url={`${this.state.selected}?status=${Applicant.APPLICATION_STATUS.ACCEPTED}`}
label="Lamaran Diterima"
child={
child={(
<ApplicantList
companyId={company.id}
status={Applicant.APPLICATION_STATUS.ACCEPTED}
/>
}
)}
/>
<Pagination
key={5 + this.state.refresh}
url={`${this.state.selected}?status=${Applicant.APPLICATION_STATUS.REJECTED}`}
label="Lamaran Ditolak"
child={
child={(
<ApplicantList
companyId={company.id}
status={Applicant.APPLICATION_STATUS.REJECTED}
/>
}
)}
/>
<Pagination
key={6 + this.state.refresh}
url={`${this.state.selected}?status=${Applicant.APPLICATION_STATUS.FINISHED}`}
label="Lamaran Selesai"
child={
child={(
<ApplicantList
companyId={company.id}
status={Applicant.APPLICATION_STATUS.FINISHED}
/>
}
)}
/>
</Tabs>
</div>
......
......@@ -47,7 +47,7 @@ export default class CompanyPage extends React.Component {
/>
<Pagination
key={4}
url={'/companies/'}
url="/companies/"
label="Semua Perusahaan"
child={<CompanyList status={Company.COMPANY_STATUS.ALL} />}
/>
......
import React from 'react';
import PropTypes from 'prop-types';
import {
Segment,
Header,
Image,
Container,
Form,
Button,
Icon,
TextArea,
Segment, Header, Image, Container, Form, Button, Icon, TextArea,
} from 'semantic-ui-react';
import { Doughnut } from 'react-chartjs-2';
import TopMenu from './components/TopMenu';
import Server from './lib/Server';
import Dumper from './lib/Dumper';
import ModalAlert from './components/ModalAlert';
export default class CompanyProfile extends React.Component {
static propTypes = {
route: PropTypes.object.isRequired,
params: PropTypes.object.isRequired,
user: PropTypes.object.isRequired,
};
constructor(props) {
super(props);
let data = TopMenu.getInfo(this.props.user);
console.log("ASdasdadasda");
console.log(data);
this.state = {
id: this.props.user.data.company.id,
name: data.name,
address: data.address,
category: data.category,
description: data.description,
website: data.website,
logo: data.logo,
size: data.size,
linkedin_url: data.linkedin_url,
name: this.props.user.data.company.name,
address: this.props.user.data.company.address,
category: this.props.user.data.company.category,
description: this.props.user.data.company.description,
website: this.props.user.data.company.website,
logo: this.props.user.data.company.logo,
size: this.props.user.data.company.size,
linkedin_url: this.props.user.data.company.linkedin_url,
loading: false,
form: {
name: '',
......@@ -53,32 +40,21 @@ export default class CompanyProfile extends React.Component {
this.getProfile = this.getProfile.bind(this);
this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
Server.get(
`/companies/${this.state.id}/`
).then(
(result) => {
console.log("ASDADS");
this.setState({ linkedin_url : result.linkedin_url})
}
);
Server.get(
`/companies/${this.props.user.data.company.id}/vacancies/`,
false,
).then((result) => {
this.setState({ vacancies: result.results });
});
Server.get(
`/companies/${this.props.user.data.company.id}/applications/`,
false,
).then((result) => {
this.setState({ applications: result.results });
});
},
(error) => error.then(() => {
console.log(error);
}));
}
getProfile() {
return Server.get(`/companies/${this.state.id}/`).then(
(result) => {
console.log(result);
this.setState({
name: result.name,
address: result.address,
......@@ -89,15 +65,13 @@ export default class CompanyProfile extends React.Component {
website: result.website,
size: result.size,
linkedin_url: result.linkedin_url,
logo: result.logo,
});
if (result.logo != '') {
this.setState({ logo: result.logo });
}
},
(error) =>
error.then(() => {
this.state.name = 'Gagal mendapatkan informasi';
}),
(error) => error.then(() => {
this.state.name = 'Gagal mendapatkan informasi';
console.log(error);
}),
);
}
......@@ -124,30 +98,27 @@ export default class CompanyProfile extends React.Component {
this.getProfile,
);
},
(error) =>
error.then((r) => {
this.setState({ loading: false });
this.modalAlert.open('Pembaharuan profil gagal', Dumper.dump(r));
}),
(error) => error.then((r) => {
this.setState({ loading: false });
this.modalAlert.open('Pembaharuan profil gagal', Dumper.dump(r));
}),
);
};
handleChange = (e) => {
const form = this.state.form;
const { form } = this.state;
form[e.target.name] = e.target.value;
this.setState({ form });
};
render() {
const defaultLogo =
'https://semantic-ui.com/images/wireframe/square-image.png';
const defaultLogo = 'https://semantic-ui.com/images/wireframe/square-image.png';
const { applications } = this.state;
const rejectedApplications = applications.filter((apl) => apl.status === 3)
.length;
const acceptedApplications = applications.filter((apl) => apl.status === 4)
.length;
const sisaApplications =
applications.length - rejectedApplications - acceptedApplications;
const sisaApplications = applications.length - rejectedApplications - acceptedApplications;
const chartData = {
labels: ['Lamaran Ditolak', 'Lamaran Diterima', 'Lamaran Pending'],
......@@ -174,14 +145,22 @@ export default class CompanyProfile extends React.Component {
<h2>{this.state.name}</h2>
<h3>{this.state.address}</h3>
<p>
{this.state.category} - {this.state.description}
{this.state.category}
{' '}
-
{this.state.description}
</p>
<p>{this.state.website}</p>
<p>{this.state.size} karyawan</p>
<p>
{this.state.size}
{' '}
karyawan
</p>
{this.state.linkedin_url ? (
<a href={this.state.linkedin_url}>
{' '}
{this.state.linkedin_url}{' '}
{this.state.linkedin_url}
{' '}
</a>
) : (
<p> Belum ada link LinkedIn</p>
......@@ -254,7 +233,7 @@ export default class CompanyProfile extends React.Component {
size="small"
onChange={this.handleChange}
defaultValue={
this.state.size === null ? "0" : this.state.size
this.state.size === null ? '0' : this.state.size
}
/>
</Form.Field>
......
import React from 'react';
import PropTypes from 'prop-types';
import { Segment, Button, Form, Header, Icon, Input } from 'semantic-ui-react';
import {
Segment, Button, Form, Header, Icon, Input,
} from 'semantic-ui-react';
import { browserHistory } from 'react-router';
import DatePicker from 'react-datepicker';
import moment from 'moment';
......@@ -40,6 +42,7 @@ export default class CreateVacancy extends React.Component {
requirements: '',
salary: 0,
tag: '',
responsibilities: '',
};
if (this.state.vacancyId) {
......@@ -97,6 +100,7 @@ export default class CreateVacancy extends React.Component {
const data = {};
data.name = this.state.name;
data.tag = this.state.tag;
data.responsibilities = this.state.responsibilities;
data.description = this.state.description;
data.benefits = this.state.benefits;
data.requirements = this.state.requirements;
......@@ -118,11 +122,10 @@ export default class CreateVacancy extends React.Component {
() => {
browserHistory.push('/lowongan');
},
(error) =>
error.then((r) => {
this.modalAlert.open('Gagal Membuat Lowongan', r.error);
this.setState({ formLoading: false });
}),
(error) => error.then((r) => {
this.modalAlert.open('Gagal Membuat Lowongan', r.error);
this.setState({ formLoading: false });
}),
);
};
......@@ -149,7 +152,8 @@ export default class CreateVacancy extends React.Component {
/>
<label htmlFor="description">
{' '}
<b> Deskripsi Lowongan </b>{' '}
<b> Deskripsi Lowongan </b>
{' '}
</label>
{!this.state.loading && (
<CKEditor
......@@ -167,7 +171,8 @@ export default class CreateVacancy extends React.Component {
/>
<label htmlFor="responsibilities">
{' '}
<b> Tanggung Jawab Lowongan </b>{' '}
<b> Tanggung Jawab Lowongan </b>
{' '}
</label>
{!this.state.loading && (
<CKEditor
......@@ -189,7 +194,8 @@ export default class CreateVacancy extends React.Component {
/>
<label htmlFor="benefits">
{' '}
<b> Keuntungan </b>{' '}
<b> Keuntungan </b>
{' '}
</label>
{!this.state.loading && (
<CKEditor
......@@ -201,7 +207,8 @@ export default class CreateVacancy extends React.Component {
<br />
<label htmlFor="requirements">
{' '}
<b> Persyaratan </b>{' '}
<b> Persyaratan </b>
{' '}
</label>
{!this.state.loading && (
<CKEditor
......
......@@ -2,7 +2,6 @@ import React from 'react';
import PropTypes from 'prop-types';
import {
Segment,
Image,
Header,
Icon,
Checkbox,
......@@ -13,6 +12,7 @@ import Server from './lib/Server';
import Storage from './lib/Storage';
import ModalAlert from './components/ModalAlert';
import Dumper from './lib/Dumper';
import { isFromGithubLinkValid } from './Utils';
export default class EditProfile extends React.Component {
static propTypes = {
......@@ -26,26 +26,14 @@ export default class EditProfile extends React.Component {
/* istanbul ignore next */
this.state = {
id: '',
npm: '',
name: '',
major: '',
batch: '',
email: '',
gender: '',
region: '',
alamat: '',
cityOfBirth: '',
dateOfBirth: '',
resume: '',
phone_number: '',
portfolio_link: '',
show_transcript: '',
photo: '',
age: '',
intro: '',
expected_salary: '',
job_seeking_status: '',
volunteer: '',
skills: '',
form: {
picture: '',
......@@ -71,15 +59,12 @@ export default class EditProfile extends React.Component {
seminar: '',
interests: '',
},
bagikanTranskrip: '',
acceptedNo: 0,
readNo: 0,
refresh: 1,
loading: false,
linkedin_url: '',
hackerrank_url: '',
self_description: '',
student_gpa: 0.0,
student_toefl: 0,
website_url: '',
latest_work: '',
latest_work_desc: '',
......@@ -97,9 +82,6 @@ export default class EditProfile extends React.Component {
this.handleCheckbox = this.handleCheckbox.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
this.handleFile = this.handleFile.bind(this);
this.gotoLink = this.gotoLink.bind(this);
this.gotoStudentResume = this.gotoStudentResume.bind(this);
this.gotoStudentTranscript = this.gotoStudentTranscript.bind(this);
this.getProfile();
}
......@@ -112,33 +94,18 @@ export default class EditProfile extends React.Component {
this.setState({
id: data.id,
name: data.full_name,
npm: data.npm,
resume: data.resume,
major: data.major,
batch: data.batch,
email: data.user.email,
gender: data.gender,
region: data.region,
alamat: data.alamat,
cityOfBirth: data.birth_place,
dateOfBirth: this.parseIndonesianDateFormat(data.birth_date),
phone_number: data.phone_number,
portfolio_link: data.portfolio_link,
photo: data.photo,
show_transcript: data.show_transcript,
acceptedNo: data.accepted_no,
readNo: data.read_no,
bagikanTranskrip: data.show_transcript,
refresh: this.state.refresh + 1,
age: data.age,
intro: data.intro,
expected_salary: data.expected_salary,
job_seeking_status: data.job_seeking_status,
volunteer: data.volunteer,
linkedin_url: data.linkedin_url,
hackerrank_url: data.hackerrank_url,
self_description: data.self_description,
student_gpa: data.student_gpa,
student_toefl: data.student_toefl,
website_url: data.website_url,
latest_work: data.latest_work,
latest_work_desc: data.latest_work_desc,
......@@ -158,19 +125,12 @@ export default class EditProfile extends React.Component {
window.scrollTo(0, 0);
}
},
(error) =>
error.then(() => {
this.state.name = 'Gagal mendapatkan informasi';
}),
(error) => error.then(() => {
this.state.name = 'Gagal mendapatkan informasi';
}),
);