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
41028645
Commit
41028645
authored
Sep 01, 2020
by
a.bairuha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
07bc1c51
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
356 additions
and
219 deletions
+356
-219
CreatePerusahaan.js
src/container/MasterData/Perusahaan/CreatePerusahaan.js
+84
-50
Perusahaan.js
src/container/MasterData/Perusahaan/Perusahaan.js
+236
-163
VisualPerusahaan.js
src/container/MasterData/Perusahaan/VisualPerusahaan.js
+36
-6
No files found.
src/container/MasterData/Perusahaan/CreatePerusahaan.js
View file @
41028645
...
...
@@ -7,6 +7,7 @@ import Autocomplete from '@material-ui/lab/Autocomplete';
import
MuiAlert
from
'@material-ui/lab/Alert'
;
import
api
from
'../../../api'
;
import
Images
from
'../../../assets/Images'
;
import
Constant
from
'../../../library/Constant'
;
const
Alert
=
withStyles
({
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
...
...
@@ -71,23 +72,34 @@ export default class CreatePerusahaan extends Component {
api
.
create
().
getDetailPerusahaan
(
this
.
props
.
data
[
1
]).
then
(
response
=>
{
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
businessID
:
response
.
data
.
data
.
business_unit_id
,
companyID
:
response
.
data
.
data
.
company_id
,
status
:
response
.
data
.
data
.
status
,
company
:
response
.
data
.
data
.
company_name
,
parentID
:
response
.
data
.
data
.
parent
,
parent
:
response
.
data
.
data
.
parent_name
,
startDate
:
response
.
data
.
data
.
start_date
,
endDate
:
response
.
data
.
data
.
end_date
,
totalReport
:
response
.
data
.
data
.
total_report
,
created
:
response
.
data
.
data
.
created
,
updated
:
response
.
data
.
data
.
updated
===
null
?
""
:
response
.
data
.
data
.
updated
},
()
=>
this
.
getAllUnitBisnis
(),
this
.
getCompanyActive
())
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
businessID
:
response
.
data
.
data
.
business_unit_id
,
companyID
:
response
.
data
.
data
.
company_id
,
status
:
response
.
data
.
data
.
status
,
company
:
response
.
data
.
data
.
company_name
,
parentID
:
response
.
data
.
data
.
parent
,
parent
:
response
.
data
.
data
.
parent_name
,
startDate
:
response
.
data
.
data
.
start_date
,
endDate
:
response
.
data
.
data
.
end_date
,
totalReport
:
response
.
data
.
data
.
total_report
,
created
:
response
.
data
.
data
.
created
,
updated
:
response
.
data
.
data
.
updated
===
null
?
""
:
response
.
data
.
data
.
updated
},
()
=>
this
.
getAllUnitBisnis
(),
this
.
getCompanyActive
())
}
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
:
'
warning
'
})
}
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'
error
'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
...
...
@@ -103,23 +115,34 @@ export default class CreatePerusahaan extends Component {
api
.
create
().
getPerusahaanActive
(
payload
).
then
(
response
=>
{
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
perusahaanData
=
data
.
map
((
item
)
=>
{
return
{
company_id
:
item
.
company_id
,
company_name
:
item
.
company_name
}
})
let
index
=
perusahaanData
.
sort
((
a
,
b
)
=>
a
.
company_id
-
b
.
company_id
).
findIndex
((
val
)
=>
val
.
company_id
==
this
.
state
.
parentID
)
let
typeProps
=
{
options
:
perusahaanData
,
getOptionLabel
:
(
option
)
=>
option
.
company_name
,
};
this
.
setState
({
perusahaan
:
typeProps
,
perusahaanData
:
response
.
data
.
data
,
getPerusahaan
:
index
==
-
1
?
null
:
perusahaanData
[
index
]
})
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
data
=
response
.
data
.
data
let
perusahaanData
=
data
.
map
((
item
)
=>
{
return
{
company_id
:
item
.
company_id
,
company_name
:
item
.
company_name
}
})
let
index
=
perusahaanData
.
sort
((
a
,
b
)
=>
a
.
company_id
-
b
.
company_id
).
findIndex
((
val
)
=>
val
.
company_id
==
this
.
state
.
parentID
)
let
typeProps
=
{
options
:
perusahaanData
,
getOptionLabel
:
(
option
)
=>
option
.
company_name
,
};
this
.
setState
({
perusahaan
:
typeProps
,
perusahaanData
:
response
.
data
.
data
,
getPerusahaan
:
index
==
-
1
?
null
:
perusahaanData
[
index
]
})
}
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
:
'
warning
'
})
}
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'
error
'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
...
...
@@ -130,25 +153,36 @@ export default class CreatePerusahaan extends Component {
getAllUnitBisnis
()
{
api
.
create
().
getUnitBisnisActive
().
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
typeData
=
data
.
map
((
item
)
=>
{
return
{
business_unit_id
:
item
.
business_unit_id
,
business_unit_name
:
item
.
business_unit_name
}
})
// console.log(typeData)
let
index
=
typeData
.
findIndex
((
val
)
=>
val
.
business_unit_id
==
this
.
state
.
businessID
)
console
.
log
(
index
)
let
typeProps
=
{
options
:
typeData
,
getOptionLabel
:
(
option
)
=>
option
.
business_unit_name
,
};
this
.
setState
({
types
:
typeProps
,
typeData
:
response
.
data
.
data
,
getTypes
:
index
==
-
1
?
null
:
typeData
[
index
]
})
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
typeData
=
data
.
map
((
item
)
=>
{
return
{
business_unit_id
:
item
.
business_unit_id
,
business_unit_name
:
item
.
business_unit_name
}
})
// console.log(typeData)
let
index
=
typeData
.
findIndex
((
val
)
=>
val
.
business_unit_id
==
this
.
state
.
businessID
)
console
.
log
(
index
)
let
typeProps
=
{
options
:
typeData
,
getOptionLabel
:
(
option
)
=>
option
.
business_unit_name
,
};
this
.
setState
({
types
:
typeProps
,
typeData
:
response
.
data
.
data
,
getTypes
:
index
==
-
1
?
null
:
typeData
[
index
]
})
}
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
:
'
warning
'
})
}
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'
error
'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
...
...
src/container/MasterData/Perusahaan/Perusahaan.js
View file @
41028645
This diff is collapsed.
Click to expand it.
src/container/MasterData/Perusahaan/VisualPerusahaan.js
View file @
41028645
...
...
@@ -7,6 +7,7 @@ import Nestable from 'react-nestable/dist/Nestable';
import
AddIcon
from
'@material-ui/icons/Add'
;
import
RemoveIcon
from
'@material-ui/icons/Remove'
;
import
api
from
'../../../api'
;
import
Constant
from
'../../../library/Constant'
;
const
Alert
=
withStyles
({
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
...
...
@@ -55,11 +56,22 @@ export default class VisualPerusahaan extends Component {
api
.
create
().
getPerusahaanHierarki
().
then
((
response
)
=>
{
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
setState
({
items
:
response
.
data
.
data
})
console
.
log
(
response
.
data
.
data
)
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
setState
({
items
:
response
.
data
.
data
})
console
.
log
(
response
.
data
.
data
)
}
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
:
'
warning
'
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'
error
'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
...
...
@@ -89,8 +101,26 @@ export default class VisualPerusahaan extends Component {
"company"
:
this
.
state
.
items
}
api
.
create
().
saveVisualisasiPerusahaan
(
payload
).
then
((
response
)
=>
{
// if (response.data.status == 'ucces') {
this
.
props
.
onClickClose
()
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
props
.
onClickClose
()
}
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
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
// } else {
// alert(response.data.message)
// }
...
...
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