Commit f7ad9481 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-dev(pc)' into 'master'

Deni dev(pc)

See merge request !384
parents 1c026c14 9b6e46eb
......@@ -200,6 +200,7 @@ const create = (type = "") => {
const getMonthTransaction = () => api.get('transaction/get_default_month')
const countingFormula = (body) => api.post('transaction/counting_formula', body)
const submitMasterBudget = (body) => api.post('transaction/master_budget/submit_master_budget', body)
const checkIsSubmit = (body) => api.post('transaction/master_budget/is_can_submit', body)
const getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body)
const getOpetratingIndID = (body) => api.post('transaction/get_operating_indicator_id', body)
......@@ -208,7 +209,8 @@ const create = (type = "") => {
const createOpetaingInd = (body) => api.post('transaction/operating_indicator/create_submission_report', body)
const checkUploadOperatingInd = (body) => api.post('transaction/operating_indicator/check_import', body)
const uploadOperatingInd = (body) => api.post('transaction/operating_indicator/import_operating_indicator', body)
const getDashboard = (body) => api.get('transaction/master_budget/get_dashboard')
const getDashboard = (body) => api.get('transaction/get_dashboard')
const historyApproval = (body) => api.post('transaction/master_budget/history_approval', body)
//Template
const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`)
......@@ -356,8 +358,10 @@ const create = (type = "") => {
getLastestUpdateMB,
countingFormula,
submitMasterBudget,
checkIsSubmit,
getIdDeleteFromExcel,
getDashboard
getDashboard,
historyApproval
}
}
......
......@@ -17,7 +17,6 @@ import { format } from 'date-fns';
import Constant from '../library/Constant';
import PropagateLoader from "react-spinners/PropagateLoader"
import CashFlow from './BudgetTahunan/CashFlow';
import { validate } from '@material-ui/pickers';
var ct = require("../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
......@@ -49,7 +48,9 @@ export default class BudgetTahunan extends Component {
alert: false,
tipeAlert: '',
messageAlert: '',
submissionID: null
submissionID: null,
isSubmit: false,
visibleTableHistory: false
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -110,12 +111,12 @@ export default class BudgetTahunan extends Component {
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ userCompany: response.data.data.company}, () => {
this.setState({ userCompany: response.data.data.company }, () => {
this.getCompanyActive()
})
})
}
}
}
}
})
}
......@@ -130,20 +131,20 @@ export default class BudgetTahunan extends Component {
company_name: item.company_name,
}
})
let arrayBaru = []
this.state.userCompany.map((item,index) => {
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),
};
this.setState({ listCompany: defaultProps, company: arrayBaru[0] }, () => {
this.getPeriode()
})
......@@ -223,9 +224,13 @@ export default class BudgetTahunan extends Component {
"periode": this.state.periode.periode
}
api.create().getSubmission(payload).then(response => {
console.log(response)
if (response) {
if (response.data.data) {
this.setState({ submissionID: response.data.data.submission_id })
this.setState({ submissionID: response.data.data.submission_id, isSubmit: false }, () => {
this.checkIsSubmit()
this.historyApproval()
})
} else {
this.setState({ submissionID: null })
}
......@@ -233,6 +238,41 @@ export default class BudgetTahunan extends Component {
})
}
historyApproval() {
let body = {
"submission_id": this.state.submissionID
}
api.create().historyApproval(body).then(response => {
console.log(response);
if (response.data.data.length > 0) {
let dataTableHistory = response.data.data.map(item => {
return [
item.pic,
item.status_approval,
item.remarks,
item.item_revision,
item.history_approval_date
]
})
this.setState({ dataTableHistory, visibleTableHistory: true })
}
})
}
checkIsSubmit() {
let body = {
"submission_id": this.state.submissionID
}
api.create().checkIsSubmit(body).then(response => {
// console.log(response);
if (response.data) {
if (response.data.status === "Success") {
this.setState({ isSubmit: response.data.data.result })
}
}
})
}
clickDetail(item, id, revision, status) {
console.log(item);
this.setState({
......@@ -382,10 +422,22 @@ export default class BudgetTahunan extends Component {
array.push(item[3])
}
})
if (array.includes("not-yet" || "draft")) {
console.log('gagal');
} else {
console.log('masuk');
// if (array.includes("not-yet" || "draft")) {
// console.log('gagal');
// } else {
// console.log('masuk');
// }
let body = {
submission_id: this.state.submissionID
}
if (this.state.isSubmit === true) {
api.create().submitMasterBudget(body).then(response => {
if (response.data) {
if (response.data.status === "Success") {
this.getCompanyActive()
}
}
})
}
}
......@@ -433,10 +485,14 @@ export default class BudgetTahunan extends Component {
{val === "submitted" || val === "approved" ?
<img src={Images.ceklis} style={{ width: 31, height: 24 }} /> :
val === "draft" ?
<img src={Images.cross} style={{ width: 31, height: 24 }} /> :
<span>Draft</span> :
val === "revision" ?
<span>Revisi</span> :
null
val === "approval_proccess" ?
<span>Approval Proccess</span> :
val === "not-yet" ?
null :
<img src={Images.cross} style={{ width: 31, height: 24 }} />
}
</div >
);
......@@ -456,7 +512,9 @@ export default class BudgetTahunan extends Component {
borderColor: 'transparent'
}}
onClick={() =>
tableMeta.rowData[5] ? this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3]) : null
// tableMeta.rowData[5] ?
this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3])
// : null
}
>
<Typography style={{ color: tableMeta.rowData[5] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography>
......@@ -472,6 +530,10 @@ export default class BudgetTahunan extends Component {
name: "",
options: { display: false }
}]
const columnsHistory = [
"Name", "Status", "Remarks", "Revision Item", "Date"
]
const options = {
filter: false,
sort: false,
......@@ -518,6 +580,7 @@ export default class BudgetTahunan extends Component {
{...this.state.listPeriode}
id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => {
this.getRevision()
this.getReport()
this.getReportAttachment()
this.getSubmission()
......@@ -535,6 +598,7 @@ export default class BudgetTahunan extends Component {
{...this.state.listCompany}
id="company"
onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => {
this.getRevision()
this.getReport()
this.getReportAttachment()
this.getSubmission()
......@@ -620,16 +684,27 @@ export default class BudgetTahunan extends Component {
}
</div>
</div>
{this.state.visibleTableHistory && (
<div style={{ marginTop: 20 }}>
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={this.state.dataTableHistory}
columns={columnsHistory}
options={options}
/>
</MuiThemeProvider>
</div>
)}
</div>
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} >
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
cursor: this.state.isSubmit === true ? 'pointer' : 'cursor',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.validate()}
onClick={() => this.state.isSubmit === true ? this.validate() : null}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography>
......@@ -704,6 +779,7 @@ export default class BudgetTahunan extends Component {
saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visiblePL: false, visibleBudgetTahunan: true })}
getReport={this.getReport.bind(this)}
status={this.state.status}
/>
)}
......@@ -720,6 +796,7 @@ export default class BudgetTahunan extends Component {
saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visibleTP: false, visibleBudgetTahunan: true })}
getReport={this.getCompanyActive.bind(this)}
status={this.state.status}
/>
)}
{this.state.visibleFAM && (
......@@ -735,6 +812,7 @@ export default class BudgetTahunan extends Component {
saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visibleFAM: false, visibleBudgetTahunan: true })}
getReport={this.getCompanyActive.bind(this)}
status={this.state.status}
/>
)}
{this.state.visibleCAT && (
......
......@@ -612,7 +612,8 @@ export default class BalanceSheet extends Component {
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ?
null
:
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......
import { createMuiTheme, MuiThemeProvider, Paper, Typography } from '@material-ui/core'
import { createMuiTheme, MuiThemeProvider, Paper, TableCell, Typography } from '@material-ui/core'
import MUIDataTable from 'mui-datatables';
import React, { Component } from 'react'
import ReactTooltip from 'react-tooltip';
......@@ -25,10 +25,33 @@ const style2 = {
export default class BalanceSheetMR extends Component {
render() {
let columns = [
"Account",
{
name: "Account",
options: {
customHeadRender: (columnMeta) => (
<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>
),
setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 300 }}>
{val}
</div>
)
}
}
},
{
name: "Rolling Outlook (FY2021)",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#07a7d0', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (val, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right', width: 90 }}>
......@@ -42,19 +65,19 @@ export default class BalanceSheetMR extends Component {
name: `Month To Date (MTD)`,
options: {
customHeadRender: (columnMeta) => (
<th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
<th style={{ ...style2, color: '#fff', backgroundColor: '#07a7d0', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
{/* <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> */}
<div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
<div className="grid grid-3x" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid" }}>
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
<div className="grid grid-3x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<span>{"Master Budget (MB)"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid" }}>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<span>{"Rolling Budget (RB)"}</span>
</div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, backgroundColor: '#37b5e6' }}>
<span>{"Actual"}</span>
</div>
</div>
......@@ -89,6 +112,12 @@ export default class BalanceSheetMR extends Component {
{
name: "Actual Previous Month",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
customBodyRender: (val, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right', width: 90 }}>
......@@ -105,20 +134,20 @@ export default class BalanceSheetMR extends Component {
<th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
<div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
<div className="grid grid-3x" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid' }}>
<div style={{ borderBottom: '1px #fff solid' }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid', backgroundColor: '#37b5e6' }}>
<div style={{ borderBottom: '1px #fff solid', backgroundColor: '#37b5e6' }}>
<span>{"Act vs Previous Month"}</span>
</div>
<div className="grid grid-2x">
<div className="column-1" style={{ borderRight: '1px #fff solid' }}>
<div className="column-1" style={{ borderRight: '1px #fff solid', backgroundColor: '#37b5e6' }}>
<span>{"Amount"}</span>
</div>
<div className="column-2" style={{ borderLeft: '1px #fff solid' }}>
<div className="column-2" style={{ borderLeft: '1px #fff solid', backgroundColor: '#37b5e6' }}>
<span>{"%"}</span>
</div>
</div>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid' }}>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid', backgroundColor: '#07a7d0' }}>
<div style={{ borderBottom: '1px #fff solid' }}>
<span>{"Act vs MB"}</span>
</div>
......@@ -131,7 +160,7 @@ export default class BalanceSheetMR extends Component {
</div>
</div>
</div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid' }}>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid', backgroundColor: '#07a7d0' }}>
<div style={{ borderBottom: '1px #fff solid' }}>
<span>{"Act vs RB"}</span>
</div>
......@@ -200,9 +229,57 @@ export default class BalanceSheetMR extends Component {
}
}
},
{
name: `MTD Explanation`,
options: {
customHeadRender: (columnMeta) => (
<th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
{/* <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> */}
<div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
<div className="grid grid-3x" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid" }}>
<span>{"vs Prev Month"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid" }}>
<span>{"vs MB"}</span>
</div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5 }}>
<span>{"vs RB"}</span>
</div>
</div>
</th>
),
setCellProps: () => ({ style2 }),
customBodyRender: (val, tableMeta, updateValue) => {
return (
<div>
<div className="grid grid-3x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{val.a}
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{val.b}
</div>
</div>
<div className="col-3">
<div style={{ textAlign: 'right', width: 90 }}>
{val.c}
</div>
</div>
</div>
</div>
)
}
}
},
]
let data = [
["Total Assets", "1", { a: "2", b: "3", c: "4" }, "5", { a: "6", b: "7", c: "8", d: "9", e: "10", f: "11" }],
["Total Assets", "1", { a: "2", b: "3", c: "4" }, "5", { a: "6", b: "7", c: "8", d: "9", e: "10", f: "11" }, { a: "12", b: "13", c: "14" }],
["Total Assets", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"]
]
return (
......
......@@ -181,7 +181,7 @@ export default class Profile extends Component {
getPerusahaan() {
api.create().getPerusahaanHierarki().then((response) => {
// console.log(response);
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
......
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