Fakultas Ilmu Komputer UI

Commit 1d6c6882 authored by Aviliani Pramestya's avatar Aviliani Pramestya
Browse files

1606829402-45-Sebagai pelamar, saya dapat menambahkan expected salary pada halaman profile

parent 8921a280
......@@ -33,6 +33,7 @@ export default class ProfilePage extends React.Component {
photo: '',
age: '',
intro: '',
expected_salary: '',
job_seeking_status: '',
volunteer: '',
skills: '',
......@@ -97,6 +98,7 @@ export default class ProfilePage extends React.Component {
refresh: this.state.refresh + 1,
age: data.age,
intro: data.intro,
expected_salary: data.expected_salary,
job_seeking_status: data.job_seeking_status,
volunteer: data.volunteer,
linkedin_url: data.linkedin_url,
......@@ -300,6 +302,10 @@ export default class ProfilePage extends React.Component {
<label htmlFor="resume">Resume</label>
<input onChange={this.handleFile} placeholder="Resume" name="resume" type="File" />
</Form.Field>
<Form.Field>
<label htmlFor="phone_number">Expected Salary</label>
<input onChange={this.handleChange} placeholder="2000000" name="expected_salary" />
</Form.Field>
<Form.Field>
<label htmlFor="intro">Intro</label>
<input
......@@ -497,6 +503,17 @@ export default class ProfilePage extends React.Component {
</Grid>
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<Icon name="money bill alternate" size="big" />
</Grid.Column>
<Grid.Column width={13}>
<p> { this.state.expected_salary || 'N/A' } </p>
</Grid.Column>
</Grid>
</Segment>
<Segment>
<Grid>
<Grid.Column width={2}>
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-06 12:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0019_merge_20191006_0852'),
]
operations = [
migrations.AddField(
model_name='student',
name='expected_salary',
field=models.IntegerField(blank=True, null=True),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-06 12:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0020_student_expected_salary'),
]
operations = [
migrations.AlterField(
model_name='student',
name='expected_salary',
field=models.CharField(blank=True, max_length=10, null=True),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-06 14:54
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0017_vacancy_amount'),
('core', '0021_auto_20191006_1925'),
('core', '0014_auto_20191004_1340'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-11 09:09
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0022_merge_20191006_2154'),
('core', '0049_auto_20191011_1403'),
]
operations = [
]
......@@ -85,6 +85,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)
expected_salary = models.CharField(max_length=10, 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', 'gender','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','job_seeking_status', 'skills']
'latest_work', 'latest_work_desc','read_no', 'volunteer','job_seeking_status', 'skills', 'expected_salary']
def get_accepted_no(self, obj):
apps = Application.objects.filter(student=obj, status=4)
......@@ -53,6 +53,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'photo': photo,
'show_transcript': instance.show_transcript,
'intro': instance.intro,
'expected_salary': instance.expected_salary,
'job_seeking_status' : instance.job_seeking_status,
'website_url' : instance.website_url,
'student_gpa' : instance.student_gpa,
......@@ -73,6 +74,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
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.expected_salary = validated_data.get('expected_salary', instance.expected_salary)
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)
......@@ -89,7 +91,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
class Meta:
model = Student
fields = ['resume', 'email', 'phone_number', 'gender','photo', 'show_transcript', 'linkedin_url', 'region', 'intro', 'website_url', 'student_gpa',
'recommendations', 'latest_work', 'latest_work_desc', 'volunteer','job_seeking_status', 'skills']
'recommendations', 'latest_work', 'latest_work_desc', 'volunteer','job_seeking_status', 'skills', 'expected_salary']
class CompanyUpdateSerializer(serializers.ModelSerializer):
......
......@@ -225,6 +225,10 @@ 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, {'expected_salary': '4000000'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('expected_salary'), '4000000')
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')
......@@ -262,4 +266,4 @@ class ProfileUpdateTests(APITestCase):
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
response = self.client.patch(url, {'description': 'Masak-Masak'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
\ No newline at end of file
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
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