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
bfdc8ddb
Commit
bfdc8ddb
authored
Sep 12, 2020
by
Rifka Kurnia Irfiana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix download
parent
259b9b4a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
127 additions
and
60 deletions
+127
-60
AuditTahunan.js
src/container/DocumentManagement/AuditTahunan.js
+25
-1
BOD.js
src/container/DocumentManagement/BOD.js
+26
-2
DocumentManagement.js
src/container/DocumentManagement/DocumentManagement.js
+1
-31
ManualBookETMS.js
src/container/DocumentManagement/ManualBookETMS.js
+26
-2
ManualBookTia.js
src/container/DocumentManagement/ManualBookTia.js
+26
-2
QReview.js
src/container/DocumentManagement/QReview.js
+23
-22
No files found.
src/container/DocumentManagement/AuditTahunan.js
View file @
bfdc8ddb
...
@@ -55,9 +55,33 @@ export default class AuditTahunan extends Component {
...
@@ -55,9 +55,33 @@ export default class AuditTahunan extends Component {
]
]
})
})
this
.
setState
({
dataTable
})
this
.
setState
({
dataTable
})
let
docPath
=
response
.
data
.
data
.
map
((
item
)
=>
{
return
[
item
.
document_filepath
]
})
this
.
setState
({
docPath
})
})
})
}
}
openPopUp
=
async
(
index
,
val
,
type
)
=>
{
if
(
type
===
'download'
)
{
console
.
log
(
this
.
state
.
docPath
[
val
])
let
res
=
await
fetch
(
"https://tia.eksad.com/tia-reporting-dev/public/document/download_document?documentName="
+
this
.
state
.
docPath
[
val
]
+
"&&fileType="
+
index
[
5
]
)
res
=
await
res
.
blob
()
// console.log(res)
if
(
res
.
size
>
0
)
{
let
url
=
window
.
URL
.
createObjectURL
(
res
);
let
a
=
document
.
createElement
(
'a'
);
a
.
href
=
url
;
a
.
download
=
index
[
1
];
a
.
click
();
}
}
}
render
()
{
render
()
{
let
columns
=
[{
let
columns
=
[{
name
:
"Action"
,
name
:
"Action"
,
...
@@ -78,7 +102,7 @@ export default class AuditTahunan extends Component {
...
@@ -78,7 +102,7 @@ export default class AuditTahunan extends Component {
marginRight
:
15
marginRight
:
15
}}
}}
// onClick={() => console.log(tableMeta)}
// onClick={() => console.log(tableMeta)}
// onClick={() => this.openPopUp(tableMeta.rowData, 'edit
')}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
val
,
'download
'
)}
>
>
<
img
src
=
{
Images
.
download
}
/
>
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
<
/button
>
...
...
src/container/DocumentManagement/BOD.js
View file @
bfdc8ddb
...
@@ -55,18 +55,42 @@ export default class BOD extends Component {
...
@@ -55,18 +55,42 @@ export default class BOD extends Component {
item
.
company_name
,
item
.
company_name
,
item
.
document_periode
,
item
.
document_periode
,
item
.
document_type
,
item
.
document_type
,
String
(
Number
(
item
.
document_size
)
/
1000
+
'
M
B'
),
String
(
Number
(
item
.
document_size
)
/
1000
+
'
K
B'
),
item
.
created_by
,
item
.
created_by
,
item
.
created_at
,
item
.
created_at
,
]
]
})
})
this
.
setState
({
dataTable
})
this
.
setState
({
dataTable
})
let
docPath
=
response
.
data
.
data
.
map
((
item
)
=>
{
return
[
item
.
document_filepath
]
})
this
.
setState
({
docPath
})
}
}
}
}
}
}
})
})
}
}
openPopUp
=
async
(
index
,
val
,
type
)
=>
{
if
(
type
===
'download'
)
{
console
.
log
(
this
.
state
.
docPath
[
val
])
let
res
=
await
fetch
(
"https://tia.eksad.com/tia-reporting-dev/public/document/download_document?documentName="
+
this
.
state
.
docPath
[
val
]
+
"&&fileType="
+
index
[
5
]
)
res
=
await
res
.
blob
()
// console.log(res)
if
(
res
.
size
>
0
)
{
let
url
=
window
.
URL
.
createObjectURL
(
res
);
let
a
=
document
.
createElement
(
'a'
);
a
.
href
=
url
;
a
.
download
=
index
[
1
];
a
.
click
();
}
}
}
render
()
{
render
()
{
let
columns
=
[
let
columns
=
[
{
{
...
@@ -88,7 +112,7 @@ export default class BOD extends Component {
...
@@ -88,7 +112,7 @@ export default class BOD extends Component {
marginRight
:
15
marginRight
:
15
}}
}}
// onClick={() => console.log(tableMeta)}
// onClick={() => console.log(tableMeta)}
// onClick={() => this.openPopUp(tableMeta.rowData, 'edit
')}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
val
,
'download
'
)}
>
>
<
img
src
=
{
Images
.
download
}
/
>
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
<
/button
>
...
...
src/container/DocumentManagement/DocumentManagement.js
View file @
bfdc8ddb
...
@@ -143,35 +143,6 @@ export default class DocumentManagement extends Component {
...
@@ -143,35 +143,6 @@ export default class DocumentManagement extends Component {
this
.
setState
({
alert
:
false
})
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
()
{
render
()
{
return
(
return
(
<
div
style
=
{{
height
:
this
.
props
.
height
,
backgroundColor
:
'#f8f8f8'
}}
>
<
div
style
=
{{
height
:
this
.
props
.
height
,
backgroundColor
:
'#f8f8f8'
}}
>
...
@@ -231,7 +202,6 @@ export default class DocumentManagement extends Component {
...
@@ -231,7 +202,6 @@ export default class DocumentManagement extends Component {
<
QReview
<
QReview
data
=
{
this
.
state
.
listData
[
this
.
state
.
tab
]}
data
=
{
this
.
state
.
listData
[
this
.
state
.
tab
]}
refresh
=
{
this
.
state
.
refresh
}
refresh
=
{
this
.
state
.
refresh
}
getDownloadDocument
=
{
this
.
getDownloadDocument
.
bind
(
this
)}
/
>
/
>
:
:
this
.
state
.
id
===
68543
?
this
.
state
.
id
===
68543
?
...
@@ -246,7 +216,7 @@ export default class DocumentManagement extends Component {
...
@@ -246,7 +216,7 @@ export default class DocumentManagement extends Component {
refresh
=
{
this
.
state
.
refresh
}
refresh
=
{
this
.
state
.
refresh
}
/
>
/
>
:
:
<
span
>
Test2
<
/span
>
<
span
>
Coming
Soon
<
/span
>
)}
)}
<
/div
>
<
/div
>
...
...
src/container/DocumentManagement/ManualBookETMS.js
View file @
bfdc8ddb
...
@@ -47,15 +47,39 @@ export default class ManualBookETMS extends Component {
...
@@ -47,15 +47,39 @@ export default class ManualBookETMS extends Component {
item
.
description
,
item
.
description
,
item
.
company_name
,
item
.
company_name
,
item
.
document_type
,
item
.
document_type
,
String
(
Number
(
item
.
document_size
)
/
1000
+
'
M
B'
),
String
(
Number
(
item
.
document_size
)
/
1000
+
'
K
B'
),
item
.
created_by
,
item
.
created_by
,
item
.
created_at
,
item
.
created_at
,
]
]
})
})
this
.
setState
({
dataTable
})
this
.
setState
({
dataTable
})
let
docPath
=
response
.
data
.
data
.
map
((
item
)
=>
{
return
[
item
.
document_filepath
]
})
this
.
setState
({
docPath
})
})
})
}
}
openPopUp
=
async
(
index
,
val
,
type
)
=>
{
if
(
type
===
'download'
)
{
console
.
log
(
this
.
state
.
docPath
[
val
])
let
res
=
await
fetch
(
"https://tia.eksad.com/tia-reporting-dev/public/document/download_document?documentName="
+
this
.
state
.
docPath
[
val
]
+
"&&fileType="
+
index
[
5
]
)
res
=
await
res
.
blob
()
// console.log(res)
if
(
res
.
size
>
0
)
{
let
url
=
window
.
URL
.
createObjectURL
(
res
);
let
a
=
document
.
createElement
(
'a'
);
a
.
href
=
url
;
a
.
download
=
index
[
1
];
a
.
click
();
}
}
}
render
()
{
render
()
{
let
columns
=
[{
let
columns
=
[{
name
:
"Action"
,
name
:
"Action"
,
...
@@ -76,7 +100,7 @@ export default class ManualBookETMS extends Component {
...
@@ -76,7 +100,7 @@ export default class ManualBookETMS extends Component {
marginRight
:
15
marginRight
:
15
}}
}}
// onClick={() => console.log(tableMeta)}
// onClick={() => console.log(tableMeta)}
// onClick={() => this.openPopUp(tableMeta.rowData, 'edit
')}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
val
,
'download
'
)}
>
>
<
img
src
=
{
Images
.
download
}
/
>
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
<
/button
>
...
...
src/container/DocumentManagement/ManualBookTia.js
View file @
bfdc8ddb
...
@@ -47,15 +47,39 @@ export default class ManualBookTia extends Component {
...
@@ -47,15 +47,39 @@ export default class ManualBookTia extends Component {
item
.
company_name
,
item
.
company_name
,
item
.
document_periode
,
item
.
document_periode
,
item
.
document_type
,
item
.
document_type
,
String
(
Number
(
item
.
document_size
)
/
1000
+
'
M
B'
),
String
(
Number
(
item
.
document_size
)
/
1000
+
'
K
B'
),
item
.
created_by
,
item
.
created_by
,
item
.
created_at
,
item
.
created_at
,
]
]
})
})
this
.
setState
({
dataTable
})
this
.
setState
({
dataTable
})
let
docPath
=
response
.
data
.
data
.
map
((
item
)
=>
{
return
[
item
.
document_filepath
]
})
this
.
setState
({
docPath
})
})
})
}
}
openPopUp
=
async
(
index
,
val
,
type
)
=>
{
if
(
type
===
'download'
)
{
console
.
log
(
this
.
state
.
docPath
[
val
])
let
res
=
await
fetch
(
"https://tia.eksad.com/tia-reporting-dev/public/document/download_document?documentName="
+
this
.
state
.
docPath
[
val
]
+
"&&fileType="
+
index
[
5
]
)
res
=
await
res
.
blob
()
// console.log(res)
if
(
res
.
size
>
0
)
{
let
url
=
window
.
URL
.
createObjectURL
(
res
);
let
a
=
document
.
createElement
(
'a'
);
a
.
href
=
url
;
a
.
download
=
index
[
1
];
a
.
click
();
}
}
}
render
()
{
render
()
{
let
columns
=
[{
let
columns
=
[{
name
:
"Action"
,
name
:
"Action"
,
...
@@ -76,7 +100,7 @@ export default class ManualBookTia extends Component {
...
@@ -76,7 +100,7 @@ export default class ManualBookTia extends Component {
marginRight
:
15
marginRight
:
15
}}
}}
// onClick={() => console.log(tableMeta)}
// onClick={() => console.log(tableMeta)}
// onClick={() => this.openPopUp(tableMeta.rowData, 'edit
')}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
val
,
'download
'
)}
>
>
<
img
src
=
{
Images
.
download
}
/
>
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
<
/button
>
...
...
src/container/DocumentManagement/QReview.js
View file @
bfdc8ddb
...
@@ -61,12 +61,18 @@ export default class QReview extends Component {
...
@@ -61,12 +61,18 @@ export default class QReview extends Component {
item
.
company_name
,
item
.
company_name
,
item
.
document_periode
,
item
.
document_periode
,
item
.
document_type
,
item
.
document_type
,
String
(
Number
(
item
.
document_size
)
/
1000
+
'
M
B'
),
String
(
Number
(
item
.
document_size
)
/
1000
+
'
K
B'
),
item
.
created_by
,
item
.
created_by
,
item
.
created_at
,
item
.
created_at
]
]
})
})
this
.
setState
({
dataTable
})
this
.
setState
({
dataTable
})
let
docPath
=
response
.
data
.
data
.
map
((
item
)
=>
{
return
[
item
.
document_filepath
]
})
this
.
setState
({
docPath
})
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
...
@@ -86,29 +92,24 @@ export default class QReview extends Component {
...
@@ -86,29 +92,24 @@ export default class QReview extends Component {
})
})
}
}
openPopUp
(
index
,
type
)
{
openPopUp
=
async
(
index
,
val
,
type
)
=>
{
if
(
type
===
'download'
)
{
if
(
type
===
'download'
)
{
const
formData
=
new
FormData
();
console
.
log
(
this
.
state
.
docPath
[
val
])
formData
.
append
(
"documentName"
,
index
[
1
]);
let
res
=
await
fetch
(
formData
.
append
(
"fileType"
,
index
[
5
]);
"https://tia.eksad.com/tia-reporting-dev/public/document/download_document?documentName="
+
this
.
state
.
docPath
[
val
]
+
"&&fileType="
+
index
[
5
]
this
.
setState
({
formData
},
()
=>
{
)
this
.
props
.
getDownloadDocument
(
this
.
state
.
formData
)
res
=
await
res
.
blob
()
})
// console.log(res)
if
(
res
.
size
>
0
)
{
let
url
=
window
.
URL
.
createObjectURL
(
res
);
let
a
=
document
.
createElement
(
'a'
);
a
.
href
=
url
;
a
.
download
=
index
[
1
];
a
.
click
();
}
}
}
}
}
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
()
{
render
()
{
let
columns
=
[{
let
columns
=
[{
name
:
"Action"
,
name
:
"Action"
,
...
@@ -129,7 +130,7 @@ export default class QReview extends Component {
...
@@ -129,7 +130,7 @@ export default class QReview extends Component {
marginRight
:
15
marginRight
:
15
}}
}}
// onClick={() => console.log(tableMeta)}
// onClick={() => console.log(tableMeta)}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
'download'
)}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
val
,
'download'
)}
>
>
<
img
src
=
{
Images
.
download
}
/
>
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
<
/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