diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000000000000000000000000000000000000..f208ee05f65770d46c7c9b0328727940fd63623c --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "trailingComma": "all", + "singleQuote": true, + "arrowParens": "always" +} diff --git a/assets/js/AdminVacancyPage.jsx b/assets/js/AdminVacancyPage.jsx index 55f70ae56522faba1830f97a8dc3f97eea6b5162..c9cabc858b9e2579cee32a4461998d253bb5305b 100755 --- a/assets/js/AdminVacancyPage.jsx +++ b/assets/js/AdminVacancyPage.jsx @@ -4,13 +4,11 @@ import Pane from './components/Pane'; import AdminVacancy from './components/AdminVacancy'; import { Item } from 'semantic-ui-react'; - export default class AdminVacancyPage extends React.Component { - render() { return ( - + diff --git a/assets/js/ApplicantPage.jsx b/assets/js/ApplicantPage.jsx index 4b3e29fbd00d399094f4f1d535d5db593e4d1350..50c444fb8e04f4645a1424bb10c8828ce7844dbd 100755 --- a/assets/js/ApplicantPage.jsx +++ b/assets/js/ApplicantPage.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import { Dropdown } from 'semantic-ui-react'; import Tabs from './components/Tabs'; import ApplicantList from './components/ApplicantList'; @@ -8,7 +9,7 @@ import Server from './lib/Server'; export default class ApplicantPage extends React.Component { static propTypes = { - user: React.PropTypes.object.isRequired, + user: PropTypes.object.isRequired, }; constructor(props) { @@ -29,7 +30,10 @@ export default class ApplicantPage extends React.Component { } getVacancyList = () => - Server.get(`/companies/${this.props.user.data.company.id}/vacancies/`, false).then( + Server.get( + `/companies/${this.props.user.data.company.id}/vacancies/`, + false, + ).then( (data) => { const results = data.results; const urls = [ @@ -52,7 +56,7 @@ export default class ApplicantPage extends React.Component { }); this.setState({ urls }); }, - error => + (error) => error.then((r) => { this.modalAlert.open('Gagal mendapatkan daftar lowongan', r.detail); }), @@ -81,7 +85,10 @@ export default class ApplicantPage extends React.Component { url={`${this.state.selected}`} label="Semua Lamaran" child={ - + } /> + } /> + } /> window.open('/admin/'); @@ -17,7 +17,13 @@ export default class CompanyPage extends React.Component { return (
-
@@ -25,33 +31,25 @@ export default class CompanyPage extends React.Component { key={1} url={`/companies/?status=${Company.COMPANY_STATUS.NEW}`} label="Belum Diverifikasi" - child={ - - } + child={} /> - } + child={} /> - } + child={} /> - } + child={} />
diff --git a/assets/js/CompanyProfile.jsx b/assets/js/CompanyProfile.jsx index 2e361f68381644396f8b9f1e79ba845f25475d67..5ba41057ad05093770b2a27fb783ddad278ac446 100755 --- a/assets/js/CompanyProfile.jsx +++ b/assets/js/CompanyProfile.jsx @@ -1,17 +1,26 @@ import React from 'react'; -import { Segment, Header, Image, Container, Form, Button, Icon, TextArea } from 'semantic-ui-react'; -import TopMenu from './components/TopMenu'; +import PropTypes from 'prop-types'; +import { + 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: React.PropTypes.object.isRequired, - params: React.PropTypes.object.isRequired, - user: React.PropTypes.object.isRequired, + route: PropTypes.object.isRequired, + params: PropTypes.object.isRequired, + user: PropTypes.object.isRequired, }; constructor(props) { @@ -39,25 +48,41 @@ 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.props.user.data.company.id}/vacancies/`, false).then((result) => { + 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) => { + Server.get( + `/companies/${this.props.user.data.company.id}/applications/`, + false, + ).then((result) => { this.setState({ applications: result.results }); }); } getProfile() { - return Server.get(`/companies/${this.state.id}/`).then((result) => { - this.setState({name:result.name, address:result.address, category:result.category, id:result.id, - description:result.description, refresh: this.state.refresh + 1, website:result.website - }); - if(result.logo != '') { - this.setState({logo: result.logo}); - } - }, error => error.then(() => { - this.state.name = 'Gagal mendapatkan informasi'; - })); + return Server.get(`/companies/${this.state.id}/`).then( + (result) => { + this.setState({ + name: result.name, + address: result.address, + category: result.category, + id: result.id, + description: result.description, + refresh: this.state.refresh + 1, + website: result.website, + }); + if (result.logo != '') { + this.setState({ logo: result.logo }); + } + }, + (error) => + error.then(() => { + this.state.name = 'Gagal mendapatkan informasi'; + }), + ); } handleSubmit = (e) => { @@ -70,13 +95,25 @@ export default class CompanyProfile extends React.Component { } }); this.setState({ loading: true }); - Server.submit(`/companies/${this.state.id}/profile/`, submitForm, 'PATCH').then(() => { - this.setState({ loading: false }); - this.modalAlert.open('Profil berhasil diperbaharui', 'Silakan periksa kembali profil anda', this.getProfile); - }, error => error.then((r) => { - this.setState({ loading: false }); - this.modalAlert.open('Pembaharuan profil gagal', Dumper.dump(r)); - })); + Server.submit( + `/companies/${this.state.id}/profile/`, + submitForm, + 'PATCH', + ).then( + () => { + this.setState({ loading: false }); + this.modalAlert.open( + 'Profil berhasil diperbaharui', + 'Silakan periksa kembali profil anda', + this.getProfile, + ); + }, + (error) => + error.then((r) => { + this.setState({ loading: false }); + this.modalAlert.open('Pembaharuan profil gagal', Dumper.dump(r)); + }), + ); }; handleChange = (e) => { @@ -86,44 +123,44 @@ export default class CompanyProfile extends React.Component { }; 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 rejectedApplications = applications.filter((apl) => apl.status === 3) + .length; + const acceptedApplications = applications.filter((apl) => apl.status === 4) + .length; + const sisaApplications = + applications.length - rejectedApplications - acceptedApplications; const chartData = { - labels: [ - 'Lamaran Ditolak', - 'Lamaran Diterima', - 'Lamaran Pending', + labels: ['Lamaran Ditolak', 'Lamaran Diterima', 'Lamaran Pending'], + datasets: [ + { + data: [rejectedApplications, acceptedApplications, sisaApplications], + backgroundColor: ['#FF6384', '#36A2EB', '#FFCE56'], + hoverBackgroundColor: ['#FF6384', '#36A2EB', '#FFCE56'], + }, ], - datasets: [{ - data: [rejectedApplications, acceptedApplications, sisaApplications], - backgroundColor: [ - '#FF6384', - '#36A2EB', - '#FFCE56', - ], - hoverBackgroundColor: [ - '#FF6384', - '#36A2EB', - '#FFCE56', - ], - }], - } + }; return (
- +
- +
-

{ this.state.name }

-

{ this.state.address }

-

{ this.state.category } - { this.state.description }

-

{ this.state.website }

+

{this.state.name}

+

{this.state.address}

+

+ {this.state.category} - {this.state.description} +

+

{this.state.website}

@@ -135,35 +172,76 @@ export default class CompanyProfile extends React.Component {
- - Edit Profile Page - + Edit Profile Page
- { this.modalAlert = modal; }} /> -
{ this.form = input; }} key={this.state.refresh} onSubmit={this.handleSubmit}> + { + this.modalAlert = modal; + }} + /> + { + this.form = input; + }} + key={this.state.refresh} + onSubmit={this.handleSubmit} + > - + - + -