Commit b11d2377 authored by rifkaki's avatar rifkaki

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into rifka

parents 9b29bddb bacc34b2
...@@ -427,7 +427,7 @@ export default class CashFlowMR extends Component { ...@@ -427,7 +427,7 @@ export default class CashFlowMR extends Component {
<div style={{ display: 'flex', justifyContent: 'space-between' }}> <div style={{ display: 'flex', justifyContent: 'space-between' }}>
<div> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.month.month_value} {this.props.periode} (rev.{this.props.revision})</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
......
...@@ -64,7 +64,10 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -64,7 +64,10 @@ export default class CorporateAnnualTargetMR extends Component {
getOptionLabel: (option) => titleCase(option.value), getOptionLabel: (option) => titleCase(option.value),
}, },
visibleCATMR: true, visibleCATMR: true,
updateBy: '-' updateBy: '-',
notes: "",
judulColumn: null,
get_for: "view"
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -76,6 +79,15 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -76,6 +79,15 @@ export default class CorporateAnnualTargetMR extends Component {
this.getMaxAch() this.getMaxAch()
} }
handleGetFor(type) {
this.setState({get_for: type}, () => {
this.getItemHierarki()
this.getLatestUpdate()
this.getKPIType()
this.getMaxAch()
})
}
getLatestUpdate() { getLatestUpdate() {
let payload = { let payload = {
"report_id": this.props.report_id, "report_id": this.props.report_id,
...@@ -91,7 +103,8 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -91,7 +103,8 @@ export default class CorporateAnnualTargetMR extends Component {
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update,
notes: response.data.data.notes_update === null ? "" : response.data.data.notes_update
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, typeAlert: 'warning', loading: false }, () => { this.setState({ alert: true, messageAlert: response.data.message, typeAlert: 'warning', loading: false }, () => {
...@@ -117,7 +130,8 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -117,7 +130,8 @@ export default class CorporateAnnualTargetMR extends Component {
"periode": "2021", "periode": "2021",
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId, "monthly_report_id": this.props.monthlyReportId,
"months": this.props.month.month_id "months": this.props.month.month_id,
"get_for": this.state.get_for
} }
api.create().getHierarkiMontlyReportCAT(payload).then(response => { api.create().getHierarkiMontlyReportCAT(payload).then(response => {
...@@ -194,7 +208,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -194,7 +208,7 @@ export default class CorporateAnnualTargetMR extends Component {
} }
}) })
// console.log(dataTable); // console.log(dataTable);
this.setState({ dataTable, loading: false }) this.setState({ dataTable, loading: false, saveDraft: true })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
...@@ -208,7 +222,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -208,7 +222,7 @@ export default class CorporateAnnualTargetMR extends Component {
} else { } else {
// console.log('terrrr') // console.log('terrrr')
// //
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false, saveDraft: true })
} }
console.log(dataTable); console.log(dataTable);
}) })
...@@ -216,10 +230,10 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -216,10 +230,10 @@ export default class CorporateAnnualTargetMR extends Component {
downloadTemplate = async () => { downloadTemplate = async () => {
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report/cat/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report/cat/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=2021`
) )
res = await res.blob()
console.log(res); console.log(res);
res = await res.blob()
if (res.size > 0) { if (res.size > 0) {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
let a = document.createElement('a'); let a = document.createElement('a');
...@@ -350,15 +364,15 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -350,15 +364,15 @@ export default class CorporateAnnualTargetMR extends Component {
}) })
}) })
let body = { let body = {
"monthly_report_id": this.props.monthlyReportId, // "monthly_report_id": this.props.monthlyReportId,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"periode": this.props.periode, "periode": "2021",
"report_id": this.props.report_id, "report_id": this.props.report_id,
"status": type, "status": type,
"months": this.props.month.month_id, "months": this.props.month.month_id,
"corporate_annual_target": data "corporate_annual_target": data
} }
console.log(data); console.log(JSON.stringify(body));
api.create('UPLOAD').uploadMonthlyReportCAT(body).then(response => { api.create('UPLOAD').uploadMonthlyReportCAT(body).then(response => {
// console.log(response); // console.log(response);
if (response.data) { if (response.data) {
...@@ -494,7 +508,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -494,7 +508,7 @@ export default class CorporateAnnualTargetMR extends Component {
let payload = { let payload = {
"monthly_report_id": this.props.monthlyReportId, "monthly_report_id": this.props.monthlyReportId,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"periode": this.props.periode, "periode": "2021",
"report_id": this.props.report_id, "report_id": this.props.report_id,
"status": type, "status": type,
"months": this.props.month.month_id, "months": this.props.month.month_id,
...@@ -926,12 +940,12 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -926,12 +940,12 @@ export default class CorporateAnnualTargetMR extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={Number(value).toFixed(1)} 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)}
disabled={false} disabled={this.state.get_for == 'view'}
decimalScale={1} decimalScale={1}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1119,11 +1133,11 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1119,11 +1133,11 @@ export default class CorporateAnnualTargetMR extends Component {
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 75, backgroundColor: 'transparent' }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 75, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
defaultValue={value} defaultValue={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.state.get_for == 'view'? true : 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) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -1178,7 +1192,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1178,7 +1192,7 @@ export default class CorporateAnnualTargetMR extends Component {
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template"> {this.state.get_for == 'edit' && <a data-tip={'Download Template'} data-for="template">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -1190,9 +1204,9 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1190,9 +1204,9 @@ export default class CorporateAnnualTargetMR extends Component {
> >
<img src={Images.template} /> <img src={Images.template} />
</button> </button>
</a> </a>}
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload'} data-for="upload"> {this.state.get_for == 'edit' && <a data-tip={'Upload'} data-for="upload">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -1204,7 +1218,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1204,7 +1218,7 @@ export default class CorporateAnnualTargetMR extends Component {
> >
<img src={Images.upload} /> <img src={Images.upload} />
</button> </button>
</a> </a>}
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Download'} data-for="download"> <a data-tip={'Download'} data-for="download">
<button <button
...@@ -1241,6 +1255,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1241,6 +1255,7 @@ export default class CorporateAnnualTargetMR extends Component {
)} )}
</div> </div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Notes : {this.state.notes}</Typography>
</div> </div>
<div className="grid grid-2x" style={{ marginTop: 20 }}> <div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1"> <div className="col-1">
...@@ -1267,7 +1282,27 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1267,7 +1282,27 @@ export default class CorporateAnnualTargetMR extends Component {
<div className="col-2"></div> <div className="col-2"></div>
: :
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button {this.state.get_for == 'view' && <button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({loading: true}, () => {
this.handleGetFor('edit')
})
}}
>
<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' }}>Edit</Typography>
</div>
</button>}
{this.state.get_for == 'edit' && <button
className="button" className="button"
type="button" type="button"
style={{ style={{
...@@ -1280,8 +1315,8 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1280,8 +1315,8 @@ export default class CorporateAnnualTargetMR extends Component {
onClick={() => { onClick={() => {
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false })
// this.handleValidate() // this.handleValidate()
this.setState({ loading: false })
}, 100); }, 100);
}) })
}} }}
...@@ -1289,38 +1324,43 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1289,38 +1324,43 @@ export default class CorporateAnnualTargetMR extends Component {
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> <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> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div> </div>
</button> </button>}
<button {this.state.get_for === 'edit' && <button
className="button" className="button"
type="button" type="button"
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default', cursor: this.state.saveDraft !== true ? 'pointer' : 'default',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => onClick={() =>
this.state.editable === true ? this.state.saveDraft === true ?
null : null :
this.state.handleTekTekTek === 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => { this.setState({ handleTekTekTek: 1 }, () => {
this.backToMonthlyReport('draft') this.backToMonthlyReport('draft')
}) })
} }
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
{this.state.saveDraft?
<LightTooltip title={"Data Incomplete"} arrow>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</LightTooltip> :
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
}
</div> </div>
</button> </button>}
<button {this.state.get_for === 'edit' && <button
type="button" type="button"
disabled={this.state.buttonError} disabled={this.state.buttonError}
onClick={() => onClick={() =>
this.state.buttonError ? this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
: :
this.state.handleTekTekTek === 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => { this.setState({ handleTekTekTek: 1 }, () => {
this.backToMonthlyReport('submitted') this.backToMonthlyReport('submitted')
})} })}
...@@ -1332,9 +1372,14 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1332,9 +1372,14 @@ export default class CorporateAnnualTargetMR extends Component {
}} }}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
{this.state.buttonError?
<LightTooltip title={"Data Incomplete"} arrow>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</LightTooltip> :
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
}
</div> </div>
</button> </button>}
</div> </div>
} }
</div> </div>
...@@ -1346,7 +1391,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1346,7 +1391,7 @@ export default class CorporateAnnualTargetMR extends Component {
<div style={{ padding: 20 }}> <div style={{ padding: 20 }}>
<div> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
...@@ -1360,13 +1405,13 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1360,13 +1405,13 @@ export default class CorporateAnnualTargetMR extends Component {
</MuiThemeProvider> </MuiThemeProvider>
)} )}
</div> </div>
<div className="grid grid-2x" style={{ marginTop: 20 }}> <div className="grid grid-2x" style={{ marginTop: 10, padding: 20 }}>
<div className="col-1"> <div className="col-1" style={{paddingLeft: 0}}>
<button <button
type="button" type="button"
onClick={() => this.setState({ loading: true }, () => { onClick={() => this.setState({ loading: true, visibleCATMR: true }, () => {
setTimeout(() => { setTimeout(() => {
this.props.onClickClose() this.getItemHierarki()
}, 100); }, 100);
})} })}
style={{ style={{
...@@ -1381,8 +1426,6 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1381,8 +1426,6 @@ export default class CorporateAnnualTargetMR extends Component {
</div> </div>
</button> </button>
</div> </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%' }}> <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button <button
className="button" className="button"
...@@ -1427,7 +1470,12 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1427,7 +1470,12 @@ export default class CorporateAnnualTargetMR extends Component {
} }
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
{this.state.saveDraft?
<LightTooltip title={"Data Incomplete"} arrow>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</LightTooltip> :
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
}
</div> </div>
</button> </button>
<button <button
......
...@@ -1374,7 +1374,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1374,7 +1374,7 @@ export default class FixedAssetsMovementMR extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5 }}>Notes : {this.state.notesUpdate}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5 }}>Notes : {this.state.notesUpdate}</Typography>
</div> </div>
<div className="grid grid-2x" style={{ padding: 20 }}> <div className="grid grid-2x" style={{ padding: 20 }}>
<div className="col-1" style={{ paddingLeft: 0, }}> <div className="col-1" style={{ paddingLeft: 0 }}>
<button <button
type="button" type="button"
onClick={() => this.setState({ loading: true }, () => { onClick={() => this.setState({ loading: true }, () => {
...@@ -1405,8 +1405,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1405,8 +1405,7 @@ export default class FixedAssetsMovementMR extends Component {
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none'
marginRight: 20
}} }}
onClick={() => { onClick={() => {
this.setState({loading: true}, () => { this.setState({loading: true}, () => {
...@@ -1524,7 +1523,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1524,7 +1523,7 @@ export default class FixedAssetsMovementMR extends Component {
)} )}
</div> </div>
<div className="grid grid-2x" style={{ marginTop: 20 }}> <div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1"> <div className="col-1" style={{ paddingLeft: 0 }}>
<button <button
type="button" type="button"
onClick={() => this.setState({ loading: true, visibleFAMMR: true }, () => { onClick={() => this.setState({ loading: true, visibleFAMMR: true }, () => {
...@@ -1546,7 +1545,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1546,7 +1545,7 @@ export default class FixedAssetsMovementMR extends Component {
</div> </div>
{/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null : {/* {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') ? */} (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%' }}> <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
<button <button
className="button" className="button"
type="button" type="button"
...@@ -1584,7 +1583,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1584,7 +1583,7 @@ export default class FixedAssetsMovementMR extends Component {
this.state.saveDraft === true ? this.state.saveDraft === true ?
null : null :
this.state.handleTekTekTek === 1 ? null : this.state.handleTekTekTek === 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => { this.setState({ handleTekTekTek: 1, loading: true }, () => {
this.uploadFAMMR('draft') this.uploadFAMMR('draft')
}) })
} }
...@@ -1607,7 +1606,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1607,7 +1606,7 @@ export default class FixedAssetsMovementMR extends Component {
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
: :
this.state.handleTekTekTek === 1 ? null : this.state.handleTekTekTek === 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => { this.setState({ handleTekTekTek: 1, loading: true }, () => {
this.uploadFAMMR('submitted') this.uploadFAMMR('submitted')
})} })}
style={{ style={{
......
...@@ -88,7 +88,8 @@ export default class ListOfCreditFacilities extends Component { ...@@ -88,7 +88,8 @@ export default class ListOfCreditFacilities extends Component {
snekbarMsg: '', snekbarMsg: '',
visibleLOCFMR: true, visibleLOCFMR: true,
saveDraft: true, saveDraft: true,
saveComp: true saveComp: true,
get_for: 'view'
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -99,6 +100,14 @@ export default class ListOfCreditFacilities extends Component { ...@@ -99,6 +100,14 @@ export default class ListOfCreditFacilities extends Component {
this.getSubmission() this.getSubmission()
} }
handleGetFor(type) {
this.setState({get_for: type}, () => {
this.getBankData()
this.getTypeOfCredit()
this.getSubmission()
})
}
getItemHierarki() { getItemHierarki() {
let payload = { let payload = {
"report_id": this.props.report_id, "report_id": this.props.report_id,
...@@ -106,7 +115,8 @@ export default class ListOfCreditFacilities extends Component { ...@@ -106,7 +115,8 @@ export default class ListOfCreditFacilities extends Component {
"periode": this.props.periode, "periode": this.props.periode,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId, "monthly_report_id": this.props.monthlyReportId,
"months": this.props.month.month_id "months": this.props.month.month_id,
"get_for": this.state.get_for
} }
api.create().getHierarkiMontlyReportLOCF(payload).then(response => { api.create().getHierarkiMontlyReportLOCF(payload).then(response => {
console.log(payload); console.log(payload);
...@@ -298,7 +308,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -298,7 +308,7 @@ export default class ListOfCreditFacilities extends Component {
// } // }
}) })
// console.log(dataTable); // console.log(dataTable);
if (dataTable.length == 0) { if (dataTable.length == 0 && this.state.get_for == 'edit') {
dataTable.push( dataTable.push(
[3, "", "", "", "", this.props.company.company_name, null, null, "", this.state.currentDate, "", "0", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "notes", 0 ], [3, "", "", "", "", this.props.company.company_name, null, null, "", this.state.currentDate, "", "0", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "notes", 0 ],
[9, "", "", "", "", "", {value: "Grand Total"}, null, "", "", "", "0", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "notes", 999999 ], [9, "", "", "", "", "", {value: "Grand Total"}, null, "", "", "", "0", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "notes", 999999 ],
...@@ -1461,7 +1471,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1461,7 +1471,7 @@ export default class ListOfCreditFacilities extends Component {
name: "", name: "",
options: { options: {
filter: false, filter: false,
display: true, display: this.state.get_for == 'view'? false : true,
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 99, backgroundColor: '#dbdbdb' }}> <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 99, backgroundColor: '#dbdbdb' }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
...@@ -1554,12 +1564,13 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1554,12 +1564,13 @@ export default class ListOfCreditFacilities extends Component {
onChange={(event, newInputValue) => handleChange(newInputValue, tableMeta, tableMeta.columnIndex)} onChange={(event, newInputValue) => handleChange(newInputValue, tableMeta, tableMeta.columnIndex)}
debug debug
disableClearable disableClearable
disabled={this.state.get_for == 'view'}
// disabled={!handleAction(tableMeta.rowData[2], tableMeta.rowData[0])} // disabled={!handleAction(tableMeta.rowData[2], tableMeta.rowData[0])}
value={handleValueDropDown(val, 'bankName', tableMeta)} value={handleValueDropDown(val, 'bankName', tableMeta)}
style={{ padding: 0, margin: 0}} style={{ padding: 0, margin: 0}}
renderInput={(params) => renderInput={(params) =>
<div ref={params.InputProps.ref} style={{ padding: 0, margin: 0 }}> <div ref={params.InputProps.ref} style={{ padding: 0, margin: 0 }}>
<textarea style={{ borderColor: 'white', width: 150, textAlign: 'center', justifyContent:'center', padding: 0, margin: 0, color: "#5198ea" }} type="text" {...params.inputProps} /> <textarea style={{ borderColor: 'white', width: 150, textAlign: 'center', justifyContent:'center', padding: 0, margin: 0, color: this.state.get_for == 'view'? "black" : "#5198ea" }} type="text" {...params.inputProps} />
</div> </div>
} }
/> />
...@@ -1589,11 +1600,12 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1589,11 +1600,12 @@ export default class ListOfCreditFacilities extends Component {
debug debug
value={handleValueDropDown(val, 'typeOfCreditList', tableMeta)} value={handleValueDropDown(val, 'typeOfCreditList', tableMeta)}
disableClearable disableClearable
disabled={this.state.get_for == 'view'}
// disabled={!handleAction(tableMeta.rowData[2], tableMeta.rowData[0])} // disabled={!handleAction(tableMeta.rowData[2], tableMeta.rowData[0])}
style={{ padding: 0, margin: 0 }} style={{ padding: 0, margin: 0 }}
renderInput={(params) => renderInput={(params) =>
<div ref={params.InputProps.ref} style={{ padding: 0, margin: 0 }}> <div ref={params.InputProps.ref} style={{ padding: 0, margin: 0 }}>
<textarea style={{ borderColor: 'white', width: 96, textAlign: 'center', justifyContent:'center', padding: 0, margin: 0, color: "#5198ea" }} type="text" {...params.inputProps} /> <textarea style={{ borderColor: 'white', width: 96, textAlign: 'center', justifyContent:'center', padding: 0, margin: 0, color: this.state.get_for == 'view'? "black" : "#5198ea" }} type="text" {...params.inputProps} />
</div> </div>
} }
/> />
...@@ -1617,13 +1629,13 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1617,13 +1629,13 @@ export default class ListOfCreditFacilities extends Component {
{ tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9? { tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null : null :
<div style={{ padding: 0, margin: 0 }}> <div style={{ padding: 0, margin: 0 }}>
<textarea style={{ borderColor: 'white', width: 96, textAlign: 'center', justifyContent:'center', padding: 0, margin: 0, color: "#5198ea" }} type="text" defaultValue={tableMeta.rowData[8]} <textarea disabled={this.state.get_for == 'view'} style={{ borderColor: 'white', width: 96, textAlign: 'center', justifyContent:'center', padding: 0, margin: 0, color: this.state.get_for == 'view'? "black" : "#5198ea" }} type="text" defaultValue={tableMeta.rowData[8]}
onBlur={(event) => handleChange(event.target.value, tableMeta, tableMeta.columnIndex)} /> onBlur={(event) => handleChange(event.target.value, tableMeta, tableMeta.columnIndex)} />
</div> </div>
// <ThemeProvider theme={theme}> // <ThemeProvider theme={theme}>
// <Input // <Input
// disableUnderline={true} // disableUnderline={true}
// style={{color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginBottom: -105 }} // style={{color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginBottom: -105 }}
// type="text" // type="text"
// placeholder="" // placeholder=""
// disabled={tableMeta.rowData[0] == 8 || tableMeta.rowData[0] == 9? true : false} // disabled={tableMeta.rowData[0] == 8 || tableMeta.rowData[0] == 9? true : false}
...@@ -1664,6 +1676,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1664,6 +1676,7 @@ export default class ListOfCreditFacilities extends Component {
// label="Valid To" // label="Valid To"
format="dd-MM-yyyy" format="dd-MM-yyyy"
value={val} value={val}
disabled={this.state.get_for == 'view'}
onChange={(e) => handleChange(e, tableMeta, tableMeta.columnIndex, 'date')} onChange={(e) => handleChange(e, tableMeta, tableMeta.columnIndex, 'date')}
// minDate={this.state.startDate} // minDate={this.state.startDate}
KeyboardButtonProps={{ KeyboardButtonProps={{
...@@ -1712,10 +1725,11 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1712,10 +1725,11 @@ export default class ListOfCreditFacilities extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={Number(value).toFixed(2)} value={Number(value).toFixed(2)}
disabled={this.state.get_for == 'view'}
// 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={2} decimalScale={2}
onBlur={(event) => { onBlur={(event) => {
...@@ -1748,10 +1762,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1748,10 +1762,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[11]} defaultValue={tableMeta.rowData[11]}
onBlur={(event) => { onBlur={(event) => {
// // // console.log(event.target.value) // // // console.log(event.target.value)
...@@ -1825,10 +1839,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1825,10 +1839,10 @@ export default class ListOfCreditFacilities extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
value={Number(tableMeta.rowData[12]).toFixed(1) == 0.0 ? "0.0" : Number(tableMeta.rowData[12]).toFixed(1)} value={Number(tableMeta.rowData[12]).toFixed(1) == 0.0 ? "0.0" : Number(tableMeta.rowData[12]).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta, 12) handleChange(event.target.value, tableMeta, 12)
...@@ -1870,10 +1884,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1870,10 +1884,10 @@ export default class ListOfCreditFacilities extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
value={Number(tableMeta.rowData[13]).toFixed(1)} value={Number(tableMeta.rowData[13]).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta, 13) handleChange(event.target.value, tableMeta, 13)
...@@ -1953,7 +1967,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1953,7 +1967,7 @@ export default class ListOfCreditFacilities extends Component {
style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Investment Loan'? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Investment Loan'? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Investment Loan'? false : true} disabled={this.state.get_for == 'view'? true : tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Investment Loan'? false : true}
value={Number(tableMeta.rowData[14]).toFixed(1)} value={Number(tableMeta.rowData[14]).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta, 14) handleChange(event.target.value, tableMeta, 14)
...@@ -1997,7 +2011,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1997,7 +2011,7 @@ export default class ListOfCreditFacilities extends Component {
style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Investment Loan'? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Investment Loan'? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Investment Loan'? false : true} disabled={this.state.get_for == 'view'? true : tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Investment Loan'? false : true}
value={Number(tableMeta.rowData[15]).toFixed(1)} value={Number(tableMeta.rowData[15]).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta, 15) handleChange(event.target.value, tableMeta, 15)
...@@ -2076,7 +2090,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2076,7 +2090,7 @@ export default class ListOfCreditFacilities extends Component {
style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Revolving Loan (KMK)'? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Revolving Loan (KMK)'? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Revolving Loan (KMK)'? false : true} disabled={this.state.get_for == 'view'? true : tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Revolving Loan (KMK)'? false : true}
value={Number(tableMeta.rowData[16]).toFixed(1)} value={Number(tableMeta.rowData[16]).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta, 16) handleChange(event.target.value, tableMeta, 16)
...@@ -2120,7 +2134,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2120,7 +2134,7 @@ export default class ListOfCreditFacilities extends Component {
style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Revolving Loan (KMK)'? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Revolving Loan (KMK)'? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Revolving Loan (KMK)'? false : true} disabled={this.state.get_for == 'view'? true : tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Revolving Loan (KMK)'? false : true}
value={Number(tableMeta.rowData[17]).toFixed(1)} value={Number(tableMeta.rowData[17]).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta, 17) handleChange(event.target.value, tableMeta, 17)
...@@ -2200,7 +2214,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2200,7 +2214,7 @@ export default class ListOfCreditFacilities extends Component {
style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Others'? "#5198ea" : "black", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }} style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Others'? "#5198ea" : "black", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
type="text" type="text"
placeholder="" placeholder=""
disabled={tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Others'? false : true} disabled={this.state.get_for == 'view'? true : tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Others'? false : true}
defaultValue={tableMeta.rowData[18]} defaultValue={tableMeta.rowData[18]}
onBlur={(event) => { onBlur={(event) => {
// // // console.log(event.target.value) // // // console.log(event.target.value)
...@@ -2246,7 +2260,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2246,7 +2260,7 @@ export default class ListOfCreditFacilities extends Component {
style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Others'? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Others'? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Others'? false : true} disabled={this.state.get_for == 'view'? true : tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Others'? false : true}
value={Number(tableMeta.rowData[19]).toFixed(1)} value={Number(tableMeta.rowData[19]).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta, 19) handleChange(event.target.value, tableMeta, 19)
...@@ -2290,7 +2304,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2290,7 +2304,7 @@ export default class ListOfCreditFacilities extends Component {
style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Others'? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Others'? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
value={Number(tableMeta.rowData[20]).toFixed(1)} value={Number(tableMeta.rowData[20]).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta, 20) handleChange(event.target.value, tableMeta, 20)
...@@ -2574,10 +2588,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2574,10 +2588,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[25]} defaultValue={tableMeta.rowData[25]}
onBlur={(event) => { onBlur={(event) => {
// // // console.log(event.target.value) // // // console.log(event.target.value)
...@@ -2654,10 +2668,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2654,10 +2668,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[27]} defaultValue={tableMeta.rowData[27]}
onBlur={(event) => { onBlur={(event) => {
// // // console.log(event.target.value) // // // console.log(event.target.value)
...@@ -2734,10 +2748,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2734,10 +2748,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[29]} defaultValue={tableMeta.rowData[29]}
onBlur={(event) => { onBlur={(event) => {
// // // console.log(event.target.value) // // // console.log(event.target.value)
...@@ -2814,10 +2828,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2814,10 +2828,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[31]} defaultValue={tableMeta.rowData[31]}
onBlur={(event) => { onBlur={(event) => {
// // // console.log(event.target.value) // // // console.log(event.target.value)
...@@ -2897,10 +2911,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2897,10 +2911,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[33]} defaultValue={tableMeta.rowData[33]}
onBlur={(event) => { onBlur={(event) => {
// // // console.log(event.target.value) // // // console.log(event.target.value)
...@@ -2922,10 +2936,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2922,10 +2936,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[34]} defaultValue={tableMeta.rowData[34]}
onBlur={(event) => { onBlur={(event) => {
// // // console.log(event.target.value) // // // console.log(event.target.value)
...@@ -2950,10 +2964,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -2950,10 +2964,10 @@ export default class ListOfCreditFacilities extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
value={Number(tableMeta.rowData[35]).toFixed(1)} value={Number(tableMeta.rowData[35]).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta, 35) handleChange(event.target.value, tableMeta, 35)
...@@ -3008,10 +3022,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3008,10 +3022,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[36]} defaultValue={tableMeta.rowData[36]}
onBlur={(event) => { onBlur={(event) => {
// // // console.log(event.target.value) // // // console.log(event.target.value)
...@@ -3033,10 +3047,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3033,10 +3047,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[37]} defaultValue={tableMeta.rowData[37]}
onBlur={(event) => { onBlur={(event) => {
// // // console.log(event.target.value) // // // console.log(event.target.value)
...@@ -3061,10 +3075,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3061,10 +3075,10 @@ export default class ListOfCreditFacilities extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
value={Number(tableMeta.rowData[38]).toFixed(1)} value={Number(tableMeta.rowData[38]).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta, 20) handleChange(event.target.value, tableMeta, 20)
...@@ -3119,10 +3133,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3119,10 +3133,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[39]} defaultValue={tableMeta.rowData[39]}
onBlur={(event) => { onBlur={(event) => {
// // // console.log(event.target.value) // // // console.log(event.target.value)
...@@ -3144,10 +3158,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3144,10 +3158,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[40]} defaultValue={tableMeta.rowData[40]}
onBlur={(event) => { onBlur={(event) => {
// // // console.log(event.target.value) // // // console.log(event.target.value)
...@@ -3172,10 +3186,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3172,10 +3186,10 @@ export default class ListOfCreditFacilities extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
value={Number(tableMeta.rowData[41]).toFixed(1)} value={Number(tableMeta.rowData[41]).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta, 20) handleChange(event.target.value, tableMeta, 20)
...@@ -3230,10 +3244,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3230,10 +3244,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[42]} defaultValue={tableMeta.rowData[42]}
onBlur={(event) => { onBlur={(event) => {
// // // console.log(event.target.value) // // // console.log(event.target.value)
...@@ -3255,10 +3269,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3255,10 +3269,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[43]} defaultValue={tableMeta.rowData[43]}
onBlur={(event) => { onBlur={(event) => {
// // // console.log(event.target.value) // // // console.log(event.target.value)
...@@ -3283,10 +3297,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3283,10 +3297,10 @@ export default class ListOfCreditFacilities extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
value={Number(tableMeta.rowData[20]).toFixed(1)} value={Number(tableMeta.rowData[20]).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta, 20) handleChange(event.target.value, tableMeta, 20)
...@@ -3320,10 +3334,10 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3320,10 +3334,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[45]} defaultValue={tableMeta.rowData[45]}
onBlur={(event) => { onBlur={(event) => {
// // // console.log(event.target.value) // // // console.log(event.target.value)
...@@ -3493,7 +3507,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3493,7 +3507,7 @@ export default class ListOfCreditFacilities extends Component {
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <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')) && ( */} {(this.state.get_for == 'edit' && (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> <div>
<a data-tip={'Download Template'} data-for="template"> <a data-tip={'Download Template'} data-for="template">
<button <button
...@@ -3510,8 +3524,8 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3510,8 +3524,8 @@ export default class ListOfCreditFacilities extends Component {
</a> </a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
</div> </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')) && ( */} {(this.state.get_for == 'edit' && (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> <div>
<a data-tip={'Upload'} data-for="upload"> <a data-tip={'Upload'} data-for="upload">
<button <button
...@@ -3530,7 +3544,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3530,7 +3544,7 @@ export default class ListOfCreditFacilities extends Component {
</a> </a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
</div> </div>
{/* )} */} )}
<a data-tip={'Download'} data-for="download"> <a data-tip={'Download'} data-for="download">
<button <button
style={{ style={{
...@@ -3609,10 +3623,31 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3609,10 +3623,31 @@ export default class ListOfCreditFacilities extends Component {
</div> </div>
</button> </button>
</div> </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') ? */}
(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') ? */}
{this.props.isApprover === true ? null :
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button {this.state.get_for == 'view' && <button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({loading: true}, () => {
this.handleGetFor('edit')
})
}}
>
<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' }}>Edit</Typography>
</div>
</button>}
{this.state.get_for == 'edit' && <button
className="button" className="button"
type="button" type="button"
style={{ style={{
...@@ -3629,8 +3664,8 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3629,8 +3664,8 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> <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> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div> </div>
</button> </button>}
<button {this.state.get_for == 'edit' && <button
className="button" className="button"
type="button" type="button"
onClick={() => onClick={() =>
...@@ -3658,8 +3693,8 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3658,8 +3693,8 @@ export default class ListOfCreditFacilities extends Component {
: :
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>} <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>}
</div> </div>
</button> </button>}
<button {this.state.get_for == 'edit' && <button
type="button" type="button"
// disabled={this.state.buttonError} // disabled={this.state.buttonError}
onClick={() => onClick={() =>
...@@ -3687,8 +3722,8 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3687,8 +3722,8 @@ export default class ListOfCreditFacilities extends Component {
: :
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>} <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>}
</div> </div>
</button> </button>}
</div> </div>}
{/* : null } */} {/* : null } */}
</div> </div>
</Paper> </Paper>
......
...@@ -62,7 +62,8 @@ export default class OperatingIndicatorMR extends Component { ...@@ -62,7 +62,8 @@ export default class OperatingIndicatorMR extends Component {
disabledSave: true, disabledSave: true,
editable: true, editable: true,
emptyData: false, emptyData: false,
templateNull: true templateNull: true,
get_for: 'view'
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -73,6 +74,13 @@ export default class OperatingIndicatorMR extends Component { ...@@ -73,6 +74,13 @@ export default class OperatingIndicatorMR extends Component {
this.getLatestUpdate() this.getLatestUpdate()
} }
handleGetFor(type) {
this.setState({get_for: type}, () => {
this.getSettingControl()
this.getLatestUpdate()
})
}
getLatestUpdate() { getLatestUpdate() {
let payload = { let payload = {
"operating_indicator_id": this.props.data.operatingIndID, "operating_indicator_id": this.props.data.operatingIndID,
...@@ -166,7 +174,8 @@ export default class OperatingIndicatorMR extends Component { ...@@ -166,7 +174,8 @@ export default class OperatingIndicatorMR extends Component {
"report_id": this.props.data.report_id, "report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id, "company_id": this.props.data.company.company_id,
"periode": this.props.data.periode, "periode": this.props.data.periode,
"months": this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null "months": this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null,
"get_for": this.state.get_for
} }
api.create().getHierarkiMontlyReportOI(payload).then(response => { api.create().getHierarkiMontlyReportOI(payload).then(response => {
console.log(response); console.log(response);
...@@ -978,10 +987,10 @@ export default class OperatingIndicatorMR extends Component { ...@@ -978,10 +987,10 @@ export default class OperatingIndicatorMR extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit} disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit || this.state.get_for == 'view'}
value={Number(tableMeta.rowData[10]).toFixed(1)} value={Number(tableMeta.rowData[10]).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -1247,10 +1256,11 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1247,10 +1256,11 @@ export default class OperatingIndicatorMR extends Component {
type="text" type="text"
placeholder="" placeholder=""
// disabled={false} // disabled={false}
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[15]} defaultValue={tableMeta.rowData[15]}
inputProps={{ inputProps={{
style: { style: {
color: "#5198ea", color: this.state.get_for == 'view'? "black" : "#5198ea",
textAlign: 'right', textAlign: 'right',
backgroundColor: '#ffac99' backgroundColor: '#ffac99'
} }
...@@ -1266,6 +1276,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1266,6 +1276,7 @@ export default class OperatingIndicatorMR extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[15]} defaultValue={tableMeta.rowData[15]}
inputProps={{ inputProps={{
style: { style: {
...@@ -1296,11 +1307,11 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1296,11 +1307,11 @@ export default class OperatingIndicatorMR extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
// disabled={false} disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[16]} defaultValue={tableMeta.rowData[16]}
inputProps={{ inputProps={{
style: { style: {
color: "#5198ea", color: this.state.get_for == 'view'? "black" : "#5198ea",
textAlign: 'right', textAlign: 'right',
backgroundColor: '#ffac99' backgroundColor: '#ffac99'
} }
...@@ -1317,6 +1328,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1317,6 +1328,7 @@ export default class OperatingIndicatorMR extends Component {
type="text" type="text"
placeholder="" placeholder=""
defaultValue={tableMeta.rowData[16]} defaultValue={tableMeta.rowData[16]}
disabled={this.state.get_for == 'view'}
inputProps={{ inputProps={{
style: { style: {
color: Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? "#5198ea" : '#5198ea', color: Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? "#5198ea" : '#5198ea',
...@@ -1391,7 +1403,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1391,7 +1403,7 @@ export default class OperatingIndicatorMR extends Component {
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
{(this.props.permission.create || this.props.permission.edit) && this.props.isSubmit && <a data-tip={'Download Template'} data-for="template"> {this.state.get_for == 'edit' && (this.props.permission.create || this.props.permission.edit) && this.props.isSubmit && <a data-tip={'Download Template'} data-for="template">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -1405,7 +1417,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1405,7 +1417,7 @@ export default class OperatingIndicatorMR extends Component {
</button> </button>
</a>} </a>}
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
{(this.props.permission.create || this.props.permission.edit) && this.props.isSubmit && <a data-tip={'Upload'} data-for="upload"> {this.state.get_for == 'edit' && (this.props.permission.create || this.props.permission.edit) && this.props.isSubmit && <a data-tip={'Upload'} data-for="upload">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -1473,7 +1485,20 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1473,7 +1485,20 @@ export default class OperatingIndicatorMR extends Component {
</button> </button>
</div> </div>
{!this.state.emptyData && (this.props.permission.create || this.props.permission.edit) && this.props.isSubmit && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> {!this.state.emptyData && (this.props.permission.create || this.props.permission.edit) && this.props.isSubmit && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button {this.state.get_for == 'view' && <button
type="button"
onClick={() => {
this.setState({loading: true}, () => {
this.handleGetFor('edit')
})
}}
style={{ marginRight: 20 }}
>
<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' }}>Edit</Typography>
</div>
</button>}
{this.state.get_for == 'edit' && <button
type="button" type="button"
onClick={() => onClick={() =>
this.setState({ loading: true, editable: false }, () => { this.setState({ loading: true, editable: false }, () => {
...@@ -1488,8 +1513,8 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1488,8 +1513,8 @@ export default class OperatingIndicatorMR extends Component {
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> <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> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div> </div>
</button> </button>}
<button {this.state.get_for == 'edit' && <button
className="button" className="button"
type="button" type="button"
disabled={this.state.editable} disabled={this.state.editable}
...@@ -1515,8 +1540,8 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1515,8 +1540,8 @@ export default class OperatingIndicatorMR extends Component {
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
} }
</div> </div>
</button> </button>}
<button {this.state.get_for == 'edit' && <button
type="button" type="button"
disabled={this.state.editable} disabled={this.state.editable}
onClick={() => this.setState({ loading: true }, () => { onClick={() => this.setState({ loading: true }, () => {
...@@ -1541,7 +1566,7 @@ export default class OperatingIndicatorMR extends Component { ...@@ -1541,7 +1566,7 @@ export default class OperatingIndicatorMR extends Component {
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
} }
</div> </div>
</button> </button>}
</div>} </div>}
</div> </div>
</Paper> </Paper>
......
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