Fakultas Ilmu Komputer UI

Commit 6c4769be authored by root's avatar root
Browse files

Merge branch 'master' of https://gitlab.cs.ui.ac.id/pmpl/class-project/kape into 1606880485-37

parents 79ae3176 0c2a62b6
Pipeline #21921 failed with stages
in 6 minutes and 9 seconds
......@@ -30,6 +30,7 @@ export default class ProfilePage extends React.Component {
phone_number: '',
show_transcript: '',
photo: '',
intro: '',
form: {
picture: '',
email: '',
......@@ -37,11 +38,13 @@ export default class ProfilePage extends React.Component {
region: '',
resume: '',
show_transcript: '',
intro: '',
},
bagikanTranskrip: '',
acceptedNo: 0,
refresh: 1,
loading: false,
linkedin_url: '',
};
this.getProfile = this.getProfile.bind(this);
this.handleChange = this.handleChange.bind(this);
......@@ -74,6 +77,8 @@ export default class ProfilePage extends React.Component {
acceptedNo: data.accepted_no,
bagikanTranskrip: data.show_transcript,
refresh: this.state.refresh + 1,
intro: data.intro,
linkedin_url: data.linkedin_url,
});
if (this.props.route.own) {
const newSession = this.props.user.data;
......@@ -157,14 +162,23 @@ export default class ProfilePage extends React.Component {
<label htmlFor="phone_number">No. Hp</label>
<input onChange={this.handleChange} placeholder="08123456789" name="phone_number" />
</Form.Field>
<Form.Field>
<label htmlFor="linkedin_url">URL Profile LinkedIn</label>
<input onChange={this.handleChange} placeholder="https://www.linkedin.com/in/jojo/" name="linkedin_url" />
</Form.Field>
<Form.Field>
<label htmlFor="region">Region</label>
<input onChange={this.handleChange} placeholder="Indonesia" name="region" />
</Form.Field>
<Form.Field>
<label htmlFor="resume">Resume</label>
<input onChange={this.handleFile} placeholder="Resume" name="resume" type="File" />
</Form.Field>
<Form.Field>
<label htmlFor="intro">Intro</label>
<input onChange={this.handleChange} placeholder="Ceritakan dirimu secara singkat" name="intro" />
</Form.Field>
<Form.Field>
<Checkbox
onChange={this.handleCheckbox}
......@@ -248,7 +262,18 @@ export default class ProfilePage extends React.Component {
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<Icon name="linkedin" size="big" />
</Grid.Column>
<Grid.Column width={13}>
<a href={this.state.linkedin_url}> { this.state.linkedin_url || 'N/A' } </a>
</Grid.Column>
</Grid>
</Segment>
</div>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<Icon name="map pin" size="big" />
......@@ -258,7 +283,20 @@ export default class ProfilePage extends React.Component {
</Grid.Column>
</Grid>
</Segment>
</div>
<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>
</Grid>
</Segment>
<Container textAlign="center">
<div className="buttonProfile">
......
......@@ -7,6 +7,7 @@ import ApplicationList from './components/ApplicationList';
const cols = [
{ key: 'StudentName', label: 'Nama' },
{ key: 'StudentID', label: 'NPM' },
{ key: 'Major', label: 'Major' },
{ key: 'Perusahaan', label: 'Perusahaan' },
{ key: 'Posisi', label: 'Posisi' },
{ key: 'Status', label: 'Status' },
......
......@@ -139,7 +139,7 @@ describe('ProfilePage', () => {
const profile = ReactTestUtils.renderIntoDocument(
<ProfilePage route={{ own: true, data: studentSession }} user={{ data: studentSession }} params={{ id: 3 }} />);
const checkboxNode = ReactTestUtils.scryRenderedDOMComponentsWithTag(profile, 'Input')[5];
const checkboxNode = ReactTestUtils.scryRenderedDOMComponentsWithTag(profile, 'Input')[6];
const checkbox = false;
checkboxNode.value = checkbox;
profile.getProfile().then(()=> expect(profile.state.show_transcript).to.equal(true));
......
......@@ -8,7 +8,6 @@ describe('Vacancy', () => {
const fetchMock = require('fetch-mock');
const response = {
close_time: '2019-03-28T05:55:42Z',
apply_before: '28 March 2019'
company: {
address: 'kebayoran baru',
id: 1,
......@@ -26,7 +25,6 @@ describe('Vacancy', () => {
const response2 = {
close_time: '2019-03-28T05:55:42Z',
apply_before: '28 March 2019'
company: {
address: 'kebayoran baru',
id: 1,
......@@ -46,7 +44,7 @@ describe('Vacancy', () => {
role: 'company',
data: {
url: 'http://localhost:8001/api/users/8/',
username: 'Tutuplapak',
email: '',
is_staff: false,
......
......@@ -23,9 +23,10 @@ export default class ApplicationList extends React.Component {
generateRows() {
return this.props.items.map(item =>
(
<Table.Row key={`${item.npm}_${item.company}_${item.position}_${item.status}_row`}>
<Table.Row key={`${item.npm}_${item.major}_${item.company}_${item.position}_${item.status}_row`}>
<Table.Cell key={`${item.name}_name`}> {item.name} </Table.Cell>
<Table.Cell key={`${item.name}_npm`}> {item.npm} </Table.Cell>
<Table.Cell key={`${item.name}_major`}> {item.major} </Table.Cell>
<Table.Cell key={`${item.name}_company`}>
{item.company_name}
</Table.Cell>
......
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-05 08:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0013_auto_20170602_1130'),
]
operations = [
migrations.AddField(
model_name='student',
name='linkedin_url',
field=models.URLField(blank=True, null=True),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-05 12:26
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0014_feedback'),
('core', '0014_company_category'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-05 13:38
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0014_feedback'),
('core', '0014_company_category'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-05 15:35
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0015_merge_20191005_1926'),
('core', '0015_merge_20191005_1957'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-05 15:56
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0015_merge_20191005_1957'),
('core', '0014_student_linkedin_url'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-05 18:34
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0015_merge_20191005_2038'),
('core', '0016_merge_20191005_2235'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-05 19:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0016_merge_20191005_2235'),
]
operations = [
migrations.AddField(
model_name='vacancy',
name='amount',
field=models.IntegerField(null=True),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-05 23:03
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0016_merge_20191005_2256'),
('core', '0017_merge_20191006_0134'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-05 22:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0017_merge_20191006_0134'),
]
operations = [
migrations.AddField(
model_name='student',
name='intro',
field=models.CharField(blank=True, max_length=50, null=True),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-06 01:52
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0018_student_intro'),
('core', '0018_merge_20191006_0603'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-06 07:44
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0017_vacancy_amount'),
('core', '0019_merge_20191006_0852'),
]
operations = [
]
......@@ -65,7 +65,10 @@ class Student(models.Model):
batch = models.CharField(max_length=4, blank=True, null=True)
show_transcript = models.BooleanField(default=False)
photo = models.FileField(upload_to=get_student_photo_file_path, null=True, blank=True, validators=[validate_image_file_extension])
linkedin_url = models.URLField(max_length=200,blank=True, null=True)
region = models.CharField(max_length=30, blank=True, null=True)
intro = models.CharField(max_length=50, blank=True, null=True)
@property
def name(self):
......
......@@ -13,6 +13,7 @@ class Vacancy(models.Model):
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
name = models.CharField(max_length=100, null=False)
amount = models.IntegerField(null=True)
@property
def apply_before(self):
......@@ -30,6 +31,7 @@ class Application(models.Model):
BOOKMARKED = 2
REJECTED = 3
ACCEPTED = 4
ABORTED = 5
cover_letter = models.TextField(null=True, blank=True)
student = models.ForeignKey(Student, on_delete=models.CASCADE)
......
......@@ -19,7 +19,7 @@ class StudentSerializer(serializers.ModelSerializer):
class Meta:
model = Student
fields = ['id', 'name', 'user', 'npm', 'resume', 'phone_number', 'birth_place', 'birth_date', 'major', 'batch', \
'show_transcript', 'photo', 'accepted_no', 'region']
'show_transcript', 'photo', 'accepted_no', 'linkedin_url', 'region', 'intro']
def get_accepted_no(self, obj):
apps = Application.objects.filter(student=obj, status=4)
......@@ -43,7 +43,9 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'phone_number': instance.phone_number,
'region': instance.region,
'photo': photo,
'show_transcript': instance.show_transcript
'show_transcript': instance.show_transcript,
'intro': instance.intro,
'linkedin_url' : instance.linkedin_url,
}
def update(self, instance, validated_data):
......@@ -53,13 +55,15 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
instance.region = validated_data.get('region', instance.region)
instance.photo = validated_data.get('photo', instance.photo)
instance.user.email = validated_data.get('email', instance.user.email)
instance.intro = validated_data.get('intro', instance.intro)
instance.linkedin_url = validated_data.get('linkedin_url', instance.linkedin_url)
instance.save()
instance.user.save()
return instance
class Meta:
model = Student
fields = ['resume', 'email', 'phone_number', 'region', 'photo', 'show_transcript']
fields = ['resume', 'email', 'phone_number', 'photo', 'show_transcript', 'linkedin_url', 'region', 'intro']
class CompanyUpdateSerializer(serializers.ModelSerializer):
......
......@@ -61,10 +61,11 @@ class ApplicationStatusSerializer(serializers.ModelSerializer):
class SupervisorStudentApplicationSerializer(serializers.ModelSerializer):
def to_representation(self, instance):
status_map = ["new", "read", "bookmarked", "rejected", "accepted" ]
status_map = ["new", "read", "bookmarked", "rejected", "accepted","aborted" ]
return {
'name' : instance.student.full_name,
'npm' : instance.student.npm,
'major' : instance.student.major,
'vacancy_name' : instance.vacancy.name,
'company_name' : instance.vacancy.company.name,
'status' : status_map[instance.status]
......@@ -72,8 +73,8 @@ class SupervisorStudentApplicationSerializer(serializers.ModelSerializer):
class Meta:
model = Application
fields = ['name', 'npm', 'vacancy_name', 'company_name', 'status']
read_only_fields = ['name', 'npm', 'vacancy_name', 'company_name', 'status']
fields = ['name', 'npm', 'major', 'vacancy_name', 'company_name', 'status']
read_only_fields = ['name', 'npm', 'major', 'vacancy_name', 'company_name', 'status']
class VacancyApplicationSerializer(serializers.ModelSerializer):
vacancy = VacancySerializer()
......
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