Commit 5eba227a authored by rifkaki's avatar rifkaki

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

parents 51691d8d 2caef293
This diff is collapsed.
This diff is collapsed.
import { createMuiTheme, FormControlLabel, Input, MuiThemeProvider, Paper, TableCell, Tooltip, Typography, withStyles } from '@material-ui/core'
import { createMuiTheme, FormControlLabel, Input, Snackbar, MuiThemeProvider, Paper, TableCell, Tooltip, Typography, withStyles } from '@material-ui/core'
import MUIDataTable from 'mui-datatables';
import React, { Component } from 'react'
import ReactTooltip from 'react-tooltip';
......@@ -11,6 +11,7 @@ import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
import Constant from '../../library/Constant';
import * as R from 'ramda';
import { Alert } from '@material-ui/lab';
const LightTooltip = withStyles((theme) => ({
tooltip: {
......@@ -266,8 +267,9 @@ export default class BalanceSheetMR extends Component {
item_report_id: i[1] === undefined ? "" : String(i[1]).trim(),
item_report: i[2] === undefined ? "" : String(i[2]).trim(),
actual: i[3] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[3]).trim(),
mtd_vs_previous_month: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
mtd_vs_mb: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
mtd_vs_previous_month: i[4] === undefined ? "" : String(i[4]).trim(),
mtd_vs_mb: i[5] === undefined ? "" : String(i[5]).trim(),
mtd_vs_rb: i[6] === undefined ? "" : String(i[6]).trim(),
})
}
})
......@@ -316,9 +318,9 @@ export default class BalanceSheetMR extends Component {
0,
0,
0,
item.mtd_vs_previous_month === "" ? "" : item.mtd_vs_previous_month,
item.mtd_vs_mb === "" ? "" : item.mtd_vs_mb,
item.mtd_vs_rb === "" ? "" : item.mtd_vs_rb === null ? '' : item.mtd_vs_rb,
item.mtd_vs_previous_month,
item.mtd_vs_mb,
item.mtd_vs_rb,
item.actual_formula,
item.order,
item.error
......@@ -356,9 +358,9 @@ export default class BalanceSheetMR extends Component {
percent_act_vs_mb: i[0] === 5 || i[0] === 6 ? String(Number(i[14].value).toFixed(1)) : i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14]).toFixed(1)),
amount_act_vs_rb: i[0] === 5 || i[0] === 6 ? String(Number(i[15].value).toFixed(1)) : i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15]).toFixed(1)),
percent_act_vs_rb: i[0] === 5 || i[0] === 6 ? String(Number(i[16].value).toFixed(1)) : i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16]).toFixed(1)),
mtd_vs_previous_month: i[0] === 5 || i[0] === 6 ? String(Number(i[17].value).toFixed(1)) : i[0] === 3 && i[17] === "" ? "0.0" : String(Number(i[17]).toFixed(1)),
mtd_vs_mb: i[0] === 5 || i[0] === 6 ? String(Number(i[18].value).toFixed(1)) : i[0] === 3 && i[18] === "" ? "0.0" : String(Number(i[18]).toFixed(1)),
mtd_vs_rb: i[0] === 5 || i[0] === 6 ? String(Number(i[19].value).toFixed(1)) : i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19]).toFixed(1))
mtd_vs_previous_month: String(i[17]),
mtd_vs_mb: String(i[18]),
mtd_vs_rb: String(i[19])
})
})
let body = {
......@@ -521,6 +523,10 @@ export default class BalanceSheetMR extends Component {
})
}
closeAlert() {
this.setState({ alert: false })
}
render() {
let dataTable2 = this.state.dataTable
const handleText = (value, tableMeta, type) => {
......@@ -1697,6 +1703,11 @@ export default class BalanceSheetMR extends Component {
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Monthly Report</Typography>
</div>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert}
</Alert>
</Snackbar>
<div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visibleBSMR ? <Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
......@@ -1804,7 +1815,7 @@ export default class BalanceSheetMR extends Component {
{/* {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="grid grid-2x" style={{ padding: 20 }}>
<div className="col-1">
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true }, () => {
......@@ -1816,7 +1827,7 @@ export default class BalanceSheetMR extends Component {
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
outline: 'none',
}}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
......@@ -1827,7 +1838,7 @@ export default class BalanceSheetMR extends Component {
{this.props.isApprover === true ?
<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%', paddingRight: 5 }}>
<button
className="button"
type="button"
......@@ -1912,7 +1923,7 @@ export default class BalanceSheetMR extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{/* {!this.state.loading && ( */}
{this.state.dataLoaded && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
......@@ -1920,7 +1931,7 @@ export default class BalanceSheetMR extends Component {
options={options}
/>
</MuiThemeProvider>
{/* )} */}
)}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
......@@ -2046,7 +2057,7 @@ export default class BalanceSheetMR extends Component {
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
String(this.state.judul).includes("MONTHLY REPORT - BALANCE SHEET") ?
String(this.state.judul).includes("MONTHLY") && String(this.state.judul).includes("REPORT") && String(this.state.judul).includes("BALANCE") && String(this.state.judul).includes("SHEET") ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
......
......@@ -197,7 +197,7 @@ export default class ProfitLossMR extends Component {
item.profit_loss.rolling_budget === null ? "0.0" : item.profit_loss.rolling_budget === "" ? "0.0" : item.profit_loss.rolling_budget,
item.profit_loss.actual === null ? "0.0" : item.profit_loss.actual === "" ? "0.0" : item.profit_loss.actual,
item.profit_loss.ytd_actual === null ? "0.0" : item.profit_loss.ytd_actual === "" ? "0.0" : item.profit_loss.ytd_actual,
item.profit_loss.actual_previous_month === null ? "5.0" : item.profit_loss.actual_previous_month === "" ? "5.0" : item.profit_loss.actual_previous_month,
item.profit_loss.actual_previous_month === null ? "0.0" : item.profit_loss.actual_previous_month === "" ? "0.0" : item.profit_loss.actual_previous_month,
item.profit_loss.amount_act_vs_previous_month === null ? "0.0" : item.profit_loss.amount_act_vs_previous_month === "" ? "0.0" : item.profit_loss.amount_act_vs_previous_month,
item.profit_loss.percent_act_vs_previous_month === null ? "0.0" : item.profit_loss.percent_act_vs_previous_month === "" ? "0.0" : item.profit_loss.percent_act_vs_previous_month,
item.profit_loss.amount_act_vs_mb === null ? "0.0" : item.profit_loss.amount_act_vs_mb === "" ? "0.0" : item.profit_loss.amount_act_vs_mb,
......@@ -232,7 +232,7 @@ export default class ProfitLossMR extends Component {
item.profit_loss.rolling_budget === null ? "0.0" : item.profit_loss.rolling_budget === "" ? "0.0" : item.profit_loss.rolling_budget,
item.profit_loss.actual === null ? "0.0" : item.profit_loss.actual === "" ? "0.0" : item.profit_loss.actual,
item.profit_loss.ytd_actual === null ? "0.0" : item.profit_loss.ytd_actual === "" ? "0.0" : item.profit_loss.ytd_actual,
item.profit_loss.actual_previous_month === null ? "5.0" : item.profit_loss.actual_previous_month === "" ? "5.0" : item.profit_loss.actual_previous_month,
item.profit_loss.actual_previous_month === null ? "0.0" : item.profit_loss.actual_previous_month === "" ? "0.0" : item.profit_loss.actual_previous_month,
item.profit_loss.amount_act_vs_previous_month === null ? "0.0" : item.profit_loss.amount_act_vs_previous_month === "" ? "0.0" : item.profit_loss.amount_act_vs_previous_month,
item.profit_loss.percent_act_vs_previous_month === null ? "0.0" : item.profit_loss.percent_act_vs_previous_month === "" ? "0.0" : item.profit_loss.percent_act_vs_previous_month,
item.profit_loss.amount_act_vs_mb === null ? "0.0" : item.profit_loss.amount_act_vs_mb === "" ? "0.0" : item.profit_loss.amount_act_vs_mb,
......@@ -603,6 +603,7 @@ export default class ProfitLossMR extends Component {
const handleText = (value, tableMeta, type) => {
// dataTable2[tableMeta.rowIndex][type] = value
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = value
console.log(dataTable2);
// console.log(dataTable2[tableMeta.rowIndex]);
}
const handleChange = (value, tableMeta, type) => {
......@@ -829,19 +830,20 @@ export default class ProfitLossMR extends Component {
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null :
<FormControlLabel
style={{ margin: 0 }}
// value={value}
// value={tableMeta.rowData[6]}
control={
<Input
disableUnderline={true}
style={{fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
inputProps={{style: {
color: "#5198ea"
}}}
placeholder=""
value={tableMeta.rowData[6]}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// value={tableMeta.rowData[6]}
defaultValue={tableMeta.rowData[6]}
inputProps={{
style: {
color: "#5198ea"
}
}}
onBlur={(event) => {
// updateValue(event.target.value)
handleText(event.target.value, tableMeta, 0)
......@@ -1574,7 +1576,7 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={false}
// value={tableMeta.rowData[19]}
value={tableMeta.rowData[19]}
defaultValue={tableMeta.rowData[19]}
inputProps={{
style: {
......@@ -1762,6 +1764,11 @@ export default class ProfitLossMR extends Component {
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Monthly Report Submission</Typography>
</div>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert}
</Alert>
</Snackbar>
<div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visiblePLMR ?
<Paper style={{ paddingTop: 10 }}>
......@@ -1869,7 +1876,7 @@ export default class ProfitLossMR extends Component {
{/* {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="grid grid-2x" style={{ padding: 20 }}>
<div className="col-1">
<div className="col-1" style={{ paddingLeft: 0}}>
<button
type="button"
onClick={() => this.setState({ loading: true }, () => {
......@@ -1892,7 +1899,7 @@ export default class ProfitLossMR extends Component {
{this.props.isApprover === true ?
<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%', paddingRight: 5 }}>
<button
className="button"
type="button"
......@@ -1978,7 +1985,7 @@ export default class ProfitLossMR extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{/* {!this.state.loading && ( */}
{this.state.dataLoaded && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
......@@ -1986,7 +1993,7 @@ export default class ProfitLossMR extends Component {
options={options}
/>
</MuiThemeProvider>
{/* )} */}
)}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
......
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