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
0029c985
Commit
0029c985
authored
Sep 06, 2020
by
Rifka Kurnia Irfiana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete approval matrix
parent
3e4aeeeb
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
197 additions
and
17 deletions
+197
-17
index.js
src/api/index.js
+2
-0
ApprovalMatrix.js
src/container/ApprovalMatrix/ApprovalMatrix.js
+70
-16
CreateApprovalMatrix.js
src/container/ApprovalMatrix/CreateApprovalMatrix.js
+1
-1
PopUpDelete.js
src/container/ApprovalMatrix/PopUpDelete.js
+124
-0
No files found.
src/api/index.js
View file @
0029c985
...
...
@@ -117,6 +117,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const
updateVAM
=
(
body
)
=>
api
.
post
(
'/approval_matrix/visual_approval_matrix'
,
body
)
const
checkUploadAM
=
(
body
)
=>
api
.
post
(
'/approval_matrix/check_import_approval_matrix'
,
body
)
const
uploadAM
=
(
body
)
=>
api
.
post
(
'approval_matrix/import_approval_matrix'
,
body
)
const
deleteAM
=
(
id
)
=>
api
.
post
(
`approval_matrix/delete_approval_matrix/
${
id
}
`
)
//User
const
getUser
=
()
=>
api
.
get
(
'user/get_all_user'
)
...
...
@@ -213,6 +214,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
updateVAM
,
checkUploadAM
,
uploadAM
,
deleteAM
,
getUser
,
getDetailUser
,
searchUser
,
...
...
src/container/ApprovalMatrix/ApprovalMatrix.js
View file @
0029c985
...
...
@@ -11,6 +11,7 @@ import UploadFile from "../../library/Upload";
import
CreateApprovalMatrix
from
"./CreateApprovalMatrix"
;
import
EditApprovalMatrix
from
"./EditApprovalMatrix"
;
import
VisualisasiAM
from
"./VisualisasiAM"
;
import
PopUpDelete
from
"./PopUpDelete"
;
import
PopUpFailedSave
from
"../../library/PopUpFailedSave"
;
import
api
from
"../../api"
;
import
Constant
from
'../../library/Constant'
;
...
...
@@ -46,6 +47,7 @@ export default class ApprovalMatrix extends Component {
btnedit
:
false
,
load
:
false
,
judul
:
''
,
popupDel
:
false
,
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
}
...
...
@@ -355,7 +357,14 @@ export default class ApprovalMatrix extends Component {
rowData
:
index
,
visibleEdit
:
true
})
}
else
{
}
else
if
(
type
===
'delete'
)
{
console
.
log
(
"berhasil klik btn del"
)
this
.
setState
({
rowData
:
index
,
popupDel
:
true
})
}
else
{
this
.
setState
({
visibleCreate
:
true
})
...
...
@@ -539,6 +548,34 @@ export default class ApprovalMatrix extends Component {
this
.
setState
({
alert
:
false
})
}
deleteAM
=
(
payload
)
=>
{
this
.
setState
({
popupDel
:
false
})
api
.
create
().
deleteAM
(
payload
).
then
(
response
=>
{
console
.
log
(
response
.
data
)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
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'
},
()
=>
{
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'
})
}
})
}
render
()
{
const
columns
=
[{
name
:
"Action"
,
...
...
@@ -560,6 +597,19 @@ export default class ApprovalMatrix extends Component {
<
img
src
=
{
Images
.
editCopy
}
/
>
<
/button
>
)}
{
this
.
state
.
btnedit
&&
(
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
marginLeft
:
10
}}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
'delete'
)}
>
<
img
src
=
{
Images
.
visualisasi
}
/
>
<
/button
>
)}
<
/div
>
);
}
...
...
@@ -643,16 +693,16 @@ export default class ApprovalMatrix extends Component {
{
this
.
state
.
visibleAM
===
true
?
this
.
state
.
load
&&
(
<
div
style
=
{{
height
:
this
.
props
.
height
}}
>
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
195
,
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
>
<
div
class
=
"main-color"
style
=
{{
height
:
195
,
width
:
'100%'
}}
/
>
<
div
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
paddingRight
:
25
,
paddingLeft
:
25
,
marginTop
:
-
1
18
}}
>
<
label
style
=
{{
width
:
'
20%'
,
color
:
'white'
,
fontSize
:
16
,
alignSelf
:
'center'
,
paddingTop
:
8
}}
>
Master
Data
-
Approval
Matrix
<
/label
>
<
div
style
=
{{
color
:
'white'
,
width
:
'50%'
,
height
:
37
,
display
:
'flex'
,
backgroundColor
:
'white'
,
borderWidth
:
2
,
alignItems
:
'center'
,
borderRadius
:
6
,
paddingLeft
:
5
,
paddingRight
:
5
,
alignSelf
:
'center'
}}
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
paddingRight
:
25
,
paddingLeft
:
25
,
marginTop
:
-
1
82
}}
>
<
label
style
=
{{
width
:
'
50%'
,
color
:
'white'
,
fontSize
:
16
,
alignSelf
:
'center'
}}
>
Master
Data
-
Approval
Matrix
<
/label
>
{
/*
<div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}>
<img src={Images.searchBlack} style={{ marginRight: 10 }} />
<InputBase
style={{ width: '100%' }}
...
...
@@ -661,15 +711,14 @@ export default class ApprovalMatrix extends Component {
onChange={(e) => this.handleInputChange(e.target.value)}
inputProps={{ 'aria-label': 'naked' }}
/>
<
/div
>
<
div
style
=
{{
width
:
'
3
0%'
,
justifyContent
:
'flex-end'
,
display
:
'flex'
,
flexFlow
:
'wrap'
}}
>
</div>
*/
}
<
div
style
=
{{
width
:
'
5
0%'
,
justifyContent
:
'flex-end'
,
display
:
'flex'
,
flexFlow
:
'wrap'
}}
>
<
a
data
-
tip
=
{
'Download Template'
}
data
-
for
=
"template"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
padding
:
0
,
margin
:
5
}}
onClick
=
{()
=>
this
.
downloadFile
()}
...
...
@@ -685,7 +734,6 @@ export default class ApprovalMatrix extends Component {
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
padding
:
0
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
visibleUpload
:
true
})}
...
...
@@ -701,7 +749,6 @@ export default class ApprovalMatrix extends Component {
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
padding
:
0
,
margin
:
5
}}
onClick
=
{()
=>
this
.
downloadDataTable
()}
...
...
@@ -716,7 +763,6 @@ export default class ApprovalMatrix extends Component {
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
padding
:
0
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
visibleVisual
:
true
,
visibleAM
:
false
})}
...
...
@@ -732,7 +778,6 @@ export default class ApprovalMatrix extends Component {
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
padding
:
0
,
margin
:
5
,
marginRight
:
20
}}
...
...
@@ -769,10 +814,10 @@ export default class ApprovalMatrix extends Component {
/
>
:
<
div
style
=
{{
height
:
this
.
props
.
height
}}
>
<
div
class
=
"main-color"
style
=
{{
height
:
19
9
,
width
:
'100%'
}}
/
>
<
div
class
=
"main-color"
style
=
{{
height
:
19
5
,
width
:
'100%'
}}
/
>
<
div
>
<
div
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
paddingRight
:
25
,
paddingLeft
:
25
,
marginTop
:
-
1
50
}}
>
<
div
style
=
{{
display
:
'flex'
,
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
paddingRight
:
25
,
paddingLeft
:
25
,
marginTop
:
-
1
65
}}
>
<
label
style
=
{{
color
:
'white'
,
fontSize
:
16
,
alignSelf
:
'center'
}}
>
Preview
Data
<
/label
>
<
/div
>
<
div
style
=
{{
padding
:
25
}}
>
...
...
@@ -782,7 +827,7 @@ export default class ApprovalMatrix extends Component {
theme
=
{
getMuiTheme
()}
data
=
{
this
.
state
.
rows
}
columns
=
{
this
.
state
.
cols
}
options
=
{
options
2
}
options
=
{
options
}
/
>
<
/MuiThemeProvider
>
)}
...
...
@@ -830,6 +875,15 @@ export default class ApprovalMatrix extends Component {
updateAM
=
{
this
.
updateAM
.
bind
(
this
)}
/
>
)}
{
this
.
state
.
popupDel
&&
(
<
PopUpDelete
type
=
{
"delete"
}
onClickClose
=
{()
=>
this
.
setState
({
popupDel
:
false
})}
data
=
{
this
.
state
.
rowData
}
// getList={() => this.getData.bind(this)}
deleteAM
=
{
this
.
deleteAM
.
bind
(
this
)}
/
>
)}
{
this
.
state
.
popupError
&&
(
<
PopUpFailedSave
onClickClose
=
{()
=>
this
.
setState
({
popupError
:
false
})}
/
>
)}
...
...
src/container/ApprovalMatrix/CreateApprovalMatrix.js
View file @
0029c985
...
...
@@ -218,7 +218,7 @@ export default class CreateApprovalMatrix extends Component {
this
.
setState
({
errorApproved
:
true
,
msgErrApproved
:
'Approver Name Cannot be Empty.'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
operatorId
))
{
this
.
setState
({
errorOperator
:
true
,
msgErrOperator
:
'Operator Cannot be Empty.'
})
this
.
setState
({
errorOperator
:
true
,
msgErrOperator
:
'Operator Cannot be Empty.
Please Choose - Option
'
})
}
else
if
(
R
.
isNil
(
this
.
state
.
startDate
))
{
this
.
setState
({
errorStartDate
:
true
,
msgErrorStartDate
:
'Valid From Cannot be Empty.'
})
...
...
src/container/ApprovalMatrix/PopUpDelete.js
0 → 100644
View file @
0029c985
import
React
,
{
Component
}
from
'react'
;
import
Images
from
'../../assets/Images'
;
import
{
Typography
}
from
'@material-ui/core'
;
import
api
from
"../../api"
;
import
Constant
from
'../../library/Constant'
;
export
default
class
PopUpDelete
extends
Component
{
constructor
(
props
)
{
super
(
props
)
this
.
state
=
{
id
:
''
,
getApprovedBy
:
null
,
getTypes
:
null
,
}
}
componentDidMount
()
{
if
(
this
.
props
.
type
===
'delete'
)
{
this
.
getDetailAM
()
}
}
getDetailAM
()
{
api
.
create
().
getDetailAM
(
this
.
props
.
data
[
1
]).
then
(
response
=>
{
console
.
log
(
response
.
data
)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
let
data
=
response
.
data
.
data
this
.
setState
({
id
:
data
.
approval_matrix_id
,
getTypes
:
data
.
approval_type_name
,
getApprovedBy
:
data
.
fullname
})
}
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
.
problem
,
tipeAlert
:
'error'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
})
}
// hapus(){
// this.setState({ popupDel: false })
// api.create().deleteAM(this.state.id).then(response => {
// console.log(response.data)
// if (response.data) {
// if (response.ok) {
// if (response.data.status == 'success') {
// // this.getData()
// this.props.getList()
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
// } 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' })
// }
// })
// }
hapus
()
{
if
(
this
.
props
.
type
==
'delete'
)
{
let
payload
=
this
.
state
.
id
this
.
props
.
deleteAM
(
payload
)
}
}
render
()
{
return
(
<
div
className
=
"test app-popup-show"
>
<
div
className
=
"popup-content background-white border-radius"
style
=
{{
borderRadius
:
8
,
padding
:
50
}}
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'center'
}}
>
<
img
src
=
{
Images
.
failedCopy
}
/
>
<
/div
>
<
div
style
=
{{
display
:
'grid'
,
justifyContent
:
'center'
,
marginTop
:
20
}}
>
<
span
style
=
{{
textAlign
:
'center'
,
fontSize
:
14
,
fontWeight
:
'bold'
}}
>
Delete
{
this
.
state
.
getTypes
}
-
{
this
.
state
.
getApprovedBy
}
?
<
/span
>
{
/* <span style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold' }}>
{`Please try again later.`}
</span> */
}
<
/div
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'center'
,
marginTop
:
24
}}
>
<
button
className
=
{
"btn-save"
}
onClick
=
{()
=>
this
.
props
.
onClickClose
()}
>
<
span
style
=
{{
color
:
'white'
}}
>
Cancel
<
/span
>
<
/button
>
<
button
className
=
{
"btn-save"
}
style
=
{{
marginLeft
:
50
}}
onClick
=
{()
=>
this
.
hapus
()}
>
<
span
style
=
{{
color
:
'white'
}}
>
Delete
<
/span
>
<
/button
>
<
/div
>
<
/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