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
5aa6d230
Commit
5aa6d230
authored
Aug 19, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'deni-dev(pc)' into 'master'
toast di upload + parameter See merge request
!130
parents
ecf887fd
508dfd97
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
94 additions
and
34 deletions
+94
-34
Parameter.js
src/container/MasterData/Parameter/Parameter.js
+40
-12
UnitBisnis.js
src/container/MasterData/UnitBisnis.js
+32
-17
Upload.js
src/library/Upload.js
+22
-5
No files found.
src/container/MasterData/Parameter/Parameter.js
View file @
5aa6d230
...
@@ -2,7 +2,8 @@ import React, { Component } from 'react';
...
@@ -2,7 +2,8 @@ import React, { Component } from 'react';
import
{
createMuiTheme
,
MuiThemeProvider
}
from
'@material-ui/core/styles'
;
import
{
createMuiTheme
,
MuiThemeProvider
}
from
'@material-ui/core/styles'
;
import
Images
from
'../../../assets/Images'
;
import
Images
from
'../../../assets/Images'
;
import
MUIDataTable
from
"mui-datatables"
;
import
MUIDataTable
from
"mui-datatables"
;
import
{
InputBase
}
from
"@material-ui/core"
;
import
{
InputBase
,
Snackbar
,
withStyles
}
from
"@material-ui/core"
;
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
CreateParameter
from
'../Parameter/CreateParameter'
;
import
CreateParameter
from
'../Parameter/CreateParameter'
;
import
api
from
'../../../api'
;
import
api
from
'../../../api'
;
import
PopUpFailedSave
from
"../../../library/PopUpFailedSave"
;
import
PopUpFailedSave
from
"../../../library/PopUpFailedSave"
;
...
@@ -15,6 +16,9 @@ const getMuiTheme = () => createMuiTheme(ct.customTable());
...
@@ -15,6 +16,9 @@ const getMuiTheme = () => createMuiTheme(ct.customTable());
const
options
=
ct
.
customOptions
();
const
options
=
ct
.
customOptions
();
const
options2
=
ct
.
customOptions2
();
const
options2
=
ct
.
customOptions2
();
const
Alert
=
withStyles
({
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
export
default
class
Parameter
extends
Component
{
export
default
class
Parameter
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
)
super
(
props
)
...
@@ -24,7 +28,10 @@ export default class Parameter extends Component {
...
@@ -24,7 +28,10 @@ export default class Parameter extends Component {
visibleParameter
:
true
,
visibleParameter
:
true
,
popupError
:
false
,
popupError
:
false
,
data
:
[],
data
:
[],
dataTable
:
[]
dataTable
:
[],
alert
:
false
,
tipeAlert
:
''
,
messageAlert
:
''
}
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
}
}
...
@@ -76,11 +83,15 @@ export default class Parameter extends Component {
...
@@ -76,11 +83,15 @@ export default class Parameter extends Component {
updateParameter
=
(
payload
)
=>
{
updateParameter
=
(
payload
)
=>
{
this
.
setState
({
visibleEdit
:
false
})
this
.
setState
({
visibleEdit
:
false
})
api
.
create
().
updateParameter
(
payload
).
then
(
response
=>
{
api
.
create
().
updateParameter
(
payload
).
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
getAllParameter
()
this
.
getAllParameter
()
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
}
)
}
else
{
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
}
})
})
}
}
...
@@ -88,11 +99,15 @@ export default class Parameter extends Component {
...
@@ -88,11 +99,15 @@ export default class Parameter extends Component {
createParameter
=
(
payload
)
=>
{
createParameter
=
(
payload
)
=>
{
this
.
setState
({
visibleCreate
:
false
})
this
.
setState
({
visibleCreate
:
false
})
api
.
create
().
createParameter
(
payload
).
then
(
response
=>
{
api
.
create
().
createParameter
(
payload
).
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
getAllParameter
()
this
.
getAllParameter
()
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
}
)
}
else
{
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
}
})
})
}
}
...
@@ -501,14 +516,22 @@ export default class Parameter extends Component {
...
@@ -501,14 +516,22 @@ export default class Parameter extends Component {
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
status
===
"success"
)
{
console
.
log
(
response
)
console
.
log
(
response
)
alert
(
response
.
data
.
message
)
this
.
getAllParameter
()
this
.
getAllParameter
()
this
.
setState
({
visibleParameter
:
true
})
this
.
setState
({
visibleParameter
:
true
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
}
})
})
}
}
closeAlert
()
{
this
.
setState
({
alert
:
false
})
}
render
()
{
render
()
{
const
columns
=
[{
const
columns
=
[{
name
:
"Action"
,
name
:
"Action"
,
...
@@ -643,6 +666,11 @@ export default class Parameter extends Component {
...
@@ -643,6 +666,11 @@ export default class Parameter extends Component {
<
div
style
=
{{
height
:
this
.
props
.
height
}}
>
<
div
style
=
{{
height
:
this
.
props
.
height
}}
>
{
/* <Row> */
}
{
/* <Row> */
}
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
199
,
width
:
'100%'
}}
/
>
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
199
,
width
:
'100%'
}}
/
>
<
Snackbar
open
=
{
this
.
state
.
alert
}
autoHideDuration
=
{
6000
}
onClose
=
{()
=>
this
.
closeAlert
()}
>
<
Alert
onClose
=
{()
=>
this
.
closeAlert
()}
severity
=
{
this
.
state
.
tipeAlert
}
>
{
this
.
state
.
messageAlert
}
<
/Alert
>
<
/Snackbar
>
{
this
.
state
.
visibleParameter
===
true
?
{
this
.
state
.
visibleParameter
===
true
?
<
div
>
<
div
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
paddingRight
:
25
,
paddingLeft
:
25
,
marginTop
:
-
150
}}
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
paddingRight
:
25
,
paddingLeft
:
25
,
marginTop
:
-
150
}}
>
...
...
src/container/MasterData/UnitBisnis.js
View file @
5aa6d230
...
@@ -200,10 +200,10 @@ export default class UnitBisnis extends Component {
...
@@ -200,10 +200,10 @@ export default class UnitBisnis extends Component {
})
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
}
else
{
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
}
)
}
}
}
else
{
}
else
{
this
.
setState
({
dataTable
:
[]
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
dataTable
:
[]
})
}
}
})
})
}
}
...
@@ -229,6 +229,7 @@ export default class UnitBisnis extends Component {
...
@@ -229,6 +229,7 @@ export default class UnitBisnis extends Component {
}
}
api
.
create
().
searchUnitBisnis
(
body
).
then
(
response
=>
{
api
.
create
().
searchUnitBisnis
(
body
).
then
(
response
=>
{
// console.log(response.data);
// console.log(response.data);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
data
=
response
.
data
.
data
let
listData
=
data
.
map
((
item
,
index
)
=>
{
let
listData
=
data
.
map
((
item
,
index
)
=>
{
...
@@ -236,7 +237,10 @@ export default class UnitBisnis extends Component {
...
@@ -236,7 +237,10 @@ export default class UnitBisnis extends Component {
})
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
}
else
{
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
}
})
})
}
}
...
@@ -244,24 +248,33 @@ export default class UnitBisnis extends Component {
...
@@ -244,24 +248,33 @@ export default class UnitBisnis extends Component {
updateUnitBisnis
=
(
payload
)
=>
{
updateUnitBisnis
=
(
payload
)
=>
{
this
.
setState
({
visibleEdit
:
false
})
this
.
setState
({
visibleEdit
:
false
})
api
.
create
().
updateUnitBisnis
(
payload
).
then
(
response
=>
{
api
.
create
().
updateUnitBisnis
(
payload
).
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
getData
()
this
.
getData
()
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
})
})
}
}
createUnitBisnis
=
(
payload
)
=>
{
createUnitBisnis
=
(
payload
)
=>
{
this
.
setState
({
visibleCreate
:
false
})
this
.
setState
({
visibleCreate
:
false
})
api
.
create
().
createUnitBisnis
(
payload
).
then
(
response
=>
{
api
.
create
().
createUnitBisnis
(
payload
).
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
getData
()
this
.
getData
()
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
})
})
}
}
...
@@ -305,6 +318,8 @@ export default class UnitBisnis extends Component {
...
@@ -305,6 +318,8 @@ export default class UnitBisnis extends Component {
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
}
})
})
}
}
...
...
src/library/Upload.js
View file @
5aa6d230
...
@@ -2,8 +2,12 @@ import React, { Component, createRef } from "react"
...
@@ -2,8 +2,12 @@ import React, { Component, createRef } from "react"
import
Dropzone
from
'react-dropzone'
import
Dropzone
from
'react-dropzone'
import
LinearProgress
from
'@material-ui/core/LinearProgress'
import
LinearProgress
from
'@material-ui/core/LinearProgress'
import
Images
from
"../assets/Images"
import
Images
from
"../assets/Images"
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
{
withStyles
,
Snackbar
}
from
"@material-ui/core"
;
const
dropzoneRef
=
createRef
()
const
dropzoneRef
=
createRef
()
const
Alert
=
withStyles
({
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
class
Upload
extends
Component
{
class
Upload
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -19,7 +23,9 @@ class Upload extends Component {
...
@@ -19,7 +23,9 @@ class Upload extends Component {
iconButtonUpload
:
'fa fa-1x fa-upload'
,
iconButtonUpload
:
'fa fa-1x fa-upload'
,
uploadProgress
:
false
,
uploadProgress
:
false
,
percentage
:
'0'
,
percentage
:
'0'
,
completed
:
'0'
completed
:
'0'
,
alert
:
false
,
alertMessage
:
''
}
}
}
}
...
@@ -64,7 +70,8 @@ class Upload extends Component {
...
@@ -64,7 +70,8 @@ class Upload extends Component {
uploadProgress
:
false
,
uploadProgress
:
false
,
percentage
:
'0'
percentage
:
'0'
})
})
alert
(
"Unsupported Media Type"
)
this
.
setState
({
alertMessage
:
"Unsupported Media Type"
,
alert
:
true
})
// alert("Unsupported Media Type")
}
}
}
}
...
@@ -85,15 +92,20 @@ class Upload extends Component {
...
@@ -85,15 +92,20 @@ class Upload extends Component {
// console.log(strState);
// console.log(strState);
if
(
strProps
.
includes
(
strState
))
{
if
(
strProps
.
includes
(
strState
))
{
if
(
this
.
state
.
sizeFile
<
1000
000
)
{
if
(
this
.
state
.
sizeFile
<
1000
)
{
this
.
props
.
onUpload
()
this
.
props
.
onUpload
()
}
else
{
}
else
{
alert
(
'File Tidak Boleh Lebih Dari 1MB'
)
this
.
setState
({
alertMessage
:
'File Tidak Boleh Lebih Dari 1MB'
,
alert
:
true
})
// alert('File Tidak Boleh Lebih Dari 1MB')
}
}
}
else
{
}
else
{
alert
(
'File Tidak Mendukung'
)
this
.
setState
({
alertMessage
:
'File Tidak Mendukung'
,
alert
:
true
})
// alert('File Tidak Mendukung')
}
}
}
closeAlert
()
{
this
.
setState
({
alert
:
false
})
}
}
render
()
{
render
()
{
...
@@ -102,6 +114,11 @@ class Upload extends Component {
...
@@ -102,6 +114,11 @@ class Upload extends Component {
<
Dropzone
ref
=
{
dropzoneRef
}
onDrop
=
{
this
.
onDrop
}
>
<
Dropzone
ref
=
{
dropzoneRef
}
onDrop
=
{
this
.
onDrop
}
>
{({
getRootProps
,
getInputProps
})
=>
(
{({
getRootProps
,
getInputProps
})
=>
(
<
div
>
<
div
>
<
Snackbar
open
=
{
this
.
state
.
alert
}
autoHideDuration
=
{
6000
}
onClose
=
{()
=>
this
.
closeAlert
()}
>
<
Alert
onClose
=
{()
=>
this
.
closeAlert
()}
severity
=
{
"warning"
}
>
{
this
.
state
.
alertMessage
}
<
/Alert
>
<
/Snackbar
>
<
div
className
=
"upload-file"
>
<
div
className
=
"upload-file"
>
{
/* label */
}
{
/* label */
}
...
...
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