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
3629fd5d
Commit
3629fd5d
authored
Sep 02, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix invalid template
parent
ad7f6475
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
580 additions
and
552 deletions
+580
-552
Parameter.js
src/container/MasterData/Parameter/Parameter.js
+299
-288
UnitBisnis.js
src/container/MasterData/UnitBisnis.js
+136
-124
User.js
src/container/Otorisasi/User.js
+145
-140
No files found.
src/container/MasterData/Parameter/Parameter.js
View file @
3629fd5d
...
@@ -35,7 +35,8 @@ export default class Parameter extends Component {
...
@@ -35,7 +35,8 @@ export default class Parameter extends Component {
messageAlert
:
''
,
messageAlert
:
''
,
create
:
false
,
create
:
false
,
edit
:
false
,
edit
:
false
,
load
:
false
load
:
false
,
judul
:
''
}
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
}
}
...
@@ -260,7 +261,7 @@ export default class Parameter extends Component {
...
@@ -260,7 +261,7 @@ export default class Parameter extends Component {
console
.
log
(
err
);
console
.
log
(
err
);
}
}
else
{
else
{
let
judul
=
resp
.
rows
[
2
]
//
let judul = resp.rows[2]
let
isi
=
resp
.
rows
.
slice
(
3
)
let
isi
=
resp
.
rows
.
slice
(
3
)
let
payload
=
[]
let
payload
=
[]
isi
.
map
((
item
,
index
)
=>
{
isi
.
map
((
item
,
index
)
=>
{
...
@@ -283,333 +284,338 @@ export default class Parameter extends Component {
...
@@ -283,333 +284,338 @@ export default class Parameter extends Component {
let
body
=
{
let
body
=
{
setting
:
payload
setting
:
payload
}
}
this
.
setState
({
payload
:
body
,
buttonError
:
false
})
console
.
log
(
resp
.
rows
[
1
]);
api
.
create
().
checkUploadParameter
(
body
).
then
(
response
=>
{
this
.
setState
({
payload
:
body
,
buttonError
:
false
,
judul
:
resp
.
rows
[
1
][
0
]
})
console
.
log
(
response
);
}
if
(
response
.
data
)
{
});
if
(
response
.
ok
)
{
}
if
(
response
.
data
.
status
===
"success"
)
{
let
dataRow
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
checkUpload
(){
return
[
api
.
create
().
checkUploadParameter
(
this
.
state
.
payload
).
then
(
response
=>
{
index
+
1
,
console
.
log
(
response
);
item
.
group
,
if
(
response
.
data
)
{
item
.
parameter
,
if
(
response
.
ok
)
{
item
.
company
,
if
(
response
.
data
.
status
===
"success"
)
{
item
.
description
,
let
dataRow
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
item
.
orders
,
return
[
item
.
value
,
index
+
1
,
item
.
min_value
,
item
.
group
,
item
.
max_value
,
item
.
parameter
,
item
.
start_date
,
item
.
company
,
item
.
end_date
,
item
.
description
,
item
.
error
,
item
.
orders
,
]
item
.
value
,
})
item
.
min_value
,
let
columns
=
[
item
.
max_value
,
"Data"
,
item
.
start_date
,
{
item
.
end_date
,
name
:
"Group"
,
item
.
error
,
options
:
{
]
customBodyRender
:
(
val
,
tableMeta
)
=>
{
})
let
check
=
null
let
columns
=
[
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
"Data"
,
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'group'
))
{
if
(
check
>
-
1
)
{
name
:
"Group"
,
this
.
setState
({
buttonError
:
true
})
options
:
{
}
customBodyRender
:
(
val
,
tableMeta
)
=>
{
}
let
check
=
null
return
(
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
<
div
style
=
{{
display
:
'flex'
}}
>
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'group'
))
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
if
(
check
>
-
1
)
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"group"
>
this
.
setState
({
buttonError
:
true
})
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"group"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
}
}
},
return
(
{
<
div
style
=
{{
display
:
'flex'
}}
>
name
:
"Parameter"
,
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
options
:
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"group"
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
let
check
=
null
<
/a>
:
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'parameter'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
return
(
<
ReactTooltip
border
=
{
true
}
id
=
"group"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
div
style
=
{{
display
:
'flex'
}}
>
<
/div
>
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
);
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"parameter"
>
}
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
},
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
{
}
name
:
"Parameter"
,
<
ReactTooltip
border
=
{
true
}
id
=
"parameter"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
options
:
{
<
/div
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
);
let
check
=
null
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'parameter'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
}
},
return
(
{
<
div
style
=
{{
display
:
'flex'
}}
>
name
:
"Company"
,
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
options
:
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"parameter"
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
let
check
=
null
<
/a>
:
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'company'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
return
(
<
ReactTooltip
border
=
{
true
}
id
=
"parameter"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
div
style
=
{{
display
:
'flex'
}}
>
<
/div
>
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
);
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"company"
>
}
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
},
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
{
}
name
:
"Company"
,
<
ReactTooltip
border
=
{
true
}
id
=
"company"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
options
:
{
<
/div
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
);
let
check
=
null
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'company'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
}
},
return
(
{
<
div
style
=
{{
display
:
'flex'
}}
>
name
:
"Description"
,
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
options
:
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"company"
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
let
check
=
null
<
/a>
:
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'description'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
return
(
<
ReactTooltip
border
=
{
true
}
id
=
"company"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
div
style
=
{{
display
:
'flex'
}}
>
<
/div
>
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
);
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"description"
>
}
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
},
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
{
}
name
:
"Description"
,
<
ReactTooltip
border
=
{
true
}
id
=
"description"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
options
:
{
<
/div
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
);
let
check
=
null
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'description'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
}
},
return
(
{
<
div
style
=
{{
display
:
'flex'
}}
>
name
:
"Order"
,
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
options
:
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"description"
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
let
check
=
null
<
/a>
:
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'order'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
return
(
<
ReactTooltip
border
=
{
true
}
id
=
"description"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
div
style
=
{{
display
:
'flex'
}}
>
<
/div
>
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
);
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"order"
>
}
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
},
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
{
}
name
:
"Order"
,
<
ReactTooltip
border
=
{
true
}
id
=
"order"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
options
:
{
<
/div
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
);
let
check
=
null
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'order'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
}
},
return
(
{
<
div
style
=
{{
display
:
'flex'
}}
>
name
:
"Value"
,
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
options
:
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"order"
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
let
check
=
null
<
/a>
:
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'value'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
return
(
<
ReactTooltip
border
=
{
true
}
id
=
"order"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
div
style
=
{{
display
:
'flex'
}}
>
<
/div
>
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
);
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"value"
>
}
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
},
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
{
}
name
:
"Value"
,
<
ReactTooltip
border
=
{
true
}
id
=
"value"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
options
:
{
<
/div
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
);
let
check
=
null
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'value'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
}
},
return
(
{
<
div
style
=
{{
display
:
'flex'
}}
>
name
:
"Min Value"
,
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
options
:
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"value"
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
let
check
=
null
<
/a>
:
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'min_value'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
return
(
<
ReactTooltip
border
=
{
true
}
id
=
"value"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
div
style
=
{{
display
:
'flex'
}}
>
<
/div
>
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
);
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"min_value"
>
}
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
},
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
{
}
name
:
"Min Value"
,
<
ReactTooltip
border
=
{
true
}
id
=
"min_value"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
options
:
{
<
/div
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
);
let
check
=
null
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'min_value'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
}
},
return
(
{
<
div
style
=
{{
display
:
'flex'
}}
>
name
:
"Max Value"
,
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
options
:
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"min_value"
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
let
check
=
null
<
/a>
:
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'max_value'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
return
(
<
ReactTooltip
border
=
{
true
}
id
=
"min_value"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
div
style
=
{{
display
:
'flex'
}}
>
<
/div
>
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
);
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"max_value"
>
}
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
},
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
{
}
name
:
"Max Value"
,
<
ReactTooltip
border
=
{
true
}
id
=
"max_value"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
options
:
{
<
/div
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
);
let
check
=
null
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'max_value'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
}
},
return
(
{
<
div
style
=
{{
display
:
'flex'
}}
>
name
:
"Valid To"
,
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
options
:
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"max_value"
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
let
check
=
null
<
/a>
:
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'start_date'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
return
(
<
ReactTooltip
border
=
{
true
}
id
=
"max_value"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
div
style
=
{{
display
:
'flex'
}}
>
<
/div
>
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
);
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"start_date"
>
}
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
},
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
{
}
name
:
"Valid To"
,
<
ReactTooltip
border
=
{
true
}
id
=
"start_date"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
options
:
{
<
/div
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
);
let
check
=
null
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'start_date'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
}
},
return
(
{
<
div
style
=
{{
display
:
'flex'
}}
>
name
:
"Valid From"
,
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
options
:
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"start_date"
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
let
check
=
null
<
/a>
:
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'end_date'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
return
(
<
ReactTooltip
border
=
{
true
}
id
=
"start_date"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
div
style
=
{{
display
:
'flex'
}}
>
<
/div
>
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
);
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"enddate"
>
}
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
},
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
{
}
name
:
"Valid From"
,
<
ReactTooltip
border
=
{
true
}
id
=
"enddate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
options
:
{
<
/div
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
);
let
check
=
null
if
(
tableMeta
.
rowData
[
11
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
11
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'end_date'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
}
},
return
(
{
<
div
style
=
{{
display
:
'flex'
}}
>
name
:
""
,
{
tableMeta
.
rowData
[
11
]
!=
null
&&
check
>
-
1
?
options
:
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
11
][
check
].
message
}
data
-
for
=
"enddate"
>
display
:
false
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
}
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
]
}
<
ReactTooltip
border
=
{
true
}
id
=
"enddate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
console
.
log
(
dataRow
);
<
/div
>
this
.
setState
({
);
dataLoaded
:
true
,
cols
:
columns
,
rows
:
dataRow
});
}
else
{
this
.
setState
({
dataLoaded
:
true
,
cols
:
[],
rows
:
[],
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
}
})
}
},
{
name
:
""
,
options
:
{
display
:
false
}
}
}
}
else
{
]
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
console
.
log
(
dataRow
);
dataLoaded
:
true
,
cols
:
[],
rows
:
[]
});
}
}
else
{
this
.
setState
({
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
dataLoaded
:
true
,
dataLoaded
:
true
,
cols
:
[],
cols
:
columns
,
rows
:
[]
rows
:
dataRow
,
visibleUpload
:
false
,
visibleParameter
:
false
});
});
}
else
{
this
.
setState
({
dataLoaded
:
true
,
cols
:
[],
rows
:
[],
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
}
else
{
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
dataLoaded
:
true
,
cols
:
[],
rows
:
[]
});
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
dataLoaded
:
true
,
cols
:
[],
rows
:
[]
});
}
}
});
})
}
}
uploadParameter
()
{
uploadParameter
()
{
api
.
create
().
uploadParameter
(
this
.
state
.
payload
).
then
(
response
=>
{
api
.
create
().
uploadParameter
(
this
.
state
.
payload
).
then
(
response
=>
{
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
status
===
"success"
)
{
console
.
log
(
response
)
this
.
getAllParameter
()
this
.
getAllParameter
()
this
.
setState
({
visibleParameter
:
true
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
this
.
setState
({
visibleParameter
:
true
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
})
}
else
{
}
else
{
...
@@ -910,7 +916,8 @@ export default class Parameter extends Component {
...
@@ -910,7 +916,8 @@ export default class Parameter extends Component {
<
/button
>
<
/button
>
<
button
<
button
type
=
"button"
type
=
"button"
onClick
=
{()
=>
this
.
state
.
buttonError
?
this
.
setState
({
popupError
:
true
})
:
this
.
uploadParameter
()}
disabled
=
{
this
.
state
.
buttonError
?
true
:
false
}
onClick
=
{()
=>
this
.
uploadParameter
()}
style
=
{{}}
style
=
{{}}
>
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
div
style
=
{{
width
:
102
,
height
:
30
,
backgroundColor
:
'#354960'
,
borderRadius
:
5
,
alignItems
:
'center'
,
display
:
'flex'
,
justifyContent
:
'center'
}}
>
...
@@ -966,7 +973,11 @@ export default class Parameter extends Component {
...
@@ -966,7 +973,11 @@ export default class Parameter extends Component {
this
.
fileHandler
(
dt
)
this
.
fileHandler
(
dt
)
this
.
setState
({
uploadStatus
:
'idle'
,
percentage
:
'0'
})
this
.
setState
({
uploadStatus
:
'idle'
,
percentage
:
'0'
})
}}
}}
onUpload
=
{()
=>
this
.
setState
({
visibleUpload
:
false
,
visibleParameter
:
false
})}
onUpload
=
{()
=>
{
this
.
state
.
judul
===
"MASTER DATA - PARAMETER"
?
this
.
checkUpload
()
:
this
.
setState
({
alert
:
true
,
messageAlert
:
"Invalid Template"
,
tipeAlert
:
'warning'
})
}}
/
>
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
...
src/container/MasterData/UnitBisnis.js
View file @
3629fd5d
...
@@ -8,7 +8,7 @@ import MUIDataTable from "mui-datatables";
...
@@ -8,7 +8,7 @@ import MUIDataTable from "mui-datatables";
import
CreateUnitBisnis
from
"./formUnitBisnis/CreateUnitBisnis"
;
import
CreateUnitBisnis
from
"./formUnitBisnis/CreateUnitBisnis"
;
import
ReactTooltip
from
'react-tooltip'
;
import
ReactTooltip
from
'react-tooltip'
;
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
{
TextField
,
InputBase
,
Snackbar
,
withStyles
}
from
"@material-ui/core"
;
import
{
TextField
,
InputBase
,
Snackbar
,
withStyles
,
LinearProgress
}
from
"@material-ui/core"
;
import
{
ExcelRenderer
}
from
'react-excel-renderer'
;
import
{
ExcelRenderer
}
from
'react-excel-renderer'
;
import
api
from
"../../api"
;
import
api
from
"../../api"
;
import
{
isThisSecond
}
from
"date-fns"
;
import
{
isThisSecond
}
from
"date-fns"
;
...
@@ -44,7 +44,8 @@ export default class UnitBisnis extends Component {
...
@@ -44,7 +44,8 @@ export default class UnitBisnis extends Component {
create
:
false
,
create
:
false
,
edit
:
false
,
edit
:
false
,
load
:
false
,
load
:
false
,
judul
:
''
judul
:
''
,
// visibleLoad: true
}
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
}
}
...
@@ -74,135 +75,138 @@ export default class UnitBisnis extends Component {
...
@@ -74,135 +75,138 @@ export default class UnitBisnis extends Component {
}
}
console
.
log
(
resp
.
rows
[
1
])
console
.
log
(
resp
.
rows
[
1
])
this
.
setState
({
payload
:
body
,
buttonError
:
false
,
judul
:
resp
.
rows
[
1
][
0
]
})
this
.
setState
({
payload
:
body
,
buttonError
:
false
,
judul
:
resp
.
rows
[
1
][
0
]
})
api
.
create
().
checkUploadUnitBisnis
(
body
).
then
(
response
=>
{
}
console
.
log
(
response
)
});
let
dataRow
=
[]
}
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
checkUpload
(){
if
(
response
.
data
.
status
===
"success"
)
{
api
.
create
().
checkUploadUnitBisnis
(
this
.
state
.
payload
).
then
(
response
=>
{
dataRow
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
console
.
log
(
response
)
return
[
let
dataRow
=
[]
index
+
1
,
if
(
response
.
data
)
{
item
.
business_unit_name
,
if
(
response
.
ok
)
{
item
.
start_date
,
if
(
response
.
data
.
status
===
"success"
)
{
item
.
end_date
,
dataRow
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
item
.
error
return
[
]
index
+
1
,
})
item
.
business_unit_name
,
let
columns
=
[
item
.
start_date
,
"Data"
,
item
.
end_date
,
{
item
.
error
name
:
"Business Unit"
,
]
options
:
{
})
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
columns
=
[
let
check
=
null
"Data"
,
if
(
tableMeta
.
rowData
[
4
]
!=
null
)
{
{
check
=
tableMeta
.
rowData
[
4
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'business_unit_name'
))
name
:
"Business Unit"
,
if
(
check
>
-
1
)
{
options
:
{
this
.
setState
({
buttonError
:
true
})
customBodyRender
:
(
val
,
tableMeta
)
=>
{
}
let
check
=
null
}
if
(
tableMeta
.
rowData
[
4
]
!=
null
)
{
return
(
check
=
tableMeta
.
rowData
[
4
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'business_unit_name'
))
<
div
style
=
{{
display
:
'flex'
}}
>
if
(
check
>
-
1
)
{
{
tableMeta
.
rowData
[
4
]
!=
null
&&
check
>
-
1
?
this
.
setState
({
buttonError
:
true
})
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
4
][
check
].
message
}
data
-
for
=
"unitbisnis"
>
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
<
/a>
:
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
ReactTooltip
border
=
{
true
}
id
=
"unitbisnis"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
);
}
}
}
}
},
return
(
{
<
div
style
=
{{
display
:
'flex'
}}
>
name
:
"Valid From"
,
{
tableMeta
.
rowData
[
4
]
!=
null
&&
check
>
-
1
?
options
:
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
4
][
check
].
message
}
data
-
for
=
"unitbisnis"
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
let
check
=
null
<
/a>
:
if
(
tableMeta
.
rowData
[
4
]
!=
null
)
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
check
=
tableMeta
.
rowData
[
4
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'start_date'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
return
(
<
ReactTooltip
border
=
{
true
}
id
=
"unitbisnis"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
div
style
=
{{
display
:
'flex'
}}
>
<
/div
>
{
tableMeta
.
rowData
[
4
]
!=
null
&&
check
>
-
1
?
);
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
4
][
check
].
message
}
data
-
for
=
"startdate"
>
}
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
},
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
{
}
name
:
"Valid From"
,
<
ReactTooltip
border
=
{
true
}
id
=
"startdate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
options
:
{
<
/div
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
);
let
check
=
null
if
(
tableMeta
.
rowData
[
4
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
4
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'start_date'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
}
},
return
(
{
<
div
style
=
{{
display
:
'flex'
}}
>
name
:
"Valid To"
,
{
tableMeta
.
rowData
[
4
]
!=
null
&&
check
>
-
1
?
options
:
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
4
][
check
].
message
}
data
-
for
=
"startdate"
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
let
check
=
null
<
/a>
:
if
(
tableMeta
.
rowData
[
4
]
!=
null
)
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
check
=
tableMeta
.
rowData
[
4
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'end_date'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
return
(
<
ReactTooltip
border
=
{
true
}
id
=
"startdate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
div
style
=
{{
display
:
'flex'
}}
>
<
/div
>
{
tableMeta
.
rowData
[
4
]
!=
null
&&
check
>
-
1
?
);
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
4
][
check
].
message
}
data
-
for
=
"enddate"
>
}
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
},
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
{
}
name
:
"Valid To"
,
<
ReactTooltip
border
=
{
true
}
id
=
"enddate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
options
:
{
<
/div
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
);
let
check
=
null
if
(
tableMeta
.
rowData
[
4
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
4
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'end_date'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
}
},
return
(
{
<
div
style
=
{{
display
:
'flex'
}}
>
name
:
""
,
{
tableMeta
.
rowData
[
4
]
!=
null
&&
check
>
-
1
?
options
:
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
4
][
check
].
message
}
data
-
for
=
"enddate"
>
display
:
false
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
}
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
]
}
<
ReactTooltip
border
=
{
true
}
id
=
"enddate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
// console.log(dataRow);
<
/div
>
this
.
setState
({
);
dataLoaded
:
true
,
cols
:
columns
,
rows
:
dataRow
});
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
}
})
}
},
{
name
:
""
,
options
:
{
display
:
false
}
}
}
}
else
{
]
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
// console.log(dataRow);
}
else
{
this
.
setState
({
this
.
setState
({
dataLoaded
:
false
,
dataLoaded
:
true
,
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
cols
:
columns
,
rows
:
dataRow
,
visibleUpload
:
false
,
visibleUnitBisnis
:
false
});
});
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
else
{
this
.
setState
({
dataLoaded
:
false
,
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
});
}
}
})
;
})
}
}
componentDidMount
()
{
componentDidMount
()
{
...
@@ -256,7 +260,7 @@ export default class UnitBisnis extends Component {
...
@@ -256,7 +260,7 @@ export default class UnitBisnis extends Component {
})
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
...
@@ -304,7 +308,7 @@ export default class UnitBisnis extends Component {
...
@@ -304,7 +308,7 @@ export default class UnitBisnis extends Component {
})
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
...
@@ -331,7 +335,7 @@ export default class UnitBisnis extends Component {
...
@@ -331,7 +335,7 @@ export default class UnitBisnis extends Component {
})
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
...
@@ -359,7 +363,7 @@ export default class UnitBisnis extends Component {
...
@@ -359,7 +363,7 @@ export default class UnitBisnis extends Component {
})
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
...
@@ -416,7 +420,7 @@ export default class UnitBisnis extends Component {
...
@@ -416,7 +420,7 @@ export default class UnitBisnis extends Component {
})
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
...
@@ -685,13 +689,21 @@ export default class UnitBisnis extends Component {
...
@@ -685,13 +689,21 @@ export default class UnitBisnis extends Component {
}}
}}
onUpload
=
{()
=>
{
onUpload
=
{()
=>
{
this
.
state
.
judul
===
"MASTER DATA - BUSINESS UNIT"
?
this
.
state
.
judul
===
"MASTER DATA - BUSINESS UNIT"
?
this
.
setState
({
visibleUpload
:
false
,
visibleUnitBisnis
:
false
}
)
:
this
.
checkUpload
(
)
:
this
.
setState
({
alert
:
true
,
messageAlert
:
"Invalid Template"
,
tipeAlert
:
'warning'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
"Invalid Template"
,
tipeAlert
:
'warning'
})
}}
}}
/
>
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
)}
)}
{
/* {this.state.visibleLoad && (
<div className="test app-popup-show">
<div className="popup-content" style={{ textAlign: 'center'}}>
<img src={Images.triputraLogo} style={{ height: 100, width: 100}}/>
</div>
</div>
)} */
}
<
/div
>
<
/div
>
);
);
}
}
...
...
src/container/Otorisasi/User.js
View file @
3629fd5d
...
@@ -166,162 +166,167 @@ export default class UserRole extends Component {
...
@@ -166,162 +166,167 @@ export default class UserRole extends Component {
}
}
console
.
log
(
resp
.
rows
[
1
])
console
.
log
(
resp
.
rows
[
1
])
this
.
setState
({
payload
:
body
,
rows
:
[],
judul
:
resp
.
rows
[
1
][
0
]
})
this
.
setState
({
payload
:
body
,
rows
:
[],
judul
:
resp
.
rows
[
1
][
0
]
})
api
.
create
().
checkUploadUser
(
body
).
then
(
response
=>
{
}
console
.
log
(
response
);
});
if
(
response
.
data
)
{
}
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
let
dataRow
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
return
[
index
+
1
,
item
.
fullname
,
item
.
email
,
item
.
role
,
item
.
start_date
,
item
.
end_date
,
item
.
error
]
})
let
columns
=
[
checkUpload
(){
"Data"
,
api
.
create
().
checkUploadUser
(
this
.
state
.
payload
).
then
(
response
=>
{
"Full Name"
,
console
.
log
(
response
);
{
if
(
response
.
data
)
{
name
:
"Email"
,
if
(
response
.
ok
)
{
options
:
{
if
(
response
.
data
.
status
===
"success"
)
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
let
dataRow
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
// console.log(tableMeta)
return
[
let
check
=
null
index
+
1
,
if
(
tableMeta
.
rowData
[
6
]
!=
null
)
{
item
.
fullname
,
check
=
tableMeta
.
rowData
[
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'email'
))
item
.
email
,
if
(
check
>
-
1
)
{
item
.
role
,
this
.
setState
({
buttonError
:
true
})
item
.
start_date
,
}
item
.
end_date
,
}
item
.
error
return
(
]
<
div
style
=
{{
display
:
'flex'
}}
>
})
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"email"
>
let
columns
=
[
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
"Data"
,
<
/a>
:
"Full Name"
,
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
{
}
name
:
"Email"
,
<
ReactTooltip
border
=
{
true
}
id
=
"email"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
options
:
{
<
/div
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
);
// console.log(tableMeta)
let
check
=
null
if
(
tableMeta
.
rowData
[
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'email'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
}
}
}
}
},
return
(
{
<
div
style
=
{{
display
:
'flex'
}}
>
name
:
"Role"
,
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
options
:
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"email"
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
let
check
=
null
<
/a>
:
if
(
tableMeta
.
rowData
[
6
]
!=
null
)
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
check
=
tableMeta
.
rowData
[
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'role'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
console
.
log
(
'masuk'
)
}
}
}
return
(
<
ReactTooltip
border
=
{
true
}
id
=
"email"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
div
style
=
{{
display
:
'flex'
}}
>
<
/div
>
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
);
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"role"
>
}
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
},
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
{
}
name
:
"Role"
,
<
ReactTooltip
border
=
{
true
}
id
=
"role"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
options
:
{
<
/div
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
);
let
check
=
null
if
(
tableMeta
.
rowData
[
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'role'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
console
.
log
(
'masuk'
)
}
}
}
}
},
return
(
{
<
div
style
=
{{
display
:
'flex'
}}
>
name
:
"Valid From"
,
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
options
:
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"role"
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
let
check
=
null
<
/a>
:
if
(
tableMeta
.
rowData
[
6
]
!=
null
)
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
check
=
tableMeta
.
rowData
[
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'start_date'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
console
.
log
(
'masuk'
)
}
}
}
return
(
<
ReactTooltip
border
=
{
true
}
id
=
"role"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
div
style
=
{{
display
:
'flex'
}}
>
<
/div
>
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
);
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"startdate"
>
}
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
},
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
{
}
name
:
"Valid From"
,
<
ReactTooltip
border
=
{
true
}
id
=
"startdate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
options
:
{
<
/div
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
);
let
check
=
null
if
(
tableMeta
.
rowData
[
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'start_date'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
console
.
log
(
'masuk'
)
}
}
}
}
},
return
(
{
<
div
style
=
{{
display
:
'flex'
}}
>
name
:
"Valid To"
,
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
options
:
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"startdate"
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
let
check
=
null
<
/a>
:
if
(
tableMeta
.
rowData
[
6
]
!=
null
)
{
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
check
=
tableMeta
.
rowData
[
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'end_date'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
console
.
log
(
'masuk'
)
}
}
}
return
(
<
ReactTooltip
border
=
{
true
}
id
=
"startdate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
div
style
=
{{
display
:
'flex'
}}
>
<
/div
>
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
);
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"enddate"
>
}
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
},
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
{
}
name
:
"Valid To"
,
<
ReactTooltip
border
=
{
true
}
id
=
"enddate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
options
:
{
<
/div
>
customBodyRender
:
(
val
,
tableMeta
)
=>
{
);
let
check
=
null
if
(
tableMeta
.
rowData
[
6
]
!=
null
)
{
check
=
tableMeta
.
rowData
[
6
].
findIndex
((
val
)
=>
val
.
field
.
includes
(
'end_date'
))
if
(
check
>
-
1
)
{
this
.
setState
({
buttonError
:
true
})
console
.
log
(
'masuk'
)
}
}
}
}
},
return
(
{
<
div
style
=
{{
display
:
'flex'
}}
>
name
:
""
,
{
tableMeta
.
rowData
[
6
]
!=
null
&&
check
>
-
1
?
options
:
{
<
a
data
-
tip
=
{
tableMeta
.
rowData
[
6
][
check
].
message
}
data
-
for
=
"enddate"
>
display
:
false
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
}
<
/a>
:
}
<
span
style
=
{{
color
:
check
!=
null
&&
check
>
-
1
?
"red"
:
'black'
}}
>
{
val
}
<
/span
>
]
}
<
ReactTooltip
border
=
{
true
}
id
=
"enddate"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
this
.
setState
({
<
/div
>
dataLoaded
:
true
,
);
cols
:
columns
,
rows
:
dataRow
});
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
}
})
}
},
{
name
:
""
,
options
:
{
display
:
false
}
}
}
}
else
{
]
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
this
.
setState
({
dataLoaded
:
true
,
cols
:
columns
,
rows
:
dataRow
,
visibleUpload
:
false
,
visibleUser
:
false
});
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Token"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
}
})
;
})
}
}
downloadFile
=
async
()
=>
{
downloadFile
=
async
()
=>
{
...
@@ -775,7 +780,7 @@ export default class UserRole extends Component {
...
@@ -775,7 +780,7 @@ export default class UserRole extends Component {
}}
}}
onUpload
=
{()
=>
{
onUpload
=
{()
=>
{
this
.
state
.
judul
===
'MASTER DATA - USER'
?
this
.
state
.
judul
===
'MASTER DATA - USER'
?
this
.
setState
({
visibleUpload
:
false
,
visibleUser
:
false
}
)
:
this
.
checkUpload
(
)
:
this
.
setState
({
alert
:
true
,
messageAlert
:
"Invalid Template"
,
tipeAlert
:
'warning'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
"Invalid Template"
,
tipeAlert
:
'warning'
})
}}
}}
/
>
/
>
...
...
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