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