Commit 29906780 authored by Deni Rinaldi's avatar Deni Rinaldi

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

parents 952dcca9 b0c28986
{
"name": "my-app",
"version": "0.1.0",
"homepage": "http://localhost:8080/tia-web/",
"homepage": "http://localhost:8080/tia-web-dev/",
"private": true,
"dependencies": {
"@date-io/date-fns": "^1.3.13",
......
......@@ -72,7 +72,7 @@ export default class ApprovalMatrix extends Component {
}
else if (response.data.status == 'success') {
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 ]
})
this.setState({ dataTable: listData, listData: response.data.data })
......@@ -275,7 +275,7 @@ export default class ApprovalMatrix extends Component {
<div>
{this.state.visibleAM === true ?
<div style={{ height: this.props.height }}>
<div style={{ height: 199, width: '100%', backgroundColor: '#354960' }} />
<div class="main-color" style={{ height: 199, width: '100%'}} />
<div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}>
<label style={{ width: '20%', color: 'white', fontSize: 16, alignSelf: 'center', paddingTop: 8 }}>Master Data - Approval Matrix</label>
......@@ -376,7 +376,7 @@ export default class ApprovalMatrix extends Component {
/>
:
<div style={{ height: this.props.height }}>
<div style={{ height: 199, width: '100%', backgroundColor: '#354960' }} />
<div class="main-color" style={{ height: 199, width: '100%' }} />
<div>
<div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}>
......
......@@ -6,6 +6,7 @@ import MenuItem from '@material-ui/core/MenuItem';
import ReactDragListView from 'react-drag-listview';
import Autocomplete from '@material-ui/lab/Autocomplete';
import api from "../../api";
import { none } from 'ramda';
const type = [
......@@ -135,9 +136,11 @@ export default class VisualisasiAM extends Component {
onDragEnd(fromIndex, toIndex) {
const data = [...that.state.listApproval];
const item = data.splice(fromIndex, 1)[0];
if (fromIndex !== -1 && toIndex !== -1) {
that.handleChangeOrder(fromIndex, toIndex, that)
data.splice(toIndex, 0, item);
that.setState({ listApproval: data });
}
},
nodeSelector: 'li',
handleSelector: 'a'
......@@ -145,10 +148,15 @@ export default class VisualisasiAM extends Component {
return (
<div>
<div style={{ height: this.props.height }}>
<div style={{ height: 199, width: '100%', backgroundColor: '#354960' }} />
<div class="main-color" style={{ height: 199, width: '100%' }} />
<div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}>
<label style={{ color: 'white', width: '20%', fontSize: 16, paddingTop: 8 }}>Visualisasi Data</label>
<div style={{ display: 'flex', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}>
<label style={{ color: 'white', width: '20%', fontSize: 16, paddingTop: 8 }}>Visualisasi</label>
</div>
<div style={{ display: 'flex', paddingRight: 25, paddingLeft: 25 }}>
<label style={{ color: '#51c6ea', width: '20%', fontSize: 11 }}>Master Data / Approval Matrix /
<span style={{ color: 'white', width: '20%', fontSize: 11 }}> Visualisasi</span>
</label>
</div>
<div style={{ padding: 25, width: '100%' }}>
<div style={{ width: '100%', padding: 25, backgroundColor: 'white', borderRadius: 6, border: 'solid 1px #c4c4c4'}}>
......@@ -160,16 +168,16 @@ export default class VisualisasiAM extends Component {
onChange={(event, newInputValue) => this.setState({typeName:newInputValue.approval_type_name}, () => {
this.handleInputChange()
})}
debug
renderInput={(params) => <TextField {...params} label="Tipe" margin="normal" />}
disableClearable
renderInput={(params) => <TextField {...params} label="Tipe Persetujuan" margin="normal" />}
/>
</div>
<ReactDragListView {...dragProps}>
<ol style={{paddingLeft: 15}}>
{this.state.listApproval.map((item, index) => (
<li key={index} style={{color: '#525252', fontSize: 14}}>
<a href="#" style={{color: '#525252'}}>
<div className="grid grid-3x grid-mobile-none gap-20px" style={{width: '75%'}}>
<li key={index} style={{color: '#4b4b4b', fontSize: 14}}>
<a href='#' style={{ color: '#4b4b4b', fontSize: '14px', cursor: 'auto', outline: 'none' }}>
<div className="grid grid-3x grid-mobile-none gap-20px margin-bottom-20px" style={{width: '75%'}}>
{item.data.map((items, indexs) => {return(<label>{items.fullname}</label>)})}
<label>{item.data.length == 1? '' : item.data[0].operator_type_name}</label>
</div>
......@@ -178,64 +186,6 @@ export default class VisualisasiAM extends Component {
))}
</ol>
</ReactDragListView>
{/* <div className="grid grid-4x grid-mobile-none gap-15px">
<div className="column-1">
<div className="margin-bottom-20px">
<label style={{ color: '#4b4b4b', fontSize: '14px' }}>1. John Doe</label>
</div>
</div>
<div className="column-2">
</div>
<div className="column-3">
</div>
<div className="column-4">
</div>
</div> */}
<div className="grid grid-4x grid-mobile-none gap-15px">
<div className="column-1">
<div className="margin-bottom-20px">
<label style={{ color: '#4b4b4b', fontSize: '14px' }}>2. Barbara Rosa</label>
</div>
</div>
<div className="column-2">
<div className="margin-bottom-20px">
<label style={{ color: '#4b4b4b', fontSize: '14px' }}>Aneesa Hassan</label>
</div>
</div>
<div className="column-3">
<div className="margin-bottom-20px">
<label style={{ color: '#4b4b4b', fontSize: '14px' }}>AND</label>
</div>
</div>
</div>
<div className="grid grid-4x grid-mobile-none gap-15px">
<div className="column-1">
<div className="margin-bottom-20px">
<label style={{ color: '#4b4b4b', fontSize: '14px' }}>3. Cole Park</label>
</div>
</div>
<div className="column-2">
<div className="margin-bottom-20px">
<label style={{ color: '#4b4b4b', fontSize: '14px' }}>Levison Robin</label>
</div>
</div>
<div className="column-3">
<div className="margin-bottom-20px">
<label style={{ color: '#4b4b4b', fontSize: '14px' }}>OR</label>
</div>
</div>
</div>
<div className="grid grid-4x grid-mobile-none gap-15px">
<div className="column-1">
<div className="margin-bottom-20px">
<label style={{ color: '#4b4b4b', fontSize: '14px' }}>4. Madison Price</label>
</div>
</div>
<div className="column-2">
</div>
<div className="column-3">
</div>
</div>
</div>
</div>
<div className="row" style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 15, paddingLeft: 15, paddingBottom: 25 }}>
......
import React, { Component } from 'react';
import { Typography, Paper, createMuiTheme, MuiThemeProvider, TableCell, FormControlLabel, TextField, Input } from '@material-ui/core';
import MUIDataTable from 'mui-datatables';
import NumberFormat from 'react-number-format';
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
const options = ct.customOptionsFixedColumn();
const style = {
position: "sticky",
left: 0,
background: "white",
zIndex: 101,
};
const style2 = {
position: "sticky",
left: 420,
background: "white",
zIndex: 101
};
export default class BalanceSheet extends Component {
render() {
const columns = [{
name: "Account",
options: {
customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#354960', width: 388 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 388 }}>
{tableMeta.rowIndex == 0 || tableMeta.rowIndex == 1 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{val}</span>
:
tableMeta.rowIndex == 2 || tableMeta.rowIndex == 6 || tableMeta.rowIndex == 7 || tableMeta.rowIndex == 8 ?
<span style={{ fontSize: 12, marginLeft: 10 }}>{val}</span> :
<span style={{ fontSize: 12, marginLeft: 20}}>{val}</span>
}
</div>
)
}
}
}, {
name: "31 Dec 2020 Actual",
options: {
customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style2, top: 0, zIndex: 102, backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({
style: {
position: "sticky",
left: 420,
background: "white",
zIndex: 101
}
})
}
}, {
name: "January 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowIndex === 3 || tableMeta.rowIndex === 4 || tableMeta.rowIndex === 9 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
// <Input
// value={this.formatValue(value)}
// style={{}}
// inputProps={{
// style: {
// color: "#5198ea",
// fontSize: 12,
// textAlign: 'right'
// }
// }}
// disableUnderline={true}
// inputStyle={{ color: 'red' }}
// />
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
/>
}
onChange={event => updateValue(event.target.value)}
/>
</div> :
<span style={{ fontSize: 12, textAlign: 'right' }}>{value === "" ? "-" : value}</span>
}
</div>
)
}
}
}, {
name: "February 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
return (
<div style={{ width: 96 }}>
{val}
</div>
)
}
}
}, {
name: "March 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
return (
<div style={{ width: 96 }}>
{val}
</div>
)
}
}
}, {
name: "April 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
return (
<div style={{ width: 96 }}>
{val}
</div>
)
}
}
}, {
name: "May 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
return (
<div style={{ width: 96 }}>
{val}
</div>
)
}
}
}, {
name: "June 2021",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
return (
<div style={{ width: 96 }}>
{val}
</div>
)
}
}
}, {
name: "31 Dec 2021 Total",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
return (
<div style={{ width: 96 }}>
{val}
</div>
)
}
}
}, {
name: "31 Dec 2022 Total",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
return (
<div style={{ width: 96 }}>
{val}
</div>
)
}
}
}, {
name: "31 Dec 2023 Total",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (val) => {
return (
<div style={{ width: 96 }}>
{val}
</div>
)
}
}
}
]
const dataTable = [
["TOTAL ASSETS", "11,247,249", "10,702,196"],
["TOTAL CURRENT ASSETS", "2,647,647", "2,058,898"],
["Cash & Cash Equivalent", "1,464,571", "729,743"],
["Cash & Bank Balance", "938,707", "265584"],
["Time & Call Deposit", "525,864", "464,159"],
["BI Deposit", "", ""],
["Marketable Securities", "150,250", "154,500"],
["Notes Receivable", "", ""],
["Accounts Receivable", "172,031", "97,112"],
["Trade Receivables - Third Party", "142,668", "77,480"],
]
return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
<div style={{ height: 78, backgroundColor: '#354960', flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Budget Tahunan - Tax Planning</Typography>
</div>
<div style={{ flex: 1, padding: 20, width: '100%' }}>
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', fontWeight: 'bold', color: '#4b4b4b', margin: 10 }}>Budget Tahunan</Typography>
</div>
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>PT. XYZ</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : 2021</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ marginTop: 20, width: '100%' }}>
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable}
columns={columns}
options={options}
/>
</MuiThemeProvider>
</div>
</div>
</Paper>
</div>
</div>
);
}
}
......@@ -3,7 +3,6 @@ import clsx from 'clsx';
import { makeStyles, useTheme } from '@material-ui/core/styles';
import Drawer from '@material-ui/core/Drawer';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import List from '@material-ui/core/List';
import CssBaseline from '@material-ui/core/CssBaseline';
import Typography from '@material-ui/core/Typography';
......@@ -13,15 +12,11 @@ import MenuIcon from '@material-ui/icons/Menu';
import ExpandMore from '@material-ui/icons/ExpandMore'
import ExpandLess from '@material-ui/icons/ExpandLess'
import ChevronLeftIcon from '@material-ui/icons/ChevronLeft';
import ChevronRightIcon from '@material-ui/icons/ChevronRight';
import ListItem from '@material-ui/core/ListItem';
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 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 {
......@@ -133,7 +128,7 @@ export default function MiniDrawer() {
const [userEmail, setUserEmail] = React.useState("")
React.useEffect(() => {
if (userFullname == "" && userEmail == "") {
if(userFullname == "" && userEmail == "") {
getUserData()
}
})
......@@ -142,13 +137,18 @@ export default function MiniDrawer() {
let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => {
if (response.data.status == 'success') {
setUserFullname(response.data.data.fullname == null ? 'Anonym' : response.data.data.fullname)
setUserEmail(response.data.data.email == null ? 'Anonym@123.xyz' : response.data.data.email)
setUserFullname(response.data.data.fullname == null? 'Anonym' : response.data.data.fullname)
setUserEmail(response.data.data.email == null? 'Anonym@123.xyz' : response.data.data.email)
console.log(userEmail)
}
})
}
const logout = () => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}
const handleDrawerOpen = () => {
setOpen(true);
};
......@@ -172,11 +172,6 @@ export default function MiniDrawer() {
setSelectedIndex(e)
}
const logout = () => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}
let { path, url } = useRouteMatch();
const { height, width } = UseWindowDimensions();
......@@ -209,20 +204,21 @@ export default function MiniDrawer() {
height: open ? 203 : 78,
paddingLeft: open ? null : 55,
display: open ? null : 'grid',
alignSelf: open ? null : 'center'
// paddingBottom: open ? 55 : null,
alignSelf: open? null : 'center'
}}>
{open === true ?
<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' }} />
<IconButton onClick={handleDrawerClose} style={{ outline: 'none' }}>
<IconButton onClick={handleDrawerClose} style={{outline: 'none'}}>
<ChevronLeftIcon style={{ fill: 'white' }} />
</IconButton>
</div> :
<IconButton
color="inherit"
aria-label="open drawer"
style={{ outline: 'none' }}
style={{outline: 'none'}}
onClick={handleDrawerOpen}
edge="start"
className={clsx(classes.menuButton, {
......@@ -288,7 +284,7 @@ export default function MiniDrawer() {
<List component="div" disablePadding>
{item.subItem.map((sub, indexs) => {
return (
<Link to={`${url}/${sub.path}`}>
<Link to={sub.label === "Logout" ? `/` : `${url}/${sub.path}`}>
<div style={{ paddingLeft: 5, }} className={selectedSubIndex === sub.label ? "active" : ""} onClick={() => sub.label === "Logout" ? logout() : selectSub(sub.label)}>
<ListItem button style={{ paddingLeft: 61 }}>
<Typography style={{ fontFamily: 'nunito', color: '#525355', fontSize: 14 }}>{sub.label}</Typography>
......
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 Images from '../assets/Images';
import DonutChart from 'react-d3-donut';
......
import React, { Component } from 'react';
import { Container, Row, Col } from "react-bootstrap";
import { makeStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import { TextField } from '@material-ui/core';
import MenuItem from '@material-ui/core/MenuItem';
import { makeStyles } from '@material-ui/core/styles';
import { TextField, List, ListSubheader, Typography } from '@material-ui/core';
import MinimizeIcon from '@material-ui/icons/Minimize';
import AddIcon from '@material-ui/icons/Add';
import RemoveIcon from '@material-ui/icons/Remove';
import TreeView from '@material-ui/lab/TreeView';
import TreeItem from '@material-ui/lab/TreeItem';
const useStyles = makeStyles((theme) => ({
root: {
width: '100%',
maxWidth: 500,
backgroundColor: theme.palette.background.paper,
},
nested: {
paddingLeft: theme.spacing(4),
},
}));
const type = [
{
value: 'KPI',
value: '1',
label: 'KPI',
},
{
value: 'Gatau',
label: 'Gatau',
value: '2',
label: 'KPI',
},
];
const companies = [
{
value: '',
label: '',
},
{
value: '1',
label: 'TIA',
},
{
value: '2',
label: 'TIA',
},
];
export default class VisualReportItems extends Component {
constructor(props) {
super(props)
this.state = {
visibleAM: false,
visibleVisual: true
}
open: false
}
state = {
tasks: [
{name:"Angular",type:"lvl1"},
{name:"Typescript",type:"lvl1"},
{name:"React", type:"lvl2"},
{name:"Vue", type:"lvl3"}
]
}
componentDidMount() {
......@@ -39,21 +58,6 @@ export default class VisualReportItems extends Component {
}
render() {
// var tasks = {
// lvl1: [],
// lvl2: [],
// lvl3: []
// }
// this.state.tasks.forEach ((task) => {
// tasks[task.type].push(
// <div key={task.taskName}
// className="draggable"
// style = {{backgroundColor: task.bgcolor}}>
// {task.taskName}
// </div>
// );
// });
return (
<div>
......@@ -65,80 +69,100 @@ export default class VisualReportItems extends Component {
</div>
<div style={{ padding: 25, width: '100%' }}>
<div style={{ width: '100%', padding: 25, backgroundColor: 'white', borderRadius: 6, border: 'solid 1px #c4c4c4'}}>
<label style={{ color: '#4b4b4b', fontSize: '16px', fontWeight: 'bold' }}>Hirarki Persetujuan</label>
<div className="" style={{ width: 250, marginTop: 8, marginBottom: 28 }}>
<label style={{ color: '#4b4b4b', fontSize: '16px', fontWeight: 'bold' }}>Hirarki Item Laporan</label>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
id="type"
id="reportItems"
style={{ width: 250 }}
select
label="Tipe Persetujuan"
// value={this.state.periode}
onChange={(e) => null}
label="Item Laporan"
// onChange={handleChange}
helperText=""
SelectProps={{
native: true,
}}
InputLabelProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085',
paddingLeft: 10
}
}}
inputProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
paddingLeft: 10
}
}}
>
{type.map((option) => (
<MenuItem key={option.value} value={option.value}>
<option key={option.value} value={option.value}>
{option.label}
</MenuItem>
</option>
))}
</TextField>
</div>
<div className="grid grid-4x grid-mobile-none gap-15px">
<div className="column-1">
<div className="margin-bottom-20px">
<label style={{ color: '#4b4b4b', fontSize: '14px' }}>1. John Doe</label>
</div>
</div>
<div className="column-2">
</div>
<div className="column-3">
</div>
<div className="column-4">
</div>
</div>
<div className="grid grid-4x grid-mobile-none gap-15px">
<div className="column-1">
<div className="margin-bottom-20px">
<label style={{ color: '#4b4b4b', fontSize: '14px' }}>2. Barbara Rosa</label>
</div>
</div>
<div className="column-2">
<div className="margin-bottom-20px">
<label style={{ color: '#4b4b4b', fontSize: '14px' }}>Aneesa Hassan</label>
</div>
</div>
<div className="column-3">
<div className="margin-bottom-20px">
<label style={{ color: '#4b4b4b', fontSize: '14px' }}>AND</label>
</div>
</div>
</div>
<div className="grid grid-4x grid-mobile-none gap-15px">
<div className="column-1">
<div className="margin-bottom-20px">
<label style={{ color: '#4b4b4b', fontSize: '14px' }}>3. Cole Park</label>
</div>
</div>
<div className="column-2">
<div className="margin-bottom-20px">
<label style={{ color: '#4b4b4b', fontSize: '14px' }}>Levison Robin</label>
</div>
</div>
<div className="column-3">
<div className="margin-bottom-20px">
<label style={{ color: '#4b4b4b', fontSize: '14px' }}>OR</label>
</div>
</div>
</div>
<div className="grid grid-4x grid-mobile-none gap-15px">
<div className="column-1">
<div className="margin-bottom-20px">
<label style={{ color: '#4b4b4b', fontSize: '14px' }}>4. Madison Price</label>
</div>
</div>
<div className="column-2">
</div>
<div className="column-3">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField
id="company"
style={{ width: 250 }}
select
label="Perusahaan"
// onChange={handleChange}
helperText=""
SelectProps={{
native: true,
}}
InputLabelProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085',
paddingLeft: 10
}
}}
inputProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
paddingLeft: 10
}
}}
>
{companies.map((option) => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))}
</TextField>
</div>
<div className="margin-top-30px">
<TreeView
defaultCollapseIcon={<RemoveIcon />}
defaultExpandIcon={< AddIcon/>}
>
<TreeItem nodeId="1" style={{margin: 10}} label="Accumulated Depreciation (negative value)">
<TreeItem nodeId="2" style={{margin: 20}} label="Beginning Balance" />
<TreeItem nodeId="3" style={{margin: 20}} label="Depreciation expense MTD (please fill in, if any)" />
<TreeItem nodeId="4" style={{margin: 20}} label="Disposal (positive value) (please fill in, if any)" />
</TreeItem>
<TreeItem nodeId="10" style={{margin: 20}} label="Control Gain/(Loss) on Fixed Assets" />
<TreeItem nodeId="5" style={{margin: 10}} label="Gain/(Loss) on Fixed Assets">
<TreeItem nodeId="6" style={{margin: 20}} label="NBV">
<TreeItem nodeId="7" style={{margin: 20}} label="Cost"/>
<TreeItem nodeId="9" style={{margin: 20}} label="Accm. Depreciation" />
</TreeItem>
<TreeItem nodeId="10" style={{margin: 20}} label="Proceed from sale or disposal of Fixed Assets (please fill in, if any)" />
</TreeItem>
</TreeView>
</div>
</div>
</div>
......
import React, { Component } from "react";
import { Container, Row, Col } from "react-bootstrap";
import { makeStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import SearchIcon from '@material-ui/icons/Search';
import Images from "../../assets/Images";
import MUIDataTable from "mui-datatables";
......@@ -18,74 +17,6 @@ var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
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 {
constructor(props) {
super(props)
......@@ -94,7 +25,8 @@ export default class UserRole extends Component {
indexData: {},
add: false,
edit: false,
visibleUser: true
visibleUser: true,
buttonError: false,
}
}
......@@ -112,22 +44,15 @@ export default class UserRole extends Component {
getUser() {
api.create().getUser().then((response) => {
// console.log(response)
if (response.data.status == 'success') {
// console.log(response.data.data)
if (response.data.status === 'success') {
let data = response.data.data
let listData = data.map((item, index) => {
return [index, item.user_id, item.fullname, item.email, item.role_name, item.company, item.status]
let listData = data.sort((a,b) => a.user_id - b.user_id).map((item, index) => {
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: response.data.data}, () => {
// console.log(this.state.listUser)
// })
} else {
alert(response.data.message)
}
// console.log(response.data.data)
})
}
......@@ -136,10 +61,10 @@ export default class UserRole extends Component {
"keyword": this.state.search
}
api.create().searchUser(payload).then((response) => {
if (response.data.status == 'success') {
if (response.data.status === 'success') {
let data = response.data.data
let listData = data.map((item, index) => {
return [index, item.user_id, item.fullname, item.email, item.role_name, item.company, item.status]
let listData = data.sort((a,b) => a.user_id - b.user_id).map((item, index) => {
return [index, item.user_id, item.fullname == null? '-' : item.fullname, item.email, item.role_name, '-', item.status]
})
this.setState({ listUser: listData })
} else {
......@@ -155,18 +80,21 @@ export default class UserRole extends Component {
console.log(err);
}
else {
let judul = resp.rows[0]
// let judul = resp.rows[0]
let isi = resp.rows.slice(3)
let payload = []
console.log(isi)
isi.map((item, index) => {
if (item.length > 0) {
payload.push({
id: item.id,
id: index + 1,
fullname: item[0],
email: item[1],
role: item[2],
start_date: item[3],
end_date: item[4],
})
}
})
let body = {
user: payload
......@@ -383,7 +311,7 @@ export default class UserRole extends Component {
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex', width: 50 }}>
<div style={{ display: 'flex'}}>
{val}
</div >
);
......@@ -394,7 +322,7 @@ export default class UserRole extends Component {
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex', width: 200 }}>
<div style={{ display: 'flex'}}>
{titleCase(val)}
</div >
);
......@@ -405,7 +333,7 @@ export default class UserRole extends Component {
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex', width: 150 }}>
<div style={{ display: 'flex'}}>
{titleCase(val)}
</div >
);
......@@ -416,7 +344,7 @@ export default class UserRole extends Component {
options: {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex', width: 100 }}>
<div style={{ display: 'flex'}}>
{titleCase(val)}
</div >
);
......@@ -437,7 +365,7 @@ export default class UserRole extends Component {
return (
<div style={{ height: this.props.height }}>
{/* <Row> */}
<div style={{ height: 199, backgroundColor: '#354960', width: '100%' }} />
<div className={"main-color"} style={{ height: 199, width: '100%' }} />
{this.state.visibleUser ? <div>
<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>
......@@ -565,7 +493,7 @@ export default class UserRole extends Component {
</button>
<button
type="button"
onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : null}
onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : this.uploadUser()}
style={{}}
>
<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';
import { titleCase } from '../../../library/Utils';
import localeID from "date-fns/locale/id"
import format from "date-fns/format";
import * as R from 'ramda'
import RemoveIcon from '@material-ui/icons/Remove';
import AddIcon from '@material-ui/icons/Add';
import { DatePicker } from '@material-ui/pickers';
......@@ -64,7 +63,7 @@ export default class AddUser extends Component {
handleChange(e, type) {
let data = this.state
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,
errorRoleName: false,
errorStartDate: false,
......@@ -73,7 +72,7 @@ export default class AddUser extends Component {
msgErrorSD: '',
msgErrorED: '',
})
} else if (isDate && type == 'end_date') {
} else if (isDate && type === 'end_date') {
this.setState({ ...data, endDate: format(e, 'yyyy-MM-dd') ,
errorRoleName: false,
errorStartDate: false,
......@@ -110,7 +109,7 @@ export default class AddUser extends Component {
}
api.create().createUser(payload).then((response) => {
console.log(response)
if (String(response.data.status).toLocaleUpperCase == 'success') {
if (String(response.data.status).toLocaleUpperCase === 'success') {
this.props.onClickClose()
this.props.refresh()
} else {
......@@ -121,7 +120,7 @@ export default class AddUser extends Component {
getRole() {
api.create().getRole().then((response) => {
if(response.data.status == 'success') {
if(response.data.status === 'success') {
let data = response.data.data
let roleData = data.map((item) => {
return {
......@@ -142,7 +141,7 @@ export default class AddUser extends Component {
getPerusahaan() {
api.create().getPerusahaanHierarki().then((response) => {
if(response.data.status == 'success') {
if(response.data.status === 'success') {
this.setState({listCompany: response.data.data})
console.log(response.data.data)
}
......@@ -150,14 +149,14 @@ export default class AddUser extends Component {
}
handleItemChecked(item) {
let indexID = this.state.company.findIndex((val) => val == item.company_id)
return indexID == -1 ? false : true
let indexID = this.state.company.findIndex((val) => val === item.company_id)
return indexID === -1 ? false : true
}
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
if (indexID == -1) {
if (indexID === -1) {
company.push(item.company_id)
} else {
company.splice(indexID, 1)
......@@ -341,7 +340,7 @@ export default class AddUser extends Component {
</div>
<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}}>{`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>
<Divider style={{margin: 20}}/>
<div style={{paddingLeft: 20, paddingRight: 20}}>
......@@ -351,8 +350,8 @@ export default class AddUser extends Component {
return(
<div>
<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 }}>
{index == this.state.selectedIndex ? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />}
{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'} />}
</span>}
<span>
<CustomCheckbox
......@@ -364,10 +363,10 @@ export default class AddUser extends Component {
</div>
{item.childCompany.length > 0 && item.childCompany.map((items,indexs) => {
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' }}>
{/* {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'} />}
{/* {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>} */}
{/* <RemoveIcon color={'action'} fontSize={'small'} /> */}
<span>
......
......@@ -5,9 +5,9 @@ import { titleCase } from '../../../library/Utils';
import Autocomplete from '@material-ui/lab/Autocomplete';
import { DatePicker } from '@material-ui/pickers';
import format from "date-fns/format";
import * as R from 'ramda'
import RemoveIcon from '@material-ui/icons/Remove';
import AddIcon from '@material-ui/icons/Add';
import * as R from 'ramda'
const CustomCheckbox = withStyles({
root: {
......@@ -52,36 +52,47 @@ export default class EditUser extends Component {
componentDidMount() {
this.getDetailUser()
this.getRole()
this.getPerusahaan()
}
handleChange(e, type) {
let data = this.state
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'), end_date: null },
errorFullname: false,
errorEmail: false,
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
})
} 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') },
errorFullname: false,
errorEmail: false,
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
})
} else {
this.setState({ ...data, tempData: { ...this.state.tempData, [e.target.name]: e.target.value },
errorFullname: false,
errorEmail: false,
errorRoleName: false,
errorStartDate: false,
errorEndDate: false,
msgErrorFN: '',
msgErrorEM: '',
msgErrorRN: '',
msgErrorSD: '',
msgErrorED: '',
......@@ -91,7 +102,8 @@ export default class EditUser extends Component {
getDetailUser() {
api.create().getDetailUser(this.state.paramsId).then((response) => {
if (response.data.status == 'success') {
this.getRole()
if (response.data.status === 'success') {
this.setState({tempData: response.data.data, company: response.data.data.company})
console.log(response.data.data)
} else {
......@@ -101,8 +113,24 @@ export default class EditUser extends Component {
}
validasi() {
if (R.isEmpty(this.state.tempData.fullname)) {
this.setState({errorFullname: true, msgErrorFN: 'Nama Lengkap tidak boleh kosong'})
} else if (R.isEmpty(this.state.tempData.email)) {
this.setState({errorEmail: true, msgErrorEM: 'Email tidak boleh kosong'})
} else if (R.isEmpty(this.state.tempData.role_name)) {
this.setState({errorRoleName: true, msgErrorRN: 'Role Name tidak boleh kosong'})
} else if (R.isNil(this.state.tempData.start_date)) {
this.setState({errorStartDate: true, msgErrorSD: 'Start Date tidak boleh kosong'})
} else if (R.isNil(this.state.tempData.end_date)) {
this.setState({errorEndDate: true, msgErrorED: 'End Date tidak boleh kosong'})
}
// else if (this.state.privileges.length < 1) {
// alert('Hak Akses belum di pilih !!')
// }
else {
this.updateUser()
}
}
updateUser() {
let payload = {
......@@ -116,7 +144,7 @@ export default class EditUser extends Component {
}
api.create().updateUser(payload).then((response) => {
if (response.data.status == 'success') {
if (response.data.status === 'success') {
this.props.onClickClose()
this.props.refresh()
} else {
......@@ -127,7 +155,7 @@ export default class EditUser extends Component {
getRole() {
api.create().getRole().then((response) => {
if(response.data.status == 'success') {
if(response.data.status === 'success') {
let data = response.data.data
let roleData = data.map((item) => {
return {
......@@ -140,8 +168,8 @@ export default class EditUser extends Component {
getOptionLabel: (option) => titleCase(option.role_name),
};
let index = roleData.findIndex((val) => val.role_id == this.state.tempData.role_id)
this.setState({listRole: defaultProps, role: index == -1? roleData[0] : roleData[index]})
let index = roleData.findIndex((val) => val.role_id === this.state.tempData.role_id)
this.setState({listRole: defaultProps, role: index === -1? roleData[0] : roleData[index]})
} else {
alert(response.data.message)
}
......@@ -150,7 +178,7 @@ export default class EditUser extends Component {
getPerusahaan() {
api.create().getPerusahaanHierarki().then((response) => {
if(response.data.status == 'success') {
if(response.data.status === 'success') {
this.setState({listCompany: response.data.data})
console.log(response.data.data)
}
......@@ -158,14 +186,14 @@ export default class EditUser extends Component {
}
handleItemChecked(item) {
let indexID = this.state.company.findIndex((val) => val == item.company_id)
return indexID == -1 ? false : true
let indexID = this.state.company.findIndex((val) => val === item.company_id)
return indexID === -1 ? false : true
}
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
if (indexID == -1) {
if (indexID === -1) {
company.push(item.company_id)
} else {
company.splice(indexID, 1)
......@@ -204,7 +232,7 @@ export default class EditUser extends Component {
disabled
// id="outlined-read-only-input"
variant="filled"
value={this.state.tempData == null? '' : this.state.tempData.user_id}
value={this.state.tempData === null? '' : this.state.tempData.user_id}
onChange={(e) => null}
>
{/* {periode.map((option) => (
......@@ -223,10 +251,11 @@ export default class EditUser extends Component {
id="fullname"
name="fullname"
label="Nama Lengkap"
value={this.state.tempData == null? '' : this.state.tempData.fullname}
value={this.state.tempData === null? '' : this.state.tempData.fullname}
onChange={(e) => this.handleChange(e, '')}
// defaultValue="Default Value"
// helperText="Some important text"
error={this.state.errorFullname}
helperText={this.state.msgErrorFN}
/>
</div>
</div>
......@@ -240,10 +269,10 @@ export default class EditUser extends Component {
id="email"
name="email"
label="Email"
value={this.state.tempData == null? '' : this.state.tempData.email}
value={this.state.tempData === null? '' : this.state.tempData.email}
onChange={(e) => this.handleChange(e, '')}
// defaultValue="Default Value"
// helperText="Some important text"
error={this.state.errorEmail}
helperText={this.state.msgErrorEM}
/>
</div>
</div>
......@@ -255,6 +284,7 @@ export default class EditUser extends Component {
id="role"
onChange={(event, newInputValue) => this.setState({role: newInputValue})}
debug
renderInput={(params) => <TextField {...params} label="Role" margin="normal" style={{marginTop: 7}}/>}
value={this.state.role}
/>
......@@ -270,14 +300,13 @@ export default class EditUser extends Component {
id="startDate"
label="Berlaku Mulai"
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}
error={this.state.errorStartDate}
helperText={this.state.msgErrorSD}
onChange={(e) => this.handleChange(e, 'start_date')}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div>
......@@ -290,10 +319,10 @@ export default class EditUser extends Component {
id="endDate"
label="Berlaku Hingga"
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}
error={this.state.errorEndDate}
helperText={this.state.msgErrorED}
minDate={this.state.tempData == null ? null : this.state.tempData.start_date}
minDate={this.state.tempData === null ? null : this.state.tempData.start_date}
onChange={(e) => this.handleChange(e, 'end_date')}
KeyboardButtonProps={{
'aria-label': 'change date',
......@@ -315,7 +344,7 @@ export default class EditUser 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}>
......@@ -336,7 +365,7 @@ export default class EditUser extends Component {
disabled
// id="outlined-read-only-input"
variant="filled"
value={this.state.tempData == null? '' : this.state.tempData.is_expired}
value={this.state.tempData === null? '' : this.state.tempData.is_expired}
>
{/* {periode.map((option) => (
<MenuItem key={option.value} value={option.value}>
......@@ -348,8 +377,8 @@ export default class EditUser extends Component {
</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}`}</Typography>
<Typography style={{fontSize: 12}}>{`Diubah: ${this.state.tempData == null? '' : this.state.tempData.updated}`}</Typography>
<Typography style={{fontSize: 12}}>{`Dibuat : ${this.state.tempData === null? '' : this.state.tempData.created}`}</Typography>
<Typography style={{fontSize: 12}}>{`Diubah: ${this.state.tempData === null? '' : this.state.tempData.updated}`}</Typography>
</div>
<Divider style={{margin: 20}}/>
<div style={{paddingLeft: 20, paddingRight: 20}}>
......@@ -359,8 +388,8 @@ export default class EditUser extends Component {
return(
<div>
<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 }}>
{index == this.state.selectedIndex ? <RemoveIcon color={'action'} fontSize={'small'} /> : <AddIcon color={'action'} fontSize={'small'} />}
{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'} />}
</span>}
<span>
<CustomCheckbox
......@@ -372,10 +401,10 @@ export default class EditUser extends Component {
</div>
{item.childCompany.length > 0 && item.childCompany.map((items,indexs) => {
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' }}>
{/* {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'} />}
{/* {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>} */}
{/* <RemoveIcon color={'action'} fontSize={'small'} /> */}
<span>
......
import React, { Component, memo } from "react";
import { Container, Row, Col } from "react-bootstrap";
import { makeStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import SearchIcon from '@material-ui/icons/Search';
import Images from "../../assets/Images";
import MUIDataTable from "mui-datatables";
......@@ -10,7 +9,6 @@ import api from "../../api";
import { titleCase } from "../../library/Utils";
import InputAdornment from '@material-ui/core/InputAdornment';
import TextField from '@material-ui/core/TextField';
import AccountCircle from '@material-ui/icons/AccountCircle';
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
const options = ct.customOptions();
......@@ -42,9 +40,9 @@ class UserRole extends Component {
getRole() {
api.create().getRole().then((response) => {
// console.log(response)
if (response.data.status == 'success') {
if (response.data.status === 'success') {
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]
})
// console.log(listData)
......@@ -65,9 +63,9 @@ class UserRole extends Component {
"keyword": this.state.search
}
api.create().searchRole(payload).then((response) => {
if (response.data.status == 'success') {
if (response.data.status === 'success') {
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]
})
this.setState({listRole: listData})
......@@ -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 (
<div style={{ height: this.props.height }}>
{/* <Row> */}
......
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 AddIcon from '@material-ui/icons/Add';
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 localeID from "date-fns/locale/id"
import * as R from 'ramda'
......@@ -54,7 +54,7 @@ export default class AddRole extends Component {
handleChange(e, type) {
let data = this.state
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,
errorRoleName: false,
errorStartDate: false,
......@@ -63,7 +63,7 @@ export default class AddRole extends Component {
msgErrorSD: '',
msgErrorED: '',
})
} else if (isDate && type == 'end_date') {
} else if (isDate && type === 'end_date') {
this.setState({...data, endDate : format(e, 'yyyy-MM-dd'),
errorRoleName: false,
errorStartDate: false,
......@@ -111,7 +111,7 @@ export default class AddRole extends Component {
// console.log(payload)
api.create().addRole(payload).then((response) => {
console.log(response)
if (response.data.status == 'success') {
if (response.data.status === 'success') {
this.props.refresh()
this.props.onClickClose()
} else {
......@@ -122,7 +122,7 @@ export default class AddRole extends Component {
getMenu() {
api.create().getMenu().then((response) => {
if (response.data.status == 'success') {
if (response.data.status === 'success') {
this.setState({menuData: response.data.data})
} else {
alert(response.data.message)
......@@ -131,14 +131,14 @@ export default class AddRole extends Component {
}
handleItemChecked(item) {
let indexID = this.state.privileges.findIndex((val) => val.menu_id == item.menu_id)
return indexID == -1? false : true
let indexID = this.state.privileges.findIndex((val) => val.menu_id === item.menu_id)
return indexID === -1? false : true
}
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
if (indexID == -1) {
if (indexID === -1) {
privileges.push({
menu_id: item.menu_id,
button_id: [1,2,3]
......@@ -150,36 +150,33 @@ export default class AddRole extends Component {
}
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
if (indexID == -1) {
if (indexID === -1) {
value = false
} else {
let arrayButton = this.state.privileges[indexID].button_id
// console.log(arrayButton)
let indexButtonID = this.state.privileges[indexID].button_id.findIndex((val) => val == index)
// console.log(indexButtonID)
if (indexButtonID == -1) {
let indexButtonID = this.state.privileges[indexID].button_id.findIndex((val) => val === index)
if (indexButtonID === -1) {
value = false
} else {
value = true
}
}
return indexID == -1? value : value
return indexID === -1? value : value
}
handleSubItemClick(item, index) {
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 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 privileges = this.state.privileges
let button_id = privileges[indexID].button_id
if (indexButtonID == -1) {
if (indexButtonID === -1) {
button_id.push(index)
} else {
button_id.splice(indexButtonID,1)
}
privileges[indexID].button_id = button_id
if (button_id.length == 0) {
if (button_id.length === 0) {
privileges.splice(indexID,1)
}
this.setState({privileges})
......@@ -317,7 +314,7 @@ export default class AddRole extends Component {
</div>
<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}}>{`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>
<Divider style={{margin: 20}}/>
<div style={{paddingLeft: 20, paddingRight: 20}}>
......@@ -345,8 +342,8 @@ export default class AddRole extends Component {
<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'}/>}
{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
......@@ -384,7 +381,7 @@ export default class AddRole extends Component {
</div>
{item.sub_menu.length > 0 && item.sub_menu.map((items,indexs) => {
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="column-1" style={{display: 'flex', flexDirection: 'row', alignItems: 'center', paddingLeft: 50}}>
<CustomCheckbox
......
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 AddIcon from '@material-ui/icons/Add';
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 * as R from 'ramda'
const CustomCheckbox = withStyles({
......@@ -50,7 +50,7 @@ export default class EditRole extends Component {
handleChange(e, type) {
let data = this.state
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'), end_date: null },
errorRoleName: false,
errorStartDate: false,
......@@ -59,7 +59,7 @@ export default class EditRole extends Component {
msgErrorSD: '',
msgErrorED: '',
})
} 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') },
errorRoleName: false,
errorStartDate: false,
......@@ -83,7 +83,7 @@ export default class EditRole extends Component {
getDetailRole() {
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 })
console.log(response.data.data.start_date)
} else {
......@@ -119,7 +119,7 @@ export default class EditRole extends Component {
// console.log(payload)
api.create().editRole(payload).then((response) => {
console.log(response)
if (response.data.status == 'success') {
if (response.data.status === 'success') {
this.props.refresh()
this.props.onClickClose()
} else {
......@@ -130,7 +130,7 @@ export default class EditRole extends Component {
getMenu() {
api.create().getMenu().then((response) => {
if (response.data.status == 'success') {
if (response.data.status === 'success') {
this.setState({ menuData: response.data.data })
} else {
alert(response.data.message)
......@@ -139,14 +139,14 @@ 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
let indexID = this.state.privileges.findIndex((val) => val.menu_id === item.menu_id)
return indexID === -1 ? false : true
}
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
if (indexID == -1) {
if (indexID === -1) {
privileges.push({
menu_id: item.menu_id,
button_id: [1, 2, 3]
......@@ -158,36 +158,33 @@ export default class EditRole extends Component {
}
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
if (indexID == -1) {
if (indexID === -1) {
value = false
} else {
let arrayButton = this.state.privileges[indexID].button_id
// console.log(arrayButton)
let indexButtonID = this.state.privileges[indexID].button_id.findIndex((val) => val == index)
// console.log(indexButtonID)
if (indexButtonID == -1) {
let indexButtonID = this.state.privileges[indexID].button_id.findIndex((val) => val === index)
if (indexButtonID === -1) {
value = false
} else {
value = true
}
}
return indexID == -1 ? value : value
return indexID === -1 ? value : value
}
handleSubItemClick(item, index) {
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 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 privileges = this.state.privileges
let button_id = privileges[indexID].button_id
if (indexButtonID == -1) {
if (indexButtonID === -1) {
button_id.push(index)
} else {
button_id.splice(indexButtonID, 1)
}
privileges[indexID].button_id = button_id
if (button_id.length == 0) {
if (button_id.length === 0) {
privileges.splice(indexID, 1)
}
this.setState({ privileges })
......@@ -229,7 +226,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) => (
......@@ -248,7 +245,7 @@ export default class EditRole extends Component {
id="userRole"
name="role_name"
label="User Role"
value={this.state.tempData == null ? '' : this.state.tempData.role_name}
value={this.state.tempData === null ? '' : this.state.tempData.role_name}
error={this.state.errorRoleName}
helperText={this.state.msgErrorRN}
onChange={(e) => this.handleChange(e, '')}
......@@ -267,7 +264,7 @@ export default class EditRole extends Component {
id="startDate"
label="Berlaku Mulai"
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}
error={this.state.errorStartDate}
helperText={this.state.msgErrorSD}
onChange={(e) => this.handleChange(e, 'start_date')}
......@@ -287,10 +284,10 @@ export default class EditRole extends Component {
id="endDate"
label="Berlaku Hingga"
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}
error={this.state.errorEndDate}
helperText={this.state.msgErrorED}
minDate={this.state.tempData == null ? null : this.state.tempData.start_date}
minDate={this.state.tempData === null ? null : this.state.tempData.start_date}
onChange={(e) => this.handleChange(e, 'end_date')}
KeyboardButtonProps={{
'aria-label': 'change date',
......@@ -312,7 +309,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}>
......@@ -324,8 +321,8 @@ export default class EditRole extends Component {
</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>
<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 }}>
......@@ -353,8 +350,8 @@ export default class EditRole extends Component {
<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'} />}
{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
......@@ -392,7 +389,7 @@ export default class EditRole extends Component {
</div>
{item.sub_menu.length > 0 && item.sub_menu.map((items, indexs) => {
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="column-1" style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', paddingLeft: 50 }}>
<CustomCheckbox
......
import screen404 from '../container/Screen404'
import Beranda from '../container/Beranda'
import UserRole from '../container/Otorisasi/UserRole'
import User from '../container/Otorisasi/User'
import ApprovalMatrix from '../container/ApprovalMatrix/ApprovalMatrix'
import BudgetTahunan from '../container/BudgetTahunan';
import HomePage from '../container/HomePage';
import BalanceSheet from '../container/BudgetTahunan/BalanceSheet';
import Profile from '../container/Profile';
......
......@@ -26,7 +26,7 @@ import Constant from "../library/Constant";
export default function BasicExample() {
return (
<Router basename={"/tia-web"}>
<Router basename={"/tia-web-dev"}>
<Switch>
<Route exact path="/">
<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