Fakultas Ilmu Komputer UI

Commit 4a4ca6f5 authored by MISAEL JONATHAN's avatar MISAEL JONATHAN
Browse files

Merge branch '1606879773-218' into 'master'

1606879773 218

See merge request !287
parents 4d637521 9042c59e
Pipeline #26871 passed with stages
in 48 minutes and 36 seconds
......@@ -32,6 +32,8 @@ export default class EditProfile extends ProfileHandler {
phone_number: '',
portfolio_link: '',
show_transcript: '',
expected_salary: '',
self_description: '',
intro: '',
skills: '',
form: {
......@@ -100,11 +102,13 @@ export default class EditProfile extends ProfileHandler {
id: data.id,
name: data.full_name,
email: data.user.email,
self_description: data.self_description,
region: data.region,
alamat: data.alamat,
phone_number: data.phone_number,
portfolio_link: data.portfolio_link,
show_transcript: data.show_transcript,
expected_salary: data.expected_salary,
refresh: this.state.refresh + 1,
intro: data.intro,
linkedin_url: data.linkedin_url,
......@@ -124,6 +128,7 @@ export default class EditProfile extends ProfileHandler {
seminar: data.seminar,
interests: data.interests,
related_course: data.related_course,
volunteer: data.volunteer,
ielts: data.ielts,
});
if (this.props.route.own) {
......@@ -165,34 +170,245 @@ export default class EditProfile extends ProfileHandler {
if (show) {
return (
<div className="editProfile">
<Segment className="profile-form">
<Header as="h3" textAlign="center">
<Icon name="edit" />
<Header.Content>Edit Profile Page</Header.Content>
</Header>
<ModalAlert
ref={(modal) => {
this.modalAlert = modal;
}}
/>
<Form
ref={(input) => {
this.form = input;
}}
key={this.state.refresh}
size="small"
>
<Form.Field>
<label htmlFor="photo">Profile Picture</label>
<input
onChange={this.handleFile}
placeholder="Profile Photo.jpg"
name="photo"
type="File"
/>
</Form.Field>
<Form.Field>
<label htmlFor="email">Email</label>
<Segment className="profile-form">
<Header as="h3" textAlign="center">
<Icon name="edit" />
<Header.Content>Edit Profile Page</Header.Content>
</Header>
<ModalAlert
ref={(modal) => {
this.modalAlert = modal;
}}
/>
<Form
ref={(input) => {
this.form = input;
}}
key={this.state.refresh}
size="small"
>
<Form.Field>
<label htmlFor="photo">Profile Picture</label>
<input
onChange={this.handleFile}
placeholder="Profile Photo.jpg"
name="photo"
type="File"
/>
</Form.Field>
<Form.Field>
<label htmlFor="email">Email</label>
<input
onChange={this.handleChange}
placeholder={
this.state.email === null
? 'jojon@email.com'
: this.state.email
}
defaultValue={
this.state.email === null ? null : this.state.email
}
name="email"
/>
</Form.Field>
<Form.Field>
<label htmlFor="phone_number">No. Hp</label>
<input
onChange={this.handleChange}
placeholder={
this.state.phone_number === null
? '08123456789'
: this.state.phone_number
}
defaultValue={
this.state.phone_number === null
? null
: this.state.phone_number
}
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="self_description">Deskripsi Diri</label>
<input
onChange={this.handleChange}
placeholder="Saya suka belajar"
defaultValue= {
this.state.self_description === null ? null : this.state.self_description
}
name="self_description"
/>
</Form.Field>
<Form.Field>
<label htmlFor="region">Region</label>
<input
onChange={this.handleChange}
placeholder={
this.state.region === null ? 'Indonesia' : this.state.region
}
defaultValue={
this.state.region === null ? null : this.state.region
}
name="region"
/>
</Form.Field>
<Form.Field>
<label htmlFor="alamat">Alamat</label>
<input
onChange={this.handleChange}
placeholder={
this.state.alamat === null
? 'JL. Satya Raya No.41'
: this.state.alamat
}
defaultValue={
this.state.alamat === null ? null : this.state.alamat
}
name="alamat"
/>
</Form.Field>
<Form.Field>
<label htmlFor="skills">Skills</label>
<input
onChange={this.handleChange}
placeholder="Isi sesuai dengan keahlian anda"
defaultValue={this.state.skills === null ? null : this.state.skills}
name="skills"
/>
</Form.Field>
<Form.Field>
<label htmlFor="languages">Bahasa yang dikuasai</label>
<input
onChange={this.handleChange}
placeholder="Indonesia, Jerman (pisahkan dengan koma)"
defaultValue={
this.state.languages === null ? null : this.state.languages
}
name="languages"
/>
</Form.Field>
<Form.Field>
<label htmlFor="interests">Interests</label>
<input
onChange={this.handleChange}
placeholder={this.state.interests === null ? 'Machine Learning' : this.state.interests}
defaultValue={this.state.interests === null ? null : this.state.interests}
name="interests"
/>
</Form.Field>
<Form.Field>
<label htmlFor="related_course">Related Coursework Taken</label>
<input
onChange={this.handleChange}
placeholder={
this.state.related_course === null
? 'Intraction System, Machine Learning'
: this.state.related_course
}
defaultValue={
this.state.related_course === null ? null : this.state.related_course
}
name="related_course"
/>
</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="expected_salary">Expected Salary</label>
<input
onChange={this.handleChange}
placeholder="2000000"
defaultValue = {
this.state.expected_salary === null ? null : this.state.expected_salary
}
name="expected_salary"
/>
</Form.Field>
<Form.Field>
<label htmlFor="intro">Intro</label>
<input
onChange={this.handleChange}
placeholder={
this.state.intro === null
? 'Ceritakan dirimu secara singkat'
: this.state.intro
}
defaultValue={
this.state.intro === null ? null : this.state.intro
}
name="intro"
/>
</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}
checked={!!this.state.show_transcript}
label="Ijinkan perusahaan tempat saya mendaftar untuk melihat transkrip akademik saya"
name="show_transcript"
/>
</Form.Field>
<Form.Field>
<label htmlFor="student_gpa">GPA</label>
<input
onChange={this.handleChange}
placeholder={
this.state.student_gpa === null
? '3.50'
: this.state.student_gpa
}
defaultValue={
this.state.student_gpa === null
? null
: this.state.student_gpa
}
name="student_gpa"
/>
</Form.Field>
<Form.Field>
<label htmlFor="student_toefl">TOEFL</label>
<input
onChange={this.handleChange}
placeholder={
......@@ -464,6 +680,19 @@ export default class EditProfile extends ProfileHandler {
name="projects"
/>
</Form.Field>
<Form.Field>
<label htmlFor="volunteer">Volunteering Experience</label>
<input
onChange={this.handleChange}
placeholder="Ketua Organisasi A - 2020"
name="volunteer"
defaultValue={
this.state.volunteer === null ? null :this.state.volunteer
}
/>
</Form.Field>
<Form.Field>
<label htmlFor="certification">Sertifikasi</label>
<input
......
......@@ -36,7 +36,6 @@ export default class NotificationPage extends React.Component {
}
console.log('Notifikasi');
Storage.set('menu-active-state', 'Notifikasi');
}
......@@ -51,8 +50,6 @@ export default class NotificationPage extends React.Component {
onClickDismiss = (index) => {
var array = [...this.state.list];
array.splice(index, 1);
console.log("eh kepencet")
console.log(index)
this.setState({
list : array
......
......@@ -115,8 +115,6 @@ export default class ProfilePage extends ProfileHandler {
this.gotoStudentToeflFile = this.gotoStudentToeflFile.bind(this);
this.getProfile();
console.log('profil');
Storage.set('menu-active-state', 'Profil');
}
......
export const isFromGithubLinkValid = github_link => {
if (github_link == null) return;
return github_link.includes('https://github.com/');
return (github_link.includes('https://github.com/') || github_link.length === 0);
};
export const gotoLink = url => window.open(url).focus();
......@@ -53,7 +53,6 @@ export default class Pagination extends React.Component {
false,
).then(
(data) => {
console.log('GET ITEM DATA');
this.setState({
current: this.state.current + this.state.dir,
});
......
......@@ -176,8 +176,6 @@ export default class VacancyList extends React.Component {
salary={this.props.salary}
/>
));
console.log(vacancies);
console.log("ini cuy")
vacancies = this.sortVacancies(vacancies);
vacancies = this.filterVacanciesBasedOnSalary(vacancies);
vacancies = this.filterVacanciesBasedOnVacancyStatus(vacancies);
......
import math
import os
import re
from django.core.exceptions import ValidationError
......@@ -27,6 +28,10 @@ def validate_student_gpa(value):
if value < 0 or value > 4:
raise ValidationError(u"GPA harus merupakan angka antara 0-4")
def validate_languages_contains_string_type_value(value):
if not re.search("^[a-zA-Z ,]*$", value):
raise ValidationError(u"Bahasa hanya mengandung karakter alphabet")
def validate_toefl_score(value):
if value < 0 or value >677:
raise ValidationError(u"skor toefl harus merupakan angka antara 0-677")
......
# Generated by Django 2.2.8 on 2019-12-06 12:07
# Generated by Django 2.2.8 on 2019-12-06 15:30
import core.lib.validators
import core.models.accounts
......@@ -139,7 +139,7 @@ class Migration(migrations.Migration):
('hackerrank_url', models.URLField(blank=True, null=True)),
('website_url', models.URLField(blank=True, null=True)),
('work_experience', models.CharField(blank=True, max_length=500, null=True)),
('region', models.CharField(blank=True, max_length=30, null=True)),
('region', models.CharField(blank=True, max_length=30, null=True, validators=[django.core.validators.RegexValidator('^[A-Za-z]+$')])),
('alamat', models.CharField(blank=True, max_length=50, null=True)),
('skills', models.CharField(blank=True, max_length=50, null=True)),
('ui_ux_portofolio', models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_student_ui_ux_portofolio_file_path, validators=[core.lib.validators.validate_document_file_extension])),
......@@ -157,7 +157,7 @@ class Migration(migrations.Migration):
('awards', models.CharField(blank=True, max_length=100, null=True)),
('projects', models.CharField(blank=True, max_length=100, null=True)),
('certification', models.CharField(blank=True, max_length=100, null=True)),
('languages', models.CharField(blank=True, max_length=100, null=True)),
('languages', models.CharField(blank=True, max_length=100, null=True, validators=[core.lib.validators.validate_languages_contains_string_type_value])),
('seminar', models.CharField(blank=True, max_length=100, null=True)),
('interests', models.CharField(blank=True, max_length=100, null=True)),
('dependants', models.IntegerField(blank=True, db_column='dependants', default=0, null=True)),
......
# Generated by Django 2.2.8 on 2019-12-06 08:57
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='student',
name='region',
field=models.CharField(blank=True, max_length=30, null=True, validators=[django.core.validators.RegexValidator('^\\w{0,30}$')]),
),
]
# Generated by Django 2.2.8 on 2019-12-06 09:00
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0002_auto_20191206_1557'),
]
operations = [
migrations.AlterField(
model_name='student',
name='region',
field=models.CharField(blank=True, max_length=30, null=True, validators=[django.core.validators.RegexValidator('^[A-Za-z]+$')]),
),
]
......@@ -7,7 +7,7 @@ from django.core.validators import MinValueValidator, MaxValueValidator, RegexVa
from django.db import models
from core.lib.validators import validate_document_file_extension, validate_image_file_extension, validate_npm, \
validate_student_gpa, validate_toefl_score
validate_student_gpa, validate_languages_contains_string_type_value, validate_toefl_score
def get_student_resume_file_path(instance, filename):
......@@ -123,7 +123,7 @@ class Student(models.Model):
awards = models.CharField(max_length=100, blank=True, null=True)
projects = models.CharField(max_length=100, blank=True, null=True)
certification = models.CharField(max_length=100, blank=True, null=True)
languages = models.CharField(max_length=100, blank=True, null=True)
languages = models.CharField(max_length=100, blank=True, null=True, validators=[validate_languages_contains_string_type_value])
seminar = models.CharField(max_length=100, blank=True, null=True)
interests = models.CharField(max_length=100, blank=True, null=True)
dependants = models.IntegerField(db_column='dependants', default=0, blank=True, null=True)
......
......@@ -5,6 +5,7 @@ from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from rest_framework import status
from rest_framework.test import APITestCase
from rest_framework.exceptions import ErrorDetail
from django.core import serializers
from core.models.accounts import Student
......@@ -139,13 +140,18 @@ class ProfileUpdateTests(APITestCase):
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('self_description'), 'I am very happy')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'languages': 'Indonesia, Jerman'}, format='multipart', encoding='utf-8')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('languages'), 'Indonesia, Jerman')
response = self.client.patch(url, {'languages': '123456'}, format='multipart', encoding='utf-8')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
response = self.client.patch(url, {'linkedin_url': 'https://www.linkedin.com/in/jojo/'}, format='multipart',
encoding='utf-8')
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, {'linkedin_url': 'https://linkedin.com/in/jojo/'}, format='multipart',
encoding='utf-8')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
......
......@@ -89,7 +89,6 @@
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
"dev": true,
"optional": true,
"requires": {
"is-extendable": "^0.1.0"
}
......@@ -1750,7 +1749,7 @@
"@babel/plugin-proposal-do-expressions": {
"version": "7.6.0",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-do-expressions/-/plugin-proposal-do-expressions-7.6.0.tgz",
"integrity": "sha1-GSlT/thiDRPRKmH2je/Sb0EFkZM=",
"integrity": "sha512-qJDaoBDbLySwU1tG0jbAomOwz8W1PEiiiK0iLQAnHLr4PYIMVX4ltDGkj3uAKx4HDs1WJ0tozGW1zAQjuTIiWg==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.0.0",
......@@ -1770,7 +1769,7 @@
"@babel/plugin-proposal-export-default-from": {
"version": "7.5.2",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-default-from/-/plugin-proposal-export-default-from-7.5.2.tgz",
"integrity": "sha1-LArC3MNuOyRD/q0sPF/HlvsbUUU=",
"integrity": "sha512-wr9Itk05L1/wyyZKVEmXWCdcsp/e185WUNl6AfYZeEKYaUPPvHXRDqO5K1VH7/UamYqGJowFRuCv30aDYZawsg==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.0.0",
......@@ -1780,7 +1779,7 @@
"@babel/plugin-proposal-export-namespace-from": {
"version": "7.5.2",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.5.2.tgz",
"integrity": "sha1-zNXtBbBtcAaI/x2wGp3ScVXg0qA=",
"integrity": "sha512-TKUdOL07anjZEbR1iSxb5WFh810KyObdd29XLFLGo1IDsSuGrjH3ouWSbAxHNmrVKzr9X71UYl2dQ7oGGcRp0g==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.0.0",
......@@ -1801,7 +1800,7 @@
"@babel/plugin-proposal-json-strings": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.2.0.tgz",
"integrity": "sha1-Vo7MRGxhSK5rJn8CVREwiR4p8xc=",
"integrity": "sha512-MAFV1CA/YVmYwZG0fBQyXhmj0BHCB5egZHCKWIFVv/XCxAeVGIHfos3SwDck4LvCllENIAg7xMKOG5kH0dzyUg==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.0.0",
......@@ -1811,7 +1810,7 @@
"@babel/plugin-proposal-logical-assignment-operators": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.2.0.tgz",
"integrity": "sha1-ilzqbEKnyHRGlZ4C//X60BLFb1c=",
"integrity": "sha512-0w797xwdPXKk0m3Js74hDi0mCTZplIu93MOSfb1ZLd/XFe3abWypx1QknVk0J+ohnsjYpvjH4Gwfo2i3RicB6Q==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.0.0",
......@@ -1821,7 +1820,7 @@
"@babel/plugin-proposal-nullish-coalescing-operator": {
"version": "7.4.4",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.4.4.tgz",
"integrity": "sha1-QcNg1ZSB2I4M46P4N98QEhp2mzk=",
"integrity": "sha512-Amph7Epui1Dh/xxUxS2+K22/MUi6+6JVTvy3P58tja3B6yKTSjwwx0/d83rF7551D6PVSSoplQb8GCwqec7HRw==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.0.0",
......@@ -1831,7 +1830,7 @@
"@babel/plugin-proposal-numeric-separator": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.2.0.tgz",
"integrity": "sha1-ZGhU2vTNIv1nM/YHYBOpNjEEQ6w=",
"integrity": "sha512-DohMOGDrZiMKS7LthjUZNNcWl8TAf5BZDwZAH4wpm55FuJTHgfqPGdibg7rZDmont/8Yg0zA03IgT6XLeP+4sg==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.0.0",
......@@ -1861,7 +1860,7 @@
"@babel/plugin-proposal-optional-chaining": {
"version": "7.6.0",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.6.0.tgz",
"integrity": "sha1-6b8fm5uhDHfAMwgtp18Gg4kEGvg=",
"integrity": "sha512-kj4gkZ6qUggkprRq3Uh5KP8XnE1MdIO0J7MhdDX8+rAbB6dJ2UrensGIS+0NPZAaaJ1Vr0PN6oLUgXMU1uMcSg==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.0.0",
......@@ -1871,7 +1870,7 @@
"@babel/plugin-proposal-pipeline-operator": {
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-pipeline-operator/-/plugin-proposal-pipeline-operator-7.5.0.tgz",
"integrity": "sha1-QQDsVe9PakwkkLX1pPKiLfonLAY=",
"integrity": "sha512-HFYuu/yGnkn69ligXxU0ohOVvQDsMNOUJs/c4PYLUVS6ntCYOyGmRQQaSYJARJ9rvc7/ulZKIzxd4wk91hN63A==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.0.0",
......@@ -1881,7 +1880,7 @@
"@babel/plugin-proposal-throw-expressions": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-throw-expressions/-/plugin-proposal-throw-expressions-7.2.0.tgz",
"integrity": "sha1-LZ5FLTcPE5AA5R22XQqF3GDGRzk=",
"integrity": "sha512-adsydM8DQF4i5DLNO4ySAU5VtHTPewOtNBV3u7F4lNMPADFF9bWQ+iDtUUe8+033cYCUz+bFlQdXQJmJOwoLpw==",
"dev": true,
"requires": {
"@babel/helper-plugin-utils": "^7.0.0",
......@@ -1928,7 +1927,7 @@
"@babel/plugin-syntax-dynamic-import": {