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
58c7ee4a
Commit
58c7ee4a
authored
Sep 11, 2020
by
Rifka Kurnia Irfiana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push download baru testing di qreview soal nya dari postman network error -curcol
parent
f2548ac7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
8 deletions
+61
-8
index.js
src/api/index.js
+2
-0
DocumentManagement.js
src/container/DocumentManagement/DocumentManagement.js
+30
-2
QReview.js
src/container/DocumentManagement/QReview.js
+29
-6
No files found.
src/api/index.js
View file @
58c7ee4a
...
...
@@ -180,6 +180,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const
getAllDocument
=
(
body
)
=>
api
.
post
(
'document/get_all_document'
,
body
)
const
uploadDocument
=
(
body
)
=>
api
.
post
(
'document/upload_document'
,
body
)
const
updateDocument
=
(
body
)
=>
api
.
post
(
'document/update_document'
,
body
)
const
downloadDocument
=
(
body
)
=>
api
.
post
(
'document/download_document'
,
body
)
// ------
// STEP 3
...
...
@@ -288,6 +289,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
getAllDocument
,
uploadDocument
,
updateDocument
,
downloadDocument
,
createSubmitReport
,
getSubmission
}
...
...
src/container/DocumentManagement/DocumentManagement.js
View file @
58c7ee4a
...
...
@@ -143,6 +143,35 @@ export default class DocumentManagement extends Component {
this
.
setState
({
alert
:
false
})
}
getDownloadDocument
(
payload
){
// console.log(payload)
api
.
create
().
downloadDocument
(
payload
).
then
(
response
=>
{
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
// this.getDataDocument(settingID)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'success'
,
visibleCreate
:
false
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
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
()
{
return
(
<
div
style
=
{{
height
:
this
.
props
.
height
,
backgroundColor
:
'#f8f8f8'
}}
>
...
...
@@ -202,6 +231,7 @@ export default class DocumentManagement extends Component {
<
QReview
data
=
{
this
.
state
.
listData
[
this
.
state
.
tab
]}
refresh
=
{
this
.
state
.
refresh
}
getDownloadDocument
=
{
this
.
getDownloadDocument
.
bind
(
this
)}
/
>
:
this
.
state
.
id
===
68543
?
...
...
@@ -226,8 +256,6 @@ export default class DocumentManagement extends Component {
{
this
.
state
.
konfirmasi
&&
(
<
PopUpKonfirmasi
onClickClosePopUp
=
{()
=>
this
.
setState
({
konfirmasi
:
false
})}
// getList={() => this.getData.bind(this)}
// deleteAM={this.deleteAM.bind(this)}
uploadDocId
=
{
this
.
createUploadDocument
.
bind
(
this
)}
/
>
)}
...
...
src/container/DocumentManagement/QReview.js
View file @
58c7ee4a
...
...
@@ -33,12 +33,12 @@ export default class QReview extends Component {
}
componentWillReceiveProps
(
props
)
{
// console.log(props);
const
{
refresh
,
id
}
=
this
.
props
;
if
(
props
.
refresh
!==
refresh
)
{
this
.
getData
()
}
// console.log(props);
const
{
refresh
,
id
}
=
this
.
props
;
if
(
props
.
refresh
!==
refresh
)
{
this
.
getData
()
}
}
getData
()
{
let
payload
=
{
...
...
@@ -86,6 +86,29 @@ export default class QReview extends Component {
})
}
openPopUp
(
index
,
type
){
if
(
type
===
'download'
)
{
const
formData
=
new
FormData
();
formData
.
append
(
"documentName"
,
index
[
1
]);
formData
.
append
(
"fileType"
,
index
[
5
]);
this
.
setState
({
formData
},
()
=>
{
this
.
props
.
getDownloadDocument
(
this
.
state
.
formData
)
})
}
}
downloadDoc
()
{
let
datax
=
this
.
state
.
index
console
.
log
(
datax
)
// let payload = {
// "documentName": this.state.typeId.approval_type_id,
// "fileType": this.state.order
// }
// this.props.getDownloadDocument(payload)
}
render
()
{
let
columns
=
[{
name
:
"Action"
,
...
...
@@ -106,7 +129,7 @@ export default class QReview extends Component {
marginRight
:
15
}}
// onClick={() => console.log(tableMeta)}
// onClick={() => this.openPopUp(tableMeta.rowData, 'edit
')}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
'download
'
)}
>
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
...
...
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