Fakultas Ilmu Komputer UI

Commit aa1976f5 authored by Nixi Sendya Putri's avatar Nixi Sendya Putri
Browse files

1606918383 49

parent 2e830ff1
No preview for this file type
import React from 'react';
import { Segment, Image, Header, Icon, Checkbox, Container, Button, Form, Grid } from 'semantic-ui-react';
import { Segment, Image, Header, Icon, Checkbox, Container, Button, Form, Grid, Message } from 'semantic-ui-react';
import Server from './lib/Server';
import Storage from './lib/Storage';
import ModalAlert from './components/ModalAlert';
......@@ -32,6 +32,7 @@ export default class ProfilePage extends React.Component {
photo: '',
age: '',
intro: '',
job_seeking_status: '',
volunteer: '',
form: {
picture: '',
......@@ -42,6 +43,7 @@ export default class ProfilePage extends React.Component {
show_transcript: '',
volunteer: '',
intro: '',
job_seeking_status: '',
latest_work: '',
latest_work_desc: '',
},
......@@ -88,8 +90,9 @@ export default class ProfilePage extends React.Component {
readNo: data.read_no,
bagikanTranskrip: data.show_transcript,
refresh: this.state.refresh + 1,
age : data.age,
age: data.age,
intro: data.intro,
job_seeking_status: data.job_seeking_status,
volunteer: data.volunteer,
linkedin_url: data.linkedin_url,
student_gpa: data.student_gpa,
......@@ -110,7 +113,7 @@ export default class ProfilePage extends React.Component {
parseIndonesianDateFormat(dateIndex) {
const monthNameIndex = {
'01': 'Januari',
'01': 'Januarxi',
'02': 'Februari',
'03': 'Maret',
'04': 'April',
......@@ -168,6 +171,12 @@ export default class ProfilePage extends React.Component {
this.setState({ form, show_transcript: d.checked });
};
handleRadio = (e, { value }) => {
const form = this.state.form;
form.job_seeking_status = value;
this.setState({ form });
}
gotoLink = (url) => {
const win = window.open(url);
win.focus();
......@@ -229,6 +238,21 @@ export default class ProfilePage extends React.Component {
<label htmlFor="volunteer">Volunteering Experience</label>
<input onChange={this.handleChange} placeholder="Ketua Organisasi A - 2020" name="volunteer" />
</Form.Field>
<Form.Field>
<label htmlFor="intro">Status Pencarian Kerja</label>
<Form.Radio
label="Aktif"
name="job_seeking_status"
value="Active"
onClick={this.handleRadio}
/>
<Form.Radio
label="Pasif"
name="job_seeking_status"
value="Passive"
onClick={this.handleRadio}
/>
</Form.Field>
<Form.Field>
<Checkbox
onChange={this.handleCheckbox}
......@@ -400,6 +424,10 @@ export default class ProfilePage extends React.Component {
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<Icon name="map pin" size="big" />
</Grid.Column>
<Grid.Column width={13}>
<p> { this.state.region || 'N/A' } </p>
<h3>Intro</h3>
</Grid.Column>
<Grid.Column width={13}>
......@@ -410,6 +438,12 @@ export default class ProfilePage extends React.Component {
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<h3>Intro</h3>
</Grid.Column>
<Grid.Column width={13}>
<p> { this.state.intro || 'N/A' } </p>
</Grid.Column>
<p className="jumlahLamaran"> Jumlah lamaran diterima: {this.state.acceptedNo || '0' }</p>
</Grid>
<Grid>
......@@ -430,6 +464,28 @@ export default class ProfilePage extends React.Component {
</Grid.Column >
</Grid>
</Segment >
<Segment className="status-form">
<Header as="h3" textAlign="left">
<Icon name="search" />
<Header.Content>
Status Mencari Pekerjaan
</Header.Content>
</Header>
<div>
<h4> { this.state.job_seeking_status === 'Active' ?
<Message positive>
<Message.Header>Sedang mencari pekerjaan</Message.Header>
<p>Saya sedang mencari pekerjaan sekarang dan saya terbuka untuk
mendapat informasi mengenai lowongan kerja.</p>
</Message> : <Message negative>
<Message.Header>Tidak mencari pekerjaan</Message.Header>
<p>Saya sedang tidak mencari pekerjaan. Mohon jangan kirimkan
informasi mengenai lowongan pekerjaan.</p>
</Message> }</h4>
</div>
</Segment>
{ this.updateForm(this.props.route.own) }
</div>
);
......
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-06 03:13
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0019_merge_20191006_0852'),
]
operations = [
migrations.AlterField(
model_name='company',
name='category',
field=models.CharField(default='Belum ada kategori perusahaan', max_length=140),
),
migrations.AlterField(
model_name='feedback',
name='title',
field=models.CharField(blank=True, default='', max_length=100),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-06 03:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0020_auto_20191006_1013'),
]
operations = [
migrations.AddField(
model_name='student',
name='job_seeking_status',
field=models.CharField(blank=True, max_length=30, null=True),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-10 05:21
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0040_auto_20191010_1134'),
('core', '0021_student_job_seeking_status'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-10 05:47
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0041_merge_20191010_1155'),
('core', '0041_merge_20191010_1221'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-10 14:05
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0042_merge_20191010_1247'),
('core', '0043_merge_20191010_1827'),
]
operations = [
]
......@@ -83,6 +83,7 @@ class Student(models.Model):
latest_work = models.CharField(max_length=100, blank=True, null=True)
latest_work_desc = models.TextField(blank=True, null=True)
intro = models.CharField(max_length=50, blank=True, null=True)
job_seeking_status = models.CharField(max_length=30, blank=True, null=True)
student_gpa = models.FloatField(db_column='student_gpa', default=1.0, blank=True, null=True)
volunteer = models.CharField(max_length=100, blank=True, null=True)
......
......@@ -21,7 +21,7 @@ class StudentSerializer(serializers.ModelSerializer):
model = Student
fields = ['id', 'name', 'user', 'npm', 'resume', 'phone_number', 'birth_place', 'birth_date', 'major', 'batch', \
'show_transcript', 'photo', 'accepted_no', 'linkedin_url', 'region', 'intro', 'website_url', 'student_gpa', 'age','recommendations',
'latest_work', 'latest_work_desc','read_no', 'volunteer']
'latest_work', 'latest_work_desc','read_no', 'volunteer','job_seeking_status']
def get_accepted_no(self, obj):
apps = Application.objects.filter(student=obj, status=4)
......@@ -52,6 +52,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'photo': photo,
'show_transcript': instance.show_transcript,
'intro': instance.intro,
'job_seeking_status' : instance.job_seeking_status,
'website_url' : instance.website_url,
'student_gpa' : instance.student_gpa,
'volunteer': instance.volunteer,
......@@ -71,6 +72,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
instance.intro = validated_data.get('intro', instance.intro)
instance.volunteer = validated_data.get('volunteer', instance.volunteer)
instance.linkedin_url = validated_data.get('linkedin_url', instance.linkedin_url)
instance.job_seeking_status = validated_data.get('job_seeking_status', instance.job_seeking_status)
instance.student_gpa = validated_data.get('student_gpa', instance.student_gpa)
instance.website_url = validated_data.get('website_url', instance.website_url)
instance.recommendations = validated_data.get('recommendations', instance.recommendations)
......@@ -83,7 +85,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
class Meta:
model = Student
fields = ['resume', 'email', 'phone_number', 'photo', 'show_transcript', 'linkedin_url', 'region', 'intro', 'website_url', 'student_gpa',
'recommendations', 'latest_work', 'latest_work_desc', 'volunteer']
'recommendations', 'latest_work', 'latest_work_desc', 'volunteer','job_seeking_status']
class CompanyUpdateSerializer(serializers.ModelSerializer):
......
......@@ -157,11 +157,6 @@ class ProfileUpdateTests(APITestCase):
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('linkedin_url'), 'https://www.linkedin.com/in/jojo/')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'website_url': 'https://www.example.com/'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('website_url'), 'https://www.example.com/')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'recommendations': 'mantap kak'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
......@@ -187,10 +182,6 @@ class ProfileUpdateTests(APITestCase):
response = self.client.patch(url, {'linkedin_url': 'this is not valid url'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'website_url': 'this is not valid url'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
new_user = User.objects.create_user('dummy.student2', 'dummy.student@student.com', 'lalala123')
new_student = Student.objects.create(user=new_user, npm="1212121212")
......@@ -224,6 +215,9 @@ class ProfileUpdateTests(APITestCase):
self.assertEqual(response.data.get('intro'), 'Saya tertarik dengan dunia front-end development')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'job_seeking_status': 'Active'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('job_seeking_status'), 'Active')
response = self.client.patch(url, {'GPA': 1.0}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('student_gpa'), 1.0)
......
......@@ -4608,11 +4608,6 @@
"eslint-visitor-keys": "^1.1.0"
}
},
"esprima": {
"version": "github:substack/esprima#0a7f8489a11b44b019ce168506f535f22d0be290",
"from": "github:substack/esprima#is-keyword",
"dev": true
},
"esquery": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz",
......
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