Commit 71f98ddc authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

apdet banyak

See merge request !852
parents 4ab8d715 1c549820
......@@ -427,7 +427,7 @@ export default class CashFlowMR extends Component {
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<div>
<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>
</div>
<div style={{ width: '50%' }}>
......
......@@ -81,8 +81,10 @@ export default class CorporateAnnualTargetMR extends Component {
handleGetFor(type) {
this.setState({get_for: type}, () => {
this.getLatestUpdate()
this.getItemHierarki()
this.getLatestUpdate()
this.getKPIType()
this.getMaxAch()
})
}
......@@ -128,7 +130,8 @@ export default class CorporateAnnualTargetMR extends Component {
"periode": "2021",
"company_id": this.props.company.company_id,
"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 => {
......@@ -937,12 +940,12 @@ export default class CorporateAnnualTargetMR extends Component {
control={
<NumberFormat
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"
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={false}
disabled={this.state.get_for == 'view'}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -1130,11 +1133,11 @@ export default class CorporateAnnualTargetMR extends Component {
<ThemeProvider theme={theme}>
<Input
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"
placeholder=""
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) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1189,7 +1192,7 @@ export default class CorporateAnnualTargetMR extends Component {
</div>
<div style={{ width: '50%' }}>
<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
style={{
backgroundColor: 'transparent',
......@@ -1201,9 +1204,9 @@ export default class CorporateAnnualTargetMR extends Component {
>
<img src={Images.template} />
</button>
</a>
</a>}
<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
style={{
backgroundColor: 'transparent',
......@@ -1215,7 +1218,7 @@ export default class CorporateAnnualTargetMR extends Component {
>
<img src={Images.upload} />
</button>
</a>
</a>}
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Download'} data-for="download">
<button
......
......@@ -88,7 +88,8 @@ export default class ListOfCreditFacilities extends Component {
snekbarMsg: '',
visibleLOCFMR: true,
saveDraft: true,
saveComp: true
saveComp: true,
get_for: 'view'
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -99,6 +100,14 @@ export default class ListOfCreditFacilities extends Component {
this.getSubmission()
}
handleGetFor(type) {
this.setState({get_for: type}, () => {
this.getBankData()
this.getTypeOfCredit()
this.getSubmission()
})
}
getItemHierarki() {
let payload = {
"report_id": this.props.report_id,
......@@ -106,7 +115,8 @@ export default class ListOfCreditFacilities extends Component {
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"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 => {
console.log(payload);
......@@ -298,7 +308,7 @@ export default class ListOfCreditFacilities extends Component {
// }
})
// console.log(dataTable);
if (dataTable.length == 0) {
if (dataTable.length == 0 && this.state.get_for == 'edit') {
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 ],
[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 {
name: "",
options: {
filter: false,
display: true,
display: this.state.get_for == 'view'? false : true,
customHeadRender: (columnMeta) => (
<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>
......@@ -1554,12 +1564,13 @@ export default class ListOfCreditFacilities extends Component {
onChange={(event, newInputValue) => handleChange(newInputValue, tableMeta, tableMeta.columnIndex)}
debug
disableClearable
disabled={this.state.get_for == 'view'}
// disabled={!handleAction(tableMeta.rowData[2], tableMeta.rowData[0])}
value={handleValueDropDown(val, 'bankName', tableMeta)}
style={{ padding: 0, margin: 0}}
renderInput={(params) =>
<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>
}
/>
......@@ -1589,11 +1600,12 @@ export default class ListOfCreditFacilities extends Component {
debug
value={handleValueDropDown(val, 'typeOfCreditList', tableMeta)}
disableClearable
disabled={this.state.get_for == 'view'}
// disabled={!handleAction(tableMeta.rowData[2], tableMeta.rowData[0])}
style={{ padding: 0, margin: 0 }}
renderInput={(params) =>
<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>
}
/>
......@@ -1617,13 +1629,13 @@ export default class ListOfCreditFacilities extends Component {
{ tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null :
<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)} />
</div>
// <ThemeProvider theme={theme}>
// <Input
// 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"
// placeholder=""
// disabled={tableMeta.rowData[0] == 8 || tableMeta.rowData[0] == 9? true : false}
......@@ -1664,6 +1676,7 @@ export default class ListOfCreditFacilities extends Component {
// label="Valid To"
format="dd-MM-yyyy"
value={val}
disabled={this.state.get_for == 'view'}
onChange={(e) => handleChange(e, tableMeta, tableMeta.columnIndex, 'date')}
// minDate={this.state.startDate}
KeyboardButtonProps={{
......@@ -1712,10 +1725,11 @@ export default class ListOfCreditFacilities extends Component {
control={
<NumberFormat
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"
placeholder=""
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)}
decimalScale={2}
onBlur={(event) => {
......@@ -1748,10 +1762,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}>
<Input
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"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[11]}
onBlur={(event) => {
// // // console.log(event.target.value)
......@@ -1825,10 +1839,10 @@ export default class ListOfCreditFacilities extends Component {
control={
<NumberFormat
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"
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)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 12)
......@@ -1870,10 +1884,10 @@ export default class ListOfCreditFacilities extends Component {
control={
<NumberFormat
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"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
value={Number(tableMeta.rowData[13]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 13)
......@@ -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' }}
type="text"
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)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 14)
......@@ -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' }}
type="text"
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)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 15)
......@@ -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' }}
type="text"
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)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 16)
......@@ -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' }}
type="text"
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)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 17)
......@@ -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 }}
type="text"
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]}
onBlur={(event) => {
// // // console.log(event.target.value)
......@@ -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' }}
type="text"
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)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 19)
......@@ -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' }}
type="text"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
value={Number(tableMeta.rowData[20]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 20)
......@@ -2574,10 +2588,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}>
<Input
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"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[25]}
onBlur={(event) => {
// // // console.log(event.target.value)
......@@ -2654,10 +2668,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}>
<Input
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"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[27]}
onBlur={(event) => {
// // // console.log(event.target.value)
......@@ -2734,10 +2748,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}>
<Input
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"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[29]}
onBlur={(event) => {
// // // console.log(event.target.value)
......@@ -2814,10 +2828,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}>
<Input
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"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[31]}
onBlur={(event) => {
// // // console.log(event.target.value)
......@@ -2897,10 +2911,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}>
<Input
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"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[33]}
onBlur={(event) => {
// // // console.log(event.target.value)
......@@ -2922,10 +2936,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}>
<Input
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"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[34]}
onBlur={(event) => {
// // // console.log(event.target.value)
......@@ -2950,10 +2964,10 @@ export default class ListOfCreditFacilities extends Component {
control={
<NumberFormat
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"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
value={Number(tableMeta.rowData[35]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 35)
......@@ -3008,10 +3022,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}>
<Input
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"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[36]}
onBlur={(event) => {
// // // console.log(event.target.value)
......@@ -3033,10 +3047,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}>
<Input
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"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[37]}
onBlur={(event) => {
// // // console.log(event.target.value)
......@@ -3061,10 +3075,10 @@ export default class ListOfCreditFacilities extends Component {
control={
<NumberFormat
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"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
value={Number(tableMeta.rowData[38]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 20)
......@@ -3119,10 +3133,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}>
<Input
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"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[39]}
onBlur={(event) => {
// // // console.log(event.target.value)
......@@ -3144,10 +3158,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}>
<Input
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"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[40]}
onBlur={(event) => {
// // // console.log(event.target.value)
......@@ -3172,10 +3186,10 @@ export default class ListOfCreditFacilities extends Component {
control={
<NumberFormat
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"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
value={Number(tableMeta.rowData[41]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 20)
......@@ -3230,10 +3244,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}>
<Input
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"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[42]}
onBlur={(event) => {
// // // console.log(event.target.value)
......@@ -3255,10 +3269,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}>
<Input
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"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[43]}
onBlur={(event) => {
// // // console.log(event.target.value)
......@@ -3283,10 +3297,10 @@ export default class ListOfCreditFacilities extends Component {
control={
<NumberFormat
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"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
value={Number(tableMeta.rowData[20]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 20)
......@@ -3320,10 +3334,10 @@ export default class ListOfCreditFacilities extends Component {
<ThemeProvider theme={theme}>
<Input
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"
placeholder=""
disabled={false}
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[45]}
onBlur={(event) => {
// // // console.log(event.target.value)
......@@ -3493,7 +3507,7 @@ export default class ListOfCreditFacilities extends Component {
</div>
<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')) && ( */}
{(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>
<a data-tip={'Download Template'} data-for="template">
<button
......@@ -3510,8 +3524,8 @@ export default class ListOfCreditFacilities extends Component {
</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')) && ( */}
)}
{(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>
<a data-tip={'Upload'} data-for="upload">
<button
......@@ -3530,7 +3544,7 @@ export default class ListOfCreditFacilities extends Component {
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
</div>
{/* )} */}
)}
<a data-tip={'Download'} data-for="download">
<button
style={{
......@@ -3609,10 +3623,31 @@ export default class ListOfCreditFacilities extends Component {
</div>
</button>
</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%' }}>
<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"
type="button"
style={{
......@@ -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' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
</button>}
{this.state.get_for == 'edit' && <button
className="button"
type="button"
onClick={() =>
......@@ -3658,8 +3693,8 @@ export default class ListOfCreditFacilities extends Component {
:
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>}
</div>
</button>
<button
</button>}
{this.state.get_for == 'edit' && <button
type="button"
// disabled={this.state.buttonError}
onClick={() =>
......@@ -3687,8 +3722,8 @@ export default class ListOfCreditFacilities extends Component {
:
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>}
</div>
</button>
</div>
</button>}
</div>}
{/* : null } */}
</div>
</Paper>
......
......@@ -62,7 +62,8 @@ export default class OperatingIndicatorMR extends Component {
disabledSave: true,
editable: true,
emptyData: false,
templateNull: true
templateNull: true,
get_for: 'view'
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -73,6 +74,13 @@ export default class OperatingIndicatorMR extends Component {
this.getLatestUpdate()
}
handleGetFor(type) {
this.setState({get_for: type}, () => {
this.getSettingControl()
this.getLatestUpdate()
})
}
getLatestUpdate() {
let payload = {
"operating_indicator_id": this.props.data.operatingIndID,
......@@ -166,7 +174,8 @@ export default class OperatingIndicatorMR extends Component {
"report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id,
"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 => {
console.log(response);
......@@ -978,10 +987,10 @@ export default class OperatingIndicatorMR extends Component {
control={
<NumberFormat
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"
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)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -1247,10 +1256,11 @@ export default class OperatingIndicatorMR extends Component {
type="text"
placeholder=""
// disabled={false}
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[15]}
inputProps={{
style: {
color: "#5198ea",
color: this.state.get_for == 'view'? "black" : "#5198ea",
textAlign: 'right',
backgroundColor: '#ffac99'
}
......@@ -1266,6 +1276,7 @@ export default class OperatingIndicatorMR extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[15]}
inputProps={{
style: {
......@@ -1296,11 +1307,11 @@ export default class OperatingIndicatorMR extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
// disabled={false}
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[16]}
inputProps={{
style: {
color: "#5198ea",
color: this.state.get_for == 'view'? "black" : "#5198ea",
textAlign: 'right',
backgroundColor: '#ffac99'
}
......@@ -1317,6 +1328,7 @@ export default class OperatingIndicatorMR extends Component {
type="text"
placeholder=""
defaultValue={tableMeta.rowData[16]}
disabled={this.state.get_for == 'view'}
inputProps={{
style: {
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 {
</div>
<div style={{ width: '50%' }}>
<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
style={{
backgroundColor: 'transparent',
......@@ -1405,7 +1417,7 @@ export default class OperatingIndicatorMR extends Component {
</button>
</a>}
<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
style={{
backgroundColor: 'transparent',
......@@ -1473,7 +1485,20 @@ export default class OperatingIndicatorMR extends Component {
</button>
</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%' }}>
<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"
onClick={() =>
this.setState({ loading: true, editable: false }, () => {
......@@ -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' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
</button>}
{this.state.get_for == 'edit' && <button
className="button"
type="button"
disabled={this.state.editable}
......@@ -1515,8 +1540,8 @@ export default class OperatingIndicatorMR extends Component {
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
}
</div>
</button>
<button
</button>}
{this.state.get_for == 'edit' && <button
type="button"
disabled={this.state.editable}
onClick={() => this.setState({ loading: true }, () => {
......@@ -1541,7 +1566,7 @@ export default class OperatingIndicatorMR extends Component {
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
}
</div>
</button>
</button>}
</div>}
</div>
</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