Commit b8835dc3 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

update didam

See merge request !91
parents 79b51095 37b42b82
{ {
"name": "my-app", "name": "my-app",
"version": "0.1.0", "version": "0.1.0",
"homepage": "http://localhost:8080/tia-web/", "homepage": "http://localhost:8080/tia-web-dev/",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@date-io/date-fns": "^1.3.13", "@date-io/date-fns": "^1.3.13",
......
...@@ -72,7 +72,7 @@ export default class ApprovalMatrix extends Component { ...@@ -72,7 +72,7 @@ export default class ApprovalMatrix extends Component {
} }
else if (response.data.status == 'success') { else if (response.data.status == 'success') {
let data = response.data.data let data = response.data.data
let listData = data.map((item, index) => { let listData = data.sort((a,b) => a.approval_matrix_id - b.approval_matrix_id).map((item, index) => {
return [index, item.approval_matrix_id, item.approval_type_name, item.orders, item.fullname, item.operator_type_name, item.status ] 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 }) this.setState({ dataTable: listData, listData: response.data.data })
......
...@@ -136,9 +136,11 @@ export default class VisualisasiAM extends Component { ...@@ -136,9 +136,11 @@ export default class VisualisasiAM extends Component {
onDragEnd(fromIndex, toIndex) { onDragEnd(fromIndex, toIndex) {
const data = [...that.state.listApproval]; const data = [...that.state.listApproval];
const item = data.splice(fromIndex, 1)[0]; const item = data.splice(fromIndex, 1)[0];
that.handleChangeOrder(fromIndex, toIndex, that) if (fromIndex !== -1 && toIndex !== -1) {
data.splice(toIndex, 0, item); that.handleChangeOrder(fromIndex, toIndex, that)
that.setState({ listApproval: data }); data.splice(toIndex, 0, item);
that.setState({ listApproval: data });
}
}, },
nodeSelector: 'li', nodeSelector: 'li',
handleSelector: 'a' handleSelector: 'a'
......
...@@ -3,7 +3,6 @@ import clsx from 'clsx'; ...@@ -3,7 +3,6 @@ import clsx from 'clsx';
import { makeStyles, useTheme } from '@material-ui/core/styles'; import { makeStyles, useTheme } from '@material-ui/core/styles';
import Drawer from '@material-ui/core/Drawer'; import Drawer from '@material-ui/core/Drawer';
import AppBar from '@material-ui/core/AppBar'; import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import List from '@material-ui/core/List'; import List from '@material-ui/core/List';
import CssBaseline from '@material-ui/core/CssBaseline'; import CssBaseline from '@material-ui/core/CssBaseline';
import Typography from '@material-ui/core/Typography'; import Typography from '@material-ui/core/Typography';
...@@ -13,15 +12,11 @@ import MenuIcon from '@material-ui/icons/Menu'; ...@@ -13,15 +12,11 @@ import MenuIcon from '@material-ui/icons/Menu';
import ExpandMore from '@material-ui/icons/ExpandMore' import ExpandMore from '@material-ui/icons/ExpandMore'
import ExpandLess from '@material-ui/icons/ExpandLess' import ExpandLess from '@material-ui/icons/ExpandLess'
import ChevronLeftIcon from '@material-ui/icons/ChevronLeft'; import ChevronLeftIcon from '@material-ui/icons/ChevronLeft';
import ChevronRightIcon from '@material-ui/icons/ChevronRight';
import ListItem from '@material-ui/core/ListItem'; import ListItem from '@material-ui/core/ListItem';
import ListItemIcon from '@material-ui/core/ListItemIcon'; import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText';
import InboxIcon from '@material-ui/icons/MoveToInbox';
import MailIcon from '@material-ui/icons/Mail';
import Collapse from '@material-ui/core/Collapse'; import Collapse from '@material-ui/core/Collapse';
import DateFnsUtils from '@date-io/date-fns'; import DateFnsUtils from '@date-io/date-fns';
import { DateTimePicker, MuiPickersUtilsProvider } from "@material-ui/pickers"; import { MuiPickersUtilsProvider } from "@material-ui/pickers";
import localeID from 'date-fns/locale/id'; import localeID from 'date-fns/locale/id';
import { import {
...@@ -131,19 +126,19 @@ export default function MiniDrawer() { ...@@ -131,19 +126,19 @@ export default function MiniDrawer() {
const [selectedSubIndex, setSelectSub] = React.useState([]); const [selectedSubIndex, setSelectSub] = React.useState([]);
const [userFullname, setUserFullname] = React.useState("") const [userFullname, setUserFullname] = React.useState("")
const [userEmail, setUserEmail] = React.useState("") const [userEmail, setUserEmail] = React.useState("")
React.useEffect(() => { React.useEffect(() => {
if (userFullname == "" && userEmail == "") { if(userFullname == "" && userEmail == "") {
getUserData() getUserData()
} }
}) })
const getUserData = () => { const getUserData = () => {
let userId = localStorage.getItem(Constant.USER) let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => { api.create().getDetailUser(userId).then((response) => {
if (response.data.status == 'success') { if (response.data.status == 'success') {
setUserFullname(response.data.data.fullname == null ? 'Anonym' : response.data.data.fullname) setUserFullname(response.data.data.fullname == null? 'Anonym' : response.data.data.fullname)
setUserEmail(response.data.data.email == null ? 'Anonym@123.xyz' : response.data.data.email) setUserEmail(response.data.data.email == null? 'Anonym@123.xyz' : response.data.data.email)
console.log(userEmail) console.log(userEmail)
} }
}) })
...@@ -172,11 +167,6 @@ export default function MiniDrawer() { ...@@ -172,11 +167,6 @@ export default function MiniDrawer() {
setSelectedIndex(e) setSelectedIndex(e)
} }
const logout = () => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}
let { path, url } = useRouteMatch(); let { path, url } = useRouteMatch();
const { height, width } = UseWindowDimensions(); const { height, width } = UseWindowDimensions();
...@@ -206,23 +196,24 @@ export default function MiniDrawer() { ...@@ -206,23 +196,24 @@ export default function MiniDrawer() {
> >
<div className={classes.toolbarDrawer} style={{ <div className={classes.toolbarDrawer} style={{
backgroundColor: '#1a2d3e', backgroundColor: '#1a2d3e',
height: open ? 203 : 78, height: open ? null : 78,
paddingLeft: open ? null : 55, paddingLeft: open ? null : 55,
display: open ? null : 'grid', display: open ? null : 'grid',
alignSelf: open ? null : 'center' paddingBottom: open ? 55 : null,
alignSelf: open? null : 'center'
}}> }}>
{open === true ? {open === true ?
<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' }} />
<IconButton onClick={handleDrawerClose} style={{ outline: 'none' }}> <IconButton onClick={handleDrawerClose} style={{outline: 'none'}}>
<ChevronLeftIcon style={{ fill: 'white' }} /> <ChevronLeftIcon style={{ fill: 'white' }} />
</IconButton> </IconButton>
</div> : </div> :
<IconButton <IconButton
color="inherit" color="inherit"
aria-label="open drawer" aria-label="open drawer"
style={{ outline: 'none' }} style={{outline: 'none'}}
onClick={handleDrawerOpen} onClick={handleDrawerOpen}
edge="start" edge="start"
className={clsx(classes.menuButton, { className={clsx(classes.menuButton, {
...@@ -232,15 +223,15 @@ export default function MiniDrawer() { ...@@ -232,15 +223,15 @@ export default function MiniDrawer() {
<MenuIcon style={{ fill: 'white' }} /> <MenuIcon style={{ fill: 'white' }} />
</IconButton>} </IconButton>}
{open && {open &&
<div style={{ width: '100%', marginTop: 15, marginBottom: 60 }}> <div style={{ width: '100%' }}>
<Typography style={{ fontSize: 14, color: '#fff', textAlign: 'center', fontWeight: 'bold' }}>{userFullname}</Typography> <Typography style={{ fontSize: 12, color: '#fff', textAlign: 'center', fontWeight: 'bold' }}>John Doe</Typography>
<Typography style={{ fontSize: 14, color: '#fff', textAlign: 'center', marginTop: 10 }}>{userEmail}</Typography> <Typography style={{ fontSize: 12, color: '#fff', textAlign: 'center', marginTop: 10 }}>john@tia.com</Typography>
</div> </div>
} }
</div> </div>
<Divider /> <Divider />
{open && {open &&
<div style={{ width: '100%', textAlign: '-webkit-center', marginTop: -45 }}> <div style={{ width: '100%', textAlign: '-webkit-center', marginTop: -40 }}>
<div className={"sub-color"} style={{ width: 90, height: 90, borderRadius: 50, display: 'flex', justifyContent: 'center' }}> <div className={"sub-color"} style={{ width: 90, height: 90, borderRadius: 50, display: 'flex', justifyContent: 'center' }}>
<div style={{ width: 72, height: 72, backgroundColor: '#838383', borderRadius: 50, alignSelf: 'center' }}> <div style={{ width: 72, height: 72, backgroundColor: '#838383', borderRadius: 50, alignSelf: 'center' }}>
</div> </div>
...@@ -289,7 +280,7 @@ export default function MiniDrawer() { ...@@ -289,7 +280,7 @@ export default function MiniDrawer() {
{item.subItem.map((sub, indexs) => { {item.subItem.map((sub, indexs) => {
return ( return (
<Link to={`${url}/${sub.path}`}> <Link to={`${url}/${sub.path}`}>
<div style={{ paddingLeft: 5, }} className={selectedSubIndex === sub.label ? "active" : ""} onClick={() => sub.label === "Logout" ? logout() : selectSub(sub.label)}> <div style={{ paddingLeft: 5, }} className={selectedSubIndex === sub.label ? "active" : ""} onClick={() => selectSub(sub.label)}>
<ListItem button style={{ paddingLeft: 61 }}> <ListItem button style={{ paddingLeft: 61 }}>
<Typography style={{ fontFamily: 'nunito', color: '#525355', fontSize: 14 }}>{sub.label}</Typography> <Typography style={{ fontFamily: 'nunito', color: '#525355', fontSize: 14 }}>{sub.label}</Typography>
</ListItem> </ListItem>
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Typography, CircularProgress, MuiThemeProvider, createMuiTheme } from '@material-ui/core'; import { Typography, MuiThemeProvider, createMuiTheme } from '@material-ui/core';
import MUIDataTable from "mui-datatables"; import MUIDataTable from "mui-datatables";
import Images from '../assets/Images'; import Images from '../assets/Images';
import DonutChart from 'react-d3-donut'; import DonutChart from 'react-d3-donut';
......
import React, { Component } from "react"; import React, { Component } from "react";
import { Container, Row, Col } from "react-bootstrap"; import { createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import { makeStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import SearchIcon from '@material-ui/icons/Search'; import SearchIcon from '@material-ui/icons/Search';
import Images from "../../assets/Images"; import Images from "../../assets/Images";
import MUIDataTable from "mui-datatables"; import MUIDataTable from "mui-datatables";
...@@ -18,74 +17,6 @@ var ct = require("../../library/CustomTable"); ...@@ -18,74 +17,6 @@ var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable());
const options = ct.customOptions(); const options = ct.customOptions();
const tesss = [{
name: "Data Ke-",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
{tableMeta.rowIndex + 1}
</div >
);
}
}
}, {
name: "Nama Lengkap",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex', width: 50 }}>
{titleCase(val)}
</div >
);
}
}
}, {
name: "Email",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex', width: 200 }}>
{val}
</div >
);
}
}
}, {
name: "Role",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex', width: 150 }}>
{titleCase(val)}
</div >
);
}
}
}, {
name: "Berlaku Mulai",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex', width: 100 }}>
{titleCase(val)}
</div >
);
}
}
}, {
name: "Berakhir Hingga",
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
{val}
</div >
);
}
}
}]
export default class UserRole extends Component { export default class UserRole extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
...@@ -94,7 +25,8 @@ export default class UserRole extends Component { ...@@ -94,7 +25,8 @@ export default class UserRole extends Component {
indexData: {}, indexData: {},
add: false, add: false,
edit: false, edit: false,
visibleUser: true visibleUser: true,
buttonError: false,
} }
} }
...@@ -112,22 +44,15 @@ export default class UserRole extends Component { ...@@ -112,22 +44,15 @@ export default class UserRole extends Component {
getUser() { getUser() {
api.create().getUser().then((response) => { api.create().getUser().then((response) => {
// console.log(response) if (response.data.status === 'success') {
if (response.data.status == 'success') {
// console.log(response.data.data)
let data = response.data.data let data = response.data.data
let listData = data.map((item, index) => { let listData = data.sort((a,b) => a.user_id - b.user_id).map((item, index) => {
return [index, item.user_id, item.fullname, item.email, item.role_name, item.company, item.status] return [index, item.user_id, item.fullname === null? '-' : item.fullname, item.email, item.role_name, '-', item.status]
}) })
// console.log(listData)
this.setState({ listUser: listData }) this.setState({ listUser: listData })
// this.setState({listUser: response.data.data}, () => {
// console.log(this.state.listUser)
// })
} else { } else {
alert(response.data.message) alert(response.data.message)
} }
// console.log(response.data.data)
}) })
} }
...@@ -136,10 +61,10 @@ export default class UserRole extends Component { ...@@ -136,10 +61,10 @@ export default class UserRole extends Component {
"keyword": this.state.search "keyword": this.state.search
} }
api.create().searchUser(payload).then((response) => { api.create().searchUser(payload).then((response) => {
if (response.data.status == 'success') { if (response.data.status === 'success') {
let data = response.data.data let data = response.data.data
let listData = data.map((item, index) => { let listData = data.sort((a,b) => a.user_id - b.user_id).map((item, index) => {
return [index, item.user_id, item.fullname, item.email, item.role_name, item.company, item.status] return [index, item.user_id, item.fullname == null? '-' : item.fullname, item.email, item.role_name, '-', item.status]
}) })
this.setState({ listUser: listData }) this.setState({ listUser: listData })
} else { } else {
...@@ -155,18 +80,21 @@ export default class UserRole extends Component { ...@@ -155,18 +80,21 @@ export default class UserRole extends Component {
console.log(err); console.log(err);
} }
else { else {
let judul = resp.rows[0] // let judul = resp.rows[0]
let isi = resp.rows.slice(3) let isi = resp.rows.slice(3)
let payload = [] let payload = []
console.log(isi)
isi.map((item, index) => { isi.map((item, index) => {
payload.push({ if (item.length > 0) {
id: item.id, payload.push({
fullname: item[0], id: index + 1,
email: item[1], fullname: item[0],
role: item[2], email: item[1],
start_date: item[3], role: item[2],
end_date: item[4], start_date: item[3],
}) end_date: item[4],
})
}
}) })
let body = { let body = {
user: payload user: payload
...@@ -383,7 +311,7 @@ export default class UserRole extends Component { ...@@ -383,7 +311,7 @@ export default class UserRole extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ display: 'flex', width: 50 }}> <div style={{ display: 'flex'}}>
{val} {val}
</div > </div >
); );
...@@ -394,7 +322,7 @@ export default class UserRole extends Component { ...@@ -394,7 +322,7 @@ export default class UserRole extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ display: 'flex', width: 200 }}> <div style={{ display: 'flex'}}>
{titleCase(val)} {titleCase(val)}
</div > </div >
); );
...@@ -405,7 +333,7 @@ export default class UserRole extends Component { ...@@ -405,7 +333,7 @@ export default class UserRole extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ display: 'flex', width: 150 }}> <div style={{ display: 'flex'}}>
{titleCase(val)} {titleCase(val)}
</div > </div >
); );
...@@ -416,7 +344,7 @@ export default class UserRole extends Component { ...@@ -416,7 +344,7 @@ export default class UserRole extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ display: 'flex', width: 100 }}> <div style={{ display: 'flex'}}>
{titleCase(val)} {titleCase(val)}
</div > </div >
); );
...@@ -437,7 +365,7 @@ export default class UserRole extends Component { ...@@ -437,7 +365,7 @@ export default class UserRole extends Component {
return ( return (
<div style={{ height: this.props.height }}> <div style={{ height: this.props.height }}>
{/* <Row> */} {/* <Row> */}
<div style={{ height: 199, backgroundColor: '#354960', width: '100%' }} /> <div className={"main-color"} style={{ height: 199, width: '100%' }} />
{this.state.visibleUser ? <div> {this.state.visibleUser ? <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={{ fontFamily: 'nunito', color: 'white', width: '20%', alignSelf: 'center', fontSize: 18 }}>Master Data - User</label> <label style={{ fontFamily: 'nunito', color: 'white', width: '20%', alignSelf: 'center', fontSize: 18 }}>Master Data - User</label>
...@@ -565,7 +493,7 @@ export default class UserRole extends Component { ...@@ -565,7 +493,7 @@ export default class UserRole extends Component {
</button> </button>
<button <button
type="button" type="button"
onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : null} onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : this.uploadUser()}
style={{}} style={{}}
> >
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}> <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
......
...@@ -5,7 +5,6 @@ import Autocomplete from '@material-ui/lab/Autocomplete'; ...@@ -5,7 +5,6 @@ import Autocomplete from '@material-ui/lab/Autocomplete';
import { titleCase } from '../../../library/Utils'; import { titleCase } from '../../../library/Utils';
import localeID from "date-fns/locale/id" import localeID from "date-fns/locale/id"
import format from "date-fns/format"; import format from "date-fns/format";
import * as R from 'ramda'
import RemoveIcon from '@material-ui/icons/Remove'; import RemoveIcon from '@material-ui/icons/Remove';
import AddIcon from '@material-ui/icons/Add'; import AddIcon from '@material-ui/icons/Add';
import { DatePicker } from '@material-ui/pickers'; import { DatePicker } from '@material-ui/pickers';
...@@ -64,7 +63,7 @@ export default class AddUser extends Component { ...@@ -64,7 +63,7 @@ export default class AddUser 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, startDate: format(e, 'yyyy-MM-dd'), endDate: null, this.setState({ ...data, startDate: format(e, 'yyyy-MM-dd'), endDate: null,
errorRoleName: false, errorRoleName: false,
errorStartDate: false, errorStartDate: false,
...@@ -73,7 +72,7 @@ export default class AddUser extends Component { ...@@ -73,7 +72,7 @@ export default class AddUser extends Component {
msgErrorSD: '', msgErrorSD: '',
msgErrorED: '', msgErrorED: '',
}) })
} else if (isDate && type == 'end_date') { } else if (isDate && type === 'end_date') {
this.setState({ ...data, endDate: format(e, 'yyyy-MM-dd') , this.setState({ ...data, endDate: format(e, 'yyyy-MM-dd') ,
errorRoleName: false, errorRoleName: false,
errorStartDate: false, errorStartDate: false,
...@@ -110,7 +109,7 @@ export default class AddUser extends Component { ...@@ -110,7 +109,7 @@ export default class AddUser extends Component {
} }
api.create().createUser(payload).then((response) => { api.create().createUser(payload).then((response) => {
console.log(response) console.log(response)
if (String(response.data.status).toLocaleUpperCase == 'success') { if (String(response.data.status).toLocaleUpperCase === 'success') {
this.props.onClickClose() this.props.onClickClose()
this.props.refresh() this.props.refresh()
} else { } else {
...@@ -121,7 +120,7 @@ export default class AddUser extends Component { ...@@ -121,7 +120,7 @@ export default class AddUser extends Component {
getRole() { getRole() {
api.create().getRole().then((response) => { api.create().getRole().then((response) => {
if(response.data.status == 'success') { if(response.data.status === 'success') {
let data = response.data.data let data = response.data.data
let roleData = data.map((item) => { let roleData = data.map((item) => {
return { return {
...@@ -142,7 +141,7 @@ export default class AddUser extends Component { ...@@ -142,7 +141,7 @@ export default class AddUser extends Component {
getPerusahaan() { getPerusahaan() {
api.create().getPerusahaanHierarki().then((response) => { api.create().getPerusahaanHierarki().then((response) => {
if(response.data.status == 'success') { if(response.data.status === 'success') {
this.setState({listCompany: response.data.data}) this.setState({listCompany: response.data.data})
console.log(response.data.data) console.log(response.data.data)
} }
...@@ -150,14 +149,14 @@ export default class AddUser extends Component { ...@@ -150,14 +149,14 @@ export default class AddUser extends Component {
} }
handleItemChecked(item) { handleItemChecked(item) {
let indexID = this.state.company.findIndex((val) => val == item.company_id) let indexID = this.state.company.findIndex((val) => val === item.company_id)
return indexID == -1 ? false : true return indexID === -1 ? false : true
} }
handleItemClick(item) { handleItemClick(item) {
let indexID = this.state.company.findIndex((val) => val == item.company_id) let indexID = this.state.company.findIndex((val) => val === item.company_id)
let company = this.state.company let company = this.state.company
if (indexID == -1) { if (indexID === -1) {
company.push(item.company_id) company.push(item.company_id)
} else { } else {
company.splice(indexID, 1) company.splice(indexID, 1)
...@@ -341,7 +340,7 @@ export default class AddUser extends Component { ...@@ -341,7 +340,7 @@ export default class AddUser extends Component {
</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 : ${format(this.state.date, 'dd MMMM yyyy', {locale: localeID})}`}</Typography> <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> */} {/* <Typography style={{fontSize: 12}}>{`Diubah: ${this.state.tempData === 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}}>
...@@ -351,8 +350,8 @@ export default class AddUser extends Component { ...@@ -351,8 +350,8 @@ export default class AddUser extends Component {
return( return(
<div> <div>
<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start' }}> <div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start' }}>
{item.childCompany.length > 0 && <span onClick={() => this.setState({ selectedIndex: index == this.state.selectedIndex ? 0 : index })} style={{ marginLeft: 7, marginRight: 2 }}> {item.childCompany.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
...@@ -364,10 +363,10 @@ export default class AddUser extends Component { ...@@ -364,10 +363,10 @@ export default class AddUser extends Component {
</div> </div>
{item.childCompany.length > 0 && item.childCompany.map((items,indexs) => { {item.childCompany.length > 0 && item.childCompany.map((items,indexs) => {
return ( return (
<Collapse in={index == this.state.selectedIndex} timeout="auto" unmountOnExit> <Collapse in={index === this.state.selectedIndex} timeout="auto" unmountOnExit>
<div style={{ paddingLeft: 60, display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start' }}> <div style={{ paddingLeft: 60, 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>} */}
{/* <RemoveIcon color={'action'} fontSize={'small'} /> */} {/* <RemoveIcon color={'action'} fontSize={'small'} /> */}
<span> <span>
......
This diff is collapsed.
import React, { Component, memo } from "react"; import React, { Component, memo } from "react";
import { Container, Row, Col } from "react-bootstrap"; import { createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import { makeStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import SearchIcon from '@material-ui/icons/Search'; import SearchIcon from '@material-ui/icons/Search';
import Images from "../../assets/Images"; import Images from "../../assets/Images";
import MUIDataTable from "mui-datatables"; import MUIDataTable from "mui-datatables";
...@@ -10,7 +9,6 @@ import api from "../../api"; ...@@ -10,7 +9,6 @@ import api from "../../api";
import { titleCase } from "../../library/Utils"; import { titleCase } from "../../library/Utils";
import InputAdornment from '@material-ui/core/InputAdornment'; import InputAdornment from '@material-ui/core/InputAdornment';
import TextField from '@material-ui/core/TextField'; import TextField from '@material-ui/core/TextField';
import AccountCircle from '@material-ui/icons/AccountCircle';
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();
...@@ -42,9 +40,9 @@ class UserRole extends Component { ...@@ -42,9 +40,9 @@ class UserRole extends Component {
getRole() { getRole() {
api.create().getRole().then((response) => { api.create().getRole().then((response) => {
// console.log(response) // console.log(response)
if (response.data.status == 'success') { if (response.data.status === 'success') {
let data = response.data.data let data = response.data.data
let listData = data.map((item,index) => { let listData = data.sort((a,b) => a.role_id - b.role_id).map((item,index) => {
return [index, item.role_id, item.role_name, item.access, item.status] return [index, item.role_id, item.role_name, item.access, item.status]
}) })
// console.log(listData) // console.log(listData)
...@@ -65,9 +63,9 @@ class UserRole extends Component { ...@@ -65,9 +63,9 @@ class UserRole extends Component {
"keyword": this.state.search "keyword": this.state.search
} }
api.create().searchRole(payload).then((response) => { api.create().searchRole(payload).then((response) => {
if (response.data.status == 'success') { if (response.data.status === 'success') {
let data = response.data.data let data = response.data.data
let listData = data.map((item,index) => { let listData = data.sort((a,b) => a.role_id - b.role_id).map((item,index) => {
return [index, item.role_id, item.role_name, item.access, item.status] return [index, item.role_id, item.role_name, item.access, item.status]
}) })
this.setState({listRole: listData}) this.setState({listRole: listData})
...@@ -168,13 +166,6 @@ class UserRole extends Component { ...@@ -168,13 +166,6 @@ class UserRole extends Component {
} }
} }
}] }]
const data = [
["1", "1", "Laporan Bulanan - September 2020", "1 (20 Oktober 2020)", "Belum Disetujui"],
["2", "2", "Laporan Bulanan - September 2020", "1 (20 Oktober 2020)", "Belum Disetujui"],
["3", "3", "Budget Tahunan 2021", "0 (20 Oktober 2020)", "Belum Disetujui"],
["4", "4", "Laporan Bulanan - September 2020", "0 (20 Oktober 2020)", "Belum Disetujui"],
["5", "5", "Budget Tahunan 2021", "0 (20 Oktober 2020)", "Belum Disetujui"],
]
return ( return (
<div style={{ height: this.props.height }}> <div style={{ height: this.props.height }}>
{/* <Row> */} {/* <Row> */}
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { TextField, Divider, Typography, Checkbox, withStyles, Collapse, MuiThemeProvider } from '@material-ui/core'; import { TextField, Divider, Typography, Checkbox, withStyles, Collapse } from '@material-ui/core';
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 {DatePicker} from "@material-ui/pickers";
import format from "date-fns/format"; import format from "date-fns/format";
import localeID from "date-fns/locale/id" import localeID from "date-fns/locale/id"
import * as R from 'ramda' import * as R from 'ramda'
...@@ -54,7 +54,7 @@ export default class AddRole extends Component { ...@@ -54,7 +54,7 @@ export default class AddRole 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, startDate: format(e, 'yyyy-MM-dd'), endDate: null, this.setState({...data, startDate: format(e, 'yyyy-MM-dd'), endDate: null,
errorRoleName: false, errorRoleName: false,
errorStartDate: false, errorStartDate: false,
...@@ -63,7 +63,7 @@ export default class AddRole extends Component { ...@@ -63,7 +63,7 @@ export default class AddRole extends Component {
msgErrorSD: '', msgErrorSD: '',
msgErrorED: '', msgErrorED: '',
}) })
} else if (isDate && type == 'end_date') { } else if (isDate && type === 'end_date') {
this.setState({...data, endDate : format(e, 'yyyy-MM-dd'), this.setState({...data, endDate : format(e, 'yyyy-MM-dd'),
errorRoleName: false, errorRoleName: false,
errorStartDate: false, errorStartDate: false,
...@@ -111,7 +111,7 @@ export default class AddRole extends Component { ...@@ -111,7 +111,7 @@ export default class AddRole extends Component {
// console.log(payload) // console.log(payload)
api.create().addRole(payload).then((response) => { api.create().addRole(payload).then((response) => {
console.log(response) console.log(response)
if (response.data.status == 'success') { if (response.data.status === 'success') {
this.props.refresh() this.props.refresh()
this.props.onClickClose() this.props.onClickClose()
} else { } else {
...@@ -122,7 +122,7 @@ export default class AddRole extends Component { ...@@ -122,7 +122,7 @@ export default class AddRole 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)
...@@ -131,14 +131,14 @@ export default class AddRole extends Component { ...@@ -131,14 +131,14 @@ export default class AddRole 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) {
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)
let privileges = this.state.privileges let privileges = this.state.privileges
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]
...@@ -150,36 +150,33 @@ export default class AddRole extends Component { ...@@ -150,36 +150,33 @@ export default class AddRole extends Component {
} }
handleSubItemChecked(item, index) { handleSubItemChecked(item, index) {
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)
let value = false let value = false
if (indexID == -1) { if (indexID === -1) {
value = false value = false
} else { } else {
let arrayButton = this.state.privileges[indexID].button_id let indexButtonID = this.state.privileges[indexID].button_id.findIndex((val) => val === index)
// console.log(arrayButton) if (indexButtonID === -1) {
let indexButtonID = this.state.privileges[indexID].button_id.findIndex((val) => val == index)
// console.log(indexButtonID)
if (indexButtonID == -1) {
value = false value = false
} else { } else {
value = true value = true
} }
} }
return indexID == -1? value : value return indexID === -1? value : value
} }
handleSubItemClick(item, index) { handleSubItemClick(item, index) {
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)
let indexButtonID = this.state.privileges[indexID].button_id.findIndex((val) => val == index) let indexButtonID = this.state.privileges[indexID].button_id.findIndex((val) => val === index)
let privileges = this.state.privileges let privileges = this.state.privileges
let button_id = privileges[indexID].button_id let button_id = privileges[indexID].button_id
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})
...@@ -317,7 +314,7 @@ export default class AddRole extends Component { ...@@ -317,7 +314,7 @@ export default class AddRole extends Component {
</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 : ${format(this.state.date, 'dd MMMM yyyy', {locale: localeID})}`}</Typography> <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> */} {/* <Typography style={{fontSize: 12}}>{`Diubah: ${this.state.tempData === 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}}>
...@@ -345,8 +342,8 @@ export default class AddRole extends Component { ...@@ -345,8 +342,8 @@ export default class AddRole extends Component {
<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
...@@ -384,7 +381,7 @@ export default class AddRole extends Component { ...@@ -384,7 +381,7 @@ export default class AddRole extends Component {
</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
......
import screen404 from '../container/Screen404' import screen404 from '../container/Screen404'
import Beranda from '../container/Beranda'
import UserRole from '../container/Otorisasi/UserRole' import UserRole from '../container/Otorisasi/UserRole'
import User from '../container/Otorisasi/User' import User from '../container/Otorisasi/User'
import ApprovalMatrix from '../container/ApprovalMatrix/ApprovalMatrix' import ApprovalMatrix from '../container/ApprovalMatrix/ApprovalMatrix'
import BudgetTahunan from '../container/BudgetTahunan';
import HomePage from '../container/HomePage'; import HomePage from '../container/HomePage';
import BalanceSheet from '../container/BudgetTahunan/BalanceSheet'; import BalanceSheet from '../container/BudgetTahunan/BalanceSheet';
import Profile from '../container/Profile'; import Profile from '../container/Profile';
......
...@@ -26,7 +26,7 @@ import Constant from "../library/Constant"; ...@@ -26,7 +26,7 @@ import Constant from "../library/Constant";
export default function BasicExample() { export default function BasicExample() {
return ( return (
<Router basename={"/tia-web"}> <Router basename={"/tia-web-dev"}>
<Switch> <Switch>
<Route exact path="/"> <Route exact path="/">
<Redirect <Redirect
......
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