Fakultas Ilmu Komputer UI

Commit 9c0dbe3a authored by M. Reza Qorib's avatar M. Reza Qorib
Browse files

[#140654507] #13 Add apply vacancy and bookmark vacancy

parent 86332029
......@@ -10,7 +10,7 @@ export default class companyRegister extends React.Component {
<div className="registerForm">
<Card fluid >
<Card.Content>
<Form>
<form encType="multipart/form-data" action="">
<Header as='h2' icon textAlign='center'>
<Icon name='signup' circular />
<Header.Content>
......@@ -36,7 +36,7 @@ export default class companyRegister extends React.Component {
</Form.Field>
<Form.Field required>
<label>Logo</label>
<Input
<Input type="File"
icon={{ name: 'attach', circular: true, link: true }}
placeholder='attach logo'
required
......@@ -59,7 +59,7 @@ export default class companyRegister extends React.Component {
<Input placeholder='Provinsi' required />
</Form.Field >
<Button type='submit' floated='right' color='blue'>Submit</Button>
</Form>
</form>
</Card.Content>
</Card>
</div>
......
......@@ -25,8 +25,8 @@ describe('LoginForm', () => {
it('handle email input without problem', () => {
const formLogin = ReactTestUtils.renderIntoDocument(
<LoginForm url="" />);
expect(formLogin.state.email).to.equal('');
<LoginForm type="sso-ui" />);
expect(formLogin.state.username).to.equal('');
const emailNode = ReactTestUtils.scryRenderedDOMComponentsWithTag(formLogin, 'Input')[0];
// const emailNode = ReactDOM.findDOMNode(formLogin.refs.email);
const email = 'jojon';
......@@ -34,12 +34,12 @@ describe('LoginForm', () => {
ReactTestUtils.Simulate.change(emailNode, { target: { value: email } });
expect(emailNode.value).to.equal(email);
expect(formLogin.state.email).to.equal(email);
expect(formLogin.state.username).to.equal(email);
});
it('handle password input without problem', () => {
const formLogin = ReactTestUtils.renderIntoDocument(
<LoginForm url="" />);
<LoginForm type="sso-ui" />);
const passwordNode = ReactTestUtils.scryRenderedDOMComponentsWithTag(formLogin, 'Input')[1];
// const passwordNode = ReactDOM.findDOMNode(formLogin.refs.password);
......
import React from 'react';
import { Modal, Button, Icon } from 'semantic-ui-react';
import Server from '../lib/Server';
import Storage from '../lib/Storage';
export default class ModalAlert extends React.Component {
static propTypes = {
......@@ -24,17 +25,20 @@ export default class ModalAlert extends React.Component {
close = () => this.setState({ open: false });
handleOpen() {
const requestData = { coverLetter: this.props.coverLetter };
let studentId = Storage.post('user-data.student.id');
Server.post(`/students/${studentId}/application`, requestData).then((data) => {
const studentId = Storage.get('user-data').student.id;
const requestData = {vacancy_id: this.props.id, cover_letter: this.props.coverLetter };
Server.post(`/students/${studentId}/applied-vacancies/`, requestData).then((data) => {
this.setState({
header: 'Pendaftaran Berhasil',
content: this.successResponse + JSON.stringify(data),
content: this.successResponse,
});
}, (error) => {
this.setState({
responseHeader: 'Pendaftaran Gagal',
responseText: this.failedResponse + JSON.stringify(error),
header: 'Pendaftaran Gagal',
content: this.failedResponse,
});
});
}
......
......@@ -64,7 +64,7 @@ export default class ModalPendaftaran extends React.Component {
<h5> Write your Cover Letter </h5>
<Form >
<TextArea placeholder="Tell us more" size='big' />
<TextArea placeholder="Tell us more" size='big' onChange={this.handleChange}/>
</Form>
</div>
......
import React from 'react';
import { Button, Image as ImageComponent, Item, Rating } from 'semantic-ui-react'
import { Button, Image as ImageComponent, Item, Rating } from 'semantic-ui-react';
import ModalPendaftaran from './ModalPendaftaran';
import Storage from '../lib/Storage';
import Server from '../lib/Server';
const defaultImage = "http://semantic-ui.com/images/wireframe/image.png";
const defaultImage = 'http://semantic-ui.com/images/wireframe/image.png';
export default class Lowongan extends React.Component {
static propTypes = {
data: React.PropTypes.object.isRequired,
};
constructor(props) {
super(props);
/* istanbul ignore next */
this.bookmark = this.bookmark.bind(this);
}
bookmark() {
const studentId = Storage.get('user-data').student.id;
const data = { vacancy_id: this.props.data.id };
Server.post(`/students/${studentId}/bookmarked-vacancies/`, data).then((response) => {
console.log(JSON.stringify(response));
}, (error) => {
console.log(JSON.stringify(error));
});
}
render() {
return (
<Item >
<Item.Image size="small" src={this.props.data.company.logo ? this.props.data.company.logo: defaultImage} />
<Item.Image size="small" src={this.props.data.company.logo ? this.props.data.company.logo : defaultImage} />
<Item.Content verticalAlign="middle">
<Item.Extra>
<h3>{ this.props.data.name }</h3>
<div className="bookmark">
<Rating icon='star' size='massive' defaultRating={0} maxRating={1} />
<Rating icon="star" onRate={this.bookmark} size="massive" defaultRating={0} maxRating={1} />
</div>
<h4>{ this.props.data.company.name }</h4>
<h5>{ this.props.data.company.address }</h5>
......@@ -26,11 +44,12 @@ export default class Lowongan extends React.Component {
<ModalPendaftaran
id={this.props.data.id} data={{ header: this.props.data.name,
description: this.props.data.description }} buttonTitle="Daftar" />
description: this.props.data.description }} buttonTitle="Daftar"
/>
</Item.Extra>
</Item.Content>
</Item>
);
}
}
\ No newline at end of file
}
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