Commit b41b6449 authored by EKSAD's avatar EKSAD

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into riri

parents ea77a9f6 0a5c464e
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
"moment": "^2.27.0", "moment": "^2.27.0",
"mui-datatables": "^3.3.1", "mui-datatables": "^3.3.1",
"node-sass": "^4.14.1", "node-sass": "^4.14.1",
"ramda": "^0.27.1",
"react": "^16.13.1", "react": "^16.13.1",
"react-bootstrap": "^1.3.0", "react-bootstrap": "^1.3.0",
"react-d3-donut": "^1.1.2", "react-d3-donut": "^1.1.2",
......
...@@ -79,6 +79,12 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/') ...@@ -79,6 +79,12 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
//UNIT BISNIS //UNIT BISNIS
const getUnitBisnis = () => api.get('business_unit/get_all_business_unit') const getUnitBisnis = () => api.get('business_unit/get_all_business_unit')
const createUnitBisnis = (body) => api.post('/business_unit/create_business_unit', body)
const updateUnitBisnis = (body) => api.post('/business_unit/update_business_unit', body)
const searchUnitBisnis = (body) => api.post('/business_unit/search_business_unit', body)
// APPROVAL MATRIX
const getAM = () => api.get('approval_matrix/get_all_approval_matrix')
// ------ // ------
// STEP 3 // STEP 3
...@@ -105,7 +111,11 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/') ...@@ -105,7 +111,11 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
editRole, editRole,
deleteRole, deleteRole,
getMenu, getMenu,
getUnitBisnis getUnitBisnis,
createUnitBisnis,
updateUnitBisnis,
searchUnitBisnis,
getAM
} }
} }
......
...@@ -103,6 +103,7 @@ ...@@ -103,6 +103,7 @@
background-color: #fff; } background-color: #fff; }
.app-popup-show { .app-popup-show {
display: flex; display: flex;
z-index: 1290;
-webkit-transition: all 0.35s cubic-bezier(0, 1, 0.5, 1); -webkit-transition: all 0.35s cubic-bezier(0, 1, 0.5, 1);
-moz-transition: all 0.35s cubic-bezier(0, 1, 0.5, 1); -moz-transition: all 0.35s cubic-bezier(0, 1, 0.5, 1);
-ms-transition: all 0.35s cubic-bezier(0, 1, 0.5, 1); -ms-transition: all 0.35s cubic-bezier(0, 1, 0.5, 1);
...@@ -2,16 +2,20 @@ import React, { Component } from 'react'; ...@@ -2,16 +2,20 @@ import React, { Component } from 'react';
import { Container, Row, Col } from "react-bootstrap"; import { Container, Row, Col } from "react-bootstrap";
import { makeStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles'; import { makeStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import { TextField, InputBase } from "@material-ui/core"; import { TextField, InputBase } from "@material-ui/core";
import { ExcelRenderer } from 'react-excel-renderer';
import Images from '../../assets/Images'; import Images from '../../assets/Images';
import MUIDataTable from "mui-datatables"; import MUIDataTable from "mui-datatables";
import UploadFile from "../../library/Upload";
import CreateApprovalMatrix from "./CreateApprovalMatrix"; import CreateApprovalMatrix from "./CreateApprovalMatrix";
import EditApprovalMatrix from "./EditApprovalMatrix"; import EditApprovalMatrix from "./EditApprovalMatrix";
import PreviewAM from "./PreviewAM"; import PreviewAM from "./PreviewAM";
import VisualisasiAM from "./VisualisasiAM"; import VisualisasiAM from "./VisualisasiAM";
import api from "../../api";
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable());
const options = ct.customOptions(); const options = ct.customOptions();
const options2 = ct.customOptions2();
const type = [ const type = [
{ {
...@@ -32,11 +36,81 @@ export default class ApprovalMatrix extends Component { ...@@ -32,11 +36,81 @@ export default class ApprovalMatrix extends Component {
visibleCreate: false, visibleCreate: false,
visibleEdit: false, visibleEdit: false,
visibleVisual: false, visibleVisual: false,
dataTable: [],
listData: [],
data: [],
search: "", search: "",
cols: null,
rows: null,
dataLoaded: false
} }
this.fileHandler = this.fileHandler.bind(this);
}
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
if (err) {
// console.log(err);
}
else {
let judul = resp.rows[0]
let isi = resp.rows.slice(1)
// let body = isi.map((item) => {
// return {
// item
// ]
// })
// console.log(JSON.stringify(isi));
this.setState({
dataLoaded: true,
cols: judul,
rows: isi
});
}
});
} }
componentDidMount() { componentDidMount() {
this.getData()
}
getData() {
api.create().getAM().then((response) => {
// console.log(response)
let datas = response.data.data
let listData = datas.map((item, index) => {
return [item.fullname ]
})
console.log(listData)
if(response.status == null){
alert(response.problem)
}
else if (response.data.status == 'success') {
let data = response.data.data
let listData = data.map((item, index) => {
return [index, item.approval_matrix_id, item.approval_type_name, item.orders, item.fullname, item.operator_type_name, item.status ]
})
this.setState({ dataTable: listData, listData: response.data.data })
} else {
alert(response.data.message)
}
})
}
openPopUp(index, type) {
if (type === 'edit') {
this.setState({
selectIndex: index,
visibleEdit: true
})
} else {
this.setState({
data: this.state.listData[index],
visibleCreate: true
})
}
} }
handleInputChange = (e) => { handleInputChange = (e) => {
...@@ -66,15 +140,88 @@ export default class ApprovalMatrix extends Component { ...@@ -66,15 +140,88 @@ export default class ApprovalMatrix extends Component {
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent' borderColor: 'transparent'
}} }}
onClick={() => null} onClick={() => this.openPopUp(tableMeta.rowIndex, 'edit')}
// onClick={() => this.setState({ visibleEdit: true })}
> >
<img src={Images.editCopy} onClick={() => this.setState({ visibleEdit: true })} /> <img src={Images.editCopy} />
</button> </button>
</div > </div >
); );
} }
} }
}, "ID", "Tipe Persetujuan", "Order", "Nama Pemberi Persetujuan", "Operator", "Status"] },
{
name: "ID",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[6] === "Aktif" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
}
},
{
name: "Tipe Persetujuan",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[6] === "Aktif" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
}
},
{
name: "Order",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[6] === "Aktif" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
}
},
{
name: "Nama Pemberi Persetujuan",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[6] === "Aktif" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
}
},
{
name: "Operator",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[6] === "Aktif" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
}
},
{
name: "Status",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<span style={{ color: tableMeta.rowData[6] === "Aktif" ? "#656565" : 'rgba(0, 0, 0, 0.25)' }}>{val}</span>
</div >
);
}
}
}]
const data = [ const data = [
["", "1", "Yearly", "1", "John Doe", "-", "Aktif"], ["", "1", "Yearly", "1", "John Doe", "-", "Aktif"],
["", "2", "Yearly", "2", "John Doe", "-", "Aktif"], ["", "2", "Yearly", "2", "John Doe", "-", "Aktif"],
...@@ -85,114 +232,187 @@ export default class ApprovalMatrix extends Component { ...@@ -85,114 +232,187 @@ export default class ApprovalMatrix extends Component {
return ( return (
<div> <div>
{this.state.visibleAM === true ? {this.state.visibleAM === true ?
<div style={{ height: this.props.height }}> <div style={{ height: this.props.height }}>
<div style={{ height: 199, width: '100%', backgroundColor: '#354960' }} /> <div style={{ height: 199, width: '100%', backgroundColor: '#354960' }} />
<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', paddingTop: 8 }}>Master Data - Approval Matrix</label> <label style={{ color: 'white', fontSize: 16, alignSelf: 'center', paddingTop: 8 }}>Master Data - Approval Matrix</label>
{/* <form style={{ }}> {/* <form style={{ }}>
<TextField id="" label="" variant="outlined" size="small" placeholder="Search" style={{ width: 423, backgroundColor: 'white', borderRadius: 6 }}/> <TextField id="" label="" variant="outlined" size="small" placeholder="Search" style={{ width: 423, backgroundColor: 'white', borderRadius: 6 }}/>
</form> */} </form> */}
<div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5 }}> <div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5 }}>
<img src={Images.searchBlack} style={{ marginRight: 10 }} /> <img src={Images.searchBlack} style={{ marginRight: 10 }} />
<InputBase <InputBase
style={{ width: '100%' }} style={{ width: '100%' }}
placeholder="Search" placeholder="Search"
value={this.state.search} value={this.state.search}
onChange={(e) => this.handleInputChange(e)} onChange={(e) => this.handleInputChange(e)}
inputProps={{ 'aria-label': 'naked' }} inputProps={{ 'aria-label': 'naked' }}
/> />
</div>
<div style={{ display: 'flex' }}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
padding: 0
}}
onClick={() => null}
>
<img src={Images.template} />
</button>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginLeft: 16,
padding:0
}}
onClick={() => null}
>
<img src={Images.upload} onClick={() => this.setState({ visibleUpload: true })}/>
</button>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginLeft: 16,
padding:0
}}
onClick={() => null}
>
<img src={Images.download} />
</button>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginLeft: 16,
padding:0
}}
onClick={() => null}
>
<img src={Images.visualisasi} onClick={() => this.setState({ visibleVisual: true, visibleAM: false })} />
</button>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginLeft: 16,
padding:0
}}
>
<img src={Images.add} onClick={() => this.setState({ visibleCreate: true })} />
</button>
</div >
</div> </div>
<div style={{ display: 'flex' }}> <div style={{ padding: 25, width: '100%' }}>
<button <MuiThemeProvider theme={getMuiTheme()}>
style={{ <MUIDataTable
backgroundColor: 'transparent', theme={getMuiTheme()}
cursor: 'pointer', data={this.state.dataTable}
borderColor: 'transparent', columns={columns}
padding: 0 options={options}
}} />
onClick={() => null} </MuiThemeProvider>
> </div>
<img src={Images.template} /> </div>
</button> </div>
<button :
style={{ <div style={{ height: this.props.height }}>
backgroundColor: 'transparent', <div style={{ height: 199, width: '100%', backgroundColor: '#354960' }} />
cursor: 'pointer', <div>
borderColor: 'transparent', <div>
marginLeft: 16, <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}>
padding:0 <label style={{ color: 'white', fontSize: 16, alignSelf: 'center' }}>Preview Data</label>
}} </div>
onClick={() => null} <div style={{ padding: 25 }}>
> {this.state.dataLoaded && (
<img src={Images.upload} /> <MuiThemeProvider theme={getMuiTheme()}>
</button> <MUIDataTable
<button theme={getMuiTheme()}
style={{ data={this.state.rows}
backgroundColor: 'transparent', columns={this.state.cols}
cursor: 'pointer', options={options}
borderColor: 'transparent', />
marginLeft: 16, </MuiThemeProvider>
padding:0 )}
}} </div>
onClick={() => null} <div style={{ display: 'flex', width: '100%', placeContent: 'flex-end', padding: 20 }}>
> <button
<img src={Images.download} /> type="button"
</button> onClick={() => this.setState({ visibleAM: true })}
<button style={{ marginRight: 20}}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
marginLeft: 16,
padding:0
}}
onClick={() => null}
> >
<img src={Images.visualisasi} onClick={() => this.setState({ visibleVisual: true, visibleAM: false })} /> <div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#354960', fontSize: 11 }}>Batal</span>
</div>
</button> </button>
<button <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
style={{ <span style={{ color: '#fff', fontSize: 11 }}>Simpan</span>
backgroundColor: 'transparent', </div>
cursor: 'pointer', </div>
borderColor: 'transparent', </div>
marginLeft: 16, </div>
padding:0 </div>
}} }
{this.state.visibleCreate && (
<CreateApprovalMatrix
onClickClose={() => this.setState({ visibleCreate: false })}
data={this.state.listData}
/>
)}
{this.state.visibleEdit && (
<EditApprovalMatrix
type={"edit"}
onClickClose={() => this.setState({ visibleEdit: false })}
data={this.state.listData[this.state.selectIndex]}
/>
)}
{this.state.visibleVisual && (
<VisualisasiAM
onClickClose={() => this.setState({ visibleVisual: false })}
/>
)}
{this.state.visibleUpload && (
<div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
<div className="popup-panel grid grid-2x" style={{ backgroundColor: '#51c6ea', height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File</span>
</div>
</div>
<div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
<button
type="button"
className="btn btn-circle btn-white"
onClick={() => this.setState({ visibleUpload: false })}
> >
<img src={Images.add} onClick={() => this.setState({ visibleCreate: true })} /> <i className="fa fa-lg fa-times" style={{ color: 'white' }} />
</button> </button>
</div > </div>
</div> </div>
<div style={{ padding: 25, width: '100%' }}> <UploadFile
<MuiThemeProvider theme={getMuiTheme()}> type={this.state.uploadStatus}
<MUIDataTable percentage={this.state.percentage}
data={data} result={this.state.result}
columns={columns} acceptedFiles={["pdf"]}
options={options} onHandle={(dt) => {
/> this.fileHandler(dt)
</MuiThemeProvider> this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => this.setState({ visibleUpload: false, visibleAM: false })}
/>
</div> </div>
</div> </div>
</div> )}
: false
}
{this.state.visibleCreate && (
<CreateApprovalMatrix
onClickClose={() => this.setState({ visibleCreate: false })}
/>
)}
{this.state.visibleEdit && (
<EditApprovalMatrix
onClickClose={() => this.setState({ visibleEdit: false })}
/>
)}
{this.state.visibleVisual && (
<VisualisasiAM
onClickClose={() => this.setState({ visibleVisual: false })}
/>
)}
</div> </div>
); );
} }
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { TextField } from '@material-ui/core'; import { TextField, Typography } from '@material-ui/core';
import { DateTimePicker, KeyboardDatePicker, DatePicker} from "@material-ui/pickers";
import MenuItem from '@material-ui/core/MenuItem'; import MenuItem from '@material-ui/core/MenuItem';
import format from "date-fns/format";
import localeID from "date-fns/locale/id"
const type = [ const type = [
{ {
value: 'KPI', value: 'YEARLY',
label: 'KPI', label: 'YEARLY',
}, },
{ {
value: 'Gatau', value: 'MONTHLY',
label: 'Gatau', label: 'MONTHLY',
},
{
value: 'DAILY',
label: 'DAILY',
}, },
]; ];
const approve_by = [ const approve_by = [
...@@ -24,20 +31,56 @@ const approve_by = [ ...@@ -24,20 +31,56 @@ const approve_by = [
]; ];
const operator = [ const operator = [
{ {
value: '1', value: '-',
label: '-', label: '-',
}, },
{ {
value: '2', value: 'AND',
label: 'AND', label: 'AND',
}, },
{ {
value: '3', value: 'OR',
label: 'OR', label: 'OR',
}, },
]; ];
export default class EditApprovalMatrix extends Component { export default class EditApprovalMatrix extends Component {
constructor(props) {
super(props)
this.state = {
startDate: null,
endDate: null,
date: new Date()
}
}
render() { render() {
let { type } = this.props
return type === 'edit' ? this.renderEdit() : false
}
componentDidMount() {
console.log(this.props.data);
}
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')})
} else if (isDate && type == 'end_date') {
this.setState({...data, endDate : format(e, 'yyyy-MM-dd')})
} else {
this.setState({...data, [e.target.name] : e.target.value})
}
}
handleDate(item) {
let value = format(item, 'dd MMMM yyyy')
return value
}
renderEdit() {
return ( return (
<div className="test app-popup-show" style={{ paddingTop: 100 }}> <div className="test app-popup-show" style={{ paddingTop: 100 }}>
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}> <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
...@@ -61,26 +104,47 @@ export default class EditApprovalMatrix extends Component { ...@@ -61,26 +104,47 @@ export default class EditApprovalMatrix extends Component {
<div className="border-bottom" style={{ padding: 20 }}> <div className="border-bottom" style={{ padding: 20 }}>
<div className="grid grid-2x grid-mobile-none gap-15px"> <div className="grid grid-2x grid-mobile-none gap-15px">
<div className="column-1"> <div className="column-1">
<div className="margin-bottom-20px"> <div style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%', height: '90%' }} style={{ width: '100%' }}
id="id" id="id"
variant="filled"
label="ID" label="ID"
value="1" value={this.props.data.approval_matrix_id}
> disabled
</TextField> inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
/>
</div> </div>
</div> </div>
<div className="column-2"> <div className="column-2">
<div className="margin-bottom-20px" style={{ marginTop: 8 }}> <div className="" style={{ paddingTop: 4, paddingRight: 10, paddingBottom: 10, paddingLeft: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
id="type" id="type"
select select
label="Tipe Persetujuan" label="Tipe Persetujuan"
value="KPI" value={this.props.data.approval_type_name}
onChange={(e) => null} onChange={(e) => null}
selectProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
> >
{type.map((option) => ( {type.map((option) => (
<MenuItem key={option.value} value={option.value}> <MenuItem key={option.value} value={option.value}>
...@@ -93,26 +157,48 @@ export default class EditApprovalMatrix extends Component { ...@@ -93,26 +157,48 @@ export default class EditApprovalMatrix extends Component {
</div> </div>
<div className="grid grid-2x grid-mobile-none gap-15px"> <div className="grid grid-2x grid-mobile-none gap-15px">
<div className="column-1"> <div className="column-1">
<div className="margin-bottom-20px"> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
id="order" id="order"
variant="standard"
label="Order" label="Order"
value="1" value={this.props.data.orders}
onChange={(e) => this.handleChange(e, '')}
inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
> >
</TextField> </TextField>
</div> </div>
</div> </div>
<div className="column-2"> <div className="column-2">
<div className="margin-bottom-20px"> <div className="margin-top-10px" style={{ paddingTop: 4, paddingRight: 10, paddingBottom: 10, paddingLeft: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
id="approve-by" id="approve-by"
select select
label="Pemberi Persetujuan" label="Pemberi Persetujuan"
value="1" value={this.props.data.fullname}
onChange={(e) => null} onChange={(e) => null}
selectProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
> >
{approve_by.map((option) => ( {approve_by.map((option) => (
<MenuItem key={option.value} value={option.value}> <MenuItem key={option.value} value={option.value}>
...@@ -125,14 +211,25 @@ export default class EditApprovalMatrix extends Component { ...@@ -125,14 +211,25 @@ export default class EditApprovalMatrix extends Component {
</div> </div>
<div className="grid grid-2x grid-mobile-none gap-15px"> <div className="grid grid-2x grid-mobile-none gap-15px">
<div className="column-1"> <div className="column-1">
<div className="margin-bottom-20px"> <div className="margin-top-10px" style={{ paddingTop: 4, paddingRight: 10, paddingBottom: 10, paddingLeft: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
id="operator" id="operator"
select select
label="Operator" label="Operator"
value="1" value={this.props.data.operator_type_name}
onChange={(e) => null} onChange={(e) => null}
selectProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
> >
{operator.map((option) => ( {operator.map((option) => (
<MenuItem key={option.value} value={option.value}> <MenuItem key={option.value} value={option.value}>
...@@ -148,73 +245,107 @@ export default class EditApprovalMatrix extends Component { ...@@ -148,73 +245,107 @@ export default class EditApprovalMatrix extends Component {
</div> </div>
<div className="grid grid-2x grid-mobile-none gap-15px"> <div className="grid grid-2x grid-mobile-none gap-15px">
<div className="column-1"> <div className="column-1">
<div className="margin-bottom-20px"> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <DatePicker
style={{ width: '100%' }} margin="normal"
id="start-period" id="startDate"
label="Berlaku Mulai" label="Berlaku Mulai"
value="31 Desember 2020" format="dd MMMM yyyy"
> value={this.state.startDate}
{/* {periode.map((option) => ( onChange={(e) => this.handleChange(e, 'start_date')}
<MenuItem key={option.value} value={option.value}> KeyboardButtonProps={{
{option.label} 'aria-label': 'change date',
</MenuItem> }}
))} */} style={{padding: 0, margin: 0, width: '100%'}}
</TextField> InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
/>
</div> </div>
</div> </div>
<div className="column-2"> <div className="column-2">
<div className="margin-bottom-20px"> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <DatePicker
style={{ width: '100%' }} margin="normal"
id="end-period" id="endDate"
label="Berlaku Hingga" label="Berlaku Hingga"
value="31 Desember 2020" format="dd MMMM yyyy"
> value={this.state.endDate}
{/* {periode.map((option) => ( onChange={(e) => this.handleChange(e, 'end_date')}
<MenuItem key={option.value} value={option.value}> KeyboardButtonProps={{
{option.label} 'aria-label': 'change date',
</MenuItem> }}
))} */} style={{padding: 0, margin: 0, width: '100%'}}
</TextField> InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
/>
</div> </div>
</div> </div>
</div> </div>
<div className="grid grid-2x grid-mobile-none gap-15px"> <div className="grid grid-2x grid-mobile-none gap-15px">
<div className="column-1"> <div className="column-1">
<div className="margin-bottom-20px"> <div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
id="status" id="status"
variant="filled" label="Status"
label="Aktif" value={this.props.data.status}
value="Aktif" disabled
inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
> >
{/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
{option.label}
</MenuItem>
))} */}
</TextField> </TextField>
</div> </div>
</div> </div>
<div className="column-2"> <div className="column-2">
<div className="margin-bottom-20px" style={{ marginTop: 8 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
id="max-value" id="max-value"
label="Max Value" label="Max Value"
value="10" value="10"
onChange={(e) => this.handleChange(e, '')}
inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
> >
</TextField> </TextField>
</div> </div>
</div> </div>
</div> </div>
<div className=""> {/* <div className="">
<span style={{ fontSize: 11, fontWeight: 600 }}>Dibuat<span style={{ marginLeft: 20}}> : Admin - 21 Jul 2020, 18:45</span></span> <span style={{ fontSize: 11, fontWeight: 600 }}>Dibuat<span style={{ marginLeft: 20}}> : Admin - 21 Jul 2020, 18:45</span></span>
</div> </div>
<div className=""> <div className="">
<span style={{ fontSize: 11, fontWeight: 'bold' }}>Diubah<span style={{ marginLeft: 17}}> : Admin - 21 Jul 2020, 18:45</span></span> <span style={{ fontSize: 11, fontWeight: 'bold' }}>Diubah<span style={{ marginLeft: 17}}> : Admin - 21 Jul 2020, 18:45</span></span>
</div> */}
<div style={{flexDirection:'column', display: 'flex', padding: 10 }}>
<Typography style={{fontSize: 12}}>{`Dibuat : ${format(this.state.date, 'dd MMMM yyyy', {locale: localeID})}`}</Typography>
{/* <Typography style={{fontSize: 12}}>{`Diubah: ${this.state.tempData == null? '' : this.state.tempData.updated}`}</Typography> */}
</div> </div>
</div> </div>
<div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}> <div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
......
...@@ -192,7 +192,8 @@ export default function MiniDrawer() { ...@@ -192,7 +192,8 @@ export default function MiniDrawer() {
> >
<div className={classes.toolbarDrawer} style={{ <div className={classes.toolbarDrawer} style={{
backgroundColor: '#51c6ea', backgroundColor: '#51c6ea',
height: open ? 152 : 68 height: open ? null : 68,
paddingBottom: open ? 25 : null
}}> }}>
<div style={{ display: 'flex', justifyContent: 'space-between', flex: 1, padding: 10 }}> <div style={{ display: 'flex', justifyContent: 'space-between', flex: 1, padding: 10 }}>
<img src={Images.triputra} alt="React Logo" style={{ height: 31, width: 151, alignSelf: 'center' }} /> <img src={Images.triputra} alt="React Logo" style={{ height: 31, width: 151, alignSelf: 'center' }} />
...@@ -218,13 +219,13 @@ export default function MiniDrawer() { ...@@ -218,13 +219,13 @@ export default function MiniDrawer() {
</div> </div>
} }
{open && {open &&
<div style={{ marginLeft: 25, marginTop: 20, marginBottom: 20 }}> <div style={{ marginLeft: 20, marginTop: 20 }}>
<Typography style={{ color: 'white', fontSize: 12 }}>APLIKASI</Typography> <Typography style={{ color: 'white', fontSize: 12 }}>APLIKASI</Typography>
</div> </div>
} }
<List> <List>
{ArraySide.map((item, index) => ( {ArraySide.map((item, index) => (
<div> <div style={{ marginTop: index === 0 ? null : 10}}>
{item.subItem != null ? {item.subItem != null ?
<div style={{ justifyContent: 'space-between', flexDirection: 'row', display: 'flex', paddingRight: 10 }} onClick={() => selectedIndex == 0 ? setSelectedIndex(index) : setSelectedIndex(0)}> <div style={{ justifyContent: 'space-between', flexDirection: 'row', display: 'flex', paddingRight: 10 }} onClick={() => selectedIndex == 0 ? setSelectedIndex(index) : setSelectedIndex(0)}>
<ListItem button key={item.label}> <ListItem button key={item.label}>
......
...@@ -9,6 +9,7 @@ import CreateUnitBisnis from "./formUnitBisnis/CreateUnitBisnis"; ...@@ -9,6 +9,7 @@ import CreateUnitBisnis from "./formUnitBisnis/CreateUnitBisnis";
import { TextField, InputBase } from "@material-ui/core"; import { TextField, InputBase } from "@material-ui/core";
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import api from "../../api"; import api from "../../api";
import { isThisSecond } from "date-fns";
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable());
...@@ -90,18 +91,45 @@ export default class UnitBisnis extends Component { ...@@ -90,18 +91,45 @@ export default class UnitBisnis extends Component {
} }
} }
handleInputChange = (e) => { handleInputChange(e) {
// Immediately update the state this.setState({ search: e })
this.setState({ let body = {
search: e.target.value "keyword": e
}
api.create().searchUnitBisnis(body).then(response => {
// console.log(response.data);
if (response.data.status == 'success') {
let data = response.data.data
let listData = data.map((item, index) => {
return [index, item.business_unit_id, item.business_unit_name, item.status]
})
this.setState({ dataTable: listData, listData: response.data.data })
} else {
alert(response.data.message)
}
}) })
}
// Execute the debounced onChange method updateUnitBisnis = (payload) => {
this.onChangeDebounced(e) this.setState({ visibleEdit: false })
api.create().updateUnitBisnis(payload).then(response => {
if (response.data.status == 'success') {
this.getData()
} else {
alert(response.data.message)
}
})
} }
onChangeDebounced = (e) => { createUnitBisnis = (payload) => {
// Delayed logic goes here this.setState({ visibleCreate: false })
api.create().createUnitBisnis(payload).then(response => {
if (response.data.status == 'success') {
this.getData()
} else {
alert(response.data.message)
}
})
} }
render() { render() {
...@@ -175,18 +203,19 @@ export default class UnitBisnis extends Component { ...@@ -175,18 +203,19 @@ export default class UnitBisnis extends Component {
{this.state.visibleUnitBisnis === true ? {this.state.visibleUnitBisnis === 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' }}>Master Data - Unit Bisnis</label> <label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Master Data - Unit Bisnis</label>
<div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5 }}> <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
style={{ width: '100%' }} style={{ width: '100%' }}
placeholder="Search" placeholder="Search"
value={this.state.search} value={this.state.search}
onChange={(e) => this.handleInputChange(e)} onChange={(e) => this.handleInputChange(e.target.value)}
inputProps={{ 'aria-label': 'naked' }} inputProps={{ 'aria-label': 'naked' }}
/> />
{/* <input type="text" value={this.state.search} onChange={(e)=> this.setState({ search: e.target.value})} style={{ width: '100%'}} /> */}
</div> </div>
<div style={{ width: '20%', justifyContent: 'space-around', display: 'flex' }}> <div style={{ width: '30%', justifyContent: 'space-around', display: 'flex', flexFlow: 'wrap' }}>
<img src={Images.template} /> <img src={Images.template} />
<button <button
style={{ style={{
...@@ -244,7 +273,7 @@ export default class UnitBisnis extends Component { ...@@ -244,7 +273,7 @@ export default class UnitBisnis extends Component {
<button <button
type="button" type="button"
onClick={() => this.setState({ visibleUnitBisnis: true })} onClick={() => this.setState({ visibleUnitBisnis: true })}
style={{ marginRight: 20}} style={{ marginRight: 20 }}
> >
<div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#354960', fontSize: 11 }}>Batal</span> <span style={{ color: '#354960', fontSize: 11 }}>Batal</span>
...@@ -260,6 +289,8 @@ export default class UnitBisnis extends Component { ...@@ -260,6 +289,8 @@ export default class UnitBisnis extends Component {
{this.state.visibleCreate && ( {this.state.visibleCreate && (
<CreateUnitBisnis <CreateUnitBisnis
onClickClose={() => this.setState({ visibleCreate: false })} onClickClose={() => this.setState({ visibleCreate: false })}
type={"create"}
createUnitBisnis={this.createUnitBisnis.bind(this)}
/> />
)} )}
...@@ -268,6 +299,7 @@ export default class UnitBisnis extends Component { ...@@ -268,6 +299,7 @@ export default class UnitBisnis extends Component {
type={"edit"} type={"edit"}
onClickClose={() => this.setState({ visibleEdit: false })} onClickClose={() => this.setState({ visibleEdit: false })}
data={this.state.listData[this.state.selectIndex]} data={this.state.listData[this.state.selectIndex]}
updateUnitBisnis={this.updateUnitBisnis.bind(this)}
/> />
)} )}
{this.state.visibleUpload && ( {this.state.visibleUpload && (
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { TextField, Typography } from '@material-ui/core'; import { TextField, Typography } from '@material-ui/core';
import * as R from 'ramda'
import { DateTimePicker, KeyboardDatePicker, DatePicker } from "@material-ui/pickers";
import format from "date-fns/format";
export default class CreateUnitBisnis extends Component { export default class CreateUnitBisnis extends Component {
constructor(props) {
super(props)
this.state = {
id: '',
name: '',
startDate: '',
endDate: ''
}
}
render() { render() {
let { type } = this.props let { type } = this.props
return type === 'edit' ? this.renderEdit() : this.renderCreate() return type === 'edit' ? this.renderEdit() : this.renderCreate()
} }
componentDidMount() { componentDidMount() {
console.log(this.props.data); if (this.props.type === 'edit') {
let data = this.props.data
this.setState({
id: data.business_unit_id,
name: data.business_unit_name,
startDate: data.start_date,
endDate: data.end_date
})
}
}
handleChange(e, type) {
let data = this.state
let isDate = type !== '' ? true : false
if (isDate && type == 'start_date') {
this.setState({ startDate: format(e, 'yyyy-MM-dd') }, () => {
console.log(this.state.startDate)
})
} else if (isDate && type == 'end_date') {
this.setState({ endDate: format(e, 'yyyy-MM-dd') }, () => {
console.log(this.state.endDate)
})
} else {
// this.setState({...data, tempData: {...this.state.tempData, [e.target.name] : e.target.value}})
}
}
validasi() {
if (R.isEmpty(this.state.name)) return alert("Unit Bisnis Name is Required.");
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");
if (R.isEmpty(this.state.startDate)) return alert("Tanggal Mulai is Required.");
if (R.isEmpty(this.state.endDate)) return alert("Tanggal Berakhir is Required.");
console.log('masuk');
if (this.props.type == 'edit') {
let payload = {
"business_unit_id": this.state.id,
"business_unit_name": this.state.name,
"start_date": this.state.startDate,
"end_date": this.state.endDate
}
this.props.updateUnitBisnis(payload)
} else if (this.props.type == 'create') {
let payload = {
"business_unit_name": this.state.name,
"start_date": this.state.startDate,
"end_date": this.state.endDate
}
this.props.createUnitBisnis(payload)
}
} }
renderEdit() { renderEdit() {
...@@ -56,12 +119,16 @@ export default class CreateUnitBisnis extends Component { ...@@ -56,12 +119,16 @@ export default class CreateUnitBisnis extends Component {
/> />
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <DatePicker
style={{ width: '100%' }} margin="normal"
id="periode" id="startDate"
value={"1 Januari 2020"}
label="Berlaku Mulai" label="Berlaku Mulai"
onChange={(e) => null} format="dd MMMM yyyy"
value={this.state.startDate}
onChange={(e) => this.handleChange(e, 'start_date')}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{ inputProps={{
style: { style: {
fontSize: 11 fontSize: 11
...@@ -73,8 +140,9 @@ export default class CreateUnitBisnis extends Component { ...@@ -73,8 +140,9 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085' color: '#7e8085'
} }
}} }}
>
</TextField> style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div> </div>
<div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
...@@ -99,13 +167,13 @@ export default class CreateUnitBisnis extends Component { ...@@ -99,13 +167,13 @@ export default class CreateUnitBisnis extends Component {
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<div style={{display: 'flex'}}> <div style={{ display: 'flex' }}>
<Typography style={{ fontSize: 11, width: '20%' }}>Dibuat</Typography> <Typography style={{ fontSize: 11, width: '20%' }}>Dibuat</Typography>
<Typography style={{ fontSize: 11 }}>: {this.props.data.created}</Typography> <Typography style={{ fontSize: 11 }}>: {this.props.data.created}</Typography>
</div> </div>
<div style={{display: 'flex'}}> <div style={{ display: 'flex' }}>
<Typography style={{ fontSize: 11, width: '20%' }}>Diubah</Typography> <Typography style={{ fontSize: 11, width: '20%' }}>Diubah</Typography>
<Typography style={{ fontSize: 11 }}>: {this.props.data.updated ==- null ? "" : this.props.data.updated}</Typography> <Typography style={{ fontSize: 11 }}>: {this.props.data.updated == - null ? "" : this.props.data.updated}</Typography>
</div> </div>
</div> </div>
</div> </div>
...@@ -116,7 +184,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -116,7 +184,7 @@ export default class CreateUnitBisnis extends Component {
style={{ width: '100%' }} style={{ width: '100%' }}
id="unit" id="unit"
label="Unit Bisnis" label="Unit Bisnis"
value={this.props.data.business_unit_name} value={this.state.name}
inputProps={{ inputProps={{
style: { style: {
fontSize: 11 fontSize: 11
...@@ -128,15 +196,21 @@ export default class CreateUnitBisnis extends Component { ...@@ -128,15 +196,21 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085' color: '#7e8085'
} }
}} }}
onChange={(e) => this.setState({ name: e.target.value })}
> >
</TextField> </TextField>
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <DatePicker
style={{ width: '100%' }} margin="normal"
id="unit" id="startDate"
label="Berlaku Hingga" label="Berlaku Hingga"
defaultValue={"31 Desember 2100"} format="dd MMMM yyyy"
value={this.state.endDate}
onChange={(e) => this.handleChange(e, 'end_date')}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{ inputProps={{
style: { style: {
fontSize: 11 fontSize: 11
...@@ -148,8 +222,9 @@ export default class CreateUnitBisnis extends Component { ...@@ -148,8 +222,9 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085' color: '#7e8085'
} }
}} }}
>
</TextField> style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div> </div>
</div> </div>
...@@ -167,9 +242,14 @@ export default class CreateUnitBisnis extends Component { ...@@ -167,9 +242,14 @@ export default class CreateUnitBisnis extends Component {
</button> </button>
</div> </div>
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}> <div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <button
<span style={{ color: '#fff', fontSize: 11 }}>Simpan</span> type="button"
</div> 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> </div>
</div> </div>
...@@ -201,14 +281,37 @@ export default class CreateUnitBisnis extends Component { ...@@ -201,14 +281,37 @@ export default class CreateUnitBisnis extends Component {
<div className="border-bottom grid grid-2x grid-mobile-none gap-15px" style={{ padding: 20 }}> <div className="border-bottom grid grid-2x grid-mobile-none gap-15px" style={{ padding: 20 }}>
<div className="column-1"> <div className="column-1">
<div style={{ padding: 10, borderRadius: 5 }}> <div style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
id="periode" // value={this.props.data.business_unit_id}
value={"1 Januari 2020"} id="status"
label="ID"
disabled
inputProps={{
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
/>
</div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<DatePicker
margin="normal"
id="startDate"
label="Berlaku Mulai" label="Berlaku Mulai"
// value={this.state.periode} format="dd MMMM yyyy"
onChange={(e) => null} value={this.state.startDate == "" ? null : this.state.startDate}
onChange={(e) => this.handleChange(e, 'start_date')}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{ inputProps={{
style: { style: {
fontSize: 11 fontSize: 11
...@@ -220,8 +323,9 @@ export default class CreateUnitBisnis extends Component { ...@@ -220,8 +323,9 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085' color: '#7e8085'
} }
}} }}
>
</TextField> style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5, backgroundColor: '#e8e8e8', }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5, backgroundColor: '#e8e8e8', }}>
...@@ -257,7 +361,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -257,7 +361,7 @@ export default class CreateUnitBisnis extends Component {
style={{ width: '100%' }} style={{ width: '100%' }}
id="unit" id="unit"
label="Unit Bisnis" label="Unit Bisnis"
defaultValue={"Agrobisnis"} value={this.state.name}
inputProps={{ inputProps={{
style: { style: {
fontSize: 11 fontSize: 11
...@@ -269,15 +373,21 @@ export default class CreateUnitBisnis extends Component { ...@@ -269,15 +373,21 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085' color: '#7e8085'
} }
}} }}
onChange={(e) => this.setState({ name: e.target.value })}
> >
</TextField> </TextField>
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <DatePicker
style={{ width: '100%' }} margin="normal"
id="unit" id="endDate"
label="Berlaku Hingga" label="Berlaku Hingga"
defaultValue={"31 Desember 2100"} format="dd MMMM yyyy"
value={this.state.endDate == "" ? null : this.state.endDate}
onChange={(e) => this.handleChange(e, 'end_date')}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{ inputProps={{
style: { style: {
fontSize: 11 fontSize: 11
...@@ -289,8 +399,9 @@ export default class CreateUnitBisnis extends Component { ...@@ -289,8 +399,9 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085' color: '#7e8085'
} }
}} }}
>
</TextField> style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div> </div>
</div> </div>
...@@ -308,9 +419,14 @@ export default class CreateUnitBisnis extends Component { ...@@ -308,9 +419,14 @@ export default class CreateUnitBisnis extends Component {
</button> </button>
</div> </div>
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}> <div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <button
<span style={{ color: '#fff', fontSize: 11 }}>Simpan</span> type="button"
</div> 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> </div>
</div> </div>
......
...@@ -8,6 +8,7 @@ import AddRole from './UserRole/AddRole'; ...@@ -8,6 +8,7 @@ import AddRole from './UserRole/AddRole';
import EditRole from './UserRole/EditRole' import EditRole from './UserRole/EditRole'
import api from "../../api"; import api from "../../api";
import { titleCase } from "../../library/Utils"; import { titleCase } from "../../library/Utils";
import { InputAdornment, TextField } from "@material-ui/core";
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable());
...@@ -148,16 +149,42 @@ export default class UserRole extends Component { ...@@ -148,16 +149,42 @@ export default class UserRole extends Component {
<div style={{ height: 199, backgroundColor: '#354960', width: '100%' }} /> <div style={{ height: 199, backgroundColor: '#354960', width: '100%' }} />
<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', width: '20%', alignSelf: 'center'}}>Master Data - Role & Otorisasi</label> <label style={{ fontFamily: 'nunito', color: 'white', width: '20%', alignSelf: 'center', fontSize: 18}}>Master Data - User</label>
<div style={{width: '60%', justifyContent: 'center', display: 'flex', borderWidth: 2, alignItems: 'center' }}> <div style={{width: '60%', justifyContent: 'center', display: 'flex', borderWidth: 2, alignItems: 'center' }}>
<div style={{width: '50%', backgroundColor:'white', padding: 10, borderRadius: 7.5, flexDirection: 'row', display: 'flex'}}> <div style={{width: '50%', backgroundColor:'white', padding: 10, borderRadius: 7.5}}>
<SearchIcon/> <TextField
<input type="text" placeholder={'Search Role'} style={{flexGrow: 1, marginLeft: 10}}/> id="input-with-icon-textfield"
name="search"
value={this.state.search}
placeholder={'Search'}
onChange={(e) => {
this.setState({ search: e.target.value }, () => {
if (this.state.search.length > 0) {
this.searchRole()
} else {
this.getRole()
}
});
}}
onKeyDown={(e) => this._handleKeyDown(e)}
style={{width: '100%', borderBottomWidth: 0, borderBottomColor: 'red'}}
InputProps={{
style: { fontFamily: 'nunito', borderBottomColor: 'white'},
startAdornment: (
<InputAdornment position="start">
<SearchIcon />
</InputAdornment>
),
}}
/>
</div> </div>
</div> </div>
{/* <label style={{ color: 'white', width: '60%', justifyContent: 'center', display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center' }}>Search</label> */} {/* <label style={{ color: 'white', width: '60%', justifyContent: 'center', display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center' }}>Search</label> */}
<div style={{ width: '20%', justifyContent: 'flex-end', display: 'flex' }}> <div style={{ width: '20%', justifyContent: 'flex-end', display: 'flex' }}>
<img src={Images.add} onClick={() => this.setState({add: true})}/> <img src={Images.template}/>
<img src={Images.upload} style={{marginLeft: 20}}/>
<img src={Images.download} style={{marginLeft: 20}}/>
<img src={Images.add} onClick={() => this.setState({add: true})} style={{marginLeft: 20}}/>
</div> </div>
</div> </div>
<div style={{ padding: 25 }}> <div style={{ padding: 25 }}>
......
...@@ -184,19 +184,12 @@ class UserRole extends Component { ...@@ -184,19 +184,12 @@ class UserRole extends Component {
<label style={{ fontFamily: 'nunito', color: 'white', width: '20%', alignSelf: 'center', fontSize: 18}}>Master Data - Role & Otorisasi</label> <label style={{ fontFamily: 'nunito', color: 'white', width: '20%', alignSelf: 'center', fontSize: 18}}>Master Data - Role & Otorisasi</label>
<div style={{width: '60%', justifyContent: 'center', display: 'flex', borderWidth: 2, alignItems: 'center' }}> <div style={{width: '60%', justifyContent: 'center', display: 'flex', borderWidth: 2, alignItems: 'center' }}>
<div style={{width: '50%', backgroundColor:'white', padding: 10, borderRadius: 7.5}}> <div style={{width: '50%', backgroundColor:'white', padding: 10, borderRadius: 7.5}}>
{/* <SearchIcon/> */}
<TextField <TextField
// className={classes.margin}
id="input-with-icon-textfield" id="input-with-icon-textfield"
// label="TextField"
name="search" name="search"
value={this.state.search} value={this.state.search}
placeholder={'Search Role'} placeholder={'Search'}
onChange={(e) => { onChange={(e) => {
// let { search } = this.state;
// search = [...search];
// search.push(e.target.value);
// search[0] = search;
this.setState({ search: e.target.value }, () => { this.setState({ search: e.target.value }, () => {
if (this.state.search.length > 0) { if (this.state.search.length > 0) {
this.searchRole() this.searchRole()
......
...@@ -235,6 +235,7 @@ export default class AddRole extends Component { ...@@ -235,6 +235,7 @@ export default class AddRole extends Component {
format="dd MMMM yyyy" format="dd MMMM yyyy"
value={this.state.endDate} value={this.state.endDate}
onChange={(e) => this.handleChange(e, 'end_date')} onChange={(e) => this.handleChange(e, 'end_date')}
minDate={this.state.startDate}
KeyboardButtonProps={{ KeyboardButtonProps={{
'aria-label': 'change date', 'aria-label': 'change date',
}} }}
......
...@@ -3,21 +3,21 @@ import { TextField, Divider, Typography, Checkbox, withStyles, Collapse, MuiThem ...@@ -3,21 +3,21 @@ import { TextField, Divider, Typography, Checkbox, withStyles, Collapse, MuiThem
import api from '../../../api'; import api from '../../../api';
import AddIcon from '@material-ui/icons/Add'; import AddIcon from '@material-ui/icons/Add';
import RemoveIcon from '@material-ui/icons/Remove'; import RemoveIcon from '@material-ui/icons/Remove';
import { DateTimePicker, KeyboardDatePicker, DatePicker} from "@material-ui/pickers"; import { DateTimePicker, KeyboardDatePicker, DatePicker } from "@material-ui/pickers";
import format from "date-fns/format"; import format from "date-fns/format";
const CustomCheckbox = withStyles({ const CustomCheckbox = withStyles({
root: { root: {
color: '#51c6ea',
'&$checked': {
color: '#51c6ea', color: '#51c6ea',
}, '&$checked': {
padding: 5 color: '#51c6ea',
},
padding: 5
}, },
checked: {}, checked: {},
})((props) => <Checkbox color="default" {...props} />); })((props) => <Checkbox color="default" {...props} />);
export default class EditRole extends Component { export default class EditRole extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
...@@ -32,9 +32,9 @@ export default class EditRole extends Component { ...@@ -32,9 +32,9 @@ export default class EditRole extends Component {
} }
handleChecked() { handleChecked() {
this.setState({checked: !this.state.checked}) this.setState({ checked: !this.state.checked })
} }
componentDidMount() { componentDidMount() {
this.getDetailRole() this.getDetailRole()
this.getMenu() this.getMenu()
...@@ -42,25 +42,25 @@ export default class EditRole extends Component { ...@@ -42,25 +42,25 @@ export default class EditRole extends Component {
handleChange(e, type) { handleChange(e, type) {
let data = this.state let data = this.state
let isDate = type !== ''? true : false let isDate = type !== '' ? true : false
if (isDate && type == 'start_date') { if (isDate && type == 'start_date') {
this.setState({...data, tempData: {...this.state.tempData, start_date : format(e, 'yyyy-MM-dd')}}, () => { this.setState({ ...data, tempData: { ...this.state.tempData, start_date: format(e, 'yyyy-MM-dd') } }, () => {
console.log(this.state.tempData) console.log(this.state.tempData)
}) })
} else if (isDate && type == 'end_date') { } else if (isDate && type == 'end_date') {
this.setState({...data, tempData: {...this.state.tempData, end_date : format(e, 'yyyy-MM-dd')}}, () => { this.setState({ ...data, tempData: { ...this.state.tempData, end_date: format(e, 'yyyy-MM-dd') } }, () => {
console.log(this.state.tempData) console.log(this.state.tempData)
}) })
} else { } else {
this.setState({...data, tempData: {...this.state.tempData, [e.target.name] : e.target.value}}) this.setState({ ...data, tempData: { ...this.state.tempData, [e.target.name]: e.target.value } })
} }
} }
getDetailRole() { getDetailRole() {
api.create().getDetailRole(this.state.paramsId).then((response) => { api.create().getDetailRole(this.state.paramsId).then((response) => {
if (response.data.status == 'success') { if (response.data.status == 'success') {
this.setState({tempData: response.data.data, privileges: response.data.data.privileges}) this.setState({ tempData: response.data.data, privileges: response.data.data.privileges })
console.log(response.data.data.start_date) console.log(response.data.data.start_date)
} else { } else {
alert(response.data.message) alert(response.data.message)
...@@ -94,7 +94,7 @@ export default class EditRole extends Component { ...@@ -94,7 +94,7 @@ export default class EditRole extends Component {
getMenu() { getMenu() {
api.create().getMenu().then((response) => { api.create().getMenu().then((response) => {
if (response.data.status == 'success') { if (response.data.status == 'success') {
this.setState({menuData: response.data.data}) this.setState({ menuData: response.data.data })
} else { } else {
alert(response.data.message) alert(response.data.message)
} }
...@@ -103,7 +103,7 @@ export default class EditRole extends Component { ...@@ -103,7 +103,7 @@ export default class EditRole extends Component {
handleItemChecked(item) { handleItemChecked(item) {
let indexID = this.state.privileges.findIndex((val) => val.menu_id == item.menu_id) let indexID = this.state.privileges.findIndex((val) => val.menu_id == item.menu_id)
return indexID == -1? false : true return indexID == -1 ? false : true
} }
handleItemClick(item) { handleItemClick(item) {
...@@ -112,12 +112,12 @@ export default class EditRole extends Component { ...@@ -112,12 +112,12 @@ export default class EditRole extends Component {
if (indexID == -1) { if (indexID == -1) {
privileges.push({ privileges.push({
menu_id: item.menu_id, menu_id: item.menu_id,
button_id: [1,2,3] button_id: [1, 2, 3]
}) })
} else { } else {
privileges.splice(indexID,1) privileges.splice(indexID, 1)
} }
this.setState({privileges}) this.setState({ privileges })
} }
handleSubItemChecked(item, index) { handleSubItemChecked(item, index) {
...@@ -136,7 +136,7 @@ export default class EditRole extends Component { ...@@ -136,7 +136,7 @@ export default class EditRole extends Component {
value = true value = true
} }
} }
return indexID == -1? value : value return indexID == -1 ? value : value
} }
handleSubItemClick(item, index) { handleSubItemClick(item, index) {
...@@ -147,13 +147,13 @@ export default class EditRole extends Component { ...@@ -147,13 +147,13 @@ export default class EditRole extends Component {
if (indexButtonID == -1) { if (indexButtonID == -1) {
button_id.push(index) button_id.push(index)
} else { } else {
button_id.splice(indexButtonID,1) button_id.splice(indexButtonID, 1)
} }
privileges[indexID].button_id = button_id privileges[indexID].button_id = button_id
if (button_id.length == 0) { if (button_id.length == 0) {
privileges.splice(indexID,1) privileges.splice(indexID, 1)
} }
this.setState({privileges}) this.setState({ privileges })
} }
handleDate(item) { handleDate(item) {
...@@ -192,7 +192,7 @@ export default class EditRole extends Component { ...@@ -192,7 +192,7 @@ export default class EditRole extends Component {
disabled disabled
// id="outlined-read-only-input" // id="outlined-read-only-input"
variant="filled" variant="filled"
value={this.state.tempData == null? '' : this.state.tempData.role_id} value={this.state.tempData == null ? '' : this.state.tempData.role_id}
onChange={(e) => null} onChange={(e) => null}
> >
{/* {periode.map((option) => ( {/* {periode.map((option) => (
...@@ -207,12 +207,12 @@ export default class EditRole extends Component { ...@@ -207,12 +207,12 @@ export default class EditRole extends Component {
<div className="column-2"> <div className="column-2">
<div className="margin-bottom-20px"> <div className="margin-bottom-20px">
<TextField <TextField
style={{ width: '100%' , marginTop: 7}} style={{ width: '100%', marginTop: 7 }}
id="userRole" id="userRole"
name="role_name" name="role_name"
label="User Role" label="User Role"
value={this.state.tempData == null? '' : this.state.tempData.role_name} value={this.state.tempData == null ? '' : this.state.tempData.role_name}
onChange={(e) => this.handleChange(e, '')} onChange={(e) => this.handleChange(e, '')}
// defaultValue="Default Value" // defaultValue="Default Value"
// helperText="Some important text" // helperText="Some important text"
/> />
...@@ -224,17 +224,17 @@ export default class EditRole extends Component { ...@@ -224,17 +224,17 @@ export default class EditRole extends Component {
<div className="column-1"> <div className="column-1">
<div className="margin-bottom-20px"> <div className="margin-bottom-20px">
<DatePicker <DatePicker
margin="normal" margin="normal"
id="startDate" id="startDate"
label="Berlaku Mulai" label="Berlaku Mulai"
format="dd MMMM yyyy" format="dd MMMM yyyy"
value={this.state.tempData == null? null : this.state.tempData.start_date} value={this.state.tempData == null ? null : this.state.tempData.start_date}
onChange={(e) => this.handleChange(e, 'start_date')} onChange={(e) => this.handleChange(e, 'start_date')}
KeyboardButtonProps={{ KeyboardButtonProps={{
'aria-label': 'change date', 'aria-label': 'change date',
}} }}
style={{padding: 0, margin: 0, width: '100%'}} style={{ padding: 0, margin: 0, width: '100%' }}
/> />
</div> </div>
</div> </div>
...@@ -242,17 +242,18 @@ export default class EditRole extends Component { ...@@ -242,17 +242,18 @@ export default class EditRole extends Component {
<div className="column-2"> <div className="column-2">
<div className="margin-bottom-20px"> <div className="margin-bottom-20px">
<DatePicker <DatePicker
margin="normal" margin="normal"
id="endDate" id="endDate"
label="Berlaku Hingga" label="Berlaku Hingga"
format="dd MMMM yyyy" format="dd MMMM yyyy"
value={this.state.tempData == null? null : this.state.tempData.end_date} value={this.state.tempData == null ? null : this.state.tempData.end_date}
onChange={(e) => this.handleChange(e, 'end_date')} minDate={this.state.tempData == null ? null : this.state.tempData.start_date}
KeyboardButtonProps={{ onChange={(e) => this.handleChange(e, 'end_date')}
'aria-label': 'change date', KeyboardButtonProps={{
}} 'aria-label': 'change date',
}}
style={{padding: 0, margin: 0, width: '100%'}}
style={{ padding: 0, margin: 0, width: '100%' }}
/> />
</div> </div>
</div> </div>
...@@ -268,7 +269,7 @@ export default class EditRole extends Component { ...@@ -268,7 +269,7 @@ export default class EditRole extends Component {
disabled disabled
// id="outlined-read-only-input" // id="outlined-read-only-input"
variant="filled" variant="filled"
value={this.state.tempData == null? '' : this.state.tempData.status} value={this.state.tempData == null ? '' : this.state.tempData.status}
> >
{/* {periode.map((option) => ( {/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}> <MenuItem key={option.value} value={option.value}>
...@@ -279,53 +280,53 @@ export default class EditRole extends Component { ...@@ -279,53 +280,53 @@ export default class EditRole extends Component {
</div> </div>
</div> </div>
</div> </div>
<div style={{flexDirection:'column', display: 'flex', paddingLeft: 20, paddingRight: 20 }}> <div style={{ flexDirection: 'column', display: 'flex', paddingLeft: 20, paddingRight: 20 }}>
<Typography style={{fontSize: 12}}>{`Dibuat : ${this.state.tempData == null? '' : (this.state.tempData.created == null? '-' : this.state.tempData.created)}`}</Typography> <Typography style={{ fontSize: 12 }}>{`Dibuat : ${this.state.tempData == null ? '' : (this.state.tempData.created == null ? '-' : this.state.tempData.created)}`}</Typography>
<Typography style={{fontSize: 12}}>{`Diubah: ${this.state.tempData == null? '' : (this.state.tempData.updated == null? '-' : this.state.tempData.updated)}`}</Typography> <Typography style={{ fontSize: 12 }}>{`Diubah: ${this.state.tempData == null ? '' : (this.state.tempData.updated == null ? '-' : this.state.tempData.updated)}`}</Typography>
</div> </div>
<Divider style={{margin: 20}}/> <Divider style={{ margin: 20 }} />
<div style={{paddingLeft: 20, paddingRight: 20}}> <div style={{ paddingLeft: 20, paddingRight: 20 }}>
<h5>Hak Akses</h5> <h5>Hak Akses</h5>
<div className="grid grid-2x grid-mobile-none gap-15px padding-top-5px padding-bottom-5px padding-left-10px padding-right-10px " style={{backgroundColor: '#4b4b4b'}}> <div className="grid grid-2x grid-mobile-none gap-15px padding-top-5px padding-bottom-5px padding-left-10px padding-right-10px " style={{ backgroundColor: '#4b4b4b' }}>
<div className="column-1"> <div className="column-1">
<Typography style={{fontSize: 12, color: 'white'}}>Otorisasi Modul</Typography> <Typography style={{ fontSize: 12, color: 'white' }}>Otorisasi Modul</Typography>
</div> </div>
<div className="column-2 grid grid-3x content-center grid-mobile-none gap-15px"> <div className="column-2 grid grid-3x content-center grid-mobile-none gap-15px">
<div className="column-1"> <div className="column-1">
<Typography style={{fontSize: 12, color: 'white'}}>Lihat</Typography> <Typography style={{ fontSize: 12, color: 'white' }}>Lihat</Typography>
</div> </div>
<div className="column-2"> <div className="column-2">
<Typography style={{fontSize: 12, color: 'white'}}>Tambah</Typography> <Typography style={{ fontSize: 12, color: 'white' }}>Tambah</Typography>
</div> </div>
<div className="column 3"> <div className="column 3">
<Typography style={{fontSize: 12, color: 'white'}}>Ubah</Typography> <Typography style={{ fontSize: 12, color: 'white' }}>Ubah</Typography>
</div> </div>
</div> </div>
</div> </div>
<div style={{height: '25vh', overflow: 'scroll'}}> <div style={{ height: '25vh', overflow: 'scroll' }}>
{this.state.menuData !== null && this.state.menuData.map((item,index) => { {this.state.menuData !== null && this.state.menuData.map((item, index) => {
return ( return (
<div> <div>
<div className="grid grid-2x grid-mobile-none gap-15px padding-left-10px padding-right-10px"> <div className="grid grid-2x grid-mobile-none gap-15px padding-left-10px padding-right-10px">
<div className="column-1" style={{display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start'}}> <div className="column-1" style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start' }}>
{item.sub_menu.length > 0 && <span onClick={() => this.setState({selectedIndex: index == this.state.selectedIndex? 0 : index})} style={{marginLeft: 7, marginRight: 2}}> {item.sub_menu.length > 0 && <span onClick={() => this.setState({ selectedIndex: index == this.state.selectedIndex ? 0 : index })} style={{ marginLeft: 7, marginRight: 2 }}>
{index == this.state.selectedIndex? <RemoveIcon color={'action'} fontSize={'small'}/> : <AddIcon color={'action'} fontSize={'small'}/>} {index == this.state.selectedIndex ? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />}
</span>} </span>}
<span> <span>
<CustomCheckbox <CustomCheckbox
checked={this.handleItemChecked(item)} checked={this.handleItemChecked(item)}
onChange={() => this.handleItemClick(item)} onChange={() => this.handleItemClick(item)}
/> />
</span> </span>
<Typography style={{fontSize: 12, marginLeft: 5}}>{item.menu_name}</Typography> <Typography style={{ fontSize: 12, marginLeft: 5 }}>{item.menu_name}</Typography>
</div> </div>
<div className="column-2 grid grid-3x content-center grid-mobile-none gap-15px"> <div className="column-2 grid grid-3x content-center grid-mobile-none gap-15px">
<div className="column-1"> <div className="column-1">
<CustomCheckbox <CustomCheckbox
disabled={!this.handleItemChecked(item)} disabled={!this.handleItemChecked(item)}
checked={this.handleSubItemChecked(item, 1)} checked={this.handleSubItemChecked(item, 1)}
onChange={() => this.handleSubItemClick(item,1)} onChange={() => this.handleSubItemClick(item, 1)}
/> />
</div> </div>
<div className="column-2"> <div className="column-2">
...@@ -333,7 +334,7 @@ export default class EditRole extends Component { ...@@ -333,7 +334,7 @@ export default class EditRole extends Component {
// disabled // disabled
disabled={!this.handleItemChecked(item)} disabled={!this.handleItemChecked(item)}
checked={this.handleSubItemChecked(item, 2)} checked={this.handleSubItemChecked(item, 2)}
onChange={() => this.handleSubItemClick(item,2)} onChange={() => this.handleSubItemClick(item, 2)}
/> />
</div> </div>
<div className="column 3"> <div className="column 3">
...@@ -341,42 +342,42 @@ export default class EditRole extends Component { ...@@ -341,42 +342,42 @@ export default class EditRole extends Component {
// disabled // disabled
disabled={!this.handleItemChecked(item)} disabled={!this.handleItemChecked(item)}
checked={this.handleSubItemChecked(item, 3)} checked={this.handleSubItemChecked(item, 3)}
onChange={() => this.handleSubItemClick(item,3)} onChange={() => this.handleSubItemClick(item, 3)}
/> />
</div> </div>
</div> </div>
</div> </div>
{item.sub_menu.length > 0 && item.sub_menu.map((items,indexs) => { {item.sub_menu.length > 0 && item.sub_menu.map((items, indexs) => {
return( return (
<Collapse in={index == this.state.selectedIndex} timeout="auto" unmountOnExit> <Collapse in={index == this.state.selectedIndex} timeout="auto" unmountOnExit>
<div className="grid grid-2x grid-mobile-none gap-15px padding-left-10px padding-right-10px"> <div className="grid grid-2x grid-mobile-none gap-15px padding-left-10px padding-right-10px">
<div className="column-1" style={{display: 'flex', flexDirection: 'row', alignItems: 'center', paddingLeft: 50}}> <div className="column-1" style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', paddingLeft: 50 }}>
<CustomCheckbox <CustomCheckbox
checked={this.handleItemChecked(items)} checked={this.handleItemChecked(items)}
onChange={() => this.handleItemClick(items)} onChange={() => this.handleItemClick(items)}
/> />
<Typography style={{fontSize: 12, maxWidth: '100%', marginLeft: 5}}>{items.menu_name}</Typography> <Typography style={{ fontSize: 12, maxWidth: '100%', marginLeft: 5 }}>{items.menu_name}</Typography>
</div> </div>
<div className="column-2 grid grid-3x content-center grid-mobile-none gap-15px"> <div className="column-2 grid grid-3x content-center grid-mobile-none gap-15px">
<div className="column-1"> <div className="column-1">
<CustomCheckbox <CustomCheckbox
disabled={!this.handleItemChecked(items)} disabled={!this.handleItemChecked(items)}
checked={this.handleSubItemChecked(items, 1)} checked={this.handleSubItemChecked(items, 1)}
onChange={() => this.handleSubItemClick(items,1)} onChange={() => this.handleSubItemClick(items, 1)}
/> />
</div> </div>
<div className="column-2"> <div className="column-2">
<CustomCheckbox <CustomCheckbox
disabled={!this.handleItemChecked(items)} disabled={!this.handleItemChecked(items)}
checked={this.handleSubItemChecked(items, 2)} checked={this.handleSubItemChecked(items, 2)}
onChange={() => this.handleSubItemClick(items,2)} onChange={() => this.handleSubItemClick(items, 2)}
/> />
</div> </div>
<div className="column 3"> <div className="column 3">
<CustomCheckbox <CustomCheckbox
disabled={!this.handleItemChecked(items)} disabled={!this.handleItemChecked(items)}
checked={this.handleSubItemChecked(items, 3)} checked={this.handleSubItemChecked(items, 3)}
onChange={() => this.handleSubItemClick(items,3)} onChange={() => this.handleSubItemClick(items, 3)}
/> />
</div> </div>
</div> </div>
...@@ -388,18 +389,28 @@ export default class EditRole extends Component { ...@@ -388,18 +389,28 @@ export default class EditRole extends Component {
) )
})} })}
</div> </div>
</div> </div>
<div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}> <div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1" style={{ alignSelf: 'center' }}> <div className="column-1" style={{ alignSelf: 'center' }}>
<div onClick={() => this.props.onClickClose()} style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <button
<span style={{ color: '#354960', fontSize: 11 }}>Batal</span> type="button"
</div> onClick={() => this.props.onClickClose()}
>
<div onClick={() => this.props.onClickClose()} style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
<span style={{ color: '#354960', fontSize: 11 }}>Batal</span>
</div>
</button>
</div> </div>
<div className="column-2" style={{display: 'flex', justifyContent: 'flex-end', alignItems: 'center'}}> <div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<div onClick={() => this.updateRole()}style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <button
<span style={{ color: '#fff', fontSize: 11 }}>Simpan</span> type="button"
</div> onClick={() => this.updateRole()}
>
<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> </div>
</div> </div>
......
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