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

unit

parent 82cecfd4
...@@ -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,9 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/') ...@@ -79,6 +79,9 @@ 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)
// ------ // ------
// STEP 3 // STEP 3
...@@ -105,7 +108,10 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/') ...@@ -105,7 +108,10 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
editRole, editRole,
deleteRole, deleteRole,
getMenu, getMenu,
getUnitBisnis getUnitBisnis,
createUnitBisnis,
updateUnitBisnis,
searchUnitBisnis
} }
} }
......
...@@ -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: 2000;
-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);
...@@ -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 && (
......
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