Fakultas Ilmu Komputer UI

Commit da6d08e3 authored by Arga Ghulam Ahmad's avatar Arga Ghulam Ahmad
Browse files

1606821601 169

parent 0791e848
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} />}
/>
......
......@@ -25,8 +25,8 @@ export default class CompanyProfile extends React.Component {
constructor(props) {
super(props);
let data = TopMenu.getInfo(this.props.user);
console.log("ASdasdadasda");
const data = TopMenu.getInfo(this.props.user);
console.log('ASdasdadasda');
console.log(data);
this.state = {
id: this.props.user.data.company.id,
......@@ -54,12 +54,12 @@ export default class CompanyProfile extends React.Component {
this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
Server.get(
`/companies/${this.state.id}/`
`/companies/${this.state.id}/`,
).then(
(result) => {
console.log("ASDADS");
this.setState({ linkedin_url : result.linkedin_url})
}
console.log('ASDADS');
this.setState({ linkedin_url: result.linkedin_url });
},
);
Server.get(
`/companies/${this.props.user.data.company.id}/vacancies/`,
......@@ -94,10 +94,9 @@ export default class CompanyProfile extends React.Component {
this.setState({ logo: result.logo });
}
},
(error) =>
error.then(() => {
this.state.name = 'Gagal mendapatkan informasi';
}),
(error) => error.then(() => {
this.state.name = 'Gagal mendapatkan informasi';
}),
);
}
......@@ -124,30 +123,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 +170,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 +258,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';
......@@ -118,11 +120,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 +150,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 +169,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 +192,8 @@ export default class CreateVacancy extends React.Component {
/>
<label htmlFor="benefits">
{' '}
<b> Keuntungan </b>{' '}
<b> Keuntungan </b>
{' '}
</label>
{!this.state.loading && (
<CKEditor
......@@ -201,7 +205,8 @@ export default class CreateVacancy extends React.Component {
<br />
<label htmlFor="requirements">
{' '}
<b> Persyaratan </b>{' '}
<b> Persyaratan </b>
{' '}
</label>
{!this.state.loading && (
<CKEditor
......
......@@ -158,15 +158,14 @@ 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';
}),
);
}
isFromGithubLinkValid = () => {
var github_link = this.state.form.github_url;
const github_link = this.state.form.github_url;
if (github_link == null) return;
return github_link.includes('https://github.com/');
};
......@@ -182,9 +181,9 @@ export default class EditProfile extends React.Component {
'07': 'Juli',
'08': 'Agustus',
'09': 'September',
'10': 'Oktober',
'11': 'November',
'12': 'Desember',
10: 'Oktober',
11: 'November',
12: 'Desember',
};
const dateIndexArray = dateIndex.split('-');
......@@ -198,10 +197,10 @@ export default class EditProfile extends React.Component {
if (!this.isFromGithubLinkValid()) {
this.modalAlert.open(
'Pembaharuan profil gagal',
'Pastikan link github yang anda tulis benar.(Berpola : https://github.com/<username>'
'Pastikan link github yang anda tulis benar.(Berpola : https://github.com/<username>',
);
} else {
var submitForm = {};
const submitForm = {};
Object.keys(this.state.form).forEach((key) => {
if (this.state.form[key] !== '') {
submitForm[key] = this.state.form[key];
......@@ -221,41 +220,40 @@ export default class EditProfile 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));
}),
);
}
};
handleFile = (e) => {
const form = this.state.form;
const { form } = this.state;
form[e.target.name] = e.target.files[0];
this.setState({ form });
};
handleChange = (e) => {
const form = this.state.form;
const { form } = this.state;
form[e.target.name] = e.target.value;
this.setState({ form });
};
handleCheckbox = (e, d) => {
const form = this.state.form;
const { form } = this.state;
form[d.name] = d.checked;
this.setState({ form, show_transcript: d.checked });
};
handleRadioGender = (e, { value }) => {
const form = this.state.form;
const { form } = this.state;
form.gender = value;
this.setState({ form });
};
handleRadio = (e, { value }) => {
const form = this.state.form;
const { form } = this.state;
form.job_seeking_status = value;
this.setState({ form });
};
......@@ -424,11 +422,11 @@ export default class EditProfile extends React.Component {
</Form.Field>
<Form.Field>
<label htmlFor="github_url">URL Profile Github</label>
<input
onChange={this.handleChange}
placeholder={this.state.github_url === null ? "https://github.com/bob" : this.state.github_url}
<input
onChange={this.handleChange}
placeholder={this.state.github_url === null ? 'https://github.com/bob' : this.state.github_url}
defaultValue={this.state.github_url === null ? null : this.state.github_url}
name="github_url"
name="github_url"
/>
</Form.Field>
<Form.Field>
......@@ -461,9 +459,9 @@ export default class EditProfile extends React.Component {
</Form.Field>
<Form.Field>
<label htmlFor="skills">Skills</label>
<input
onChange={this.handleChange}
placeholder="Isi sesuai dengan keahlian anda"
<input
onChange={this.handleChange}
placeholder="Isi sesuai dengan keahlian anda"
defaultValue={this.state.skills === null ? 'Competitive Programming' : this.state.skills}
name="skills"
/>
......
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { Grid, Segment, Header, Card, Image, Button } from 'semantic-ui-react';
import {
Grid, Segment, Header, Card, Image, Button,
} from 'semantic-ui-react';
import LoginForm from './components/LoginForm';
import CompanyRegisterModal from './components/CompanyRegisterModal';
import Footer from './components/Footer';
......@@ -26,7 +28,8 @@ const CompanyForm = ({ children, onChange }) => (
>
<Button primary onClick={() => onChange('user')}>
{' '}
Login as User{' '}
Login as User
{' '}
</Button>
</div>
</Segment>
......@@ -51,7 +54,8 @@ const UserForm = ({ children, onChange }) => (
>
<Button primary onClick={() => onChange('company')}>
{' '}
Login as Company{' '}
Login as Company
{' '}
</Button>
</div>
</Segment>
......
This diff is collapsed.
......@@ -30,27 +30,25 @@ export default class SupervisorPage extends React.Component {
});
}
render = () => {
return (
<Grid container columns="eleven" doubling>
<Grid.Row>
<br />
</Grid.Row>
<Grid.Row>
<Header as="h2">
<Icon name="list" />
render = () => (
<Grid container columns="eleven" doubling>
<Grid.Row>
<br />
</Grid.Row>
<Grid.Row>
<Header as="h2">
<Icon name="list" />
Daftar Mahasiswa
</Header>
</Grid.Row>
<Grid.Row>
<div id="layout-content" className="layout-content-wrapper">
<Pagination
url={'/applications/'}
child={<ApplicationList cols={cols} />}
/>
</div>
</Grid.Row>
</Grid>
);
};
</Header>
</Grid.Row>
<Grid.Row>
<div id="layout-content" className="layout-content-wrapper">
<Pagination
url="/applications/"
child={<ApplicationList cols={cols} />}
/>
</div>
</Grid.Row>
</Grid>
);
}
......@@ -13,16 +13,14 @@ export default class TranscriptPage extends React.Component {
super(props);
/* istanbul ignore next */
this.state = { text: 'Mohon Tunggu..' };
const url =
this.props.user.role === 'student'
? `/students/${this.props.params.id}/transcript/`
: `/applications/${this.props.params.id}/transcript/`;
const url = this.props.user.role === 'student'
? `/students/${this.props.params.id}/transcript/`
: `/applications/${this.props.params.id}/transcript/`;
Server.get(url).then(
(response) => this.setState({ data: response }),
() =>
this.setState({
text: 'Anda tidak berhak untuk melihat transkrip ini',
}),
() => this.setState({
text: 'Anda tidak berhak untuk melihat transkrip ini',
}),
);
}
......@@ -30,7 +28,11 @@ export default class TranscriptPage extends React.Component {
return this.state.data ? (
<CourseList data={this.state.data} />
) : (
<h5 style={{ textAlign: 'center' }}> {this.state.text} </h5>