Commit cdd61b6c authored by Deni Rinaldi's avatar Deni Rinaldi

budgetTahunan

parent 6bceff12
...@@ -20,7 +20,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -20,7 +20,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
// 10 second timeout... // 10 second timeout...
timeout: 10000 timeout: 30000
}) })
api.addAsyncRequestTransform(request => async () => { api.addAsyncRequestTransform(request => async () => {
...@@ -166,6 +166,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -166,6 +166,8 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const getPeriodeTransaction = () => api.get('transaction/get_periode') const getPeriodeTransaction = () => api.get('transaction/get_periode')
const deleteAttachment = (id) => api.post(`transaction/delete_attachment/${id}`) const deleteAttachment = (id) => api.post(`transaction/delete_attachment/${id}`)
const getDetailReportMB = (body) => api.post('/transaction/master_budget/get_report_hierarki', body) const getDetailReportMB = (body) => api.post('/transaction/master_budget/get_report_hierarki', body)
const createSubmitReport = (body) => api.post('transaction/master_budget/create_submission_report', body)
const getSubmission = (body) => api.post('transaction/get_submission_id', body)
//Template //Template
const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`) const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`)
...@@ -283,7 +285,9 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -283,7 +285,9 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
deleteReportItems, deleteReportItems,
getDocumentCategory, getDocumentCategory,
getAllDocument, getAllDocument,
uploadDocument uploadDocument,
createSubmitReport,
getSubmission
} }
} }
......
...@@ -36,6 +36,7 @@ const Images = { ...@@ -36,6 +36,7 @@ const Images = {
up: require('./up.svg'), up: require('./up.svg'),
down: require('./down.svg'), down: require('./down.svg'),
close: require('./close.svg'), close: require('./close.svg'),
cross: require('./cross.svg'),
//Image //Image
triputra: require('./triputra.png'), triputra: require('./triputra.png'),
......
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="23" height="24" viewBox="0 0 23 24">
<defs>
<path id="ni206yvona" d="M0 0L22.46 0 22.46 23.835 0 23.835z"/>
</defs>
<g fill="none" fill-rule="evenodd">
<mask id="6c78lb5jhb" fill="#fff">
<use xlink:href="#ni206yvona"/>
</mask>
<path fill="#EC1F25" d="M21.08 23.834c-.96-.003-1.715-.22-2.447-.515-1.416-.569-2.64-1.45-3.834-2.38-1.443-1.124-2.783-2.362-4.057-3.671-.718-.738-1.369-1.535-2.019-2.331-.137-.168-.131-.168-.243.019-1.084 1.801-2.058 3.66-3.006 5.535-.48.95-1.093 1.812-1.87 2.551-.6.574-1.286.876-2.131.72C.7 23.618.127 22.904.023 22.26c-.073-.446.06-.877.316-1.268.727-1.11 1.42-2.244 2.17-3.338.828-1.207 1.53-2.492 2.37-3.69.448-.64.9-1.279 1.371-1.902.078-.103.09-.173.006-.283-.993-1.32-1.925-2.68-2.772-4.1-.476-.797-1.017-1.557-1.524-2.336C1.408 4.498.852 3.656.316 2.8-.025 2.255-.13 1.671.201 1.078.556.443 1.072.06 1.831.037c.712-.022 1.27.285 1.767.753.828.782 1.459 1.709 1.963 2.72.914 1.834 1.882 3.64 2.932 5.399.058.097.092.182.207.033.959-1.234 2.005-2.39 3.137-3.467 1.458-1.387 2.981-2.697 4.664-3.811C17.528.984 18.609.42 19.819.142c.597-.137 1.199-.206 1.806-.063.25.06.472.17.653.357.238.246.24.556.006.812-.327.357-.749.573-1.182.755-1.315.55-2.447 1.379-3.542 2.267-1.128.913-2.192 1.897-3.21 2.93-1.106 1.119-2.159 2.286-3.104 3.546-.256.34-.486.7-.736 1.045-.072.099-.057.17.007.265.756 1.13 1.606 2.187 2.52 3.193.913 1.009 1.868 1.975 2.873 2.892 1.09.995 2.219 1.941 3.448 2.764.657.44 1.378.751 2.085 1.094.285.138.555.3.78.53.347.352.312.722-.1 1.007-.363.25-.774.306-1.042.298" mask="url(#6c78lb5jhb)"/>
</g>
</svg>
...@@ -15,6 +15,7 @@ import { ExcelRenderer } from 'react-excel-renderer'; ...@@ -15,6 +15,7 @@ import { ExcelRenderer } from 'react-excel-renderer';
import UploadFile from "../library/Upload"; import UploadFile from "../library/Upload";
import { format } from 'date-fns'; import { format } from 'date-fns';
import Constant from '../library/Constant'; import Constant from '../library/Constant';
import PropagateLoader from "react-spinners/PropagateLoader"
const Alert = withStyles({ const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />); })((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
...@@ -42,6 +43,7 @@ export default class BudgetTahunan extends Component { ...@@ -42,6 +43,7 @@ export default class BudgetTahunan extends Component {
alert: false, alert: false,
tipeAlert: '', tipeAlert: '',
messageAlert: '', messageAlert: '',
submissionID: null
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -73,7 +75,7 @@ export default class BudgetTahunan extends Component { ...@@ -73,7 +75,7 @@ export default class BudgetTahunan extends Component {
"report_type": "Master Budget", "report_type": "Master Budget",
} }
api.create().getReportTypeBody(payload).then(response => { api.create().getReportTypeBody(payload).then(response => {
// console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
let dataTable = response.data.data.map((item, index) => { let dataTable = response.data.data.map((item, index) => {
...@@ -88,8 +90,10 @@ export default class BudgetTahunan extends Component { ...@@ -88,8 +90,10 @@ export default class BudgetTahunan extends Component {
] ]
}) })
// console.log(dataTable); // console.log(dataTable);
this.setState({ dataTable }) this.setState({ dataTable, loading: false })
} }
} else {
this.setState({ loading: false })
} }
}) })
} }
...@@ -148,6 +152,7 @@ export default class BudgetTahunan extends Component { ...@@ -148,6 +152,7 @@ export default class BudgetTahunan extends Component {
let index = data.sort((a, b) => a - b).findIndex((val) => val == year) let index = data.sort((a, b) => a - b).findIndex((val) => val == year)
this.setState({ listPeriode: defaultProps, periode: index == -1 ? periodeData[0] : periodeData[index] }, () => { this.setState({ listPeriode: defaultProps, periode: index == -1 ? periodeData[0] : periodeData[index] }, () => {
this.getRevision() this.getRevision()
this.getSubmission()
}) })
} }
} }
...@@ -182,6 +187,22 @@ export default class BudgetTahunan extends Component { ...@@ -182,6 +187,22 @@ export default class BudgetTahunan extends Component {
}) })
} }
getSubmission() {
let payload = {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode
}
api.create().getSubmission(payload).then(response => {
if (response) {
if (response.data.data) {
this.setState({ submissionID: response.data.data.submission_id })
} else {
this.setState({ submissionID: null })
}
}
})
}
clickDetail(item, id, revision) { clickDetail(item, id, revision) {
console.log(item); console.log(item);
this.setState({ this.setState({
...@@ -288,8 +309,18 @@ export default class BudgetTahunan extends Component { ...@@ -288,8 +309,18 @@ export default class BudgetTahunan extends Component {
this.setState({ alert: false }) this.setState({ alert: false })
} }
getDataBalanceSheet(data){ getDataBalanceSheet(data) {
console.log(data) this.setState({ loading: true })
// console.log(JSON.stringify(data));
api.create().createSubmitReport(data).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.getReport()
this.getSubmission()
}
}
})
} }
...@@ -336,9 +367,11 @@ export default class BudgetTahunan extends Component { ...@@ -336,9 +367,11 @@ export default class BudgetTahunan extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{val === "submitted" || val === "approved" ? {val === "submitted" || val === "approved" ?
<img src={Images.ceklis} style={{ width: 31, height: 24 }} /> : <img src={Images.ceklis} style={{ width: 31, height: 24 }} /> :
val === "revision" ? val === "draft" ?
<span>Revisi</span> : <img src={Images.cross} style={{ width: 31, height: 24 }} /> :
null val === "revision" ?
<span>Revisi</span> :
null
} }
</div > </div >
); );
...@@ -422,6 +455,16 @@ export default class BudgetTahunan extends Component { ...@@ -422,6 +455,16 @@ export default class BudgetTahunan extends Component {
{ value: '0', label: '0' }, { value: '0', label: '0' },
{ value: '1', label: '1' }, { value: '1', label: '1' },
] ]
const loadingComponent = (
<div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<PropagateLoader
// css={override}
size={20}
color={"#274B80"}
loading={this.state.loading}
/>
</div>
);
return ( return (
<div style={{ flex: 1, backgroundColor: '#f8f8f8' }}> <div style={{ flex: 1, backgroundColor: '#f8f8f8' }}>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}> <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
...@@ -429,6 +472,7 @@ export default class BudgetTahunan extends Component { ...@@ -429,6 +472,7 @@ export default class BudgetTahunan extends Component {
{this.state.messageAlert} {this.state.messageAlert}
</Alert> </Alert>
</Snackbar> </Snackbar>
{this.state.loading && loadingComponent}
{this.state.visibleBudgetTahunan && ( {this.state.visibleBudgetTahunan && (
<div> <div>
<div className={"main-color"} style={{ height: 78, display: 'flex', alignItems: 'center', paddingLeft: 20 }}> <div className={"main-color"} style={{ height: 78, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
...@@ -447,6 +491,7 @@ export default class BudgetTahunan extends Component { ...@@ -447,6 +491,7 @@ export default class BudgetTahunan extends Component {
onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => { onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => {
this.getReport() this.getReport()
this.getReportAttachment() this.getReportAttachment()
this.getSubmission()
})} })}
debug debug
disableClearable disableClearable
...@@ -462,6 +507,7 @@ export default class BudgetTahunan extends Component { ...@@ -462,6 +507,7 @@ export default class BudgetTahunan extends Component {
onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => { onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => {
this.getReport() this.getReport()
this.getReportAttachment() this.getReportAttachment()
this.getSubmission()
})} })}
debug debug
disableClearable disableClearable
...@@ -599,6 +645,7 @@ export default class BudgetTahunan extends Component { ...@@ -599,6 +645,7 @@ export default class BudgetTahunan extends Component {
company={this.state.company} company={this.state.company}
revision={this.state.revisionTable} revision={this.state.revisionTable}
periode={this.state.periode.periode} periode={this.state.periode.periode}
submissionID={this.state.submissionID}
getDataBalanceSheet={this.getDataBalanceSheet.bind(this)} getDataBalanceSheet={this.getDataBalanceSheet.bind(this)}
onClickClose={() => this.setState({ visibleBS: false, visibleBudgetTahunan: true })} onClickClose={() => this.setState({ visibleBS: false, visibleBudgetTahunan: true })}
/> />
......
...@@ -5,6 +5,7 @@ import NumberFormat from 'react-number-format'; ...@@ -5,6 +5,7 @@ import NumberFormat from 'react-number-format';
import api from '../../api'; import api from '../../api';
import AddIcon from '@material-ui/icons/Add'; import AddIcon from '@material-ui/icons/Add';
import { values } from 'ramda'; import { values } from 'ramda';
import PropagateLoader from "react-spinners/PropagateLoader"
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3()); const getMuiTheme = () => createMuiTheme(ct.customTable3());
...@@ -48,11 +49,13 @@ export default class BalanceSheet extends Component { ...@@ -48,11 +49,13 @@ export default class BalanceSheet extends Component {
} }
getItemHierarki() { getItemHierarki() {
this.setState({ loading: true })
let payload = { let payload = {
"report_id": this.props.report_id, "report_id": this.props.report_id,
"revision": Number(this.props.revision), "revision": Number(this.props.revision),
"periode": this.props.periode, "periode": this.props.periode,
"company_id": this.props.company.company_id "company_id": this.props.company.company_id,
"submission_id": this.props.submissionID
} }
api.create().getDetailReportMB(payload).then(response => { api.create().getDetailReportMB(payload).then(response => {
console.log(response); console.log(response);
...@@ -670,8 +673,10 @@ export default class BalanceSheet extends Component { ...@@ -670,8 +673,10 @@ export default class BalanceSheet extends Component {
} }
}) })
console.log(dataTable); console.log(dataTable);
this.setState({ dataTable }) this.setState({ dataTable, loading: false })
} }
} else {
this.setState({ loading: false })
} }
}) })
} }
...@@ -708,14 +713,40 @@ export default class BalanceSheet extends Component { ...@@ -708,14 +713,40 @@ export default class BalanceSheet extends Component {
// }, () => console.log(this.state.dataTable)) // }, () => console.log(this.state.dataTable))
} }
backToMasterBudget(){ backToMasterBudget(type) {
let data = this.state.dataTable.map(i => { let data = []
return [ this.state.dataTable.map(i => {
i[1], i[4], i[6], i[7], i[8], i[9], i[10], i[11], i[12], i[13], i[14], i[15], i[16], i[17], i[18], i[19], i[20], i[21] data.push({
] item_report_id: i[1],
total_actual_before: String(i[6]),
january: String(i[7]),
february: String(i[8]),
march: String(i[9]),
april: String(i[10]),
may: String(i[11]),
june: String(i[12]),
july: String(i[13]),
august: String(i[14]),
september: String(i[15]),
october: String(i[16]),
november: String(i[17]),
december: String(i[18]),
total_current_year: String(i[19]),
total_next_year: String(i[20]),
total_more_year: String(i[21])
})
}) })
let payload = {
"submission_id": this.props.submissionID,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"status": type,
"balance_sheet": data
}
// console.log(data); // console.log(data);
this.props.getDataBalanceSheet(data) this.props.getDataBalanceSheet(payload)
this.props.onClickClose() this.props.onClickClose()
} }
...@@ -1948,14 +1979,23 @@ export default class BalanceSheet extends Component { ...@@ -1948,14 +1979,23 @@ export default class BalanceSheet extends Component {
} }
} }
] ]
const loadingComponent = (
console.log(this.props.width); <div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<PropagateLoader
// css={override}
size={20}
color={"#274B80"}
loading={this.state.loading}
/>
</div>
);
return ( return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}> <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}> <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Pengajuan Budget Tahunan</Typography> <Typography style={{ fontSize: '16px', color: 'white' }}>Pengajuan Budget Tahunan</Typography>
</div> </div>
{this.state.loading && loadingComponent}
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}> <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} > <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
...@@ -1981,14 +2021,13 @@ export default class BalanceSheet extends Component { ...@@ -1981,14 +2021,13 @@ export default class BalanceSheet extends Component {
<div className="grid grid-2x" style={{ marginTop: 20 }}> <div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1"> <div className="col-1">
<button <button
className="button"
type="button" type="button"
onClick={() => this.backToMasterBudget('draft')}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
}} }}
onClick={() => this.props.onClickClose()}
> >
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
...@@ -2001,7 +2040,7 @@ export default class BalanceSheet extends Component { ...@@ -2001,7 +2040,7 @@ export default class BalanceSheet extends Component {
</div> </div>
<button <button
type="button" type="button"
onClick={() => this.backToMasterBudget()} onClick={() => this.backToMasterBudget('submitted')}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
......
...@@ -84,6 +84,7 @@ export default class CreateManagementDoc extends Component { ...@@ -84,6 +84,7 @@ export default class CreateManagementDoc extends Component {
getDataDocument() { getDataDocument() {
api.create().getDocumentCategory().then(response => { api.create().getDocumentCategory().then(response => {
console.log(response);
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
......
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