Commit 87576ef4 authored by Rifka Kurnia's avatar Rifka Kurnia

Merge branch 'rifka' into 'master'

create master data cat ui

See merge request !1205
parents e54a3136 46fb5d30
...@@ -185,6 +185,9 @@ const create = (type = "") => { ...@@ -185,6 +185,9 @@ const create = (type = "") => {
const searchParameter = (body) => api.post('setting/search_setting', body) const searchParameter = (body) => api.post('setting/search_setting', body)
const deleteParameter = (id) => api.post(`setting/delete_setting/${id}`) const deleteParameter = (id) => api.post(`setting/delete_setting/${id}`)
// MASTER DATA - CAT
const getParentItemReport = (body) => api.post('item_report/get_parent_item_report_default', body)
//Transaction //Transaction
const getReportTypeBody = (body) => api.post('transaction/master_budget/get_all_report', body) const getReportTypeBody = (body) => api.post('transaction/master_budget/get_all_report', body)
const getMasterBudgetAtt = (body) => api.post('transaction/master_budget/get_report_attachment', body) const getMasterBudgetAtt = (body) => api.post('transaction/master_budget/get_report_attachment', body)
...@@ -683,7 +686,8 @@ const create = (type = "") => { ...@@ -683,7 +686,8 @@ const create = (type = "") => {
getHierarkiCronJobMRCF, getHierarkiCronJobMRCF,
getHierarkiCronJobMRRatio, getHierarkiCronJobMRRatio,
getRollingOutlookID, getRollingOutlookID,
getRollingOutlookBS getRollingOutlookBS,
getParentItemReport
} }
} }
......
...@@ -72,7 +72,9 @@ export default class CreateMasterDataCAT extends Component { ...@@ -72,7 +72,9 @@ export default class CreateMasterDataCAT extends Component {
maxAchValue: null, maxAchValue: null,
formulaYTDValue: null, formulaYTDValue: null,
kpiDisable: true, kpiDisable: true,
maxAchDisable: true maxAchDisable: true,
listPeriode: null,
// periode: null,
} }
} }
...@@ -87,8 +89,73 @@ export default class CreateMasterDataCAT extends Component { ...@@ -87,8 +89,73 @@ export default class CreateMasterDataCAT extends Component {
startDate: date, startDate: date,
endDate: date endDate: date
}) })
this.getPeriode()
} }
getPeriode() {
api.create().getPeriodeTransaction().then(response => {
let currentYear = new Date().getFullYear()
console.log(currentYear)
console.log(response)
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 periode = String(Number(currentYear))
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], loading: false })
}
}
})
}
getParentIR() {
let payload = {
"report_id":3,
"years":this.state.periode.periode
}
api.create().getParentItemReport(payload).then(response => {
console.log(payload)
console.log(response)
if (response.data) {
if (response.data.status === "success") {
response.data.data.map((item) => {
console.log(item.description)
this.setState({
itemReport1 : String(item.description).toLocaleLowerCase().includes("financial").tolocal ? item.description : null
})
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
console.log(this.state.itemReport1)
})
}
handleChange(e, type) { handleChange(e, type) {
let data = this.state let data = this.state
...@@ -545,11 +612,14 @@ export default class CreateMasterDataCAT extends Component { ...@@ -545,11 +612,14 @@ export default class CreateMasterDataCAT extends Component {
<div className="column-2"> <div className="column-2">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete <Autocomplete
{...this.state.listReportType} {...this.state.listPeriode}
id="reportType" id="year"
onChange={(event, newInputValue) => this.setState({ reportType: newInputValue, kpiDisable: true, maxAchDisable: true }, () => { // onChange={(event, newInputValue) => this.setState({ reportType: newInputValue, kpiDisable: true, maxAchDisable: true }, () => {
newInputValue == null || (newInputValue.report_name !== 'CAT') ? this.setState({ kpiTypeValue: null, maxAchValue: null, formulaYTDValue: null }, () => this.clearMessage()) // newInputValue == null || (newInputValue.report_name !== 'CAT') ? this.setState({ kpiTypeValue: null, maxAchValue: null, formulaYTDValue: null }, () => this.clearMessage())
: this.clearMessage(); // : this.clearMessage();
// })}
onChange={(event, newInputValue) => this.setState({ periode: newInputValue, loading: true, previewTable: false }, () => {
this.getParentIR()
})} })}
debug debug
renderInput={(params) => renderInput={(params) =>
...@@ -566,14 +636,29 @@ export default class CreateMasterDataCAT extends Component { ...@@ -566,14 +636,29 @@ export default class CreateMasterDataCAT extends Component {
helperText={this.state.msgErrorJenisLaporan} helperText={this.state.msgErrorJenisLaporan}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }} InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>} />}
value={this.state.reportType} value={this.state.periode}
/> />
{/* <Autocomplete
{...this.state.listPeriode}
id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue, loading: true, previewTable: false }, () => {
// this.getSubmission()
this.getDataTable()
})}
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> </div>
</div> </div>
<div style={{ borderBottom: 'solid 1px #c4c4c4', margin: 20, marginBottom: 10 }} > <div style={{ borderBottom: 'solid 1px #c4c4c4', margin: 20, marginBottom: 10 }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', padding: 10 }}>Item Report - 1</Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b', padding: 10, fontWeight: 'bold' }}>Item Report - 1</Typography>
</div> </div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}> <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
...@@ -605,10 +690,10 @@ export default class CreateMasterDataCAT extends Component { ...@@ -605,10 +690,10 @@ export default class CreateMasterDataCAT extends Component {
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
id="orders" id="reportName1"
name="order" name="reportName1"
label="Report Name" label="Report Name"
// disabled disabled
// onChange={(e) => this.handleChange(e, null)} // onChange={(e) => this.handleChange(e, null)}
// value={this.state.order} // value={this.state.order}
value={'CAT'} value={'CAT'}
...@@ -637,41 +722,42 @@ export default class CreateMasterDataCAT extends Component { ...@@ -637,41 +722,42 @@ export default class CreateMasterDataCAT extends Component {
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}> <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1"> <div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete <TextField
{...this.state.listReportType} style={{ width: '100%' }}
id="reportName1" id="itemReportName1"
onChange={(event, newInputValue) => this.setState({ reportType: newInputValue, kpiDisable: true, maxAchDisable: true }, () => { name="itemReportName1"
newInputValue == null || (newInputValue.report_name !== 'CAT') ? this.setState({ kpiTypeValue: null, maxAchValue: null, formulaYTDValue: null }, () => this.clearMessage())
: this.clearMessage();
})}
debug
renderInput={(params) =>
<TextField {...params}
label="Item Report Name" label="Item Report Name"
disabled
// onChange={(e) => this.handleChange(e, null)}
// value={this.state.order}
value={'item report name'}
// error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder}
inputProps={{
min: 0,
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085',
} }
}} }}
error={this.state.errorJenisLaporan} >
helperText={this.state.msgErrorJenisLaporan} </TextField>
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>}
value={this.state.reportType}
// value={'FINANCIAL PERSPECTIVE'}
// disabled
/>
</div> </div>
</div> </div>
<div className="column-2"> <div className="column-2">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
id="weight" id="weight1"
name="weight1"
label="Weight" label="Weight"
name="weight"
value={this.state.weight} value={this.state.weight}
onChange={(e) => this.handleChange(e, '')} onChange={(e) => this.handleChange(e, '')}
inputProps={{ inputProps={{
...@@ -694,7 +780,7 @@ export default class CreateMasterDataCAT extends Component { ...@@ -694,7 +780,7 @@ export default class CreateMasterDataCAT extends Component {
</div> </div>
<div style={{ borderBottom: 'solid 1px #c4c4c4', margin: 20, marginBottom: 10 }} > <div style={{ borderBottom: 'solid 1px #c4c4c4', margin: 20, marginBottom: 10 }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', padding: 10 }}>Item Report - 2</Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b', padding: 10, fontWeight: 'bold' }}>Item Report - 2</Typography>
</div> </div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}> <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
...@@ -758,41 +844,42 @@ export default class CreateMasterDataCAT extends Component { ...@@ -758,41 +844,42 @@ export default class CreateMasterDataCAT extends Component {
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}> <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1"> <div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete <TextField
{...this.state.listReportType} style={{ width: '100%' }}
id="reportType" id="itemReportName2"
onChange={(event, newInputValue) => this.setState({ reportType: newInputValue, kpiDisable: true, maxAchDisable: true }, () => { name="itemReportName2"
newInputValue == null || (newInputValue.report_name !== 'CAT') ? this.setState({ kpiTypeValue: null, maxAchValue: null, formulaYTDValue: null }, () => this.clearMessage())
: this.clearMessage();
})}
debug
renderInput={(params) =>
<TextField {...params}
label="Item Report Name" label="Item Report Name"
disabled
// onChange={(e) => this.handleChange(e, null)}
// value={this.state.order}
value={'item report name'}
// error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder}
inputProps={{
min: 0,
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085',
} }
}} }}
error={this.state.errorJenisLaporan} >
helperText={this.state.msgErrorJenisLaporan} </TextField>
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>}
value={this.state.reportType}
// value={'FINANCIAL PERSPECTIVE'}
// disabled
/>
</div> </div>
</div> </div>
<div className="column-2"> <div className="column-2">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
id="weight" id="weight2"
name="weight2"
label="Weight" label="Weight"
name="weight"
value={this.state.weight} value={this.state.weight}
onChange={(e) => this.handleChange(e, '')} onChange={(e) => this.handleChange(e, '')}
inputProps={{ inputProps={{
...@@ -815,7 +902,7 @@ export default class CreateMasterDataCAT extends Component { ...@@ -815,7 +902,7 @@ export default class CreateMasterDataCAT extends Component {
</div> </div>
<div style={{ borderBottom: 'solid 1px #c4c4c4', margin: 20, marginBottom: 10 }} > <div style={{ borderBottom: 'solid 1px #c4c4c4', margin: 20, marginBottom: 10 }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', padding: 10 }}>Item Report - 3</Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b', padding: 10, fontWeight: 'bold' }}>Item Report - 3</Typography>
</div> </div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}> <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
...@@ -879,41 +966,42 @@ export default class CreateMasterDataCAT extends Component { ...@@ -879,41 +966,42 @@ export default class CreateMasterDataCAT extends Component {
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}> <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1"> <div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete <TextField
{...this.state.listReportType} style={{ width: '100%' }}
id="reportType" id="itemReportName3"
onChange={(event, newInputValue) => this.setState({ reportType: newInputValue, kpiDisable: true, maxAchDisable: true }, () => { name="itemReportName3"
newInputValue == null || (newInputValue.report_name !== 'CAT') ? this.setState({ kpiTypeValue: null, maxAchValue: null, formulaYTDValue: null }, () => this.clearMessage())
: this.clearMessage();
})}
debug
renderInput={(params) =>
<TextField {...params}
label="Item Report Name" label="Item Report Name"
disabled
// onChange={(e) => this.handleChange(e, null)}
// value={this.state.order}
value={'item report name'}
// error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder}
inputProps={{
min: 0,
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085',
} }
}} }}
error={this.state.errorJenisLaporan} >
helperText={this.state.msgErrorJenisLaporan} </TextField>
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>}
value={this.state.reportType}
// value={'FINANCIAL PERSPECTIVE'}
// disabled
/>
</div> </div>
</div> </div>
<div className="column-2"> <div className="column-2">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
id="weight" id="weight3"
name="weight3"
label="Weight" label="Weight"
name="weight"
value={this.state.weight} value={this.state.weight}
onChange={(e) => this.handleChange(e, '')} onChange={(e) => this.handleChange(e, '')}
inputProps={{ inputProps={{
...@@ -936,7 +1024,7 @@ export default class CreateMasterDataCAT extends Component { ...@@ -936,7 +1024,7 @@ export default class CreateMasterDataCAT extends Component {
</div> </div>
<div style={{ borderBottom: 'solid 1px #c4c4c4', margin: 20, marginBottom: 10 }} > <div style={{ borderBottom: 'solid 1px #c4c4c4', margin: 20, marginBottom: 10 }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', padding: 10 }}>Item Report - 4</Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b', padding: 10, fontWeight: 'bold' }}>Item Report - 4</Typography>
</div> </div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}> <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
...@@ -1000,41 +1088,42 @@ export default class CreateMasterDataCAT extends Component { ...@@ -1000,41 +1088,42 @@ export default class CreateMasterDataCAT extends Component {
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}> <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1"> <div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete <TextField
{...this.state.listReportType} style={{ width: '100%' }}
id="reportType" id="itemReportName4"
onChange={(event, newInputValue) => this.setState({ reportType: newInputValue, kpiDisable: true, maxAchDisable: true }, () => { name="itemReportName4"
newInputValue == null || (newInputValue.report_name !== 'CAT') ? this.setState({ kpiTypeValue: null, maxAchValue: null, formulaYTDValue: null }, () => this.clearMessage())
: this.clearMessage();
})}
debug
renderInput={(params) =>
<TextField {...params}
label="Item Report Name" label="Item Report Name"
disabled
// onChange={(e) => this.handleChange(e, null)}
// value={this.state.order}
value={'item report name'}
// error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder}
inputProps={{
min: 0,
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
}
}}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085',
} }
}} }}
error={this.state.errorJenisLaporan} >
helperText={this.state.msgErrorJenisLaporan} </TextField>
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>}
value={this.state.reportType}
// value={'FINANCIAL PERSPECTIVE'}
// disabled
/>
</div> </div>
</div> </div>
<div className="column-2"> <div className="column-2">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
id="weight" id="weight4"
name="weight4"
label="Weight" label="Weight"
name="weight"
value={this.state.weight} value={this.state.weight}
onChange={(e) => this.handleChange(e, '')} onChange={(e) => this.handleChange(e, '')}
inputProps={{ inputProps={{
......
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