Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Tia-dev
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dida Adams Arizona
Tia-dev
Commits
9bd4d0e2
Commit
9bd4d0e2
authored
Jul 14, 2022
by
muhammad ridwan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
front end tambahan menu carfm
parent
9bd0ec10
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1369 additions
and
42 deletions
+1369
-42
.env_dev
.env_dev
+1
-1
index.js
src/api/index.js
+5
-0
AntiFraud.js
src/container/CRFM/AntiFraud.js
+357
-0
CreateCrafmDoc.js
src/container/CRFM/CreateCrafmDoc.js
+514
-0
InternalAudit.js
src/container/CRFM/InternalAudit.js
+112
-37
RiskManagement.js
src/container/CRFM/RiskManagement.js
+357
-0
TableDocument.js
src/container/CRFM/TableDocument.js
+8
-4
homeRoutes.js
src/router/homeRoutes.js
+15
-0
No files found.
.env_dev
View file @
9bd4d0e2
// contents of .env
REACT_APP_URL_MAIN_BE=https://tia.eksad.com/tia-reporting
-dev
REACT_APP_URL_MAIN_BE=https://tia.eksad.com/tia-reporting
REACT_APP_URL_MAIN_FE=/tia-web-dev
"cpy_file_build_windows" : "robocopy E:\tia-web\src\tia-dev\src E:\tia-web\src /e",
...
...
src/api/index.js
View file @
9bd4d0e2
...
...
@@ -470,6 +470,7 @@ const create = (type = "") => {
// MANAGEMENT DOCUMENT
// const getDocumentCategory = (body) => api.post('setting/get_all_setting_document_category', body)
const
getDocumentCategory
=
()
=>
api
.
get
(
'setting/get_all_setting_document_category'
)
const
getCarfmDocumentBySubmenu
=
(
body
)
=>
api
.
post
(
'document/get_cafrm_document_by_submenu'
,
body
);
const
getAllDocument
=
(
body
)
=>
api
.
post
(
'document/get_all_document'
,
body
)
const
uploadDocument
=
(
body
)
=>
api
.
post
(
'document/upload_document'
,
body
)
const
updateDocument
=
(
body
)
=>
api
.
post
(
'document/update_document'
,
body
)
...
...
@@ -477,6 +478,8 @@ const create = (type = "") => {
const
getPerusahaanUserActive
=
()
=>
api
.
get
(
'company/get_all_user_company_active'
)
const
getDetailDocument
=
(
id
)
=>
api
.
get
(
`document/get_document_by_id/
${
id
}
`
)
const
deleteDocument
=
(
id
)
=>
api
.
post
(
`document/delete_document/
${
id
}
`
)
const
uploadCarfmDocument
=
(
body
)
=>
api
.
post
(
'document/upload_cafrm_document'
,
body
)
// Monitoring
const
getMonitoringMB
=
(
body
)
=>
api
.
get
(
`transaction/monitoring/submission/
${
body
.
year
}
`
)
...
...
@@ -591,9 +594,11 @@ const create = (type = "") => {
deleteParameter
,
deletePerusahaan
,
deleteReportItems
,
getCarfmDocumentBySubmenu
,
getDocumentCategory
,
getAllDocument
,
uploadDocument
,
uploadCarfmDocument
,
updateDocument
,
downloadDocument
,
getPerusahaanUserActive
,
...
...
src/container/CRFM/AntiFraud.js
0 → 100644
View file @
9bd4d0e2
import
React
,
{
Component
}
from
'react'
import
{
withStyles
}
from
'@material-ui/core/styles'
;
import
{
createMuiTheme
,
MuiThemeProvider
,
Paper
,
Snackbar
,
Tab
,
Tabs
,
Typography
}
from
'@material-ui/core'
;
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
Constant
from
'../../library/Constant'
;
import
Images
from
'../../assets/Images'
;
import
ReactTooltip
from
'react-tooltip'
;
import
api
from
'../../api'
;
import
PropagateLoader
from
"react-spinners/PropagateLoader"
import
TableDocument
from
"./TableDocument"
;
import
PopUpKonfirmasi
from
"../DocumentManagement/PopUpKonfirmasi"
;
import
CreateCrafmDoc
from
"./CreateCrafmDoc"
;
const
Alert
=
withStyles
({})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
export
default
class
RiskManagement
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
alert
:
false
,
listData
:
[],
id
:
0
,
btncreate
:
false
,
btnview
:
false
,
load
:
false
,
name
:
''
,
userCompActive
:
[],
isHasAccessDocument
:
false
,
submenu_id
:
27
,
submenu_name
:
"anti-fraud"
,
menu_title
:
"Anti-Fraud"
}
}
componentDidMount
()
{
// this.getPermission()
this
.
getDataCarfm
();
this
.
getDetailUser
();
}
getDataCarfm
(){
let
payload
=
{
submenu_id
:
this
.
state
.
submenu_id
}
api
.
create
().
getCarfmDocumentBySubmenu
(
payload
).
then
(
response
=>
{
if
(
response
){
if
(
response
.
data
.
status
===
'success'
){
let
dataList
=
[]
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
// if (item.value == "Manual Book TIA 4.0sss") {
dataList
.
push
(
item
)
// }
})
if
(
dataList
.
length
==
0
)
{
this
.
setState
({
isHasAccessDocument
:
dataList
.
length
==
0
?
false
:
true
})
}
else
{
this
.
setState
({
isHasAccessDocument
:
dataList
.
length
==
0
?
false
:
true
,
listData
:
dataList
,
loadTable
:
true
,
refresh
:
''
},
()
=>
{
this
.
getPermission
(
this
.
state
.
submenu_name
)
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
)
}
getPermission
(
subMenu
)
{
let
payload
=
{
menu
:
subMenu
}
api
.
create
().
getPermission
(
payload
).
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
btncreate
:
response
.
data
.
data
.
create
,
btnview
:
response
.
data
.
data
.
view
,
btndownload
:
response
.
data
.
data
.
download
,
load
:
true
})
console
.
log
(
"btn create "
+
this
.
state
.
btncreate
);
}
else
{
this
.
setState
({
load
:
true
})
}
}
else
{
this
.
setState
({
load
:
true
})
}
})
}
getDetailUser
()
{
let
userId
=
localStorage
.
getItem
(
Constant
.
USER
)
api
.
create
().
getDetailUser
(
userId
).
then
((
response
)
=>
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
userCompany
:
response
.
data
.
data
.
company
,
visibleTrue
:
false
},
()
=>
{
this
.
getCompanyActive
()
console
.
log
(
this
.
state
.
userCompany
);
})
}
}
}
})
}
getCompanyActive
()
{
api
.
create
().
getPerusahaanActive
().
then
((
response
)
=>
{
console
.
log
(
"getcompanyactive start"
);
console
.
log
(
response
);
console
.
log
(
"getcompanyactive stop"
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
compActive
=
[]
let
userCompActive
=
[]
this
.
state
.
userCompany
.
map
((
item
,
index
)
=>
{
let
indeks
=
data
.
findIndex
((
val
)
=>
val
.
company_id
==
item
)
if
(
indeks
!==
-
1
&&
String
(
data
[
indeks
].
status
).
toLocaleLowerCase
()
==
'active'
){
userCompActive
.
push
(
item
)
}
})
data
.
map
((
item
,
index
)
=>
{
if
(
String
(
item
.
status
).
toLocaleLowerCase
()
==
'active'
)
{
compActive
.
push
(
item
)
}
})
if
(
compActive
.
length
==
userCompActive
.
length
){
this
.
setState
({
btnadd
:
true
})
}
else
{
this
.
setState
({
btnadd
:
false
})
}
this
.
setState
({
userCompActive
,
visibleTrue
:
true
})
// console.log(userCompActive)
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
visibleTrue
:
true
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
console
.
log
(
"error di getcompany active"
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
listCompany
:
null
,
company
:
null
,
visibleTrue
:
true
})
}
})
}
createUploadDocument
()
{
this
.
setState
({
visibleCreate
:
false
,
konfirmasi
:
false
})
const
formData
=
this
.
state
.
formData
formData
.
append
(
"documentId"
,
this
.
state
.
docId
)
formData
.
append
(
"updated"
,
1
)
this
.
setState
({
loading
:
true
})
api
.
create
().
updateDocument
(
formData
).
then
(
response
=>
{
// console.log(response)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
getDataDocument
(
this
.
state
.
settingID
,
this
.
state
.
menuName
)
this
.
setState
({
konfirmasi
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
,
visibleCreate
:
false
,
loading
:
false
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
}
createDocument
(
payload
)
{
//upload apinya disini
this
.
setState
({
loading
:
true
})
api
.
create
().
uploadCarfmDocument
(
payload
).
then
(
response
=>
{
// console.log(response)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
message
===
"The Document Already Exists in The System, Do You Want to Overwrite It?"
)
{
this
.
setState
({
konfirmasi
:
true
,
formData
:
payload
,
docId
:
response
.
data
.
data
.
document_id
,
loading
:
false
})
}
else
if
(
response
.
data
.
message
===
"Data was Saved Successfully"
)
{
this
.
getDataCarfm
()
this
.
setState
({
visibleCreate
:
false
,
loading
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
}
closeAlert
()
{
this
.
setState
({
alert
:
false
})
}
handleLoading
(
tipe
)
{
this
.
setState
({
loading
:
tipe
==
0
?
false
:
true
})
}
render
()
{
const
loadingComponent
=
(
<
div
style
=
{{
position
:
'absolute'
,
zIndex
:
1500
,
top
:
0
,
left
:
0
,
width
:
'100%'
,
height
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
background
:
'rgba(255,255,255,0.8)'
}}
>
<
PropagateLoader
// css={override}
size
=
{
20
}
color
=
{
"#274B80"
}
loading
=
{
this
.
state
.
loading
}
/
>
<
/div
>
);
return
(
<
div
style
=
{{
height
:
this
.
props
.
height
,
backgroundColor
:
'#f8f8f8'
}}
>
{
/* {this.props.load && ()} */
}
<
Snackbar
open
=
{
this
.
state
.
alert
}
autoHideDuration
=
{
6000
}
onClose
=
{()
=>
this
.
closeAlert
()}
>
<
Alert
onClose
=
{()
=>
this
.
closeAlert
()}
severity
=
{
this
.
state
.
tipeAlert
}
>
{
this
.
state
.
messageAlert
}
<
/Alert
>
<
/Snackbar
>
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
{
this
.
state
.
menu_title
}
<
/Typography
>
<
/div
>
<
div
style
=
{{
padding
:
20
}}
>
{
this
.
state
.
loading
&&
loadingComponent
&&
this
.
state
.
isHasAccessDocument
}
<
Paper
style
=
{{
padding
:
20
}}
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
{(
this
.
state
.
btncreate
)
&&
<
span
>
<
a
data
-
tip
=
{
'Add'
}
data
-
for
=
"add"
>
<
div
style
=
{{
display
:
'grid'
,
justifyContent
:
'flex-end'
}}
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
setState
({
visibleCreate
:
true
,
refresh
:
''
})}
style
=
{{
marginRight
:
25
,
background
:
'transparent'
}}
>
<
img
src
=
{
Images
.
add
}
/
>
<
/button
>
<
/div
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"add"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/span>
}
<
/div
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
this
.
state
.
visibleTrue
&&
(
<
TableDocument
data
=
{
this
.
state
.
listData
}
refresh
=
{
this
.
state
.
refresh
}
load
=
{
true
}
userCompActive
=
{
this
.
state
.
userCompActive
}
handleLoading
=
{
this
.
handleLoading
.
bind
(
this
)}
name
=
{
this
.
state
.
name
}
submenu_id
=
{
this
.
state
.
submenu_id
}
btndownload
=
{
this
.
state
.
btndownload
}
/
>
)}
<
/div
>
<
/Paper
>
{
!
this
.
state
.
isHasAccessDocument
&&
(
<
Paper
style
=
{{
padding
:
20
}}
>
<
label
>
You
Don
't Have Any Access in Document Management</label>
</Paper>
)}
</div>
{this.state.konfirmasi && (
<PopUpKonfirmasi
onClickClosePopUp={() => this.setState({ konfirmasi: false })}
uploadDocId={this.createUploadDocument.bind(this)}
/>
)}
{this.state.visibleCreate && (
<CreateCrafmDoc
onClickClose={() => this.setState({ visibleCreate: false })}
// getDataDocument={this.getDataDocument.bind(this)}
createDocument={this.createDocument.bind(this)}
handleLoading={this.handleLoading.bind(this)}
allsubcoCreate={this.state.btnadd}
submenu_id={this.state.submenu_id}
/>
)}
</div>
);
}
}
src/container/CRFM/CreateCrafmDoc.js
0 → 100644
View file @
9bd4d0e2
import
React
,
{
Component
}
from
'react'
import
Images
from
'../../assets/Images'
import
{
TextField
,
withStyles
,
Snackbar
}
from
'@material-ui/core'
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
api
from
'../../api'
import
Autocomplete
from
'@material-ui/lab/Autocomplete'
import
Constant
from
'../../library/Constant'
import
{
format
}
from
'date-fns'
;
import
UploadFile
from
"../../library/Upload"
;
import
{
ExcelRenderer
}
from
'react-excel-renderer'
;
import
*
as
R
from
'ramda'
import
PropagateLoader
from
"react-spinners/PropagateLoader"
const
Alert
=
withStyles
({
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
export
default
class
CreateCrafmDoc
extends
Component
{
constructor
(
props
)
{
super
(
props
)
this
.
state
=
{
perusahaan
:
null
,
perusahaanData
:
null
,
getPerusahaan
:
null
,
errorPerusahaan
:
false
,
msgErrorPerusahaan
:
''
,
document
:
null
,
documentData
:
null
,
getDocument
:
null
,
errorDocument
:
false
,
msgErrorDocument
:
''
,
listPeriode
:
null
,
periode
:
null
,
errorPeriode
:
false
,
msgErrorPeriode
:
''
,
listMonth
:
null
,
monthId
:
null
,
errorMonth
:
false
,
msgErrorMonth
:
''
,
description
:
''
,
errorDesc
:
false
,
msgErrorDesc
:
''
,
file
:
null
,
alert
:
false
,
tipeAlert
:
''
,
messageAlert
:
''
,
fileType
:
''
,
konfirmasi
:
false
,
docId
:
''
,
sizeUpload
:
"1"
,
disabledPeriode
:
false
,
menuName
:
null
}
}
componentDidMount
()
{
this
.
getDataCompany
()
this
.
getPeriode
()
this
.
getMonth
()
this
.
getFileSize
()
this
.
getMenuName
()
}
getFileSize
()
{
let
body
=
{
group
:
'MAX_FILE_SIZE'
,
company_id
:
0
,
type
:
'MAX_FILE_SIZE'
}
api
.
create
().
getAllSettingByType
(
body
).
then
(
response
=>
{
// console.log(response);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
data
.
length
==
0
)
{
this
.
setState
({
sizeUpload
:
"1"
})
}
else
{
this
.
setState
({
sizeUpload
:
response
.
data
.
data
[
0
].
value
})
}
// sizeUpload: response.data.data[0] ? response.data.data[0].value === undefined ? "1" : response.data.data[0].value : "1"
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
})
}
getDataCompany
()
{
api
.
create
().
getPerusahaanUserActive
().
then
((
response
)
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
typeData
=
data
.
map
((
item
)
=>
{
return
{
company_id
:
item
.
company_id
,
company_name
:
item
.
company_name
}
})
// typeData.push({
// company_id: 0,
// company_name: 'Default'
// })
let
typeProps
=
{
options
:
typeData
.
sort
((
a
,
b
)
=>
a
.
company_name
-
b
.
company_name
),
getOptionLabel
:
(
option
)
=>
option
.
company_name
,
};
this
.
setState
({
perusahaan
:
typeProps
,
perusahaanData
:
response
.
data
.
data
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
})
}
getMenuName
(){
api
.
create
().
getMenuByUser
().
then
(
response
=>
{
if
(
response
.
data
){
if
(
response
.
data
.
status
===
'success'
){
response
.
data
.
data
.
map
(
(
item
)
=>
{
if
(
item
.
menu_id
==
this
.
props
.
submenu_id
){
this
.
setState
({
menuName
:
item
.
menu_name
}
);
}
}
)
}
}
}
)
}
getPeriode
()
{
api
.
create
().
getPeriodeTransaction
().
then
(
response
=>
{
let
dateNow
=
new
Date
let
year
=
format
(
dateNow
,
'yyyy'
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
let
data
=
response
.
data
.
data
let
periodeData
=
data
.
map
((
item
)
=>
{
return
{
periode
:
item
,
}
})
let
defaultProps
=
{
options
:
periodeData
,
getOptionLabel
:
(
option
)
=>
option
.
periode
,
};
let
index
=
data
.
sort
((
a
,
b
)
=>
a
-
b
).
findIndex
((
val
)
=>
val
==
year
)
this
.
setState
({
listPeriode
:
defaultProps
,
periode
:
index
==
-
1
?
periodeData
[
0
]
:
periodeData
[
index
]
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
})
}
getMonth
()
{
api
.
create
().
getMonthTransaction
().
then
(
response
=>
{
let
dateNow
=
new
Date
// let bulan = format(dateNow, 'MMMM')
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
let
data
=
response
.
data
.
data
let
monthData
=
data
.
map
((
item
)
=>
{
return
{
month_id
:
item
.
month_id
,
month_name
:
item
.
month_name
}
})
let
defaultProps
=
{
options
:
monthData
,
getOptionLabel
:
(
option
)
=>
option
.
month_name
,
};
// let index = data.sort((a, b) => a - b).findIndex((val) => val == bulan)
// this.setState({ listMonth: defaultProps, month: index == -1 ? monthData[0] : monthData[index] })
this
.
setState
({
listMonth
:
defaultProps
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
})
}
clearMessage
()
{
this
.
setState
({
errorPerusahaan
:
false
,
msgErrorPerusahaan
:
''
,
errorDocument
:
false
,
msgErrorDocument
:
''
,
errorMonth
:
false
,
msgErrorMonth
:
''
,
errorPeriode
:
false
,
msgErrorPeriode
:
''
,
})
}
fileHandler
=
(
event
)
=>
{
let
fileObj
=
event
let
length
=
event
.
name
.
split
(
"."
).
length
let
fileType
=
event
.
name
.
split
(
"."
)[
length
-
1
]
if
(
fileType
===
'zip'
||
'rar'
)
{
this
.
setState
({
file
:
event
,
fileType
:
String
(
fileType
)
})
}
else
{
ExcelRenderer
(
fileObj
,
(
err
,
resp
)
=>
{
// console.log(fileType)
if
(
err
)
{
// console.log(err);
}
else
{
this
.
setState
({
file
:
event
,
fileType
:
String
(
fileType
)
})
}
})
}
}
validasi
()
{
if
(
this
.
state
.
disabledPeriode
===
true
)
{
if
(
R
.
isNil
(
this
.
state
.
file
))
{
this
.
setState
({
alert
:
true
,
messageAlert
:
'File Cannot be Empty'
,
tipeAlert
:
'warning'
})
}
else
{
const
formData
=
new
FormData
();
formData
.
append
(
"file"
,
this
.
state
.
file
);
formData
.
append
(
"companyId"
,
1
);
formData
.
append
(
"submenuId"
,
this
.
props
.
submenu_id
);
formData
.
append
(
"description"
,
this
.
state
.
description
);
formData
.
append
(
"extension"
,
this
.
state
.
fileType
);
formData
.
append
(
"documentPeriode"
,
null
);
formData
.
append
(
"documentMonth"
,
null
);
this
.
setState
({
formData
},
()
=>
{
this
.
props
.
createDocument
(
this
.
state
.
formData
)
})
var
object
=
{};
formData
.
forEach
(
function
(
value
,
key
)
{
object
[
key
]
=
value
;
});
var
json
=
JSON
.
stringify
(
object
);
// console.log(object)
}
}
else
{
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
))
{
this
.
setState
({
errorPerusahaan
:
true
,
msgErrorPerusahaan
:
'Company Cannot be Empty'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
periode
))
{
this
.
setState
({
errorPeriode
:
true
,
msgErrorPeriode
:
'Period Cannot be Empty'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
monthId
))
{
this
.
setState
({
errorMonth
:
true
,
msgErrorMonth
:
'Month Cannot be Empty'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
file
))
{
this
.
setState
({
alert
:
true
,
messageAlert
:
'File Cannot be Empty'
,
tipeAlert
:
'warning'
})
}
else
{
const
formData
=
new
FormData
();
formData
.
append
(
"file"
,
this
.
state
.
file
);
formData
.
append
(
"companyId"
,
this
.
state
.
getPerusahaan
.
company_id
);
formData
.
append
(
"submenuId"
,
this
.
props
.
submenu_id
);
formData
.
append
(
"description"
,
this
.
state
.
description
);
formData
.
append
(
"extension"
,
this
.
state
.
fileType
);
formData
.
append
(
"documentPeriode"
,
this
.
state
.
periode
.
periode
);
formData
.
append
(
"documentMonth"
,
this
.
state
.
monthId
.
month_id
);
this
.
setState
({
formData
},
()
=>
{
this
.
props
.
createDocument
(
this
.
state
.
formData
,
)
})
}
}
this
.
props
.
handleLoading
(
0
)
}
deleteFile
(
e
)
{
this
.
setState
({
file
:
null
})
}
closeAlert
()
{
this
.
setState
({
alert
:
false
})
}
render
()
{
const
loadingComponent
=
(
<
div
style
=
{{
position
:
'absolute'
,
zIndex
:
110
,
top
:
0
,
left
:
0
,
width
:
'100%'
,
height
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
background
:
'rgba(255,255,255,0.8)'
}}
>
<
PropagateLoader
// css={override}
size
=
{
20
}
color
=
{
"#274B80"
}
loading
=
{
this
.
state
.
loading
}
/
>
<
/div
>
);
return
(
<
div
>
<
div
className
=
"test app-popup-show"
>
<
div
className
=
"popup-content background-white border-radius"
style
=
{{
borderRadius
:
8
}}
>
<
div
className
=
"popup-panel grid grid-2x main-color"
style
=
{{
height
:
64
,
borderTopRightRadius
:
8
,
borderTopLeftRadius
:
8
}}
>
<
div
className
=
"col-1"
style
=
{{
maxWidth
:
"inherit"
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
div
className
=
"popup-title"
>
<
span
style
=
{{
color
:
'#fff'
,
fontSize
:
16
,
fontWeight
:
'bold'
}}
>
Create
<
/span
>
<
/div
>
<
/div
>
<
div
className
=
"col-2 content-right"
style
=
{{
maxWidth
:
"inherit"
,
alignSelf
:
'center'
}}
>
<
button
type
=
"button"
className
=
"btn btn-circle btn-white"
onClick
=
{()
=>
this
.
props
.
onClickClose
()}
>
<
img
src
=
{
Images
.
close
}
/
>
<
/button
>
<
/div
>
<
/div
>
<
div
className
=
"grid grid-2x grid-mobile-none gap-15px"
style
=
{{
paddingLeft
:
20
,
paddingRight
:
20
,
paddingTop
:
20
}}
>
{
this
.
state
.
disabledPeriode
===
false
?
<
div
className
=
"column-1"
>
<
div
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
{...
this
.
state
.
perusahaan
}
// debug
clearOnEscape
id
=
"tipe"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getPerusahaan
:
newInputValue
},
()
=>
this
.
clearMessage
())}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
error
=
{
this
.
state
.
errorPerusahaan
}
helperText
=
{
this
.
state
.
msgErrorPerusahaan
}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
}
}}
label
=
"Company Name"
/>
}
value
=
{
this
.
state
.
getPerusahaan
}
/
>
<
/div
>
<
/div
>
:
true
}
<
div
className
=
"column-2"
>
<
div
style
=
{{
padding
:
10
,
borderRadius
:
5
,
marginTop
:
"1.2em"
}}
>
<
TextField
value
=
{
this
.
state
.
menuName
}
InputProps
=
{{
style
:
{
fontSize
:
11
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
}
}}
placeholder
=
"Category"
size
=
"medium"
fullWidth
=
{
true
}
/
>
<
/div
>
<
/div
>
{
this
.
state
.
disabledPeriode
===
false
?
<
div
className
=
"column-1"
>
<
div
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
{...
this
.
state
.
listMonth
}
// debug
clearOnEscape
id
=
"month"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
monthId
:
newInputValue
},
()
=>
this
.
clearMessage
())}
style
=
{{
width
:
250
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Period Month"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
}
}}
error
=
{
this
.
state
.
errorMonth
}
helperText
=
{
this
.
state
.
msgErrorMonth
}
/>
}
value
=
{
this
.
state
.
monthId
}
/
>
<
/div
>
<
/div
>
:
true
}
{
this
.
state
.
disabledPeriode
===
false
?
<
div
className
=
"column-2"
>
<
div
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
{...
this
.
state
.
listPeriode
}
// debug
clearOnEscape
id
=
"periode"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
periode
:
newInputValue
},
()
=>
this
.
clearMessage
())}
style
=
{{
width
:
250
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Period Year"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
}
}}
error
=
{
this
.
state
.
errorPeriode
}
helperText
=
{
this
.
state
.
msgErrorPeriode
}
/>
}
value
=
{
this
.
state
.
periode
}
/
>
<
/div
>
<
/div
>
:
true
}
<
/div
>
<
div
style
=
{{
paddingLeft
:
30
,
paddingRight
:
30
,
paddingTop
:
10
}}
>
<
UploadFile
type
=
{
this
.
state
.
uploadStatus
}
percentage
=
{
this
.
state
.
percentage
}
result
=
{
this
.
state
.
result
}
acceptedFiles
=
{[
"xls"
,
"xlsx"
,
"pdf"
,
"PDF"
,
"docx"
,
"doc"
,
"pptx"
,
"ppt"
,
"ods"
,
"odf"
,
"txt"
,
"csv"
,
"zip"
,
"rar"
]}
intent
=
{
"management"
}
onHandle
=
{(
dt
)
=>
{
this
.
fileHandler
(
dt
)
this
.
setState
({
uploadStatus
:
'idle'
,
percentage
:
'0'
})
}}
onDelete
=
{(
e
)
=>
{
this
.
deleteFile
(
e
)
}}
onUpload
=
{()
=>
alert
(
'sukses'
)}
sizeUpload
=
{
Number
(
this
.
state
.
sizeUpload
)}
/
>
<
/div
>
<
div
className
=
"margin-top-10px"
style
=
{{
paddingLeft
:
30
,
paddingRight
:
30
,
borderRadius
:
5
,
paddingBottom
:
20
}}
>
<
TextField
style
=
{{
width
:
'100%'
}}
id
=
"description"
label
=
"Description"
value
=
{
this
.
state
.
decription
}
inputProps
=
{{
min
:
0
,
style
:
{
fontSize
:
11
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
}
}}
name
=
"Description"
onChange
=
{(
e
)
=>
{
this
.
setState
({
description
:
e
.
target
.
value
})
this
.
clearMessage
()
}}
error
=
{
this
.
state
.
errorDesc
}
helperText
=
{
this
.
state
.
msgErrorDesc
}
>
<
/TextField
>
<
/div
>
<
div
className
=
"border-top grid grid-2x"
style
=
{{
height
:
56
,
backgroundColor
:
'#f5f5f5'
,
paddingLeft
:
20
,
paddingRight
:
20
}}
>
<
div
className
=
"column-1"
style
=
{{
alignSelf
:
'center'
}}
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
props
.
onClickClose
()}
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
border
:
'solid 1px #354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
span
style
=
{{
color
:
'#354960'
,
fontSize
:
11
}}
>
Cancel
<
/span
>
<
/div
>
<
/button
>
<
/div
>
<
div
className
=
"column-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
alignItems
:
'center'
}}
>
<
button
type
=
"button"
onClick
=
{()
=>
{
this
.
props
.
handleLoading
(
1
)
setTimeout
(()
=>
{
this
.
validasi
()
console
.
log
(
this
.
validasi
());
},
100
)
}
}
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
span
style
=
{{
color
:
'#fff'
,
fontSize
:
11
}}
>
Save
<
/span
>
<
/div
>
<
/button
>
<
/div
>
<
/div
>
<
/div
>
<
Snackbar
open
=
{
this
.
state
.
alert
}
autoHideDuration
=
{
6000
}
onClose
=
{()
=>
this
.
closeAlert
()}
>
<
Alert
onClose
=
{()
=>
this
.
closeAlert
()}
severity
=
{
this
.
state
.
tipeAlert
}
>
{
this
.
state
.
messageAlert
}
<
/Alert
>
<
/Snackbar
>
<
/div
>
<
/div
>
)
}
}
src/container/CRFM/InternalAudit.js
View file @
9bd4d0e2
import
React
,
{
Component
}
from
'react'
import
MUIDataTable
from
'mui-datatables'
import
{
withStyles
}
from
'@material-ui/core/styles'
;
import
{
createMuiTheme
,
MuiThemeProvider
,
Paper
,
Snackbar
,
Tab
,
Tabs
,
Typography
}
from
'@material-ui/core'
;
import
MuiAlert
from
'@material-ui/lab/Alert'
;
...
...
@@ -8,17 +7,13 @@ import Images from '../../assets/Images';
import
ReactTooltip
from
'react-tooltip'
;
import
api
from
'../../api'
;
import
PropagateLoader
from
"react-spinners/PropagateLoader"
import
AllDocument
from
"../DocumentManagement/All
Document"
;
import
TableDocument
from
"./Table
Document"
;
import
PopUpKonfirmasi
from
"../DocumentManagement/PopUpKonfirmasi"
;
import
CreateManagementDoc
from
"../DocumentManagement/CreateManagementDoc"
;
var
ct
=
require
(
"../../library/CustomTable"
);
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable
());
const
options
=
ct
.
customOptionsManagementDocument
();
import
CreateCrafmDoc
from
"./CreateCrafmDoc"
;
const
Alert
=
withStyles
({})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
export
default
class
InternalAudi
t
extends
Component
{
export
default
class
RiskManagemen
t
extends
Component
{
constructor
(
props
)
{
super
(
props
);
...
...
@@ -32,28 +27,28 @@ export default class InternalAudit extends Component {
name
:
''
,
userCompActive
:
[],
isHasAccessDocument
:
false
,
submenu_id
:
26
submenu_id
:
26
,
submenu_name
:
"internal audit"
,
menu_title
:
"Internal Audit"
}
}
componentDidMount
()
{
// this.getPermission()
this
.
getPermission
(
"internal audit"
);
this
.
getDataCrfm
();
this
.
getDataCarfm
();
this
.
getDetailUser
();
}
getDataCrfm
(){
getDataC
a
rfm
(){
let
payload
=
{
submenu_id
:
this
.
state
.
submenu_id
submenu_id
:
this
.
state
.
submenu_id
}
api
.
create
().
getCrfmDocumentBySubmenu
(
payload
).
then
(
api
.
create
().
getC
a
rfmDocumentBySubmenu
(
payload
).
then
(
response
=>
{
console
.
log
(
"ini data crfm"
);
console
.
log
(
response
);
console
.
log
(
"data crfm"
);
if
(
response
){
if
(
response
.
status
===
'success'
){
if
(
response
.
data
.
status
===
'success'
){
let
dataList
=
[]
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
// if (item.value == "Manual Book TIA 4.0sss") {
...
...
@@ -70,7 +65,7 @@ export default class InternalAudit extends Component {
loadTable
:
true
,
refresh
:
''
},
()
=>
{
this
.
getPermission
(
dataList
[
0
].
valu
e
)
this
.
getPermission
(
this
.
state
.
submenu_nam
e
)
})
}
}
else
{
...
...
@@ -95,7 +90,6 @@ export default class InternalAudit extends Component {
menu
:
subMenu
}
api
.
create
().
getPermission
(
payload
).
then
(
response
=>
{
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
...
...
@@ -104,6 +98,7 @@ export default class InternalAudit extends Component {
btndownload
:
response
.
data
.
data
.
download
,
load
:
true
})
console
.
log
(
"btn create "
+
this
.
state
.
btncreate
);
}
else
{
this
.
setState
({
load
:
true
...
...
@@ -123,6 +118,7 @@ export default class InternalAudit extends Component {
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
userCompany
:
response
.
data
.
data
.
company
,
visibleTrue
:
false
},
()
=>
{
this
.
getCompanyActive
()
console
.
log
(
this
.
state
.
userCompany
);
})
}
}
...
...
@@ -132,6 +128,9 @@ export default class InternalAudit extends Component {
getCompanyActive
()
{
api
.
create
().
getPerusahaanActive
().
then
((
response
)
=>
{
console
.
log
(
"getcompanyactive start"
);
console
.
log
(
response
);
console
.
log
(
"getcompanyactive stop"
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
...
...
@@ -166,11 +165,76 @@ export default class InternalAudit extends Component {
})
}
}
else
{
console
.
log
(
"error di getcompany active"
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
listCompany
:
null
,
company
:
null
,
visibleTrue
:
true
})
}
})
}
createUploadDocument
()
{
this
.
setState
({
visibleCreate
:
false
,
konfirmasi
:
false
})
const
formData
=
this
.
state
.
formData
formData
.
append
(
"documentId"
,
this
.
state
.
docId
)
formData
.
append
(
"updated"
,
1
)
this
.
setState
({
loading
:
true
})
api
.
create
().
updateDocument
(
formData
).
then
(
response
=>
{
// console.log(response)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
getDataDocument
(
this
.
state
.
settingID
,
this
.
state
.
menuName
)
this
.
setState
({
konfirmasi
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
,
visibleCreate
:
false
,
loading
:
false
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
}
createDocument
(
payload
)
{
//upload apinya disini
this
.
setState
({
loading
:
true
})
api
.
create
().
uploadCarfmDocument
(
payload
).
then
(
response
=>
{
// console.log(response)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
message
===
"The Document Already Exists in The System, Do You Want to Overwrite It?"
)
{
this
.
setState
({
konfirmasi
:
true
,
formData
:
payload
,
docId
:
response
.
data
.
data
.
document_id
,
loading
:
false
})
}
else
if
(
response
.
data
.
message
===
"Data was Saved Successfully"
)
{
this
.
getDataCarfm
()
this
.
setState
({
visibleCreate
:
false
,
loading
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
}
closeAlert
()
{
this
.
setState
({
alert
:
false
})
...
...
@@ -214,7 +278,7 @@ export default class InternalAudit extends Component {
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
Internal
Audit
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
{
this
.
state
.
menu_title
}
<
/Typography
>
<
/div
>
<
div
style
=
{{
padding
:
20
}}
>
...
...
@@ -245,34 +309,45 @@ export default class InternalAudit extends Component {
<
div
style
=
{{
display
:
'flex'
}}
>
{
/*{this.state.visibleTrue && (*/
}
<
All
Document
{
this
.
state
.
visibleTrue
&&
(
<
Table
Document
data
=
{
this
.
state
.
listData
}
refresh
=
{
this
.
state
.
refresh
}
load
=
{
true
}
setId
=
{
1
}
userCompActive
=
{[]}
userCompActive
=
{
this
.
state
.
userCompActive
}
handleLoading
=
{
this
.
handleLoading
.
bind
(
this
)}
name
=
{
this
.
state
.
name
}
submenu_id
=
{
this
.
state
.
submenu_id
}
btndownload
=
{
this
.
state
.
btndownload
}
/
>
{
/*)}*/
}
)
}
<
/div
>
<
/Paper
>
{
/*{!this.state.isHasAccessDocument && (*/
}
{
/* <Paper style={{ padding: 20 }}>*/
}
{
/* <label>You Don't Have Any Access in Document Management</label>*/
}
{
/* </Paper>*/
}
{
/*)}*/
}
{
!
this
.
state
.
isHasAccessDocument
&&
(
<
Paper
style
=
{{
padding
:
20
}}
>
<
label
>
You
Don
't Have Any Access in Document Management</label>
</Paper>
)}
</div>
{this.state.konfirmasi && (
<PopUpKonfirmasi
onClickClosePopUp={() => this.setState({ konfirmasi: false })}
uploadDocId={this.createUploadDocument.bind(this)}
/>
)}
{this.state.visibleCreate && (
<CreateCrafmDoc
onClickClose={() => this.setState({ visibleCreate: false })}
// getDataDocument={this.getDataDocument.bind(this)}
createDocument={this.createDocument.bind(this)}
handleLoading={this.handleLoading.bind(this)}
allsubcoCreate={this.state.btnadd}
submenu_id={this.state.submenu_id}
/>
)}
</div>
);
...
...
src/container/CRFM/RiskManagement.js
0 → 100644
View file @
9bd4d0e2
import
React
,
{
Component
}
from
'react'
import
{
withStyles
}
from
'@material-ui/core/styles'
;
import
{
createMuiTheme
,
MuiThemeProvider
,
Paper
,
Snackbar
,
Tab
,
Tabs
,
Typography
}
from
'@material-ui/core'
;
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
Constant
from
'../../library/Constant'
;
import
Images
from
'../../assets/Images'
;
import
ReactTooltip
from
'react-tooltip'
;
import
api
from
'../../api'
;
import
PropagateLoader
from
"react-spinners/PropagateLoader"
import
TableDocument
from
"./TableDocument"
;
import
PopUpKonfirmasi
from
"../DocumentManagement/PopUpKonfirmasi"
;
import
CreateCrafmDoc
from
"./CreateCrafmDoc"
;
const
Alert
=
withStyles
({})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
export
default
class
RiskManagement
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
alert
:
false
,
listData
:
[],
id
:
0
,
btncreate
:
false
,
btnview
:
false
,
load
:
false
,
name
:
''
,
userCompActive
:
[],
isHasAccessDocument
:
false
,
submenu_id
:
28
,
submenu_name
:
"risk management"
,
menu_title
:
"Risk Management"
}
}
componentDidMount
()
{
// this.getPermission()
this
.
getDataCarfm
();
this
.
getDetailUser
();
}
getDataCarfm
(){
let
payload
=
{
submenu_id
:
this
.
state
.
submenu_id
}
api
.
create
().
getCarfmDocumentBySubmenu
(
payload
).
then
(
response
=>
{
if
(
response
){
if
(
response
.
data
.
status
===
'success'
){
let
dataList
=
[]
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
// if (item.value == "Manual Book TIA 4.0sss") {
dataList
.
push
(
item
)
// }
})
if
(
dataList
.
length
==
0
)
{
this
.
setState
({
isHasAccessDocument
:
dataList
.
length
==
0
?
false
:
true
})
}
else
{
this
.
setState
({
isHasAccessDocument
:
dataList
.
length
==
0
?
false
:
true
,
listData
:
dataList
,
loadTable
:
true
,
refresh
:
''
},
()
=>
{
this
.
getPermission
(
this
.
state
.
submenu_name
)
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
)
}
getPermission
(
subMenu
)
{
let
payload
=
{
menu
:
subMenu
}
api
.
create
().
getPermission
(
payload
).
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
btncreate
:
response
.
data
.
data
.
create
,
btnview
:
response
.
data
.
data
.
view
,
btndownload
:
response
.
data
.
data
.
download
,
load
:
true
})
console
.
log
(
"btn create "
+
this
.
state
.
btncreate
);
}
else
{
this
.
setState
({
load
:
true
})
}
}
else
{
this
.
setState
({
load
:
true
})
}
})
}
getDetailUser
()
{
let
userId
=
localStorage
.
getItem
(
Constant
.
USER
)
api
.
create
().
getDetailUser
(
userId
).
then
((
response
)
=>
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
userCompany
:
response
.
data
.
data
.
company
,
visibleTrue
:
false
},
()
=>
{
this
.
getCompanyActive
()
console
.
log
(
this
.
state
.
userCompany
);
})
}
}
}
})
}
getCompanyActive
()
{
api
.
create
().
getPerusahaanActive
().
then
((
response
)
=>
{
console
.
log
(
"getcompanyactive start"
);
console
.
log
(
response
);
console
.
log
(
"getcompanyactive stop"
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
compActive
=
[]
let
userCompActive
=
[]
this
.
state
.
userCompany
.
map
((
item
,
index
)
=>
{
let
indeks
=
data
.
findIndex
((
val
)
=>
val
.
company_id
==
item
)
if
(
indeks
!==
-
1
&&
String
(
data
[
indeks
].
status
).
toLocaleLowerCase
()
==
'active'
){
userCompActive
.
push
(
item
)
}
})
data
.
map
((
item
,
index
)
=>
{
if
(
String
(
item
.
status
).
toLocaleLowerCase
()
==
'active'
)
{
compActive
.
push
(
item
)
}
})
if
(
compActive
.
length
==
userCompActive
.
length
){
this
.
setState
({
btnadd
:
true
})
}
else
{
this
.
setState
({
btnadd
:
false
})
}
this
.
setState
({
userCompActive
,
visibleTrue
:
true
})
// console.log(userCompActive)
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
visibleTrue
:
true
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
console
.
log
(
"error di getcompany active"
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
listCompany
:
null
,
company
:
null
,
visibleTrue
:
true
})
}
})
}
createUploadDocument
()
{
this
.
setState
({
visibleCreate
:
false
,
konfirmasi
:
false
})
const
formData
=
this
.
state
.
formData
formData
.
append
(
"documentId"
,
this
.
state
.
docId
)
formData
.
append
(
"updated"
,
1
)
this
.
setState
({
loading
:
true
})
api
.
create
().
updateDocument
(
formData
).
then
(
response
=>
{
// console.log(response)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
getDataDocument
(
this
.
state
.
settingID
,
this
.
state
.
menuName
)
this
.
setState
({
konfirmasi
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
,
visibleCreate
:
false
,
loading
:
false
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
}
createDocument
(
payload
)
{
//upload apinya disini
this
.
setState
({
loading
:
true
})
api
.
create
().
uploadCarfmDocument
(
payload
).
then
(
response
=>
{
// console.log(response)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
message
===
"The Document Already Exists in The System, Do You Want to Overwrite It?"
)
{
this
.
setState
({
konfirmasi
:
true
,
formData
:
payload
,
docId
:
response
.
data
.
data
.
document_id
,
loading
:
false
})
}
else
if
(
response
.
data
.
message
===
"Data was Saved Successfully"
)
{
this
.
getDataCarfm
()
this
.
setState
({
visibleCreate
:
false
,
loading
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
}
closeAlert
()
{
this
.
setState
({
alert
:
false
})
}
handleLoading
(
tipe
)
{
this
.
setState
({
loading
:
tipe
==
0
?
false
:
true
})
}
render
()
{
const
loadingComponent
=
(
<
div
style
=
{{
position
:
'absolute'
,
zIndex
:
1500
,
top
:
0
,
left
:
0
,
width
:
'100%'
,
height
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
background
:
'rgba(255,255,255,0.8)'
}}
>
<
PropagateLoader
// css={override}
size
=
{
20
}
color
=
{
"#274B80"
}
loading
=
{
this
.
state
.
loading
}
/
>
<
/div
>
);
return
(
<
div
style
=
{{
height
:
this
.
props
.
height
,
backgroundColor
:
'#f8f8f8'
}}
>
{
/* {this.props.load && ()} */
}
<
Snackbar
open
=
{
this
.
state
.
alert
}
autoHideDuration
=
{
6000
}
onClose
=
{()
=>
this
.
closeAlert
()}
>
<
Alert
onClose
=
{()
=>
this
.
closeAlert
()}
severity
=
{
this
.
state
.
tipeAlert
}
>
{
this
.
state
.
messageAlert
}
<
/Alert
>
<
/Snackbar
>
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
{
this
.
state
.
menu_title
}
<
/Typography
>
<
/div
>
<
div
style
=
{{
padding
:
20
}}
>
{
this
.
state
.
loading
&&
loadingComponent
&&
this
.
state
.
isHasAccessDocument
}
<
Paper
style
=
{{
padding
:
20
}}
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
{(
this
.
state
.
btncreate
)
&&
<
span
>
<
a
data
-
tip
=
{
'Add'
}
data
-
for
=
"add"
>
<
div
style
=
{{
display
:
'grid'
,
justifyContent
:
'flex-end'
}}
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
setState
({
visibleCreate
:
true
,
refresh
:
''
})}
style
=
{{
marginRight
:
25
,
background
:
'transparent'
}}
>
<
img
src
=
{
Images
.
add
}
/
>
<
/button
>
<
/div
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"add"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/span>
}
<
/div
>
<
div
style
=
{{
display
:
'flex'
}}
>
{
this
.
state
.
visibleTrue
&&
(
<
TableDocument
data
=
{
this
.
state
.
listData
}
refresh
=
{
this
.
state
.
refresh
}
load
=
{
true
}
userCompActive
=
{
this
.
state
.
userCompActive
}
handleLoading
=
{
this
.
handleLoading
.
bind
(
this
)}
name
=
{
this
.
state
.
name
}
submenu_id
=
{
this
.
state
.
submenu_id
}
btndownload
=
{
this
.
state
.
btndownload
}
/
>
)}
<
/div
>
<
/Paper
>
{
!
this
.
state
.
isHasAccessDocument
&&
(
<
Paper
style
=
{{
padding
:
20
}}
>
<
label
>
You
Don
't Have Any Access in Document Management</label>
</Paper>
)}
</div>
{this.state.konfirmasi && (
<PopUpKonfirmasi
onClickClosePopUp={() => this.setState({ konfirmasi: false })}
uploadDocId={this.createUploadDocument.bind(this)}
/>
)}
{this.state.visibleCreate && (
<CreateCrafmDoc
onClickClose={() => this.setState({ visibleCreate: false })}
// getDataDocument={this.getDataDocument.bind(this)}
createDocument={this.createDocument.bind(this)}
handleLoading={this.handleLoading.bind(this)}
allsubcoCreate={this.state.btnadd}
submenu_id={this.state.submenu_id}
/>
)}
</div>
);
}
}
src/container/CRFM/TableDocument.js
View file @
9bd4d0e2
...
...
@@ -36,7 +36,7 @@ export default class TableDocument extends Component {
componentWillReceiveProps
(
props
)
{
// console.log(props);
const
{
refresh
,
id
}
=
this
.
props
;
const
{
refresh
}
=
this
.
props
;
if
(
props
.
refresh
!==
refresh
)
{
this
.
getData
()
}
...
...
@@ -47,8 +47,10 @@ export default class TableDocument extends Component {
"submenu_id"
:
this
.
props
.
submenu_id
}
this
.
setState
({
loading
:
true
})
api
.
create
().
getCrfmDocumentBySubmenu
(
payload
).
then
(
response
=>
{
api
.
create
().
getCarfmDocumentBySubmenu
(
payload
).
then
(
response
=>
{
console
.
log
(
"table document carfm"
);
console
.
log
(
response
)
console
.
log
(
"table document carfm stop"
)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
...
...
@@ -98,9 +100,11 @@ export default class TableDocument extends Component {
})
}
}
else
{
console
.
log
(
"error di table document getcarfm 1"
);
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
else
{
console
.
log
(
"error di table document getcarfm 2"
);
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
...
...
@@ -139,7 +143,7 @@ export default class TableDocument extends Component {
<
div
style
=
{{
display
:
'flex'
}}
>
{
this
.
props
.
btn
view
&&
<
a
data
-
tip
=
{
'Download'
}
data
-
for
=
"download"
>
{
this
.
props
.
btn
download
&&
<
a
data
-
tip
=
{
'Download'
}
data
-
for
=
"download"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
...
...
@@ -166,7 +170,7 @@ export default class TableDocument extends Component {
display
:
false
}
},
"Description"
,
"Description"
,
"Company Name"
,
"Period Month"
,
"Period Year"
,
"Type"
,
"File Size"
,
"Created By"
,
"Created Date"
,
{
name
:
"Category"
,
...
...
src/router/homeRoutes.js
View file @
9bd4d0e2
...
...
@@ -21,6 +21,9 @@ import SubHolding from '../container/Laporan/SubHolding';
import
SummaryTriputra
from
'../container/SummaryTriputra/SummaryOfTriputra'
;
import
MasterDataCAT
from
'../container/MasterData/MasterDataCAT/MasterDataCAT'
import
ProgressReport
from
'../container/Progress/ProgressReport'
import
InternalAudit
from
"../container/CRFM/InternalAudit"
;
import
AntiFraud
from
"../container/CRFM/AntiFraud"
;
import
RiskManagement
from
"../container/CRFM/RiskManagement"
;
const
routes
=
[
{
...
...
@@ -111,6 +114,18 @@ const routes = [
path
:
"/home/progress-reports"
,
main
:
ProgressReport
},
{
path
:
"/home/internal-audit"
,
main
:
InternalAudit
},
{
path
:
"/home/anti-fraud"
,
main
:
AntiFraud
},
{
path
:
"/home/risk-management"
,
main
:
RiskManagement
},
{
path
:
"*"
,
main
:
screen404
...
...
Write
Preview
Markdown
is supported
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