Commit baa2462a authored by Deni Rinaldi's avatar Deni Rinaldi

push sebelum liburan

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