Commit 8576aab2 authored by EKSAD's avatar EKSAD

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

parents 30ed4bca 88eea993
...@@ -9,6 +9,7 @@ import { titleCase } from '../library/Utils'; ...@@ -9,6 +9,7 @@ import { titleCase } from '../library/Utils';
import ProfitLoss from './BudgetTahunan/ProfitLoss'; import ProfitLoss from './BudgetTahunan/ProfitLoss';
import TaxPlanning from './BudgetTahunan/TaxPlanning'; import TaxPlanning from './BudgetTahunan/TaxPlanning';
import FixedAssetsMovement from './BudgetTahunan/FixedAssetsMovement'; import FixedAssetsMovement from './BudgetTahunan/FixedAssetsMovement';
import CorporateAnnualTarget from './BudgetTahunan/CorporateAnnualTarget';
export default class BudgetTahunan extends Component { export default class BudgetTahunan extends Component {
constructor(props) { constructor(props) {
...@@ -23,7 +24,8 @@ export default class BudgetTahunan extends Component { ...@@ -23,7 +24,8 @@ export default class BudgetTahunan extends Component {
company: null, company: null,
report_id: null, report_id: null,
visiblePL: false, visiblePL: false,
visibleFAM: false visibleFAM: false,
visibleCAT: false
} }
} }
...@@ -114,6 +116,15 @@ export default class BudgetTahunan extends Component { ...@@ -114,6 +116,15 @@ export default class BudgetTahunan extends Component {
visibleFAM: true, visibleFAM: true,
visibleTP: false visibleTP: false
}) })
} else if (item === 'CAT') {
this.setState({
visibleBudgetTahunan: false,
visibleBS: false,
visiblePL: false,
visibleCAT: true,
visibleFAM: false,
visibleTP: false
})
} }
} }
...@@ -319,7 +330,14 @@ export default class BudgetTahunan extends Component { ...@@ -319,7 +330,14 @@ export default class BudgetTahunan extends Component {
/> />
)} )}
{this.state.visibleFAM && ( {this.state.visibleFAM && (
<FixedAssetsMovement /> <FixedAssetsMovement
onClickClose={() => this.setState({ visibleFAM: false, visibleBudgetTahunan: true })}
/>
)}
{this.state.visibleCAT && (
<CorporateAnnualTarget
onClickClose={() => this.setState({ visibleCAT: false, visibleBudgetTahunan: true })}
/>
)} )}
</div > </div >
); );
......
...@@ -121,9 +121,9 @@ export default class BalanceSheet extends Component { ...@@ -121,9 +121,9 @@ export default class BalanceSheet extends Component {
handleValue(data) { handleValue(data) {
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[6] == undefined? (total + 0) : (total + item[6]) total = item[data.columnIndex] == undefined ? (total + 0) : (total + 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])
...@@ -133,17 +133,17 @@ export default class BalanceSheet extends Component { ...@@ -133,17 +133,17 @@ export default class BalanceSheet extends Component {
} }
handleChange(value, tableMeta) { handleChange(value, tableMeta) {
let val = String(value).split(",").join("")
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])
// console.log(indexParent);
if (indexParent > 0) { if (indexParent > 0) {
let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(value) 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(value)) : (jagain + Number(value)) a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
} else { } else {
let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(value) data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
} }
// console.log(this.state.dataTable)
// this.setState({ // this.setState({
// data: a, // data: a,
// }, () => console.log(this.state.dataTable)) // }, () => console.log(this.state.dataTable))
...@@ -155,22 +155,22 @@ export default class BalanceSheet extends Component { ...@@ -155,22 +155,22 @@ export default class BalanceSheet extends Component {
options: { options: {
display: false display: false
} }
},{ }, {
name: "", name: "",
options: { options: {
display: false display: false
} }
},{ }, {
name: "", name: "",
options: { options: {
display: false display: false
} }
},{ }, {
name: "", name: "",
options: { options: {
display: false display: false
} }
},{ }, {
name: "Account", name: "Account",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
...@@ -185,7 +185,7 @@ export default class BalanceSheet extends Component { ...@@ -185,7 +185,7 @@ export default class BalanceSheet extends Component {
{tableMeta.rowData[3] == 0 ? {tableMeta.rowData[3] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(val).toUpperCase()}</span> <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(val).toUpperCase()}</span>
: :
tableMeta.rowData[3] === 1? tableMeta.rowData[3] === 1 ?
<span style={{ fontSize: 12, marginLeft: 20 }}>{val}</span> : <span style={{ fontSize: 12, marginLeft: 20 }}>{val}</span> :
<span style={{ fontSize: 12, marginLeft: 40 }}>{val}</span> <span style={{ fontSize: 12, marginLeft: 40 }}>{val}</span>
} }
...@@ -197,18 +197,67 @@ export default class BalanceSheet extends Component { ...@@ -197,18 +197,67 @@ export default class BalanceSheet extends Component {
name: "31 Dec 2020 Actual", name: "31 Dec 2020 Actual",
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>
), ),
setCellProps: () => ({ // customHeadRender: (columnMeta) => (
style: { // <TableCell key={columnMeta.index} style={{ ...style2, top: 0, zIndex: 102, backgroundColor: '#354960', width: 96 }}>
position: "sticky", // <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
left: 420, // </TableCell>
background: "white", // ),
zIndex: 101 // setCellProps: () => ({
// style: {
// position: "sticky",
// left: 420,
// background: "white",
// zIndex: 101
// }
// }),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ?
<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}
onChange={event => {
// console.log(event.target)
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
/>
}
/>
</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={this.handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 1 ?
<span>-</span>
:
<span>validasi</span>
}
</div>
)
} }
})
} }
}, { }, {
name: "January 2021", name: "January 2021",
...@@ -243,7 +292,16 @@ export default class BalanceSheet extends Component { ...@@ -243,7 +292,16 @@ export default class BalanceSheet extends Component {
/> />
</div> : </div> :
tableMeta.rowData[0] === 2 ? tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>{this.handleValue(tableMeta)}</span> <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={this.handleValue(tableMeta)}
/>
</span>
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
<span>-</span> <span>-</span>
...@@ -262,10 +320,47 @@ export default class BalanceSheet extends Component { ...@@ -262,10 +320,47 @@ export default class BalanceSheet 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>
), ),
customBodyRender: (val) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ textAlign: 'right' }}>
{val} {tableMeta.rowData[0] === 4 ?
<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}
onChange={event => {
// console.log(event.target)
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
/>
}
/>
</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={this.handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 1 ?
<span>-</span>
:
<span>validasi</span>
}
</div> </div>
) )
} }
...@@ -278,10 +373,47 @@ export default class BalanceSheet extends Component { ...@@ -278,10 +373,47 @@ export default class BalanceSheet 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>
), ),
customBodyRender: (val) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ textAlign: 'right' }}>
{val} {tableMeta.rowData[0] === 4 ?
<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}
onChange={event => {
// console.log(event.target)
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
/>
}
/>
</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={this.handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 1 ?
<span>-</span>
:
<span>validasi</span>
}
</div> </div>
) )
} }
...@@ -294,10 +426,47 @@ export default class BalanceSheet extends Component { ...@@ -294,10 +426,47 @@ export default class BalanceSheet 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>
), ),
customBodyRender: (val) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ textAlign: 'right' }}>
{val} {tableMeta.rowData[0] === 4 ?
<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}
onChange={event => {
// console.log(event.target)
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
/>
}
/>
</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={this.handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 1 ?
<span>-</span>
:
<span>validasi</span>
}
</div> </div>
) )
} }
...@@ -310,10 +479,47 @@ export default class BalanceSheet extends Component { ...@@ -310,10 +479,47 @@ export default class BalanceSheet 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>
), ),
customBodyRender: (val) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ textAlign: 'right' }}>
{val} {tableMeta.rowData[0] === 4 ?
<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}
onChange={event => {
// console.log(event.target)
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
/>
}
/>
</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={this.handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 1 ?
<span>-</span>
:
<span>validasi</span>
}
</div> </div>
) )
} }
...@@ -326,10 +532,47 @@ export default class BalanceSheet extends Component { ...@@ -326,10 +532,47 @@ export default class BalanceSheet 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>
), ),
customBodyRender: (val) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ textAlign: 'right' }}>
{val} {tableMeta.rowData[0] === 4 ?
<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}
onChange={event => {
// console.log(event.target)
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
/>
}
/>
</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={this.handleValue(tableMeta)}
/>
</span>
:
tableMeta.rowData[0] === 1 ?
<span>-</span>
:
<span>validasi</span>
}
</div> </div>
) )
} }
......
import React, { Component } from 'react';
import { Typography, Paper, createMuiTheme, MuiThemeProvider, TableCell, FormControlLabel, TextField, Input } from '@material-ui/core';
import MUIDataTable from 'mui-datatables';
import NumberFormat from 'react-number-format';
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
const options = ct.customOptionsFixedColumn();
const style = {
position: "sticky",
left: 0,
background: "white",
zIndex: 101,
};
const style2 = {
position: "sticky",
left: 420,
background: "white",
zIndex: 101
};
export default class CorporateAnnualTarget extends Component {
constructor(props) {
super(props)
this.state = {
dataTable: [
["FINANCIAL PERSPECTIVE", "9,884,181", "9,884,181", "9,884,181", "9,884,181", "9,884,181", "9,884,181", "9,884,181", "9,884,181", "9,884,181", "9,884,181"],
["Control", "-", "-"],
["Accumulated Depreciation (negative value)", "2,647,647", "2,058,898"],
["Control", "-", "-"],
["Gain / (Loss) on Fixed Assets", "-", "-"],
["Control", "-", "-"]
]
}
}
componentDidMount() {
console.log(this.props);
}
handleChange(value, tableMeta) {
let data = this.state.dataTable
let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = value
this.setState({
data: a
}, () => console.log(this.state.dataTable))
// let a = data[0].tableMeta.tableData[tableMeta.rowIndex] === value
// console.log(data)
}
render() {
const columns = [{
name: "Key Performance Indicator",
options: {
customHeadRender: (columnMeta) => (
<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>
</TableCell>
),
setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 388 }}>
{tableMeta.rowIndex == 0 || tableMeta.rowIndex == 1 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{val}</span>
:
tableMeta.rowIndex == 2 || tableMeta.rowIndex == 6 || tableMeta.rowIndex == 7 || tableMeta.rowIndex == 8 ?
<span style={{ fontSize: 12, marginLeft: 10 }}>{val}</span> :
<span style={{ fontSize: 12, marginLeft: 20 }}>{val}</span>
}
</div>
)
}
}
}, {
name: "Weight",
options: {
customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style2, top: 0, zIndex: 102, backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({
style: {
position: "sticky",
left: 420,
background: "white",
zIndex: 101
}
})
}
}, {
name: "UOM",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowIndex === 3 || tableMeta.rowIndex === 4 || tableMeta.rowIndex === 9 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
// <Input
// value={this.formatValue(value)}
// style={{}}
// inputProps={{
// style: {
// color: "#5198ea",
// fontSize: 12,
// textAlign: 'right'
// }
// }}
// disableUnderline={true}
// inputStyle={{ color: 'red' }}
// />
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
/>
}
onChange={event => updateValue(event.target.value)}
/>
</div> :
<span style={{ fontSize: 12, textAlign: 'right' }}>{value === "" ? "-" : value}</span>
}
</div>
)
}
}
}, {
name: "Jenis KPI",
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: "Max Ach.",
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: "Formula YTD",
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: "January 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: "February 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: "March 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: "April 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: "May 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: "June 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: "31 Dec 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: "31 Dec 2022 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: "31 Dec 2023 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>
)
}
}
}
]
return (
<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 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Pengajuan Budget Tahunan</Typography>
</div>
<div style={{ flex: 1, padding: 20, width: '100%' }}>
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Fixed Assets Movement</Typography>
</div>
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>PT. XYZ</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : 2021</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ marginTop: 20, width: '100%' }}>
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={this.state.dataTable}
columns={columns}
options={options}
/>
</MuiThemeProvider>
</div>
</div>
<div className="grid grid-2x">
<div className="col-1">
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
}}
onClick={() => this.props.onClickClose()}
>
<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>
</div>
</button>
</div>
<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 }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography>
</div>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography>
</div>
</div>
</div>
</Paper>
</div>
</div>
);
}
}
...@@ -334,25 +334,25 @@ export default class CreateParameter extends Component { ...@@ -334,25 +334,25 @@ export default class CreateParameter extends Component {
validasi() { validasi() {
if (R.isNil(this.state.getTypes)) { if (R.isNil(this.state.getTypes)) {
this.setState({ errorGroup: true, msgErrorGroup: 'Group is required.' }) this.setState({ errorGroup: true, msgErrorGroup: 'Group Cannot be Empty.' })
} else if (R.isNil(this.state.getParameter)) { } else if (R.isNil(this.state.getParameter)) {
this.setState({ errorParameter: true, msgErrorParameter: 'Parameter is required.' }) this.setState({ errorParameter: true, msgErrorParameter: 'Parameter Cannot be Empty.' })
} else if (R.isNil(this.state.getPerusahaan)) { } else if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company is required.' }) this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Cannot be Empty.' })
// } else if (R.isEmpty(this.state.tempData.description)) { // } else if (R.isEmpty(this.state.tempData.description)) {
// this.setState({ errorDeskripsi: true, msgErrorDeskripsi: 'Deskripsi tidak boleh kosong' }) // this.setState({ errorDeskripsi: true, msgErrorDeskripsi: 'Deskripsi tidak boleh kosong' })
// } else if (R.isEmpty(this.state.tempData.value)) { // } else if (R.isEmpty(this.state.tempData.value)) {
// this.setState({ errorValue: true, msgErrorValue: 'Value tidak boleh kosong' }) // this.setState({ errorValue: true, msgErrorValue: 'Value tidak boleh kosong' })
} else if ((!R.isNil(this.state.tempData.max_value) && R.isNil(this.state.tempData.min_value)) || (!R.isNil(this.state.tempData.max_value) && R.isEmpty(this.state.tempData.min_value))) { } else if ((!R.isNil(this.state.tempData.max_value) && R.isNil(this.state.tempData.min_value)) || (!R.isEmpty(this.state.tempData.max_value) && R.isEmpty(this.state.tempData.min_value))) {
this.setState({ errorMinValue: true, msgErrorMinValue: 'Min value is required.' }) this.setState({ errorMinValue: true, msgErrorMinValue: 'Min Value Cannot be Empty.' })
} else if (R.isNil(this.state.tempData.start_date)) { } else if (R.isNil(this.state.tempData.start_date)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Start date is required.' }) this.setState({ errorStartDate: true, msgErrorStartDate: 'Start date Cannot be Empty.' })
// } else if (R.isNil(this.state.tempData.order)) { // } else if (R.isNil(this.state.tempData.order)) {
// this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' }) // this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' })
} else if (!R.isNil(this.state.tempData.min_value) && R.isNil(this.state.tempData.max_value)) { } else if ((!R.isNil(this.state.tempData.min_value) && R.isNil(this.state.tempData.max_value)) || (!R.isEmpty(this.state.tempData.min_value) && R.isEmpty(this.state.tempData.max_value))) {
this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Max value is required.' }) this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Max Value Cannot be Empty.' })
} else if (R.isNil(this.state.tempData.end_date)) { } else if (R.isNil(this.state.tempData.end_date)) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'End date is required.' }) this.setState({ errorEndDate: true, msgErrorEndDate: 'End date Cannot be Empty.' })
} else { } else {
this.updateParameter() this.updateParameter()
} }
...@@ -360,25 +360,25 @@ export default class CreateParameter extends Component { ...@@ -360,25 +360,25 @@ export default class CreateParameter extends Component {
validasiCreate() { validasiCreate() {
if (R.isNil(this.state.getTypes)) { if (R.isNil(this.state.getTypes)) {
this.setState({ errorGroup: true, msgErrorGroup: 'Group is required.' }) this.setState({ errorGroup: true, msgErrorGroup: 'Group Cannot be Empty.' })
} else if (R.isNil(this.state.getParameter)) { } else if (R.isNil(this.state.getParameter)) {
this.setState({ errorParameter: true, msgErrorParameter: 'Parameter is required.' }) this.setState({ errorParameter: true, msgErrorParameter: 'Parameter Cannot be Empty.' })
} else if (R.isNil(this.state.getPerusahaan)) { } else if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Perusahaan is required.' }) this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Perusahaan Cannot be Empty.' })
// } else if (R.isEmpty(this.state.description)) { // } else if (R.isEmpty(this.state.description)) {
// this.setState({ errorDeskripsi: true, msgErrorDeskripsi: 'Deskripsi tidak boleh kosong' }) // this.setState({ errorDeskripsi: true, msgErrorDeskripsi: 'Deskripsi tidak boleh kosong' })
// } else if (R.isNil(this.state.value)) { // } else if (R.isNil(this.state.value)) {
// this.setState({ errorValue: true, msgErrorValue: 'Value tidak boleh kosong' }) // this.setState({ errorValue: true, msgErrorValue: 'Value tidak boleh kosong' })
} else if (!R.isNil(this.state.maxValue) && R.isNil(this.state.minValue)) { } else if ((!R.isNil(this.state.maxValue) && R.isNil(this.state.minValue)) || (!R.isNil(this.state.maxValue) && R.isEmpty(this.state.minValue))) {
this.setState({ errorMinValue: true, msgErrorMinValue: 'Min value is required.' }) this.setState({ errorMinValue: true, msgErrorMinValue: 'Min Value Cannot be Empty.' })
} else if (R.isNil(this.state.startDate)) { } else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Start date is required.' }) this.setState({ errorStartDate: true, msgErrorStartDate: 'Start date Cannot be Empty.' })
// } else if (R.isNil(this.state.order)) { // } else if (R.isNil(this.state.order)) {
// this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' }) // this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' })
} else if (!R.isNil(this.state.minValue) && R.isNil(this.state.maxValue)) { } else if ((!R.isNil(this.state.minValue) && R.isNil(this.state.maxValue)) || (!R.isNil(this.state.minValue) && R.isEmpty(this.state.maxValue))) {
this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Max value is required.' }) this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Max Value Cannot be Empty.' })
} else if (R.isNil(this.state.endDate)) { } else if (R.isNil(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'End date is required' }) this.setState({ errorEndDate: true, msgErrorEndDate: 'End date Cannot be Empty' })
} else { } else {
this.createParameter() this.createParameter()
} }
...@@ -516,7 +516,6 @@ export default class CreateParameter extends Component { ...@@ -516,7 +516,6 @@ export default class CreateParameter extends Component {
id="value" id="value"
label="Value" label="Value"
value={this.state.tempData === null ? '' : this.state.tempData.value} value={this.state.tempData === null ? '' : this.state.tempData.value}
type={"number"}
inputProps={{ inputProps={{
min: 0, min: 0,
style: { style: {
...@@ -530,7 +529,18 @@ export default class CreateParameter extends Component { ...@@ -530,7 +529,18 @@ export default class CreateParameter extends Component {
} }
}} }}
name="value" name="value"
onChange={(e) => this.handleChange(e, '')} onChange={(e) => {
let coba = String(e.target.value).replace(/[^\d]/g, '');
this.setState({
tempData: {
...this.state.tempData,
value: coba
}
})
this.clearMessage()
}
// this.handleChange(coba, 'value')}
}
// error={this.state.errorValue} // error={this.state.errorValue}
// helperText={this.state.msgErrorValue} // helperText={this.state.msgErrorValue}
> >
...@@ -541,7 +551,6 @@ export default class CreateParameter extends Component { ...@@ -541,7 +551,6 @@ export default class CreateParameter extends Component {
style={{ width: '100%' }} style={{ width: '100%' }}
id="min_value" id="min_value"
label="Min Value" label="Min Value"
type={"number"}
value={this.state.tempData === null ? '' : this.state.tempData.min_value} value={this.state.tempData === null ? '' : this.state.tempData.min_value}
inputProps={{ inputProps={{
min: 0, min: 0,
...@@ -556,7 +565,18 @@ export default class CreateParameter extends Component { ...@@ -556,7 +565,18 @@ export default class CreateParameter extends Component {
} }
}} }}
name="min_value" name="min_value"
onChange={(e) => this.handleChange(e, '')} onChange={(e) => {
let coba = String(e.target.value).replace(/[^\d]/g, '');
this.setState({
tempData: {
...this.state.tempData,
min_value: coba
}
})
this.clearMessage()
}
// this.handleChange(coba, 'value')}
}
error={this.state.errorMinValue} error={this.state.errorMinValue}
helperText={this.state.msgErrorMinValue} helperText={this.state.msgErrorMinValue}
> >
...@@ -663,7 +683,6 @@ export default class CreateParameter extends Component { ...@@ -663,7 +683,6 @@ export default class CreateParameter extends Component {
style={{ width: '100%' }} style={{ width: '100%' }}
id="order" id="order"
label="Order" label="Order"
type={"number"}
value={this.state.tempData === null ? '' : this.state.tempData.order} value={this.state.tempData === null ? '' : this.state.tempData.order}
inputProps={{ inputProps={{
min: 0, min: 0,
...@@ -678,7 +697,17 @@ export default class CreateParameter extends Component { ...@@ -678,7 +697,17 @@ export default class CreateParameter extends Component {
} }
}} }}
name="order" name="order"
onChange={(e) => this.handleChange(e, '')} onChange={(e) => {
let coba = String(e.target.value).replace(/[^\d]/g,'');
this.setState({
tempData: {
...this.state.tempData,
order: coba
}
})
this.clearMessage()}
// this.handleChange(coba, 'value')}
}
// error={this.state.errorOrder} // error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder} // helperText={this.state.msgErrorOrder}
> >
...@@ -689,7 +718,6 @@ export default class CreateParameter extends Component { ...@@ -689,7 +718,6 @@ export default class CreateParameter extends Component {
style={{ width: '100%' }} style={{ width: '100%' }}
id="max_value" id="max_value"
label="Max Value" label="Max Value"
type={"number"}
value={this.state.tempData === null ? '' : this.state.tempData.max_value} value={this.state.tempData === null ? '' : this.state.tempData.max_value}
inputProps={{ inputProps={{
min: 0, min: 0,
...@@ -704,7 +732,18 @@ export default class CreateParameter extends Component { ...@@ -704,7 +732,18 @@ export default class CreateParameter extends Component {
} }
}} }}
name="max_value" name="max_value"
onChange={(e) => this.handleChange(e, '')} onChange={(e) => {
let coba = String(e.target.value).replace(/[^\d]/g, '');
this.setState({
tempData: {
...this.state.tempData,
max_value: coba
}
})
this.clearMessage()
}
// this.handleChange(coba, 'value')}
}
error={this.state.errorMaxValue} error={this.state.errorMaxValue}
helperText={this.state.msgErrorMaxValue} helperText={this.state.msgErrorMaxValue}
> >
...@@ -860,7 +899,6 @@ export default class CreateParameter extends Component { ...@@ -860,7 +899,6 @@ export default class CreateParameter extends Component {
id="value" id="value"
label="Value" label="Value"
value={this.state.value === null ? '' : this.state.value} value={this.state.value === null ? '' : this.state.value}
type={"number"}
inputProps={{ inputProps={{
min: 0, min: 0,
style: { style: {
...@@ -875,7 +913,14 @@ export default class CreateParameter extends Component { ...@@ -875,7 +913,14 @@ export default class CreateParameter extends Component {
} }
}} }}
name="value" name="value"
onChange={(e) => this.handleChangeCreate(e, '')} onChange={(e) => {
let coba = String(e.target.value).replace(/[^\d]/g,'');
this.setState({
value: coba
})
this.clearMessage()}
// this.handleChange(coba, 'value')}
}
// error={this.state.errorValue} // error={this.state.errorValue}
// helperText={this.state.msgErrorValue} // helperText={this.state.msgErrorValue}
> >
...@@ -886,7 +931,6 @@ export default class CreateParameter extends Component { ...@@ -886,7 +931,6 @@ export default class CreateParameter extends Component {
style={{ width: '100%' }} style={{ width: '100%' }}
id="min_value" id="min_value"
label="Min Value" label="Min Value"
type={"number"}
value={this.state.minValue === null ? '' : this.state.minValue} value={this.state.minValue === null ? '' : this.state.minValue}
inputProps={{ inputProps={{
min: 0, min: 0,
...@@ -901,7 +945,14 @@ export default class CreateParameter extends Component { ...@@ -901,7 +945,14 @@ export default class CreateParameter extends Component {
} }
}} }}
name="minValue" name="minValue"
onChange={(e) => this.handleChangeCreate(e, '')} onChange={(e) => {
let coba = String(e.target.value).replace(/[^\d]/g,'');
this.setState({
minValue: coba
})
this.clearMessage()}
// this.handleChange(coba, 'value')}
}
error={this.state.errorMinValue} error={this.state.errorMinValue}
helperText={this.state.msgErrorMinValue} helperText={this.state.msgErrorMinValue}
> >
...@@ -1005,7 +1056,6 @@ export default class CreateParameter extends Component { ...@@ -1005,7 +1056,6 @@ export default class CreateParameter extends Component {
style={{ width: '100%' }} style={{ width: '100%' }}
id="order" id="order"
label="Order" label="Order"
type={"number"}
value={this.state.order === null ? '' : this.state.order} value={this.state.order === null ? '' : this.state.order}
inputProps={{ inputProps={{
min: 0, min: 0,
...@@ -1020,7 +1070,14 @@ export default class CreateParameter extends Component { ...@@ -1020,7 +1070,14 @@ export default class CreateParameter extends Component {
} }
}} }}
name="order" name="order"
onChange={(e) => this.handleChangeCreate(e, '')} onChange={(e) => {
let coba = String(e.target.value).replace(/[^\d]/g,'');
this.setState({
order: coba
})
this.clearMessage()}
// this.handleChange(coba, 'value')}
}
// error={this.state.errorOrder} // error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder} // helperText={this.state.msgErrorOrder}
> >
...@@ -1031,7 +1088,6 @@ export default class CreateParameter extends Component { ...@@ -1031,7 +1088,6 @@ export default class CreateParameter extends Component {
style={{ width: '100%' }} style={{ width: '100%' }}
id="max_value" id="max_value"
label="Max Value" label="Max Value"
type={"number"}
value={this.state.maxValue === null ? '' : this.state.maxValue} value={this.state.maxValue === null ? '' : this.state.maxValue}
inputProps={{ inputProps={{
min: 0, min: 0,
...@@ -1046,7 +1102,14 @@ export default class CreateParameter extends Component { ...@@ -1046,7 +1102,14 @@ export default class CreateParameter extends Component {
} }
}} }}
name="maxValue" name="maxValue"
onChange={(e) => this.handleChangeCreate(e, '')} onChange={(e) => {
let coba = String(e.target.value).replace(/[^\d]/g,'');
this.setState({
maxValue: coba
})
this.clearMessage()}
// this.handleChange(coba, 'value')}
}
error={this.state.errorMaxValue} error={this.state.errorMaxValue}
helperText={this.state.msgErrorMaxValue} helperText={this.state.msgErrorMaxValue}
> >
......
...@@ -190,20 +190,18 @@ export default class CreatePerusahaan extends Component { ...@@ -190,20 +190,18 @@ export default class CreatePerusahaan extends Component {
} else if (R.isNil(this.state.getTypes)) { } else if (R.isNil(this.state.getTypes)) {
this.setState({ errorUB: true, msgErrorUB: 'Business Unit required' }) this.setState({ errorUB: true, msgErrorUB: 'Business Unit required' })
} else if (R.isNil(this.state.startDate)) { } else if (R.isNil(this.state.startDate)) {
this.setState({ errorSD: true, msgErrorSD: 'Start Date required' }) this.setState({ errorSD: true, msgErrorSD: 'Valid From required' })
} else if (R.isNil(this.state.endDate)) { } else if (R.isNil(this.state.endDate)) {
this.setState({ errorED: true, msgErrorED: 'End Date required' }) this.setState({ errorED: true, msgErrorED: 'Valid To required' })
} else { } else {
let payload = { let payload = {
"company_id": this.state.companyID, "company_id": this.state.companyID,
"company_name": this.state.company, "company_name": this.state.company,
"business_unit_id": this.state.getTypes.business_unit_id, "business_unit_id": this.state.getTypes.business_unit_id,
"parent": this.state.getPerusahaan == null ? null : this.state.getPerusahaan.company_id, "parent": this.state.getPerusahaan == null ? null : this.state.getPerusahaan.company_id,
// "total_report": this.state.totalReport,
"start_date": this.state.startDate, "start_date": this.state.startDate,
"end_date": this.state.endDate "end_date": this.state.endDate
} }
// console.log(payload);
this.props.updatePerusahaan(payload) this.props.updatePerusahaan(payload)
} }
} }
...@@ -214,19 +212,15 @@ export default class CreatePerusahaan extends Component { ...@@ -214,19 +212,15 @@ export default class CreatePerusahaan extends Component {
} else if (R.isNil(this.state.getTypes)) { } else if (R.isNil(this.state.getTypes)) {
this.setState({ errorUB: true, msgErrorUB: 'Business Unit required' }) this.setState({ errorUB: true, msgErrorUB: 'Business Unit required' })
} else if (R.isNil(this.state.startDate)) { } else if (R.isNil(this.state.startDate)) {
this.setState({ errorSD: true, msgErrorSD: 'Start Date required' }) this.setState({ errorSD: true, msgErrorSD: 'Valid From required' })
} else if (R.isNil(this.state.endDate)) { } else if (R.isNil(this.state.endDate)) {
this.setState({ errorED: true, msgErrorED: 'End Date required' }) this.setState({ errorED: true, msgErrorED: 'Valid To required' })
} }
// else if (R.isEmpty(this.state.totalReport)) {
// this.setState({ errorJL: true, msgErrorJL: 'Total Report harus diisi' })
// }
else { else {
let payload = { let payload = {
"company_name": this.state.company, "company_name": this.state.company,
"parent": this.state.getPerusahaan == null ? null : this.state.getPerusahaan.company_id, "parent": this.state.getPerusahaan == null ? null : this.state.getPerusahaan.company_id,
"business_unit_id": this.state.getTypes.business_unit_id, "business_unit_id": this.state.getTypes.business_unit_id,
// "total_report": this.state.totalReport,
"start_date": this.state.startDate, "start_date": this.state.startDate,
"end_date": this.state.endDate "end_date": this.state.endDate
} }
...@@ -302,7 +296,7 @@ export default class CreatePerusahaan extends Component { ...@@ -302,7 +296,7 @@ export default class CreatePerusahaan extends Component {
<DatePicker <DatePicker
margin="normal" margin="normal"
id="startDate" id="startDate"
label="Start Date" label="Valid From"
format="dd MMMM yyyy" format="dd MMMM yyyy"
value={this.state.startDate} value={this.state.startDate}
onChange={(e) => this.handleChange(e, 'start_date')} onChange={(e) => this.handleChange(e, 'start_date')}
...@@ -348,11 +342,11 @@ export default class CreatePerusahaan extends Component { ...@@ -348,11 +342,11 @@ export default class CreatePerusahaan extends Component {
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<Typography style={{ fontSize: 11, width: '20%' }}>Created</Typography> <Typography style={{ fontSize: 11, width: '25%' }}>Created By</Typography>
<Typography style={{ fontSize: 11 }}>: {this.state.created}</Typography> <Typography style={{ fontSize: 11 }}>: {this.state.created}</Typography>
</div> </div>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<Typography style={{ fontSize: 11, width: '20%' }}>Updated</Typography> <Typography style={{ fontSize: 11, width: '25%' }}>Updated By</Typography>
<Typography style={{ fontSize: 11 }}>: {this.state.updated}</Typography> <Typography style={{ fontSize: 11 }}>: {this.state.updated}</Typography>
</div> </div>
</div> </div>
...@@ -396,7 +390,7 @@ export default class CreatePerusahaan extends Component { ...@@ -396,7 +390,7 @@ export default class CreatePerusahaan extends Component {
<DatePicker <DatePicker
margin="normal" margin="normal"
id="endDate" id="endDate"
label="End Date" label="Valid To"
format="dd MMMM yyyy" format="dd MMMM yyyy"
value={this.state.endDate} value={this.state.endDate}
minDate={this.state.startDate} minDate={this.state.startDate}
...@@ -420,29 +414,6 @@ export default class CreatePerusahaan extends Component { ...@@ -420,29 +414,6 @@ export default class CreatePerusahaan extends Component {
helperText={this.state.msgErrorED} helperText={this.state.msgErrorED}
/> />
</div> </div>
{/* <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
id="report"
label="Jumlah Laporan"
value={this.state.totalReport}
inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
onChange={(e) => this.setState({ totalReport: e.target.value }, () => this.clearError())}
error={this.state.errorJL}
helperText={this.state.msgErrorJL}
>
</TextField>
</div> */}
</div> </div>
</div> </div>
...@@ -532,15 +503,9 @@ export default class CreatePerusahaan extends Component { ...@@ -532,15 +503,9 @@ export default class CreatePerusahaan extends Component {
helperText={this.state.msgErrorUB} helperText={this.state.msgErrorUB}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }} InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }} InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
// onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue }, () => this.clearError())}
/> />
} }
value={this.state.types} value={this.state.types}
// value={this.state.getTypes}
// error={this.state.errorUB}
// helperText={this.state.msgErrorUB}
// onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue }, () => this.clearError())}
/> />
</div> </div>
...@@ -548,7 +513,7 @@ export default class CreatePerusahaan extends Component { ...@@ -548,7 +513,7 @@ export default class CreatePerusahaan extends Component {
<DatePicker <DatePicker
margin="normal" margin="normal"
id="startDate" id="startDate"
label="Start Date" label="Valid From"
format="dd MMMM yyyy" format="dd MMMM yyyy"
value={this.state.startDate == "" ? null : this.state.startDate} value={this.state.startDate == "" ? null : this.state.startDate}
onChange={(e) => this.handleChange(e, 'start_date')} onChange={(e) => this.handleChange(e, 'start_date')}
...@@ -592,8 +557,8 @@ export default class CreatePerusahaan extends Component { ...@@ -592,8 +557,8 @@ export default class CreatePerusahaan extends Component {
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Typography style={{ fontSize: 11 }}>Created : </Typography> <Typography style={{ fontSize: 11, width: '25%' }}>Created By : </Typography>
<Typography style={{ fontSize: 11 }}>Updated : </Typography> <Typography style={{ fontSize: 11, width: '25%' }}>Updated By : </Typography>
</div> </div>
</div> </div>
...@@ -635,12 +600,11 @@ export default class CreatePerusahaan extends Component { ...@@ -635,12 +600,11 @@ export default class CreatePerusahaan extends Component {
<DatePicker <DatePicker
margin="normal" margin="normal"
id="endDate" id="endDate"
label="End Date" label="Valid To"
format="dd MMMM yyyy" format="dd MMMM yyyy"
error={this.state.errorED} error={this.state.errorED}
helperText={this.state.msgErrorED} helperText={this.state.msgErrorED}
minDate={this.state.startDate} minDate={this.state.startDate}
// value={this.state.endDate == "" ? null : this.state.endDate}
value={this.state.endDate} value={this.state.endDate}
onChange={(e) => this.handleChange(e, 'end_date')} onChange={(e) => this.handleChange(e, 'end_date')}
KeyboardButtonProps={{ KeyboardButtonProps={{
...@@ -661,29 +625,6 @@ export default class CreatePerusahaan extends Component { ...@@ -661,29 +625,6 @@ export default class CreatePerusahaan extends Component {
style={{ padding: 0, margin: 0, width: '100%' }} style={{ padding: 0, margin: 0, width: '100%' }}
/> />
</div> </div>
{/* <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
id="report"
label="Jumlah Laporan"
value={this.state.totalReport}
inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
error={this.state.errorJL}
helperText={this.state.msgErrorJL}
onChange={(e) => this.setState({ totalReport: e.target.value }, () => this.clearError())}
>
</TextField>
</div> */}
</div> </div>
</div> </div>
......
...@@ -238,6 +238,29 @@ export default class Perusahaan extends Component { ...@@ -238,6 +238,29 @@ export default class Perusahaan extends Component {
componentDidMount() { componentDidMount() {
this.getData() this.getData()
this.getPermission()
}
getPermission() {
let payload = {
menu: "company"
}
api.create().getPermission(payload).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({
create: response.data.data.create,
edit: response.data.data.edit,
load: true
})
} else {
this.setState({
load: true
})
}
}
})
} }
getData() { getData() {
...@@ -472,6 +495,7 @@ export default class Perusahaan extends Component { ...@@ -472,6 +495,7 @@ export default class Perusahaan extends Component {
</Alert> </Alert>
</Snackbar> </Snackbar>
{this.state.visiblePerusahaan === true ? {this.state.visiblePerusahaan === true ?
this.state.load && (
<div> <div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -118 }}> <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -118 }}>
<label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Master Data - Company</label> <label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Master Data - Company</label>
...@@ -570,8 +594,9 @@ export default class Perusahaan extends Component { ...@@ -570,8 +594,9 @@ export default class Perusahaan extends Component {
</div> </div>
</div> </div>
)
: :
this.state.visibleVisual == true ? this.state.visibleVisual === true ?
<VisualPerusahaan <VisualPerusahaan
onClickClose={() => this.setState({ visibleVisual: false, visiblePerusahaan: true })} onClickClose={() => this.setState({ visibleVisual: false, visiblePerusahaan: true })}
height={this.props.height} height={this.props.height}
......
...@@ -112,11 +112,11 @@ export default class CreateUnitBisnis extends Component { ...@@ -112,11 +112,11 @@ export default class CreateUnitBisnis extends Component {
validasi() { validasi() {
if (R.isEmpty(this.state.name)) { if (R.isEmpty(this.state.name)) {
this.setState({ errorName: true, msgErrorName: 'Business unit is required.' }) this.setState({ errorName: true, msgErrorName: 'Business unit Cannot be Empty.' })
} else if (R.isEmpty(this.state.startDate)) { } else if (R.isEmpty(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Start date is required.' }) this.setState({ errorStartDate: true, msgErrorStartDate: 'Start date Cannot be Empty.' })
} else if (R.isEmpty(this.state.endDate) || this.state.endDate === null) { } else if (R.isEmpty(this.state.endDate) || this.state.endDate === null) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'End date is required.' }) this.setState({ errorEndDate: true, msgErrorEndDate: 'End date Cannot be Empty.' })
} else { } else {
let payload = { let payload = {
"business_unit_id": this.state.id, "business_unit_id": this.state.id,
...@@ -130,11 +130,11 @@ export default class CreateUnitBisnis extends Component { ...@@ -130,11 +130,11 @@ export default class CreateUnitBisnis extends Component {
validasiCreate() { validasiCreate() {
if (R.isEmpty(this.state.name)) { if (R.isEmpty(this.state.name)) {
this.setState({ errorName: true, msgErrorName: 'Business unit is required.' }) this.setState({ errorName: true, msgErrorName: 'Business unit Cannot be Empty.' })
} else if (R.isNil(this.state.startDate)) { } else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Start date is required.' }) this.setState({ errorStartDate: true, msgErrorStartDate: 'Start date Cannot be Empty.' })
} else if (R.isNil(this.state.endDate)) { } else if (R.isNil(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'End date is required.' }) this.setState({ errorEndDate: true, msgErrorEndDate: 'End date Cannot be Empty.' })
} else { } else {
let payload = { let payload = {
"business_unit_name": this.state.name, "business_unit_name": this.state.name,
......
...@@ -78,7 +78,7 @@ export default class Profile extends Component { ...@@ -78,7 +78,7 @@ export default class Profile extends Component {
validasi() { validasi() {
if (this.state.oldPassword == "") { if (this.state.oldPassword == "") {
this.setState({ errorOldPassword: true, msgOldPassword: 'Old password is required.' }) this.setState({ errorOldPassword: true, msgOldPassword: 'Old password Cannot be Empty.' })
} else if (this.state.oldPassword.length < 8) { } else if (this.state.oldPassword.length < 8) {
this.setState({ errorOldPassword: true, msgOldPassword: 'Old password minimum 8 characters.' }) this.setState({ errorOldPassword: true, msgOldPassword: 'Old password minimum 8 characters.' })
} else if (this.isEmail(this.state.oldPassword)) { } else if (this.isEmail(this.state.oldPassword)) {
...@@ -86,7 +86,7 @@ export default class Profile extends Component { ...@@ -86,7 +86,7 @@ export default class Profile extends Component {
} else if (!this.isRegex(this.state.oldPassword)) { } else if (!this.isRegex(this.state.oldPassword)) {
this.setState({ errorOldPassword: true, msgOldPassword: 'Old password must be a combination of characters, letters and numbers.' }) this.setState({ errorOldPassword: true, msgOldPassword: 'Old password must be a combination of characters, letters and numbers.' })
} else if (this.state.password.trim() == "") { } else if (this.state.password.trim() == "") {
this.setState({ errorPassword: true, msgPassword: 'Password is required.' }) this.setState({ errorPassword: true, msgPassword: 'Password Cannot be Empty.' })
} else if (this.state.password.length < 8) { } else if (this.state.password.length < 8) {
this.setState({ errorPassword: true, msgPassword: 'Password minimum 8 characters.' }) this.setState({ errorPassword: true, msgPassword: 'Password minimum 8 characters.' })
} else if (this.isEmail(this.state.password)) { } else if (this.isEmail(this.state.password)) {
...@@ -94,7 +94,7 @@ export default class Profile extends Component { ...@@ -94,7 +94,7 @@ export default class Profile extends Component {
} else if (!this.isRegex(this.state.password)) { } else if (!this.isRegex(this.state.password)) {
this.setState({ errorPassword: true, msgPassword: 'Password must be a combination of characters, letters and numbers.' }) this.setState({ errorPassword: true, msgPassword: 'Password must be a combination of characters, letters and numbers.' })
} else if (this.state.confirmPassword.trim() == "") { } else if (this.state.confirmPassword.trim() == "") {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation is required.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation Cannot be Empty.' })
} else if (this.state.confirmPassword.length < 8) { } else if (this.state.confirmPassword.length < 8) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation of at least 8 characters.' }) this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation of at least 8 characters.' })
} else if (this.isEmail(this.state.confirmPassword)) { } else if (this.isEmail(this.state.confirmPassword)) {
......
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