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
1e35bef0
Commit
1e35bef0
authored
Aug 21, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'faisal' into 'master'
update alert See merge request
!148
parents
06630a5b
d08befcb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
28 deletions
+67
-28
Perusahaan.js
src/container/MasterData/Perusahaan/Perusahaan.js
+67
-28
No files found.
src/container/MasterData/Perusahaan/Perusahaan.js
View file @
1e35bef0
...
...
@@ -6,13 +6,14 @@ import Images from '../../../assets/Images';
import
UploadFile
from
"../../../library/Upload"
;
import
MUIDataTable
from
"mui-datatables"
;
import
{
render
}
from
'@testing-library/react'
;
import
{
TextField
,
InputBase
}
from
"@material-ui/core"
;
import
{
ExcelRenderer
}
from
'react-excel-renderer'
;
import
CreatePerusahaan
from
"./CreatePerusahaan"
;
import
EditPerusahaan
from
"./EditPerusahaan"
import
VisualPerusahaan
from
"./VisualPerusahaan"
;
import
api
from
"../../../api"
;
import
ReactTooltip
from
'react-tooltip'
;
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
{
TextField
,
InputBase
,
Snackbar
,
withStyles
}
from
"@material-ui/core"
;
import
PopUpFailedSave
from
'../../../library/PopUpFailedSave'
;
var
ct
=
require
(
"../../../library/CustomTable"
);
...
...
@@ -20,6 +21,9 @@ const getMuiTheme = () => createMuiTheme(ct.customTable());
const
options
=
ct
.
customOptions
();
const
options2
=
ct
.
customOptions2
();
const
Alert
=
withStyles
({
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
export
default
class
Perusahaan
extends
Component
{
constructor
(
props
)
{
super
(
props
)
...
...
@@ -35,7 +39,10 @@ export default class Perusahaan extends Component {
cols
:
null
,
rows
:
null
,
dataLoaded
:
false
,
popupError
:
false
popupError
:
false
,
alert
:
false
,
tipeAlert
:
''
,
messageAlert
:
''
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
}
...
...
@@ -236,15 +243,19 @@ export default class Perusahaan extends Component {
getData
()
{
api
.
create
().
getPerusahaan
().
then
((
response
)
=>
{
console
.
log
(
response
)
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
listData
=
data
.
sort
((
a
,
b
)
=>
a
.
company_id
-
b
.
company_id
).
map
((
item
,
index
)
=>
{
return
[
index
,
item
.
company_id
,
item
.
company_name
,
item
.
parent_name
,
item
.
business_unit_name
,
item
.
total_report
,
item
.
status
]
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
listData
=
data
.
sort
((
a
,
b
)
=>
a
.
company_id
-
b
.
company_id
).
map
((
item
,
index
)
=>
{
return
[
index
,
item
.
company_id
,
item
.
company_name
,
item
.
parent_name
,
item
.
business_unit_name
,
item
.
total_report
,
item
.
status
]
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
alert
(
response
.
data
.
message
)
}
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
dataTable
:
[]
}
)
}
})
}
...
...
@@ -268,15 +279,18 @@ export default class Perusahaan extends Component {
"keyword"
:
e
}
api
.
create
().
searchPerusahaan
(
body
).
then
(
response
=>
{
// console.log(response.data);
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
listData
=
data
.
map
((
item
,
index
)
=>
{
return
[
index
,
item
.
company_id
,
item
.
company_name
,
item
.
parent_name
,
item
.
business_unit_name
,
item
.
total_report
,
item
.
status
]
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
listData
=
data
.
map
((
item
,
index
)
=>
{
return
[
index
,
item
.
company_id
,
item
.
company_name
,
item
.
parent_name
,
item
.
business_unit_name
,
item
.
total_report
,
item
.
status
]
})
this
.
setState
({
dataTable
:
listData
,
listData
:
response
.
data
.
data
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
}
)
}
})
}
...
...
@@ -284,11 +298,15 @@ export default class Perusahaan extends Component {
updatePerusahaan
=
(
payload
)
=>
{
this
.
setState
({
visibleEdit
:
false
})
api
.
create
().
updatePerusahaan
(
payload
).
then
(
response
=>
{
if
(
response
.
data
.
status
==
'success'
)
{
alert
(
response
.
data
.
message
)
this
.
getData
()
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
getData
()
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
}
)
}
})
}
...
...
@@ -296,11 +314,15 @@ export default class Perusahaan extends Component {
createPerusahaan
=
(
payload
)
=>
{
this
.
setState
({
visibleCreate
:
false
})
api
.
create
().
createPerusahaan
(
payload
).
then
(
response
=>
{
if
(
response
.
data
.
status
==
'success'
)
{
alert
(
response
.
data
.
message
)
this
.
getData
()
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
getData
()
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
})
}
}
else
{
alert
(
response
.
data
.
message
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
}
)
}
})
}
...
...
@@ -338,11 +360,23 @@ export default class Perusahaan extends Component {
uploadPerusahaan
()
{
api
.
create
().
uploadPerusahaan
(
this
.
state
.
payload
).
then
(
response
=>
{
console
.
log
(
response
)
this
.
getData
()
this
.
setState
({
visiblePerusahaan
:
true
})
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
"success"
)
{
this
.
getData
()
this
.
setState
({
visiblePerusahaan
:
true
,
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
()
{
const
columns
=
[{
name
:
"Action"
,
...
...
@@ -443,6 +477,11 @@ export default class Perusahaan extends Component {
<
div
style
=
{{
height
:
this
.
props
.
height
}}
>
{
/* <Row> */
}
<
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
.
visiblePerusahaan
===
true
?
<
div
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
paddingRight
:
25
,
paddingLeft
:
25
,
marginTop
:
-
150
}}
>
...
...
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