Commit baa2462a authored by Deni Rinaldi's avatar Deni Rinaldi

push sebelum liburan

parent 85eea79e
...@@ -2,10 +2,19 @@ import React from 'react'; ...@@ -2,10 +2,19 @@ import React from 'react';
import './assets/sass/app.css'; import './assets/sass/app.css';
import Route from './router' import Route from './router'
import 'bootstrap/dist/css/bootstrap.min.css'; import 'bootstrap/dist/css/bootstrap.min.css';
import Constant from './library/Constant';
if (sessionStorage.getItem('reloaded') != null) {
console.log('page was reloaded');
} else {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}
sessionStorage.setItem('reloaded', 'yes');
function App() { function App() {
return ( return (
<Route/> <Route />
// <div className="App"> // <div className="App">
// <header className="App-header"> // <header className="App-header">
// <img src={logo} className="App-logo" alt="logo" /> // <img src={logo} className="App-logo" alt="logo" />
......
...@@ -10,6 +10,34 @@ ...@@ -10,6 +10,34 @@
color: #273b80 !important; color: #273b80 !important;
} }
.color-pallete1{
background-color: #273b80 !important;
}
.color-pallete2{
background-color: #1c71b8 !important;
}
.color-pallete3{
background-color: #37b5e6 !important;
}
.color-pallete4{
background-color: #07a7d0 !important;
}
.color-pallete5{
background-color: #768895 !important;
}
.color-pallete6{
background-color: #211e1e !important;
}
.color-pallete7{
background-color: #242021 !important;
}
.btn-save{ .btn-save{
width: 102px; width: 102px;
height: 30px; height: 30px;
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Typography, Paper, TextField, MenuItem, Select, FormControlLabel } from '@material-ui/core'; import { Typography, Paper, TextField, MenuItem, Select, FormControlLabel, Snackbar, withStyles } 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 BalanceSheet from './BudgetTahunan/BalanceSheet'; import BalanceSheet from './BudgetTahunan/BalanceSheet';
import api from '../api'; import api from '../api';
import Autocomplete from '@material-ui/lab/Autocomplete'; import Autocomplete from '@material-ui/lab/Autocomplete';
import MuiAlert from '@material-ui/lab/Alert';
import { titleCase } from '../library/Utils'; import { titleCase } from '../library/Utils';
import ProfitLoss from './BudgetTahunan/ProfitLoss'; import ProfitLoss from './BudgetTahunan/ProfitLoss';
import TaxPlanning from './BudgetTahunan/TaxPlanning'; import TaxPlanning from './BudgetTahunan/TaxPlanning';
...@@ -13,6 +14,10 @@ import CorporateAnnualTarget from './BudgetTahunan/CorporateAnnualTarget'; ...@@ -13,6 +14,10 @@ import CorporateAnnualTarget from './BudgetTahunan/CorporateAnnualTarget';
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import UploadFile from "../library/Upload"; import UploadFile from "../library/Upload";
import { format } from 'date-fns'; import { format } from 'date-fns';
import Constant from '../library/Constant';
const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
export default class BudgetTahunan extends Component { export default class BudgetTahunan extends Component {
constructor(props) { constructor(props) {
...@@ -33,7 +38,10 @@ export default class BudgetTahunan extends Component { ...@@ -33,7 +38,10 @@ export default class BudgetTahunan extends Component {
visibleCAT: false, visibleCAT: false,
listAttachment: [], listAttachment: [],
visibleUpload: false, visibleUpload: false,
revisionTable: null revisionTable: null,
alert: false,
tipeAlert: '',
messageAlert: '',
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -88,6 +96,7 @@ export default class BudgetTahunan extends Component { ...@@ -88,6 +96,7 @@ export default class BudgetTahunan extends Component {
getCompanyActive() { getCompanyActive() {
api.create().getPerusahaanActive().then((response) => { api.create().getPerusahaanActive().then((response) => {
if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
let data = response.data.data let data = response.data.data
let companyData = data.map((item) => { let companyData = data.map((item) => {
...@@ -104,10 +113,21 @@ export default class BudgetTahunan extends Component { ...@@ -104,10 +113,21 @@ export default class BudgetTahunan extends Component {
this.getPeriode() this.getPeriode()
}) })
} else { } else {
alert(response.data.message) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
} }
}) })
} }
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', listCompany: null, company: null })
}
})
}
getPeriode() { getPeriode() {
api.create().getPeriodeTransaction().then(response => { api.create().getPeriodeTransaction().then(response => {
...@@ -264,6 +284,10 @@ export default class BudgetTahunan extends Component { ...@@ -264,6 +284,10 @@ export default class BudgetTahunan extends Component {
}) })
} }
closeAlert() {
this.setState({ alert: false })
}
render() { render() {
const columns = ["#", "Jenis Laporan", const columns = ["#", "Jenis Laporan",
{ {
...@@ -395,6 +419,11 @@ export default class BudgetTahunan extends Component { ...@@ -395,6 +419,11 @@ export default class BudgetTahunan extends Component {
] ]
return ( return (
<div style={{ flex: 1, backgroundColor: '#f8f8f8' }}> <div style={{ flex: 1, backgroundColor: '#f8f8f8' }}>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert}
</Alert>
</Snackbar>
{this.state.visibleBudgetTahunan && ( {this.state.visibleBudgetTahunan && (
<div> <div>
<div className={"main-color"} style={{ height: 78, display: 'flex', alignItems: 'center', paddingLeft: 20 }}> <div className={"main-color"} style={{ height: 78, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
...@@ -558,6 +587,7 @@ export default class BudgetTahunan extends Component { ...@@ -558,6 +587,7 @@ export default class BudgetTahunan extends Component {
{this.state.visibleBS && ( {this.state.visibleBS && (
<BalanceSheet <BalanceSheet
open={this.props.open}
report_id={this.state.report_id} report_id={this.state.report_id}
height={this.props.height} height={this.props.height}
width={this.props.width} width={this.props.width}
......
...@@ -764,7 +764,7 @@ export default class BalanceSheet extends Component { ...@@ -764,7 +764,7 @@ export default class BalanceSheet extends Component {
name: "Account", name: "Account",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#354960', width: 300 }}> <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
...@@ -787,8 +787,8 @@ export default class BalanceSheet extends Component { ...@@ -787,8 +787,8 @@ export default class BalanceSheet extends Component {
name: "31 Dec 2020 Actual", name: "31 Dec 2020 Actual",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
setCellProps: () => ({ style2 }), setCellProps: () => ({ style2 }),
...@@ -859,7 +859,7 @@ export default class BalanceSheet extends Component { ...@@ -859,7 +859,7 @@ export default class BalanceSheet extends Component {
name: "Jan 2021", name: "Jan 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
...@@ -931,7 +931,7 @@ export default class BalanceSheet extends Component { ...@@ -931,7 +931,7 @@ export default class BalanceSheet extends Component {
name: "Feb 2021", name: "Feb 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
...@@ -1003,7 +1003,7 @@ export default class BalanceSheet extends Component { ...@@ -1003,7 +1003,7 @@ export default class BalanceSheet extends Component {
name: "Mar 2021", name: "Mar 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
...@@ -1075,7 +1075,7 @@ export default class BalanceSheet extends Component { ...@@ -1075,7 +1075,7 @@ export default class BalanceSheet extends Component {
name: "Apr 2021", name: "Apr 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
...@@ -1147,7 +1147,7 @@ export default class BalanceSheet extends Component { ...@@ -1147,7 +1147,7 @@ export default class BalanceSheet extends Component {
name: "May 2021", name: "May 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
...@@ -1219,7 +1219,7 @@ export default class BalanceSheet extends Component { ...@@ -1219,7 +1219,7 @@ export default class BalanceSheet extends Component {
name: "Jun 2021", name: "Jun 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
...@@ -1291,7 +1291,7 @@ export default class BalanceSheet extends Component { ...@@ -1291,7 +1291,7 @@ export default class BalanceSheet extends Component {
name: "Jul 2021", name: "Jul 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
...@@ -1363,7 +1363,7 @@ export default class BalanceSheet extends Component { ...@@ -1363,7 +1363,7 @@ export default class BalanceSheet extends Component {
name: "Aug 2021", name: "Aug 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
...@@ -1435,7 +1435,7 @@ export default class BalanceSheet extends Component { ...@@ -1435,7 +1435,7 @@ export default class BalanceSheet extends Component {
name: "Sep 2021", name: "Sep 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
...@@ -1507,7 +1507,7 @@ export default class BalanceSheet extends Component { ...@@ -1507,7 +1507,7 @@ export default class BalanceSheet extends Component {
name: "Oct 2021", name: "Oct 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
...@@ -1579,7 +1579,7 @@ export default class BalanceSheet extends Component { ...@@ -1579,7 +1579,7 @@ export default class BalanceSheet extends Component {
name: "Nov 2021", name: "Nov 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
...@@ -1651,7 +1651,7 @@ export default class BalanceSheet extends Component { ...@@ -1651,7 +1651,7 @@ export default class BalanceSheet extends Component {
name: "Dec 2021", name: "Dec 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
...@@ -1723,8 +1723,8 @@ export default class BalanceSheet extends Component { ...@@ -1723,8 +1723,8 @@ export default class BalanceSheet extends Component {
name: "Current Total", name: "Current Total",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
setCellProps: () => ({ style2 }), setCellProps: () => ({ style2 }),
...@@ -1795,8 +1795,8 @@ export default class BalanceSheet extends Component { ...@@ -1795,8 +1795,8 @@ export default class BalanceSheet extends Component {
name: "31 Dec 2022 Total", name: "31 Dec 2022 Total",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
setCellProps: () => ({ style2 }), setCellProps: () => ({ style2 }),
...@@ -1867,8 +1867,8 @@ export default class BalanceSheet extends Component { ...@@ -1867,8 +1867,8 @@ export default class BalanceSheet extends Component {
name: "31 Dec 2023 Total", name: "31 Dec 2023 Total",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
setCellProps: () => ({ style2 }), setCellProps: () => ({ style2 }),
...@@ -1957,7 +1957,7 @@ export default class BalanceSheet extends Component { ...@@ -1957,7 +1957,7 @@ export default class BalanceSheet extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
<div style={{ marginTop: 20, width: this.props.width - 200, height: this.props.height - 400 }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) , height: this.props.height - 400 }}>
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={dataTable2} data={dataTable2}
......
...@@ -373,14 +373,6 @@ export default function MiniDrawer() { ...@@ -373,14 +373,6 @@ export default function MiniDrawer() {
}) })
} }
if (sessionStorage.getItem('reloaded') != null) {
console.log('page was reloaded');
} else {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}
sessionStorage.setItem('reloaded', 'yes');
const logout = () => { const logout = () => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -649,7 +641,7 @@ export default function MiniDrawer() { ...@@ -649,7 +641,7 @@ export default function MiniDrawer() {
key={index} key={index}
path={route.path} path={route.path}
// exact={route.exact} // exact={route.exact}
children={<route.main height={height} width={width} />} children={<route.main height={height} width={width} open={open}/>}
/> />
))} ))}
</Switch> </Switch>
......
...@@ -678,7 +678,7 @@ export default class CreateParameter extends Component { ...@@ -678,7 +678,7 @@ export default class CreateParameter extends Component {
margin="normal" margin="normal"
id="start_date" id="start_date"
label="Valid From" label="Valid From"
format="dd MMMM yyyy" format="dd-MM-yyyy"
value={this.state.tempData === null ? '' : this.state.tempData.start_date} value={this.state.tempData === null ? '' : this.state.tempData.start_date}
error={this.state.errorStartDate} error={this.state.errorStartDate}
helperText={this.state.msgErrorStartDate} helperText={this.state.msgErrorStartDate}
...@@ -846,7 +846,7 @@ export default class CreateParameter extends Component { ...@@ -846,7 +846,7 @@ export default class CreateParameter extends Component {
margin="normal" margin="normal"
id="end_date" id="end_date"
label="Valid To" label="Valid To"
format="dd MMMM yyyy" format="dd-MM-yyyy"
error={this.state.errorEndDate} error={this.state.errorEndDate}
helperText={this.state.msgErrorEndDate} helperText={this.state.msgErrorEndDate}
minDate={this.state.tempData === null ? null : this.state.tempData.start_date} minDate={this.state.tempData === null ? null : this.state.tempData.start_date}
...@@ -1057,7 +1057,7 @@ export default class CreateParameter extends Component { ...@@ -1057,7 +1057,7 @@ export default class CreateParameter extends Component {
margin="normal" margin="normal"
id="startDate" id="startDate"
label="Valid From" label="Valid From"
format="dd MMMM yyyy" format="dd-MM-yyyy"
error={this.state.errorStartDate} error={this.state.errorStartDate}
helperText={this.state.msgErrorStartDate} helperText={this.state.msgErrorStartDate}
value={this.state.startDate == "" ? null : this.state.startDate} value={this.state.startDate == "" ? null : this.state.startDate}
...@@ -1216,7 +1216,7 @@ export default class CreateParameter extends Component { ...@@ -1216,7 +1216,7 @@ export default class CreateParameter extends Component {
margin="normal" margin="normal"
id="endDate" id="endDate"
label="Valid To" label="Valid To"
format="dd MMMM yyyy" format="dd-MM-yyyy"
error={this.state.errorEndDate} error={this.state.errorEndDate}
helperText={this.state.msgErrorEndDate} helperText={this.state.msgErrorEndDate}
minDate={this.state.startDate} minDate={this.state.startDate}
......
...@@ -2,7 +2,7 @@ import React, { Component } from 'react'; ...@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles'; import { createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import Images from '../../../assets/Images'; import Images from '../../../assets/Images';
import MUIDataTable from "mui-datatables"; import MUIDataTable from "mui-datatables";
import { InputBase, Snackbar, withStyles } from "@material-ui/core"; import { InputBase, Snackbar, withStyles, Typography } from "@material-ui/core";
import MuiAlert from '@material-ui/lab/Alert'; import MuiAlert from '@material-ui/lab/Alert';
import CreateParameter from '../Parameter/CreateParameter'; import CreateParameter from '../Parameter/CreateParameter';
import api from '../../../api'; import api from '../../../api';
...@@ -268,16 +268,16 @@ export default class Parameter extends Component { ...@@ -268,16 +268,16 @@ export default class Parameter extends Component {
if (item.length > 0) { if (item.length > 0) {
payload.push({ payload.push({
id: index + 1, id: index + 1,
group: item[0], group: item[0] === undefined ? "" : item[0] ,
parameter: item[1], parameter: item[1] === undefined ? "" : item[1],
company: item[2], company: item[2] === undefined ? "" : item[2],
description: item[3], description: item[3],
orders: item[4], orders: item[4],
value: item[5], value: item[5],
min_value: item[6], min_value: item[6],
max_value: item[7], max_value: item[7],
start_date: item[8], start_date: item[8] === undefined ? "" : item[8],
end_date: item[9], end_date: item[9] === undefined ? "" : item[9],
}) })
} }
}) })
...@@ -329,9 +329,9 @@ export default class Parameter extends Component { ...@@ -329,9 +329,9 @@ export default class Parameter extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[11] != null && check > -1 ? {tableMeta.rowData[11] != null && check > -1 ?
<a data-tip={tableMeta.rowData[11][check].message} data-for="group"> <a data-tip={tableMeta.rowData[11][check].message} data-for="group">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
} }
<ReactTooltip border={true} id="group" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="group" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -354,9 +354,9 @@ export default class Parameter extends Component { ...@@ -354,9 +354,9 @@ export default class Parameter extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[11] != null && check > -1 ? {tableMeta.rowData[11] != null && check > -1 ?
<a data-tip={tableMeta.rowData[11][check].message} data-for="parameter"> <a data-tip={tableMeta.rowData[11][check].message} data-for="parameter">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
} }
<ReactTooltip border={true} id="parameter" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="parameter" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -379,9 +379,9 @@ export default class Parameter extends Component { ...@@ -379,9 +379,9 @@ export default class Parameter extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[11] != null && check > -1 ? {tableMeta.rowData[11] != null && check > -1 ?
<a data-tip={tableMeta.rowData[11][check].message} data-for="company"> <a data-tip={tableMeta.rowData[11][check].message} data-for="company">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
} }
<ReactTooltip border={true} id="company" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="company" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -529,9 +529,9 @@ export default class Parameter extends Component { ...@@ -529,9 +529,9 @@ export default class Parameter extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[11] != null && check > -1 ? {tableMeta.rowData[11] != null && check > -1 ?
<a data-tip={tableMeta.rowData[11][check].message} data-for="start_date"> <a data-tip={tableMeta.rowData[11][check].message} data-for="start_date">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
} }
<ReactTooltip border={true} id="start_date" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="start_date" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -554,9 +554,9 @@ export default class Parameter extends Component { ...@@ -554,9 +554,9 @@ export default class Parameter extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[11] != null && check > -1 ? {tableMeta.rowData[11] != null && check > -1 ?
<a data-tip={tableMeta.rowData[11][check].message} data-for="enddate"> <a data-tip={tableMeta.rowData[11][check].message} data-for="enddate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
} }
<ReactTooltip border={true} id="enddate" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="enddate" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -797,8 +797,8 @@ export default class Parameter extends Component { ...@@ -797,8 +797,8 @@ export default class Parameter extends Component {
{this.state.visibleParameter === true ? {this.state.visibleParameter === true ?
<div> <div>
{this.state.load && ( {this.state.load && (
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -180 }}> <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -182 }}>
<label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Parameter</label> <label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '40%', }}>Parameter</label>
{/* <div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}> {/* <div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}>
<img src={Images.searchBlack} style={{ marginRight: 10 }} /> <img src={Images.searchBlack} style={{ marginRight: 10 }} />
<InputBase <InputBase
...@@ -809,7 +809,7 @@ export default class Parameter extends Component { ...@@ -809,7 +809,7 @@ export default class Parameter extends Component {
inputProps={{ 'aria-label': 'naked' }} inputProps={{ 'aria-label': 'naked' }}
/> />
</div> */} </div> */}
<div style={{ width: '30%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <div style={{ width: '40%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template"> <a data-tip={'Download Template'} data-for="template">
<button <button
style={{ style={{
......
...@@ -59,14 +59,15 @@ export default class UnitBisnis extends Component { ...@@ -59,14 +59,15 @@ export default class UnitBisnis extends Component {
} }
else { else {
let isi = resp.rows.slice(3) let isi = resp.rows.slice(3)
console.log(isi);
let payload = [] let payload = []
isi.map((item, index) => { isi.map((item, index) => {
if (item.length > 0) { if (item.length > 0) {
payload.push({ payload.push({
id: index + 1, id: index + 1,
business_unit_name: item[0], business_unit_name: item[0] === undefined ? "" : item[0],
start_date: item[1], start_date: item[1] == undefined ? "" : item[1],
end_date: item[2], end_date: item[2] === undefined ? "" : item[2],
}) })
} }
}) })
...@@ -88,7 +89,6 @@ export default class UnitBisnis extends Component { ...@@ -88,7 +89,6 @@ export default class UnitBisnis extends Component {
if (response.data.status === "success") { if (response.data.status === "success") {
dataRow = response.data.data.map((item, index) => { dataRow = response.data.data.map((item, index) => {
return [ return [
index + 1,
item.business_unit_name, item.business_unit_name,
item.start_date, item.start_date,
item.end_date, item.end_date,
...@@ -96,25 +96,24 @@ export default class UnitBisnis extends Component { ...@@ -96,25 +96,24 @@ export default class UnitBisnis extends Component {
] ]
}) })
let columns = [ let columns = [
"Data",
{ {
name: "Business Unit", name: "Business Unit",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[4] != null) { if (tableMeta.rowData[3] != null) {
check = tableMeta.rowData[4].findIndex((val) => val.field.includes('business_unit_name')) check = tableMeta.rowData[3].findIndex((val) => val.field.includes('business_unit_name'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[4] != null && check > -1 ? {tableMeta.rowData[3] != null && check > -1 ?
<a data-tip={tableMeta.rowData[4][check].message} data-for="unitbisnis"> <a data-tip={tableMeta.rowData[3][check].message} data-for="unitbisnis">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
} }
<ReactTooltip border={true} id="unitbisnis" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="unitbisnis" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -127,19 +126,19 @@ export default class UnitBisnis extends Component { ...@@ -127,19 +126,19 @@ export default class UnitBisnis extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[4] != null) { if (tableMeta.rowData[3] != null) {
check = tableMeta.rowData[4].findIndex((val) => val.field.includes('start_date')) check = tableMeta.rowData[3].findIndex((val) => val.field.includes('start_date'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[4] != null && check > -1 ? {tableMeta.rowData[3] != null && check > -1 ?
<a data-tip={tableMeta.rowData[4][check].message} data-for="startdate"> <a data-tip={tableMeta.rowData[3][check].message} data-for="startdate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
} }
<ReactTooltip border={true} id="startdate" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="startdate" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -152,19 +151,19 @@ export default class UnitBisnis extends Component { ...@@ -152,19 +151,19 @@ export default class UnitBisnis extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[4] != null) { if (tableMeta.rowData[3] != null) {
check = tableMeta.rowData[4].findIndex((val) => val.field.includes('end_date')) check = tableMeta.rowData[3].findIndex((val) => val.field.includes('end_date'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[4] != null && check > -1 ? {tableMeta.rowData[3] != null && check > -1 ?
<a data-tip={tableMeta.rowData[4][check].message} data-for="enddate"> <a data-tip={tableMeta.rowData[3][check].message} data-for="enddate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span>
} }
<ReactTooltip border={true} id="enddate" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="enddate" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -511,8 +510,8 @@ export default class UnitBisnis extends Component { ...@@ -511,8 +510,8 @@ export default class UnitBisnis extends Component {
{this.state.visibleUnitBisnis === true ? {this.state.visibleUnitBisnis === true ?
this.state.load && ( this.state.load && (
<div> <div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -180 }}> <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -182 }}>
<label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Master Data - Business Unit</label> <label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '50%', }}>Master Data - Business Unit</label>
{/* <div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}> {/* <div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}>
<img src={Images.searchBlack} style={{ marginRight: 10 }} /> <img src={Images.searchBlack} style={{ marginRight: 10 }} />
<InputBase <InputBase
...@@ -523,7 +522,7 @@ export default class UnitBisnis extends Component { ...@@ -523,7 +522,7 @@ export default class UnitBisnis extends Component {
inputProps={{ 'aria-label': 'naked' }} inputProps={{ 'aria-label': 'naked' }}
/> />
</div> */} </div> */}
<div style={{ width: '30%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <div style={{ width: '50%', justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template"> <a data-tip={'Download Template'} data-for="template">
<button <button
style={{ style={{
......
...@@ -215,7 +215,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -215,7 +215,7 @@ export default class CreateUnitBisnis extends Component {
margin="normal" margin="normal"
id="startDate" id="startDate"
label="Valid From" label="Valid From"
format="dd MMMM yyyy" format="dd-MM-yyyy"
value={this.state.startDate} value={this.state.startDate}
onChange={(e) => this.handleChange(e, 'start_date')} onChange={(e) => this.handleChange(e, 'start_date')}
KeyboardButtonProps={{ KeyboardButtonProps={{
...@@ -300,7 +300,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -300,7 +300,7 @@ export default class CreateUnitBisnis extends Component {
margin="normal" margin="normal"
id="startDate" id="startDate"
label="Valid To" label="Valid To"
format="dd MMMM yyyy" format="dd-MM-yyyy"
error={this.state.errorEndDate} error={this.state.errorEndDate}
helperText={this.state.msgErrorEndDate} helperText={this.state.msgErrorEndDate}
minDate={this.state.startDate} minDate={this.state.startDate}
...@@ -403,7 +403,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -403,7 +403,7 @@ export default class CreateUnitBisnis extends Component {
margin="normal" margin="normal"
id="startDate" id="startDate"
label="Valid From" label="Valid From"
format="dd MMMM yyyy" format="dd-MM-yyyy"
value={this.state.startDate == "" ? null : this.state.startDate} value={this.state.startDate == "" ? null : this.state.startDate}
onChange={(e) => this.handleChange(e, 'start_date')} onChange={(e) => this.handleChange(e, 'start_date')}
KeyboardButtonProps={{ KeyboardButtonProps={{
...@@ -482,7 +482,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -482,7 +482,7 @@ export default class CreateUnitBisnis extends Component {
margin="normal" margin="normal"
id="endDate" id="endDate"
label="Valid To" label="Valid To"
format="dd MMMM yyyy" format="dd-MM-yyyy"
error={this.state.errorEndDate} error={this.state.errorEndDate}
helperText={this.state.msgErrorEndDate} helperText={this.state.msgErrorEndDate}
minDate={this.state.startDate} minDate={this.state.startDate}
......
...@@ -119,6 +119,8 @@ export default class Profile extends Component { ...@@ -119,6 +119,8 @@ export default class Profile extends Component {
setTimeout(() => { setTimeout(() => {
window.location.reload(); window.location.reload();
}, 1000); }, 1000);
} else if (response.data.message === "Old Password is Not Correct") {
this.setState({ errorOldPassword: true, msgOldPassword: 'Incorrect password.' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Token")) {
......
...@@ -166,6 +166,7 @@ exports.customTable = function () { ...@@ -166,6 +166,7 @@ exports.customTable = function () {
toolButton: { toolButton: {
display: "flex", display: "flex",
height: "auto", height: "auto",
whiteSpace: 'nowrap'
}, },
data: { data: {
display: "inline-block", display: "inline-block",
...@@ -445,11 +446,15 @@ exports.customTable3 = function () { ...@@ -445,11 +446,15 @@ exports.customTable3 = function () {
fontSize: "10pt" fontSize: "10pt"
} }
}, },
ColorPallete3: {
backgroundColor: '#37b5e6'
},
MuiTableCell: { MuiTableCell: {
root: { root: {
display: 'table-cell', display: 'table-cell',
padding: 7, padding: 7,
paddingLeft: 25, paddingLeft: 25,
paddingRight: 25,
fontSize: '0.875rem', fontSize: '0.875rem',
textAlign: 'left', textAlign: 'left',
fontFamily: "Roboto, Helvetica, Arial, sans-serif", fontFamily: "Roboto, Helvetica, Arial, sans-serif",
......
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