Commit 8acd0ed5 authored by Deni Rinaldi's avatar Deni Rinaldi

unit

parent 82cecfd4
......@@ -19,6 +19,7 @@
"moment": "^2.27.0",
"mui-datatables": "^3.3.1",
"node-sass": "^4.14.1",
"ramda": "^0.27.1",
"react": "^16.13.1",
"react-bootstrap": "^1.3.0",
"react-d3-donut": "^1.1.2",
......
......@@ -79,6 +79,9 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
//UNIT BISNIS
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)
// ------
// STEP 3
......@@ -105,7 +108,10 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
editRole,
deleteRole,
getMenu,
getUnitBisnis
getUnitBisnis,
createUnitBisnis,
updateUnitBisnis,
searchUnitBisnis
}
}
......
......@@ -103,6 +103,7 @@
background-color: #fff; }
.app-popup-show {
display: flex;
z-index: 2000;
-webkit-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);
......@@ -192,7 +192,8 @@ export default function MiniDrawer() {
>
<div className={classes.toolbarDrawer} style={{
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 }}>
<img src={Images.triputra} alt="React Logo" style={{ height: 31, width: 151, alignSelf: 'center' }} />
......@@ -218,13 +219,13 @@ export default function MiniDrawer() {
</div>
}
{open &&
<div style={{ marginLeft: 25, marginTop: 20, marginBottom: 20 }}>
<div style={{ marginLeft: 20, marginTop: 20 }}>
<Typography style={{ color: 'white', fontSize: 12 }}>APLIKASI</Typography>
</div>
}
<List>
{ArraySide.map((item, index) => (
<div>
<div style={{ marginTop: index === 0 ? null : 10}}>
{item.subItem != null ?
<div style={{ justifyContent: 'space-between', flexDirection: 'row', display: 'flex', paddingRight: 10 }} onClick={() => selectedIndex == 0 ? setSelectedIndex(index) : setSelectedIndex(0)}>
<ListItem button key={item.label}>
......
......@@ -9,6 +9,7 @@ import CreateUnitBisnis from "./formUnitBisnis/CreateUnitBisnis";
import { TextField, InputBase } from "@material-ui/core";
import { ExcelRenderer } from 'react-excel-renderer';
import api from "../../api";
import { isThisSecond } from "date-fns";
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
......@@ -90,18 +91,45 @@ export default class UnitBisnis extends Component {
}
}
handleInputChange = (e) => {
// Immediately update the state
this.setState({
search: e.target.value
handleInputChange(e) {
this.setState({ search: e })
let body = {
"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
this.onChangeDebounced(e)
updateUnitBisnis = (payload) => {
this.setState({ visibleEdit: false })
api.create().updateUnitBisnis(payload).then(response => {
if (response.data.status == 'success') {
this.getData()
} else {
alert(response.data.message)
}
})
}
onChangeDebounced = (e) => {
// Delayed logic goes here
createUnitBisnis = (payload) => {
this.setState({ visibleCreate: false })
api.create().createUnitBisnis(payload).then(response => {
if (response.data.status == 'success') {
this.getData()
} else {
alert(response.data.message)
}
})
}
render() {
......@@ -175,18 +203,19 @@ export default class UnitBisnis extends Component {
{this.state.visibleUnitBisnis === true ?
<div>
<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>
<div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5 }}>
<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, alignSelf: 'center' }}>
<img src={Images.searchBlack} style={{ marginRight: 10 }} />
<InputBase
style={{ width: '100%' }}
placeholder="Search"
value={this.state.search}
onChange={(e) => this.handleInputChange(e)}
onChange={(e) => this.handleInputChange(e.target.value)}
inputProps={{ 'aria-label': 'naked' }}
/>
{/* <input type="text" value={this.state.search} onChange={(e)=> this.setState({ search: e.target.value})} style={{ width: '100%'}} /> */}
</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} />
<button
style={{
......@@ -244,7 +273,7 @@ export default class UnitBisnis extends Component {
<button
type="button"
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' }}>
<span style={{ color: '#354960', fontSize: 11 }}>Batal</span>
......@@ -260,6 +289,8 @@ export default class UnitBisnis extends Component {
{this.state.visibleCreate && (
<CreateUnitBisnis
onClickClose={() => this.setState({ visibleCreate: false })}
type={"create"}
createUnitBisnis={this.createUnitBisnis.bind(this)}
/>
)}
......@@ -268,6 +299,7 @@ export default class UnitBisnis extends Component {
type={"edit"}
onClickClose={() => this.setState({ visibleEdit: false })}
data={this.state.listData[this.state.selectIndex]}
updateUnitBisnis={this.updateUnitBisnis.bind(this)}
/>
)}
{this.state.visibleUpload && (
......
import React, { Component } from 'react';
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 {
constructor(props) {
super(props)
this.state = {
id: '',
name: '',
startDate: '',
endDate: ''
}
}
render() {
let { type } = this.props
return type === 'edit' ? this.renderEdit() : this.renderCreate()
}
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() {
......@@ -56,12 +119,16 @@ export default class CreateUnitBisnis extends Component {
/>
</div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
id="periode"
value={"1 Januari 2020"}
<DatePicker
margin="normal"
id="startDate"
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={{
style: {
fontSize: 11
......@@ -73,8 +140,9 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085'
}
}}
>
</TextField>
style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div>
<div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
......@@ -99,13 +167,13 @@ export default class CreateUnitBisnis extends Component {
</div>
<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 }}>: {this.props.data.created}</Typography>
</div>
<div style={{display: 'flex'}}>
<div style={{ display: 'flex' }}>
<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>
......@@ -116,7 +184,7 @@ export default class CreateUnitBisnis extends Component {
style={{ width: '100%' }}
id="unit"
label="Unit Bisnis"
value={this.props.data.business_unit_name}
value={this.state.name}
inputProps={{
style: {
fontSize: 11
......@@ -128,15 +196,21 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085'
}
}}
onChange={(e) => this.setState({ name: e.target.value })}
>
</TextField>
</div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
id="unit"
<DatePicker
margin="normal"
id="startDate"
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={{
style: {
fontSize: 11
......@@ -148,8 +222,9 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085'
}
}}
>
</TextField>
style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div>
</div>
......@@ -167,9 +242,14 @@ export default class CreateUnitBisnis extends Component {
</button>
</div>
<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' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Simpan</span>
</div>
<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>
......@@ -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="column-1">
<div style={{ padding: 10, borderRadius: 5 }}>
<div style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
id="periode"
value={"1 Januari 2020"}
// value={this.props.data.business_unit_id}
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"
// value={this.state.periode}
onChange={(e) => null}
format="dd MMMM yyyy"
value={this.state.startDate == "" ? null : this.state.startDate}
onChange={(e) => this.handleChange(e, 'start_date')}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
inputProps={{
style: {
fontSize: 11
......@@ -220,8 +323,9 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085'
}
}}
>
</TextField>
style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5, backgroundColor: '#e8e8e8', }}>
......@@ -257,7 +361,7 @@ export default class CreateUnitBisnis extends Component {
style={{ width: '100%' }}
id="unit"
label="Unit Bisnis"
defaultValue={"Agrobisnis"}
value={this.state.name}
inputProps={{
style: {
fontSize: 11
......@@ -269,15 +373,21 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085'
}
}}
onChange={(e) => this.setState({ name: e.target.value })}
>
</TextField>
</div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
id="unit"
<DatePicker
margin="normal"
id="endDate"
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={{
style: {
fontSize: 11
......@@ -289,8 +399,9 @@ export default class CreateUnitBisnis extends Component {
color: '#7e8085'
}
}}
>
</TextField>
style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div>
</div>
......@@ -308,9 +419,14 @@ export default class CreateUnitBisnis extends Component {
</button>
</div>
<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' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Simpan</span>
</div>
<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>
......
......@@ -3,21 +3,21 @@ import { TextField, Divider, Typography, Checkbox, withStyles, Collapse, MuiThem
import api from '../../../api';
import AddIcon from '@material-ui/icons/Add';
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";
const CustomCheckbox = withStyles({
root: {
color: '#51c6ea',
'&$checked': {
color: '#51c6ea',
},
padding: 5
'&$checked': {
color: '#51c6ea',
},
padding: 5
},
checked: {},
})((props) => <Checkbox color="default" {...props} />);
})((props) => <Checkbox color="default" {...props} />);
export default class EditRole extends Component {
constructor(props) {
super(props)
this.state = {
......@@ -32,9 +32,9 @@ export default class EditRole extends Component {
}
handleChecked() {
this.setState({checked: !this.state.checked})
this.setState({ checked: !this.state.checked })
}
componentDidMount() {
this.getDetailRole()
this.getMenu()
......@@ -42,25 +42,25 @@ export default class EditRole extends Component {
handleChange(e, type) {
let data = this.state
let isDate = type !== ''? true : false
let isDate = type !== '' ? true : false
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)
})
} 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)
})
} 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() {
api.create().getDetailRole(this.state.paramsId).then((response) => {
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)
} else {
alert(response.data.message)
......@@ -94,7 +94,7 @@ export default class EditRole extends Component {
getMenu() {
api.create().getMenu().then((response) => {
if (response.data.status == 'success') {
this.setState({menuData: response.data.data})
this.setState({ menuData: response.data.data })
} else {
alert(response.data.message)
}
......@@ -103,7 +103,7 @@ export default class EditRole extends Component {
handleItemChecked(item) {
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) {
......@@ -112,12 +112,12 @@ export default class EditRole extends Component {
if (indexID == -1) {
privileges.push({
menu_id: item.menu_id,
button_id: [1,2,3]
button_id: [1, 2, 3]
})
} else {
privileges.splice(indexID,1)
privileges.splice(indexID, 1)
}
this.setState({privileges})
this.setState({ privileges })
}
handleSubItemChecked(item, index) {
......@@ -136,7 +136,7 @@ export default class EditRole extends Component {
value = true
}
}
return indexID == -1? value : value
return indexID == -1 ? value : value
}
handleSubItemClick(item, index) {
......@@ -147,13 +147,13 @@ export default class EditRole extends Component {
if (indexButtonID == -1) {
button_id.push(index)
} else {
button_id.splice(indexButtonID,1)
button_id.splice(indexButtonID, 1)
}
privileges[indexID].button_id = button_id
if (button_id.length == 0) {
privileges.splice(indexID,1)
privileges.splice(indexID, 1)
}
this.setState({privileges})
this.setState({ privileges })
}
handleDate(item) {
......@@ -192,7 +192,7 @@ export default class EditRole extends Component {
disabled
// id="outlined-read-only-input"
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}
>
{/* {periode.map((option) => (
......@@ -207,12 +207,12 @@ export default class EditRole extends Component {
<div className="column-2">
<div className="margin-bottom-20px">
<TextField
style={{ width: '100%' , marginTop: 7}}
id="userRole"
name="role_name"
label="User Role"
value={this.state.tempData == null? '' : this.state.tempData.role_name}
onChange={(e) => this.handleChange(e, '')}
style={{ width: '100%', marginTop: 7 }}
id="userRole"
name="role_name"
label="User Role"
value={this.state.tempData == null ? '' : this.state.tempData.role_name}
onChange={(e) => this.handleChange(e, '')}
// defaultValue="Default Value"
// helperText="Some important text"
/>
......@@ -224,17 +224,17 @@ export default class EditRole extends Component {
<div className="column-1">
<div className="margin-bottom-20px">
<DatePicker
margin="normal"
id="startDate"
label="Berlaku Mulai"
format="dd MMMM yyyy"
value={this.state.tempData == null? null : this.state.tempData.start_date}
onChange={(e) => this.handleChange(e, 'start_date')}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
style={{padding: 0, margin: 0, width: '100%'}}
margin="normal"
id="startDate"
label="Berlaku Mulai"
format="dd MMMM yyyy"
value={this.state.tempData == null ? null : this.state.tempData.start_date}
onChange={(e) => this.handleChange(e, 'start_date')}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div>
</div>
......@@ -242,17 +242,17 @@ export default class EditRole extends Component {
<div className="column-2">
<div className="margin-bottom-20px">
<DatePicker
margin="normal"
id="endDate"
label="Berlaku Hingga"
format="dd MMMM yyyy"
value={this.state.tempData == null? null : this.state.tempData.end_date}
onChange={(e) => this.handleChange(e, 'end_date')}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
style={{padding: 0, margin: 0, width: '100%'}}
margin="normal"
id="endDate"
label="Berlaku Hingga"
format="dd MMMM yyyy"
value={this.state.tempData == null ? null : this.state.tempData.end_date}
onChange={(e) => this.handleChange(e, 'end_date')}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div>
</div>
......@@ -268,7 +268,7 @@ export default class EditRole extends Component {
disabled
// id="outlined-read-only-input"
variant="filled"
value={this.state.tempData == null? '' : this.state.tempData.status}
value={this.state.tempData == null ? '' : this.state.tempData.status}
>
{/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
......@@ -279,53 +279,53 @@ export default class EditRole extends Component {
</div>
</div>
</div>
<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}}>{`Diubah: ${this.state.tempData == null? '' : (this.state.tempData.updated == null? '-' : this.state.tempData.updated)}`}</Typography>
<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 }}>{`Diubah: ${this.state.tempData == null ? '' : (this.state.tempData.updated == null ? '-' : this.state.tempData.updated)}`}</Typography>
</div>
<Divider style={{margin: 20}}/>
<div style={{paddingLeft: 20, paddingRight: 20}}>
<Divider style={{ margin: 20 }} />
<div style={{ paddingLeft: 20, paddingRight: 20 }}>
<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">
<Typography style={{fontSize: 12, color: 'white'}}>Otorisasi Modul</Typography>
<Typography style={{ fontSize: 12, color: 'white' }}>Otorisasi Modul</Typography>
</div>
<div className="column-2 grid grid-3x content-center grid-mobile-none gap-15px">
<div className="column-1">
<Typography style={{fontSize: 12, color: 'white'}}>Lihat</Typography>
<Typography style={{ fontSize: 12, color: 'white' }}>Lihat</Typography>
</div>
<div className="column-2">
<Typography style={{fontSize: 12, color: 'white'}}>Tambah</Typography>
<Typography style={{ fontSize: 12, color: 'white' }}>Tambah</Typography>
</div>
<div className="column 3">
<Typography style={{fontSize: 12, color: 'white'}}>Ubah</Typography>
<Typography style={{ fontSize: 12, color: 'white' }}>Ubah</Typography>
</div>
</div>
</div>
<div style={{height: '25vh', overflow: 'scroll'}}>
{this.state.menuData !== null && this.state.menuData.map((item,index) => {
<div style={{ height: '25vh', overflow: 'scroll' }}>
{this.state.menuData !== null && this.state.menuData.map((item, index) => {
return (
<div>
<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'}}>
{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'}/>}
<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 }}>
{index == this.state.selectedIndex ? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />}
</span>}
<span>
<CustomCheckbox
checked={this.handleItemChecked(item)}
onChange={() => this.handleItemClick(item)}
/>
<CustomCheckbox
checked={this.handleItemChecked(item)}
onChange={() => this.handleItemClick(item)}
/>
</span>
<Typography style={{fontSize: 12, marginLeft: 5}}>{item.menu_name}</Typography>
<Typography style={{ fontSize: 12, marginLeft: 5 }}>{item.menu_name}</Typography>
</div>
<div className="column-2 grid grid-3x content-center grid-mobile-none gap-15px">
<div className="column-1">
<CustomCheckbox
disabled={!this.handleItemChecked(item)}
checked={this.handleSubItemChecked(item, 1)}
onChange={() => this.handleSubItemClick(item,1)}
onChange={() => this.handleSubItemClick(item, 1)}
/>
</div>
<div className="column-2">
......@@ -333,7 +333,7 @@ export default class EditRole extends Component {
// disabled
disabled={!this.handleItemChecked(item)}
checked={this.handleSubItemChecked(item, 2)}
onChange={() => this.handleSubItemClick(item,2)}
onChange={() => this.handleSubItemClick(item, 2)}
/>
</div>
<div className="column 3">
......@@ -341,42 +341,42 @@ export default class EditRole extends Component {
// disabled
disabled={!this.handleItemChecked(item)}
checked={this.handleSubItemChecked(item, 3)}
onChange={() => this.handleSubItemClick(item,3)}
onChange={() => this.handleSubItemClick(item, 3)}
/>
</div>
</div>
</div>
{item.sub_menu.length > 0 && item.sub_menu.map((items,indexs) => {
return(
{item.sub_menu.length > 0 && item.sub_menu.map((items, indexs) => {
return (
<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="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
checked={this.handleItemChecked(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 className="column-2 grid grid-3x content-center grid-mobile-none gap-15px">
<div className="column-1">
<CustomCheckbox
disabled={!this.handleItemChecked(items)}
checked={this.handleSubItemChecked(items, 1)}
onChange={() => this.handleSubItemClick(items,1)}
onChange={() => this.handleSubItemClick(items, 1)}
/>
</div>
<div className="column-2">
<CustomCheckbox
disabled={!this.handleItemChecked(items)}
checked={this.handleSubItemChecked(items, 2)}
onChange={() => this.handleSubItemClick(items,2)}
onChange={() => this.handleSubItemClick(items, 2)}
/>
</div>
<div className="column 3">
<CustomCheckbox
disabled={!this.handleItemChecked(items)}
checked={this.handleSubItemChecked(items, 3)}
onChange={() => this.handleSubItemClick(items,3)}
onChange={() => this.handleSubItemClick(items, 3)}
/>
</div>
</div>
......@@ -388,18 +388,28 @@ export default class EditRole extends Component {
)
})}
</div>
</div>
<div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
<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' }}>
<span style={{ color: '#354960', fontSize: 11 }}>Batal</span>
</div>
<button
type="button"
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 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' }}>
<span style={{ color: '#fff', fontSize: 11 }}>Simpan</span>
</div>
<div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
<button
type="button"
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>
......
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