Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Class Project
Kape
Commits
64b52d44
Commit
64b52d44
authored
Dec 06, 2019
by
Metta Anantha Pindika
Browse files
Merge branch '1606876046-203' into 'master'
1606876046 203 See merge request
!263
parents
cab7b151
fb3e5c20
Pipeline
#26778
passed with stages
in 45 minutes and 30 seconds
Changes
7
Pipelines
1
Show whitespace changes
Inline
Side-by-side
assets/js/CompanyProfile.jsx
View file @
64b52d44
...
...
@@ -7,6 +7,7 @@ import { Doughnut } from 'react-chartjs-2';
import
Server
from
'
./lib/Server
'
;
import
Dumper
from
'
./lib/Dumper
'
;
import
ModalAlert
from
'
./components/ModalAlert
'
;
import
DatePicker
from
"
react-datepicker
"
;
export
default
class
CompanyProfile
extends
React
.
Component
{
static
propTypes
=
{
...
...
@@ -21,6 +22,7 @@ export default class CompanyProfile extends React.Component {
address
:
this
.
props
.
user
.
data
.
company
.
address
,
category
:
this
.
props
.
user
.
data
.
company
.
category
,
description
:
this
.
props
.
user
.
data
.
company
.
description
,
founded
:
this
.
props
.
user
.
data
.
company
.
founded
,
website
:
this
.
props
.
user
.
data
.
company
.
website
,
logo
:
this
.
props
.
user
.
data
.
company
.
logo
,
size
:
this
.
props
.
user
.
data
.
company
.
size
,
...
...
@@ -30,6 +32,7 @@ export default class CompanyProfile extends React.Component {
name
:
''
,
address
:
''
,
description
:
''
,
founded
:
''
,
website
:
''
,
size
:
''
,
},
...
...
@@ -61,6 +64,7 @@ export default class CompanyProfile extends React.Component {
category
:
result
.
category
,
id
:
result
.
id
,
description
:
result
.
description
,
founded
:
result
.
founded
,
refresh
:
this
.
state
.
refresh
+
1
,
website
:
result
.
website
,
size
:
result
.
size
,
...
...
@@ -150,6 +154,9 @@ export default class CompanyProfile extends React.Component {
-
{
this
.
state
.
description
}
</
p
>
<
p
>
Founded:
{
this
.
state
.
founded
}
</
p
>
<
p
>
{
this
.
state
.
website
}
</
p
>
<
p
>
{
this
.
state
.
size
}
...
...
@@ -225,6 +232,17 @@ karyawan
}
/>
</
Form
.
Field
>
<
label
htmlFor
=
"founded"
>
Founded:
</
label
>
<
input
name
=
"founded"
placeholder
=
"YYYY-MM-DD"
pattern
=
"\d{4}\-\d{2}\-\d{2}"
onChange
=
{
this
.
handleChange
}
defaultValue
=
{
this
.
state
.
founded
===
null
?
null
:
this
.
state
.
founded
}
/>
<
Form
.
Field
/>
<
Form
.
Field
>
<
label
htmlFor
=
"size"
>
Jumlah karyawan
</
label
>
<
input
...
...
assets/js/components/CompanyRegisterModal.jsx
View file @
64b52d44
...
...
@@ -193,6 +193,10 @@ export default class CompanyRegisterModal extends React.Component {
<
label
htmlFor
=
"description"
>
Deskripsi
</
label
>
<
TextArea
onChange
=
{
this
.
handleChange
}
placeholder
=
"Tell us more"
name
=
"description"
autoHeight
required
/>
</
Form
.
Field
>
<
Form
.
Field
required
>
<
label
htmlFor
=
"founded"
>
Founded
</
label
>
<
TextArea
onChange
=
{
this
.
handleChange
}
placeholder
=
"YYYY-MM-DD"
name
=
"founded"
required
/>
</
Form
.
Field
>
<
Form
.
Field
required
>
<
label
htmlFor
=
"address"
>
Alamat
</
label
>
<
Input
onChange
=
{
this
.
handleChange
}
placeholder
=
"Alamat"
name
=
"address"
required
/>
...
...
core/migrations/0003_company_founded.py
0 → 100644
View file @
64b52d44
# Generated by Django 2.2.8 on 2019-12-06 08:01
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'core'
,
'0002_student_ielts'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'company'
,
name
=
'founded'
,
field
=
models
.
DateTimeField
(
blank
=
True
,
null
=
True
),
),
]
core/migrations/0004_auto_20191206_1510.py
0 → 100644
View file @
64b52d44
# Generated by Django 2.2.8 on 2019-12-06 08:10
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'core'
,
'0003_company_founded'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'company'
,
name
=
'founded'
,
field
=
models
.
DateField
(
blank
=
True
,
null
=
True
),
),
]
core/models/accounts.py
View file @
64b52d44
...
...
@@ -161,6 +161,7 @@ class Company(models.Model):
updated
=
models
.
DateTimeField
(
auto_now
=
True
)
user
=
models
.
OneToOneField
(
User
,
on_delete
=
models
.
CASCADE
)
description
=
models
.
TextField
()
founded
=
models
.
DateField
(
blank
=
True
,
null
=
True
)
status
=
models
.
IntegerField
(
default
=
NEW
,
validators
=
[
MaxValueValidator
(
2
),
MinValueValidator
(
0
)])
logo
=
models
.
FileField
(
upload_to
=
get_company_logo_file_path
,
null
=
True
,
blank
=
True
,
validators
=
[
validate_image_file_extension
])
...
...
core/serializers/accounts.py
View file @
64b52d44
...
...
@@ -175,6 +175,7 @@ class CompanyUpdateSerializer(serializers.ModelSerializer):
return
{
'address'
:
instance
.
address
,
'description'
:
instance
.
description
,
'founded'
:
instance
.
founded
,
'name'
:
instance
.
user
.
first_name
,
'website'
:
instance
.
website
,
'linkedin_url'
:
instance
.
linkedin_url
,
...
...
@@ -185,8 +186,8 @@ class CompanyUpdateSerializer(serializers.ModelSerializer):
instance
.
address
=
validated_data
.
get
(
'address'
,
instance
.
address
)
instance
.
website
=
validated_data
.
get
(
'website'
,
instance
.
website
)
instance
.
size
=
validated_data
.
get
(
'size'
,
instance
.
size
)
instance
.
description
=
validated_data
.
get
(
'description
'
,
instance
.
description
)
instance
.
description
=
validated_data
.
get
(
'description'
,
instance
.
description
)
instance
.
founded
=
validated_data
.
get
(
'founded
'
,
instance
.
founded
)
instance
.
user
.
first_name
=
validated_data
.
get
(
'name'
,
instance
.
user
.
first_name
)
instance
.
linkedin_url
=
validated_data
.
get
(
'linkedin_url'
,
instance
.
linkedin_url
)
...
...
@@ -196,7 +197,7 @@ class CompanyUpdateSerializer(serializers.ModelSerializer):
class
Meta
:
model
=
Company
fields
=
[
'address'
,
'description'
,
'name'
,
'website'
,
'linkedin_url'
,
'size'
]
fields
=
[
'address'
,
'description'
,
'founded'
,
'name'
,
'website'
,
'linkedin_url'
,
'size'
]
class
CompanySerializer
(
serializers
.
ModelSerializer
):
...
...
core/tests/test_accounts.py
View file @
64b52d44
...
...
@@ -92,6 +92,7 @@ class RegisterTests(APITestCase):
def
test_create_and_recreate
(
self
):
url
=
'/api/register/'
tc_post
=
{
'password'
:
'corporatepass'
,
'name'
:
'tutuplapak'
,
'description'
:
'menutup lapak'
,
'founded'
:
'2019-01-01'
,
'email'
:
'email@email.com'
,
'logo'
:
'lalala'
,
'address'
:
'alamat'
,
'category'
:
'Perusahaan Jasa'
,
'website'
:
'www.tutuplapak.com'
,
'size'
:
'1000'
}
...
...
@@ -486,6 +487,9 @@ class ProfileUpdateTests(APITestCase):
response
=
self
.
client
.
patch
(
url
,
{
'description'
:
'Masak-Masak'
},
format
=
'multipart'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_202_ACCEPTED
)
response
=
self
.
client
.
patch
(
url
,
{
'founded'
:
'2019-01-01'
},
format
=
'multipart'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_202_ACCEPTED
)
response
=
self
.
client
.
patch
(
url
,
{
'size'
:
'1000'
},
format
=
'multipart'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_202_ACCEPTED
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment