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
9eeedb3c
Commit
9eeedb3c
authored
Sep 08, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'deni-dev(pc)' into 'master'
Deni dev(pc) See merge request
!268
parents
c2cd6553
72e78932
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
464 additions
and
56 deletions
+464
-56
index.js
src/api/index.js
+3
-1
AuditTahunan.js
src/container/DocumentManagement/AuditTahunan.js
+3
-12
CreateManagementDoc.js
src/container/DocumentManagement/CreateManagementDoc.js
+356
-0
DocumentManagement.js
src/container/DocumentManagement/DocumentManagement.js
+17
-0
ManualBookTia.js
src/container/DocumentManagement/ManualBookTia.js
+0
-11
CreateParameter.js
src/container/MasterData/Parameter/CreateParameter.js
+2
-4
Upload.js
src/library/Upload.js
+83
-28
No files found.
src/api/index.js
View file @
9eeedb3c
...
@@ -176,6 +176,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
...
@@ -176,6 +176,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
// MANAGEMENT DOCUMENT
// MANAGEMENT DOCUMENT
const
getDocumentCategory
=
()
=>
api
.
get
(
'document_category/get_all_document_category'
)
const
getDocumentCategory
=
()
=>
api
.
get
(
'document_category/get_all_document_category'
)
const
getAllDocument
=
(
body
)
=>
api
.
post
(
'document/get_all_document'
,
body
)
const
getAllDocument
=
(
body
)
=>
api
.
post
(
'document/get_all_document'
,
body
)
const
uploadDocument
=
(
body
)
=>
api
.
post
(
'document/upload_document'
,
body
)
// ------
// ------
// STEP 3
// STEP 3
...
@@ -281,7 +282,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
...
@@ -281,7 +282,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
deletePerusahaan
,
deletePerusahaan
,
deleteReportItems
,
deleteReportItems
,
getDocumentCategory
,
getDocumentCategory
,
getAllDocument
getAllDocument
,
uploadDocument
}
}
}
}
...
...
src/container/DocumentManagement/AuditTahunan.js
View file @
9eeedb3c
...
@@ -2,6 +2,7 @@ import React, { Component } from 'react'
...
@@ -2,6 +2,7 @@ import React, { Component } from 'react'
import
MUIDataTable
from
'mui-datatables'
import
MUIDataTable
from
'mui-datatables'
import
{
createMuiTheme
,
MuiThemeProvider
}
from
'@material-ui/core'
;
import
{
createMuiTheme
,
MuiThemeProvider
}
from
'@material-ui/core'
;
import
api
from
'../../api'
;
import
api
from
'../../api'
;
import
CreateManagementDoc
from
'./CreateManagementDoc'
;
var
ct
=
require
(
"../../library/CustomTable"
);
var
ct
=
require
(
"../../library/CustomTable"
);
...
@@ -12,7 +13,8 @@ export default class AuditTahunan extends Component {
...
@@ -12,7 +13,8 @@ export default class AuditTahunan extends Component {
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
)
super
(
props
)
this
.
state
=
{
this
.
state
=
{
dataTable
:
[]
dataTable
:
[],
visibleCreate
:
false
}
}
}
}
...
@@ -50,17 +52,6 @@ export default class AuditTahunan extends Component {
...
@@ -50,17 +52,6 @@ export default class AuditTahunan extends Component {
]
]
return
(
return
(
<
div
style
=
{{
width
:
'100%'
}}
>
<
div
style
=
{{
width
:
'100%'
}}
>
<
div
style
=
{{
display
:
'grid'
,
justifyContent
:
'flex-end'
}}
>
<
button
type
=
"button"
onClick
=
{()
=>
null
}
style
=
{{
marginRight
:
25
}}
>
<
div
style
=
{{
width
:
150
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
span
style
=
{{
color
:
'#fff'
,
fontSize
:
11
}}
>
Add
<
/span
>
<
/div
>
<
/button
>
<
/div
>
<
div
style
=
{{
padding
:
25
}}
>
<
div
style
=
{{
padding
:
25
}}
>
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
<
MUIDataTable
...
...
src/container/DocumentManagement/CreateManagementDoc.js
0 → 100644
View file @
9eeedb3c
import
React
,
{
Component
}
from
'react'
import
Images
from
'../../assets/Images'
import
{
TextField
,
withStyles
,
Snackbar
}
from
'@material-ui/core'
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
MuiAlert
from
'@material-ui/lab/Alert'
;
const
Alert
=
withStyles
({
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
export
default
class
CreateManagementDoc
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
,
description
:
''
,
errorDesc
:
false
,
msgErrorDesc
:
''
,
file
:
null
,
alert
:
false
,
tipeAlert
:
''
,
messageAlert
:
''
,
fileType
:
''
}
}
componentDidMount
()
{
this
.
getDataCompany
()
this
.
getDataDocument
()
this
.
getPeriode
()
}
getDataCompany
()
{
api
.
create
().
getPerusahaanActive
().
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_id
-
b
.
company_id
),
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"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
alert
(
response
.
problem
)
}
})
}
getDataDocument
()
{
api
.
create
().
getDocumentCategory
().
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
typeData
=
data
.
map
((
item
)
=>
{
return
{
document_category_id
:
item
.
document_category_id
,
document_category_name
:
item
.
document_category_name
}
})
let
typeProps
=
{
options
:
typeData
.
sort
((
a
,
b
)
=>
a
.
document_category_id
-
b
.
document_category_id
),
getOptionLabel
:
(
option
)
=>
option
.
document_category_name
,
};
this
.
setState
({
document
:
typeProps
,
documentData
:
response
.
data
.
data
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
alert
(
response
.
problem
)
}
})
}
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
]
})
}
}
})
}
clearMessage
()
{
this
.
setState
({
errorPerusahaan
:
false
,
msgErrorPerusahaan
:
''
,
errorDocument
:
false
,
msgErrorDocument
:
''
,
})
}
fileHandler
=
(
event
)
=>
{
let
fileObj
=
event
let
length
=
event
.
name
.
split
(
"."
).
length
let
fileType
=
event
.
name
.
split
(
"."
)[
length
-
1
]
ExcelRenderer
(
fileObj
,
(
err
,
resp
)
=>
{
console
.
log
(
fileType
)
if
(
err
)
{
console
.
log
(
err
);
}
else
{
this
.
setState
({
file
:
event
,
fileType
:
String
(
fileType
)
})
}
})
}
validasi
()
{
if
(
R
.
isNil
(
this
.
state
.
getPerusahaan
))
{
this
.
setState
({
errorPerusahaan
:
true
,
msgErrorPerusahaan
:
'Company Cannot be Empty.'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
getDocument
))
{
this
.
setState
({
errorDocument
:
true
,
msgErrorDocument
:
'Category 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
(
"documentCategoryId"
,
this
.
state
.
getDocument
.
document_category_id
);
formData
.
append
(
"documentPeriode"
,
this
.
state
.
periode
.
periode
);
formData
.
append
(
"description"
,
this
.
state
.
description
);
formData
.
append
(
"extension"
,
this
.
state
.
fileType
);
this
.
setState
({
formData
},
()
=>
{
this
.
createDocument
()
})
}
}
createDocument
(){
api
.
create
().
uploadDocument
(
this
.
state
.
formData
).
then
(
response
=>
{
console
.
log
(
response
)
})
}
closeAlert
()
{
this
.
setState
({
alert
:
false
})
}
deleteFile
(
e
){
this
.
setState
({
file
:
null
})
}
render
()
{
return
(
<
div
className
=
"test app-popup-show"
>
<
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
=
"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
}}
>
<
div
className
=
"column-1"
>
<
div
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
{...
this
.
state
.
perusahaan
}
debug
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
className
=
"margin-top-10px"
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
{...
this
.
state
.
listPeriode
}
id
=
"periode"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
periode
:
newInputValue
},
()
=>
{
this
.
clearMessage
()
})}
debug
disableClearable
style
=
{{
width
:
250
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Periode"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
}
}}
/>
}
value
=
{
this
.
state
.
periode
}
/
>
<
/div
>
<
/div
>
<
div
className
=
"column-2"
>
<
div
style
=
{{
padding
:
10
,
borderRadius
:
5
}}
>
<
Autocomplete
{...
this
.
state
.
document
}
debug
id
=
"tipe"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
getDocument
:
newInputValue
},
()
=>
this
.
clearMessage
())}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
error
=
{
this
.
state
.
errorDocument
}
helperText
=
{
this
.
state
.
msgErrorDocument
}
InputProps
=
{{
...
params
.
InputProps
,
style
:
{
fontSize
:
11
}
}}
InputLabelProps
=
{{
style
:
{
fontSize
:
11
,
color
:
'#7e8085'
}
}}
label
=
"Category"
/>
}
value
=
{
this
.
state
.
getDocument
}
/
>
<
/div
>
<
/div
>
<
/div
>
<
div
style
=
{{
paddingLeft
:
30
,
paddingRight
:
30
}}
>
<
UploadFile
type
=
{
this
.
state
.
uploadStatus
}
percentage
=
{
this
.
state
.
percentage
}
result
=
{
this
.
state
.
result
}
acceptedFiles
=
{[
"xls"
,
"xlsx"
,
"pdf"
,
"PDF"
]}
intent
=
{
"management"
}
onHandle
=
{(
dt
)
=>
{
this
.
fileHandler
(
dt
)
this
.
setState
({
uploadStatus
:
'idle'
,
percentage
:
'0'
})
}}
onDelete
=
{(
e
)
=>
{
this
.
deleteFile
(
e
)
}}
onUpload
=
{()
=>
alert
(
'sukses'
)}
/
>
<
/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
.
validasi
()}
>
<
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
>
<
/div
>
)
}
}
src/container/DocumentManagement/DocumentManagement.js
View file @
9eeedb3c
...
@@ -5,6 +5,7 @@ import Images from '../../assets/Images'
...
@@ -5,6 +5,7 @@ import Images from '../../assets/Images'
import
ManualBookTia
from
'./ManualBookTia'
import
ManualBookTia
from
'./ManualBookTia'
import
api
from
'../../api'
import
api
from
'../../api'
import
AuditTahunan
from
'./AuditTahunan'
import
AuditTahunan
from
'./AuditTahunan'
import
CreateManagementDoc
from
'./CreateManagementDoc'
export
default
class
DocumentManagement
extends
Component
{
export
default
class
DocumentManagement
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -47,6 +48,17 @@ export default class DocumentManagement extends Component {
...
@@ -47,6 +48,17 @@ export default class DocumentManagement extends Component {
<
/div
>
<
/div
>
<
div
style
=
{{
padding
:
20
}}
>
<
div
style
=
{{
padding
:
20
}}
>
<
Paper
style
=
{{
padding
:
20
}}
>
<
Paper
style
=
{{
padding
:
20
}}
>
<
div
style
=
{{
display
:
'grid'
,
justifyContent
:
'flex-end'
}}
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
setState
({
visibleCreate
:
true
})}
style
=
{{
marginRight
:
25
}}
>
<
div
style
=
{{
width
:
150
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
span
style
=
{{
color
:
'#fff'
,
fontSize
:
11
}}
>
Add
<
/span
>
<
/div
>
<
/button
>
<
/div
>
<
div
style
=
{{
display
:
'flex'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
<
Tabs
<
Tabs
orientation
=
"vertical"
orientation
=
"vertical"
...
@@ -79,6 +91,11 @@ export default class DocumentManagement extends Component {
...
@@ -79,6 +91,11 @@ export default class DocumentManagement extends Component {
<
/Paper
>
<
/Paper
>
<
/div
>
<
/div
>
{
this
.
state
.
visibleCreate
&&
(
<
CreateManagementDoc
onClickClose
=
{()
=>
this
.
setState
({
visibleCreate
:
false
})}
/
>
)}
<
/div
>
<
/div
>
)
)
}
}
...
...
src/container/DocumentManagement/ManualBookTia.js
View file @
9eeedb3c
...
@@ -21,17 +21,6 @@ export default class ManualBookTia extends Component {
...
@@ -21,17 +21,6 @@ export default class ManualBookTia extends Component {
]
]
return
(
return
(
<
div
style
=
{{
width
:
'100%'
}}
>
<
div
style
=
{{
width
:
'100%'
}}
>
<
div
style
=
{{
display
:
'grid'
,
justifyContent
:
'flex-end'
}}
>
<
button
type
=
"button"
onClick
=
{()
=>
null
}
style
=
{{
marginRight
:
25
}}
>
<
div
style
=
{{
width
:
150
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
span
style
=
{{
color
:
'#fff'
,
fontSize
:
11
}}
>
Add
<
/span
>
<
/div
>
<
/button
>
<
/div
>
<
div
style
=
{{
padding
:
25
}}
>
<
div
style
=
{{
padding
:
25
}}
>
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
<
MUIDataTable
...
...
src/container/MasterData/Parameter/CreateParameter.js
View file @
9eeedb3c
...
@@ -58,9 +58,6 @@ export default class CreateParameter extends Component {
...
@@ -58,9 +58,6 @@ export default class CreateParameter extends Component {
componentDidMount
()
{
componentDidMount
()
{
if
(
this
.
props
.
type
===
'edit'
)
{
if
(
this
.
props
.
type
===
'edit'
)
{
this
.
setState
({
getSettingTypeID
:
this
.
props
.
data
[
0
],
})
this
.
getDetailParameter
()
this
.
getDetailParameter
()
}
else
{
}
else
{
let
date
=
format
(
new
Date
,
'yyyy-MM-dd'
)
let
date
=
format
(
new
Date
,
'yyyy-MM-dd'
)
...
@@ -85,6 +82,7 @@ export default class CreateParameter extends Component {
...
@@ -85,6 +82,7 @@ export default class CreateParameter extends Component {
getSettingGroupID
:
response
.
data
.
data
.
setting_group_id
,
getSettingGroupID
:
response
.
data
.
data
.
setting_group_id
,
getCompanyID
:
data
.
company_id
,
getCompanyID
:
data
.
company_id
,
settingType
:
data
.
setting_type
,
settingType
:
data
.
setting_type
,
getSettingTypeID
:
data
.
setting_type_id
},
()
=>
{
},
()
=>
{
this
.
getAllGroup
()
this
.
getAllGroup
()
this
.
getPerusahaan
()
this
.
getPerusahaan
()
...
@@ -283,7 +281,7 @@ export default class CreateParameter extends Component {
...
@@ -283,7 +281,7 @@ export default class CreateParameter extends Component {
options
:
typeData
,
options
:
typeData
,
getOptionLabel
:
(
option
)
=>
option
.
setting_type_name
,
getOptionLabel
:
(
option
)
=>
option
.
setting_type_name
,
};
};
this
.
setState
({
enableParameter
:
true
,
parameter
:
typeProps
,
parameterData
:
response
.
data
.
data
,
getParameter
:
index
==
-
1
?
typeData
[
0
]
:
typeData
[
index
]
})
this
.
setState
({
enableParameter
:
true
,
parameter
:
typeProps
,
parameterData
:
response
.
data
.
data
,
getParameter
:
index
==
-
1
?
null
:
typeData
[
index
]
})
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
...
...
src/library/Upload.js
View file @
9eeedb3c
...
@@ -49,7 +49,42 @@ class Upload extends Component {
...
@@ -49,7 +49,42 @@ class Upload extends Component {
let
length
=
acceptedFiles
[
0
].
name
.
split
(
"."
).
length
let
length
=
acceptedFiles
[
0
].
name
.
split
(
"."
).
length
let
fileType
=
acceptedFiles
[
0
].
name
.
split
(
"."
)[
length
-
1
]
let
fileType
=
acceptedFiles
[
0
].
name
.
split
(
"."
)[
length
-
1
]
formData
.
append
(
'file'
,
acceptedFiles
[
0
])
formData
.
append
(
'file'
,
acceptedFiles
[
0
])
console
.
log
(
acceptedFiles
);
console
.
log
(
fileType
);
if
(
this
.
props
.
intent
===
'management'
)
{
if
(
acceptedFiles
)
{
if
(
this
.
props
.
acceptedFiles
.
includes
(
fileType
))
{
if
(
this
.
state
.
sizeFile
<
10000
)
{
this
.
setState
({
file
:
acceptedFiles
[
0
],
typeFile
:
fileType
,
nameFile
:
acceptedFiles
[
0
].
name
,
sizeFile
:
(
acceptedFiles
[
0
].
size
/
1000
).
toFixed
(
0
),
previewVisible
:
true
,
inputVisible
:
false
,
uploadProgress
:
false
,
percentage
:
'0'
})
this
.
props
.
onHandle
(
acceptedFiles
[
0
])
}
else
{
this
.
setState
({
alertMessage
:
'The file is too large. Allowed maximum size is 10MB'
,
alert
:
true
})
// alert('File Tidak Boleh Lebih Dari 1MB')
}
}
else
{
this
.
setState
({
alertMessage
:
'File extension not allowed.'
,
alert
:
true
})
// alert('File Tidak Mendukung')
}
}
else
{
this
.
setState
({
previewVisible
:
false
,
inputVisible
:
true
,
uploadProgress
:
false
,
percentage
:
'0'
})
this
.
setState
({
alertMessage
:
"File extension not allowed."
,
alert
:
true
})
// alert("Unsupported Media Type")
}
}
else
{
if
(
acceptedFiles
)
{
if
(
acceptedFiles
)
{
this
.
setState
({
this
.
setState
({
file
:
acceptedFiles
[
0
],
file
:
acceptedFiles
[
0
],
...
@@ -74,14 +109,25 @@ class Upload extends Component {
...
@@ -74,14 +109,25 @@ class Upload extends Component {
// alert("Unsupported Media Type")
// alert("Unsupported Media Type")
}
}
}
}
}
onRemove
=
()
=>
{
onRemove
=
()
=>
{
if
(
this
.
props
.
intent
===
"management"
)
{
this
.
setState
({
this
.
setState
({
previewVisible
:
false
,
previewVisible
:
false
,
inputVisible
:
true
,
inputVisible
:
true
,
uploadProgress
:
false
,
uploadProgress
:
false
,
percentage
:
'0'
percentage
:
'0'
})
})
this
.
props
.
onDelete
(
"delete"
)
}
else
{
this
.
setState
({
previewVisible
:
false
,
inputVisible
:
true
,
uploadProgress
:
false
,
percentage
:
'0'
})
}
}
}
onUpload
=
()
=>
{
onUpload
=
()
=>
{
...
@@ -92,12 +138,21 @@ class Upload extends Component {
...
@@ -92,12 +138,21 @@ class Upload extends Component {
// console.log(strState);
// console.log(strState);
if
(
strProps
.
includes
(
strState
))
{
if
(
strProps
.
includes
(
strState
))
{
if
(
this
.
props
.
intent
===
'management'
)
{
if
(
this
.
state
.
sizeFile
<
10000
)
{
this
.
props
.
onUpload
()
}
else
{
this
.
setState
({
alertMessage
:
'The file is too large. Allowed maximum size is 10MB'
,
alert
:
true
})
// alert('File Tidak Boleh Lebih Dari 1MB')
}
}
else
{
if
(
this
.
state
.
sizeFile
<
1000
)
{
if
(
this
.
state
.
sizeFile
<
1000
)
{
this
.
props
.
onUpload
()
this
.
props
.
onUpload
()
}
else
{
}
else
{
this
.
setState
({
alertMessage
:
'The file is too large. Allowed maximum size is 1MB'
,
alert
:
true
})
this
.
setState
({
alertMessage
:
'The file is too large. Allowed maximum size is 1MB'
,
alert
:
true
})
// alert('File Tidak Boleh Lebih Dari 1MB')
// alert('File Tidak Boleh Lebih Dari 1MB')
}
}
}
}
else
{
}
else
{
this
.
setState
({
alertMessage
:
'File extension not allowed.'
,
alert
:
true
})
this
.
setState
({
alertMessage
:
'File extension not allowed.'
,
alert
:
true
})
// alert('File Tidak Mendukung')
// alert('File Tidak Mendukung')
...
@@ -171,7 +226,7 @@ class Upload extends Component {
...
@@ -171,7 +226,7 @@ class Upload extends Component {
onClick
=
{
this
.
state
.
uploadProgress
===
true
?
null
:
this
.
onUpload
}
>
onClick
=
{
this
.
state
.
uploadProgress
===
true
?
null
:
this
.
onUpload
}
>
{
/*<i className={this.state.iconButtonUpload} />*/
}
{
/*<i className={this.state.iconButtonUpload} />*/
}
{
this
.
state
.
uploadProgress
===
true
{
this
.
state
.
uploadProgress
===
true
?
<
i
className
=
{
'fa fa-1x fa-spinner fa-spin'
}
/>
:
?
<
i
className
=
{
'fa fa-1x fa-spinner fa-spin'
}
/> :
this.props.intent === 'management'
?
null
:
<
img
src
=
{
Images
.
upload
}
/>
}
<
img
src
=
{
Images
.
upload
}
/>
}
<
/button
>
<
/button
>
<
/div
>
<
/div
>
...
...
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