Fakultas Ilmu Komputer UI

Commit d68cdc58 authored by Fannyah Dita Cahya's avatar Fannyah Dita Cahya
Browse files

1606918414 44

parent 927a10a3
......@@ -23,6 +23,7 @@ export default class ProfilePage extends React.Component {
major: '',
batch: '',
email: '',
gender: '',
region: '',
cityOfBirth: '',
dateOfBirth: '',
......@@ -39,6 +40,7 @@ export default class ProfilePage extends React.Component {
picture: '',
email: '',
phone_number: '',
gender: '',
region: '',
skills: '',
resume: '',
......@@ -82,6 +84,7 @@ export default class ProfilePage extends React.Component {
major: data.major,
batch: data.batch,
email: data.user.email,
gender: data.gender,
region: data.region,
cityOfBirth: data.birth_place,
dateOfBirth: this.parseIndonesianDateFormat(data.birth_date),
......@@ -174,6 +177,12 @@ export default class ProfilePage extends React.Component {
this.setState({ form, show_transcript: d.checked });
};
handleRadioGender = (e, {value}) => {
const form = this.state.form;
form.gender = value;
this.setState({ form })
}
handleRadio = (e, { value }) => {
const form = this.state.form;
form.job_seeking_status = value;
......@@ -189,7 +198,7 @@ export default class ProfilePage extends React.Component {
gotoStudentTranscript = () => this.gotoLink(`transkrip/${this.state.id}`);
updateForm(show) {
updateForm(show){
if (show) {
return (
<Segment className="profile-form">
......@@ -223,6 +232,21 @@ export default class ProfilePage extends React.Component {
name="phone_number"
/>
</Form.Field>
<Form.Field>
<label htmlFor="gender">Jenis Kelamin</label>
<Form.Radio
label="Perempuan"
name='gender'
value="Perempuan"
onClick={this.handleRadioGender}
/>
<Form.Radio
label="Laki-laki"
name='gender'
value="Laki-laki"
onClick={this.handleRadioGender}
/>
</Form.Field>
<Form.Field>
<label htmlFor="linkedin_url">URL Profile LinkedIn</label>
<input
......@@ -384,6 +408,17 @@ export default class ProfilePage extends React.Component {
</Grid>
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
<Icon name="venus mars" size="big" />
</Grid.Column>
<Grid.Column width={13}>
<p> { this.state.gender || 'N/A' }</p>
</Grid.Column>
</Grid>
</Segment>
<Segment basic vertical>
<Grid>
<Grid.Column width={2}>
......
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2019-10-05 22:28
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='gender',
field=models.CharField(blank=True, max_length=30, null=True),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-06 03:58
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0018_student_gender'),
('core', '0019_merge_20191006_0852'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-06 05:17
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0017_vacancy_amount'),
('core', '0020_merge_20191006_1058'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-11 04:43
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0047_merge_20191011_0029'),
('core', '0021_merge_20191006_1217'),
]
operations = [
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-10-11 07:03
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0048_merge_20191011_1143'),
]
operations = [
migrations.AlterField(
model_name='student',
name='phone_number',
field=models.CharField(blank=True, db_index=True, max_length=100, null=True, validators=[django.core.validators.RegexValidator(b'^0\\d{1,11}$')]),
),
]
......@@ -65,7 +65,8 @@ class Student(models.Model):
user = models.OneToOneField(User)
npm = models.IntegerField(validators=[validate_npm], unique=True)
resume = models.FileField(upload_to=get_student_resume_file_path, null=True, blank=True, validators=[validate_document_file_extension])
phone_number = models.CharField(max_length=12, blank=True, db_index=True, null=True, validators=[RegexValidator(r'^0\d{1,11}$')])
phone_number = models.CharField(max_length=100, blank=True, db_index=True, null=True, validators=[RegexValidator(r'^0\d{1,11}$')])
gender = models.CharField(max_length=30, blank=True, null=True)
bookmarked_vacancies = models.ManyToManyField('core.Vacancy', related_name="bookmarked_vacancies", blank=True)
applied_vacancies = models.ManyToManyField('core.Vacancy', related_name="applied_vacancies",
blank=True, through='core.Application')
......
......@@ -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', \
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']
......@@ -48,6 +48,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
'resume': resume,
'email': instance.user.email,
'phone_number': instance.phone_number,
'gender' : instance.gender,
'region': instance.region,
'photo': photo,
'show_transcript': instance.show_transcript,
......@@ -67,6 +68,7 @@ class StudentUpdateSerializer(serializers.ModelSerializer):
instance.resume = validated_data.get('resume', instance.resume)
instance.show_transcript = validated_data.get('show_transcript', instance.show_transcript)
instance.phone_number = validated_data.get('phone_number', instance.phone_number)
instance.gender = validated_data.get('gender', instance.gender)
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)
......@@ -86,7 +88,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',
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']
......
......@@ -166,6 +166,11 @@ class ProfileUpdateTests(APITestCase):
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('region'), 'Indonesia')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'gender': 'Perempuan'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('gender'), 'Perempuan')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'skills': 'Java, Python'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
......@@ -177,7 +182,7 @@ class ProfileUpdateTests(APITestCase):
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'phone_number': '````'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
url = '/api/students/123123123/profile/'
response = self.client.patch(url, {'phone_number': '08123123123'}, format='multipart')
......
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