Commit 457e97e2 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into deni-dev(pc)

parents 92e9e0de 387cb89d
......@@ -113,14 +113,13 @@ 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 (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>
......
......@@ -116,27 +116,14 @@ export default class EditReportItems 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.tempData.order)) {
this.setState({errorOrder: true, msgErrorOrder: 'Order Harus Diisi'})
}
else if (R.isEmpty(this.state.description)) {
} else if (R.isEmpty(this.state.tempData.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)) {
} 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 if (this.state.disabledValue === false && R.isEmpty(this.state.realVal)) {
this.setState({errorRV: true, msgErrorRV: 'Nilai Seharusnya Harus Diisi'})
}
else if (this.state.disabledCondt === false && R.isEmpty(this.state.condition)) return alert("Kondisi Jika Salah is Required.")
else if (R.isNil(this.state.startDate)) {
this.setState({errorStartDate: true, msgErrorSD: 'Start Date tidak boleh kosong'})
}
else if (R.isNil(this.state.endDate)) {
this.setState({errorEndDate: true, msgErrorED: 'End Date tidak boleh kosong'})
}
else {
this.updateReportItems()
}
......@@ -368,6 +355,8 @@ export default class EditReportItems extends Component {
id="description"
label="Deskripsi"
name="description"
error={this.state.errorDesc}
helperText={this.state.msgErrorDesc}
onChange={(e) => this.handleChange(e, '')}
value={this.state.tempData === null ? '' : this.state.tempData.description}
inputProps={{
......@@ -545,14 +534,15 @@ export default class EditReportItems extends Component {
id="order"
label="Order"
name="order"
onChange={(e) => this.handleChange(e, '')}
value={this.state.tempData === null ? '' : this.state.tempData.order}
error={this.state.errorOrder}
helperText={this.state.msgErrorOrder}
onChange={(e) => this.handleChange(e, '')}
inputProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
paddingLeft: 10
fontFamily: 'Nunito Sans, sans-serif'
}
}}
InputLabelProps={{
......@@ -560,8 +550,7 @@ export default class EditReportItems extends Component {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085',
paddingLeft: 10
color: '#7e8085'
}
}}
>
......@@ -623,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={{
......@@ -701,7 +692,7 @@ export default class EditReportItems extends Component {
</button>
</div>
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<button onClick={() => this.updateReportItems()}>
<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>
......
......@@ -143,8 +143,10 @@ export default class VisualReportItems extends Component {
}
api.create().getItemReportHierarki(payload).then((response) => {
console.log(response.data)
if (response.data.status == 'success') {
this.setState({ items: response.data.data })
if (response.data) {
if (response.data.status == 'success') {
this.setState({ items: response.data.data })
}
}
})
}
......
......@@ -102,136 +102,138 @@ export default class UserRole extends Component {
this.setState({ payload: body })
api.create().checkUploadUser(body).then(response => {
console.log(response);
if (response.data.status === "success") {
let dataRow = response.data.data.map((item, index) => {
return [
index + 1,
item.fullname,
item.email,
item.role,
item.start_date,
item.end_date,
item.error
]
})
let columns = [
"Data Ke-",
"Nama Lengkap",
{
name: "Email",
options: {
customBodyRender: (val, tableMeta) => {
console.log(tableMeta)
let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('email'))
if (check > -1) {
this.setState({ buttonError: true })
if (response.data) {
if (response.data.status === "success") {
let dataRow = response.data.data.map((item, index) => {
return [
index + 1,
item.fullname,
item.email,
item.role,
item.start_date,
item.end_date,
item.error
]
})
let columns = [
"Data Ke-",
"Nama Lengkap",
{
name: "Email",
options: {
customBodyRender: (val, tableMeta) => {
console.log(tableMeta)
let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('email'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="email">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="email" place="bottom" type="light" effect="solid" />
</div >
);
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="email">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
},
{
name: "Role",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('role'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
<ReactTooltip border={true} id="email" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "Role",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('role'))
if (check > -1) {
this.setState({ buttonError: true })
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="role">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="role" place="bottom" type="light" effect="solid" />
</div >
);
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="role">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
},
{
name: "Berlaku Mulai",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('start_date'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
<ReactTooltip border={true} id="role" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "Berlaku Mulai",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('start_date'))
if (check > -1) {
this.setState({ buttonError: true })
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="startdate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="startdate" place="bottom" type="light" effect="solid" />
</div >
);
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="startdate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
},
{
name: "Berakhir Hingga",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('end_date'))
if (check > -1) {
this.setState({ buttonError: true })
}
}
<ReactTooltip border={true} id="startdate" place="bottom" type="light" effect="solid" />
</div >
);
}
}
},
{
name: "Berakhir Hingga",
options: {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[6] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('end_date'))
if (check > -1) {
this.setState({ buttonError: true })
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="enddate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="enddate" place="bottom" type="light" effect="solid" />
</div >
);
}
}
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="enddate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
}
<ReactTooltip border={true} id="enddate" place="bottom" type="light" effect="solid" />
</div >
);
},
{
name: "",
options: {
display: false
}
}
}
},
{
name: "",
options: {
display: false
}
]
this.setState({
dataLoaded: true,
cols: columns,
rows: dataRow
});
}
]
this.setState({
dataLoaded: true,
cols: columns,
rows: dataRow
});
}
})
}
......@@ -261,7 +263,7 @@ export default class UserRole extends Component {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Data User.xlsx';
a.download = 'User.xlsx';
a.click();
}
}
......
......@@ -70,37 +70,56 @@ export default class AddUser extends Component {
componentDidMount() {
this.getRole()
this.getPerusahaan()
if (this.props.type === 'edit') {
//
} else {
let date = format(new Date, 'yyyy-MM-dd')
console.log(date);
this.setState({
startDate: date,
endDate: date
})
}
}
handleChange(e, type) {
let data = this.state
let isDate = type !== '' ? true : false
if (isDate && type === 'start_date') {
this.setState({
...data, startDate: format(e, 'yyyy-MM-dd'), endDate: null,
this.setState({ ...data, startDate: format(e, 'yyyy-MM-dd'), endDate: null,
errorFullname: false,
errorEmail: false,
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
})
} else if (isDate && type === 'end_date') {
this.setState({
...data, endDate: format(e, 'yyyy-MM-dd'),
this.setState({ ...data, endDate: format(e, 'yyyy-MM-dd') ,
errorFullname: false,
errorEmail: false,
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
})
} else {
this.setState({
...data, [e.target.name]: e.target.value,
this.setState({ ...data, [e.target.name]: e.target.value,
errorFullname: false,
errorEmail: false,
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
......@@ -108,8 +127,33 @@ export default class AddUser extends Component {
}
}
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,}))$/;
return re.test(String(email).toLowerCase());
}
validasi() {
var isEmail = this.isEmail(this.state.email)
if (R.isEmpty(this.state.fullname)) {
this.setState({ errorFullname: true, msgErrorFN: 'Nama Lengkap tidak boleh kosong' })
} else if (R.isEmpty(this.state.email)) {
this.setState({ errorEmail: true, msgErrorEM: 'Email tidak boleh kosong' })
} else if (!isEmail) {
this.setState({ errorEmail: true, msgErrorEM: 'Format email tidak sesuai!' })
} else if (R.isNil(this.state.role)) {
this.setState({ errorRoleName: true, msgErrorRN: 'Role Name tidak boleh kosong' })
} else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Start Date tidak boleh kosong' })
} else if (R.isNil(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorED: 'End Date tidak boleh kosong' })
}
// else if (this.state.privileges.length < 1) {
// alert('Hak Akses belum di pilih !!')
// }
else {
this.createUser()
}
}
createUser() {
......@@ -316,6 +360,19 @@ export default class AddUser extends Component {
variant="filled"
value={'-'}
onChange={(e) => null}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085',
}
}}
>
{/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
......@@ -329,12 +386,27 @@ export default class AddUser extends Component {
<div className="column-2">
<div className="">
<TextField
style={{ width: '100%', marginTop: 7 }}
id="fullname"
name="fullname"
label="Nama Lengkap"
value={this.state.fullname}
onChange={(e) => this.handleChange(e, '')}
style={{ width: '100%' , marginTop: 7}}
id="fullname"
name="fullname"
label="Nama Lengkap"
value={this.state.fullname}
error={this.state.errorFullname}
helperText={this.state.msgErrorFN}
onChange={(e) => this.handleChange(e, '')}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085',
}
}}
// defaultValue="Default Value"
// helperText="Some important text"
/>
......@@ -346,12 +418,27 @@ export default class AddUser extends Component {
<div className="column-1">
<div className="margin-bottom-20px">
<TextField
style={{ width: '100%', marginTop: 7 }}
id="email"
name="email"
label="Email"
value={this.state.email}
onChange={(e) => this.handleChange(e, '')}
style={{ width: '100%' , marginTop: 7}}
id="email"
name="email"
label="Email"
value={this.state.email}
error={this.state.errorEmail}
helperText={this.state.msgErrorEM}
onChange={(e) => this.handleChange(e, '')}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085',
}
}}
// defaultValue="Default Value"
// helperText="Some important text"
/>
......@@ -365,7 +452,24 @@ export default class AddUser extends Component {
id="role"
onChange={(event, newInputValue) => this.setState({ role: newInputValue })}
debug
renderInput={(params) => <TextField {...params} label="Role" margin="normal" style={{ marginTop: 7 }} />}
renderInput={(params) =>
<TextField
{...params}
label="Role"
margin="normal"
style={{marginTop: 7}}
onChange={(e) => this.handleChange(e, '')}
error={this.state.errorRoleName}
helperText={this.state.msgErrorRN}
InputLabelProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>}
value={this.state.role}
/>
</div>
......@@ -387,6 +491,19 @@ export default class AddUser extends Component {
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
......@@ -408,6 +525,19 @@ export default class AddUser extends Component {
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
......@@ -426,6 +556,19 @@ export default class AddUser extends Component {
// id="outlined-read-only-input"
variant="filled"
value={'Aktif'}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
>
{/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
......@@ -447,6 +590,19 @@ export default class AddUser extends Component {
// id="outlined-read-only-input"
variant="filled"
value={'T'}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
>
{/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
......
......@@ -126,12 +126,22 @@ export default class EditUser extends Component {
})
}
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,}))$/;
return re.test(String(email).toLowerCase());
}
validasi() {
var isEmail = this.isEmail(this.state.tempData.email)
// console.log(this.state.tempData)
if (R.isEmpty(this.state.tempData.fullname)) {
this.setState({ errorFullname: true, msgErrorFN: 'Nama Lengkap tidak boleh kosong' })
} else if (R.isEmpty(this.state.tempData.email)) {
this.setState({ errorEmail: true, msgErrorEM: 'Email tidak boleh kosong' })
} else if (R.isEmpty(this.state.tempData.role_name)) {
} else if (!isEmail) {
this.setState({ errorEmail: true, msgErrorEM: 'Format email tidak sesuai!' })
} else if (R.isNil(this.state.role)) {
this.setState({ errorRoleName: true, msgErrorRN: 'Role Name tidak boleh kosong' })
} else if (R.isNil(this.state.tempData.start_date)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Start Date tidak boleh kosong' })
......@@ -349,6 +359,19 @@ export default class EditUser extends Component {
variant="filled"
value={this.state.tempData === null ? '' : this.state.tempData.user_id}
onChange={(e) => null}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
>
{/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
......@@ -371,6 +394,19 @@ export default class EditUser extends Component {
// defaultValue="Default Value"
error={this.state.errorFullname}
helperText={this.state.msgErrorFN}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
/>
</div>
</div>
......@@ -388,6 +424,19 @@ export default class EditUser extends Component {
onChange={(e) => this.handleChange(e, '')}
error={this.state.errorEmail}
helperText={this.state.msgErrorEM}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
/>
</div>
</div>
......@@ -400,7 +449,23 @@ export default class EditUser extends Component {
onChange={(event, newInputValue) => this.setState({ role: newInputValue })}
debug
renderInput={(params) => <TextField {...params} label="Role" margin="normal" style={{ marginTop: 7 }} />}
renderInput={(params) => <TextField
{...params}
label="Role"
margin="normal"
style={{ marginTop: 7 }}
onChange={(e) => this.handleChange(e, '')}
error={this.state.errorRoleName}
helperText={this.state.msgErrorRN}
InputLabelProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>}
value={this.state.role}
/>
</div>
......@@ -422,6 +487,19 @@ export default class EditUser extends Component {
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div>
......@@ -442,7 +520,19 @@ export default class EditUser extends Component {
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div>
......@@ -460,6 +550,19 @@ export default class EditUser extends Component {
// id="outlined-read-only-input"
variant="filled"
value={this.state.tempData === null ? '' : this.state.tempData.status}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
>
{/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
......@@ -481,6 +584,19 @@ export default class EditUser extends Component {
// id="outlined-read-only-input"
variant="filled"
value={this.state.tempData === null ? '' : this.state.tempData.is_expired}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
>
{/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
......
......@@ -52,6 +52,16 @@ export default class AddRole extends Component {
componentDidMount() {
this.getMenu()
if (this.props.type === 'edit') {
//
} else {
let date = format(new Date, 'yyyy-MM-dd')
console.log(date);
this.setState({
startDate: date,
endDate: date
})
}
}
handleChange(e, type) {
......@@ -266,6 +276,19 @@ export default class AddRole extends Component {
variant="filled"
value={'-'}
onChange={(e) => null}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085',
}
}}
>
{/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
......@@ -287,6 +310,19 @@ export default class AddRole extends Component {
error={this.state.errorRoleName}
helperText={this.state.msgErrorRN}
onChange={(e) => this.handleChange(e, '')}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085',
}
}}
// defaultValue="Default Value"
// helperText="Some important text"
/>
......@@ -309,6 +345,19 @@ export default class AddRole extends Component {
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
......@@ -330,6 +379,19 @@ export default class AddRole extends Component {
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
......@@ -348,6 +410,20 @@ export default class AddRole extends Component {
// id="outlined-read-only-input"
variant="filled"
value={'Aktif'}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
>
{/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
......
......@@ -274,6 +274,19 @@ export default class EditRole extends Component {
variant="filled"
value={this.state.tempData === null ? '' : this.state.tempData.role_id}
onChange={(e) => null}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
>
{/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
......@@ -295,6 +308,19 @@ export default class EditRole extends Component {
error={this.state.errorRoleName}
helperText={this.state.msgErrorRN}
onChange={(e) => this.handleChange(e, '')}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
// defaultValue="Default Value"
// helperText="Some important text"
/>
......@@ -317,6 +343,19 @@ export default class EditRole extends Component {
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
......@@ -338,6 +377,19 @@ export default class EditRole extends Component {
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
......@@ -356,6 +408,19 @@ export default class EditRole extends Component {
// id="outlined-read-only-input"
variant="filled"
value={this.state.tempData === null ? '' : this.state.tempData.status}
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
>
{/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
......
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