Commit 0a3222dc authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-dev(pc)' into 'master'

toast AM

See merge request !138
parents 430da4df 217cae5a
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Container, Row, Col } from "react-bootstrap"; import { Container, Row, Col } from "react-bootstrap";
import { makeStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles'; import { makeStyles, createMuiTheme, MuiThemeProvider, withStyles } from '@material-ui/core/styles';
import { TextField, InputBase } from "@material-ui/core"; import { TextField, InputBase, Snackbar } from "@material-ui/core";
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import Images from '../../assets/Images'; import Images from '../../assets/Images';
import MUIDataTable from "mui-datatables"; import MUIDataTable from "mui-datatables";
import ReactTooltip from 'react-tooltip'; import ReactTooltip from 'react-tooltip';
import MuiAlert from '@material-ui/lab/Alert';
import UploadFile from "../../library/Upload"; import UploadFile from "../../library/Upload";
import CreateApprovalMatrix from "./CreateApprovalMatrix"; import CreateApprovalMatrix from "./CreateApprovalMatrix";
import EditApprovalMatrix from "./EditApprovalMatrix"; import EditApprovalMatrix from "./EditApprovalMatrix";
...@@ -18,6 +19,9 @@ const getMuiTheme = () => createMuiTheme(ct.customTable()); ...@@ -18,6 +19,9 @@ const getMuiTheme = () => createMuiTheme(ct.customTable());
const options = ct.customOptions(); const options = ct.customOptions();
const options2 = ct.customOptions2(); const options2 = ct.customOptions2();
const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
export default class ApprovalMatrix extends Component { export default class ApprovalMatrix extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
...@@ -264,17 +268,18 @@ export default class ApprovalMatrix extends Component { ...@@ -264,17 +268,18 @@ export default class ApprovalMatrix extends Component {
getData() { getData() {
api.create().getAM().then((response) => { api.create().getAM().then((response) => {
// console.log(response) // console.log(response)
if(response.status == null){ if (response.data) {
alert(response.problem) if (response.data.status == 'success') {
} let data = response.data.data
else if (response.data.status == 'success') { let listData = data.sort((a, b) => a.approval_matrix_id - b.approval_matrix_id).map((item, index) => {
let data = response.data.data return [index, item.approval_matrix_id, item.approval_type_name, item.orders, item.fullname, item.operator_type_name, item.status]
let listData = data.sort((a,b) => a.approval_matrix_id - b.approval_matrix_id).map((item, index) => { })
return [index, item.approval_matrix_id, item.approval_type_name, item.orders, item.fullname, item.operator_type_name, item.status ] this.setState({ dataTable: listData, listData: response.data.data })
}) } else {
this.setState({ dataTable: listData, listData: response.data.data }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else { } else {
alert(response.data.message) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
} }
}) })
} }
...@@ -299,14 +304,18 @@ export default class ApprovalMatrix extends Component { ...@@ -299,14 +304,18 @@ export default class ApprovalMatrix extends Component {
} }
api.create().searchAM(body).then(response => { api.create().searchAM(body).then(response => {
// console.log(response.data); // console.log(response.data);
if (response.data.status == 'success') { if (response.data) {
let data = response.data.data if (response.data.status == 'success') {
let listData = data.map((item, index) => { let data = response.data.data
return [index, item.approval_matrix_id, item.approval_type_name, item.orders, item.fullname, item.operator_type_name, item.status] let listData = data.map((item, index) => {
}) return [index, item.approval_matrix_id, item.approval_type_name, item.orders, item.fullname, item.operator_type_name, item.status]
this.setState({ dataTable: listData, listData: response.data.data }) })
this.setState({ dataTable: listData, listData: response.data.data })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else { } else {
alert(response.data.message) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
} }
}) })
} }
...@@ -314,11 +323,15 @@ export default class ApprovalMatrix extends Component { ...@@ -314,11 +323,15 @@ export default class ApprovalMatrix extends Component {
createAM = (payload) => { createAM = (payload) => {
this.setState({ visibleCreate: false }) this.setState({ visibleCreate: false })
api.create().createAM(payload).then(response => { api.create().createAM(payload).then(response => {
if (response.data.status == 'success') { if (response.data) {
alert(response.data.message) if (response.data.status == 'success') {
this.getData() this.getData()
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else { } else {
alert(response.data.message) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
} }
}) })
} }
...@@ -326,11 +339,15 @@ export default class ApprovalMatrix extends Component { ...@@ -326,11 +339,15 @@ export default class ApprovalMatrix extends Component {
updateAM = (payload) => { updateAM = (payload) => {
this.setState({ visibleEdit: false }) this.setState({ visibleEdit: false })
api.create().updateAM(payload).then(response => { api.create().updateAM(payload).then(response => {
if (response.data.status == 'success') { if (response.data) {
alert(response.data.message) if (response.data.status == 'success') {
this.getData() this.getData()
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else { } else {
alert(response.data.message) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
} }
}) })
} }
...@@ -338,11 +355,15 @@ export default class ApprovalMatrix extends Component { ...@@ -338,11 +355,15 @@ export default class ApprovalMatrix extends Component {
updateVAM = (payload) => { updateVAM = (payload) => {
this.setState({ visibleVisual: false, visibleAM: true }) this.setState({ visibleVisual: false, visibleAM: true })
api.create().updateVAM(payload).then(response => { api.create().updateVAM(payload).then(response => {
if (response.data.status == 'success') { if (response.data) {
alert(response.data.message) if (response.data.status == 'success') {
this.getData() this.getData()
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else { } else {
alert(response.data.message) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
} }
}) })
} }
...@@ -381,12 +402,24 @@ export default class ApprovalMatrix extends Component { ...@@ -381,12 +402,24 @@ export default class ApprovalMatrix extends Component {
uploadAM() { uploadAM() {
api.create().uploadAM(this.state.payload).then(response => { api.create().uploadAM(this.state.payload).then(response => {
console.log(response.data) console.log(response.data)
// console.log(this.state.payload) if (response.data) {
this.getData() if (response.data.status === "success") {
this.setState({ visibleAM: true }) // console.log(this.state.payload)
this.getData()
this.setState({ visibleAM: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
}) })
} }
closeAlert() {
this.setState({ alert: false })
}
render() { render() {
const columns = [{ const columns = [{
name: "Action", name: "Action",
...@@ -401,7 +434,7 @@ export default class ApprovalMatrix extends Component { ...@@ -401,7 +434,7 @@ export default class ApprovalMatrix extends Component {
borderColor: 'transparent' borderColor: 'transparent'
}} }}
onClick={() => this.openPopUp(tableMeta.rowData, 'edit')} onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
// onClick={() => this.setState({ visibleEdit: true })} // onClick={() => this.setState({ visibleEdit: true })}
> >
<img src={Images.editCopy} /> <img src={Images.editCopy} />
</button> </button>
...@@ -409,7 +442,7 @@ export default class ApprovalMatrix extends Component { ...@@ -409,7 +442,7 @@ export default class ApprovalMatrix extends Component {
); );
} }
} }
}, },
{ {
name: "ID", name: "ID",
options: { options: {
...@@ -421,7 +454,7 @@ export default class ApprovalMatrix extends Component { ...@@ -421,7 +454,7 @@ export default class ApprovalMatrix extends Component {
); );
} }
} }
}, },
{ {
name: "Tipe Persetujuan", name: "Tipe Persetujuan",
options: { options: {
...@@ -432,7 +465,7 @@ export default class ApprovalMatrix extends Component { ...@@ -432,7 +465,7 @@ export default class ApprovalMatrix extends Component {
</div > </div >
); );
} }
} }
}, },
{ {
name: "Order", name: "Order",
...@@ -444,7 +477,7 @@ export default class ApprovalMatrix extends Component { ...@@ -444,7 +477,7 @@ export default class ApprovalMatrix extends Component {
</div > </div >
); );
} }
} }
}, },
{ {
name: "Nama Pemberi Persetujuan", name: "Nama Pemberi Persetujuan",
...@@ -494,8 +527,13 @@ export default class ApprovalMatrix extends Component { ...@@ -494,8 +527,13 @@ export default class ApprovalMatrix extends Component {
<div> <div>
{this.state.visibleAM === true ? {this.state.visibleAM === true ?
<div style={{ height: this.props.height }}> <div style={{ height: this.props.height }}>
<div class="main-color" style={{ height: 199, width: '100%'}} /> <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<div> <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert}
</Alert>
</Snackbar>
<div class="main-color" style={{ height: 199, width: '100%' }} />
<div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}> <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}>
<label style={{ width: '20%', color: 'white', fontSize: 16, alignSelf: 'center', paddingTop: 8 }}>Master Data - Approval Matrix</label> <label style={{ width: '20%', color: 'white', fontSize: 16, alignSelf: 'center', paddingTop: 8 }}>Master Data - Approval Matrix</label>
<div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}> <div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}>
...@@ -519,7 +557,7 @@ export default class ApprovalMatrix extends Component { ...@@ -519,7 +557,7 @@ export default class ApprovalMatrix extends Component {
}} }}
onClick={() => this.downloadFile()} onClick={() => this.downloadFile()}
> >
<img src={Images.template} title="Download Template"/> <img src={Images.template} title="Download Template" />
</button> </button>
<button <button
style={{ style={{
...@@ -527,12 +565,12 @@ export default class ApprovalMatrix extends Component { ...@@ -527,12 +565,12 @@ export default class ApprovalMatrix extends Component {
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
marginLeft: 16, marginLeft: 16,
padding:0, padding: 0,
margin: 5 margin: 5
}} }}
onClick={() => this.setState({ visibleUpload: true })} onClick={() => this.setState({ visibleUpload: true })}
> >
<img src={Images.upload} title="Upload File"/> <img src={Images.upload} title="Upload File" />
</button> </button>
<button <button
style={{ style={{
...@@ -540,12 +578,12 @@ export default class ApprovalMatrix extends Component { ...@@ -540,12 +578,12 @@ export default class ApprovalMatrix extends Component {
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
marginLeft: 16, marginLeft: 16,
padding:0, padding: 0,
margin: 5 margin: 5
}} }}
onClick={() => this.downloadDataTable()} onClick={() => this.downloadDataTable()}
> >
<img src={Images.download} title="Download File"/> <img src={Images.download} title="Download File" />
</button> </button>
<button <button
style={{ style={{
...@@ -553,12 +591,12 @@ export default class ApprovalMatrix extends Component { ...@@ -553,12 +591,12 @@ export default class ApprovalMatrix extends Component {
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
marginLeft: 16, marginLeft: 16,
padding:0, padding: 0,
margin: 5 margin: 5
}} }}
onClick={() => this.setState({ visibleVisual: true, visibleAM: false })} onClick={() => this.setState({ visibleVisual: true, visibleAM: false })}
> >
<img src={Images.visualisasi} title="Visualisasi"/> <img src={Images.visualisasi} title="Visualisasi" />
</button> </button>
<button <button
style={{ style={{
...@@ -566,12 +604,12 @@ export default class ApprovalMatrix extends Component { ...@@ -566,12 +604,12 @@ export default class ApprovalMatrix extends Component {
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
marginLeft: 16, marginLeft: 16,
padding:0, padding: 0,
margin: 5 margin: 5
}} }}
onClick={() => this.setState({ visibleCreate: true })} onClick={() => this.setState({ visibleCreate: true })}
> >
<img src={Images.add} title="Tambah Approval Matrix"/> <img src={Images.add} title="Tambah Approval Matrix" />
</button> </button>
</div > </div >
</div> </div>
...@@ -589,54 +627,54 @@ export default class ApprovalMatrix extends Component { ...@@ -589,54 +627,54 @@ export default class ApprovalMatrix extends Component {
</div> </div>
: :
this.state.visibleVisual == true ? this.state.visibleVisual == true ?
<VisualisasiAM <VisualisasiAM
onClickClose={() => this.setState({ visibleVisual: false, visibleAM: true })} onClickClose={() => this.setState({ visibleVisual: false, visibleAM: true })}
height= {this.props.height} height={this.props.height}
updateVAM={this.updateVAM.bind(this)} updateVAM={this.updateVAM.bind(this)}
/> />
: :
<div style={{ height: this.props.height }}> <div style={{ height: this.props.height }}>
<div class="main-color" style={{ height: 199, width: '100%' }} /> <div class="main-color" style={{ height: 199, width: '100%' }} />
<div>
<div> <div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}> <div>
<label style={{ color: 'white', fontSize: 16, alignSelf: 'center' }}>Preview Data</label> <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}>
</div> <label style={{ color: 'white', fontSize: 16, alignSelf: 'center' }}>Preview Data</label>
<div style={{ padding: 25 }}> </div>
{this.state.dataLoaded && ( <div style={{ padding: 25 }}>
<MuiThemeProvider theme={getMuiTheme()}> {this.state.dataLoaded && (
<MUIDataTable <MuiThemeProvider theme={getMuiTheme()}>
theme={getMuiTheme()} <MUIDataTable
data={this.state.rows} theme={getMuiTheme()}
columns={this.state.cols} data={this.state.rows}
options={options} columns={this.state.cols}
/> options={options}
</MuiThemeProvider> />
)} </MuiThemeProvider>
</div> )}
<div style={{ display: 'flex', width: '100%', placeContent: 'flex-end', padding: 20 }}> </div>
<button <div style={{ display: 'flex', width: '100%', placeContent: 'flex-end', padding: 20 }}>
type="button" <button
onClick={() => this.setState({ visibleAM: true })} type="button"
style={{ marginRight: 20 }} onClick={() => this.setState({ visibleAM: true })}
> style={{ marginRight: 20 }}
<div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> >
<span style={{ color: '#354960', fontSize: 11 }}>Batal</span> <div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
</div> <span style={{ color: '#354960', fontSize: 11 }}>Batal</span>
</button> </div>
<button </button>
type="button" <button
onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : this.uploadAM()} type="button"
style={{}} onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : this.uploadAM()}
> style={{}}
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> >
<span style={{ color: '#fff', fontSize: 11 }}>Simpan</span> <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
</div> <span style={{ color: '#fff', fontSize: 11 }}>Simpan</span>
</button> </div>
</button>
</div>
</div> </div>
</div> </div>
</div> </div>
</div>
} }
{this.state.visibleCreate && ( {this.state.visibleCreate && (
...@@ -655,7 +693,7 @@ export default class ApprovalMatrix extends Component { ...@@ -655,7 +693,7 @@ export default class ApprovalMatrix extends Component {
/> />
)} )}
{this.state.popupError && ( {this.state.popupError && (
<PopUpFailedSave onClickClose={()=> this.setState({ popupError: false })} /> <PopUpFailedSave onClickClose={() => this.setState({ popupError: false })} />
)} )}
{this.state.visibleUpload && ( {this.state.visibleUpload && (
<div className="test app-popup-show"> <div className="test app-popup-show">
...@@ -672,7 +710,7 @@ export default class ApprovalMatrix extends Component { ...@@ -672,7 +710,7 @@ export default class ApprovalMatrix extends Component {
className="btn btn-circle btn-white" className="btn btn-circle btn-white"
onClick={() => this.setState({ visibleUpload: false })} onClick={() => this.setState({ visibleUpload: false })}
> >
<img src={Images.close}/> <img src={Images.close} />
</button> </button>
</div> </div>
</div> </div>
......
...@@ -328,22 +328,22 @@ export default class CreateParameter extends Component { ...@@ -328,22 +328,22 @@ export default class CreateParameter extends Component {
} }
validasi() { validasi() {
if (R.isNil(this.state.getParameter)) { if (R.isNil(this.state.getTypes)) {
this.setState({ errorParameter: true, msgErrorParameter: 'Parameter tidak boleh kosong' })
} else if (R.isNil(this.state.getTypes)) {
this.setState({ errorGroup: true, msgErrorGroup: 'Group tidak boleh kosong' }) this.setState({ errorGroup: true, msgErrorGroup: 'Group tidak boleh kosong' })
} else if (R.isNil(this.state.getParameter)) {
this.setState({ errorParameter: true, msgErrorParameter: 'Parameter tidak boleh kosong' })
} else if (R.isNil(this.state.getPerusahaan)) { } else if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Perusahaan tidak boleh kosong' }) this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Perusahaan tidak boleh kosong' })
// } 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)) { } else if (!R.isNil(this.state.tempData.max_value) && R.isNil(this.state.tempData.min_value)) {
this.setState({ errorMinValue: true, msgErrorMinValue: 'Min Value tidak boleh kosong' }) this.setState({ errorMinValue: true, msgErrorMinValue: 'Min Value tidak boleh kosong' })
} 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 tidak boleh kosong' }) this.setState({ errorStartDate: true, msgErrorStartDate: 'Start Date tidak boleh kosong' })
// } 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)) {
this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Max Value tidak boleh kosong' }) this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Max Value tidak boleh kosong' })
} else if (R.isNil(this.state.tempData.end_date)) { } else if (R.isNil(this.state.tempData.end_date)) {
...@@ -360,16 +360,16 @@ export default class CreateParameter extends Component { ...@@ -360,16 +360,16 @@ export default class CreateParameter extends Component {
this.setState({ errorParameter: true, msgErrorParameter: 'Parameter tidak boleh kosong' }) this.setState({ errorParameter: true, msgErrorParameter: 'Parameter tidak boleh kosong' })
} else if (R.isNil(this.state.getPerusahaan)) { } else if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Perusahaan tidak boleh kosong' }) this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Perusahaan tidak boleh kosong' })
// } 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)) {
this.setState({ errorMinValue: true, msgErrorMinValue: 'Min Value tidak boleh kosong' }) this.setState({ errorMinValue: true, msgErrorMinValue: 'Min Value tidak boleh kosong' })
} else if (R.isNil(this.state.startDate)) { } else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorStartDate: 'Start Date tidak boleh kosong' }) this.setState({ errorStartDate: true, msgErrorStartDate: 'Start Date tidak boleh kosong' })
// } 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)) {
this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Max Value tidak boleh kosong' }) this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Max Value tidak boleh kosong' })
} else if (R.isNil(this.state.endDate)) { } else if (R.isNil(this.state.endDate)) {
...@@ -468,7 +468,7 @@ export default class CreateParameter extends Component { ...@@ -468,7 +468,7 @@ export default class CreateParameter extends Component {
{...this.state.parameter} {...this.state.parameter}
debug debug
id="tipe" id="tipe"
onChange={(event, newInputValue) => this.setState({ getParameter: newInputValue }, ()=> this.clearMessage())} onChange={(event, newInputValue) => this.setState({ getParameter: newInputValue }, () => this.clearMessage())}
renderInput={(params) => renderInput={(params) =>
<TextField <TextField
{...params} {...params}
...@@ -500,8 +500,8 @@ export default class CreateParameter extends Component { ...@@ -500,8 +500,8 @@ export default class CreateParameter extends Component {
}} }}
name="description" name="description"
onChange={(e) => this.handleChange(e, '')} onChange={(e) => this.handleChange(e, '')}
// error={this.state.errorDeskripsi} // error={this.state.errorDeskripsi}
// helperText={this.state.msgErrorDeskripsi} // helperText={this.state.msgErrorDeskripsi}
> >
</TextField> </TextField>
</div> </div>
...@@ -526,8 +526,8 @@ export default class CreateParameter extends Component { ...@@ -526,8 +526,8 @@ export default class CreateParameter extends Component {
}} }}
name="value" name="value"
onChange={(e) => this.handleChange(e, '')} onChange={(e) => this.handleChange(e, '')}
// error={this.state.errorValue} // error={this.state.errorValue}
// helperText={this.state.msgErrorValue} // helperText={this.state.msgErrorValue}
> >
</TextField> </TextField>
</div> </div>
...@@ -625,8 +625,15 @@ export default class CreateParameter extends Component { ...@@ -625,8 +625,15 @@ export default class CreateParameter extends Component {
{...this.state.types} {...this.state.types}
debug debug
id="tipe" id="tipe"
onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue }, () => newInputValue === null ? this.setState({ enableParameter: false, getParameter: null }, ()=> this.clearMessage()) : this.getParameterByGroup(newInputValue.setting_group_id), this.clearMessage() )} onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue }, () => newInputValue === null ? this.setState({ enableParameter: false, getParameter: null }, () => this.clearMessage()) : this.getParameterByGroup(newInputValue.setting_group_id), this.clearMessage())}
renderInput={(params) => <TextField {...params} InputProps={{ ...params.InputProps, style: { fontSize: 11 } }} InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }} label="Group" />} renderInput={(params) =>
<TextField
{...params}
error={this.state.errorGroup}
helperText={this.state.msgErrorGroup}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
label="Group" />}
value={this.state.getTypes} value={this.state.getTypes}
/> />
</div> </div>
...@@ -635,8 +642,14 @@ export default class CreateParameter extends Component { ...@@ -635,8 +642,14 @@ export default class CreateParameter extends Component {
{...this.state.perusahaan} {...this.state.perusahaan}
debug debug
id="tipe" id="tipe"
onChange={(event, newInputValue) => this.setState({ getPerusahaan: newInputValue }, ()=> this.clearMessage())} onChange={(event, newInputValue) => this.setState({ getPerusahaan: newInputValue }, () => this.clearMessage())}
renderInput={(params) => <TextField {...params} InputProps={{ ...params.InputProps, style: { fontSize: 11 } }} InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }} label="Perusahaan" />} renderInput={(params) =>
<TextField {...params}
error={this.state.errorPerusahaan}
helperText={this.state.msgErrorPerusahaan}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
label="Perusahaan" />}
value={this.state.getPerusahaan} value={this.state.getPerusahaan}
/> />
</div> </div>
...@@ -661,8 +674,8 @@ export default class CreateParameter extends Component { ...@@ -661,8 +674,8 @@ export default class CreateParameter extends Component {
}} }}
name="order" name="order"
onChange={(e) => this.handleChange(e, '')} onChange={(e) => this.handleChange(e, '')}
// error={this.state.errorOrder} // error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder} // helperText={this.state.msgErrorOrder}
> >
</TextField> </TextField>
</div> </div>
...@@ -801,7 +814,7 @@ export default class CreateParameter extends Component { ...@@ -801,7 +814,7 @@ export default class CreateParameter extends Component {
debug debug
disabled={!this.state.enableParameter} disabled={!this.state.enableParameter}
id="tipe" id="tipe"
onChange={(event, newInputValue) => this.setState({ getParameter: newInputValue }, ()=> this.clearMessage())} onChange={(event, newInputValue) => this.setState({ getParameter: newInputValue }, () => this.clearMessage())}
renderInput={(params) => renderInput={(params) =>
<TextField <TextField
{...params} {...params}
...@@ -849,7 +862,7 @@ export default class CreateParameter extends Component { ...@@ -849,7 +862,7 @@ export default class CreateParameter extends Component {
fontSize: 11 fontSize: 11
} }
}} }}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
...@@ -858,8 +871,8 @@ export default class CreateParameter extends Component { ...@@ -858,8 +871,8 @@ export default class CreateParameter extends Component {
}} }}
name="value" name="value"
onChange={(e) => this.handleChangeCreate(e, '')} onChange={(e) => this.handleChangeCreate(e, '')}
// error={this.state.errorValue} // error={this.state.errorValue}
// helperText={this.state.msgErrorValue} // helperText={this.state.msgErrorValue}
> >
</TextField> </TextField>
</div> </div>
...@@ -951,7 +964,7 @@ export default class CreateParameter extends Component { ...@@ -951,7 +964,7 @@ export default class CreateParameter extends Component {
{...this.state.types} {...this.state.types}
debug debug
id="tipe" id="tipe"
onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue }, () => newInputValue === null ? this.setState({ enableParameter: false, getParameter: null }, ()=> this.clearMessage()) : this.getParameterByGroup(newInputValue.setting_group_id), this.clearMessage() )} onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue }, () => newInputValue === null ? this.setState({ enableParameter: false, getParameter: null }, () => this.clearMessage()) : this.getParameterByGroup(newInputValue.setting_group_id), this.clearMessage())}
renderInput={(params) => renderInput={(params) =>
<TextField <TextField
{...params} {...params}
...@@ -969,7 +982,7 @@ export default class CreateParameter extends Component { ...@@ -969,7 +982,7 @@ export default class CreateParameter extends Component {
{...this.state.perusahaan} {...this.state.perusahaan}
debug debug
id="tipe" id="tipe"
onChange={(event, newInputValue) => this.setState({ getPerusahaan: newInputValue }, ()=> this.clearMessage())} onChange={(event, newInputValue) => this.setState({ getPerusahaan: newInputValue }, () => this.clearMessage())}
renderInput={(params) => renderInput={(params) =>
<TextField <TextField
{...params} {...params}
...@@ -1003,8 +1016,8 @@ export default class CreateParameter extends Component { ...@@ -1003,8 +1016,8 @@ export default class CreateParameter extends Component {
}} }}
name="order" name="order"
onChange={(e) => this.handleChangeCreate(e, '')} onChange={(e) => this.handleChangeCreate(e, '')}
// error={this.state.errorOrder} // error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder} // helperText={this.state.msgErrorOrder}
> >
</TextField> </TextField>
</div> </div>
......
...@@ -522,8 +522,7 @@ export default class Parameter extends Component { ...@@ -522,8 +522,7 @@ export default class Parameter extends Component {
if (response.data.status === "success") { if (response.data.status === "success") {
console.log(response) console.log(response)
this.getAllParameter() this.getAllParameter()
this.setState({ visibleParameter: true }) this.setState({ visibleParameter: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
} }
......
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