Commit 3fdd3412 authored by Deni Rinaldi's avatar Deni Rinaldi

OTW Bandara

parent db7314d5
......@@ -189,6 +189,7 @@ const create = (type = "") => {
const uploadAttachment = (body) => api.post('transaction/master_budget/upload_attachment', body)
const getRevision = (body) => api.post('transaction/master_budget/get_revision', body)
const getPeriodeTransaction = () => api.get('transaction/get_periode')
const getMonthTransaction = () => api.get('transaction/get_default_month')
const deleteAttachment = (id) => api.post(`transaction/master_budget/delete_attachment/${id}`)
const getDetailReportMB = (body) => api.post('/transaction/master_budget/get_report_hierarki', body)
const getLastestUpdateMB = (body) => api.post('/transaction/master_budget/get_latest_update', body)
......@@ -197,7 +198,6 @@ const create = (type = "") => {
const checkUploadMB = (body) => api.post('transaction/master_budget/check_import', body)
const uploadMasterBudget = (body) => api.post('transaction/master_budget/import_master_budget', body)
const validateSubmitReport = (body) => api.post('transaction/master_budget/validate_save', body)
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)
......@@ -437,7 +437,7 @@ const create = (type = "") => {
getHierarkiMontlyReport,
getDetailReportCF,
getReportHierarkiPL,
getMonthlyReportID,
getMonthlyReportID
}
}
......
......@@ -27,6 +27,8 @@ export default class MonthlyReport extends Component {
visibleBS: false,
listPeriode: null,
periode: null,
listMonth: null,
month: null,
listCompany: null,
company: null,
report_id: null,
......@@ -103,7 +105,7 @@ export default class MonthlyReport extends Component {
getOptionLabel: (option) => titleCase(option.company_name),
};
this.setState({ listCompany: defaultProps, company: companyData[0] }, () => {
this.getPeriode()
this.getMonth()
})
} else {
alert(response.data.message)
......@@ -111,6 +113,35 @@ export default class MonthlyReport extends Component {
})
}
getMonth(){
api.create().getMonthTransaction().then(response => {
let dateNow = new Date
let month = format(dateNow, 'MMMM')
console.log(response);
if (response.data) {
if (response.data.status === "success") {
console.log(response);
let data = response.data.data
let monthData = data.map((item) => {
return {
month_id: item.id,
month_value: String(item.month_name).substr(0,3)
}
})
let defaultProps = {
options: monthData,
getOptionLabel: (option) => option.month_value,
};
let index = data.sort((a, b) => a - b).findIndex((val) => val.month_name == month)
console.log(index);
this.setState({ listMonth: defaultProps, month: index == -1 ? monthData[0] : monthData[index]}, ()=> {
this.getPeriode()
})
}
}
})
}
getPeriode() {
api.create().getPeriodeTransaction().then(response => {
let dateNow = new Date
......@@ -414,7 +445,19 @@ export default class MonthlyReport extends Component {
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report</Typography>
</div>
<div style={{ padding: 20 }}>
<div>
<div style={{ display: 'flex' }}>
<Autocomplete
{...this.state.listMonth}
id="month"
onChange={(event, newInputValue) => this.setState({ month: newInputValue }, () => {
this.getMonthlyReportID()
})}
disableClearable
style={{ width: 250, marginRight: 20 }}
renderInput={(params) => <TextField {...params} label="Month" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.month}
/>
<Autocomplete
{...this.state.listPeriode}
id="periode"
......
......@@ -47,7 +47,7 @@ export default class BalanceSheetMR extends Component {
async getItemHierarki() {
let payload = {
"report_id": 2,
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"periode": this.props.periode,
"company_id": this.props.company.company_id,
......
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