Commit a7622619 authored by Rifka Kurnia Irfiana's avatar Rifka Kurnia Irfiana

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

parents 2fca59d0 88eea993
......@@ -9,6 +9,7 @@ import { titleCase } from '../library/Utils';
import ProfitLoss from './BudgetTahunan/ProfitLoss';
import TaxPlanning from './BudgetTahunan/TaxPlanning';
import FixedAssetsMovement from './BudgetTahunan/FixedAssetsMovement';
import CorporateAnnualTarget from './BudgetTahunan/CorporateAnnualTarget';
export default class BudgetTahunan extends Component {
constructor(props) {
......@@ -23,7 +24,8 @@ export default class BudgetTahunan extends Component {
company: null,
report_id: null,
visiblePL: false,
visibleFAM: false
visibleFAM: false,
visibleCAT: false
}
}
......@@ -114,6 +116,15 @@ export default class BudgetTahunan extends Component {
visibleFAM: true,
visibleTP: false
})
} else if (item === 'CAT') {
this.setState({
visibleBudgetTahunan: false,
visibleBS: false,
visiblePL: false,
visibleCAT: true,
visibleFAM: false,
visibleTP: false
})
}
}
......@@ -306,7 +317,12 @@ export default class BudgetTahunan extends Component {
/>
)}
{this.state.visiblePL && (
<ProfitLoss />
<ProfitLoss
report_id={this.state.report_id}
company={this.state.company}
onClickClose={()=> this.setState({ visiblePL: false, visibleBudgetTahunan: true})}
/>
)}
{this.state.visibleTP && (
<TaxPlanning
......@@ -316,7 +332,14 @@ export default class BudgetTahunan extends Component {
/>
)}
{this.state.visibleFAM && (
<FixedAssetsMovement />
<FixedAssetsMovement
onClickClose={() => this.setState({ visibleFAM: false, visibleBudgetTahunan: true })}
/>
)}
{this.state.visibleCAT && (
<CorporateAnnualTarget
onClickClose={() => this.setState({ visibleCAT: false, visibleBudgetTahunan: true })}
/>
)}
</div >
);
......
......@@ -121,9 +121,9 @@ export default class BalanceSheet extends Component {
handleValue(data) {
let total = 0
this.state.dataTable.map((item,index) => {
this.state.dataTable.map((item, index) => {
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])
......@@ -133,17 +133,17 @@ export default class BalanceSheet extends Component {
}
handleChange(value, tableMeta) {
let val = String(value).split(",").join("")
let data = this.state.dataTable
let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2])
// console.log(indexParent);
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]
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 {
let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(value)
data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
}
// console.log(this.state.dataTable)
// this.setState({
// data: a,
// }, () => console.log(this.state.dataTable))
......@@ -155,22 +155,22 @@ export default class BalanceSheet extends Component {
options: {
display: false
}
},{
}, {
name: "",
options: {
display: false
}
},{
}, {
name: "",
options: {
display: false
}
},{
}, {
name: "",
options: {
display: false
}
},{
}, {
name: "Account",
options: {
customHeadRender: (columnMeta) => (
......@@ -185,7 +185,7 @@ export default class BalanceSheet extends Component {
{tableMeta.rowData[3] == 0 ?
<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: 40 }}>{val}</span>
}
......@@ -197,18 +197,67 @@ export default class BalanceSheet extends Component {
name: "31 Dec 2020 Actual",
options: {
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>
</TableCell>
),
setCellProps: () => ({
style: {
position: "sticky",
left: 420,
background: "white",
zIndex: 101
// 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
// }
// }),
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",
......@@ -243,7 +292,16 @@ export default class BalanceSheet extends Component {
/>
</div> :
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 ?
<span>-</span>
......@@ -262,10 +320,47 @@ export default class BalanceSheet extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ width: 96 }}>
{val}
<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>
)
}
......@@ -278,10 +373,47 @@ export default class BalanceSheet extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ width: 96 }}>
{val}
<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>
)
}
......@@ -294,10 +426,47 @@ export default class BalanceSheet extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ width: 96 }}>
{val}
<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>
)
}
......@@ -310,10 +479,47 @@ export default class BalanceSheet extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ width: 96 }}>
{val}
<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>
)
}
......@@ -326,10 +532,47 @@ export default class BalanceSheet extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ width: 96 }}>
{val}
<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>
)
}
......
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>
);
}
}
......@@ -2,6 +2,7 @@ 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';
import api from '../../api';
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
......@@ -21,8 +22,102 @@ const style2 = {
};
export default class ProfitLoss extends Component {
constructor(props) {
super(props)
this.state = {
dataTable: [
// ["TOTAL ASSETS", "11,247,249", "10,702,196"],
// ["TOTAL CURRENT ASSETS", "2,647,647", "2,058,898"],
// ["Cash & Cash Equivalent", "1,464,571", "729,743"],
// ["Cash & Bank Balance", "938,707", "265,584"],
// ["Time & Call Deposit", "525,864", "464,159"],
// ["BI Deposit", "", ""],
// ["Marketable Securities", "150,250", "154,500"],
// ["Notes Receivable", "", ""],
// ["Accounts Receivable", "172,031", "97,112"],
// ["Trade Receivables - Third Party", "142,668", "77,480"],
]
}
}
componentDidMount() {
this.getItemHierarki()
console.log(this.props);
}
getItemHierarki() {
let payload = {
"report_id": this.props.report_id,
"company_id": this.props.company.company_id
}
api.create().getItemReportHierarki(payload).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
let dataTable = []
response.data.data.map((item, index) => {
if (item.children.length > 0) {
dataTable.push([
item.level,
item.description
])
item.children.map(i => {
if (i.children) {
if (i.children.length > 0) {
dataTable.push([
i.level,
i.description
])
i.children.map(val => {
dataTable.push([
val.level,
val.description
])
})
} else {
dataTable.push([
i.level,
i.description
])
}
} else {
dataTable.push([
i.level,
i.description
])
}
})
} else {
dataTable.push([
item.level,
item.description
])
}
})
console.log(dataTable);
this.setState({ dataTable })
}
}
})
}
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: "",
options: {
display: false
}
}, {
name: "Account",
options: {
customHeadRender: (columnMeta) => (
......@@ -34,35 +129,18 @@ export default class ProfitLoss extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 388 }}>
{tableMeta.rowIndex == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{val}</span>
{tableMeta.rowData[0] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(val).toUpperCase()}</span>
:
tableMeta.rowIndex == 1 || tableMeta.rowIndex == 4 || tableMeta.rowIndex == 7 ?
<span style={{ fontSize: 12, marginLeft: 10 }}>{val}</span> :
<span style={{ fontSize: 12, marginLeft: 20 }}>{val}</span>
tableMeta.rowData[0] === 1?
<span style={{ fontSize: 12, marginLeft: 20 }}>{val}</span> :
<span style={{ fontSize: 12, marginLeft: 40 }}>{val}</span>
}
</div>
)
}
}
}, {
name: "Keterangan",
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: "31 Dec 2020 Actual",
options: {
customHeadRender: (columnMeta) => (
......@@ -88,10 +166,9 @@ export default class ProfitLoss extends Component {
</TableCell>
),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowIndex === 2 || tableMeta.rowIndex === 3 ?
{tableMeta.rowIndex === 3 || tableMeta.rowIndex === 4 || tableMeta.rowIndex === 9 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -116,9 +193,12 @@ export default class ProfitLoss extends Component {
type="text"
placeholder=""
value={value}
onChange={event => {
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
/>
}
onChange={event => updateValue(event.target.value)}
/>
</div> :
<span style={{ fontSize: 12, textAlign: 'right' }}>{value === "" ? "-" : value}</span>
......@@ -257,18 +337,7 @@ export default class ProfitLoss extends Component {
}
}
]
const dataTable = [
["Ravenue", "", "11,247,249", "10,702,196"],
["Unit Bisnis/ Brand/ SubCo 1", "", "2,647,647", "2,058,898"],
["Sales Volume","Subco1", "1,464,571", "729,743"],
["Sales Price","Subco1", "1", "6"],
["Unit Bisnis/ Brand/ SubCo 2", "", "-", "-"],
["Sales Volume","Subco2", "-", "-"],
["Sales Price","Subco2", "-", "-"],
["Unit Bisnis/ Brand/ SubCo 3", "", "-", "-"],
["Sales Volume","Subco3", "-", "-"],
["Sales Price","Subco3", "-", "-"],
]
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 }}>
......@@ -281,7 +350,7 @@ export default class ProfitLoss extends Component {
</div>
<div style={{ padding: 20 }}>
<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' }}>in IDR mn</Typography>
</div>
......@@ -289,7 +358,7 @@ export default class ProfitLoss extends Component {
<div style={{ marginTop: 20, width: '100%' }}>
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable}
data={this.state.dataTable}
columns={columns}
options={options}
/>
......@@ -298,11 +367,22 @@ export default class ProfitLoss extends Component {
</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 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' }}>Batal</Typography>
</div>
......
......@@ -334,25 +334,25 @@ export default class CreateParameter extends Component {
validasi() {
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)) {
this.setState({ errorParameter: true, msgErrorParameter: 'Parameter is required.' })
this.setState({ errorParameter: true, msgErrorParameter: 'Parameter Cannot be Empty.' })
} 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)) {
// this.setState({ errorDeskripsi: true, msgErrorDeskripsi: 'Deskripsi tidak boleh kosong' })
// } else if (R.isEmpty(this.state.tempData.value)) {
// 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))) {
this.setState({ errorMinValue: true, msgErrorMinValue: 'Min value is required.' })
} 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 Cannot be Empty.' })
} 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)) {
// 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)) {
this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Max value is required.' })
} 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 Cannot be Empty.' })
} 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 {
this.updateParameter()
}
......@@ -360,25 +360,25 @@ export default class CreateParameter extends Component {
validasiCreate() {
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)) {
this.setState({ errorParameter: true, msgErrorParameter: 'Parameter is required.' })
this.setState({ errorParameter: true, msgErrorParameter: 'Parameter Cannot be Empty.' })
} 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)) {
// this.setState({ errorDeskripsi: true, msgErrorDeskripsi: 'Deskripsi tidak boleh kosong' })
// } else if (R.isNil(this.state.value)) {
// this.setState({ errorValue: true, msgErrorValue: 'Value tidak boleh kosong' })
} else if (!R.isNil(this.state.maxValue) && R.isNil(this.state.minValue)) {
this.setState({ errorMinValue: true, msgErrorMinValue: 'Min value is required.' })
} 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 Cannot be Empty.' })
} 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)) {
// this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' })
} else if (!R.isNil(this.state.minValue) && R.isNil(this.state.maxValue)) {
this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Max value is required.' })
} 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 Cannot be Empty.' })
} 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 {
this.createParameter()
}
......@@ -516,7 +516,6 @@ export default class CreateParameter extends Component {
id="value"
label="Value"
value={this.state.tempData === null ? '' : this.state.tempData.value}
type={"number"}
inputProps={{
min: 0,
style: {
......@@ -530,7 +529,18 @@ export default class CreateParameter extends Component {
}
}}
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}
// helperText={this.state.msgErrorValue}
>
......@@ -541,7 +551,6 @@ export default class CreateParameter extends Component {
style={{ width: '100%' }}
id="min_value"
label="Min Value"
type={"number"}
value={this.state.tempData === null ? '' : this.state.tempData.min_value}
inputProps={{
min: 0,
......@@ -556,7 +565,18 @@ export default class CreateParameter extends Component {
}
}}
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}
helperText={this.state.msgErrorMinValue}
>
......@@ -663,7 +683,6 @@ export default class CreateParameter extends Component {
style={{ width: '100%' }}
id="order"
label="Order"
type={"number"}
value={this.state.tempData === null ? '' : this.state.tempData.order}
inputProps={{
min: 0,
......@@ -678,7 +697,17 @@ export default class CreateParameter extends Component {
}
}}
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}
// helperText={this.state.msgErrorOrder}
>
......@@ -689,7 +718,6 @@ export default class CreateParameter extends Component {
style={{ width: '100%' }}
id="max_value"
label="Max Value"
type={"number"}
value={this.state.tempData === null ? '' : this.state.tempData.max_value}
inputProps={{
min: 0,
......@@ -704,7 +732,18 @@ export default class CreateParameter extends Component {
}
}}
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}
helperText={this.state.msgErrorMaxValue}
>
......@@ -860,7 +899,6 @@ export default class CreateParameter extends Component {
id="value"
label="Value"
value={this.state.value === null ? '' : this.state.value}
type={"number"}
inputProps={{
min: 0,
style: {
......@@ -875,7 +913,14 @@ export default class CreateParameter extends Component {
}
}}
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}
// helperText={this.state.msgErrorValue}
>
......@@ -886,7 +931,6 @@ export default class CreateParameter extends Component {
style={{ width: '100%' }}
id="min_value"
label="Min Value"
type={"number"}
value={this.state.minValue === null ? '' : this.state.minValue}
inputProps={{
min: 0,
......@@ -901,7 +945,14 @@ export default class CreateParameter extends Component {
}
}}
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}
helperText={this.state.msgErrorMinValue}
>
......@@ -1005,7 +1056,6 @@ export default class CreateParameter extends Component {
style={{ width: '100%' }}
id="order"
label="Order"
type={"number"}
value={this.state.order === null ? '' : this.state.order}
inputProps={{
min: 0,
......@@ -1020,7 +1070,14 @@ export default class CreateParameter extends Component {
}
}}
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}
// helperText={this.state.msgErrorOrder}
>
......@@ -1031,7 +1088,6 @@ export default class CreateParameter extends Component {
style={{ width: '100%' }}
id="max_value"
label="Max Value"
type={"number"}
value={this.state.maxValue === null ? '' : this.state.maxValue}
inputProps={{
min: 0,
......@@ -1046,7 +1102,14 @@ export default class CreateParameter extends Component {
}
}}
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}
helperText={this.state.msgErrorMaxValue}
>
......
......@@ -190,20 +190,18 @@ export default class CreatePerusahaan extends Component {
} else if (R.isNil(this.state.getTypes)) {
this.setState({ errorUB: true, msgErrorUB: 'Business Unit required' })
} 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)) {
this.setState({ errorED: true, msgErrorED: 'End Date required' })
this.setState({ errorED: true, msgErrorED: 'Valid To required' })
} else {
let payload = {
"company_id": this.state.companyID,
"company_name": this.state.company,
"business_unit_id": this.state.getTypes.business_unit_id,
"parent": this.state.getPerusahaan == null ? null : this.state.getPerusahaan.company_id,
// "total_report": this.state.totalReport,
"start_date": this.state.startDate,
"end_date": this.state.endDate
}
// console.log(payload);
this.props.updatePerusahaan(payload)
}
}
......@@ -214,19 +212,15 @@ export default class CreatePerusahaan extends Component {
} else if (R.isNil(this.state.getTypes)) {
this.setState({ errorUB: true, msgErrorUB: 'Business Unit required' })
} 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)) {
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 {
let payload = {
"company_name": this.state.company,
"parent": this.state.getPerusahaan == null ? null : this.state.getPerusahaan.company_id,
"business_unit_id": this.state.getTypes.business_unit_id,
// "total_report": this.state.totalReport,
"start_date": this.state.startDate,
"end_date": this.state.endDate
}
......@@ -302,7 +296,7 @@ export default class CreatePerusahaan extends Component {
<DatePicker
margin="normal"
id="startDate"
label="Start Date"
label="Valid From"
format="dd MMMM yyyy"
value={this.state.startDate}
onChange={(e) => this.handleChange(e, 'start_date')}
......@@ -348,11 +342,11 @@ export default class CreatePerusahaan extends Component {
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<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>
</div>
<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>
</div>
</div>
......@@ -396,7 +390,7 @@ export default class CreatePerusahaan extends Component {
<DatePicker
margin="normal"
id="endDate"
label="End Date"
label="Valid To"
format="dd MMMM yyyy"
value={this.state.endDate}
minDate={this.state.startDate}
......@@ -420,29 +414,6 @@ export default class CreatePerusahaan extends Component {
helperText={this.state.msgErrorED}
/>
</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>
......@@ -532,15 +503,9 @@ export default class CreatePerusahaan extends Component {
helperText={this.state.msgErrorUB}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
// onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue }, () => this.clearError())}
/>
}
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>
......@@ -548,7 +513,7 @@ export default class CreatePerusahaan extends Component {
<DatePicker
margin="normal"
id="startDate"
label="Start Date"
label="Valid From"
format="dd MMMM yyyy"
value={this.state.startDate == "" ? null : this.state.startDate}
onChange={(e) => this.handleChange(e, 'start_date')}
......@@ -592,8 +557,8 @@ export default class CreatePerusahaan extends Component {
</div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Typography style={{ fontSize: 11 }}>Created : </Typography>
<Typography style={{ fontSize: 11 }}>Updated : </Typography>
<Typography style={{ fontSize: 11, width: '25%' }}>Created By : </Typography>
<Typography style={{ fontSize: 11, width: '25%' }}>Updated By : </Typography>
</div>
</div>
......@@ -635,12 +600,11 @@ export default class CreatePerusahaan extends Component {
<DatePicker
margin="normal"
id="endDate"
label="End Date"
label="Valid To"
format="dd MMMM yyyy"
error={this.state.errorED}
helperText={this.state.msgErrorED}
minDate={this.state.startDate}
// value={this.state.endDate == "" ? null : this.state.endDate}
value={this.state.endDate}
onChange={(e) => this.handleChange(e, 'end_date')}
KeyboardButtonProps={{
......@@ -661,29 +625,6 @@ export default class CreatePerusahaan extends Component {
style={{ padding: 0, margin: 0, width: '100%' }}
/>
</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>
......
......@@ -238,6 +238,29 @@ export default class Perusahaan extends Component {
componentDidMount() {
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() {
......@@ -472,6 +495,7 @@ export default class Perusahaan extends Component {
</Alert>
</Snackbar>
{this.state.visiblePerusahaan === true ?
this.state.load && (
<div>
<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>
......@@ -570,8 +594,9 @@ export default class Perusahaan extends Component {
</div>
</div>
)
:
this.state.visibleVisual == true ?
this.state.visibleVisual === true ?
<VisualPerusahaan
onClickClose={() => this.setState({ visibleVisual: false, visiblePerusahaan: true })}
height={this.props.height}
......
......@@ -350,7 +350,7 @@ export default class CreateReportItems extends Component {
<div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Add Data</span>
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Create Data</span>
</div>
</div>
<div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
......@@ -431,7 +431,7 @@ export default class CreateReportItems extends Component {
debug
renderInput={(params) =>
<TextField {...params}
label="Company"
label="Company Name"
InputLabelProps={{
style: {
fontSize: 11,
......@@ -830,16 +830,14 @@ export default class CreateReportItems extends Component {
</div>
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingBottom: 20, paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<div className="margin-top-10px" style={{ padding: 20}}>
<div style={{ display: 'flex' }}>
<Typography style={{ fontSize: 11 }}>Created By :</Typography>
<Typography style={{ fontSize: 11, width: '13%' }}>Created By</Typography>
<Typography style={{ fontSize: 11 }}>: </Typography>
</div>
<div style={{ display: 'flex' }}>
<Typography style={{ fontSize: 11 }}>Updated By :</Typography>
</div>
</div>
<Typography style={{ fontSize: 11, width: '13%' }}>Updated By</Typography>
<Typography style={{ fontSize: 11 }}>: </Typography>
</div>
</div>
......
......@@ -421,7 +421,7 @@ export default class EditReportItems extends Component {
debug
renderInput={(params) =>
<TextField {...params}
label="Company"
label="Company Name"
InputLabelProps={{
style: {
fontSize: 11,
......
......@@ -112,11 +112,11 @@ export default class CreateUnitBisnis extends Component {
validasi() {
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)) {
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) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'End date is required.' })
this.setState({ errorEndDate: true, msgErrorEndDate: 'End date Cannot be Empty.' })
} else {
let payload = {
"business_unit_id": this.state.id,
......@@ -130,11 +130,11 @@ export default class CreateUnitBisnis extends Component {
validasiCreate() {
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)) {
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)) {
this.setState({ errorEndDate: true, msgErrorEndDate: 'End date is required.' })
this.setState({ errorEndDate: true, msgErrorEndDate: 'End date Cannot be Empty.' })
} else {
let payload = {
"business_unit_name": this.state.name,
......
......@@ -78,7 +78,7 @@ export default class Profile extends Component {
validasi() {
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) {
this.setState({ errorOldPassword: true, msgOldPassword: 'Old password minimum 8 characters.' })
} else if (this.isEmail(this.state.oldPassword)) {
......@@ -86,7 +86,7 @@ export default class Profile extends Component {
} else if (!this.isRegex(this.state.oldPassword)) {
this.setState({ errorOldPassword: true, msgOldPassword: 'Old password must be a combination of characters, letters and numbers.' })
} 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) {
this.setState({ errorPassword: true, msgPassword: 'Password minimum 8 characters.' })
} else if (this.isEmail(this.state.password)) {
......@@ -94,7 +94,7 @@ export default class Profile extends Component {
} else if (!this.isRegex(this.state.password)) {
this.setState({ errorPassword: true, msgPassword: 'Password must be a combination of characters, letters and numbers.' })
} 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) {
this.setState({ errorConfirmPassword: true, msgConfirmPassword: 'Password confirmation of at least 8 characters.' })
} 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