Commit 42ba2cac authored by faisalhamdi's avatar faisalhamdi

validasi parent company

parent 469afb6b
......@@ -249,6 +249,8 @@ export default class CreatePerusahaan extends Component {
validasiEdit() {
if (R.isEmpty(this.state.company)) {
this.setState({ errorNP: true, msgErrorNP: 'Company Name Cannot be Empty.' })
} else if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPC: true, msgErrorPC: 'Parent Company Cannot be Empty.' })
} else if (R.isNil(this.state.getTypes)) {
this.setState({ errorUB: true, msgErrorUB: 'Business Unit Cannot be Empty.' })
} else if (R.isNil(this.state.startDate)) {
......@@ -260,7 +262,8 @@ export default class CreatePerusahaan extends Component {
"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,
// "parent": this.state.getPerusahaan == null ? null : this.state.getPerusahaan.company_id,
"parent": this.state.getPerusahaan.company_id,
"start_date": this.state.startDate,
"end_date": this.state.endDate
}
......@@ -271,6 +274,8 @@ export default class CreatePerusahaan extends Component {
validasi() {
if (R.isEmpty(this.state.company)) {
this.setState({ errorNP: true, msgErrorNP: 'Company Name Cannot be Empty.' })
} else if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPC: true, msgErrorPC: 'Parent Company Cannot be Empty.' })
} else if (R.isNil(this.state.getTypes)) {
this.setState({ errorUB: true, msgErrorUB: 'Business Unit Cannot be Empty.' })
} else if (R.isNil(this.state.startDate)) {
......@@ -281,7 +286,8 @@ export default class CreatePerusahaan extends Component {
else {
let payload = {
"company_name": this.state.company,
"parent": this.state.getPerusahaan == null ? null : this.state.getPerusahaan.company_id,
// "parent": this.state.getPerusahaan == null ? null : this.state.getPerusahaan.company_id,
"parent": this.state.getPerusahaan.company_id,
"business_unit_id": this.state.getTypes.business_unit_id,
"start_date": this.state.startDate,
"end_date": this.state.endDate
......@@ -452,8 +458,17 @@ export default class CreatePerusahaan extends Component {
{...this.state.perusahaan}
debug
id="tipe"
onChange={(event, newInputValue) => this.setState({ getPerusahaan: newInputValue })}
renderInput={(params) => <TextField {...params} InputProps={{ ...params.InputProps, style: { fontSize: 11 } }} InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }} label="Parent Company" />}
onChange={(event, newInputValue) => this.setState({ getPerusahaan: newInputValue }, ()=> this.clearError())}
renderInput={(params) =>
<TextField
{...params}
label="Parent Company"
error={this.state.errorPC}
helperText={this.state.msgErrorPC}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>
}
value={this.state.getPerusahaan}
/>
</div>
......@@ -662,9 +677,18 @@ export default class CreatePerusahaan extends Component {
{...this.state.perusahaan}
debug
id="tipe"
onChange={(event, newInputValue) => this.setState({ getPerusahaan: newInputValue })}
renderInput={(params) => <TextField {...params} InputProps={{ ...params.InputProps, style: { fontSize: 11 } }} InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }} label="Parent Company" />}
value={this.state.getPerusahaan}
onChange={(event, newInputValue) => this.setState({ getPerusahaan: newInputValue }, ()=> this.clearError())}
renderInput={(params) =>
<TextField
{...params}
label="Parent Company"
error={this.state.errorPC}
helperText={this.state.msgErrorPC}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>
}
value={this.state.perusahaan}
/>
</div>
<div style={{ padding: 10, borderRadius: 5 }}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment