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

deps

parent ca744adf
......@@ -58,12 +58,14 @@ export default class BudgetTahunan extends Component {
approverID: null,
pic: '',
submitter: false,
detailRevisiCheck: []
detailRevisiCheck: [],
lastRevision: ""
}
this.fileHandler = this.fileHandler.bind(this);
}
componentDidMount() {
this.setState({ loading: true })
this.props.selectIndex('Master Budget & CAT')
if (this.props.location.state !== undefined) {
console.log(this.props);
......@@ -95,6 +97,7 @@ export default class BudgetTahunan extends Component {
"revision": this.state.revision.revision,
}
api.create().getMasterBudgetAtt(payload).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({ listAttachment: response.data.data })
......@@ -269,7 +272,8 @@ export default class BudgetTahunan extends Component {
submitter: response.data.data.submitter,
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,
loading: false
loading: false,
lastRevision: response.data.data.last_revision
}, () => {
this.historyApproval()
this.getReport()
......@@ -305,6 +309,7 @@ export default class BudgetTahunan extends Component {
}
approvalSubmission(type) {
this.setState({ loading: true })
let body = {
"approval_id": this.props.location.state == undefined ? this.state.approverID : this.state.rawData.approval_id,
"status": type,
......@@ -313,7 +318,7 @@ export default class BudgetTahunan extends Component {
api.create().approvalSubmission(body).then((res) => {
console.log(res)
this.setState({ loading: false }, () => {
this.checkApprover()
this.getSubmission()
})
})
}
......@@ -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() {
this.setState({ loading: true })
let array = []
let canSubmit = true
this.state.dataTable.map(item => {
......@@ -485,8 +511,7 @@ export default class BudgetTahunan extends Component {
console.log(response);
if (response.data) {
if (response.data.status === "Success") {
this.getCompanyActive()
this.setState({ loading: true })
this.getSubmission()
}
}
})
......@@ -543,17 +568,17 @@ export default class BudgetTahunan extends Component {
return (
<div style={{ display: 'flex' }}>
{val === "submitted" || val === "approved" ?
<img src={Images.ceklis} style={{ width: 31, height: 24 }} /> :
<span>COMPLETED</span> :
val === "draft" ?
<span>Draft</span> :
<span>DRAFT</span> :
val === "revision" ?
<span>Revisi</span> :
<span>REVISION</span> :
val === "approval_proccess" ?
<span>Approval Proccess</span> :
<span>APPROVAL PROCCESS</span> :
val === "approval_review" ?
<span>Approval Review</span> :
<span>APPROVAL REVIEW</span> :
val === "not-yet" ?
null :
<span>OPEN</span> :
<img src={Images.cross} style={{ width: 31, height: 24 }} />
}
</div >
......@@ -727,7 +752,7 @@ export default class BudgetTahunan extends Component {
{this.state.visibleBudgetTahunan && (
<div>
<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 style={{ padding: 20, width: '100%' }}>
<Paper style={{ paddingTop: 10 }}>
......@@ -768,7 +793,7 @@ export default class BudgetTahunan extends Component {
/>
</div>
<div style={{ marginTop: 20 }}>
<Autocomplete
{/* <Autocomplete
{...this.state.listRevision}
id="revision"
onChange={(event, newInputValue) => this.setState({ revision: newInputValue }, () => {
......@@ -780,7 +805,8 @@ export default class BudgetTahunan extends Component {
style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Revision" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.revision}
/>
/> */}
<TextField disabled={true} label="Revision" margin="normal" style={{ marginTop: 7, width: 250 }} value={this.state.lastRevision} />
</div>
<div style={{ marginTop: 20 }}>
......@@ -813,9 +839,28 @@ export default class BudgetTahunan extends Component {
<div style={{ display: 'flex', marginTop: 10 }}>
<div style={{ width: '50%', paddingLeft: 20 }}>
{this.state.listAttachment.length > 0 ?
this.state.listAttachment.map((item) => {
this.state.listAttachment.map((item, index) => {
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
......@@ -835,7 +880,7 @@ export default class BudgetTahunan extends Component {
}}
onClick={() => this.deleteAttachment(item)}
>
<Typography style={{ fontSize: '16px', color: '#ff3939' }}>Delete</Typography>
<Typography style={{ fontSize: '13px', color: '#ff3939' }}>Delete</Typography>
</button>
)
})
......
......@@ -77,7 +77,7 @@ export default class BalanceSheet extends Component {
})
}
getItemHierarki() {
async getItemHierarki() {
this.setState({ loading: true, judulColumn: null })
let payload = {
"report_id": this.props.report_id,
......@@ -86,51 +86,14 @@ export default class BalanceSheet extends Component {
"company_id": this.props.company.company_id,
"submission_id": this.props.submissionID
}
api.create().getDetailReportMB(payload).then(response => {
console.log(response);
let dataTable = []
if (response.data) {
let res = response.data.data
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
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) => {
let response = await api.create().getDetailReportMB(payload)
console.log(response);
let dataTable = []
if (response.data) {
let res = response.data.data
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) {
dataTable.push([
item.type_report_id,
item.id,
......@@ -158,19 +121,55 @@ export default class BalanceSheet extends Component {
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)
})
}
}
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 })
}
}
})
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) {
......@@ -3116,12 +3115,14 @@ export default class BalanceSheet extends Component {
onClick={() =>
this.state.editable === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
this.uploadBalanceSheet('draft')
}, 100);
})
this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
this.uploadBalanceSheet('draft')
}, 100);
})
)
}
>
<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 {
onClick={() =>
this.state.editable === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
this.uploadBalanceSheet('submitted')
}, 100);
})
this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
this.uploadBalanceSheet('submitted')
}, 100);
})
)
}
>
<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