Commit 7b2d71fd authored by Deni Rinaldi's avatar Deni Rinaldi

deps

parent ca744adf
...@@ -58,12 +58,14 @@ export default class BudgetTahunan extends Component { ...@@ -58,12 +58,14 @@ export default class BudgetTahunan extends Component {
approverID: null, approverID: null,
pic: '', pic: '',
submitter: false, submitter: false,
detailRevisiCheck: [] detailRevisiCheck: [],
lastRevision: ""
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
componentDidMount() { componentDidMount() {
this.setState({ loading: true })
this.props.selectIndex('Master Budget & CAT') this.props.selectIndex('Master Budget & CAT')
if (this.props.location.state !== undefined) { if (this.props.location.state !== undefined) {
console.log(this.props); console.log(this.props);
...@@ -95,6 +97,7 @@ export default class BudgetTahunan extends Component { ...@@ -95,6 +97,7 @@ export default class BudgetTahunan extends Component {
"revision": this.state.revision.revision, "revision": this.state.revision.revision,
} }
api.create().getMasterBudgetAtt(payload).then(response => { api.create().getMasterBudgetAtt(payload).then(response => {
console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ listAttachment: response.data.data }) this.setState({ listAttachment: response.data.data })
...@@ -269,7 +272,8 @@ export default class BudgetTahunan extends Component { ...@@ -269,7 +272,8 @@ export default class BudgetTahunan extends Component {
submitter: response.data.data.submitter, submitter: response.data.data.submitter,
approverID: response.data.data.approve_id, pic: response.data.data.approver == null ? '' : response.data.data.approver, approverID: response.data.data.approve_id, pic: response.data.data.approver == null ? '' : response.data.data.approver,
lastStatus: response.data.data.last_status === null ? 'SUBMIT' : response.data.data.last_status, lastStatus: response.data.data.last_status === null ? 'SUBMIT' : response.data.data.last_status,
loading: false loading: false,
lastRevision: response.data.data.last_revision
}, () => { }, () => {
this.historyApproval() this.historyApproval()
this.getReport() this.getReport()
...@@ -305,6 +309,7 @@ export default class BudgetTahunan extends Component { ...@@ -305,6 +309,7 @@ export default class BudgetTahunan extends Component {
} }
approvalSubmission(type) { approvalSubmission(type) {
this.setState({ loading: true })
let body = { let body = {
"approval_id": this.props.location.state == undefined ? this.state.approverID : this.state.rawData.approval_id, "approval_id": this.props.location.state == undefined ? this.state.approverID : this.state.rawData.approval_id,
"status": type, "status": type,
...@@ -313,7 +318,7 @@ export default class BudgetTahunan extends Component { ...@@ -313,7 +318,7 @@ export default class BudgetTahunan extends Component {
api.create().approvalSubmission(body).then((res) => { api.create().approvalSubmission(body).then((res) => {
console.log(res) console.log(res)
this.setState({ loading: false }, () => { this.setState({ loading: false }, () => {
this.checkApprover() this.getSubmission()
}) })
}) })
} }
...@@ -461,7 +466,28 @@ export default class BudgetTahunan extends Component { ...@@ -461,7 +466,28 @@ export default class BudgetTahunan extends Component {
}) })
} }
async downloadAttachment(fileurl, name) {
let length = name.split(".").length
let fileType = name.split(".")[length - 1]
console.log(fileType);
let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/download_attachment?fileName=${fileurl}&&fileType=${fileType}`
// console.log(url);
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/download_attachment?fileName=${fileurl}&&fileType=${fileType}`
)
res = await res.blob()
this.setState({ loading: false })
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Master Budget Balance Sheet.xlsx';
a.click();
}
}
validate() { validate() {
this.setState({ loading: true })
let array = [] let array = []
let canSubmit = true let canSubmit = true
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
...@@ -485,8 +511,7 @@ export default class BudgetTahunan extends Component { ...@@ -485,8 +511,7 @@ export default class BudgetTahunan extends Component {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "Success") { if (response.data.status === "Success") {
this.getCompanyActive() this.getSubmission()
this.setState({ loading: true })
} }
} }
}) })
...@@ -543,17 +568,17 @@ export default class BudgetTahunan extends Component { ...@@ -543,17 +568,17 @@ export default class BudgetTahunan extends Component {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{val === "submitted" || val === "approved" ? {val === "submitted" || val === "approved" ?
<img src={Images.ceklis} style={{ width: 31, height: 24 }} /> : <span>COMPLETED</span> :
val === "draft" ? val === "draft" ?
<span>Draft</span> : <span>DRAFT</span> :
val === "revision" ? val === "revision" ?
<span>Revisi</span> : <span>REVISION</span> :
val === "approval_proccess" ? val === "approval_proccess" ?
<span>Approval Proccess</span> : <span>APPROVAL PROCCESS</span> :
val === "approval_review" ? val === "approval_review" ?
<span>Approval Review</span> : <span>APPROVAL REVIEW</span> :
val === "not-yet" ? val === "not-yet" ?
null : <span>OPEN</span> :
<img src={Images.cross} style={{ width: 31, height: 24 }} /> <img src={Images.cross} style={{ width: 31, height: 24 }} />
} }
</div > </div >
...@@ -727,7 +752,7 @@ export default class BudgetTahunan extends Component { ...@@ -727,7 +752,7 @@ export default class BudgetTahunan extends Component {
{this.state.visibleBudgetTahunan && ( {this.state.visibleBudgetTahunan && (
<div> <div>
<div className={"main-color"} style={{ height: 78, display: 'flex', alignItems: 'center', paddingLeft: 20 }}> <div className={"main-color"} style={{ height: 78, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Master Budget Submission</Typography> <Typography style={{ fontSize: '16px', color: 'white' }}>Master Budget Submission & CAT Submission</Typography>
</div> </div>
<div style={{ padding: 20, width: '100%' }}> <div style={{ padding: 20, width: '100%' }}>
<Paper style={{ paddingTop: 10 }}> <Paper style={{ paddingTop: 10 }}>
...@@ -768,7 +793,7 @@ export default class BudgetTahunan extends Component { ...@@ -768,7 +793,7 @@ export default class BudgetTahunan extends Component {
/> />
</div> </div>
<div style={{ marginTop: 20 }}> <div style={{ marginTop: 20 }}>
<Autocomplete {/* <Autocomplete
{...this.state.listRevision} {...this.state.listRevision}
id="revision" id="revision"
onChange={(event, newInputValue) => this.setState({ revision: newInputValue }, () => { onChange={(event, newInputValue) => this.setState({ revision: newInputValue }, () => {
...@@ -780,7 +805,8 @@ export default class BudgetTahunan extends Component { ...@@ -780,7 +805,8 @@ export default class BudgetTahunan extends Component {
style={{ width: 250 }} style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Revision" margin="normal" style={{ marginTop: 7 }} />} renderInput={(params) => <TextField {...params} label="Revision" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.revision} value={this.state.revision}
/> /> */}
<TextField disabled={true} label="Revision" margin="normal" style={{ marginTop: 7, width: 250 }} value={this.state.lastRevision} />
</div> </div>
<div style={{ marginTop: 20 }}> <div style={{ marginTop: 20 }}>
...@@ -813,9 +839,28 @@ export default class BudgetTahunan extends Component { ...@@ -813,9 +839,28 @@ export default class BudgetTahunan extends Component {
<div style={{ display: 'flex', marginTop: 10 }}> <div style={{ display: 'flex', marginTop: 10 }}>
<div style={{ width: '50%', paddingLeft: 20 }}> <div style={{ width: '50%', paddingLeft: 20 }}>
{this.state.listAttachment.length > 0 ? {this.state.listAttachment.length > 0 ?
this.state.listAttachment.map((item) => { this.state.listAttachment.map((item, index) => {
return ( return (
<Typography style={{ fontSize: '16px', color: '#4b4b4b' }}>{item.attachment_name}</Typography> <div style={{ display: 'flex' }}>
<Typography style={{ fontSize: '13px', color: '#4b4b4b', width: 25 }}>{index+1}. </Typography>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
display: 'grid'
}}
onClick={() => {
this.downloadAttachment(item.attachment_url, item.attachment_name)
}}
>
<div>
<Typography style={{ fontSize: '13px', color: '#4b4b4b' }}> {item.attachment_name}</Typography>
</div>
</button>
</div>
) )
}) })
: null : null
...@@ -835,7 +880,7 @@ export default class BudgetTahunan extends Component { ...@@ -835,7 +880,7 @@ export default class BudgetTahunan extends Component {
}} }}
onClick={() => this.deleteAttachment(item)} onClick={() => this.deleteAttachment(item)}
> >
<Typography style={{ fontSize: '16px', color: '#ff3939' }}>Delete</Typography> <Typography style={{ fontSize: '13px', color: '#ff3939' }}>Delete</Typography>
</button> </button>
) )
}) })
......
...@@ -77,7 +77,7 @@ export default class BalanceSheet extends Component { ...@@ -77,7 +77,7 @@ export default class BalanceSheet extends Component {
}) })
} }
getItemHierarki() { async getItemHierarki() {
this.setState({ loading: true, judulColumn: null }) this.setState({ loading: true, judulColumn: null })
let payload = { let payload = {
"report_id": this.props.report_id, "report_id": this.props.report_id,
...@@ -86,51 +86,14 @@ export default class BalanceSheet extends Component { ...@@ -86,51 +86,14 @@ export default class BalanceSheet extends Component {
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"submission_id": this.props.submissionID "submission_id": this.props.submissionID
} }
api.create().getDetailReportMB(payload).then(response => { let response = await api.create().getDetailReportMB(payload)
console.log(response); console.log(response);
let dataTable = [] let dataTable = []
if (response.data) { if (response.data) {
let res = response.data.data let res = response.data.data
const handlePushChild = (item) => { const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id) let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) { if (indexIDzz === -1) {
dataTable.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description,
item.balance_sheet.total_actual_before === null ? "0" : item.balance_sheet.total_actual_before === "" ? "0" : item.balance_sheet.total_actual_before,
item.balance_sheet.january,
item.balance_sheet.february,
item.balance_sheet.march,
item.balance_sheet.april,
item.balance_sheet.may,
item.balance_sheet.june,
item.balance_sheet.july,
item.balance_sheet.august,
item.balance_sheet.september,
item.balance_sheet.october,
item.balance_sheet.november,
item.balance_sheet.december,
item.balance_sheet.total_current_year,
item.balance_sheet.total_next_year,
item.balance_sheet.total_more_year,
item.order,
item.condition_it_should_be,
item.condition_if_wrong
])
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
}
res.map((item, index) => {
dataTable.push([ dataTable.push([
item.type_report_id, item.type_report_id,
item.id, item.id,
...@@ -158,19 +121,55 @@ export default class BalanceSheet extends Component { ...@@ -158,19 +121,55 @@ export default class BalanceSheet extends Component {
item.condition_it_should_be, item.condition_it_should_be,
item.condition_if_wrong item.condition_if_wrong
]) ])
if (item.children !== null) { }
if (item.children.length > 0) { if (item.children !== null) {
item.children.map((items, indexs) => { if (item.children.length > 0) {
handlePushChild(items) item.children.map((items, indexs) => {
}) handlePushChild(items)
} })
} }
}) }
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} else {
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} }
}) res.map((item, index) => {
dataTable.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description,
item.balance_sheet.total_actual_before === null ? "0" : item.balance_sheet.total_actual_before === "" ? "0" : item.balance_sheet.total_actual_before,
item.balance_sheet.january,
item.balance_sheet.february,
item.balance_sheet.march,
item.balance_sheet.april,
item.balance_sheet.may,
item.balance_sheet.june,
item.balance_sheet.july,
item.balance_sheet.august,
item.balance_sheet.september,
item.balance_sheet.october,
item.balance_sheet.november,
item.balance_sheet.december,
item.balance_sheet.total_current_year,
item.balance_sheet.total_next_year,
item.balance_sheet.total_more_year,
item.order,
item.condition_it_should_be,
item.condition_if_wrong
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
})
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} else {
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
}
} }
handleValue(data) { handleValue(data) {
...@@ -3116,12 +3115,14 @@ export default class BalanceSheet extends Component { ...@@ -3116,12 +3115,14 @@ export default class BalanceSheet extends Component {
onClick={() => onClick={() =>
this.state.editable === true ? this.state.editable === true ?
null : null :
this.state.handleTekTekTek == 1 ? null : this.setState({ loading: true }, () =>
this.setState({ handleTekTekTek: 1 }, () => { this.state.handleTekTekTek == 1 ? null :
setTimeout(() => { this.setState({ handleTekTekTek: 1 }, () => {
this.uploadBalanceSheet('draft') setTimeout(() => {
}, 100); this.uploadBalanceSheet('draft')
}) }, 100);
})
)
} }
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
...@@ -3139,12 +3140,14 @@ export default class BalanceSheet extends Component { ...@@ -3139,12 +3140,14 @@ export default class BalanceSheet extends Component {
onClick={() => onClick={() =>
this.state.editable === true ? this.state.editable === true ?
null : null :
this.state.handleTekTekTek == 1 ? null : this.setState({ loading: true }, () =>
this.setState({ handleTekTekTek: 1 }, () => { this.state.handleTekTekTek == 1 ? null :
setTimeout(() => { this.setState({ handleTekTekTek: 1 }, () => {
this.uploadBalanceSheet('submitted') setTimeout(() => {
}, 100); this.uploadBalanceSheet('submitted')
}) }, 100);
})
)
} }
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
......
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