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
1a494a1c
Commit
1a494a1c
authored
Sep 07, 2020
by
a.bairuha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update Delete Report Item
parent
1955d960
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
16 deletions
+81
-16
index.js
src/api/index.js
+3
-1
ReportItems.js
src/container/MasterData/ReportItems.js
+78
-15
No files found.
src/api/index.js
View file @
1a494a1c
...
...
@@ -143,6 +143,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const
getItemReportHierarki
=
(
body
)
=>
api
.
post
(
'item_report/get_item_report_hierarki'
,
body
)
const
saveVisualisasiReport
=
(
body
)
=>
api
.
post
(
'item_report/save_visualization'
,
body
)
const
getReportParent
=
(
body
)
=>
api
.
post
(
'item_report/get_parent_item_report'
,
body
)
const
deleteReportItems
=
(
id
)
=>
api
.
post
(
`item_report/delete_item_report/
${
id
}
`
)
//PARAMETER
const
getAllParameter
=
()
=>
api
.
get
(
'/setting/get_all_setting'
)
...
...
@@ -271,7 +272,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
deleteAttachment
,
getDetailReportMB
,
deleteUnitBisnis
,
deleteParameter
deleteParameter
,
deleteReportItems
}
}
...
...
src/container/MasterData/ReportItems.js
View file @
1a494a1c
...
...
@@ -13,6 +13,7 @@ import api from "../../api";
import
ReactTooltip
from
"react-tooltip"
;
import
PopUpFailedSave
from
"../../library/PopUpFailedSave"
;
import
Constant
from
"../../library/Constant"
;
import
PopUpDelete
from
"../../library/PopUpDelete"
;
var
ct
=
require
(
"../../library/CustomTable"
);
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable
());
...
...
@@ -44,7 +45,9 @@ export default class ReportItems extends Component {
buttonCreate
:
false
,
buttonEdit
:
false
,
load
:
false
,
judul
:
''
judul
:
''
,
reportNameDelete
:
''
,
visibleDelete
:
false
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
...
...
@@ -616,12 +619,46 @@ export default class ReportItems extends Component {
})
}
deleteReport
(
payload
)
{
console
.
log
(
payload
);
let
id
=
String
(
payload
[
1
])
api
.
create
().
deleteReportItems
(
id
).
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
getData
()
this
.
setState
({
visibleDelete
:
false
,
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'
})
}
})
}
openPopUp
(
index
,
type
)
{
if
(
type
===
'edit'
)
{
this
.
setState
({
rowData
:
index
,
edit
:
true
})
}
else
if
(
type
===
'delete'
)
{
this
.
setState
({
rowData
:
index
,
reportNameDelete
:
"["
+
String
(
index
[
2
])
+
" - "
+
String
(
index
[
3
])
+
" - "
+
String
(
index
[
5
])
+
"]"
,
visibleDelete
:
true
})
}
else
{
this
.
setState
({
add
:
true
...
...
@@ -785,21 +822,39 @@ export default class ReportItems extends Component {
sort
:
false
,
customBodyRender
:
(
val
,
tableMeta
)
=>
{
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
this
.
state
.
buttonEdit
&&
(
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
}}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
'edit'
)}
this
.
state
.
buttonEdit
&&
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
a
data
-
tip
=
{
'Edit'
}
data
-
for
=
"edit"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
}}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
'edit'
)}
>
<
img
src
=
{
Images
.
editCopy
}
/
>
<
/button
>
)}
<
/div
>
>
<
img
src
=
{
Images
.
editCopy
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"edit"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Delete'
}
data
-
for
=
"delete"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
marginLeft
:
15
}}
// onClick={() => console.log(tableMeta)}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
'delete'
)}
>
<
img
src
=
{
Images
.
delete
}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"delete"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
)
);
}
}
...
...
@@ -1150,6 +1205,14 @@ export default class ReportItems extends Component {
<
/div
>
<
/div
>
)}
{
this
.
state
.
visibleDelete
&&
(
<
PopUpDelete
rowData
=
{
this
.
state
.
rowData
}
name
=
{
this
.
state
.
reportNameDelete
}
onClickClose
=
{()
=>
this
.
setState
({
visibleDelete
:
false
})}
onClickDelete
=
{
this
.
deleteReport
.
bind
(
this
)}
/
>
)}
<
/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