Commit 79a169cb authored by Riri Novita's avatar Riri Novita

Merge branch 'dev/riri' into 'ENV-DEV'

Fixing Company

See merge request !1830
parents 4b7e3091 af06568d
......@@ -40,12 +40,16 @@ export default class CreatePerusahaan extends Component {
errorED: false,
errorJL: false,
errorUB: false,
errorCur: false,
errorDefCur: false,
msgErrorNP: '',
msgErrorPC: '',
msgErrorSD: '',
msgErrorED: '',
msgErrorJL: '',
msgErrorUB: '',
msgErrorCur: '',
msgErrorDefCur: '',
alert: false,
tipeAlert: '',
messageAlert: '',
......@@ -303,22 +307,30 @@ export default class CreatePerusahaan extends Component {
errorED: false,
errorJL: false,
errorUB: false,
errorCur: false,
errorDefCur: false,
msgErrorNP: '',
msgErrorPC: '',
msgErrorSD: '',
msgErrorED: '',
msgErrorJL: '',
msgErrorUB: ''
msgErrorUB: '',
msgErrorCur: '',
msgErrorDefCur: ''
})
}
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.getPerusahaan)) {
this.setState({ errorPC: true, msgErrorPC: 'Parent Company Cannot be Empty' })
} else if (this.state.currency.length === 0) {
this.setState({ errorCur: true, msgErrorCur: 'Currency Cannot be Empty' })
} else if (R.isNil(this.state.defaultCurrency)) {
this.setState({ errorDefCur: true, msgErrorDefCur: 'Default Currency Cannot be Empty' })
} else if (R.isNil(this.state.startDate)) {
this.setState({ errorSD: true, msgErrorSD: 'Valid From Cannot be Empty' })
} else if (R.isNil(this.state.endDate)) {
......@@ -362,21 +374,26 @@ export default class CreatePerusahaan extends Component {
"parent": this.state.getPerusahaan.company_id,
"start_date": this.state.startDate,
"end_date": this.state.endDate,
"default_currency": this.state.defaultCurrency.id,
"currency": currencyID
"currency": currencyID,
"default_currency": this.state.defaultCurrency.id
}
console.log(payload);
this.props.updatePerusahaan(payload)
// this.props.updatePerusahaan(payload)
}
}
validasi() {
console.log(this.state.currency.length);
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.' })
this.setState({ errorUB: true, msgErrorUB: 'Business Unit Cannot be Empty' })
} else if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPC: true, msgErrorPC: 'Parent Company Cannot be Empty' })
} else if (this.state.currency.length === 0) {
this.setState({ errorCur: true, msgErrorCur: 'Currency Cannot be Empty' })
} else if (R.isNil(this.state.defaultCurrency)) {
this.setState({ errorDefCur: true, msgErrorDefCur: 'Default Currency Cannot be Empty' })
} else if (R.isNil(this.state.startDate)) {
this.setState({ errorSD: true, msgErrorSD: 'Valid From Cannot be Empty.' })
} else if (R.isNil(this.state.endDate)) {
......@@ -396,8 +413,8 @@ export default class CreatePerusahaan extends Component {
"business_unit_id": this.state.getTypes.business_unit_id,
"start_date": this.state.startDate,
"end_date": this.state.endDate,
"currency": currencyID,
"default_currency": this.state.defaultCurrency.id,
"currency": currencyID
}
// console.log(payload);
this.props.createPerusahaan(payload)
......@@ -495,6 +512,7 @@ export default class CreatePerusahaan extends Component {
}
})
this.clearError()
}}
renderInput={(params) => (
<TextField
......@@ -505,6 +523,8 @@ export default class CreatePerusahaan extends Component {
style={{ marginTop: 0 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
error={this.state.errorCur}
helperText={this.state.msgErrorCur}
/>
)}
value={this.state.currency}
......@@ -619,6 +639,8 @@ export default class CreatePerusahaan extends Component {
style={{ marginTop: 7 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
error={this.state.errorDefCur}
helperText={this.state.msgErrorDefCur}
/>
}
......@@ -763,6 +785,20 @@ export default class CreatePerusahaan extends Component {
multiple
options={this.state.dataCurrency}
getOptionLabel={(option) => option.value}
renderInput={(params) => (
<TextField
{...params}
variant="standard"
label="Currency"
margin="normal"
style={{ marginTop: 0 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
error={this.state.errorCur}
helperText={this.state.msgErrorCur}
/>
)}
value={this.state.currency}
onChange={(event, newInputValue) => {
let findIdx = newInputValue.findIndex(e => e.id === 2)
let bizpar = findIdx >= 0 ? this.state.dataCurrency.filter(e => e.id === 2) : newInputValue
......@@ -775,20 +811,9 @@ export default class CreatePerusahaan extends Component {
this.setState({ defaultCurrency: result })
}
this.clearError()
})
}}
renderInput={(params) => (
<TextField
{...params}
variant="standard"
label="Currency"
margin="normal"
style={{ marginTop: 0 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>
)}
value={this.state.currency}
/>
</div>
<div style={{ padding: 10, borderRadius: 5 }}>
......@@ -905,6 +930,8 @@ export default class CreatePerusahaan extends Component {
style={{ marginTop: 7 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
error={this.state.errorDefCur}
helperText={this.state.msgErrorDefCur}
/>
}
......
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