Commit d7f22e87 authored by Deni Rinaldi's avatar Deni Rinaldi

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

last

See merge request !503
parents 5bc900c9 b288fc9b
...@@ -212,6 +212,8 @@ const create = (type = "") => { ...@@ -212,6 +212,8 @@ const create = (type = "") => {
const historyApproval = (body) => api.post('transaction/master_budget/history_approval', body) const historyApproval = (body) => api.post('transaction/master_budget/history_approval', body)
const getOpetratingIndID = (body) => api.post('transaction/operating_indicator/get_operating_indicator_id', body) const getOpetratingIndID = (body) => api.post('transaction/operating_indicator/get_operating_indicator_id', body)
const getSubmitOI = (body) => api.post('transaction/operating_indicator/get_latest_periode_submit', body)
const getLastPeriodOI = (idCompany) => api.get(`transaction/operating_indicator/get_last_periode/${idCompany}`)
const getAllOperatingInd = (body) => api.post('transaction/operating_indicator/get_all_report', body) const getAllOperatingInd = (body) => api.post('transaction/operating_indicator/get_all_report', body)
const getOperatingIndDetail = (body) => api.post('transaction/operating_indicator/get_report_hierarki', body) const getOperatingIndDetail = (body) => api.post('transaction/operating_indicator/get_report_hierarki', body)
const createOpetaingInd = (body) => api.post('transaction/operating_indicator/create_operating_indicator_report', body) const createOpetaingInd = (body) => api.post('transaction/operating_indicator/create_operating_indicator_report', body)
...@@ -417,7 +419,9 @@ const create = (type = "") => { ...@@ -417,7 +419,9 @@ const create = (type = "") => {
getReportOLPA, getReportOLPA,
approvalSubmissionOLPA, approvalSubmissionOLPA,
checkApproverOLPA, checkApproverOLPA,
getLastPeriodeOI getLastPeriodeOI,
getSubmitOI,
getLastPeriodOI
} }
} }
......
...@@ -46,7 +46,8 @@ export default class BalanceSheet extends Component { ...@@ -46,7 +46,8 @@ export default class BalanceSheet extends Component {
buttonError: false, buttonError: false,
judulColumn: null, judulColumn: null,
updateBy: '-', updateBy: '-',
handleTekTekTek: 0 handleTekTekTek: 0,
saveDraft: true
} }
this.handleValue = this.handleValue.bind(this) this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -331,15 +332,15 @@ export default class BalanceSheet extends Component { ...@@ -331,15 +332,15 @@ export default class BalanceSheet extends Component {
item.total_next_year, item.total_next_year,
item.total_more_year, item.total_more_year,
item.orders, item.orders,
item.condition_it_should_be ? item.condition_it_should_be : '0', item.condition_it_should_be,
item.condition_if_wrong ? item.condition_if_wrong : "STOPPER", item.condition_if_wrong,
item.error item.error
] ]
}) })
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, errorPreview: false }, () => {
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[25].length > 0) { if (item[25].length > 0) {
console.log('masuk') console.log('error')
this.setState({ buttonError: true, errorPreview: true, editable: true }) this.setState({ buttonError: true, errorPreview: true, editable: true })
} }
}) })
...@@ -451,9 +452,9 @@ export default class BalanceSheet extends Component { ...@@ -451,9 +452,9 @@ export default class BalanceSheet extends Component {
api.create().validateSubmitReport(payload).then((response) => { api.create().validateSubmitReport(payload).then((response) => {
console.log(response) console.log(response)
if (response.data.data.result) { if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: false }) this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
} else { } else {
this.setState({ loading: false, buttonError: true, editable: true }) this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
} }
}) })
} }
...@@ -3022,13 +3023,13 @@ export default class BalanceSheet extends Component { ...@@ -3022,13 +3023,13 @@ export default class BalanceSheet extends Component {
type="button" type="button"
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default', cursor: this.state.saveDraft !== true ? 'pointer' : 'default',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => onClick={() =>
this.state.editable === true ? this.state.saveDraft === true ?
null : null :
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => { this.setState({ handleTekTekTek: 1 }, () => {
...@@ -3132,13 +3133,13 @@ export default class BalanceSheet extends Component { ...@@ -3132,13 +3133,13 @@ export default class BalanceSheet extends Component {
type="button" type="button"
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default', cursor: this.state.errorPreview !== true ? 'pointer' : 'default',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => onClick={() =>
this.state.editable === true ? this.state.errorPreview === true ?
null : null :
this.setState({ loading: true }, () => this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
......
...@@ -74,7 +74,7 @@ export default class OperatingIndicator extends Component { ...@@ -74,7 +74,7 @@ export default class OperatingIndicator extends Component {
} }
getLastPeriod() { getLastPeriod() {
api.create().getLastPeriod(this.state.company.company_id).then(response => { api.create().getLastPeriodOI(this.state.company.company_id).then(response => {
console.log(response); console.log(response);
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ lastPeriod: response.data.data.last_periode, latestPeriode: response.data.data.latest_periode }, () => { this.setState({ lastPeriod: response.data.data.last_periode, latestPeriode: response.data.data.latest_periode }, () => {
...@@ -114,13 +114,13 @@ export default class OperatingIndicator extends Component { ...@@ -114,13 +114,13 @@ export default class OperatingIndicator extends Component {
return [ return [
item.number, item.number,
item.report_name, item.report_name,
item.current_status, this.state.isSubmit === false ? "CLOSED" : item.current_status,
item.report_id, item.report_id,
item.is_can_upload item.is_can_upload
] ]
}) })
// console.log(dataTable); // console.log(dataTable);
this.setState({ dataTable, dataReport: response.data.data}) this.setState({ dataTable, dataReport: response.data.data })
} }
} }
}) })
...@@ -132,7 +132,7 @@ export default class OperatingIndicator extends Component { ...@@ -132,7 +132,7 @@ export default class OperatingIndicator extends Component {
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ userCompany: response.data.data.company}, () => { this.setState({ userCompany: response.data.data.company }, () => {
this.getCompanyActive() this.getCompanyActive()
}) })
} }
...@@ -150,21 +150,21 @@ export default class OperatingIndicator extends Component { ...@@ -150,21 +150,21 @@ export default class OperatingIndicator extends Component {
let userCompActive = [] let userCompActive = []
this.state.userCompany.map((item, index) => { this.state.userCompany.map((item, index) => {
let indeks = data.findIndex((val) => val.company_id == item) let indeks = data.findIndex((val) => val.company_id == item)
if (indeks !== -1 && String(data[indeks].status).toLocaleLowerCase() == 'active'){ if (indeks !== -1 && String(data[indeks].status).toLocaleLowerCase() == 'active') {
userCompActive.push(item) userCompActive.push(item)
} }
}) })
data.map(( item, index ) => { data.map((item, index) => {
if (String(item.status).toLocaleLowerCase() == 'active') { if (String(item.status).toLocaleLowerCase() == 'active') {
compActive.push(item) compActive.push(item)
} }
}) })
if (compActive.length == userCompActive.length){ if (compActive.length == userCompActive.length) {
this.setState({ superUser: false}) this.setState({ superUser: false })
} else { } else {
this.setState({ superUser: true}) this.setState({ superUser: true })
} }
let companyData = data.map((item) => { let companyData = data.map((item) => {
...@@ -175,7 +175,7 @@ export default class OperatingIndicator extends Component { ...@@ -175,7 +175,7 @@ export default class OperatingIndicator extends Component {
}) })
let arrayBaru = [] let arrayBaru = []
this.state.userCompany.map((item,index) => { this.state.userCompany.map((item, index) => {
let indexID = companyData.findIndex((val) => val.company_id == item) let indexID = companyData.findIndex((val) => val.company_id == item)
if (indexID !== -1) { if (indexID !== -1) {
arrayBaru.push(companyData[indexID]) arrayBaru.push(companyData[indexID])
...@@ -187,7 +187,7 @@ export default class OperatingIndicator extends Component { ...@@ -187,7 +187,7 @@ export default class OperatingIndicator extends Component {
getOptionLabel: (option) => titleCase(option.company_name), getOptionLabel: (option) => titleCase(option.company_name),
}; };
this.setState({ listCompany: defaultProps, company: arrayBaru.length < 1? companyData[0] : arrayBaru[0] }, () => { this.setState({ listCompany: defaultProps, company: arrayBaru.length < 1 ? companyData[0] : arrayBaru[0] }, () => {
this.getLastPeriod() this.getLastPeriod()
}) })
} else { } else {
...@@ -242,7 +242,6 @@ export default class OperatingIndicator extends Component { ...@@ -242,7 +242,6 @@ export default class OperatingIndicator extends Component {
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 = data.sort((a, b) => a - b).findIndex((val) => val === periode)
this.setState({ listPeriode: defaultProps, periode: index == -1 ? periodeData[0] : periodeData[index] }, () => { this.setState({ listPeriode: defaultProps, periode: index == -1 ? periodeData[0] : periodeData[index] }, () => {
this.getReport()
this.getOperatingID() this.getOperatingID()
}) })
} }
...@@ -301,12 +300,12 @@ export default class OperatingIndicator extends Component { ...@@ -301,12 +300,12 @@ export default class OperatingIndicator extends Component {
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"periode": this.state.periode.periode "periode": this.state.periode.periode
} }
api.create().getSubmitMasterBudget(body).then(response => { api.create().getSubmitOI(body).then(response => {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ isSubmit: response.data.data.is_can_submit }, () => { this.setState({ isSubmit: response.data.data.is_can_submit }, () => {
// this.getReport() this.getReport()
// this.getOperatingID() // this.getOperatingID()
}) })
} }
...@@ -318,7 +317,7 @@ export default class OperatingIndicator extends Component { ...@@ -318,7 +317,7 @@ export default class OperatingIndicator extends Component {
let index = this.state.dataReport.findIndex((val) => val.report_name == item[1]) let index = this.state.dataReport.findIndex((val) => val.report_name == item[1])
if (index !== -1) { if (index !== -1) {
this.setState({ this.setState({
dataDetail: {...this.state.dataReport[index], periode: this.state.periode.periode, operatingIndID: this.state.operatingIndID, company: this.state.company}, dataDetail: { ...this.state.dataReport[index], periode: this.state.periode.periode, operatingIndID: this.state.operatingIndID, company: this.state.company },
visibleOperatingIndicator: false, visibleOperatingIndicator: false,
visibleDetailOpt: true, visibleDetailOpt: true,
}) })
...@@ -511,7 +510,6 @@ export default class OperatingIndicator extends Component { ...@@ -511,7 +510,6 @@ export default class OperatingIndicator extends Component {
{...this.state.listPeriode} {...this.state.listPeriode}
id="periode" id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => { onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => {
this.getReport()
this.getOperatingID() this.getOperatingID()
// this.getReportAttachment() // this.getReportAttachment()
})} })}
...@@ -528,7 +526,6 @@ export default class OperatingIndicator extends Component { ...@@ -528,7 +526,6 @@ export default class OperatingIndicator extends Component {
{...this.state.listCompany} {...this.state.listCompany}
id="company" id="company"
onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => { onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => {
this.getReport()
this.getOperatingID() this.getOperatingID()
// this.getReportAttachment() // this.getReportAttachment()
})} })}
...@@ -555,11 +552,13 @@ export default class OperatingIndicator extends Component { ...@@ -555,11 +552,13 @@ export default class OperatingIndicator extends Component {
</MuiThemeProvider> </MuiThemeProvider>
</div> </div>
</div> </div>
{this.state.isSubmit && (
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} > <div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <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> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography>
</div> </div>
</div> </div>
)}
</Paper> </Paper>
</div> </div>
...@@ -576,10 +575,10 @@ export default class OperatingIndicator extends Component { ...@@ -576,10 +575,10 @@ export default class OperatingIndicator extends Component {
this.getOperatingID() this.getOperatingID()
this.forceUpdate() this.forceUpdate()
})} })}
getReport={() => this.getReport()} getReport={() => this.getOperatingID()}
saveOperatingInd={this.saveOperatingInd.bind(this)} saveOperatingInd={this.saveOperatingInd.bind(this)}
// superUser={this.state.superUser} // superUser={this.state.superUser}
permission={{create: this.state.buttonCreate, edit: this.state.buttonEdit, delete: this.state.buttonDelete}} permission={{ create: this.state.buttonCreate, edit: this.state.buttonEdit, delete: this.state.buttonDelete }}
/> />
} }
......
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