Commit 51b644cc authored by d.arizona's avatar d.arizona

apdet

parent 99a47381
......@@ -2,3 +2,6 @@
REACT_APP_URL_MAIN_BE=https://tia.eksad.com/tia-reporting-dev
REACT_APP_URL_MAIN_FE=/tia-web-dev
"cpy_file_build_windows" : "robocopy E:\tia-web\src\tia-dev\src E:\tia-web\src /e",
"cpy_sya_bundar": "public, build, package, packaglock, src to src"
\ No newline at end of file
......@@ -53,6 +53,7 @@ export default class BalanceSheetMR extends Component {
updateBy: '-',
notes: "",
judulColumn: null,
get_for: "view"
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -135,15 +136,29 @@ export default class BalanceSheetMR 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().getHierarkiMontlyReportBS(payload).then(response => {
console.log(response);
let dataTable = []
let err = false
if (response.data) {
let res = response.data.data
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (item.type_report_id === 3 && item.level === 2) {
if (item.balance_sheet.mtd_vs_previous_month == "" && Number(item.balance_sheet.percent_act_vs_previous_month) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_previous_month) > this.state.maxValue) {
err = true
}
if (item.balance_sheet.mtd_vs_mb == "" && Number(item.balance_sheet.percent_act_vs_mb) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_mb) > this.state.maxValue) {
err = true
}
if (item.balance_sheet.mtd_vs_rb == "" && Number(item.balance_sheet.percent_act_vs_rb) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_rb) > this.state.maxValue) {
err = true
}
}
if (indexIDzz === -1) {
dataTable.push([
item.type_report_id,
......@@ -179,6 +194,17 @@ export default class BalanceSheetMR extends Component {
}
}
res.map((item, index) => {
if (item.type_report_id === 3 && item.level === 2) {
if (item.balance_sheet.mtd_vs_previous_month == "" && Number(item.balance_sheet.percent_act_vs_previous_month) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_previous_month) > this.state.maxValue) {
err = true
}
if (item.balance_sheet.mtd_vs_mb == "" && Number(item.balance_sheet.percent_act_vs_mb) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_mb) > this.state.maxValue) {
err = true
}
if (item.balance_sheet.mtd_vs_rb == "" && Number(item.balance_sheet.percent_act_vs_rb) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_rb) > this.state.maxValue) {
err = true
}
}
dataTable.push([
item.type_report_id,
item.id,
......@@ -211,6 +237,9 @@ export default class BalanceSheetMR extends Component {
}
}
})
if (err === true) {
this.setState({ bebas: true })
}
this.setState({ dataTable, loading: false, buttonError: true, saveDraft: true })
}
console.log(dataTable);
......@@ -249,6 +278,13 @@ export default class BalanceSheetMR extends Component {
}
}
handleGetFor(type) {
this.setState({get_for: type}, () => {
this.getSettingControl()
this.getLatestUpdate()
})
}
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
......@@ -344,6 +380,7 @@ export default class BalanceSheetMR extends Component {
uploadBalanceSheet(type) {
let data = []
this.setState({loading: true})
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
......@@ -449,6 +486,20 @@ export default class BalanceSheetMR extends Component {
let data = []
let err = false
this.state.dataTable.map((i, index) => {
if(i[0] === 3 && i[4] === 2) {
console.log(i);
if ( i[17] === "" && (Number(i[12]) < this.state.minValue || Number(i[12]) > this.state.maxValue)) {
console.log('msk 1');
// console.log(i);
err = true
} else if ( i[18] === "" && (Number(i[14]) < this.state.minValue || Number(i[14]) > this.state.maxValue)) {
console.log('msk 2');
err = true
} else if ( i[19] === "" && (Number(i[16]) < this.state.minValue || Number(i[16]) > this.state.maxValue)) {
console.log('msk 3');
err = true
}
}
data.push({
"item_report_id": i[1],
"rolling_outlook": i[6],
......@@ -468,19 +519,19 @@ export default class BalanceSheetMR extends Component {
})
})
console.log(JSON.stringify(data));
data.map(i => {
if (i.mtd_vs_previous_month === "" && (Number(i.percent_act_vs_previous_month) < this.state.minValue || Number(i.percent_act_vs_previous_month) > this.state.maxValue)) {
console.log('msk 1');
console.log(i);
err = true
} else if (i.mtd_vs_mb === "" && (Number(i.percent_act_vs_mb) < this.state.minValue || Number(i.percent_act_vs_mb) > this.state.maxValue)) {
console.log('msk 2');
err = true
} else if (i.mtd_vs_rb === "" && (Number(i.percent_act_vs_rb) < this.state.minValue || Number(i.percent_act_vs_rb) > this.state.maxValue)) {
console.log('msk 3');
err = true
}
})
// data.map(i => {
// if (i.mtd_vs_previous_month === "" && (Number(i.percent_act_vs_previous_month) < this.state.minValue || Number(i.percent_act_vs_previous_month) > this.state.maxValue)) {
// console.log('msk 1');
// console.log(i);
// err = true
// } else if (i.mtd_vs_mb === "" && (Number(i.percent_act_vs_mb) < this.state.minValue || Number(i.percent_act_vs_mb) > this.state.maxValue)) {
// console.log('msk 2');
// err = true
// } else if (i.mtd_vs_rb === "" && (Number(i.percent_act_vs_rb) < this.state.minValue || Number(i.percent_act_vs_rb) > this.state.maxValue)) {
// console.log('msk 3');
// err = true
// }
// })
// if (err === true) {
// console.log('error');
// this.setState({ loading: false, buttonError: true, saveDraft: false })
......@@ -648,14 +699,14 @@ export default class BalanceSheetMR extends Component {
if (String(item).includes('[M-1]')) {
let tst = String(item).replace('[M-1]', '')
// let indexID = dataTable2.findIndex((val) => val[21] == tst)
let data = tableMeta.rowData[20]
let data = tableMeta.rowData[20] == null? [] : tableMeta.rowData[20]
let indexID = data.findIndex((val) => val.item_formula == String(`${item}`))
if (indexID !== -1) {
let valuezz = data[indexID].value
anjay.push(valuezz == "" ? 0 : valuezz)
}
} else {
let data = tableMeta.rowData[20]
let data = tableMeta.rowData[20] == null? [] : tableMeta.rowData[20]
let indexID = data.findIndex((val) => val.item_formula == String(`${item}`))
if (indexID !== -1) {
console.log(tableMeta)
......@@ -1108,10 +1159,10 @@ export default class BalanceSheetMR extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.props.isApprover ? 'black' : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.isApprover || 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.isApprover}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
value={Number(tableMeta.rowData[9]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
......@@ -1490,6 +1541,7 @@ export default class BalanceSheetMR extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
// disabled={false}
defaultValue={tableMeta.rowData[17]}
inputProps={{
......@@ -1511,6 +1563,7 @@ export default class BalanceSheetMR extends Component {
type="text"
placeholder=""
// disabled={Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? false : true}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
defaultValue={tableMeta.rowData[17]}
inputProps={{
style: {
......@@ -1543,6 +1596,7 @@ export default class BalanceSheetMR extends Component {
type="text"
placeholder=""
// disabled={false}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
defaultValue={tableMeta.rowData[18]}
inputProps={{
style: {
......@@ -1563,6 +1617,7 @@ export default class BalanceSheetMR extends Component {
type="text"
placeholder=""
// disabled={Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? false : true}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
defaultValue={tableMeta.rowData[18]}
inputProps={{
style: {
......@@ -1595,6 +1650,7 @@ export default class BalanceSheetMR extends Component {
type="text"
placeholder=""
// disabled={false}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
defaultValue={tableMeta.rowData[19]}
inputProps={{
style: {
......@@ -1615,6 +1671,7 @@ export default class BalanceSheetMR extends Component {
type="text"
placeholder=""
// disabled={Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue ? false : true}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
defaultValue={tableMeta.rowData[19]}
inputProps={{
style: {
......@@ -1725,7 +1782,7 @@ export default class BalanceSheetMR extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%' }}>
{this.props.isApprover === true ?
{this.props.isApprover === true || this.state.get_for == 'view'?
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download'} data-for="download">
<button
......@@ -1843,7 +1900,27 @@ export default class BalanceSheetMR extends Component {
<div className="col-2">
</div> :
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
<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={{
......@@ -1864,8 +1941,8 @@ export default class BalanceSheetMR 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"
style={{
......@@ -1885,10 +1962,15 @@ export default class BalanceSheetMR extends Component {
}
>
<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>
}
</div>
</button>
<button
</button>}
{this.state.get_for === 'edit' && <button
type="button"
disabled={this.state.buttonError}
onClick={() =>
......@@ -1907,9 +1989,14 @@ export default class BalanceSheetMR extends Component {
}}
>
<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>
}
</div>
</button>
</button>}
</div>
}
</div>
......@@ -1937,11 +2024,12 @@ export default class BalanceSheetMR extends Component {
</MuiThemeProvider>
)}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
</div>
<div className="grid grid-2x" style={{ marginTop: 10, padding: 20}}>
<div className="col-1" style={{paddingLeft: 0}}>
<button
type="button"
onClick={() => this.setState({ loading: true }, () => {
onClick={() => this.setState({ loading: true, visibleBSMR: true }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 100);
......@@ -1958,7 +2046,7 @@ export default class BalanceSheetMR extends Component {
</div>
</button>
</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%', paddingRight: 5 }}>
<button
className="button"
type="button"
......@@ -2001,7 +2089,12 @@ export default class BalanceSheetMR extends Component {
}
>
<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>
}
</div>
</button>
<button
......@@ -2023,12 +2116,16 @@ export default class BalanceSheetMR extends Component {
}}
>
<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>
}
</div>
</button>
</div>
</div>
</div>
</Paper>
}
</div>
......
......@@ -47,7 +47,8 @@ export default class FixedAssetsMovementMR extends Component {
loading: true,
visibleFAMMR: true,
updateBy: '-',
notesUpdate: '-'
notesUpdate: '-',
get_for: 'view'
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -57,6 +58,13 @@ export default class FixedAssetsMovementMR extends Component {
this.getLatestUpdate()
}
handleGetFor(type) {
this.setState({get_for: type}, () => {
this.getItemHierarki()
this.getLatestUpdate()
})
}
getLatestUpdate() {
let payload = {
"report_id": this.props.report_id,
......@@ -96,7 +104,8 @@ export default class FixedAssetsMovementMR 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().getHierarkiMontlyReportFAM(payload).then(response => {
// console.log(payload);
......@@ -450,7 +459,7 @@ export default class FixedAssetsMovementMR extends Component {
// console.log(valuezz);
}
} else {
let data = tableMeta.rowData[16]
let data = tableMeta.rowData[16] == null? [] : tableMeta.rowData[16]
let indexID = data.findIndex((val) => val.item_formula == String(`@${item}`))
if (indexID !== -1) {
let valuezz = data[indexID].value
......@@ -875,10 +884,10 @@ export default class FixedAssetsMovementMR extends Component {
<NumberFormat
thousandSeparator={true}
// style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.isApprover ? 'black' : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.isApprover || 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.isApprover}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
value={Number(tableMeta.rowData[8]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 8)
......@@ -1275,7 +1284,7 @@ export default class FixedAssetsMovementMR extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%' }}>
{this.props.isApprover === true ?
{this.props.isApprover === true || this.state.get_for == 'view'?
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download'} data-for="download">
<button
......@@ -1389,7 +1398,27 @@ export default class FixedAssetsMovementMR extends Component {
<div className="col-2"></div>
:
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
<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={{
......@@ -1411,8 +1440,8 @@ export default class FixedAssetsMovementMR 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"
style={{
......@@ -1440,8 +1469,8 @@ export default class FixedAssetsMovementMR 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={() =>
......@@ -1468,7 +1497,7 @@ export default class FixedAssetsMovementMR extends Component {
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
}
</div>
</button>
</button>}
</div>
}
</div>
......
......@@ -91,7 +91,8 @@ export default class ProfitLossMR extends Component {
judulColumn: null,
handleTekTekTek: 0,
saveDraft: true,
buttonError: true
buttonError: true,
get_for: 'view'
}
this.fileHandler = this.fileHandler.bind(this);
......@@ -103,6 +104,13 @@ export default class ProfitLossMR extends Component {
this.getSettingControl()
}
handleGetFor(type) {
this.setState({get_for: type}, () => {
this.getLatestUpdate()
this.getSettingControl()
})
}
getSettingControl() {
let body = {
group: 'THRESHOLD_VARIANCE',
......@@ -179,7 +187,7 @@ export default class ProfitLossMR extends Component {
"company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId,
"months": this.props.month.month_id,
"get_for": "edit"
"get_for": this.state.get_for
}
console.log(payload);
api.create().getHierarkiMontlyReportPL(payload).then(response => {
......@@ -1115,10 +1123,10 @@ export default class ProfitLossMR extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.props.isApprover ? 'black' : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.isApprover || 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.isApprover}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
value={Number(tableMeta.rowData[10]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, "actual")
......@@ -1628,7 +1636,7 @@ export default class ProfitLossMR extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={false}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
// value={tableMeta.rowData[19]}
defaultValue={tableMeta.rowData[19]}
inputProps={{
......@@ -1651,6 +1659,7 @@ export default class ProfitLossMR extends Component {
placeholder=""
// disabled={Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? false : true}
// value={tableMeta.rowData[19]}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
defaultValue={tableMeta.rowData[19]}
inputProps={{
style: {
......@@ -1683,8 +1692,8 @@ export default class ProfitLossMR extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={false}
// value={tableMeta.rowData[20]}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
defaultValue={tableMeta.rowData[20]}
inputProps={{
style: {
......@@ -1706,6 +1715,7 @@ export default class ProfitLossMR extends Component {
placeholder=""
// disabled={Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue ? false : true}
// value={tableMeta.rowData[20]}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
defaultValue={tableMeta.rowData[20]}
inputProps={{
style: {
......@@ -1737,7 +1747,7 @@ export default class ProfitLossMR extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={false}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
// value={tableMeta.rowData[21]}
defaultValue={tableMeta.rowData[21]}
inputProps={{
......@@ -1760,6 +1770,7 @@ export default class ProfitLossMR extends Component {
placeholder=""
// disabled={Number(tableMeta.rowData[18]) < this.state.minValue || Number(tableMeta.rowData[18]) > this.state.maxValue ? false : true}
// value={tableMeta.rowData[21]}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
defaultValue={tableMeta.rowData[21]}
inputProps={{
style: {
......@@ -1844,7 +1855,7 @@ export default class ProfitLossMR extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%' }}>
{this.props.isApprover === true ?
{this.props.isApprover === true || this.state.get_for == 'view'?
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download'} data-for="download">
<button
......@@ -1961,7 +1972,27 @@ export default class ProfitLossMR extends Component {
<div className="col-2">
</div> :
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
<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={{
......@@ -1982,8 +2013,8 @@ export default class ProfitLossMR 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"
style={{
......@@ -2011,8 +2042,8 @@ export default class ProfitLossMR 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.butto nError}
onClick={() =>
......@@ -2039,7 +2070,7 @@ export default class ProfitLossMR extends Component {
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
}
</div>
</button>
</button>}
</div>
}
</div>
......
......@@ -53,7 +53,8 @@ export default class TaxPlanningMR extends Component {
buttonDraft: true,
handleTekTekTek: 0,
saveDraft: true,
buttonError: true
buttonError: true,
get_for: 'view'
}
this.fileHandler = this.fileHandler.bind(this);
......@@ -65,6 +66,13 @@ export default class TaxPlanningMR extends Component {
this.getLatestUpdate()
}
handleGetFor(type) {
this.setState({get_for: type}, () => {
this.getSettingControl()
this.getLatestUpdate()
})
}
getSettingControl() {
let body = {
group: 'THRESHOLD_CONTROL',
......@@ -894,10 +902,10 @@ export default class TaxPlanningMR extends Component {
<NumberFormat
thousandSeparator={true}
decimalSeparator={"."}
style={{ color: this.props.isApprover ? 'black' : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.isApprover || this.state.get_for == 'view' ? 'black' : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder="input"
disabled={this.props.isApprover}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
value={Number(value.tbc).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 0)
......@@ -955,8 +963,9 @@ export default class TaxPlanningMR extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.isApprover || this.state.get_for == 'view'? 'black' : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
placeholder="input"
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.fcp).toFixed(2) : Number(value.fcp).toFixed(1)}
onBlur={(event) => {
......@@ -1014,8 +1023,9 @@ export default class TaxPlanningMR extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.props.isApprover || this.state.get_for == 'view'? 'black' : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
placeholder="input"
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
onBlur={(event) => {
......@@ -1356,7 +1366,7 @@ export default class TaxPlanningMR extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%' }}>
{this.props.isApprover === true ?
{this.props.isApprover === true || this.state.get_for == 'view'?
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download'} data-for="download">
<button
......@@ -1472,7 +1482,27 @@ export default class TaxPlanningMR extends Component {
<div className="col-2">
</div> :
<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={{
......@@ -1496,8 +1526,8 @@ export default class TaxPlanningMR 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={() =>
......@@ -1521,8 +1551,8 @@ export default class TaxPlanningMR extends Component {
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
</button>}
{this.state.get_for == 'edit' && <button
type="button"
// disabled={this.state.buttonError}
onClick={() =>
......@@ -1546,7 +1576,7 @@ export default class TaxPlanningMR extends Component {
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', marginRight: 10 }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</button>}
</div>
}
</div>
......
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