Commit 10738301 authored by d.arizona's avatar d.arizona

update mayan

parent 23469c2f
...@@ -284,7 +284,7 @@ const create = (type = "") => { ...@@ -284,7 +284,7 @@ const create = (type = "") => {
const getReportFRLastMR = (body) => api.post('/transaction/summary_ratio/monthly_report_last_year/get_report_hierarki', body) const getReportFRLastMR = (body) => api.post('/transaction/summary_ratio/monthly_report_last_year/get_report_hierarki', body)
const getReportBSSuma = (body) => api.post('/transaction/summary_balance_sheet/summary/get_report_hierarki', body) const getReportBSSuma = (body) => api.post('/transaction/summary_balance_sheet/summary/get_report_hierarki', body)
const getDashboardCAT = (body) => api.post('/transaction/dashboard/get_dashboard_cat', body) const getDashboardCAT = (body) => api.post('/transaction/dashboard/get_dashboard_cat', body)
const getListChildDashboardCAT = (body) => api.get(`/transaction/dashboard/get_item_cat/${body}`) const getListChildDashboardCAT = (periode,month) => api.get(`/transaction/dashboard/get_home_cat/${periode}/${month}`)
const getDashboardCATDetail = (body) => api.post('/transaction/dashboard/get_dashboard_cat_detail', body) const getDashboardCATDetail = (body) => api.post('/transaction/dashboard/get_dashboard_cat_detail', body)
const getHierarkiReportYtd = (body) => api.post('/transaction/summary_ytd/summary/get_report_hierarki', body) const getHierarkiReportYtd = (body) => api.post('/transaction/summary_ytd/summary/get_report_hierarki', body)
const getHierarkiReportHistorical = (body) => api.post('/transaction/summary_historical/summary/get_report_hierarki', body) const getHierarkiReportHistorical = (body) => api.post('/transaction/summary_historical/summary/get_report_hierarki', body)
......
...@@ -227,7 +227,7 @@ export default function MiniDrawer() { ...@@ -227,7 +227,7 @@ export default function MiniDrawer() {
}, { }, {
img: 'beranda', img: 'beranda',
label: 'CAT Dashboard', label: 'CAT Dashboard',
path: 'dashboard-cat', path: 'cat-dashboard',
} }
], ],
collapse: false, collapse: false,
......
This diff is collapsed.
...@@ -36,12 +36,22 @@ export default class DashboardCAT extends Component { ...@@ -36,12 +36,22 @@ export default class DashboardCAT extends Component {
} }
componentDidMount() { componentDidMount() {
this.getDetailUser() this.props.selectIndex('CAT Dashboard')
console.log(this.props); let dataStorageCAT = localStorage.getItem(Constant.DATACAT)
// this.getMonth() if (dataStorageCAT != 'datacat') {
this.setState({selectedKPI: JSON.parse(dataStorageCAT).listKPI})
}
if (this.props.location.state !== undefined) {
this.setState({ userType: this.props.location.state.userType, intent: 'Home', rawData: this.props.location.state.rawData }, () => {
this.getDetailUser()
})
} else {
this.getDetailUser()
}
} }
getDetailUser() { getDetailUser() {
console.log(this.state.rawData)
let userId = localStorage.getItem(Constant.USER) let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => { api.create().getDetailUser(userId).then((response) => {
if (response.data) { if (response.data) {
...@@ -92,7 +102,7 @@ export default class DashboardCAT extends Component { ...@@ -92,7 +102,7 @@ export default class DashboardCAT extends Component {
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
let data = response.data.data let data = response.data.data
let comID = this.state.rawData ? this.state.rawData.company_id : 0 let comID = this.state.rawData ? this.state.rawData.companyId : 0
let companyData = data.map((item) => { let companyData = data.map((item) => {
return { return {
company_id: item.company_id, company_id: item.company_id,
...@@ -157,6 +167,7 @@ export default class DashboardCAT extends Component { ...@@ -157,6 +167,7 @@ export default class DashboardCAT extends Component {
let data = [] let data = []
console.log(response.data.data) console.log(response.data.data)
console.log(this.state.lastPeriod) console.log(this.state.lastPeriod)
let periodeID = this.state.rawData ? this.state.rawData.periode : 0
response.data.data.map((item) => { response.data.data.map((item) => {
if (this.state.isApprover) { if (this.state.isApprover) {
if (item >= 2000 && item <= (Number(currentYear) + 1)) { if (item >= 2000 && item <= (Number(currentYear) + 1)) {
...@@ -174,17 +185,17 @@ export default class DashboardCAT extends Component { ...@@ -174,17 +185,17 @@ export default class DashboardCAT extends Component {
} }
}) })
let defaultProps = { let defaultProps = {
options: periodeData, options: periodeData.sort((a, b) => a.periode - b.periode),
getOptionLabel: (option) => option.periode, getOptionLabel: (option) => option.periode,
}; };
let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod) let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod)
let index = data.sort((a, b) => a - b).findIndex((val) => val === periode) let index = periodeData.sort((a, b) => a.periode - b.periode).findIndex((val) => periodeID == 0? val.periode === periode : val.periode == periodeID)
// // console.log(this.props.location.state.rawData) // // console.log(this.props.location.state.rawData)
// console.log(this.state.lastPeriod) // console.log(this.state.lastPeriod)
console.log(data) console.log(data)
console.log(periodeData) console.log(periodeData)
console.log(defaultProps) console.log(defaultProps)
// // // console.log(index) console.log(index)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => { this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
this.getMonth() this.getMonth()
}) })
...@@ -202,6 +213,7 @@ export default class DashboardCAT extends Component { ...@@ -202,6 +213,7 @@ export default class DashboardCAT extends Component {
if (response.data.status === "success") { if (response.data.status === "success") {
console.log(response); console.log(response);
let data = response.data.data let data = response.data.data
let monthID = this.state.rawData ? this.state.rawData.month : 0
let monthData = data.map((item) => { let monthData = data.map((item) => {
return { return {
month_id: item.id, month_id: item.id,
...@@ -212,8 +224,9 @@ export default class DashboardCAT extends Component { ...@@ -212,8 +224,9 @@ export default class DashboardCAT extends Component {
options: monthData, options: monthData,
getOptionLabel: (option) => option.month_value, getOptionLabel: (option) => option.month_value,
}; };
let index = data.findIndex((val) => val.month_name == month) let index = data.findIndex((val) => monthID == 0? val.month_name == month : val.id == monthID)
// console.log(index); console.log(index);
this.setState({ listMonth: defaultProps, month: index == -1 ? monthData[0] : monthData[index] }, () => { this.setState({ listMonth: defaultProps, month: index == -1 ? monthData[0] : monthData[index] }, () => {
this.getDasboardCAT() this.getDasboardCAT()
}) })
...@@ -266,7 +279,13 @@ export default class DashboardCAT extends Component { ...@@ -266,7 +279,13 @@ export default class DashboardCAT extends Component {
} }
setSelectedKPI(data) { setSelectedKPI(data) {
this.setState({ selectedKPI: data }) this.setState({ selectedKPI: data }, () => {
let payloadData = {
userID: localStorage.getItem(Constant.USER),
listKPI: this.state.selectedKPI
}
localStorage.setItem(Constant.DATACAT, this.state.selectedKPI.length == 0? 'datacat' : JSON.stringify(payloadData))
})
} }
render() { render() {
......
...@@ -59,7 +59,7 @@ export default class StrategiMap extends Component { ...@@ -59,7 +59,7 @@ export default class StrategiMap extends Component {
<div style={{ display: 'grid', alignContent: 'center', backgroundColor: '#6885a6', width: 155, borderTopLeftRadius: 6, borderBottomLeftRadius: 6, padding: 10 }}> <div style={{ display: 'grid', alignContent: 'center', backgroundColor: '#6885a6', width: 155, borderTopLeftRadius: 6, borderBottomLeftRadius: 6, padding: 10 }}>
<Typography style={{ color: '#fff', fontSize: 12, textAlign: 'center' }}>{items.item_name}</Typography> <Typography style={{ color: '#fff', fontSize: 12, textAlign: 'center' }}>{items.item_name}</Typography>
</div> </div>
<div style={{ backgroundColor: this.state.radioValue ? (items.is_higher_actual == '-' ? '#d8d8d8' : (items.is_higher_actual == 'true' ? '#cbf4a8' : '#faaaaa')) : (items.is_higher_yoy == '-' ? 'white' : (items.is_higher_yoy ? '#cbf4a8' : '#faaaaa')), width: 68, borderTopRightRadius: 6, borderBottomRightRadius: 6, textAlign: 'center', paddingTop: 10, paddingBottom: 10 }}> <div style={{ backgroundColor: this.state.radioValue ? (items.is_higher_actual == '-' ? '#d8d8d8' : (items.is_higher_actual == 'true' ? '#cbf4a8' : '#faaaaa')) : (items.is_higher_yoy == '-' ? '#d8d8d8' : (items.is_higher_yoy == 'true' ? '#cbf4a8' : '#faaaaa')), width: 68, borderTopRightRadius: 6, borderBottomRightRadius: 6, textAlign: 'center', paddingTop: 10, paddingBottom: 10 }}>
{items.is_higher_actual == '-' ? {items.is_higher_actual == '-' ?
<Typography style={{ color: '#4b4b4b', fontSize: 10, textAlign: 'center' }}>{'-'}</Typography> <Typography style={{ color: '#4b4b4b', fontSize: 10, textAlign: 'center' }}>{'-'}</Typography>
: :
......
...@@ -9,7 +9,7 @@ const Constant = { ...@@ -9,7 +9,7 @@ const Constant = {
URL_FE_DEV: 'https://tia.eksad.com/tia-web-dev', URL_FE_DEV: 'https://tia.eksad.com/tia-web-dev',
URL_FE_DEMO: 'https://tia.eksad.com/tia-web-demo', URL_FE_DEMO: 'https://tia.eksad.com/tia-web-demo',
URL_FE_PROD: 'https://dashboard.triputra-group.com/tia-web', URL_FE_PROD: 'https://dashboard.triputra-group.com/tia-web',
DATACAT: 'datacat'
// URL_BE_MAIN : Constant.URL_BE_DEV, // URL_BE_MAIN : Constant.URL_BE_DEV,
// URL_FE_MAIN : Constant.URL_FE_DEV, // URL_FE_MAIN : Constant.URL_FE_DEV,
} }
......
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