Commit b98b27a6 authored by Deni Rinaldi's avatar Deni Rinaldi

ngantoek

parent 986aa7d3
...@@ -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>
) )
} }
......
...@@ -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}
> >
......
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