Commit 448cf80a authored by rifkaki's avatar rifkaki

managdoc, tp ro, ro

parent 27f39644
...@@ -249,6 +249,9 @@ const create = (type = "") => { ...@@ -249,6 +249,9 @@ const create = (type = "") => {
const getRollingOutlookLastUpdate = (body) => api.post('transaction/rolling_outlook/get_latest_update', body) const getRollingOutlookLastUpdate = (body) => api.post('transaction/rolling_outlook/get_latest_update', body)
const getRollingOutlookRevision = (body) => api.post('transaction/rolling_outlook/get_revision', body) const getRollingOutlookRevision = (body) => api.post('transaction/rolling_outlook/get_revision', body)
const getRollingOutlookIsApprover = (body) => api.get('transaction/rolling_outlook/is_approver') const getRollingOutlookIsApprover = (body) => api.get('transaction/rolling_outlook/is_approver')
const uploadAttachmentRO = (body) => api.post('transaction/rolling_outlook/upload_attachment', body)
const deleteAttachmentRO = (id) => api.post(`transaction/rolling_outlook/delete_attachment/${id}`)
const getRollingOutlookBS = (body) => api.post('transaction/balance_sheet/rolling_outlook/get_report_hierarki', body) const getRollingOutlookBS = (body) => api.post('transaction/balance_sheet/rolling_outlook/get_report_hierarki', body)
const checkImportRollingOutlookBS = (body) => api.post('transaction/balance_sheet/rolling_outlook/check_import', body) const checkImportRollingOutlookBS = (body) => api.post('transaction/balance_sheet/rolling_outlook/check_import', body)
const importRollingOutlookBS = (body) => api.post('transaction/balance_sheet/rolling_outlook/import_rolling_outlook', body) const importRollingOutlookBS = (body) => api.post('transaction/balance_sheet/rolling_outlook/import_rolling_outlook', body)
...@@ -727,6 +730,8 @@ const create = (type = "") => { ...@@ -727,6 +730,8 @@ const create = (type = "") => {
getRollingOutlookLastUpdate, getRollingOutlookLastUpdate,
getRollingOutlookRevision, getRollingOutlookRevision,
getRollingOutlookIsApprover, getRollingOutlookIsApprover,
uploadAttachmentRO,
deleteAttachmentRO,
checkImportRollingOutlookBS, checkImportRollingOutlookBS,
importRollingOutlookBS importRollingOutlookBS
} }
......
...@@ -50,7 +50,7 @@ export default class getAllDocument extends Component { ...@@ -50,7 +50,7 @@ export default class getAllDocument extends Component {
} }
this.setState({ loading: true }) this.setState({ loading: true })
api.create().getAllDocument(payload).then(response => { api.create().getAllDocument(payload).then(response => {
// console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status == 'success') { if (response.data.status == 'success') {
...@@ -69,6 +69,7 @@ export default class getAllDocument extends Component { ...@@ -69,6 +69,7 @@ export default class getAllDocument extends Component {
String(Number(item.document_size) / 1000 + ' KB'), String(Number(item.document_size) / 1000 + ' KB'),
item.created_by, item.created_by,
item.created_at, item.created_at,
item.values
]) ])
} else { } else {
if (indexId !== -1) { if (indexId !== -1) {
...@@ -83,6 +84,7 @@ export default class getAllDocument extends Component { ...@@ -83,6 +84,7 @@ export default class getAllDocument extends Component {
String(Number(item.document_size) / 1000 + ' KB'), String(Number(item.document_size) / 1000 + ' KB'),
item.created_by, item.created_by,
item.created_at, item.created_at,
item.values
]) ])
} }
} }
...@@ -121,17 +123,18 @@ export default class getAllDocument extends Component { ...@@ -121,17 +123,18 @@ export default class getAllDocument extends Component {
} }
openPopUp = async (index, val, type) =>{ openPopUp = async (index, val, type) =>{
console.log(index)
if (type === 'download') { if (type === 'download') {
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/document/download_document?documentName=`+this.state.docPath[val]+"&&fileType="+index[6] `${process.env.REACT_APP_URL_MAIN_BE}/public/document/download_document?documentName=`+this.state.docPath[val]+"&&fileType="+index[6]
) )
res = await res.blob() res = await res.blob()
// console.log(res) console.log(res)
if (res.size > 0) { if (res.size > 0) {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
let a = document.createElement('a'); let a = document.createElement('a');
a.href = url; a.href = url;
a.download = index[1]; a.download = (String(index[3]).includes(":") ? String(index[3]).replace(":", " (") + ` )` : String(index[3])) +" - "+index[4]+" - "+index[5]+" - "+index[10]+"."+index[6];
a.click(); a.click();
} }
} }
...@@ -270,7 +273,14 @@ export default class getAllDocument extends Component { ...@@ -270,7 +273,14 @@ export default class getAllDocument extends Component {
); );
} }
} }
}, "File Name", "Description", },
{
name: "File Name",
options: {
display: false
}
},
"Description",
{ {
name: "Company Name", name: "Company Name",
options: { options: {
...@@ -289,7 +299,13 @@ export default class getAllDocument extends Component { ...@@ -289,7 +299,13 @@ export default class getAllDocument extends Component {
display: String(this.props.data.value).includes('Manual Book TIA') ? false : true display: String(this.props.data.value).includes('Manual Book TIA') ? false : true
} }
}, },
"Type", "File Size", "Created By", "Created Date" "Type", "File Size", "Created By", "Created Date",
{
name: "Category",
options: {
display: false
}
},
] ]
const loadingComponent = ( const loadingComponent = (
......
...@@ -552,14 +552,14 @@ export default class RollingOutlook extends Component { ...@@ -552,14 +552,14 @@ export default class RollingOutlook extends Component {
} }
uploadAttachment(formData) { uploadAttachment(formData) {
// var object = {}; var object = {};
// formData.forEach(function (value, key) { formData.forEach(function (value, key) {
// object[key] = value; object[key] = value;
// }); });
// var json = JSON.stringify(object); var json = JSON.stringify(object);
// console.log(object) console.log(object)
// console.log(json) console.log(json)
api.create().uploadAttachment(formData).then(response => { api.create().uploadAttachmentRO(formData).then(response => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
...@@ -572,7 +572,7 @@ export default class RollingOutlook extends Component { ...@@ -572,7 +572,7 @@ export default class RollingOutlook extends Component {
} }
deleteAttachment(item) { deleteAttachment(item) {
api.create().deleteAttachment(item.attachment_id).then(response => { api.create().deleteAttachmentRO(item.attachment_id).then(response => {
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.getRollingOutlookID() this.getRollingOutlookID()
...@@ -610,6 +610,17 @@ export default class RollingOutlook extends Component { ...@@ -610,6 +610,17 @@ export default class RollingOutlook extends Component {
let length = name.split(".").length let length = name.split(".").length
let fileType = name.split(".")[length - 1] let fileType = name.split(".")[length - 1]
console.log(fileType); console.log(fileType);
// console.log(fileurl);
let indexStrip = String(fileurl).indexOf("-")
let fileName = String(fileurl).substr(indexStrip + 1, String(fileurl).length)
let cobaSplit = String(fileName).split("-")
let mapSplit = ""
cobaSplit.map((item, index) => {
if (item != ""){
mapSplit+= index == 0 ? `${titleCase(item)}` : ` ${item}`
}
})
// console.log(mapSplit);
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/download_attachment?fileName=${fileurl}&&fileType=${fileType}` let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/download_attachment?fileName=${fileurl}&&fileType=${fileType}`
// console.log(url); // console.log(url);
let res = await fetch( let res = await fetch(
...@@ -621,7 +632,7 @@ export default class RollingOutlook extends Component { ...@@ -621,7 +632,7 @@ export default class RollingOutlook extends Component {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
let a = document.createElement('a'); let a = document.createElement('a');
a.href = url; a.href = url;
a.download = 'Rolling Outlook Attachment.xlsx'; a.download = "(Rolling Outlook Attachment) - " +mapSplit;
a.click(); a.click();
} }
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment