Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Fasilkom UI Open Source Software
Kape
Commits
30b6238a
Commit
30b6238a
authored
Apr 26, 2017
by
M. Reza Qorib
Browse files
Update applicancy status
parent
5dac8617
Changes
4
Hide whitespace changes
Inline
Side-by-side
assets/js/VacancyPage.jsx
View file @
30b6238a
...
...
@@ -44,6 +44,7 @@ export default class VacancyPage extends React.Component {
<
VacancyList
key
=
{
2
}
userId
=
{
this
.
state
.
id
}
status
=
"applied"
url
=
{
`/students/
${
this
.
state
.
id
}
/applied-vacancies/`
}
/>
</
Pane
>
...
...
assets/js/components/Applicant.jsx
View file @
30b6238a
...
...
@@ -20,6 +20,8 @@ export default class Applicant extends React.Component {
ACCEPTED
:
4
,
};
static
APPLICATION_STATUS_TEXT
=
[
'
Baru
'
,
'
Sudah Dibaca
'
,
'
Ditandai
'
,
'
Diterima
'
,
'
Ditolak
'
];
constructor
(
props
)
{
super
(
props
);
/* istanbul ignore next */
...
...
assets/js/components/Vacancy.jsx
View file @
30b6238a
...
...
@@ -13,10 +13,12 @@ export default class Vacancy extends React.Component {
data
:
React
.
PropTypes
.
object
.
isRequired
,
bookmarked
:
React
.
PropTypes
.
number
,
status
:
React
.
PropTypes
.
string
.
isRequired
,
applicationStatus
:
React
.
PropTypes
.
string
,
};
static
defaultProps
=
{
bookmarked
:
0
,
applicationStatus
:
''
,
};
constructor
(
props
)
{
...
...
@@ -104,6 +106,7 @@ export default class Vacancy extends React.Component {
</
Grid
.
Row
>
<
Grid
.
Row
>
{
this
.
generateAction
()
}
<
p
>
{
this
.
props
.
applicationStatus
}
</
p
>
</
Grid
.
Row
>
</
Grid
.
Column
>
</
Grid
.
Row
>
...
...
assets/js/components/VacancyList.jsx
View file @
30b6238a
import
React
from
'
react
'
;
import
{
Item
,
Button
,
Grid
,
Segment
}
from
'
semantic-ui-react
'
;
import
{
Item
,
Button
,
Grid
}
from
'
semantic-ui-react
'
;
import
{
Link
}
from
'
react-router
'
;
import
Vacancy
from
'
./Vacancy
'
;
import
CompanyVacancy
from
'
./CompanyVacancy
'
;
import
Server
from
'
../lib/Server
'
;
import
ModalAlert
from
'
../components/ModalAlert
'
;
import
Aplicant
from
'
./../components/Applicant
'
;
export
default
class
VacancyList
extends
React
.
Component
{
...
...
@@ -13,10 +14,12 @@ export default class VacancyList extends React.Component {
url
:
React
.
PropTypes
.
string
.
isRequired
,
userId
:
React
.
PropTypes
.
number
.
isRequired
,
type
:
React
.
PropTypes
.
string
,
status
:
React
.
PropTypes
.
string
,
};
static
defaultProps
=
{
type
:
'
student
'
,
status
:
'
new
'
,
};
constructor
(
props
)
{
...
...
@@ -29,6 +32,7 @@ export default class VacancyList extends React.Component {
Server
.
get
(
this
.
props
.
url
,
false
).
then
((
data
)
=>
{
this
.
setState
({
vacancies
:
data
});
});
console
.
log
(
this
.
state
.
vacancies
);
this
.
updateStatusList
=
this
.
updateStatusList
.
bind
(
this
);
this
.
generateVacancies
=
this
.
generateVacancies
.
bind
(
this
);
this
.
checkBookmark
=
this
.
checkBookmark
.
bind
(
this
);
...
...
@@ -45,7 +49,7 @@ export default class VacancyList extends React.Component {
checkApplied
(
id
)
{
for
(
let
i
=
0
;
i
<
this
.
state
.
appliedList
.
length
;
i
+=
1
)
{
if
(
id
===
this
.
state
.
appliedList
[
i
].
id
)
{
return
'
registered
'
;
}
if
(
id
===
this
.
state
.
appliedList
[
i
].
vacancy
.
id
)
{
return
'
registered
'
;
}
}
return
'
new
'
;
}
...
...
@@ -55,7 +59,12 @@ export default class VacancyList extends React.Component {
this
.
setState
({
bookmarkList
:
data
});
});
Server
.
get
(
`/students/
${
this
.
props
.
userId
}
/applied-vacancies/`
,
false
).
then
((
data
)
=>
{
// console.log('hasil api:');
// console.log(data);
// console.log(data.vacancy);
this
.
setState
({
appliedList
:
data
});
console
.
log
(
'
applied list:
'
)
console
.
log
(
this
.
state
.
appliedList
);
});
}
...
...
@@ -73,12 +82,14 @@ export default class VacancyList extends React.Component {
return
this
.
state
.
vacancies
.
map
(
vacancy
=>
(
<
Vacancy
key
=
{
vacancy
.
id
}
status
=
{
this
.
checkApplied
(
vacancy
.
id
)
}
bookmarked
=
{
this
.
checkBookmark
(
vacancy
.
id
)
}
data
=
{
vacancy
}
key
=
{
this
.
props
.
status
===
'
applied
'
?
vacancy
.
vacancy
.
id
:
vacancy
.
id
}
status
=
{
this
.
checkApplied
(
this
.
props
.
status
===
'
applied
'
?
vacancy
.
vacancy
.
id
:
vacancy
.
id
)
}
bookmarked
=
{
this
.
checkBookmark
(
this
.
props
.
status
===
'
applied
'
?
vacancy
.
vacancy
.
id
:
vacancy
.
id
)
}
data
=
{
this
.
props
.
status
===
'
applied
'
?
vacancy
.
vacancy
:
vacancy
}
studentId
=
{
this
.
props
.
userId
}
/>
applicationStatus
=
{
this
.
props
.
status
===
'
applied
'
?
(
vacancy
.
status
===
4
?
'
Ditolak
'
:
(
vacancy
.
status
===
3
?
'
Diterima
'
:
'
Terdaftar
'
))
:
''
}
>
{
console
.
log
(
this
.
checkApplied
(
this
.
props
.
status
===
'
applied
'
?
vacancy
.
vacancy
.
id
:
vacancy
.
id
))
}
</
Vacancy
>
),
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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