Commit 1d772ffe authored by a.bairuha's avatar a.bairuha

update

parent b7dc546d
...@@ -121,7 +121,7 @@ export default class CreatePerusahaan extends Component { ...@@ -121,7 +121,7 @@ export default class CreatePerusahaan extends Component {
options: typeData, options: typeData,
getOptionLabel: (option) => option.business_unit_name, getOptionLabel: (option) => option.business_unit_name,
}; };
this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? typeData[0] : typeData[index] }) this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? null : typeData[index] })
} else { } else {
alert(response.data.message) alert(response.data.message)
} }
...@@ -175,19 +175,21 @@ export default class CreatePerusahaan extends Component { ...@@ -175,19 +175,21 @@ export default class CreatePerusahaan extends Component {
errorSD: false, errorSD: false,
errorED: false, errorED: false,
errorJL: false, errorJL: false,
errorUB: false,
msgErrorNP: '', msgErrorNP: '',
msgErrorPC: '', msgErrorPC: '',
msgErrorSD: '', msgErrorSD: '',
msgErrorED: '', msgErrorED: '',
msgErrorJL: '', msgErrorJL: '',
msgErrorUB: ''
}) })
} }
validasiEdit() { validasiEdit() {
if (R.isEmpty(this.state.company)) { if (R.isEmpty(this.state.company)) {
this.setState({ errorNP: true, msgErrorNP: 'Nama perusahaan harus diisi' }) this.setState({ errorNP: true, msgErrorNP: 'Nama perusahaan harus diisi' })
// } else if (R.isEmpty(this.state.totalReport)) { } else if (R.isNil(this.state.getTypes)) {
// this.setState({ errorJL: true, msgErrorJL: 'Total Report harus diisi' }) this.setState({ errorUB: true, msgErrorUB: 'Unit Bisnis harus diisi' })
} else if (R.isNil(this.state.startDate)) { } else if (R.isNil(this.state.startDate)) {
this.setState({ errorSD: true, msgErrorSD: 'Start Date tidak boleh kosong' }) this.setState({ errorSD: true, msgErrorSD: 'Start Date tidak boleh kosong' })
} else if (R.isNil(this.state.endDate)) { } else if (R.isNil(this.state.endDate)) {
...@@ -210,7 +212,7 @@ export default class CreatePerusahaan extends Component { ...@@ -210,7 +212,7 @@ export default class CreatePerusahaan extends Component {
validasi() { validasi() {
if (R.isEmpty(this.state.company)) { if (R.isEmpty(this.state.company)) {
this.setState({ errorNP: true, msgErrorNP: 'Nama perusahaan harus diisi' }) this.setState({ errorNP: true, msgErrorNP: 'Nama perusahaan harus diisi' })
} else if (R.isNil(this.state.types)) { } else if (R.isNil(this.state.getTypes)) {
this.setState({ errorUB: true, msgErrorUB: 'Unit Bisnis harus diisi' }) this.setState({ errorUB: true, msgErrorUB: 'Unit Bisnis harus diisi' })
} else if (R.isNil(this.state.startDate)) { } else if (R.isNil(this.state.startDate)) {
this.setState({ errorSD: true, msgErrorSD: 'Start Date tidak boleh kosong' }) this.setState({ errorSD: true, msgErrorSD: 'Start Date tidak boleh kosong' })
...@@ -218,9 +220,11 @@ export default class CreatePerusahaan extends Component { ...@@ -218,9 +220,11 @@ export default class CreatePerusahaan extends Component {
this.setState({ errorED: true, msgErrorED: 'End Date tidak boleh kosong' }) this.setState({ errorED: true, msgErrorED: 'End Date tidak boleh kosong' })
} else if (!R.isEmpty(this.state.startDate) && !R.isEmpty(this.state.endDate) && (this.state.startDate > this.state.endDate)) { } else if (!R.isEmpty(this.state.startDate) && !R.isEmpty(this.state.endDate) && (this.state.startDate > this.state.endDate)) {
return alert("Masa Berlaku Tidak Boleh Kurang Dari Tanggal Mulai") return alert("Masa Berlaku Tidak Boleh Kurang Dari Tanggal Mulai")
} else if (R.isEmpty(this.state.totalReport)) { }
this.setState({ errorJL: true, msgErrorJL: 'Total Report harus diisi' }) // else if (R.isEmpty(this.state.totalReport)) {
} else { // this.setState({ errorJL: true, msgErrorJL: 'Total Report harus diisi' })
// }
else {
let payload = { let payload = {
"company_name": this.state.company, "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,
...@@ -283,8 +287,17 @@ export default class CreatePerusahaan extends Component { ...@@ -283,8 +287,17 @@ export default class CreatePerusahaan extends Component {
{...this.state.types} {...this.state.types}
debug debug
id="tipe" id="tipe"
onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue })} onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue }, ()=> this.clearError())}
renderInput={(params) => <TextField {...params} InputProps={{ ...params.InputProps, style: { fontSize: 11 } }} InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }} label="Unit Bisnis" />} renderInput={(params) =>
<TextField
{...params}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
label="Unit Bisnis"
error={this.state.errorUB}
helperText={this.state.msgErrorUB}
/>
}
value={this.state.getTypes} value={this.state.getTypes}
/> />
</div> </div>
...@@ -511,14 +524,13 @@ export default class CreatePerusahaan extends Component { ...@@ -511,14 +524,13 @@ export default class CreatePerusahaan extends Component {
{...this.state.types} {...this.state.types}
debug debug
id="tipe" id="tipe"
onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue })} onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue }, ()=> this.clearError())}
renderInput={(params) => renderInput={(params) =>
<TextField <TextField
{...params} {...params}
label="Unit Bisnis" label="Unit Bisnis"
margin="normal" margin="normal"
style={{marginTop: 7}} style={{marginTop: 7}}
onChange={(e) => this.handleChange(e, '')}
error={this.state.errorUB} error={this.state.errorUB}
helperText={this.state.msgErrorUB} helperText={this.state.msgErrorUB}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }} InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
...@@ -652,7 +664,7 @@ export default class CreatePerusahaan extends Component { ...@@ -652,7 +664,7 @@ export default class CreatePerusahaan extends Component {
style={{ padding: 0, margin: 0, width: '100%' }} style={{ padding: 0, margin: 0, width: '100%' }}
/> />
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> {/* <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
id="report" id="report"
...@@ -674,7 +686,7 @@ export default class CreatePerusahaan extends Component { ...@@ -674,7 +686,7 @@ export default class CreatePerusahaan extends Component {
onChange={(e) => this.setState({ totalReport: e.target.value }, () => this.clearError())} onChange={(e) => this.setState({ totalReport: e.target.value }, () => this.clearError())}
> >
</TextField> </TextField>
</div> </div> */}
</div> </div>
</div> </div>
......
...@@ -446,7 +446,7 @@ export default class Perusahaan extends Component { ...@@ -446,7 +446,7 @@ export default class Perusahaan extends Component {
{this.state.visiblePerusahaan === true ? {this.state.visiblePerusahaan === true ?
<div> <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={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%' }}>Master Data - Perusahaan</label> <label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Master Data - Perusahaan</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' }}>
<img src={Images.searchBlack} style={{ marginRight: 10 }} /> <img src={Images.searchBlack} style={{ marginRight: 10 }} />
<InputBase <InputBase
...@@ -457,7 +457,8 @@ export default class Perusahaan extends Component { ...@@ -457,7 +457,8 @@ export default class Perusahaan extends Component {
inputProps={{ 'aria-label': 'naked' }} inputProps={{ 'aria-label': 'naked' }}
/> />
</div> </div>
<div style={{ width: '20%', justifyContent: 'space-around', display: 'flex', flexFlow: 'wrap' }}> <div style={{ width: '30%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -469,6 +470,9 @@ export default class Perusahaan extends Component { ...@@ -469,6 +470,9 @@ export default class Perusahaan extends Component {
> >
<img src={Images.template} /> <img src={Images.template} />
</button> </button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload'} data-for="upload">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -480,6 +484,9 @@ export default class Perusahaan extends Component { ...@@ -480,6 +484,9 @@ export default class Perusahaan extends Component {
> >
<img src={Images.upload} /> <img src={Images.upload} />
</button> </button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Download'} data-for="download">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -491,6 +498,9 @@ export default class Perusahaan extends Component { ...@@ -491,6 +498,9 @@ export default class Perusahaan extends Component {
> >
<img src={Images.download} /> <img src={Images.download} />
</button> </button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
<a data-tip={'Visualisasi'} data-for="visual">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -502,6 +512,9 @@ export default class Perusahaan extends Component { ...@@ -502,6 +512,9 @@ export default class Perusahaan extends Component {
> >
<img src={Images.visualisasi} onClick={() => this.setState({ visibleVisual: true, visiblePerusahaan: false })} /> <img src={Images.visualisasi} onClick={() => this.setState({ visibleVisual: true, visiblePerusahaan: false })} />
</button> </button>
</a>
<ReactTooltip border={true} id="visual" place="bottom" type="light" effect="solid" />
<a data-tip={'Tambah'} data-for="create">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -513,6 +526,8 @@ export default class Perusahaan extends Component { ...@@ -513,6 +526,8 @@ export default class Perusahaan extends Component {
> >
<img src={Images.add} /> <img src={Images.add} />
</button> </button>
</a>
<ReactTooltip border={true} id="create" place="bottom" type="light" effect="solid" />
</div> </div>
</div> </div>
<div style={{ padding: 25 }}> <div style={{ padding: 25 }}>
...@@ -626,7 +641,7 @@ export default class Perusahaan extends Component { ...@@ -626,7 +641,7 @@ export default class Perusahaan extends Component {
type={this.state.uploadStatus} type={this.state.uploadStatus}
percentage={this.state.percentage} percentage={this.state.percentage}
result={this.state.result} result={this.state.result}
acceptedFiles={["pdf"]} acceptedFiles={["xsls"]}
onHandle={(dt) => { onHandle={(dt) => {
this.fileHandler(dt) this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' }) this.setState({ uploadStatus: 'idle', percentage: '0' })
......
...@@ -134,6 +134,21 @@ export default class AddUser extends Component { ...@@ -134,6 +134,21 @@ export default class AddUser extends Component {
} }
} }
clearError() {
this.setState({
errorFullname: false,
errorEmail: false,
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
})
}
isEmail(email) { isEmail(email) {
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(String(email).toLowerCase()); return re.test(String(email).toLowerCase());
...@@ -498,7 +513,7 @@ export default class AddUser extends Component { ...@@ -498,7 +513,7 @@ export default class AddUser extends Component {
<Autocomplete <Autocomplete
{...this.state.listRole} {...this.state.listRole}
id="role" id="role"
onChange={(event, newInputValue) => this.setState({ role: newInputValue })} onChange={(event, newInputValue) => this.setState({ role: newInputValue }, ()=> this.clearError())}
debug debug
renderInput={(params) => renderInput={(params) =>
<TextField <TextField
......
...@@ -121,6 +121,21 @@ export default class EditUser extends Component { ...@@ -121,6 +121,21 @@ export default class EditUser extends Component {
} }
} }
clearError() {
this.setState({
errorFullname: false,
errorEmail: false,
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
})
}
getDetailUser() { getDetailUser() {
api.create().getDetailUser(this.state.paramsId).then((response) => { api.create().getDetailUser(this.state.paramsId).then((response) => {
this.getRole() this.getRole()
...@@ -497,7 +512,7 @@ export default class EditUser extends Component { ...@@ -497,7 +512,7 @@ export default class EditUser extends Component {
<Autocomplete <Autocomplete
{...this.state.listRole} {...this.state.listRole}
id="role" id="role"
onChange={(event, newInputValue) => this.setState({ role: newInputValue })} onChange={(event, newInputValue) => this.setState({ role: newInputValue }, ()=> this.clearError())}
debug debug
renderInput={(params) => <TextField renderInput={(params) => <TextField
......
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