Fakultas Ilmu Komputer UI

Commit 3ecfd274 authored by Reza Qorib's avatar Reza Qorib
Browse files

Merge branch 'Features/HomeDosen' into 'develop'

Features/home dosen

See merge request !21
parents 4b65b513 41c65d90
......@@ -244,6 +244,38 @@ card .formRegis{
margin-right: 10%;
}
.ui.segment.biodata-section{
background-color: white;
}
.ui.segment.biodata-section h1{
color: black;
}
.ui.segment.biodata-section h3{
color: black;
}
.ui.segment.biodata-section h4{
color: black;
}
.ui.segment.biodata-section h5{
color: black;
}
.ui.segments.biodataBorder{
border-color: transparent;
}
.transkrip{
color: black;
}
.ui.segment.biodata-section b{
color: white;
}
.admin-bar{
margin: 0;
padding: 0 10px 0 0;
......
import React from '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() {
return (
<Tabs selected={0}>
<Pane label="Lowongan Belum Terferivikasi" >
<Item.Group>
<AdminVacancy />
</Item.Group>
</Pane>
<Pane label=" Semua Lamaran" />
</Tabs>
);
}
}
......@@ -12,7 +12,6 @@ export default class Dashboard extends React.Component {
React.PropTypes.arrayOf(React.PropTypes.node),
React.PropTypes.node,
]).isRequired,
user: React.PropTypes.object.isRequired,
};
constructor(props) {
......@@ -23,8 +22,8 @@ export default class Dashboard extends React.Component {
render = () => (
<div>
<TopMenu user={this.props.user} />
<div className="content"> {this.props.children} </div>
<Footer />
{this.props.children}
</div>
)
}
import React from 'react';
import { Segment, Image, Header, Icon, Checkbox, Container, Button, Form } from 'semantic-ui-react';
import { Segment, Image, Header, Icon, Checkbox, Container, Button, Form, Grid } from 'semantic-ui-react';
import Server from './lib/Server';
import Storage from './lib/Storage';
import ModalAlert from './components/ModalAlert';
......@@ -168,29 +168,79 @@ export default class ProfilePage extends React.Component {
const defaultPicture = 'http://semantic-ui.com/images/wireframe/square-image.png';
return (
<div className="profilePage">
<Segment className="biodata-section">
<Header as="h2" icon textAlign="center">
<Image src={this.state.photo ? this.state.photo : defaultPicture} size="small" shape="circular" />
</Header>
<Container textAlign="center" className="profile-biodata">
<div className="biodata">
<h3> { this.state.name } </h3>
<h5> { this.state.major }, { this.state.batch } </h5>
<h5> { this.state.email } </h5>
<h5> { this.state.phone_number } </h5>
<h5> { this.state.cityOfBirth}, { this.state.dateOfBirth } </h5>
<p>Sudah diterima di { this.state.acceptedNo } perusahaan</p>
</div>
<div className="button-profile">
<a target="_blank" rel="noopener noreferrer" href={this.state.resume ? this.state.resume : '#'} >
<Button primary size="small">Resume</Button>
</a>
</div>
<div>
<br />
Bagikan Transkrip: <b>{ this.state.bagikanTranskrip ? 'Ya' : 'Tidak'}</b>
</div>
</Container>
<Segment className="biodata-section" >
<Grid>
<Grid.Column width={7}>
<Header as="h2" icon textAlign="center">
<br />
<Image src={this.state.photo || defaultPicture} size="medium" />
</Header>
</Grid.Column>
<Grid.Column width={6}>
<Container textAlign="left" className="profile-biodata">
<div className="biodata">
<Segment basic textAlign="center">
<h1> { this.state.name } </h1>
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<Icon name="university" size="big" />
</Grid.Column>
<Grid.Column width={13}>
<h3> { this.state.major }, { this.state.batch } </h3>
</Grid.Column>
</Grid>
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<Icon name="mail" size="big" />
</Grid.Column>
<Grid.Column width={13}>
<h3> { this.state.email } </h3>
</Grid.Column>
</Grid>
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<Icon name="phone" size="big" />
</Grid.Column>
<Grid.Column width={13}>
<h3> { this.state.phone_number }</h3>
</Grid.Column>
</Grid>
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<Icon name="gift" size="big" />
</Grid.Column>
<Grid.Column width={13}>
<h3> { this.state.cityOfBirth}, { this.state.dateOfBirth } </h3>
</Grid.Column>
</Grid>
</Segment>
</div>
<Container textAlign="center">
<div className="button-profile">
<a href={this.state.resume || '#'} ><Button primary size="small">Resume</Button></a>
</div>
<div>
<h4> Bagikan Transkrip : { this.state.bagikanTranskrip }</h4>
</div>
</Container>
</Container>
</Grid.Column >
</Grid>
</Segment >
{ this.updateForm(this.props.route.own) }
</div>
......
import React from 'react';
import { Header, Icon, Grid } from 'semantic-ui-react';
import Pagination from './components/Pagination';
import Server from './lib/Server';
import ApplicationList from './components/ApplicationList';
const cols = [
{ key: 'StudentName', label: 'Nama' },
{ key: 'StudentID', label: 'NPM' },
{ key: 'Perusahaan', label: 'Perusahaan' },
{ key: 'Posisi', label: 'Posisi' },
{ key: 'Status', label: 'Status' },
];
export default class SupervisorPage extends React.Component {
constructor(props) {
super(props);
/* istanbul ignore next */
this.state = { list: [] };
}
componentDidMount() {
this.UserList();
}
UserList() {
Server.get('/student-applications/', false).then((data) => {
this.setState({ list: data.results });
});
}
render = () => {
return (
<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={'/student-applications/'} child={<ApplicationList cols={cols} />} />
</div>
</Grid.Row>
</Grid>
);
}
}
import React from 'react';
import { Container, Item } from 'semantic-ui-react';
import { Container } from 'semantic-ui-react';
import Tabs from './components/Tabs';
import Pane from './components/Pane';
import VacancyList from './components/VacancyList';
import AdminVacancy from './components/AdminVacancy';
import Pagination from './components/Pagination';
export default class VacancyPage extends React.Component {
......@@ -18,7 +17,7 @@ export default class VacancyPage extends React.Component {
return user.data.student.id;
} else if (role === 'company' || (role === 'admin' && user.data.company != null)) {
return user.data.company.id;
} else if (role === 'supervisor' || role === 'admin' && user.data.supervisor != null){
} else if (role === 'supervisor' || (role === 'admin' && user.data.supervisor != null)) {
return user.data.supervisor.id;
}
......@@ -80,7 +79,8 @@ export default class VacancyPage extends React.Component {
</Pane>
</Tabs>
);
} else if (this.props.user.role === 'company') {
} else if ((this.props.user.role === 'admin' && this.props.user.data.company != null)
|| this.props.user.role === 'company') {
return (
<Container className="vacancies">
<Pagination
......@@ -116,7 +116,7 @@ export default class VacancyPage extends React.Component {
<Pane label="Lowongan Terverifikasi" >
<Pagination
key={2}
url={`/vacancies/?verified=true`}
url="/vacancies/?verified=true"
child={
<VacancyList
user={this.props.user}
......
......@@ -90,7 +90,28 @@ describe('Dashboard', () => {
email: '',
is_staff: false,
company: null,
supervisor: null,
supervisor: {
id: 3,
user: {
url: 'http://localhost:8000/api/users/9/',
username: 'muhammad.reza42',
email: 'muhammad.reza42@ui.ac.id',
is_staff: false,
},
name: 'Muhammad R.',
created: '2017-03-28T13:33:46.147241Z',
updated: '2017-03-28T13:33:46.148248Z',
npm: 1406543593,
resume: null,
phone_number: null,
bookmarked_vacancies: [
3,
],
applied_vacancies: [
3,
1,
],
},
student: null,
},
};
......
import React from 'react';
import ReactTestUtils from 'react-addons-test-utils';
import fetchMock from 'fetch-mock';
import SupervisorPage from '../SupervisorPage';
describe('SupervisorPage', () => {
const data = {
count: 5,
next: null,
previous: null,
results: [
{
company_name: 'Tutuplapak',
name: 'Joshua Casey Darian Gunawan',
npm: 1406622616,
vacancy_name: 'Software Engineer',
status: 'accepted',
},
{
company_name: 'Tutuplapak',
name: 'Muhammad Reza Qorib',
npm: 1406543593,
vacancy_name: 'Software Engineer',
status: 'accepted',
},
{
company_name: 'Tutuplapak',
name: 'Muhammad Reza Qorib',
npm: 1406543593,
vacancy_name: 'Kepala Sekolah',
status: 'read',
},
{
company_name: 'company1',
name: 'Farhan Farasdak',
npm: 1406572321,
vacancy_name: 'Data Scientist',
status: 'new',
},
{
company_name: 'company1',
name: 'student2',
npm: 1406527513,
vacancy_name: 'Data Scientist',
status: 'new',
},
],
};
fetchMock.get('*', data);
it('renders for admin without problem', () => {
const supervisorPage = ReactTestUtils.renderIntoDocument(
<SupervisorPage />);
expect(supervisorPage).to.exist;
fetchMock.restore();
});
});
......@@ -4,7 +4,7 @@ import ReactTestUtils from 'react-addons-test-utils';
import AdminVacancy from '../../components/AdminVacancy';
import Storage from '../../lib/Storage';
describe('Vacancy', () => {
describe('AdminVacancy', () => {
const fetchMock = require('fetch-mock');
const response = {
close_time: '2019-03-28T05:55:42Z',
......@@ -78,7 +78,6 @@ describe('Vacancy', () => {
},
};
it('renders for verified without problem', () => {
const lowongan = ReactTestUtils.renderIntoDocument(
<AdminVacancy status={4} data={response} />);
......
import React from 'react';
import ReactTestUtils from 'react-addons-test-utils';
import AdminVerificationModal from '../../components/AdminVerificationModal';
describe('AdminVerificationModal', () => {
it('renders without problem', () => {
const modalAdmin = ReactTestUtils.renderIntoDocument(
<AdminVerificationModal />);
expect(modalAdmin).to.exist;
});
it('close without problem', () => {
const modalAdmin = ReactTestUtils.renderIntoDocument(
<AdminVerificationModal />);
modalAdmin.handleClose();
expect(modalAdmin.state.modalOpen).to.equal(false);
});
it('open without problem', () => {
const modalAdmin = ReactTestUtils.renderIntoDocument(
<AdminVerificationModal />);
modalAdmin.handleOpen();
expect(modalAdmin.state.modalOpen).to.equal(true);
});
});
import React from 'react';
import ReactTestUtils from 'react-addons-test-utils';
import Footer from '../../components/Footer';
describe('Footer', () => {
it('renders without problem', () => {
const footer = ReactTestUtils.renderIntoDocument(
<Footer params={{ id: 1 }} />);
expect(footer).to.exist;
});
});
......@@ -119,7 +119,28 @@ describe('TopMenu', () => {
email: '',
is_staff: false,
company: null,
supervisor: null,
supervisor: {
id: 3,
user: {
url: 'http://localhost:8000/api/users/9/',
username: 'muhammad.reza42',
email: 'muhammad.reza42@ui.ac.id',
is_staff: false,
},
name: 'Muhammad R.',
created: '2017-03-28T13:33:46.147241Z',
updated: '2017-03-28T13:33:46.148248Z',
npm: 1406543593,
resume: null,
phone_number: null,
bookmarked_vacancies: [
3,
],
applied_vacancies: [
3,
1,
],
},
student: null,
},
};
......
......@@ -75,7 +75,7 @@ describe('VacancyList', () => {
};
const studentUser = {
role: 'company',
role: 'student',
data: {
url: 'http://localhost:8001/api/users/8/',
username: 'Tutuplapak',
......@@ -109,6 +109,8 @@ describe('VacancyList', () => {
1,
],
},
company: null,
supervisor: null,
},
};
......@@ -255,6 +257,38 @@ describe('VacancyList', () => {
},
];
const response = [{
close_time: '2019-03-28T05:55:42Z',
company: {
address: 'kebayoran baru',
id: 1,
logo: null,
name: 'tutup lapak',
},
created: '2017-03-28T07:05:47.128672Z',
description: 'Lorem ipsum dolbh.',
id: 1,
name: 'Software Engineer',
open_time: '2017-03-28T05:55:38Z',
updated: '2017-03-28T07:34:13.122093Z',
verified: true,
}, {
close_time: '2019-03-28T05:55:42Z',
company: {
address: 'kebayoran baru',
id: 2,
logo: null,
name: 'tutup lapak',
},
created: '2017-03-28T07:05:47.128672Z',
description: 'Lorem ipsum dolbh.',
id: 2,
name: 'Software Engineer',
open_time: '2017-03-28T05:55:38Z',
updated: '2017-03-28T07:34:13.122093Z',
verified: true,
}];
const response2 = [{
close_time: '2019-03-28T05:55:42Z',
company: {
......@@ -275,12 +309,14 @@ describe('VacancyList', () => {
it('renders without problem', () => {
const vacancyList = ReactTestUtils.renderIntoDocument(
<VacancyList items={newResponse} userId={1} user={studentUser} />);
vacancyList.generateVacancies();
expect(vacancyList).to.exist;
});
it('renders without problem for company', () => {
const vacancyList = ReactTestUtils.renderIntoDocument(
<VacancyList items={newResponse} userId={1} user={companyUser} />);
vacancyList.generateVacancies();
vacancyList.state.vacancies = newResponse;
expect(vacancyList.generateVacancies()).to.exist;
});
......@@ -296,90 +332,37 @@ describe('VacancyList', () => {
const vacancyList = ReactTestUtils.renderIntoDocument(
<VacancyList items={newResponse} userId={3} user={supervisorUser} />);
vacancyList.state.vacancies = newResponse;
vacancyList.updateStatus(4,1);
vacancyList.updateStatus(4, 1);
});
// it('renders with problem for company', () => {
// const vacancyList = ReactTestUtils.renderIntoDocument(
// <VacancyList type="company" userId={1} url="test" />);
// vacancyList.state.vacancies = response;
// expect(vacancyList.generateVacancies()).to.exist;
// });
//
// it('update bookmarks without problem', () => {
// const vacancyList = ReactTestUtils.renderIntoDocument(
// <VacancyList userId={1} url="test" />);
// vacancyList.state.appliedList = [{ id: 1 }, { id: 3 }];
// vacancyList.updateStatusList().then(() => {
// expect(JSON.stringify(vacancyList.state.bookmarkList)).to.be.defined;
// });
// });
//
// it('check applied vacancies without problem', () => {
// const vacancyList = ReactTestUtils.renderIntoDocument(
// <VacancyList userId={1} url="test" />);
// vacancyList.updateStatusList().then(() => {
// expect(JSON.stringify(vacancyList.state.bookmarkList)).to.be.defined;
// });
// });
//
// it('renders marked bookmarked vacancies without problem', (done) => {
// const vacancyList = ReactTestUtils.renderIntoDocument(
// <VacancyList userId={1} url="test" />);
// vacancyList.state.vacancies = response;
// vacancyList.state.bookmarkList = [{ id: 5 }, { id: 3 }, { id: 1 }];
// vacancyList.updateStatusList().then(() => {
// expect(vacancyList.generateVacancies()).to.exist;
// done();
// }, () => done());
// });
//
// it('renders not marked vacancies without problem', () => {
// fetchMock.get('*', response);
// const vacancyList = ReactTestUtils.renderIntoDocument(
// <VacancyList userId={1} url="test" />);
// vacancyList.state.vacancies = response;
// vacancyList.state.bookmarkList = [{ id: 6 }, { id: 4 }, { id: 2 }];
// expect(vacancyList.generateVacancies()).to.exist;
// fetchMock.restore();
// });
//
// it('success calling API', () => {
// fetchMock.get('*', response);
// const vacancyList = ReactTestUtils.renderIntoDocument(
// <VacancyList userId={1} url="test" />);
// vacancyList.state.vacancies = response;
// expect(JSON.stringify(vacancyList.state.vacancies)).to.equal(JSON.stringify(response));
// fetchMock.restore();
// });
//
it('success delete vacancy', () => {