Commit 45c7e72d authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

apdettt

See merge request !811
parents 8768c9e1 8f7ba2d0
...@@ -6,10 +6,15 @@ ...@@ -6,10 +6,15 @@
"dependencies": { "dependencies": {
"@date-io/date-fns": "^1.3.13", "@date-io/date-fns": "^1.3.13",
"@date-io/moment": "^2.8.0", "@date-io/moment": "^2.8.0",
"@devexpress/dx-react-chart": "^2.7.3",
"@devexpress/dx-react-chart-material-ui": "^2.7.3",
"@devexpress/dx-react-core": "^2.7.3",
"@material-ui/core": "^4.11.0", "@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1", "@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.56", "@material-ui/lab": "^4.0.0-alpha.56",
"@material-ui/pickers": "^3.2.10", "@material-ui/pickers": "^3.2.10",
"@nivo/bar": "^0.67.0",
"@nivo/core": "^0.67.0",
"@testing-library/jest-dom": "^4.2.4", "@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0", "@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1", "@testing-library/user-event": "^7.2.1",
......
...@@ -184,8 +184,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -184,8 +184,8 @@ export default class CorporateAnnualTarget extends Component {
item.description === 'ROIC' ? Number(item.cat.march).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1)) : { value: item.cat.march, formula: item.cat.march_formula } : (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.march).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1)) : { value: item.cat.march, formula: item.cat.march_formula } : (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1)),
item.description === 'ROIC' ? Number(item.cat.april).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1)) : { value: item.cat.april, formula: item.cat.april_formula } : (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.april).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1)) : { value: item.cat.april, formula: item.cat.april_formula } : (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1)),
item.description === 'ROIC' ? Number(item.cat.may).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1)) : { value: item.cat.may, formula: item.cat.may_formula } : (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.may).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1)) : { value: item.cat.may, formula: item.cat.may_formula } : (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1)),
item.description === 'ROIC' ? Number(item.cat.may).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)) : { value: item.cat.june, formula: item.cat.june_formula } : item.description === 'ROIC' ? Number(item.cat.june).toFixed(1) : (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.june).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)) : { value: item.cat.june, formula: item.cat.june_formula } : item.description === 'ROIC' ? Number(item.cat.june).toFixed(1) : (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)),
item.description === 'ROIC' ? Number(item.cat.may).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)) : { value: item.cat.july, formula: item.cat.july_formula } : item.description === 'ROIC' ? Number(item.cat.july).toFixed(1) : (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.july).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)) : { value: item.cat.july, formula: item.cat.july_formula } : item.description === 'ROIC' ? Number(item.cat.july).toFixed(1) : (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)),
item.description === 'ROIC' ? Number(item.cat.august).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1)) : { value: item.cat.august, formula: item.cat.august_formula } : (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.august).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1)) : { value: item.cat.august, formula: item.cat.august_formula } : (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1)),
item.description === 'ROIC' ? Number(item.cat.september).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1)) : { value: item.cat.september, formula: item.cat.september_formula } : (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.september).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1)) : { value: item.cat.september, formula: item.cat.september_formula } : (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1)),
item.description === 'ROIC' ? Number(item.cat.october).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1)) : { value: item.cat.october, formula: item.cat.october_formula } : (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.october).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3? (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1)) : { value: item.cat.october, formula: item.cat.october_formula } : (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1)),
...@@ -228,8 +228,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -228,8 +228,8 @@ export default class CorporateAnnualTarget extends Component {
item.description === 'ROIC' ? Number(item.cat.march).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.march, formula: item.cat.march_formula } : (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.march).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.march, formula: item.cat.march_formula } : (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1)),
item.description === 'ROIC' ? Number(item.cat.april).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.april, formula: item.cat.april_formula } : (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.april).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.april, formula: item.cat.april_formula } : (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1)),
item.description === 'ROIC' ? Number(item.cat.may).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.may, formula: item.cat.may_formula } : (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.may).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.may, formula: item.cat.may_formula } : (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1)),
item.description === 'ROIC' ? Number(item.cat.may).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.june, formula: item.cat.june_formula } : item.description === 'ROIC' ? Number(item.cat.june).toFixed(1) : (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.june).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.june, formula: item.cat.june_formula } : item.description === 'ROIC' ? Number(item.cat.june).toFixed(1) : (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)),
item.description === 'ROIC' ? Number(item.cat.may).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.july, formula: item.cat.july_formula } : item.description === 'ROIC' ? Number(item.cat.july).toFixed(1) : (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.july).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.july, formula: item.cat.july_formula } : item.description === 'ROIC' ? Number(item.cat.july).toFixed(1) : (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)),
item.description === 'ROIC' ? Number(item.cat.august).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.august, formula: item.cat.august_formula } : (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.august).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.august, formula: item.cat.august_formula } : (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1)),
item.description === 'ROIC' ? Number(item.cat.september).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.september, formula: item.cat.september_formula } : (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.september).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.september, formula: item.cat.september_formula } : (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1)),
item.description === 'ROIC' ? Number(item.cat.october).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.october, formula: item.cat.october_formula } : (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.october).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.october, formula: item.cat.october_formula } : (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1)),
......
...@@ -217,6 +217,11 @@ export default function MiniDrawer() { ...@@ -217,6 +217,11 @@ export default function MiniDrawer() {
label: 'CAT Dashboard', label: 'CAT Dashboard',
path: 'dashboard-cat', path: 'dashboard-cat',
}, },
{
img: 'beranda',
label: 'Financial Dashboard',
path: 'dashboard-financial',
},
{ {
img: 'beranda', img: 'beranda',
label: 'Summary of Triputra Group', label: 'Summary of Triputra Group',
......
import * as React from 'react';
import Paper from '@material-ui/core/Paper';
import { ResponsiveBar } from '@nivo/bar'
import { Snackbar, TextField, Typography, withStyles } from '@material-ui/core';
import MuiAlert from '@material-ui/lab/Alert';
import { Autocomplete } from '@material-ui/lab';
import { titleCase } from '../../library/Utils';
import api from '../../api';
import Constant from '../../library/Constant';
const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
// make sure parent container have a defined height when using
// responsive component, otherwise height will be 0 and
// no chart will be rendered.
// website examples showcase many properties,
// you'll often use just a few of them.
// const MyResponsiveBar = ({ data /* see data tab */ }) => (
// )
export default class DashboardFinancial extends React.Component {
constructor(props) {
super(props);
this.state = {
data: [
{
"country": "AD",
"hot dog": 6,
"hot dogColor": "hsl(228, 70%, 50%)",
"burger": 53,
"burgerColor": "hsl(29, 70%, 50%)",
"sandwich": 74,
"sandwichColor": "hsl(148, 70%, 50%)",
"kebab": 132,
"kebabColor": "hsl(54, 70%, 50%)",
"fries": 46,
"friesColor": "hsl(2, 70%, 50%)",
"donut": 146,
"donutColor": "hsl(60, 70%, 50%)"
},
{
"country": "AE",
"hot dog": 167,
"hot dogColor": "hsl(340, 70%, 50%)",
"burger": 133,
"burgerColor": "hsl(160, 70%, 50%)",
"sandwich": 46,
"sandwichColor": "hsl(330, 70%, 50%)",
"kebab": 68,
"kebabColor": "hsl(298, 70%, 50%)",
"fries": 11,
"friesColor": "hsl(89, 70%, 50%)",
"donut": 119,
"donutColor": "hsl(40, 70%, 50%)"
},
{
"country": "AF",
"hot dog": 60,
"hot dogColor": "hsl(188, 70%, 50%)",
"burger": 120,
"burgerColor": "hsl(252, 70%, 50%)",
"sandwich": 138,
"sandwichColor": "hsl(152, 70%, 50%)",
"kebab": 45,
"kebabColor": "hsl(256, 70%, 50%)",
"fries": 132,
"friesColor": "hsl(201, 70%, 50%)",
"donut": 130,
"donutColor": "hsl(191, 70%, 50%)"
},
{
"country": "AG",
"hot dog": 84,
"hot dogColor": "hsl(356, 70%, 50%)",
"burger": 102,
"burgerColor": "hsl(161, 70%, 50%)",
"sandwich": 157,
"sandwichColor": "hsl(177, 70%, 50%)",
"kebab": 65,
"kebabColor": "hsl(74, 70%, 50%)",
"fries": 105,
"friesColor": "hsl(82, 70%, 50%)",
"donut": 90,
"donutColor": "hsl(138, 70%, 50%)"
},
{
"country": "AI",
"hot dog": 144,
"hot dogColor": "hsl(102, 70%, 50%)",
"burger": 62,
"burgerColor": "hsl(308, 70%, 50%)",
"sandwich": 59,
"sandwichColor": "hsl(101, 70%, 50%)",
"kebab": 117,
"kebabColor": "hsl(152, 70%, 50%)",
"fries": 57,
"friesColor": "hsl(297, 70%, 50%)",
"donut": 34,
"donutColor": "hsl(319, 70%, 50%)"
},
{
"country": "AL",
"hot dog": 84,
"hot dogColor": "hsl(288, 70%, 50%)",
"burger": 93,
"burgerColor": "hsl(288, 70%, 50%)",
"sandwich": 23,
"sandwichColor": "hsl(64, 70%, 50%)",
"kebab": 128,
"kebabColor": "hsl(118, 70%, 50%)",
"fries": 199,
"friesColor": "hsl(125, 70%, 50%)",
"donut": 184,
"donutColor": "hsl(334, 70%, 50%)"
},
{
"country": "AM",
"hot dog": 44,
"hot dogColor": "hsl(239, 70%, 50%)",
"burger": 17,
"burgerColor": "hsl(306, 70%, 50%)",
"sandwich": 58,
"sandwichColor": "hsl(317, 70%, 50%)",
"kebab": 51,
"kebabColor": "hsl(148, 70%, 50%)",
"fries": 151,
"friesColor": "hsl(344, 70%, 50%)",
"donut": 174,
"donutColor": "hsl(190, 70%, 50%)"
}
],
};
}
componentDidMount() {
console.log(this.props.height)
}
getDetailUser() {
let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => {
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ userCompany: response.data.data.company }, () => {
this.getCompanyActive()
})
}
}
}
})
}
getCompanyActive() {
api.create().getPerusahaanActive().then((response) => {
// console.log(response);
if (response.data) {
if (response.data.status === 'success') {
let data = response.data.data
let comID = this.state.rawData ? this.state.rawData.company_id : 0
let companyData = data.map((item) => {
return {
company_id: item.company_id,
company_name: item.company_name,
}
})
let arrayBaru = []
this.state.userCompany.map((item, index) => {
let indexID = companyData.findIndex((val) => val.company_id == item)
if (indexID !== -1) {
arrayBaru.push(companyData[indexID])
}
})
let defaultProps = {
options: arrayBaru,
getOptionLabel: (option) => titleCase(option.company_name),
};
let index = arrayBaru.findIndex((val) => val.company_id == comID)
this.setState({ listCompany: defaultProps, company: arrayBaru.length < 1 ? companyData[0] : (index == -1 ? arrayBaru[0] : arrayBaru[index]) }, () => {
this.getLastPeriod()
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', listCompany: null, company: null })
}
})
}
getLastPeriod() {
api.create().getLastPeriod(this.state.company.company_id).then(response => {
// console.log(response);
if (response.data.status === "success") {
this.setState({ lastPeriod: response.data.data.last_periode, latestPeriode: response.data.data.latest_periode }, () => {
this.getPeriode()
})
}
})
}
getPeriode() {
api.create().getPeriodeTransaction().then(response => {
let currentYear = new Date().getFullYear()
// console.log(currentYear)
if (response.data) {
if (response.data.status === "success") {
let data = []
response.data.data.map((item) => {
if (this.state.isApprover) {
if (item >= 2000 && item <= (Number(currentYear) + 1)) {
data.push(item)
}
} else {
if ((item >= 2000) && (item == this.state.lastPeriod || item < this.state.lastPeriod)) {
data.push(item)
}
}
})
let periodeData = data.map((item) => {
return {
periode: item,
}
})
let defaultProps = {
options: periodeData,
getOptionLabel: (option) => option.periode,
};
let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod)
let index = data.sort((a, b) => a - b).findIndex((val) => val === periode)
// console.log(data)
// console.log(this.state.latestPeriode)
// console.log(periodeData)
// console.log(index)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
// this.getDataTable()
// this.getSubmission()
this.getReportType()
// if (this.state.isApprover === true) {
// this.getCompanySubmitted()
// } else {
// this.getRevision()
// }
})
}
}
})
}
getReportType() {
let payload = {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode,
"report_type": "Master Budget",
}
api.create().getReportTypeBody(payload).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
if (this.state.report.value === 2) {
response.data.data.map((item, index) => {
if (item.report_name === 'Balance Sheet') {
this.setState({ revisionType: item.revision }, ()=> {
this.getSubmission()
})
}
})
} else if (this.state.report.value === 1) {
response.data.data.map((item, index) => {
if (item.report_name === 'Profit Loss') {
this.setState({ revisionType: item.revision }, ()=> {
this.getSubmission()
})
}
})
} else {
this.setState({ revisionType: 0 }, ()=> {
this.getSubmission()
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
render() {
const { data: chartData } = this.state;
return (
<div style={{ flex: 1, backgroundColor: '#f8f8f8' }} ref={this.myRef}>
<div>
<div className={"main-color"} style={{ height: 78, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Dashboard Financial</Typography>
</div>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert}
</Alert>
</Snackbar>
<div style={{ padding: 20, width: '100%' }}>
<Paper style={{ paddingTop: 10 , height: this.props.height}}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>FINANCIAL SUMMARY OF TRIPUTRA GROUP</Typography>
</div>
<div style={{ minWidth: 'max-content', padding: '20px 20px 0px 20px' }}>
<div style={{ marginTop: 15 }}>
<Autocomplete
options={this.state.reportType}
getOptionLabel={(option) => titleCase(option.label)}
id="typereport"
onChange={(event, newInputValue) => this.setState({ report: newInputValue, loading: true, previewTable: false }, () => {
this.getReportType()
})}
disableClearable
style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Report Type" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.report}
/>
</div>
<div style={{ marginTop: 15 }}>
<Autocomplete
{...this.state.listCompany}
id="company"
disabled={this.state.intent === 'Home' ? true : false}
onChange={(event, newInputValue) => this.setState({ company: newInputValue, loading: true, previewTable: false }, () => {
this.getReportType()
})}
disableClearable
style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.company}
/>
</div>
<div style={{ marginTop: 15 }}>
<Autocomplete
{...this.state.listPeriode}
id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue, loading: true, previewTable: false }, () => {
this.getReportType()
})}
disabled={this.state.intent === 'Home' ? true : false}
disableClearable
style={{ width: 250 }}
renderInput={(params) =>
<TextField {...params} label="Period" margin="normal" style={{ marginTop: 7 }}
/>}
value={this.state.periode}
/>
</div>
</div>
<div style={{height: Number(0.3 * this.props.height)}}>
<ResponsiveBar
data={chartData}
keys={[ 'hot dog', 'burger', 'sandwich', 'kebab', 'fries', 'donut' ]}
indexBy="country"
margin={{ top: 50, right: 130, bottom: 50, left: 60 }}
padding={0.3}
groupMode="grouped"
valueScale={{ type: 'linear' }}
indexScale={{ type: 'band', round: true }}
colors={{ scheme: 'nivo' }}
defs={[
{
id: 'dots',
type: 'patternDots',
background: 'inherit',
color: '#38bcb2',
size: 4,
padding: 1,
stagger: true
},
{
id: 'lines',
type: 'patternLines',
background: 'inherit',
color: '#eed312',
rotation: -45,
lineWidth: 6,
spacing: 10
}
]}
fill={[
{
match: {
id: 'fries'
},
id: 'dots'
},
{
match: {
id: 'sandwich'
},
id: 'lines'
}
]}
borderColor={{ from: 'color', modifiers: [ [ 'darker', 1.6 ] ] }}
axisTop={null}
axisRight={null}
axisBottom={{
tickSize: 5,
tickPadding: 5,
tickRotation: 0,
legend: 'country',
legendPosition: 'middle',
legendOffset: 32
}}
axisLeft={{
tickSize: 5,
tickPadding: 5,
tickRotation: 0,
legend: 'food',
legendPosition: 'middle',
legendOffset: -40
}}
labelSkipWidth={12}
labelSkipHeight={12}
labelTextColor={{ from: 'color', modifiers: [ [ 'darker', 1.6 ] ] }}
legends={[
{
dataFrom: 'keys',
anchor: 'bottom-right',
direction: 'column',
justify: false,
translateX: 25,
translateY: 0,
itemsSpacing: 0,
itemWidth: 20,
itemHeight: 24,
itemDirection: 'left-to-right',
itemOpacity: 0.85,
symbolSize: 17,
effects: [
{
on: 'hover',
style: {
itemOpacity: 1
}
}
]
}
]}
animate={true}
motionStiffness={90}
motionDamping={15}
/>
</div>
</Paper>
</div>
</div>
</div>
);
}
}
...@@ -86,7 +86,9 @@ export default class ListOfCreditFacilities extends Component { ...@@ -86,7 +86,9 @@ export default class ListOfCreditFacilities extends Component {
perBS: 0, perBS: 0,
snekbar: false, snekbar: false,
snekbarMsg: '', snekbarMsg: '',
visibleLOCFMR: true visibleLOCFMR: true,
saveDraft: true,
saveComp: true
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -303,8 +305,8 @@ export default class ListOfCreditFacilities extends Component { ...@@ -303,8 +305,8 @@ export default class ListOfCreditFacilities extends Component {
) )
} }
this.getPerBS() this.getPerBS()
// console.log(dataTable) console.log(dataTable)
this.setState({ dataTable, loading: false }, () => { this.setState({ dataTable, loading: false, visibleLOCFMR: true, totalOutStand: 0, diff: 0 }, () => {
this.handleCalculate() this.handleCalculate()
}) })
} }
...@@ -387,11 +389,11 @@ export default class ListOfCreditFacilities extends Component { ...@@ -387,11 +389,11 @@ export default class ListOfCreditFacilities extends Component {
checkUpload() { checkUpload() {
api.create().checkUploadMonthlyReportLOCF(this.state.payload).then(response => { api.create().checkUploadMonthlyReportLOCF(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload)); console.log(JSON.stringify(this.state.payload));
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleLOCFMR: false, loading: true }) this.setState({ visibleUpload: false, loading: true, visibleLOCFMR: false, totalOutStand: 0, diff: 0 })
let dataTable = [] let dataTable = []
response.data.data.map((item, index) => { response.data.data.map((item, index) => {
if (index == response.data.data.length -1) { if (index == response.data.data.length -1) {
...@@ -401,13 +403,12 @@ export default class ListOfCreditFacilities extends Component { ...@@ -401,13 +403,12 @@ export default class ListOfCreditFacilities extends Component {
item.parent, item.parent,
item.formula, item.formula,
item.level, item.level,
// item.description, item.borrower_comp_name === null ? this.props.company.company_name : item.borrower_comp_name === "" ? this.props.company.company_name : item.borrower_comp_name,
item.borrower_comp_name === null ? "" : item.borrower_comp_name === "" ? "" : item.borrower_comp_name,
item.bank_name === null ? null : item.bank_name === "" ? null : {value: item.bank_name}, item.bank_name === null ? null : item.bank_name === "" ? null : {value: item.bank_name},
item.type_of_credit === null ? null : item.type_of_credit === "" ? null : {value: item.type_of_credit}, item.type_of_credit === null ? null : item.type_of_credit === "" ? null : {value: item.type_of_credit},
item.remarks === null ? "0.0" : item.remarks === "" ? "0.0" : item.remarks, item.remarks === null ? "" : item.remarks === "" ? "" : item.remarks,
item.loan_maturity_date === null ? "0.0" : item.loan_maturity_date === "" ? "0.0" : item.loan_maturity_date, item.loan_maturity_date === null ? this.state.currentDate : item.loan_maturity_date === "" ? this.state.currentDate : item.loan_maturity_date,
item.interest === null ? "0.0" : item.interest === "" ? "0.0" : item.interest, item.interest === null ? "0" : item.interest === "" ? "0" : item.interest,
item.currency === null ? "0.0" : item.currency === "" ? "0.0" : item.currency, item.currency === null ? "0.0" : item.currency === "" ? "0.0" : item.currency,
item.loan_plafond_amount_ori, item.loan_plafond_amount_ori,
item.loan_plafond_amount_idr === null ? "0.0" : item.loan_plafond_amount_idr === "" ? "0.0" : item.loan_plafond_amount_idr, item.loan_plafond_amount_idr === null ? "0.0" : item.loan_plafond_amount_idr === "" ? "0.0" : item.loan_plafond_amount_idr,
...@@ -415,7 +416,6 @@ export default class ListOfCreditFacilities extends Component { ...@@ -415,7 +416,6 @@ export default class ListOfCreditFacilities extends Component {
item.out_loan_ki_amount_idr === null ? "0.0" : item.out_loan_ki_amount_idr === "" ? "0.0" : item.out_loan_ki_amount_idr, item.out_loan_ki_amount_idr === null ? "0.0" : item.out_loan_ki_amount_idr === "" ? "0.0" : item.out_loan_ki_amount_idr,
item.out_loan_kmk_amount_ori, item.out_loan_kmk_amount_ori,
item.out_loan_kmk_amount_idr === null ? "0.0" : item.out_loan_kmk_amount_idr === "" ? "0.0" : item.out_loan_kmk_amount_idr, item.out_loan_kmk_amount_idr === null ? "0.0" : item.out_loan_kmk_amount_idr === "" ? "0.0" : item.out_loan_kmk_amount_idr,
// item.mtd_vs_previous_month === null ? "0.0" : item.mtd_vs_previous_month === "" ? "0.0" : item.mtd_vs_previous_month,
item.out_loan_other_type, item.out_loan_other_type,
item.out_loan_other_amount_ori, item.out_loan_other_amount_ori,
item.out_loan_other_amount_idr === null ? "0.0" : item.out_loan_other_amount_idr === "" ? "0.0" : item.out_loan_other_amount_idr, item.out_loan_other_amount_idr === null ? "0.0" : item.out_loan_other_amount_idr === "" ? "0.0" : item.out_loan_other_amount_idr,
...@@ -432,20 +432,18 @@ export default class ListOfCreditFacilities extends Component { ...@@ -432,20 +432,18 @@ export default class ListOfCreditFacilities extends Component {
item.ebitda_to_interest_financial, item.ebitda_to_interest_financial,
item.ebitda_to_interest_current === null ? "0.0" : item.ebitda_to_interest_current === "" ? "0.0" : item.ebitda_to_interest_current, item.ebitda_to_interest_current === null ? "0.0" : item.ebitda_to_interest_current === "" ? "0.0" : item.ebitda_to_interest_current,
item.other_ratio1_ratio_name, item.other_ratio1_ratio_name,
item.other_ratio1_financial, item.other_ratio1_financial === null ? "0.0" : item.other_ratio1_financial === "" ? "0.0" : item.other_ratio1_financial,
item.other_ratio1_current === null ? "0.0" : item.other_ratio1_current === "" ? "0.0" : item.other_ratio1_current, item.other_ratio1_current === null ? "0.0" : item.other_ratio1_current === "" ? "0.0" : item.other_ratio1_current,
item.other_ratio2_ratio_name, item.other_ratio2_ratio_name,
item.other_ratio2_financial, item.other_ratio2_financial === null ? "0.0" : item.other_ratio2_financial === "" ? "0.0" : item.other_ratio2_financial,
item.other_ratio2_current === null ? "0.0" : item.other_ratio2_current === "" ? "0.0" : item.other_ratio2_current, item.other_ratio2_current === null ? "0.0" : item.other_ratio2_current === "" ? "0.0" : item.other_ratio2_current,
item.other_ratio3_ratio_name, item.other_ratio3_ratio_name,
item.other_ratio3_financial, item.other_ratio3_financial === null ? "0.0" : item.other_ratio3_financial === "" ? "0.0" : item.other_ratio3_financial,
item.other_ratio3_current === null ? "0.0" : item.other_ratio3_current === "" ? "0.0" : item.other_ratio3_current, item.other_ratio3_current === null ? "0.0" : item.other_ratio3_current === "" ? "0.0" : item.other_ratio3_current,
item.other_ratio4_ratio_name, item.other_ratio4_ratio_name,
item.other_ratio4_financia,, item.other_ratio4_financial === null ? "0.0" : item.other_ratio4_financial === "" ? "0.0" : item.other_ratio4_financial,
item.other_ratio4_current === null ? "0.0" : item.other_ratio4_current === "" ? "0.0" : item.other_ratio4_current, item.other_ratio4_current === null ? "0.0" : item.other_ratio4_current === "" ? "0.0" : item.other_ratio4_current,
item.notes, item.notes,
// item.per_bs === null ? "0.0" : item.per_bs === "" ? "0.0" : item.per_bs,
// item.diff === null ? "0.0" : item.diff === "" ? "0.0" : item.diff,
], ],
[9, "", "", "", "", "", {value: "Grand Total"}, null, "", "", "", "0", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "notes", 999999 ], [9, "", "", "", "", "", {value: "Grand Total"}, null, "", "", "", "0", "", "0", "", "0", "", "0", "", "", "0", "0", "0", "0", "0", "", "0", "", "0", "", "0", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "notes", 999999 ],
) )
...@@ -456,13 +454,12 @@ export default class ListOfCreditFacilities extends Component { ...@@ -456,13 +454,12 @@ export default class ListOfCreditFacilities extends Component {
item.parent, item.parent,
item.formula, item.formula,
item.level, item.level,
// item.description, item.borrower_comp_name === null ? this.props.company.company_name : item.borrower_comp_name === "" ? this.props.company.company_name : item.borrower_comp_name,
item.borrower_comp_name === null ? "0.0" : item.borrower_comp_name === "" ? "0.0" : item.borrower_comp_name,
item.bank_name === null ? null : item.bank_name === "" ? null : {value: item.bank_name}, item.bank_name === null ? null : item.bank_name === "" ? null : {value: item.bank_name},
item.type_of_credit === null ? null : item.type_of_credit === "" ? null : {value: item.type_of_credit}, item.type_of_credit === null ? null : item.type_of_credit === "" ? null : {value: item.type_of_credit},
item.remarks === null ? "0.0" : item.remarks === "" ? "0.0" : item.remarks, item.remarks === null ? "" : item.remarks === "" ? "" : item.remarks,
item.loan_maturity_date === null ? "0.0" : item.loan_maturity_date === "" ? "0.0" : item.loan_maturity_date, item.loan_maturity_date === null ? this.state.currentDate : item.loan_maturity_date === "" ? this.state.currentDate : item.loan_maturity_date,
item.interest === null ? "0.0" : item.interest === "" ? "0.0" : item.interest, item.interest === null ? "0" : item.interest === "" ? "0" : item.interest,
item.currency === null ? "0.0" : item.currency === "" ? "0.0" : item.currency, item.currency === null ? "0.0" : item.currency === "" ? "0.0" : item.currency,
item.loan_plafond_amount_ori, item.loan_plafond_amount_ori,
item.loan_plafond_amount_idr === null ? "0.0" : item.loan_plafond_amount_idr === "" ? "0.0" : item.loan_plafond_amount_idr, item.loan_plafond_amount_idr === null ? "0.0" : item.loan_plafond_amount_idr === "" ? "0.0" : item.loan_plafond_amount_idr,
...@@ -470,7 +467,6 @@ export default class ListOfCreditFacilities extends Component { ...@@ -470,7 +467,6 @@ export default class ListOfCreditFacilities extends Component {
item.out_loan_ki_amount_idr === null ? "0.0" : item.out_loan_ki_amount_idr === "" ? "0.0" : item.out_loan_ki_amount_idr, item.out_loan_ki_amount_idr === null ? "0.0" : item.out_loan_ki_amount_idr === "" ? "0.0" : item.out_loan_ki_amount_idr,
item.out_loan_kmk_amount_ori, item.out_loan_kmk_amount_ori,
item.out_loan_kmk_amount_idr === null ? "0.0" : item.out_loan_kmk_amount_idr === "" ? "0.0" : item.out_loan_kmk_amount_idr, item.out_loan_kmk_amount_idr === null ? "0.0" : item.out_loan_kmk_amount_idr === "" ? "0.0" : item.out_loan_kmk_amount_idr,
// item.mtd_vs_previous_month === null ? "0.0" : item.mtd_vs_previous_month === "" ? "0.0" : item.mtd_vs_previous_month,
item.out_loan_other_type, item.out_loan_other_type,
item.out_loan_other_amount_ori, item.out_loan_other_amount_ori,
item.out_loan_other_amount_idr === null ? "0.0" : item.out_loan_other_amount_idr === "" ? "0.0" : item.out_loan_other_amount_idr, item.out_loan_other_amount_idr === null ? "0.0" : item.out_loan_other_amount_idr === "" ? "0.0" : item.out_loan_other_amount_idr,
...@@ -487,20 +483,18 @@ export default class ListOfCreditFacilities extends Component { ...@@ -487,20 +483,18 @@ export default class ListOfCreditFacilities extends Component {
item.ebitda_to_interest_financial, item.ebitda_to_interest_financial,
item.ebitda_to_interest_current === null ? "0.0" : item.ebitda_to_interest_current === "" ? "0.0" : item.ebitda_to_interest_current, item.ebitda_to_interest_current === null ? "0.0" : item.ebitda_to_interest_current === "" ? "0.0" : item.ebitda_to_interest_current,
item.other_ratio1_ratio_name, item.other_ratio1_ratio_name,
item.other_ratio1_financial, item.other_ratio1_financial === null ? "0.0" : item.other_ratio1_financial === "" ? "0.0" : item.other_ratio1_financial,
item.other_ratio1_current === null ? "0.0" : item.other_ratio1_current === "" ? "0.0" : item.other_ratio1_current, item.other_ratio1_current === null ? "0.0" : item.other_ratio1_current === "" ? "0.0" : item.other_ratio1_current,
item.other_ratio2_ratio_name, item.other_ratio2_ratio_name,
item.other_ratio2_financial, item.other_ratio2_financial === null ? "0.0" : item.other_ratio2_financial === "" ? "0.0" : item.other_ratio2_financial,
item.other_ratio2_current === null ? "0.0" : item.other_ratio2_current === "" ? "0.0" : item.other_ratio2_current, item.other_ratio2_current === null ? "0.0" : item.other_ratio2_current === "" ? "0.0" : item.other_ratio2_current,
item.other_ratio3_ratio_name, item.other_ratio3_ratio_name,
item.other_ratio3_financial, item.other_ratio3_financial === null ? "0.0" : item.other_ratio3_financial === "" ? "0.0" : item.other_ratio3_financial,
item.other_ratio3_current === null ? "0.0" : item.other_ratio3_current === "" ? "0.0" : item.other_ratio3_current, item.other_ratio3_current === null ? "0.0" : item.other_ratio3_current === "" ? "0.0" : item.other_ratio3_current,
item.other_ratio4_ratio_name, item.other_ratio4_ratio_name,
item.other_ratio4_financia,, item.other_ratio4_financial === null ? "0.0" : item.other_ratio4_financial === "" ? "0.0" : item.other_ratio4_financial,
item.other_ratio4_current === null ? "0.0" : item.other_ratio4_current === "" ? "0.0" : item.other_ratio4_current, item.other_ratio4_current === null ? "0.0" : item.other_ratio4_current === "" ? "0.0" : item.other_ratio4_current,
item.notes, item.notes,
// item.per_bs === null ? "0.0" : item.locf.per_bs === "" ? "0.0" : item.locf.per_bs,
// item.diff === null ? "0.0" : item.locf.diff === "" ? "0.0" : item.locf.diff,
]) ])
} }
...@@ -521,6 +515,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -521,6 +515,7 @@ export default class ListOfCreditFacilities extends Component {
} }
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => {
this.handleCalculate()
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[23].length > 0) { if (item[23].length > 0) {
// console.log('masuk') // console.log('masuk')
...@@ -537,92 +532,94 @@ export default class ListOfCreditFacilities extends Component { ...@@ -537,92 +532,94 @@ export default class ListOfCreditFacilities extends Component {
uploadProfitLossMR(type) { uploadProfitLossMR(type) {
let data = [] let data = []
// this.state.dataTable.map(i => { this.state.dataTable.map(i => {
// data.push({ if (i[0] == 3) {
// "item_report_id": i[1], data.push({
// "borrower_comp_name": i[5], "item_report_id": i[1],
// "bank_name": i[6].value, "borrower_comp_name": i[5],
// "type_of_credit": i[7].value, "bank_name": i[6].value,
// "remarks": i[8], "type_of_credit": i[7].value,
// "loan_maturity_date": i[9], "remarks": i[8],
// "interest": i[10], "loan_maturity_date": i[9],
// "currency": i[11], "interest": i[10],
// "loan_plafond_amount_ori": i[12], "currency": i[11],
// "loan_plafond_amount_idr": i[13], "loan_plafond_amount_ori": i[12],
// "out_loan_ki_amount_ori": i[14], "loan_plafond_amount_idr": i[13],
// "out_loan_ki_amount_idr": i[15], "out_loan_ki_amount_ori": i[14],
// "out_loan_kmk_amount_ori": i[16], "out_loan_ki_amount_idr": i[15],
// "out_loan_kmk_amount_idr": i[17], "out_loan_kmk_amount_ori": i[16],
// // "mtd_vs_previous_month": i[18], "out_loan_kmk_amount_idr": i[17],
// "out_loan_other_type": i[18], // "mtd_vs_previous_month": i[18],
// "out_loan_other_amount_ori": i[19], "out_loan_other_type": i[18],
// "out_loan_other_amount_idr": i[20], "out_loan_other_amount_ori": i[19],
// "total_out_loan_ori": i[21], "out_loan_other_amount_idr": i[20],
// "total_out_loan_idr": i[22], "total_out_loan_ori": i[21],
// "remaining_plafond_ori": i[23], "total_out_loan_idr": i[22],
// "remaining_plafond_idr": i[24], "remaining_plafond_ori": i[23],
// "current_ratio_financial": i[25], "remaining_plafond_idr": i[24],
// "current_ratio_current": i[26], "current_ratio_financial": i[25],
// "der_financial": i[27], "current_ratio_current": i[26],
// "der_current": i[28], "der_financial": i[27],
// "debt_to_ebitda_financial": i[20], "der_current": i[28],
// "debt_to_ebitda_current": i[30], "debt_to_ebitda_financial": i[20],
// "ebitda_to_interest_financial": i[31], "debt_to_ebitda_current": i[30],
// "ebitda_to_interest_current": i[32], "ebitda_to_interest_financial": i[31],
// "other_ratio1_ratio_name": i[33], "ebitda_to_interest_current": i[32],
// "other_ratio1_financial": i[34], "other_ratio1_ratio_name": i[33],
// "other_ratio1_current": i[35], "other_ratio1_financial": i[34],
// "other_ratio2_ratio_name": i[36], "other_ratio1_current": i[35],
// "other_ratio2_financial": i[37], "other_ratio2_ratio_name": i[36],
// "other_ratio2_current": i[38], "other_ratio2_financial": i[37],
// "other_ratio3_ratio_name": i[39], "other_ratio2_current": i[38],
// "other_ratio3_financial": i[40], "other_ratio3_ratio_name": i[39],
// "other_ratio3_current": i[41], "other_ratio3_financial": i[40],
// "other_ratio4_ratio_name": i[42], "other_ratio3_current": i[41],
// "other_ratio4_financial": i[43], "other_ratio4_ratio_name": i[42],
// "other_ratio4_current": i[4], "other_ratio4_financial": i[43],
// "notes": i[45], "other_ratio4_current": i[4],
// }) "notes": i[45],
// }) })
// let body = { }
// "monthly_report_id": this.props.monthlyReportId, })
// "company_id": this.props.company.company_id, let body = {
// "periode": this.props.periode, "monthly_report_id": this.props.monthlyReportId,
// "report_id": this.props.report_id, "company_id": this.props.company.company_id,
// "status": type, "periode": this.props.periode,
// "months": this.props.month.month_id, "report_id": this.props.report_id,
// "locf": data, "status": type,
// "per_bs": this.state.perBS, "months": this.props.month.month_id,
// "diff": this.state.diff, "locf": data,
// "total_loan" : this.state.totalOutStand "per_bs": this.state.perBS,
// } "diff": this.state.diff,
"total_loan" : this.state.totalOutStand
}
// console.log(data); // console.log(data);
// api.create('UPLOAD').uploadMonthlyReportLOCF(body).then(response => { api.create('UPLOAD').uploadMonthlyReportLOCF(body).then(response => {
// console.log(response); console.log(response);
// if (response.data) { if (response.data) {
// if (response.ok) { if (response.ok) {
// if (response.data.status === "success") { if (response.data.status === "success") {
// this.props.saveToMonthlyReport() this.props.saveToMonthlyReport()
// // this.props.onClickClose() // this.props.onClickClose()
// // this.props.getReport() // this.props.getReport()
// } else { } else {
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
// if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
// setTimeout(() => { setTimeout(() => {
// localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
// window.location.reload(); window.location.reload();
// }, 1000); }, 1000);
// } }
// }) })
// // alert(response.data.status) // alert(response.data.status)
// } }
// } else { } else {
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
// } }
// } else { } else {
// this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
// } }
// }) })
} }
getBankData() { getBankData() {
...@@ -631,6 +628,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -631,6 +628,7 @@ export default class ListOfCreditFacilities extends Component {
company_id: this.props.company.company_id, company_id: this.props.company.company_id,
type: 'BANK_NAME' type: 'BANK_NAME'
} }
this.setState({ dataLoaded: false })
api.create().getAllSettingByType(body).then(response => { api.create().getAllSettingByType(body).then(response => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
...@@ -1185,14 +1183,14 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1185,14 +1183,14 @@ export default class ListOfCreditFacilities extends Component {
setTimeout(() => { setTimeout(() => {
// console.log(dataCoba) // console.log(dataCoba)
// console.log(dataGabung) // console.log(dataGabung)
// console.log(newData) console.log(newData)
// console.log(dataTampungBank) // console.log(dataTampungBank)
// console.log(totalLoan); // console.log(totalLoan);
// dataTable: newData, totalOutStand: newData[newData.length-1][22] // dataTable: newData, totalOutStand: newData[newData.length-1][22]
if (bankNameEmpty) { if (bankNameEmpty) {
this.setState({ loading: false, dataTable: this.state.dataTable, totalOutStand: 0, diff: Number(0 - this.state.perBS) }) this.setState({ loading: false, dataTable: this.state.dataTable, totalOutStand: 0, diff: Number(0 - this.state.perBS), saveDraft: false })
} else { } else {
this.setState({ loading: false, dataTable: newData, totalOutStand: totalLoan, diff: Number(totalLoan - this.state.perBS) }) this.setState({ loading: false, dataTable: newData, totalOutStand: totalLoan, diff: Number(totalLoan - this.state.perBS), saveDraft: false, saveComp: Number(totalLoan - this.state.perBS) == 0? false : true })
} }
}, 100); }, 100);
}) })
...@@ -1590,7 +1588,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1590,7 +1588,7 @@ export default class ListOfCreditFacilities extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={tableMeta.rowData[0] == 8 || tableMeta.rowData[0] == 9? true : false} disabled={tableMeta.rowData[0] == 8 || tableMeta.rowData[0] == 9? true : false}
defaultValue={val} defaultValue={tableMeta.rowData[8]}
onBlur={(event) => { onBlur={(event) => {
// // // console.log(event.target.value) // // // console.log(event.target.value)
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1712,7 +1710,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -1712,7 +1710,7 @@ export default class ListOfCreditFacilities extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={false} disabled={false}
defaultValue={val} defaultValue={tableMeta.rowData[11]}
onBlur={(event) => { onBlur={(event) => {
// // // console.log(event.target.value) // // // console.log(event.target.value)
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -3617,7 +3615,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3617,7 +3615,7 @@ export default class ListOfCreditFacilities extends Component {
type="button" type="button"
// disabled={this.state.buttonError} // disabled={this.state.buttonError}
onClick={() => onClick={() =>
this.state.buttonError ? this.state.saveComp ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
: :
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
...@@ -3629,7 +3627,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3629,7 +3627,7 @@ export default class ListOfCreditFacilities extends Component {
} }
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer', cursor: this.state.saveComp === true ? 'default' : 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none' outline: 'none'
}} }}
...@@ -3662,13 +3660,13 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3662,13 +3660,13 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.loading && loadingComponent} {this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}> {this.state.dataLoaded && <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={dataTable2} data={dataTable2}
columns={columns} columns={columns}
options={options} options={options}
/> />
</MuiThemeProvider> </MuiThemeProvider>}
</div> </div>
<div style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingLeft: 15, paddingRight: 15, marginTop: 5}}> <div style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingLeft: 15, paddingRight: 15, marginTop: 5}}>
...@@ -3696,11 +3694,12 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3696,11 +3694,12 @@ export default class ListOfCreditFacilities extends Component {
<div className="col-1"> <div className="col-1">
<button <button
type="button" type="button"
onClick={() => this.setState({ loading: true, visibleLOCFMR: true }, () => { onClick={() => {
setTimeout(() => { this.getBankData()
this.setState({loading: false}) this.getTypeOfCredit()
}, 100); this.getSubmission()
})} }
}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
...@@ -3741,7 +3740,7 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3741,7 +3740,7 @@ export default class ListOfCreditFacilities extends Component {
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => { this.setState({ handleTekTekTek: 1, loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.backToMonthlyReport('draft') this.uploadProfitLossMR('draft')
}, 100); }, 100);
}) })
} }
...@@ -3761,19 +3760,19 @@ export default class ListOfCreditFacilities extends Component { ...@@ -3761,19 +3760,19 @@ export default class ListOfCreditFacilities extends Component {
type="button" type="button"
// disabled={this.state.buttonError} // disabled={this.state.buttonError}
onClick={() => onClick={() =>
this.state.buttonError ? this.state.saveComp ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
: :
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1, loading: true }, () => { this.setState({ handleTekTekTek: 1, loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.backToMonthlyReport('submitted') this.uploadProfitLossMR('submitted')
}, 100); }, 100);
}) })
} }
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer', cursor: this.state.saveComp === true ? 'default' : 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none' outline: 'none'
}} }}
......
...@@ -26,7 +26,6 @@ export default class SummaryOfTriputra extends Component { ...@@ -26,7 +26,6 @@ export default class SummaryOfTriputra extends Component {
{ value: 2, label: 'YTD Report' }, { value: 2, label: 'YTD Report' },
{ value: 3, label: 'CPSM Report' }, { value: 3, label: 'CPSM Report' },
{ value: 4, label: 'Historical' }, { value: 4, label: 'Historical' },
{ value: 5, label: 'Dashboard Financial' },
], ],
report: null, report: null,
loading: false, loading: false,
...@@ -233,6 +232,7 @@ export default class SummaryOfTriputra extends Component { ...@@ -233,6 +232,7 @@ export default class SummaryOfTriputra extends Component {
if (this.state.report.value === 1) { if (this.state.report.value === 1) {
api.create().getDetailReportMB(payload).then(response => { api.create().getDetailReportMB(payload).then(response => {
// console.log(response); // console.log(response);
// console.log(payload)
let dataTable = [] let dataTable = []
if (response.data) { if (response.data) {
let res = response.data.data let res = response.data.data
......
...@@ -10,6 +10,7 @@ import UnitBisnis from '../container/MasterData/UnitBisnis' ...@@ -10,6 +10,7 @@ import UnitBisnis from '../container/MasterData/UnitBisnis'
import Parameter from '../container/MasterData/Parameter/Parameter' import Parameter from '../container/MasterData/Parameter/Parameter'
import ReportItems from '../container/MasterData/ReportItems' import ReportItems from '../container/MasterData/ReportItems'
import DashboardCAT from '../container/Laporan/DashboardCAT' import DashboardCAT from '../container/Laporan/DashboardCAT'
import DashboardFinancial from '../container/Laporan/DashboardFinancial'
import BudgetTahunan from '../container/BudgetTahunan'; import BudgetTahunan from '../container/BudgetTahunan';
import RollingOutlook from '../container/RollingOutlook'; import RollingOutlook from '../container/RollingOutlook';
import OperatingIndicator from '../container/OprIndicator/OperatingIndicator' import OperatingIndicator from '../container/OprIndicator/OperatingIndicator'
...@@ -96,6 +97,10 @@ const routes = [ ...@@ -96,6 +97,10 @@ const routes = [
path: "/home/summary-of-triputra", path: "/home/summary-of-triputra",
main: SummaryTriputra main: SummaryTriputra
}, },
{
path: "/home/dashboard-financial",
main: DashboardFinancial
},
{ {
path: "*", path: "*",
main: screen404 main: screen404
......
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