Commit 5b11b9d7 authored by Deni Rinaldi's avatar Deni Rinaldi

dah

parent ca756d49
......@@ -79,7 +79,7 @@ export default class BudgetTahunan extends Component {
this.props.selectIndex('Master Budget & CAT')
if (this.props.location.state !== undefined) {
console.log(this.props);
this.setState({ userType: this.props.location.state.userType, intent: 'Home', lastPeriod: this.props.location.state.rawData.periode, rawData: this.props.location.state.rawData }, () => {
this.setState({ userType: this.props.location.state.userType, intent: 'Home', latestPeriode: this.props.location.state.rawData.periode, rawData: this.props.location.state.rawData }, () => {
this.checkApprover()
})
} else {
......@@ -318,9 +318,10 @@ export default class BudgetTahunan extends Component {
options: periodeData,
getOptionLabel: (option) => option.periode,
};
let index = data.sort((a, b) => a - b).findIndex((val) => val === (this.state.latestPeriode == "" ? String(Number(currentYear) + 1) : this.state.latestPeriode))
let periode = (this.state.latestPeriode == "" ? String(Number(currentYear) + 1) : this.state.latestPeriode)
let index = data.sort((a, b) => a - b).findIndex((val) => val === periode)
// console.log(data)
console.log(this.state.lastPeriod)
console.log(this.state.latestPeriode)
// console.log(periodeData)
// console.log(index)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
......@@ -662,7 +663,7 @@ export default class BudgetTahunan extends Component {
validateRevision() {
let arrayRevisi = this.state.detailRevisiCheck
let remarksKosong = 0
arrayRevisi.map((item,index) => {
arrayRevisi.map((item, index) => {
if (item.remarks == "") {
remarksKosong += 1
}
......@@ -677,7 +678,7 @@ export default class BudgetTahunan extends Component {
render() {
const handleMaxDate = () => {
let handleDate = Number(moment(this.state.maxDateRevision).format('YYYYMMDD')) - Number(moment(this.state.minDateRevision).format('YYYYMMDD'))
return handleDate < 0? moment(this.state.minDateRevision).format('YYYY/MM/DD') : moment(this.state.maxDateRevision).format('YYYY/MM/DD')
return handleDate < 0 ? moment(this.state.minDateRevision).format('YYYY/MM/DD') : moment(this.state.maxDateRevision).format('YYYY/MM/DD')
}
const columns = ["#", "Report Type",
{
......@@ -755,7 +756,7 @@ export default class BudgetTahunan extends Component {
onClick={() =>
tableMeta.rowData[5] == true ?
this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3])
: null
: null
}
>
{/* {this.state.isApprover == true ?
......@@ -1046,24 +1047,24 @@ export default class BudgetTahunan extends Component {
{!this.state.isApprover && (this.state.lastStatus === 'SUBMIT' || this.state.lastStatus === 'REVISION') && (
<div style={{ width: '50%' }}>
{
this.state.listAttachment.length > 0 ?
this.state.listAttachment.map((item) => {
return (
<button
style={{
backgroundColor: 'transparent',
cursor: this.state.isSubmit === false ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
display: 'grid'
}}
onClick={() => this.state.isSubmit === false ? null : this.deleteAttachment(item)}
>
<Typography style={{ fontSize: '13px', color: this.state.isSubmit === false ? 'GrayText' : '#ff3939' }}>Delete</Typography>
</button>
)
})
: null
this.state.listAttachment.length > 0 ?
this.state.listAttachment.map((item) => {
return (
<button
style={{
backgroundColor: 'transparent',
cursor: this.state.isSubmit === false ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
display: 'grid'
}}
onClick={() => this.state.isSubmit === false ? null : this.deleteAttachment(item)}
>
<Typography style={{ fontSize: '13px', color: this.state.isSubmit === false ? 'GrayText' : '#ff3939' }}>Delete</Typography>
</button>
)
})
: null
}
</div>
)}
......@@ -1075,7 +1076,10 @@ export default class BudgetTahunan extends Component {
</div> : this.state.lastStatus === 'WAITING FOR YOUR APPROVAL' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{this.state.lastStatus}</span>
</div> : null
</div> : this.state.lastStatus === 'WAITING FOR APPROVAL' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{`${this.state.lastStatus} - ${this.state.pic}`}</span>
</div> : null
:
this.state.lastStatus === 'SUBMITTED' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
......@@ -1246,7 +1250,7 @@ export default class BudgetTahunan extends Component {
getReport={this.getSubmission.bind(this)}
isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus}
prevRevision={this.state.isSubmit? this.state.prevRevision : true}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
status={this.state.status}
/>
)}
......@@ -1266,7 +1270,7 @@ export default class BudgetTahunan extends Component {
status={this.state.status}
isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus}
prevRevision={this.state.isSubmit? this.state.prevRevision : true}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
/>
)}
{this.state.visibleTP && (
......@@ -1285,7 +1289,7 @@ export default class BudgetTahunan extends Component {
status={this.state.status}
isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus}
prevRevision={this.state.isSubmit? this.state.prevRevision : true}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
/>
)}
{this.state.visibleFAM && (
......@@ -1304,7 +1308,7 @@ export default class BudgetTahunan extends Component {
status={this.state.status}
isApprover={this.state.isApprover}
lastStatus={this.state.lastStatus}
prevRevision={this.state.isSubmit? this.state.prevRevision : true}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
/>
)}
{this.state.visibleCAT && (
......@@ -1323,7 +1327,7 @@ export default class BudgetTahunan extends Component {
isApprover={this.state.isApprover}
status={this.state.status}
lastStatus={this.state.lastStatus}
prevRevision={this.state.isSubmit? this.state.prevRevision : true}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
/>
)}
{this.state.visibleCF && (
......@@ -1339,7 +1343,7 @@ export default class BudgetTahunan extends Component {
saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visibleCF: false, visibleBudgetTahunan: true })}
getReport={this.getSubmission.bind(this)}
prevRevision={this.state.isSubmit? this.state.prevRevision : true}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
/>
)}
......@@ -1382,7 +1386,7 @@ export default class BudgetTahunan extends Component {
id="startDate"
label="Valid From"
format="dd-MM-yyyy"
onChange={(e) => this.setState({minDateRevision: moment(e).format('YYYY/MM/DD')}, () => this.setState({maxDateRevision: handleMaxDate()}))}
onChange={(e) => this.setState({ minDateRevision: moment(e).format('YYYY/MM/DD') }, () => this.setState({ maxDateRevision: handleMaxDate() }))}
value={moment(this.state.minDateRevision).format('YYYY/MM/DD')}
KeyboardButtonProps={{
'aria-label': 'change date',
......@@ -1409,7 +1413,7 @@ export default class BudgetTahunan extends Component {
id="startDate"
label="Valid To"
format="dd-MM-yyyy"
onChange={(e) => this.setState({maxDateRevision: moment(e).format('YYYY/MM/DD')})}
onChange={(e) => this.setState({ maxDateRevision: moment(e).format('YYYY/MM/DD') })}
minDate={moment(this.state.minDateRevision).format('YYYY/MM/DD')}
value={moment(this.state.maxDateRevision).format('YYYY/MM/DD')}
KeyboardButtonProps={{
......
......@@ -2880,11 +2880,9 @@ export default class BalanceSheet extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%' }}>
{this.props.isApprover == true || this.state.dataTable.length == 0 ? null :
{this.state.dataTable.length == 0 ? null : this.props.isApprover == true ?
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
{((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && (
<div>
<a data-tip={'Download Template'} data-for="template">
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
......@@ -2892,31 +2890,54 @@ export default class BalanceSheet extends Component {
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.downloadTemplate()}
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
})}
>
<img src={Images.template} />
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
</div>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div> :
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
{((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && (
<div>
<a data-tip={'Download Template'} data-for="template">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.downloadTemplate()}
>
<img src={Images.template} />
</button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
</div>
)}
{((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && (
<div>
<a data-tip={'Upload'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ visibleUpload: true })}
>
<img src={Images.upload} />
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
</div>
<div>
<a data-tip={'Upload'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ visibleUpload: true })}
>
<img src={Images.upload} />
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
</div>
)}
<a data-tip={'Download'} data-for="download">
<button
......@@ -2977,75 +2998,75 @@ export default class BalanceSheet extends Component {
</div>
{this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ?
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.handleValidate()
}, 100);
})
}}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.editable === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMasterBudget('draft')
})
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMasterBudget('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div> : null
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.handleValidate()
}, 100);
})
}}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.editable === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMasterBudget('draft')
})
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMasterBudget('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div> : null
}
</div>
</Paper>
......
......@@ -119,10 +119,10 @@ export default class CorporateAnnualTarget extends Component {
"",
item.description,
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : (String(item.cat.weight).indexOf(".") == -1 ? item.cat.weight : `${Number(item.weight) * 100}%`),
parentTrue? item.cat.uom : item.uom,
parentTrue? item.cat.kpi_type == "" ? null : { value: item.cat.kpi_type } : item.kpi_type == "" ? null : { value: item.kpi_type },
parentTrue? item.cat.max_ach == "" ? null : { value: item.cat.max_ach } : item.max_ach == "" ? null : { value: item.max_ach },
parentTrue? item.cat.formula == "" ? null : { value: item.cat.formula }: item.formula_ytd == "" ? null : { value: item.formula_ytd },
parentTrue ? item.cat.uom : item.uom,
parentTrue ? item.cat.kpi_type == "" ? null : { value: item.cat.kpi_type } : item.kpi_type == "" ? null : { value: item.kpi_type },
parentTrue ? item.cat.max_ach == "" ? null : { value: item.cat.max_ach } : item.max_ach == "" ? null : { value: item.max_ach },
parentTrue ? item.cat.formula == "" ? null : { value: item.cat.formula } : item.formula_ytd == "" ? null : { value: item.formula_ytd },
item.cat.total_actual_before == "" ? item.cat.total_actual_before : String(item.cat.total_actual_before).indexOf(".") == -1 ? Number(item.cat.total_actual_before) : Number(item.cat.total_actual_before).toFixed(1),
item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1),
item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1),
......@@ -218,7 +218,7 @@ export default class CorporateAnnualTarget extends Component {
let resReal = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
let resNull = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
let res = await fetch(
this.props.submissionID == null? resNull : resReal
this.props.submissionID == null ? resNull : resReal
)
res = await res.blob()
console.log(res)
......@@ -261,17 +261,17 @@ export default class CorporateAnnualTarget extends Component {
}
})
}
nilaiTotal = i[6] == 'SUM'? total : i[6] == 'AVG'? total/12 : lastValz
nilaiTotal = i[6] == 'SUM' ? total : i[6] == 'AVG' ? total / 12 : lastValz
}
console.log(nilaiTotal)
// console.log(i[2] === undefined ? "" : String(Number(i[2]*100)).length > 3? String(Number(i[2]*100).toFixed(0) + '%') : String(Number(i[2]*100)) + '%')
payload.push({
item_report_id: i[0] === undefined ? "" : reg.test(String(i[0])) === false ? "" : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(),
weight: i[2] === undefined ? "" : String(Number(i[2]*100)).length > 3? String(Number(i[2]*100).toFixed(0) + '%') : String(Number(i[2]*100)) + '%',
weight: i[2] === undefined ? "" : String(Number(i[2] * 100)).length > 3 ? String(Number(i[2] * 100).toFixed(0) + '%') : String(Number(i[2] * 100)) + '%',
uom: i[3] === undefined ? "" : String(i[3]).trim(),
kpi_type: i[4] === undefined ? "" : String(i[4]).trim(),
max_ach: i[5] === undefined ? "" : String(i[5]).toLocaleLowerCase() !== 'unlimited' ? String(Number(i[5]*100) + '%') : String(i[5]).trim(),
max_ach: i[5] === undefined ? "" : String(i[5]).toLocaleLowerCase() !== 'unlimited' ? String(Number(i[5] * 100) + '%') : String(i[5]).trim(),
formula: i[6] === undefined ? "" : String(i[6]).trim(),
total_actual_before: i[7] === undefined ? "0.0" : reg.test(String(i[7])) === false ? "0.0" : String(Number(i[7]).toFixed(1)).trim(),
january: i[8] === undefined ? "0.0" : reg.test(String(i[8])) === false ? "0.0" : String(Number(i[8]).toFixed(1)).trim(),
......@@ -286,7 +286,7 @@ export default class CorporateAnnualTarget extends Component {
october: i[17] === undefined ? "0.0" : reg.test(String(i[17])) === false ? "0.0" : String(Number(i[17]).toFixed(1)).trim(),
november: i[18] === undefined ? "0.0" : reg.test(String(i[18])) === false ? "0.0" : String(Number(i[18]).toFixed(1)).trim(),
december: i[19] === undefined ? "0.0" : reg.test(String(i[19])) === false ? "0.0" : String(Number(i[19]).toFixed(1)).trim(),
total_current_year: i[20] == 0? "0.0" : String(Number(nilaiTotal).toFixed(1)).trim(),
total_current_year: i[20] == 0 ? "0.0" : String(Number(nilaiTotal).toFixed(1)).trim(),
total_next_year: i[21] === undefined ? "0.0" : reg.test(String(i[21])) === false ? "0.0" : String(Number(i[21]).toFixed(1)).trim(),
total_more_year: i[22] === undefined ? "0.0" : reg.test(String(i[22])) === false ? "0.0" : String(Number(i[22]).toFixed(1)).trim(),
strategic: i[23] === undefined ? "" : String(i[23]).trim(),
......@@ -308,7 +308,7 @@ export default class CorporateAnnualTarget extends Component {
}
checkUpload() {
this.setState({loading: true})
this.setState({ loading: true })
let dataDelete = this.state.dataDelete
api.create().getIdDeleteFromExcel(this.state.payload).then((response) => {
if (response.data) {
......@@ -336,7 +336,7 @@ export default class CorporateAnnualTarget extends Component {
item.item_report_id,
item.parent,
item.formula,
item.level == null? 1 : item.level,
item.level == null ? 1 : item.level,
"",
item.item_report,
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : (String(item.weight).indexOf(".") == -1 ? item.weight : `${Number(item.weight) * 100}%`),
......@@ -399,7 +399,7 @@ export default class CorporateAnnualTarget extends Component {
console.log(this.state.dataTable)
this.state.dataTable.map(i => {
data.push({
"item_report_id": i[1] == "" || i[1] == null? 0 : i[1],
"item_report_id": i[1] == "" || i[1] == null ? 0 : i[1],
"item_report": String(i[6]),
"weight": String(i[7]),
"uom": String(i[8]),
......@@ -460,7 +460,7 @@ export default class CorporateAnnualTarget extends Component {
let dataTampung = []
let weightReal = null
this.state.dataTable.map((i, index) => {
if (i[0] ==1) {
if (i[0] == 1) {
dataTampung.push({
id: i[1],
maxValue: i[7],
......@@ -469,15 +469,15 @@ export default class CorporateAnnualTarget extends Component {
}
if (i[0] !== 1 && i[0] !== 4) {
totalWeight += Number(i[7] == "" || i[7] == undefined? 0 : i[7].replace('%', ''))
totalWeight += Number(i[7] == "" || i[7] == undefined ? 0 : i[7].replace('%', ''))
}
if (i[2] !== null) {
let indexID = dataTampung.findIndex((val) => val.id == i[2])
if (indexID !== -1) {
let weightParent = Number(dataTampung[indexID].maxValue == "" || dataTampung[indexID].maxValue == undefined? 0 : dataTampung[indexID].maxValue.replace('%', ''))
let weightParent = Number(dataTampung[indexID].maxValue == "" || dataTampung[indexID].maxValue == undefined ? 0 : dataTampung[indexID].maxValue.replace('%', ''))
let valChild = Number(dataTampung[indexID].valChild)
let valReal = Number(i[7] == "" || i[7] == undefined? 0 : i[7].replace('%', ''))
let valReal = Number(i[7] == "" || i[7] == undefined ? 0 : i[7].replace('%', ''))
let totalBaru = valChild + valReal
if (totalBaru > weightParent) {
dataTableBaru[index][7] = `${(weightParent - valChild)}%`
......@@ -486,16 +486,16 @@ export default class CorporateAnnualTarget extends Component {
} else {
dataTableBaru[index][7] = i[7]
weightReal = i[7]
dataTampung[indexID].valChild = dataTampung[indexID].valChild + Number(i[7] == "" || i[7] == undefined? 0 : i[7].replace('%', ''))
dataTampung[indexID].valChild = dataTampung[indexID].valChild + Number(i[7] == "" || i[7] == undefined ? 0 : i[7].replace('%', ''))
}
}
}
data.push({
"item_report_id": i[1] == "" ? null : i[1],
"item_report_id": i[1] == "" ? null : i[1],
"item_name": String(i[6]),
"parent": i[2] == "" ? null : i[2],
"weight": weightReal == null? String(i[7]) : weightReal,
"weight": weightReal == null ? String(i[7]) : weightReal,
"uom": String(i[8]),
"kpi_type": i[9] == null ? "" : i[9].value,
"max_ach": i[10] == null ? "" : i[10].value,
......@@ -534,7 +534,7 @@ export default class CorporateAnnualTarget extends Component {
console.log(totalWeight)
// this.setState({dataTable: dataTampung})
if (totalWeight < 100) {
this.setState({ alert: true, messageAlert: 'Total weight less than 100%', tipeAlert: 'warning', loading: false, buttonError: true, editable: true})
this.setState({ alert: true, messageAlert: 'Total weight less than 100%', tipeAlert: 'warning', loading: false, buttonError: true, editable: true })
} else {
api.create().validateSubmitReport(payload).then((response) => {
console.log(response)
......@@ -644,7 +644,7 @@ export default class CorporateAnnualTarget extends Component {
let data = response.data.data
console.log(data)
let inputKPI = []
data.map((item) => {
inputKPI.push({
value: item.value
......@@ -697,7 +697,7 @@ export default class CorporateAnnualTarget extends Component {
getOptionLabel: (option) => titleCase(option.value),
};
// setTimeout(() => {
this.setState({ maxAchList: defaultProps })
this.setState({ maxAchList: defaultProps })
// }, 300);
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
......@@ -849,7 +849,7 @@ export default class CorporateAnnualTarget extends Component {
newData.push([
3,
"",
item[2] == null? item[1] : item[2],
item[2] == null ? item[1] : item[2],
item[3],
item[4],
"",
......@@ -1098,7 +1098,7 @@ export default class CorporateAnnualTarget extends Component {
type="text"
placeholder=""
value={value}
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
maxLength={4}
onBlur={(event) => {
// updateValue(some)
......@@ -1301,7 +1301,7 @@ export default class CorporateAnnualTarget extends Component {
type="text"
placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1342,7 +1342,7 @@ export default class CorporateAnnualTarget extends Component {
type="text"
placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1383,7 +1383,7 @@ export default class CorporateAnnualTarget extends Component {
type="text"
placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1425,7 +1425,7 @@ export default class CorporateAnnualTarget extends Component {
placeholder=""
value={Number(value).toFixed(1)}
decimalScale={1}
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1465,7 +1465,7 @@ export default class CorporateAnnualTarget extends Component {
type="text"
placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1505,7 +1505,7 @@ export default class CorporateAnnualTarget extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
decimalScale={1}
onBlur={(event) => {
......@@ -1546,7 +1546,7 @@ export default class CorporateAnnualTarget extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
decimalScale={1}
onBlur={(event) => {
......@@ -1588,7 +1588,7 @@ export default class CorporateAnnualTarget extends Component {
type="text"
placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1628,7 +1628,7 @@ export default class CorporateAnnualTarget extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
decimalScale={1}
onBlur={(event) => {
......@@ -1669,7 +1669,7 @@ export default class CorporateAnnualTarget extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale={1}
value={Number(value).toFixed(1)}
onBlur={(event) => {
......@@ -1711,7 +1711,7 @@ export default class CorporateAnnualTarget extends Component {
type="text"
placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1752,7 +1752,7 @@ export default class CorporateAnnualTarget extends Component {
type="text"
placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1793,7 +1793,7 @@ export default class CorporateAnnualTarget extends Component {
type="text"
placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1872,7 +1872,7 @@ export default class CorporateAnnualTarget extends Component {
type="text"
placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1913,7 +1913,7 @@ export default class CorporateAnnualTarget extends Component {
type="text"
placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1951,7 +1951,7 @@ export default class CorporateAnnualTarget extends Component {
style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginBottom: -5 }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
defaultValue={value}
onBlur={(event) => {
console.log(event.target.value)
......@@ -1991,7 +1991,7 @@ export default class CorporateAnnualTarget extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginBottom: -5 }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
defaultValue={value}
onBlur={(event) => {
console.log(event.target.value)
......@@ -2045,57 +2045,80 @@ export default class CorporateAnnualTarget extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
{!this.props.isApprover && <div style={{ width: '50%' }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
{((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ) && <a data-tip={'Download Template'} data-for="template">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.downloadTemplate()}
>
<img src={Images.template} />
</button>
</a>}
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
{((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ) && <a data-tip={'Upload'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ visibleUpload: true })}
>
<img src={Images.upload} />
</button>
</a>}
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() =>
// this.setState({ loading: true }, () => {
// setTimeout(() => {
this.downloadAllData()}
// }, 100);
// })}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div>
</div>}
<div style={{ width: '50%' }}>
{this.state.dataTable.length == 0 ? null : this.props.isApprover == true ?
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
})}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div> :
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
{((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && <a data-tip={'Download Template'} data-for="template">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.downloadTemplate()}
>
<img src={Images.template} />
</button>
</a>}
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
{((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && <a data-tip={'Upload'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ visibleUpload: true })}
>
<img src={Images.upload} />
</button>
</a>}
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() =>
// this.setState({ loading: true }, () => {
// setTimeout(() => {
this.downloadAllData()}
// }, 100);
// })}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div>
}
</div>
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
......@@ -2133,7 +2156,7 @@ export default class CorporateAnnualTarget extends Component {
</button>
</div>
{!this.props.isApprover && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
{((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ) && <button
{((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && <button
className="button"
type="button"
style={{
......@@ -2155,7 +2178,7 @@ export default class CorporateAnnualTarget extends Component {
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>}
{((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ) && <button
{((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && <button
className="button"
type="button"
style={{
......@@ -2179,7 +2202,7 @@ export default class CorporateAnnualTarget extends Component {
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>}
{((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ) && <button
{((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && <button
type="button"
// disabled={this.state.buttonError}
onClick={() => this.state.buttonError ?
......@@ -2275,13 +2298,13 @@ export default class CorporateAnnualTarget extends Component {
marginRight: 20
}}
onClick={() => this.state.editable === true ?
null : this.setState({ loading: true}, () =>
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
this.uploadCAT("draft")
}, 100);
})
null : this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
this.uploadCAT("draft")
}, 100);
})
)
}
>
......@@ -2299,13 +2322,13 @@ export default class CorporateAnnualTarget extends Component {
}}
onClick={() =>
this.state.editable === true ?
null : this.setState({ loading: true}, () =>
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
this.uploadCAT("submitted")
}, 100);
})
null : this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
this.uploadCAT("submitted")
}, 100);
})
)
}
>
......
......@@ -162,9 +162,9 @@ export default class FixedAssetsMovement extends Component {
}
}
})
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} else {
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
}
})
}
......@@ -287,7 +287,7 @@ export default class FixedAssetsMovement extends Component {
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
fixed_asset_movement: payload
fixed_asset_movement: payload
}
console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
......@@ -393,7 +393,7 @@ export default class FixedAssetsMovement extends Component {
}
async downloadAllData() {
let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
console.log(url);
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
......@@ -461,9 +461,9 @@ export default class FixedAssetsMovement extends Component {
const handleChange = (value, tableMeta, type) => {
let val = String(value).split(",").join("")
if (type === "actual") {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
} else {
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[tableMeta.rowIndex][2])
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[tableMeta.rowIndex][2])
if (indexParent > 0) {
// console.log(indexParent)
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
......@@ -535,7 +535,7 @@ export default class FixedAssetsMovement extends Component {
if (response.data) {
if (response.data.status === "success") {
setTimeout(() => {
return response.data.data.result
return response.data.data.result
}, 2000);
}
}
......@@ -554,7 +554,7 @@ export default class FixedAssetsMovement extends Component {
if (response.data) {
if (response.data.status === "success") {
setTimeout(() => {
return response.data.data.result
return response.data.data.result
}, 2000);
}
}
......@@ -640,7 +640,7 @@ export default class FixedAssetsMovement extends Component {
setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 300 }}>
<div style={{ width: 300 }}>
{tableMeta.rowData[23] ?
tableMeta.rowData[23].length > 0 ?
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
......@@ -726,7 +726,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -814,7 +814,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -903,7 +903,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -992,7 +992,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1081,7 +1081,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1170,7 +1170,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1259,7 +1259,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1348,7 +1348,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1437,7 +1437,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1526,7 +1526,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1615,7 +1615,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1704,7 +1704,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1831,7 +1831,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1920,7 +1920,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -2024,11 +2024,9 @@ export default class FixedAssetsMovement extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%' }}>
{this.props.isApprover == true || this.state.dataTable.length == 0 ? null :
{this.state.dataTable.length == 0 ? null : this.props.isApprover == true ?
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
{((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === "draft" || this.props.status === 'submitted') ) && (
<div>
<a data-tip={'Download Template'} data-for="template">
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
......@@ -2036,31 +2034,54 @@ export default class FixedAssetsMovement extends Component {
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.downloadTemplate()}
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
})}
>
<img src={Images.template} />
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
</div>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div> :
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
{((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === "draft" || this.props.status === 'submitted')) && (
<div>
<a data-tip={'Download Template'} data-for="template">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.downloadTemplate()}
>
<img src={Images.template} />
</button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
</div>
)}
{((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === "draft" || this.props.status === 'submitted') ) && (
<div>
<a data-tip={'Upload'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ visibleUpload: true })}
>
<img src={Images.upload} />
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
</div>
{((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === "draft" || this.props.status === 'submitted')) && (
<div>
<a data-tip={'Upload'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ visibleUpload: true })}
>
<img src={Images.upload} />
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
</div>
)}
<a data-tip={'Download'} data-for="download">
<button
......@@ -2087,7 +2108,7 @@ export default class FixedAssetsMovement extends Component {
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.loading && loadingComponent}
{this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
......@@ -2095,7 +2116,7 @@ export default class FixedAssetsMovement extends Component {
options={options}
/>
</MuiThemeProvider>
</div>
</div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography>
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
......@@ -2123,75 +2144,75 @@ export default class FixedAssetsMovement extends Component {
</div>
{this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === "draft" || this.props.status === 'submitted') ?
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%'}}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.handleValidate()
}, 100);
})
}}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.editable === true ?
null :
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.handleValidate()
}, 100);
})
}}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.editable === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMasterBudget('draft')
})
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMasterBudget('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div> : null
})
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMasterBudget('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div> : null
}
</div>
</Paper>
......@@ -2249,7 +2270,7 @@ export default class FixedAssetsMovement extends Component {
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false})
this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false })
}, 100);
})
}}
......@@ -2270,13 +2291,13 @@ export default class FixedAssetsMovement extends Component {
marginRight: 20
}}
onClick={() => this.state.editable === true ?
null : this.setState({ loading: true}, () =>
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
this.uploadFAM('draft')
}, 100);
}))}
null : this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
this.uploadFAM('draft')
}, 100);
}))}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
......@@ -2290,15 +2311,15 @@ export default class FixedAssetsMovement extends Component {
borderColor: 'transparent',
outline: 'none'
}}
onClick={() =>
onClick={() =>
this.state.editable === true ?
null : this.setState({ loading: true}, () =>
this.state.handleTekTekTek == 1 ? null :
this.setState({handleTekTekTek: 1}, () => {
setTimeout(() => {
this.uploadFAM('submitted')
}, 100);
})
null : this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
this.uploadFAM('submitted')
}, 100);
})
)
}
>
......
......@@ -91,7 +91,7 @@ export default class ProfitLoss extends Component {
api.create().getDetailReportMB(payload).then(response => {
console.log(response);
let dataTable = []
this.setState({visibleProfitLoss: true})
this.setState({ visibleProfitLoss: true })
if (response.data) {
let res = response.data.data
const handlePushChild = (item) => {
......@@ -499,7 +499,7 @@ export default class ProfitLoss extends Component {
total += Number(valItem)
}
})
let indexParent = dataTable2.findIndex((val) => val[1] == tableMeta.rowData[2] )
let indexParent = dataTable2.findIndex((val) => val[1] == tableMeta.rowData[2])
if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "sales price") {
let value = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20])
dataTable2[tableMeta.rowIndex][20] = R.equals(value, NaN) ? "0.0" : value
......@@ -652,7 +652,7 @@ export default class ProfitLoss extends Component {
return (
<div style={{ textAlign: 'right' }}>
<div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null :
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null :
<FormControlLabel
style={{ margin: 0 }}
// value={value}
......@@ -662,7 +662,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
defaultValue={value}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -737,7 +737,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -826,7 +826,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -916,7 +916,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1006,7 +1006,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1096,7 +1096,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1186,7 +1186,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1276,7 +1276,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1366,7 +1366,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1456,7 +1456,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1546,7 +1546,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1636,7 +1636,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1726,7 +1726,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1863,7 +1863,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1896,7 +1896,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 13)).toFixed(1)}ue={handleFormula(value, tableMeta)}
value={Number(handleFormula(value, tableMeta, 13)).toFixed(1)} ue={handleFormula(value, tableMeta)}
/>
// null
:
......@@ -1907,7 +1907,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 13)).toFixed(1)}ue={handleFormula(value, tableMeta)}
value={Number(handleFormula(value, tableMeta, 13)).toFixed(1)} ue={handleFormula(value, tableMeta)}
/>
// null
:
......@@ -1953,7 +1953,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1986,7 +1986,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 14)).toFixed(1)}ue={handleFormula(value, tableMeta)}
value={Number(handleFormula(value, tableMeta, 14)).toFixed(1)} ue={handleFormula(value, tableMeta)}
/>
// null
:
......@@ -1997,7 +1997,7 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 14)).toFixed(1)}ue={handleFormula(value, tableMeta)}
value={Number(handleFormula(value, tableMeta, 14)).toFixed(1)} ue={handleFormula(value, tableMeta)}
/>
// null
:
......@@ -2070,9 +2070,30 @@ export default class ProfitLoss extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%' }}>
{this.props.isApprover == true || this.state.dataTable.length == 0 ? null :
{this.state.dataTable.length == 0 ? null : this.props.isApprover == true ?
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
{((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ) && <a data-tip={'Download Template'} data-for="template">
<a data-tip={'Download'} data-for="download">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
})}
>
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div> :
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
{((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && <a data-tip={'Download Template'} data-for="template">
<button
style={{
backgroundColor: 'transparent',
......@@ -2086,7 +2107,7 @@ export default class ProfitLoss extends Component {
</button>
</a>}
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
{((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ) && <a data-tip={'Upload'} data-for="upload">
{((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && <a data-tip={'Upload'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
......@@ -2158,74 +2179,74 @@ export default class ProfitLoss extends Component {
</button>
</div>
{this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false ?
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true, dataTable: dataTable2, buttonDraft: false}, () => {
setTimeout(() => {
this.handleValidate()
}, 100);
})
}}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
disabled={this.state.buttonDraft}
onClick={() =>
this.state.handleTekTekTek == 1? null :
this.setState({handleTekTekTek: 1}, () => {
this.backToMasterBudget('draft')
})
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() => this.state.buttonError?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1? null :
this.setState({handleTekTekTek: 1}, () => {
this.backToMasterBudget('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div> : null
(this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false ?
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true, dataTable: dataTable2, buttonDraft: false }, () => {
setTimeout(() => {
this.handleValidate()
}, 100);
})
}}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
disabled={this.state.buttonDraft}
onClick={() =>
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMasterBudget('draft')
})
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() => this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMasterBudget('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div> : null
}
</div>
</Paper>
......@@ -2254,9 +2275,9 @@ export default class ProfitLoss extends Component {
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
<button
<button
type="button"
onClick={() => this.setState({ loading: true, dataTable:[] }, () => {
onClick={() => this.setState({ loading: true, dataTable: [] }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 100);
......@@ -2269,7 +2290,7 @@ export default class ProfitLoss extends Component {
</button>
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
<button
className="button"
type="button"
disabled={this.state.buttonError}
......@@ -2303,8 +2324,8 @@ export default class ProfitLoss extends Component {
}}
onClick={() =>
this.state.editable === true ?
null :
this.setState({ loading: true}, () =>
null :
this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
......@@ -2326,10 +2347,10 @@ export default class ProfitLoss extends Component {
borderColor: 'transparent',
outline: 'none',
}}
onClick={() =>
onClick={() =>
this.state.editable === true ?
null :
this.setState({ loading: true}, () =>
null :
this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
......
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