Commit b288fc9b authored by Deni Rinaldi's avatar Deni Rinaldi

last

parent 05bc705e
......@@ -212,6 +212,8 @@ const create = (type = "") => {
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 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 getOperatingIndDetail = (body) => api.post('transaction/operating_indicator/get_report_hierarki', body)
const createOpetaingInd = (body) => api.post('transaction/operating_indicator/create_operating_indicator_report', body)
......@@ -417,7 +419,9 @@ const create = (type = "") => {
getReportOLPA,
approvalSubmissionOLPA,
checkApproverOLPA,
getLastPeriodeOI
getLastPeriodeOI,
getSubmitOI,
getLastPeriodOI
}
}
......
......@@ -46,7 +46,8 @@ export default class BalanceSheet extends Component {
buttonError: false,
judulColumn: null,
updateBy: '-',
handleTekTekTek: 0
handleTekTekTek: 0,
saveDraft: true
}
this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this);
......@@ -331,15 +332,15 @@ export default class BalanceSheet extends Component {
item.total_next_year,
item.total_more_year,
item.orders,
item.condition_it_should_be ? item.condition_it_should_be : '0',
item.condition_if_wrong ? item.condition_if_wrong : "STOPPER",
item.condition_it_should_be,
item.condition_if_wrong,
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 => {
if (item[25].length > 0) {
console.log('masuk')
console.log('error')
this.setState({ buttonError: true, errorPreview: true, editable: true })
}
})
......@@ -451,9 +452,9 @@ export default class BalanceSheet extends Component {
api.create().validateSubmitReport(payload).then((response) => {
console.log(response)
if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: false })
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
} 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 {
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
cursor: this.state.saveDraft !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.editable === true ?
this.state.saveDraft === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
......@@ -3132,13 +3133,13 @@ export default class BalanceSheet extends Component {
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
cursor: this.state.errorPreview !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.editable === true ?
this.state.errorPreview === true ?
null :
this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1 ? null :
......
......@@ -74,7 +74,7 @@ export default class OperatingIndicator extends Component {
}
getLastPeriod() {
api.create().getLastPeriod(this.state.company.company_id).then(response => {
api.create().getLastPeriodOI(this.state.company.company_id).then(response => {
console.log(response);
if (response.data.status === "success") {
this.setState({ lastPeriod: response.data.data.last_periode, latestPeriode: response.data.data.latest_periode }, () => {
......@@ -114,15 +114,15 @@ export default class OperatingIndicator extends Component {
return [
item.number,
item.report_name,
item.current_status,
this.state.isSubmit === false ? "CLOSED" : item.current_status,
item.report_id,
item.is_can_upload
]
})
// console.log(dataTable);
this.setState({ dataTable, dataReport: response.data.data})
this.setState({ dataTable, dataReport: response.data.data })
}
}
}
})
}
......@@ -132,12 +132,12 @@ export default class OperatingIndicator 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()
})
})
}
}
}
}
})
}
......@@ -150,21 +150,21 @@ export default class OperatingIndicator extends Component {
let userCompActive = []
this.state.userCompany.map((item, index) => {
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)
}
})
data.map(( item, index ) => {
data.map((item, index) => {
if (String(item.status).toLocaleLowerCase() == 'active') {
compActive.push(item)
}
})
if (compActive.length == userCompActive.length){
this.setState({ superUser: false})
if (compActive.length == userCompActive.length) {
this.setState({ superUser: false })
} else {
this.setState({ superUser: true})
this.setState({ superUser: true })
}
let companyData = data.map((item) => {
......@@ -173,21 +173,21 @@ export default class OperatingIndicator 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.length < 1? companyData[0] : arrayBaru[0] }, () => {
this.setState({ listCompany: defaultProps, company: arrayBaru.length < 1 ? companyData[0] : arrayBaru[0] }, () => {
this.getLastPeriod()
})
} else {
......@@ -242,7 +242,6 @@ export default class OperatingIndicator extends Component {
let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod)
let index = data.sort((a, b) => a - b).findIndex((val) => val === periode)
this.setState({ listPeriode: defaultProps, periode: index == -1 ? periodeData[0] : periodeData[index] }, () => {
this.getReport()
this.getOperatingID()
})
}
......@@ -301,12 +300,12 @@ export default class OperatingIndicator extends Component {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode
}
api.create().getSubmitMasterBudget(body).then(response => {
api.create().getSubmitOI(body).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.setState({ isSubmit: response.data.data.is_can_submit }, () => {
// this.getReport()
this.getReport()
// this.getOperatingID()
})
}
......@@ -318,7 +317,7 @@ export default class OperatingIndicator extends Component {
let index = this.state.dataReport.findIndex((val) => val.report_name == item[1])
if (index !== -1) {
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,
visibleDetailOpt: true,
})
......@@ -511,7 +510,6 @@ export default class OperatingIndicator extends Component {
{...this.state.listPeriode}
id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => {
this.getReport()
this.getOperatingID()
// this.getReportAttachment()
})}
......@@ -528,19 +526,18 @@ export default class OperatingIndicator extends Component {
{...this.state.listCompany}
id="company"
onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => {
this.getReport()
this.getOperatingID()
// this.getReportAttachment()
})}
clearOnEscape
disableClearable
style={{ width: 250 }}
renderInput={(params) =>
<TextField
{...params}
label="Company"
margin="normal"
style={{ marginTop: 7 }}
renderInput={(params) =>
<TextField
{...params}
label="Company"
margin="normal"
style={{ marginTop: 7 }}
/>}
value={this.state.company}
/>
......@@ -555,18 +552,20 @@ export default class OperatingIndicator extends Component {
</MuiThemeProvider>
</div>
</div>
<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' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography>
{this.state.isSubmit && (
<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' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography>
</div>
</div>
</div>
)}
</Paper>
</div>
</div>
)}
{this.state.visibleDetailOpt &&
{this.state.visibleDetailOpt &&
<OperatingIndicatorDetail
open={this.props.open}
data={this.state.dataDetail}
......@@ -576,10 +575,10 @@ export default class OperatingIndicator extends Component {
this.getOperatingID()
this.forceUpdate()
})}
getReport={() => this.getReport()}
getReport={() => this.getOperatingID()}
saveOperatingInd={this.saveOperatingInd.bind(this)}
// 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