Commit bc96792c authored by EKSAD's avatar EKSAD

update lagi

parent 81961ca8
......@@ -113,13 +113,12 @@ export default class CreateReportItems extends Component {
// alert('coba ya')
if (R.isNil(this.state.reportType)) return alert("Jenis Laporan is Required.");
if (R.isNil(this.state.company)) return alert("Perusahaan is Required.");
else if (R.isNil(this.state.order)) {
else if (R.isEmpty(this.state.order)) {
this.setState({errorOrder: true, msgErrorOrder: 'Order Harus Diisi'})
}
else if (R.isEmpty(this.state.description)) {
this.setState({errorDesc: true, msgErrorDesc: 'Deskripsi Harus Diisi'})
}
else if (R.isNil(this.state.parent)) return alert("Parent ID is Required.")
else if (R.isNil(this.state.InputType)) return alert("Tipe Data is Required.")
else if (this.state.disabledFormula === false && R.isEmpty(this.state.formula)) {
this.setState({errorFormula: true, msgErrorFormula: 'Formula Harus Diisi'})
......@@ -290,8 +289,7 @@ export default class CreateReportItems extends Component {
</div>
</div>
<div className="border-bottom grid grid-2x grid-mobile-none gap-15px" style={{ padding: 20 }}>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField
......@@ -317,7 +315,36 @@ export default class CreateReportItems extends Component {
}}
/>
</div>
<div className="margin-top-10px" style={{padding: 10}} >
</div>
<div className="column-2">
<div className="margin-top-10px" style={{padding: 10, borderRadius: 5}}>
<Autocomplete
{...this.state.listReportType}
id="reportType"
onChange={(event, newInputValue) => this.setState({reportType: newInputValue})}
debug
renderInput={(params) =>
<TextField {...params}
label="Jenis Laporan"
InputLabelProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontWeight: 600, fontFamily: 'Nunito Sans, sans-serif' } }}
/>}
value={this.state.reportType}
/>
</div>
</div>
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{padding: 10, borderRadius: 5}} >
<Autocomplete
{...this.state.listCompany}
id="company"
......@@ -339,17 +366,19 @@ export default class CreateReportItems extends Component {
value={this.state.company}
/>
</div>
<div style={{ padding: 10, borderRadius: 5 }}>
</div>
<div className="column-2">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
id="description"
label="Deskripsi"
name="description"
value={this.state.description}
error={this.state.errorDesc}
helperText={this.state.msgErrorDesc}
id="orders"
name="order"
label="Order"
onChange={(e) => this.handleChange(e, '')}
value={this.state.order}
error={this.state.errorOrder}
helperText={this.state.msgErrorOrder}
onChange={(e) => this.handleChange(e, '')}
// value={this.props.data.business_unit_name}
inputProps={{
style: {
fontSize: 11,
......@@ -368,14 +397,22 @@ export default class CreateReportItems extends Component {
>
</TextField>
</div>
<div style={{ padding: 10, borderRadius: 5 }}>
</div>
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
id="uom"
name="uom"
label="UOM"
value={this.state.uom}
id="description"
label="Deskripsi"
name="description"
value={this.state.description}
error={this.state.errorDesc}
helperText={this.state.msgErrorDesc}
onChange={(e) => this.handleChange(e, '')}
// value={this.props.data.business_unit_name}
inputProps={{
style: {
fontSize: 11,
......@@ -394,20 +431,18 @@ export default class CreateReportItems extends Component {
>
</TextField>
</div>
<div className="margin-top-10px" style={{padding: 10}}>
</div>
<div className="column-2">
<div className="margin-top-10px" style={{padding: 10, borderRadius: 5}} >
<Autocomplete
{...this.state.listInputType}
id="inputType"
onChange={(event, newInputValue) => this.setState({InputType: newInputValue},
() => newInputValue === null ? this.setState({disabledFormula: true, disabledCondt: true, disabledValue: true, formula: '', condition: '', realVal: ''})
: newInputValue.type_report_name === 'Formula' ? this.setState({disabledFormula: false, disabledCondt: true, disabledValue: true, formula: '', condition: '', realVal: ''})
: newInputValue.type_report_name === 'Validation' ? this.setState({disabledFormula: false, disabledCondt: false, disabledValue: false, formula: '', condition: '', realVal: ''})
: this.setState({disabledFormula: true, disabledCondt: true, disabledValue: true, formula: '', condition: '', realVal: ''})
)}
{...this.state.listParent}
id="parentId"
onChange={(event, newInputValue) => this.setState({parent: newInputValue})}
debug
disabled={this.state.reportType == null || this.state.company == null}
renderInput={(params) =>
<TextField {...params}
label="Tipe Data"
label="Parent ID"
InputLabelProps={{
style: {
fontSize: 11,
......@@ -418,20 +453,21 @@ export default class CreateReportItems extends Component {
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontWeight: 600, fontFamily: 'Nunito Sans, sans-serif' } }}
/>}
value={this.state.InputType}
value={this.state.parent}
/>
</div>
</div>
</div>
<div className="margin-top-10px" style={{padding: 10}}>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
id="realVal"
label="Nilai Seharusnya"
name="realVal"
disabled={this.state.disabledValue}
value={this.state.realVal}
error={this.state.errorRV}
helperText={this.state.msgErrorRV}
id="uom"
name="uom"
label="UOM"
value={this.state.uom}
onChange={(e) => this.handleChange(e, '')}
inputProps={{
style: {
......@@ -448,110 +484,18 @@ export default class CreateReportItems extends Component {
color: '#7e8085',
}
}}
/>
</div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<DatePicker
margin="normal"
id="startDate"
label="Berlaku Mulai"
format="dd MMMM yyyy"
value={this.state.startDate}
error={this.state.errorStartDate}
helperText={this.state.msgErrorSD}
onChange={(e) => this.handleChange(e, 'start_date')}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
style={{padding: 0, margin: 0, width: '100%'}}
/>
</div>
<div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
value={'Aktif'}
id="status"
label="Status"
disabled
inputProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085',
}
}}
/>
</div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<div style={{display: 'flex'}}>
<Typography style={{ fontSize: 11, width: '20%' }}>Dibuat</Typography>
<Typography style={{ fontSize: 11 }}>: Admin - 21 Jul 2020, 18:45</Typography>
</div>
<div style={{display: 'flex'}}>
<Typography style={{ fontSize: 11, width: '20%' }}>Diubah</Typography>
<Typography style={{ fontSize: 11 }}>: Admin - 21 Jul 2020, 18:45</Typography>
</div>
>
</TextField>
</div>
</div>
<div className="column-2">
<div className="margin-top-10px" style={{padding: 10}}>
<Autocomplete
{...this.state.listReportType}
id="reportType"
onChange={(event, newInputValue) => this.setState({reportType: newInputValue})}
debug
renderInput={(params) =>
<TextField {...params}
label="Jenis Laporan"
InputLabelProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontWeight: 600, fontFamily: 'Nunito Sans, sans-serif' } }}
/>}
value={this.state.reportType}
/>
</div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
id="orders"
name="order"
label="Order"
onChange={(e) => this.handleChange(e, '')}
value={this.state.order}
error={this.state.errorOrder}
helperText={this.state.msgErrorOrder}
id="weight"
label="Weight"
name="weight"
value={this.state.weight}
onChange={(e) => this.handleChange(e, '')}
inputProps={{
style: {
......@@ -571,16 +515,25 @@ export default class CreateReportItems extends Component {
>
</TextField>
</div>
<div style={{padding: 10}} >
</div>
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{padding: 10, borderRadius: 5}}>
<Autocomplete
{...this.state.listParent}
id="parentId"
onChange={(event, newInputValue) => this.setState({parent: newInputValue})}
{...this.state.listInputType}
id="inputType"
onChange={(event, newInputValue) => this.setState({InputType: newInputValue},
() => newInputValue === null ? this.setState({disabledFormula: true, disabledCondt: true, disabledValue: true, formula: '', condition: '', realVal: ''})
: newInputValue.type_report_name === 'Formula' ? this.setState({disabledFormula: false, disabledCondt: true, disabledValue: true, formula: '', condition: '', realVal: ''})
: newInputValue.type_report_name === 'Validation' ? this.setState({disabledFormula: false, disabledCondt: false, disabledValue: false, formula: '', condition: '', realVal: ''})
: this.setState({disabledFormula: true, disabledCondt: true, disabledValue: true, formula: '', condition: '', realVal: ''})
)}
debug
disabled={this.state.reportType == null || this.state.company == null}
renderInput={(params) =>
<TextField {...params}
label="Parent ID"
label="Tipe Data"
InputLabelProps={{
style: {
fontSize: 11,
......@@ -591,16 +544,21 @@ export default class CreateReportItems extends Component {
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontWeight: 600, fontFamily: 'Nunito Sans, sans-serif' } }}
/>}
value={this.state.parent}
value={this.state.InputType}
/>
</div>
<div style={{ padding: 10, borderRadius: 5 }}>
</div>
<div className="column-2">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
id="weight"
label="Weight"
name="weight"
value={this.state.weight}
id="formula"
label="Formula"
name="formula"
disabled={this.state.disabledFormula}
value={this.state.formula}
error={this.state.errorFormula}
helperText={this.state.msgErrorFormula}
onChange={(e) => this.handleChange(e, '')}
inputProps={{
style: {
......@@ -620,16 +578,21 @@ export default class CreateReportItems extends Component {
>
</TextField>
</div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
</div>
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{padding: 10, borderRadius: 5}}>
<TextField
style={{ width: '100%' }}
id="formula"
label="Formula"
name="formula"
disabled={this.state.disabledFormula}
value={this.state.formula}
error={this.state.errorFormula}
helperText={this.state.msgErrorFormula}
id="realVal"
label="Nilai Seharusnya"
name="realVal"
disabled={this.state.disabledValue}
value={this.state.realVal}
error={this.state.errorRV}
helperText={this.state.msgErrorRV}
onChange={(e) => this.handleChange(e, '')}
inputProps={{
style: {
......@@ -646,10 +609,11 @@ export default class CreateReportItems extends Component {
color: '#7e8085',
}
}}
>
</TextField>
/>
</div>
<div className="margin-top-10px" style={{padding: 10}}>
</div>
<div className="column-2">
<div className="margin-top-10px" style={{padding: 10, borderRadius: 5}}>
<Autocomplete
value={this.state.condition}
id="isWrongCondition"
......@@ -673,7 +637,46 @@ export default class CreateReportItems extends Component {
/>}
/>
</div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
</div>
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<DatePicker
margin="normal"
id="startDate"
label="Berlaku Mulai"
format="dd MMMM yyyy"
value={this.state.startDate}
error={this.state.errorStartDate}
helperText={this.state.msgErrorSD}
onChange={(e) => this.handleChange(e, 'start_date')}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
style={{padding: 0, margin: 0, width: '100%'}}
/>
</div>
</div>
<div className="column-2">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<DatePicker
margin="normal"
id="endDate"
......@@ -707,7 +710,50 @@ export default class CreateReportItems extends Component {
/>
</div>
</div>
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
value={'Aktif'}
id="status"
label="Status"
disabled
inputProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085',
}
}}
/>
</div>
</div>
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<div style={{display: 'flex'}}>
<Typography style={{ fontSize: 11, width: '20%' }}>Dibuat</Typography>
<Typography style={{ fontSize: 11 }}>: Admin - 21 Jul 2020, 18:45</Typography>
</div>
<div style={{display: 'flex'}}>
<Typography style={{ fontSize: 11, width: '20%' }}>Diubah</Typography>
<Typography style={{ fontSize: 11 }}>: Admin - 21 Jul 2020, 18:45</Typography>
</div>
</div>
</div>
</div>
<div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
......@@ -722,9 +768,14 @@ export default class CreateReportItems extends Component {
</button>
</div>
<div className="column-2" style={{display: 'flex', justifyContent: 'flex-end', alignItems: 'center'}}>
<div onClick={() => this.validasi()} style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<button
type="button"
onClick={() => this.validasi()}
>
<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>
</button>
</div>
</div>
</div>
......
......@@ -120,7 +120,10 @@ export default class EditReportItems extends Component {
this.setState({errorOrder: true, msgErrorOrder: 'Order Harus Diisi'})
} else if (R.isEmpty(this.state.tempData.description)) {
this.setState({errorDesc: true, msgErrorDesc: 'Deskripsi Harus Diisi'})
} else if (R.isNil(this.state.tempData.InputType)) return alert("Tipe Data is Required.")
} else if (R.isNil(this.state.InputType)) return alert("Tipe Data harus dipilih.")
else if (this.state.InputType.type_report_name === 'Formula' || this.state.InputType.type_report_name === 'Validation' && R.isEmpty(this.state.tempData.formula)) {
this.setState({errorFormula: true, msgErrorFormula: 'Formula Harus Diisi'})
}
else {
this.updateReportItems()
}
......@@ -609,6 +612,8 @@ export default class EditReportItems extends Component {
label="Formula"
disabled={this.state.InputType == null? true : (this.state.InputType.type_report_name === 'Formula' || this.state.InputType.type_report_name === 'Validation'? false : true)}
name="formula"
error={this.state.errorFormula}
helperText={this.state.msgErrorFormula}
onChange={(e) => this.handleChange(e, '')}
value={this.state.tempData === null ? '' : this.state.tempData.formula}
inputProps={{
......
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