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
f2d49c8a
Commit
f2d49c8a
authored
Sep 14, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'rifka' into 'master'
fix download See merge request
!290
parents
259b9b4a
bfdc8ddb
Changes
6
Show 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 @
f2d49c8a
...
...
@@ -55,7 +55,31 @@ export default class AuditTahunan extends Component {
]
})
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
()
{
...
...
@@ -78,7 +102,7 @@ export default class AuditTahunan extends Component {
marginRight
:
15
}}
// onClick={() => console.log(tableMeta)}
// onClick={() => this.openPopUp(tableMeta.rowData, 'edit
')}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
val
,
'download
'
)}
>
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
...
...
src/container/DocumentManagement/BOD.js
View file @
f2d49c8a
...
...
@@ -55,18 +55,42 @@ export default class BOD extends Component {
item
.
company_name
,
item
.
document_periode
,
item
.
document_type
,
String
(
Number
(
item
.
document_size
)
/
1000
+
'
M
B'
),
String
(
Number
(
item
.
document_size
)
/
1000
+
'
K
B'
),
item
.
created_by
,
item
.
created_at
,
]
})
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
()
{
let
columns
=
[
{
...
...
@@ -88,7 +112,7 @@ export default class BOD extends Component {
marginRight
:
15
}}
// onClick={() => console.log(tableMeta)}
// onClick={() => this.openPopUp(tableMeta.rowData, 'edit
')}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
val
,
'download
'
)}
>
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
...
...
src/container/DocumentManagement/DocumentManagement.js
View file @
f2d49c8a
...
...
@@ -143,35 +143,6 @@ 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'
}}
>
...
...
@@ -231,7 +202,6 @@ 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
?
...
...
@@ -246,7 +216,7 @@ export default class DocumentManagement extends Component {
refresh
=
{
this
.
state
.
refresh
}
/
>
:
<
span
>
Test2
<
/span
>
<
span
>
Coming
Soon
<
/span
>
)}
<
/div
>
...
...
src/container/DocumentManagement/ManualBookETMS.js
View file @
f2d49c8a
...
...
@@ -47,13 +47,37 @@ export default class ManualBookETMS extends Component {
item
.
description
,
item
.
company_name
,
item
.
document_type
,
String
(
Number
(
item
.
document_size
)
/
1000
+
'
M
B'
),
String
(
Number
(
item
.
document_size
)
/
1000
+
'
K
B'
),
item
.
created_by
,
item
.
created_at
,
]
})
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
()
{
...
...
@@ -76,7 +100,7 @@ export default class ManualBookETMS extends Component {
marginRight
:
15
}}
// onClick={() => console.log(tableMeta)}
// onClick={() => this.openPopUp(tableMeta.rowData, 'edit
')}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
val
,
'download
'
)}
>
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
...
...
src/container/DocumentManagement/ManualBookTia.js
View file @
f2d49c8a
...
...
@@ -47,13 +47,37 @@ export default class ManualBookTia extends Component {
item
.
company_name
,
item
.
document_periode
,
item
.
document_type
,
String
(
Number
(
item
.
document_size
)
/
1000
+
'
M
B'
),
String
(
Number
(
item
.
document_size
)
/
1000
+
'
K
B'
),
item
.
created_by
,
item
.
created_at
,
]
})
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
()
{
...
...
@@ -76,7 +100,7 @@ export default class ManualBookTia extends Component {
marginRight
:
15
}}
// onClick={() => console.log(tableMeta)}
// onClick={() => this.openPopUp(tableMeta.rowData, 'edit
')}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
val
,
'download
'
)}
>
<
img
src
=
{
Images
.
download
}
/
>
<
/button
>
...
...
src/container/DocumentManagement/QReview.js
View file @
f2d49c8a
...
...
@@ -61,12 +61,18 @@ export default class QReview extends Component {
item
.
company_name
,
item
.
document_periode
,
item
.
document_type
,
String
(
Number
(
item
.
document_size
)
/
1000
+
'
M
B'
),
String
(
Number
(
item
.
document_size
)
/
1000
+
'
K
B'
),
item
.
created_by
,
item
.
created_at
,
item
.
created_at
]
})
this
.
setState
({
dataTable
})
let
docPath
=
response
.
data
.
data
.
map
((
item
)
=>
{
return
[
item
.
document_filepath
]
})
this
.
setState
({
docPath
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
...
...
@@ -86,29 +92,24 @@ export default class QReview extends Component {
})
}
openPopUp
(
index
,
type
)
{
openPopUp
=
async
(
index
,
val
,
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
)
})
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
();
}
}
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"
,
...
...
@@ -129,7 +130,7 @@ export default class QReview extends Component {
marginRight
:
15
}}
// onClick={() => console.log(tableMeta)}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
'download'
)}
onClick
=
{()
=>
this
.
openPopUp
(
tableMeta
.
rowData
,
val
,
'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