Commit 8dec0844 authored by d.arizona's avatar d.arizona

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

parents e468136e 2dfe1d4b
...@@ -45,6 +45,7 @@ export default class ApprovalMatrix extends Component { ...@@ -45,6 +45,7 @@ export default class ApprovalMatrix extends Component {
btncreate: false, btncreate: false,
btnedit: false, btnedit: false,
load: false, load: false,
judul: '',
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -52,11 +53,11 @@ export default class ApprovalMatrix extends Component { ...@@ -52,11 +53,11 @@ export default class ApprovalMatrix extends Component {
fileHandler = (event) => { fileHandler = (event) => {
let fileObj = event let fileObj = event
ExcelRenderer(fileObj, (err, resp) => { ExcelRenderer(fileObj, (err, resp) => {
// console.log(resp)
if (err) { if (err) {
// console.log(err); console.log(err);
} }
else { else {
let judul = resp.rows[2]
let isi = resp.rows.slice(3) let isi = resp.rows.slice(3)
let payload = [] let payload = []
isi.map((item, index) => { isi.map((item, index) => {
...@@ -75,213 +76,218 @@ export default class ApprovalMatrix extends Component { ...@@ -75,213 +76,218 @@ export default class ApprovalMatrix extends Component {
let body = { let body = {
approval_matrix: payload approval_matrix: payload
} }
this.setState({ payload: body, buttonError: false }) console.log(resp.rows[1])
api.create().checkUploadAM(body).then(response => { this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] })
// console.log(response.data) }
let dataRow = [] });
if(response.data){ }
if (response.ok) {
if (response.data.status === "success") { checkUpload(){
dataRow = response.data.data.map((item, index) => { api.create().checkUploadAM(this.state.payload).then(response => {
return [ console.log(response)
index + 1, let dataRow = []
item.approval_type_name, if (response.data) {
item.orders, if (response.ok) {
item.fullname, if (response.data.status === "success") {
item.operator_type_name, dataRow = response.data.data.map((item, index) => {
item.start_date, return [
item.end_date, index + 1,
item.error item.approval_type_name,
] item.orders,
}) item.fullname,
let columns = [ item.operator_type_name,
"Data", item.start_date,
{ item.end_date,
name: "Approval Type", item.error
options: { ]
customBodyRender: (val, tableMeta) => { })
let check = null let columns = [
if (tableMeta.rowData[7] != null) { "Data",
check = tableMeta.rowData[7].findIndex((val) => val.field.includes('approval_type_name')) {
if (check > -1) { name: "Approval Type",
this.setState({ buttonError: true }) options: {
} customBodyRender: (val, tableMeta) => {
} let check = null
return ( if (tableMeta.rowData[7] != null) {
<div style={{ display: 'flex' }}> check = tableMeta.rowData[7].findIndex((val) => val.field.includes('approval_type_name'))
{tableMeta.rowData[7] != null && check > -1 ? if (check > -1) {
<a data-tip={tableMeta.rowData[7][check].message} data-for="typename"> this.setState({ buttonError: true })
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="typename" place="bottom" type="light" effect="solid" />
</div >
);
} }
} }
}, return (
{ <div style={{ display: 'flex' }}>
name: "Order", {tableMeta.rowData[7] != null && check > -1 ?
options: { <a data-tip={tableMeta.rowData[7][check].message} data-for="approvaltype">
customBodyRender: (val, tableMeta) => { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
let check = null </a> :
if (tableMeta.rowData[7] != null) { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
check = tableMeta.rowData[7].findIndex((val) => val.field.includes('orders'))
if (check > -1) {
this.setState({ buttonError: true })
}
} }
return ( <ReactTooltip border={true} id="approvaltype" place="bottom" type="light" effect="solid" />
<div style={{ display: 'flex' }}> </div >
{tableMeta.rowData[7] != null && check > -1 ? );
<a data-tip={tableMeta.rowData[7][check].message} data-for="order"> }
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> }
</a> : },
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> {
} name: "Order",
<ReactTooltip border={true} id="order" place="bottom" type="light" effect="solid" /> options: {
</div > customBodyRender: (val, tableMeta) => {
); let check = null
if (tableMeta.rowData[7] != null) {
check = tableMeta.rowData[7].findIndex((val) => val.field.includes('orders'))
if (check > -1) {
this.setState({ buttonError: true })
} }
} }
}, return (
{ <div style={{ display: 'flex' }}>
name: "Approver Name", {tableMeta.rowData[7] != null && check > -1 ?
options: { <a data-tip={tableMeta.rowData[7][check].message} data-for="order">
customBodyRender: (val, tableMeta) => { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
let check = null </a> :
if (tableMeta.rowData[7] != null) { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
check = tableMeta.rowData[7].findIndex((val) => val.field.includes('fullname'))
if (check > -1) {
this.setState({ buttonError: true })
}
} }
return ( <ReactTooltip border={true} id="order" place="bottom" type="light" effect="solid" />
<div style={{ display: 'flex' }}> </div >
{tableMeta.rowData[7] != null && check > -1 ? );
<a data-tip={tableMeta.rowData[7][check].message} data-for="fullname"> }
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> }
</a> : },
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> {
} name: "Approver Name",
<ReactTooltip border={true} id="fullname" place="bottom" type="light" effect="solid" /> options: {
</div > customBodyRender: (val, tableMeta) => {
); let check = null
if (tableMeta.rowData[7] != null) {
check = tableMeta.rowData[7].findIndex((val) => val.field.includes('fullname'))
if (check > -1) {
this.setState({ buttonError: true })
} }
} }
}, return (
{ <div style={{ display: 'flex' }}>
name: "Operator", {tableMeta.rowData[7] != null && check > -1 ?
options: { <a data-tip={tableMeta.rowData[7][check].message} data-for="fullname">
customBodyRender: (val, tableMeta) => { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
let check = null </a> :
if (tableMeta.rowData[7] != null) { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
check = tableMeta.rowData[7].findIndex((val) => val.field.includes('operator_type_name'))
if (check > -1) {
this.setState({ buttonError: true })
}
} }
return ( <ReactTooltip border={true} id="fullname" place="bottom" type="light" effect="solid" />
<div style={{ display: 'flex' }}> </div >
{tableMeta.rowData[7] != null && check > -1 ? );
<a data-tip={tableMeta.rowData[7][check].message} data-for="operatorname"> }
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> }
</a> : },
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> {
} name: "Operator",
<ReactTooltip border={true} id="operatorname" place="bottom" type="light" effect="solid" /> options: {
</div > customBodyRender: (val, tableMeta) => {
); let check = null
if (tableMeta.rowData[7] != null) {
check = tableMeta.rowData[7].findIndex((val) => val.field.includes('operator_type_name'))
if (check > -1) {
this.setState({ buttonError: true })
} }
} }
}, return (
{ <div style={{ display: 'flex' }}>
name: "Valid From", {tableMeta.rowData[7] != null && check > -1 ?
options: { <a data-tip={tableMeta.rowData[7][check].message} data-for="operatorname">
customBodyRender: (val, tableMeta) => { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
let check = null </a> :
if (tableMeta.rowData[7] != null) { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
check = tableMeta.rowData[7].findIndex((val) => val.field.includes('start_date'))
if (check > -1) {
this.setState({ buttonError: true })
}
} }
return ( <ReactTooltip border={true} id="operatorname" place="bottom" type="light" effect="solid" />
<div style={{ display: 'flex' }}> </div >
{tableMeta.rowData[7] != null && check > -1 ? );
<a data-tip={tableMeta.rowData[7][check].message} data-for="startdate"> }
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> }
</a> : },
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> {
} name: "Valid From",
<ReactTooltip border={true} id="startdate" place="bottom" type="light" effect="solid" /> options: {
</div > customBodyRender: (val, tableMeta) => {
); let check = null
if (tableMeta.rowData[7] != null) {
check = tableMeta.rowData[7].findIndex((val) => val.field.includes('start_date'))
if (check > -1) {
this.setState({ buttonError: true })
} }
} }
}, return (
{ <div style={{ display: 'flex' }}>
name: "Valid To", {tableMeta.rowData[7] != null && check > -1 ?
options: { <a data-tip={tableMeta.rowData[7][check].message} data-for="startdate">
customBodyRender: (val, tableMeta) => { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
let check = null </a> :
if (tableMeta.rowData[7] != null) { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
check = tableMeta.rowData[7].findIndex((val) => val.field.includes('end_date'))
if (check > -1) {
this.setState({ buttonError: true })
}
} }
return ( <ReactTooltip border={true} id="startdate" place="bottom" type="light" effect="solid" />
<div style={{ display: 'flex' }}> </div >
{tableMeta.rowData[7] != null && check > -1 ? );
<a data-tip={tableMeta.rowData[7][check].message} data-for="enddate"> }
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> }
</a> : },
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> {
} name: "Valid To",
<ReactTooltip border={true} id="enddate" place="bottom" type="light" effect="solid" /> options: {
</div > customBodyRender: (val, tableMeta) => {
); let check = null
if (tableMeta.rowData[7] != null) {
check = tableMeta.rowData[7].findIndex((val) => val.field.includes('end_date'))
if (check > -1) {
this.setState({ buttonError: true })
} }
} }
}, return (
{ <div style={{ display: 'flex' }}>
name: "", {tableMeta.rowData[7] != null && check > -1 ?
options: { <a data-tip={tableMeta.rowData[7][check].message} data-for="enddate">
display: false <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} </a> :
} <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
] }
<ReactTooltip border={true} id="enddate" place="bottom" type="light" effect="solid" />
// console.log(dataRow); </div >
this.setState({ );
dataLoaded: true,
cols: columns,
rows: dataRow
});
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
} }
}) }
},
{
name: "",
options: {
display: false
}
} }
} else { ]
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
} // console.log(dataRow);
} else {
this.setState({ this.setState({
dataLoaded: false, dataLoaded: true,
alert: true, messageAlert: response.problem, tipeAlert: 'error' cols: columns,
rows: dataRow, visibleUpload: false,
visibleAM: false
}); });
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
}) } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({
dataLoaded: false,
alert: true, messageAlert: response.problem, tipeAlert: 'error'
});
} }
}); })
} }
componentDidMount() { componentDidMount() {
...@@ -537,6 +543,7 @@ export default class ApprovalMatrix extends Component { ...@@ -537,6 +543,7 @@ export default class ApprovalMatrix extends Component {
const columns = [{ const columns = [{
name: "Action", name: "Action",
options: { options: {
sort: false,
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
...@@ -775,7 +782,7 @@ export default class ApprovalMatrix extends Component { ...@@ -775,7 +782,7 @@ export default class ApprovalMatrix extends Component {
theme={getMuiTheme()} theme={getMuiTheme()}
data={this.state.rows} data={this.state.rows}
columns={this.state.cols} columns={this.state.cols}
options={options} options={options2}
/> />
</MuiThemeProvider> </MuiThemeProvider>
)} )}
...@@ -792,7 +799,10 @@ export default class ApprovalMatrix extends Component { ...@@ -792,7 +799,10 @@ export default class ApprovalMatrix extends Component {
</button> </button>
<button <button
type="button" type="button"
onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : this.uploadAM()} // disabled={this.state.buttonError == true ? { buttonError: true, cursor: 'none' } : false}
disabled={this.state.buttonError == true ? true : false}
// onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : this.uploadAM()}
onClick={() => this.uploadAM()}
style={{}} style={{}}
> >
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
...@@ -851,7 +861,12 @@ export default class ApprovalMatrix extends Component { ...@@ -851,7 +861,12 @@ export default class ApprovalMatrix extends Component {
this.fileHandler(dt) this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' }) this.setState({ uploadStatus: 'idle', percentage: '0' })
}} }}
onUpload={() => this.setState({ visibleUpload: false, visibleAM: false })} // onUpload={() => this.setState({ visibleUpload: false, visibleAM: false })}
onUpload={() => {
this.state.judul === "APPROVAL MATRIX" ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
/> />
</div> </div>
</div> </div>
......
...@@ -570,7 +570,11 @@ export default class BudgetTahunan extends Component { ...@@ -570,7 +570,11 @@ export default class BudgetTahunan extends Component {
{this.state.visiblePL && ( {this.state.visiblePL && (
<ProfitLoss <ProfitLoss
report_id={this.state.report_id} report_id={this.state.report_id}
height={this.props.height}
width={this.props.width}
company={this.state.company} company={this.state.company}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
onClickClose={() => this.setState({ visiblePL: false, visibleBudgetTahunan: true })} onClickClose={() => this.setState({ visiblePL: false, visibleBudgetTahunan: true })}
/> />
...@@ -584,11 +588,23 @@ export default class BudgetTahunan extends Component { ...@@ -584,11 +588,23 @@ export default class BudgetTahunan extends Component {
)} )}
{this.state.visibleFAM && ( {this.state.visibleFAM && (
<FixedAssetsMovement <FixedAssetsMovement
report_id={this.state.report_id}
height={this.props.height}
width={this.props.width}
company={this.state.company}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
onClickClose={() => this.setState({ visibleFAM: false, visibleBudgetTahunan: true })} onClickClose={() => this.setState({ visibleFAM: false, visibleBudgetTahunan: true })}
/> />
)} )}
{this.state.visibleCAT && ( {this.state.visibleCAT && (
<CorporateAnnualTarget <CorporateAnnualTarget
report_id={this.state.report_id}
height={this.props.height}
width={this.props.width}
company={this.state.company}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
onClickClose={() => this.setState({ visibleCAT: false, visibleBudgetTahunan: true })} onClickClose={() => this.setState({ visibleCAT: false, visibleBudgetTahunan: true })}
/> />
)} )}
......
...@@ -7,14 +7,14 @@ import AddIcon from '@material-ui/icons/Add'; ...@@ -7,14 +7,14 @@ import AddIcon from '@material-ui/icons/Add';
import { values } from 'ramda'; import { values } from 'ramda';
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable3());
const options = ct.customOptionsFixedColumn(); const options = ct.customOptionsFixedColumn();
const style = { const style = {
position: "sticky", position: "sticky",
left: 0, left: 0,
background: "white",
zIndex: 101, zIndex: 101,
background: "white",
}; };
const style2 = { const style2 = {
position: "sticky", position: "sticky",
...@@ -764,20 +764,20 @@ export default class BalanceSheet extends Component { ...@@ -764,20 +764,20 @@ export default class BalanceSheet extends Component {
name: "Account", name: "Account",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#354960', width: 388 }}> <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#354960', width: 300 }}>
<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>
</TableCell> </TableCell>
), ),
setCellProps: () => ({ style }), setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ width: 388 }}> <div style={{ width: 300}}>
{tableMeta.rowData[4] == 0 ? {tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span> <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
: :
tableMeta.rowData[4] === 1 ? <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<span style={{ fontSize: 12, marginLeft: 20 * Number(tableMeta.rowData[4]) }}>{tableMeta.rowData[0] === 4 ? "" : val}</span> : <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
<span style={{ fontSize: 12, marginLeft: 20 * Number(tableMeta.rowData[4]) }}>{tableMeta.rowData[0] === 4 ? "" : val}</span> </div>
} }
</div> </div>
) )
...@@ -1957,7 +1957,7 @@ export default class BalanceSheet extends Component { ...@@ -1957,7 +1957,7 @@ export default class BalanceSheet extends Component {
<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 - 200, height: this.props.height-200 }}> <div style={{ marginTop: 20, width: this.props.width - 200, height: this.props.height - 400 }}>
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={dataTable2} data={dataTable2}
......
...@@ -45,6 +45,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -45,6 +45,8 @@ export default class CorporateAnnualTarget extends Component {
getItemHierarki() { getItemHierarki() {
let payload = { let payload = {
"report_id": this.props.report_id, "report_id": this.props.report_id,
"revision": Number(this.props.revision),
"periode": this.props.periode,
"company_id": this.props.company.company_id "company_id": this.props.company.company_id
} }
api.create().getItemReportHierarki(payload).then(response => { api.create().getItemReportHierarki(payload).then(response => {
...@@ -148,7 +150,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -148,7 +150,7 @@ export default class CorporateAnnualTarget extends Component {
let total = 0 let total = 0
this.state.dataTable.map((item, index) => { this.state.dataTable.map((item, index) => {
if (data.rowData[1] == item[2]) { if (data.rowData[1] == item[2]) {
total = item[data.columnIndex] == undefined ? (total + 0) : (total + item[data.columnIndex]) total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
} }
}) })
let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2]) let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2])
...@@ -162,14 +164,14 @@ export default class CorporateAnnualTarget extends Component { ...@@ -162,14 +164,14 @@ export default class CorporateAnnualTarget extends Component {
let data = this.state.dataTable let data = this.state.dataTable
let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2]) let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2])
if (indexParent > 0) { if (indexParent > 0) {
console.log(indexParent) // console.log(indexParent)
let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
let jagain = data[indexParent][tableMeta.columnIndex] let jagain = data[indexParent][tableMeta.columnIndex]
a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val)) a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
} else { } else {
data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
} }
this.forceUpdate() // this.forceUpdate()
// console.log(this.state.dataTable) // console.log(this.state.dataTable)
// this.setState({ // this.setState({
// data: a, // data: a,
...@@ -177,6 +179,32 @@ export default class CorporateAnnualTarget extends Component { ...@@ -177,6 +179,32 @@ export default class CorporateAnnualTarget extends Component {
} }
render() { render() {
// let dataTable2 = this.state.dataTable
// const handleChange = (value, tableMeta) => {
// let val = String(value).split(",").join("")
// // let data = this.state.dataTable2
// let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[tableMeta.rowIndex][2])
// if (indexParent > 0) {
// // console.log(indexParent)
// let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
// let jagain = dataTable2[indexParent][tableMeta.columnIndex]
// a = dataTable2[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
// } else {
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
// }
// }
// const handleValue = (data) => {
// let total = 0
// dataTable2.map((item, index) => {
// if (data.rowData[1] == item[2]) {
// total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
// }
// })
// let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
// let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
// // console.log(indexParent);
// return a
// }
const columns = [{ const columns = [{
name: "", name: "",
options: { options: {
...@@ -207,7 +235,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -207,7 +235,7 @@ export default class CorporateAnnualTarget extends Component {
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#354960', width: 388 }}> <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#354960', width: 388 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
setCellProps: () => ({ style }), setCellProps: () => ({ style }),
...@@ -229,7 +257,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -229,7 +257,7 @@ export default class CorporateAnnualTarget extends Component {
name: "Weight", name: "Weight",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style2, top: 0, zIndex: 102, backgroundColor: '#354960', width: 96 }}> <TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
...@@ -260,19 +288,6 @@ export default class CorporateAnnualTarget extends Component { ...@@ -260,19 +288,6 @@ export default class CorporateAnnualTarget extends Component {
style={{ margin: 0 }} style={{ margin: 0 }}
value={value} value={value}
control={ control={
// <Input
// value={this.formatValue(value)}
// style={{}}
// inputProps={{
// style: {
// color: "#5198ea",
// fontSize: 12,
// textAlign: 'right'
// }
// }}
// disableUnderline={true}
// inputStyle={{ color: 'red' }}
// />
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
...@@ -339,7 +354,23 @@ export default class CorporateAnnualTarget extends Component { ...@@ -339,7 +354,23 @@ export default class CorporateAnnualTarget extends Component {
} }
} }
}, { }, {
name: "January 2021", name: "2020",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
return (
<div style={{ width: 96 }}>
{val}
</div>
)
}
}
}, {
name: "Jan 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}> <TableCell style={{ backgroundColor: '#354960', width: 96 }}>
...@@ -355,7 +386,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -355,7 +386,7 @@ export default class CorporateAnnualTarget extends Component {
} }
} }
}, { }, {
name: "February 2021", name: "Feb 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}> <TableCell style={{ backgroundColor: '#354960', width: 96 }}>
...@@ -371,7 +402,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -371,7 +402,7 @@ export default class CorporateAnnualTarget extends Component {
} }
} }
}, { }, {
name: "March 2021", name: "Mar 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}> <TableCell style={{ backgroundColor: '#354960', width: 96 }}>
...@@ -387,7 +418,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -387,7 +418,7 @@ export default class CorporateAnnualTarget extends Component {
} }
} }
}, { }, {
name: "April 2021", name: "Apr 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}> <TableCell style={{ backgroundColor: '#354960', width: 96 }}>
...@@ -419,7 +450,135 @@ export default class CorporateAnnualTarget extends Component { ...@@ -419,7 +450,135 @@ export default class CorporateAnnualTarget extends Component {
} }
} }
}, { }, {
name: "June 2021", name: "Jun 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
return (
<div style={{ width: 96 }}>
{val}
</div>
)
}
}
}, {
name: "Jul 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
return (
<div style={{ width: 96 }}>
{val}
</div>
)
}
}
}, {
name: "Aug 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
return (
<div style={{ width: 96 }}>
{val}
</div>
)
}
}
}, {
name: "Sep 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
return (
<div style={{ width: 96 }}>
{val}
</div>
)
}
}
}, {
name: "Oct 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
return (
<div style={{ width: 96 }}>
{val}
</div>
)
}
}
}, {
name: "Nop 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
return (
<div style={{ width: 96 }}>
{val}
</div>
)
}
}
}, {
name: "Dec 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
return (
<div style={{ width: 96 }}>
{val}
</div>
)
}
}
}, {
name: "2021 Total",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
return (
<div style={{ width: 96 }}>
{val}
</div>
)
}
}
}, {
name: "2022 Total",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}> <TableCell style={{ backgroundColor: '#354960', width: 96 }}>
...@@ -435,7 +594,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -435,7 +594,7 @@ export default class CorporateAnnualTarget extends Component {
} }
} }
}, { }, {
name: "31 Dec 2021 Total", name: "2023 Total",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}> <TableCell style={{ backgroundColor: '#354960', width: 96 }}>
...@@ -451,7 +610,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -451,7 +610,7 @@ export default class CorporateAnnualTarget extends Component {
} }
} }
}, { }, {
name: "31 Dec 2022 Total", name: "Strategic Initiative",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}> <TableCell style={{ backgroundColor: '#354960', width: 96 }}>
...@@ -467,7 +626,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -467,7 +626,7 @@ export default class CorporateAnnualTarget extends Component {
} }
} }
}, { }, {
name: "31 Dec 2023 Total", name: "PIC",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}> <TableCell style={{ backgroundColor: '#354960', width: 96 }}>
...@@ -493,12 +652,12 @@ export default class CorporateAnnualTarget extends Component { ...@@ -493,12 +652,12 @@ export default class CorporateAnnualTarget extends Component {
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}> <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} > <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Fixed Assets Movement</Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Corporate Annual Target</Typography>
</div> </div>
<div style={{ padding: 20 }}> <div style={{ padding: 20 }}>
<div> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>PT. XYZ</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : 2021</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
...@@ -525,15 +684,15 @@ export default class CorporateAnnualTarget extends Component { ...@@ -525,15 +684,15 @@ export default class CorporateAnnualTarget extends Component {
onClick={() => this.props.onClickClose()} onClick={() => this.props.onClickClose()}
> >
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Kembali</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div> </div>
</button> </button>
</div> </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%' }}>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960', marginRight: 20 }}> <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960', marginRight: 20 }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography>
</div> </div>
<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', marginRight: 20 }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography>
</div> </div>
</div> </div>
......
...@@ -45,6 +45,8 @@ export default class FixedAssetsMovement extends Component { ...@@ -45,6 +45,8 @@ export default class FixedAssetsMovement extends Component {
getItemHierarki() { getItemHierarki() {
let payload = { let payload = {
"report_id": this.props.report_id, "report_id": this.props.report_id,
"revision": Number(this.props.revision),
"periode": this.props.periode,
"company_id": this.props.company.company_id "company_id": this.props.company.company_id
} }
api.create().getItemReportHierarki(payload).then(response => { api.create().getItemReportHierarki(payload).then(response => {
...@@ -148,7 +150,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -148,7 +150,7 @@ export default class FixedAssetsMovement extends Component {
let total = 0 let total = 0
this.state.dataTable.map((item, index) => { this.state.dataTable.map((item, index) => {
if (data.rowData[1] == item[2]) { if (data.rowData[1] == item[2]) {
total = item[data.columnIndex] == undefined ? (total + 0) : (total + item[data.columnIndex]) total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
} }
}) })
let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2]) let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2])
...@@ -162,18 +164,44 @@ export default class FixedAssetsMovement extends Component { ...@@ -162,18 +164,44 @@ export default class FixedAssetsMovement extends Component {
let data = this.state.dataTable let data = this.state.dataTable
let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2]) let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2])
if (indexParent > 0) { if (indexParent > 0) {
console.log(indexParent) // console.log(indexParent)
let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
let jagain = data[indexParent][tableMeta.columnIndex] let jagain = data[indexParent][tableMeta.columnIndex]
a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val)) a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
} else { } else {
data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
} }
this.forceUpdate() // this.forceUpdate()
// console.log(this.state.dataTable) // console.log(this.state.dataTable)
} }
render() { render() {
let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta) => {
let val = String(value).split(",").join("")
// let data = this.state.dataTable2
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[tableMeta.rowIndex][2])
if (indexParent > 0) {
// console.log(indexParent)
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
let jagain = dataTable2[indexParent][tableMeta.columnIndex]
a = dataTable2[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
}
}
const handleValue = (data) => {
let total = 0
dataTable2.map((item, index) => {
if (data.rowData[1] == item[2]) {
total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
}
})
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
// console.log(indexParent);
return a
}
const columns = [{ const columns = [{
name: "", name: "",
options: { options: {
...@@ -212,11 +240,11 @@ export default class FixedAssetsMovement extends Component { ...@@ -212,11 +240,11 @@ export default class FixedAssetsMovement extends Component {
return ( return (
<div style={{ width: 388 }}> <div style={{ width: 388 }}>
{tableMeta.rowData[4] == 0 ? {tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(val).toUpperCase()}</span> <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
: :
tableMeta.rowData[4] === 1 ? tableMeta.rowData[4] === 1 ?
<span style={{ fontSize: 12, marginLeft: 20 * Number(tableMeta.rowData[4]) }}>{val}</span> : <span style={{ fontSize: 12, marginLeft: 20 * Number(tableMeta.rowData[4]) }}>{tableMeta.rowData[0] === 4 ? "" : val}</span> :
<span style={{ fontSize: 12, marginLeft: 20 * Number(tableMeta.rowData[4]) }}>{val}</span> <span style={{ fontSize: 12, marginLeft: 20 * Number(tableMeta.rowData[4]) }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
} }
</div> </div>
) )
...@@ -230,10 +258,11 @@ export default class FixedAssetsMovement extends Component { ...@@ -230,10 +258,11 @@ export default class FixedAssetsMovement extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -245,10 +274,10 @@ export default class FixedAssetsMovement extends Component { ...@@ -245,10 +274,10 @@ export default class FixedAssetsMovement extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -262,14 +291,32 @@ export default class FixedAssetsMovement extends Component { ...@@ -262,14 +291,32 @@ export default class FixedAssetsMovement extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 4 ?
<span>-</span> null
: :
<span>validasi</span> tableMeta.rowData[0] === 6 ?
<span>Formula</span>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
:
<span>validasi</span>
} }
</div> </div>
) )
...@@ -283,11 +330,11 @@ export default class FixedAssetsMovement extends Component { ...@@ -283,11 +330,11 @@ export default class FixedAssetsMovement extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -299,10 +346,10 @@ export default class FixedAssetsMovement extends Component { ...@@ -299,10 +346,10 @@ export default class FixedAssetsMovement extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -316,14 +363,32 @@ export default class FixedAssetsMovement extends Component { ...@@ -316,14 +363,32 @@ export default class FixedAssetsMovement extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 4 ?
<span>-</span> null
: :
<span>validasi</span> tableMeta.rowData[0] === 6 ?
<span>Formula</span>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
:
<span>validasi</span>
} }
</div> </div>
) )
...@@ -337,10 +402,11 @@ export default class FixedAssetsMovement extends Component { ...@@ -337,10 +402,11 @@ export default class FixedAssetsMovement extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -352,10 +418,10 @@ export default class FixedAssetsMovement extends Component { ...@@ -352,10 +418,10 @@ export default class FixedAssetsMovement extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -369,14 +435,32 @@ export default class FixedAssetsMovement extends Component { ...@@ -369,14 +435,32 @@ export default class FixedAssetsMovement extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 4 ?
<span>-</span> null
: :
<span>validasi</span> tableMeta.rowData[0] === 6 ?
<span>Formula</span>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
:
<span>validasi</span>
} }
</div> </div>
) )
...@@ -390,10 +474,11 @@ export default class FixedAssetsMovement extends Component { ...@@ -390,10 +474,11 @@ export default class FixedAssetsMovement extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -405,10 +490,10 @@ export default class FixedAssetsMovement extends Component { ...@@ -405,10 +490,10 @@ export default class FixedAssetsMovement extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -422,14 +507,32 @@ export default class FixedAssetsMovement extends Component { ...@@ -422,14 +507,32 @@ export default class FixedAssetsMovement extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 4 ?
<span>-</span> null
: :
<span>validasi</span> tableMeta.rowData[0] === 6 ?
<span>Formula</span>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
:
<span>validasi</span>
} }
</div> </div>
) )
...@@ -443,10 +546,11 @@ export default class FixedAssetsMovement extends Component { ...@@ -443,10 +546,11 @@ export default class FixedAssetsMovement extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -458,10 +562,10 @@ export default class FixedAssetsMovement extends Component { ...@@ -458,10 +562,10 @@ export default class FixedAssetsMovement extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -475,14 +579,32 @@ export default class FixedAssetsMovement extends Component { ...@@ -475,14 +579,32 @@ export default class FixedAssetsMovement extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 4 ?
<span>-</span> null
: :
<span>validasi</span> tableMeta.rowData[0] === 6 ?
<span>Formula</span>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
:
<span>validasi</span>
} }
</div> </div>
) )
...@@ -496,10 +618,11 @@ export default class FixedAssetsMovement extends Component { ...@@ -496,10 +618,11 @@ export default class FixedAssetsMovement extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -511,10 +634,10 @@ export default class FixedAssetsMovement extends Component { ...@@ -511,10 +634,10 @@ export default class FixedAssetsMovement extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -528,14 +651,32 @@ export default class FixedAssetsMovement extends Component { ...@@ -528,14 +651,32 @@ export default class FixedAssetsMovement extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 4 ?
<span>-</span> null
: :
<span>validasi</span> tableMeta.rowData[0] === 6 ?
<span>Formula</span>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
:
<span>validasi</span>
} }
</div> </div>
) )
...@@ -549,10 +690,11 @@ export default class FixedAssetsMovement extends Component { ...@@ -549,10 +690,11 @@ export default class FixedAssetsMovement extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -564,10 +706,10 @@ export default class FixedAssetsMovement extends Component { ...@@ -564,10 +706,10 @@ export default class FixedAssetsMovement extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
onChange={event => { onBlur={(event) => {
// console.log(event.target) // updateValue(event.target.value)
updateValue(event.target.value) handleChange(event.target.value, tableMeta)
this.handleChange(event.target.value, tableMeta) console.log(dataTable2)
}} }}
/> />
} }
...@@ -581,63 +723,681 @@ export default class FixedAssetsMovement extends Component { ...@@ -581,63 +723,681 @@ export default class FixedAssetsMovement extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={this.handleValue(tableMeta)} value={handleValue(tableMeta)}
/> />
</span> </span>
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 4 ?
<span>-</span> null
: :
<span>validasi</span> tableMeta.rowData[0] === 6 ?
<span>Formula</span>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
:
<span>validasi</span>
} }
</div> </div>
) )
} }
} }
}, { }, {
name: "31 Dec 2021 Total", name: "July 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}> <TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
customBodyRender: (val) => { setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ textAlign: 'right' }}>
{val} {tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
console.log(dataTable2)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 4 ?
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
:
<span>validasi</span>
}
</div> </div>
) )
} }
} }
}, { }, {
name: "31 Dec 2022 Total", name: "August 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}> <TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
customBodyRender: (val) => { setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ textAlign: 'right' }}>
{val} {tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
console.log(dataTable2)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 4 ?
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
:
<span>validasi</span>
}
</div> </div>
) )
} }
} }
}, { }, {
name: "31 Dec 2023 Total", name: "September 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}> <TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
customBodyRender: (val) => { setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ textAlign: 'right' }}>
{val} {tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
console.log(dataTable2)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 4 ?
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
:
<span>validasi</span>
}
</div>
)
}
}
}, {
name: "October 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
console.log(dataTable2)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 4 ?
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
:
<span>validasi</span>
}
</div>
)
}
}
}, {
name: "November 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
console.log(dataTable2)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 4 ?
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
:
<span>validasi</span>
}
</div>
)
}
}
}, {
name: "December 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
console.log(dataTable2)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 4 ?
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
:
<span>validasi</span>
}
</div>
)
}
}
}, {
name: "Current Total",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
console.log(dataTable2)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 4 ?
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
:
<span>validasi</span>
}
</div>
)
}
}
}, {
name: "31 Dec 2022 Total",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
console.log(dataTable2)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 4 ?
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
:
<span>validasi</span>
}
</div>
)
}
}
}, {
name: "31 Dec 2023 Total",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
console.log(dataTable2)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 4 ?
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
null :
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value)}
/>
:
<span>validasi</span>
}
</div> </div>
) )
} }
...@@ -645,6 +1405,8 @@ export default class FixedAssetsMovement extends Component { ...@@ -645,6 +1405,8 @@ export default class FixedAssetsMovement extends Component {
} }
] ]
// console.log(this.props.width);
return ( return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}> <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}> <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
...@@ -658,14 +1420,14 @@ export default class FixedAssetsMovement extends Component { ...@@ -658,14 +1420,14 @@ export default class FixedAssetsMovement 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' }}>Periode : 2021</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode}</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: '100%' }}> <div style={{ marginTop: 20, width: this.props.width - 200, height: this.props.height-200 }}>
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={this.state.dataTable} data={dataTable2}
columns={columns} columns={columns}
options={options} options={options}
/> />
...@@ -693,9 +1455,23 @@ export default class FixedAssetsMovement extends Component { ...@@ -693,9 +1455,23 @@ export default class FixedAssetsMovement extends Component {
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960', marginRight: 20 }}> <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960', marginRight: 20 }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography>
</div> </div>
<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', marginRight: 20 }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography>
</div> </div>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
}}
onClick={() => this.forceUpdate()}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
</div> </div>
</div> </div>
</Paper> </Paper>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -157,7 +157,7 @@ class Login extends Component { ...@@ -157,7 +157,7 @@ class Login extends Component {
this.validateLogin() this.validateLogin()
}} }}
> >
<div style={{ paddingTop: 56, padding: 65, display: 'flex', flexDirection: 'column', height: (this.state.msgEmail.length > 45 ? 466 : 441), borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff' }}> <div style={{ maxWidth: 397, paddingTop: 56, padding: 65, display: 'flex', flexDirection: 'column', height: (this.state.msgEmail.length > 45 ? 475 : 441), borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff' }}>
<img src={Images.triputraBlack} style={{ height: 59, width: 175, alignSelf: 'center'}} /> <img src={Images.triputraBlack} style={{ height: 59, width: 175, alignSelf: 'center'}} />
<TextField <TextField
...@@ -189,7 +189,7 @@ class Login extends Component { ...@@ -189,7 +189,7 @@ class Login extends Component {
}} }}
variant="outlined" variant="outlined"
error={this.state.errorPassword} error={this.state.errorPassword}
style={{ width: '100%', height: 51, marginTop: this.state.errorEmail ? (this.state.msgEmail.length > 45 ? 60 : 35) : 20 }} style={{ width: '100%', height: 51, marginTop: this.state.errorEmail ? (this.state.msgEmail.length > 45 ? 70 : 35) : 20 }}
helperText={this.state.msgPassword} helperText={this.state.msgPassword}
onSubmit={() => this.validateLogin()} onSubmit={() => this.validateLogin()}
InputProps={{ InputProps={{
......
...@@ -43,7 +43,8 @@ export default class ReportItems extends Component { ...@@ -43,7 +43,8 @@ export default class ReportItems extends Component {
messageAlert: '', messageAlert: '',
buttonCreate: false, buttonCreate: false,
buttonEdit: false, buttonEdit: false,
load: false load: false,
judul: ''
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -52,11 +53,11 @@ export default class ReportItems extends Component { ...@@ -52,11 +53,11 @@ export default class ReportItems extends Component {
fileHandler = (event) => { fileHandler = (event) => {
let fileObj = event let fileObj = event
ExcelRenderer(fileObj, (err, resp) => { ExcelRenderer(fileObj, (err, resp) => {
// console.log(resp)
if (err) { if (err) {
console.log(err); console.log(err);
} }
else { else {
let judul = resp.rows[0]
let isi = resp.rows.slice(3) let isi = resp.rows.slice(3)
let payload = [] let payload = []
isi.map((item, index) => { isi.map((item, index) => {
...@@ -82,393 +83,400 @@ export default class ReportItems extends Component { ...@@ -82,393 +83,400 @@ export default class ReportItems extends Component {
let body = { let body = {
item_report: payload item_report: payload
} }
console.log(JSON.stringify(body)) console.log(resp.rows[1])
this.setState({ payload: body, buttonError: false }) this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] })
api.create().checkUploadReportItems(body).then(response => { }
console.log(response) });
if (response.data) { }
if (response.ok) {
if (response.data.status === "success") { checkUpload(){
let dataRow = response.data.data.map((item, index) => { api.create().checkUploadReportItems(this.state.payload).then(response => {
return [ console.log(response)
index + 1, let dataRow = []
item.report, if (response.data) {
item.company, if (response.ok) {
item.orders, if (response.data.status === "success") {
item.description, dataRow = response.data.data.map((item, index) => {
item.parent, return [
item.uom, index + 1,
item.weight, item.report,
item.type_report, item.company,
item.formula, item.orders,
item.condition_it_should_be, item.description,
item.condition_if_wrong, item.parent,
item.start_date, item.uom,
item.end_date, item.weight,
item.error item.type_report,
] item.formula,
}) item.condition_it_should_be,
let columns = [ item.condition_if_wrong,
"Data", item.start_date,
{ item.end_date,
name: "Report Type", item.error
options: { ]
customBodyRender: (val, tableMeta) => { })
let check = null let columns = [
if (tableMeta.rowData[14] != null) { "Data",
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('report')) {
if (check > -1) { name: "Report Type",
this.setState({ buttonError: true }) options: {
} customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('report'))
if (check > -1) {
this.setState({ buttonError: true })
} }
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[14] != null && check > -1 ?
<a data-tip={tableMeta.rowData[14][check].message} data-for="reportname">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="reportname" place="bottom" type="light" effect="solid" />
</div >
);
} }
} return (
}, <div style={{ display: 'flex' }}>
{ {tableMeta.rowData[14] != null && check > -1 ?
name: "Company Name", <a data-tip={tableMeta.rowData[14][check].message} data-for="reportname">
options: { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
customBodyRender: (val, tableMeta) => { </a> :
let check = null <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('company'))
if (check > -1) {
this.setState({ buttonError: true })
} }
<ReactTooltip border={true} id="reportname" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "Company Name",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('company'))
if (check > -1) {
this.setState({ buttonError: true })
} }
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[14] != null && check > -1 ?
<a data-tip={tableMeta.rowData[14][check].message} data-for="companyname">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="companyname" place="bottom" type="light" effect="solid" />
</div >
);
} }
} return (
}, <div style={{ display: 'flex' }}>
{ {tableMeta.rowData[14] != null && check > -1 ?
name: "Order", <a data-tip={tableMeta.rowData[14][check].message} data-for="companyname">
options: { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
customBodyRender: (val, tableMeta) => { </a> :
let check = null <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('orders'))
if (check > -1) {
this.setState({ buttonError: true })
} }
<ReactTooltip border={true} id="companyname" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "Order",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('orders'))
if (check > -1) {
this.setState({ buttonError: true })
} }
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[14] != null && check > -1 ?
<a data-tip={tableMeta.rowData[14][check].message} data-for="order">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="order" place="bottom" type="light" effect="solid" />
</div >
);
} }
} return (
}, <div style={{ display: 'flex' }}>
{ {tableMeta.rowData[14] != null && check > -1 ?
name: "Description", <a data-tip={tableMeta.rowData[14][check].message} data-for="order">
options: { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
customBodyRender: (val, tableMeta) => { </a> :
let check = null <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('description'))
if (check > -1) {
this.setState({ buttonError: true })
} }
<ReactTooltip border={true} id="order" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "Description",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('description'))
if (check > -1) {
this.setState({ buttonError: true })
} }
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[14] != null && check > -1 ?
<a data-tip={tableMeta.rowData[14][check].message} data-for="desc">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="desc" place="bottom" type="light" effect="solid" />
</div >
);
} }
} return (
}, <div style={{ display: 'flex' }}>
{ {tableMeta.rowData[14] != null && check > -1 ?
name: "Parent ID", <a data-tip={tableMeta.rowData[14][check].message} data-for="desc">
options: { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
customBodyRender: (val, tableMeta) => { </a> :
let check = null <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('parent'))
if (check > -1) {
this.setState({ buttonError: true })
} }
<ReactTooltip border={true} id="desc" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "Parent ID",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('parent'))
if (check > -1) {
this.setState({ buttonError: true })
} }
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[14] != null && check > -1 ?
<a data-tip={tableMeta.rowData[14][check].message} data-for="parents">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="parents" place="bottom" type="light" effect="solid" />
</div >
);
} }
} return (
}, <div style={{ display: 'flex' }}>
{ {tableMeta.rowData[14] != null && check > -1 ?
name: "UOM", <a data-tip={tableMeta.rowData[14][check].message} data-for="parents">
options: { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
customBodyRender: (val, tableMeta) => { </a> :
let check = null <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('uom'))
if (check > -1) {
this.setState({ buttonError: true })
} }
<ReactTooltip border={true} id="parents" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "UOM",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('uom'))
if (check > -1) {
this.setState({ buttonError: true })
} }
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[14] != null && check > -1 ?
<a data-tip={tableMeta.rowData[14][check].message} data-for="uoms">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="uoms" place="bottom" type="light" effect="solid" />
</div >
);
} }
} return (
}, <div style={{ display: 'flex' }}>
{ {tableMeta.rowData[14] != null && check > -1 ?
name: "Weight", <a data-tip={tableMeta.rowData[14][check].message} data-for="uoms">
options: { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
customBodyRender: (val, tableMeta) => { </a> :
let check = null <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('weight'))
if (check > -1) {
this.setState({ buttonError: true })
} }
<ReactTooltip border={true} id="uoms" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "Weight",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('weight'))
if (check > -1) {
this.setState({ buttonError: true })
} }
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[14] != null && check > -1 ?
<a data-tip={tableMeta.rowData[14][check].message} data-for="weights">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="weights" place="bottom" type="light" effect="solid" />
</div >
);
} }
} return (
}, <div style={{ display: 'flex' }}>
{ {tableMeta.rowData[14] != null && check > -1 ?
name: "Data Type", <a data-tip={tableMeta.rowData[14][check].message} data-for="weights">
options: { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
customBodyRender: (val, tableMeta) => { </a> :
let check = null <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('type_report'))
if (check > -1) {
this.setState({ buttonError: true })
} }
<ReactTooltip border={true} id="weights" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "Data Type",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('type_report'))
if (check > -1) {
this.setState({ buttonError: true })
} }
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[14] != null && check > -1 ?
<a data-tip={tableMeta.rowData[14][check].message} data-for="datatype">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="datatype" place="bottom" type="light" effect="solid" />
</div >
);
} }
} return (
}, <div style={{ display: 'flex' }}>
{ {tableMeta.rowData[14] != null && check > -1 ?
name: "Formula", <a data-tip={tableMeta.rowData[14][check].message} data-for="datatype">
options: { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
customBodyRender: (val, tableMeta) => { </a> :
let check = null <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('formula'))
if (check > -1) {
this.setState({ buttonError: true })
} }
<ReactTooltip border={true} id="datatype" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "Formula",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('formula'))
if (check > -1) {
this.setState({ buttonError: true })
} }
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[14] != null && check > -1 ?
<a data-tip={tableMeta.rowData[14][check].message} data-for="formulas">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="formulas" place="bottom" type="light" effect="solid" />
</div >
);
} }
} return (
}, <div style={{ display: 'flex' }}>
{ {tableMeta.rowData[14] != null && check > -1 ?
name: "True Value", <a data-tip={tableMeta.rowData[14][check].message} data-for="formulas">
options: { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
customBodyRender: (val, tableMeta) => { </a> :
let check = null <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('condition_it_should_be'))
if (check > -1) {
this.setState({ buttonError: true })
} }
<ReactTooltip border={true} id="formulas" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "True Value",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('condition_it_should_be'))
if (check > -1) {
this.setState({ buttonError: true })
} }
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[14] != null && check > -1 ?
<a data-tip={tableMeta.rowData[14][check].message} data-for="values">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="values" place="bottom" type="light" effect="solid" />
</div >
);
} }
} return (
}, <div style={{ display: 'flex' }}>
{ {tableMeta.rowData[14] != null && check > -1 ?
name: "False Condition", <a data-tip={tableMeta.rowData[14][check].message} data-for="values">
options: { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
customBodyRender: (val, tableMeta) => { </a> :
let check = null <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('condition_if_wrong'))
if (check > -1) {
this.setState({ buttonError: true })
} }
<ReactTooltip border={true} id="values" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "False Condition",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('condition_if_wrong'))
if (check > -1) {
this.setState({ buttonError: true })
} }
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[14] != null && check > -1 ?
<a data-tip={tableMeta.rowData[14][check].message} data-for="conditions">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="conditions" place="bottom" type="light" effect="solid" />
</div >
);
} }
} return (
}, <div style={{ display: 'flex' }}>
{ {tableMeta.rowData[14] != null && check > -1 ?
name: "Valid From", <a data-tip={tableMeta.rowData[14][check].message} data-for="conditions">
options: { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
customBodyRender: (val, tableMeta) => { </a> :
let check = null <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('start_date'))
if (check > -1) {
this.setState({ buttonError: true })
} }
<ReactTooltip border={true} id="conditions" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "Valid From",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('start_date'))
if (check > -1) {
this.setState({ buttonError: true })
} }
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[14] != null && check > -1 ?
<a data-tip={tableMeta.rowData[14][check].message} data-for="startdate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="startdate" place="bottom" type="light" effect="solid" />
</div >
);
} }
} return (
}, <div style={{ display: 'flex' }}>
{ {tableMeta.rowData[14] != null && check > -1 ?
name: "Valid To", <a data-tip={tableMeta.rowData[14][check].message} data-for="startdate">
options: { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
customBodyRender: (val, tableMeta) => { </a> :
let check = null <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('end_date'))
if (check > -1) {
this.setState({ buttonError: true })
} }
<ReactTooltip border={true} id="startdate" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "Valid To",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[14] != null) {
check = tableMeta.rowData[14].findIndex((val) => val.field.includes('end_date'))
if (check > -1) {
this.setState({ buttonError: true })
} }
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[14] != null && check > -1 ?
<a data-tip={tableMeta.rowData[14][check].message} data-for="enddate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="enddate" place="bottom" type="light" effect="solid" />
</div >
);
} }
} return (
}, <div style={{ display: 'flex' }}>
{ {tableMeta.rowData[14] != null && check > -1 ?
name: "", <a data-tip={tableMeta.rowData[14][check].message} data-for="enddate">
options: { <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
display: false </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="enddate" place="bottom" type="light" effect="solid" />
</div >
);
} }
} }
] },
{
console.log(dataRow); name: "",
this.setState({ options: {
dataLoaded: true, display: false
cols: columns,
rows: dataRow
});
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
} }
}) }
} ]
// console.log(dataRow);
this.setState({
dataLoaded: true,
cols: columns,
rows: dataRow, visibleUpload: false,
itemReport: false
});
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
} }
console.log(response); } else {
}) this.setState({
dataLoaded: false,
alert: true, messageAlert: response.problem, tipeAlert: 'error'
});
} }
}); })
} }
componentDidMount() { componentDidMount() {
...@@ -993,7 +1001,8 @@ export default class ReportItems extends Component { ...@@ -993,7 +1001,8 @@ export default class ReportItems extends Component {
</button> </button>
<button <button
type="button" type="button"
onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : this.uploadReportItems()} disabled={this.state.buttonError == true ? true : false}
onClick={() => this.uploadReportItems()}
style={{}} style={{}}
> >
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
...@@ -1050,7 +1059,12 @@ export default class ReportItems extends Component { ...@@ -1050,7 +1059,12 @@ export default class ReportItems extends Component {
this.fileHandler(dt) this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' }) this.setState({ uploadStatus: 'idle', percentage: '0' })
}} }}
onUpload={() => this.setState({ visibleUpload: false, itemReport: false })} onUpload={() => {
this.state.judul === "MASTER DATA - REPORT ITEMS" ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning'})
}}
/> />
</div> </div>
</div> </div>
......
...@@ -331,6 +331,206 @@ exports.customTable2 = function () { ...@@ -331,6 +331,206 @@ exports.customTable2 = function () {
} }
} }
exports.customTable3 = function () {
return {
typography: {
useNextVariants: true,
},
overrides: {
MUIDataTable: {
paper: {
position: 'relative',
// width: '100% !important',
boxShadow: "0 0 0 0 rgba(154,161,171,.15)",
border: "1px rgba(0,0,0,0.1) solid",
borderRadius: "10px",
overflow: "hidden",
},
// responsiveScroll: {
// position: 'relative',
// width: '100% !important',
// }
responsiveScrollMaxHeight: {
height: 650,
maxHeight: 650
},
},
MuiToolbar: {
root: {
position: 'relative',
}
},
MUIDataTableToolbar: {
root: {
position: 'relative',
padding: "0px 15px",
backgroundColor: '#f2f6fa', //'rgba(0,76,151,0.05)',
},
titleText: {
color: "#555"
},
icon: {
color: "#555 !important"
},
iconActive: {
color: "#555 !important"
},
left: {
flex: "0 0 auto !important"
},
actions: {
flex: "1 0 auto !important"
}
},
MUIDataTableSearch: {
main: {
position: 'absolute',
top: "0",
right: "-9px",
width: "350px !important",
backgroundColor: "#f2f6fa",
zIndex: "10",
textAlign: "right",
display: "block",
},
searchIcon: {
width: "50px !important",
color: "#555 !important",
display: "inline-block",
textAlign: "center",
verticalAlign: "top",
},
searchText: {
width: "calc(100% - 120px) !important",
marginRight: "10px",
color: "#555 !important",
display: "inline-block",
verticalAlign: "top",
},
clearIcon: {
width: "50px !important",
color: "#555 !important",
display: "inline-block",
verticalAlign: "top",
},
},
MuiTableCell: {
root: {
display: 'table-cell',
padding: 7,
paddingLeft: 25,
fontSize: '0.875rem',
textAlign: 'left',
fontFamily: "Roboto, Helvetica, Arial, sans-serif",
fontWeight: 400,
lineHeight: 1.43,
borderBottom: '1px solid rgba(224, 224, 224, 1)',
letterSpacing: '0.01071em',
verticalAlign: 'inherit',
}
},
MUIDataTableHead: {
main: {
position: 'relative',
backgroundColor: mainColor,
color: "#555",
// display: "flex",
// alignItems: "stretch"
},
fixedHeader: {
// position: "relative",
borderBottom: "1px rgba(0,0,0,0.1) solid",
backgroundColor: '#f2f6fa', //'rgba(0,76,151,0.05)',
color: "#555",
padding: "10px 20px",
height: "auto"
},
},
MUIDataTableHeadRow: {
root: {
position: 'relative',
backgroundColor: mainColor,
}
},
MUIDataTableHeadCell: {
root: {
fontSize: "10pt",
fontWeight: "500",
color: "#555",
backgroundColor: secondColor,
},
fixedHeader: {
// position: "relative",
borderBottom: "1px rgba(0,0,0,0.1) solid",
backgroundColor: '#f2f6fa', //'rgba(0,76,151,0.05)',
color: "#555",
padding: "10px 25px",
height: "auto"
},
toolButton: {
display: "flex",
height: "auto",
},
data: {
display: "inline-block",
verticalAlign: "top",
},
sortActive: {
color: "#555"
},
sortAction: {
color: "#555",
display: "inline-block",
verticalAlign: "top",
MuiButtonBase: {
color: "#555",
root: {
color: "#555",
}
}
}
},
MUIDataTableBodyCell: {
root: {
position: 'relative',
fontSize: "13px",
}
},
MUIDataTableSelectCell: {
headerCell: {
backgroundColor: secondColor,
checkboxRoot: {
color: "#555",
}
},
checkboxRoot: {
color: "#555"
}
},
MuiInput: {
root: {
top: "5px",
color: "#555 !important",
},
underline: {
borderBottom: "1px #555 solid !important",
}
},
MuiSelect: {
root: {
top: "0",
color: "#555 !important",
},
}
// MuiIconButton: {
// root: {
// color: "#fff !important",
// }
// }
}
}
}
exports.customOptions = function () { exports.customOptions = function () {
return { return {
// selectableRows: false, // selectableRows: false,
...@@ -371,7 +571,7 @@ exports.customOptionsFixedColumn = function () { ...@@ -371,7 +571,7 @@ exports.customOptionsFixedColumn = function () {
sort: false, sort: false,
responsive: 'scrollMaxHeight', responsive: 'scrollMaxHeight',
viewColumns:false, viewColumns:false,
overflowX: 'auto', // overflowX: 'auto',
print: false, print: false,
download: false, download: false,
elevation: 5, elevation: 5,
......
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