Commit 8d3199f6 authored by herman's avatar herman

Merge branch 'master' into 'herman'

Master

See merge request !910
parents bc667aa9 40cd343a
......@@ -257,11 +257,13 @@ const create = (type = "") => {
const getMonthlyReport = (body) => api.post('transaction/monthly_report/get_all_report', body)
const getMonthlyOI = (body) => api.post('transaction/monthly_report_oi/get_operating_indicator_id', body)
const getMonthlyReportID = (body) => api.post('transaction/monthly_report/get_monthly_report_id', body)
const getHierarkiMontlyReportBS = (body) => api.post('transaction/monthly_report_bs/get_report_hierarki', body)
// const getHierarkiMontlyReportBS = (body) => api.post('transaction/monthly_report_bs/get_report_hierarki', body)
const getHierarkiMontlyReportBS = (body) => api.post('transaction/balance_sheet/monthly_report/get_report_hierarki', body)
const getHierarkiMontlyReportOI = (body) => api.post('transaction/monthly_report_oi/get_report_hierarki', body)
const getLastestUpdateMR = (body) => api.post('/transaction/monthly_report/get_latest_update', body)
const getHierarkiMontlyReportTP = (body) => api.post('transaction/monthly_report_tp/get_report_hierarki', body)
const getHierarkiMontlyReportLOCF = (body) => api.post('transaction/monthly_report_locf/get_report_hierarki', body)
// const getHierarkiMontlyReportTP = (body) => api.post('transaction/monthly_report_tp/get_report_hierarki', body)
const getHierarkiMontlyReportTP = (body) => api.post('transaction/tax_planning/monthly_report/get_report_hierarki', body)
const getHierarkiMontlyReportLOCF = (body) => api.post('transaction/locf/monthly_report/get_report_hierarki', body)
const getHierarkiMontlyReportFAM = (body) => api.post('transaction/monthly_report/fam/get_report_hierarki', body)
const getHierarkiMontlyReportCF = (body) => api.post('transaction/monthly_report_cf/get_report_hierarki', body)
const getHierarkiMontlyReportCAT = (body) => api.post('/transaction/monthly_report/cat/get_report_hierarki', body)
......@@ -272,36 +274,49 @@ const create = (type = "") => {
const getMontlyReportAtt = (body) => api.post('transaction/monthly_report/get_report_attachment', body)
const uploadAttachmentMonthly = (body) => api.post('transaction/monthly_report/upload_attachment', body)
const deleteAttachmentMonthly = (id) => api.post(`transaction/monthly_report/delete_attachment/${id}`)
const createMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/create_monthly_report', body)
const createMonthlyReportLOCF = (body) => api.post('transaction/monthly_report_locf/create_monthly_report', body)
const createMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/create_monthly_report', body)
// const createMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/create_monthly_report', body)
const createMonthlyReportBS = (body) => api.post('transaction/balance_sheet/monthly_report/create_monthly_report', body)
const createMonthlyReportLOCF = (body) => api.post('transaction/locf/monthly_report/create_monthly_report', body)
// const createMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/create_monthly_report', body)
const createMonthlyReportTP = (body) => api.post('transaction/tax_planning/monthly_report/create_monthly_report', body)
const createMonthlyReportFAM = (body) => api.post('transaction/monthly_report/fam/create_monthly_report', body)
const createMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/create_monthly_report', body)
const createMonthlyReportCAT = (body) => api.post('transaction/monthly_report/cat/create_monthly_report', body)
const checkUploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/check_import', body)
// const checkUploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/check_import', body)
const checkUploadMonthlyReportTP = (body) => api.post('transaction/tax_planning/monthly_report/check_import', body)
const checkUploadMonthlyReportFAM = (body) => api.post('transaction/monthly_report/fam/check_import', body)
const checkUploadMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/check_import', body)
// const checkUploadMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/check_import', body)
const checkUploadMonthlyReportBS = (body) => api.post('transaction/balance_sheet/monthly_report/check_import', body)
const checkUploadMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/check_import', body)
const checkUploadMonthlyReportCAT = (body) => api.post('transaction/monthly_report/cat/check_import', body)
const uploadMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/import_monthly_report', body)
// const uploadMonthlyReportBS = (body) => api.post('transaction/monthly_report_bs/import_monthly_report', body)
const uploadMonthlyReportBS = (body) => api.post('transaction/balance_sheet/monthly_report/import_monthly_report', body)
const uploadMonthlyReportFAM = (body) => api.post('transaction/monthly_report/fam/import_monthly_report', body)
const uploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/import_monthly_report', body)
// const uploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/import_monthly_report', body)
const uploadMonthlyReportTP = (body) => api.post('transaction/tax_planning/monthly_report/import_monthly_report', body)
const uploadMonthlyReportOI = (body) => api.post('transaction/monthly_report_oi/import_monthly_report', body)
const uploadMonthlyReportCAT = (body) => api.post('transaction/monthly_report/cat/import_monthly_report', body)
const validateSubmitReportBS = (body) => api.post('transaction/monthly_report_bs/validate_save', body)
// const validateSubmitReportBS = (body) => api.post('transaction/monthly_report_bs/validate_save', body)
const validateSubmitReportBS = (body) => api.post('transaction/balance_sheet/monthly_report/validate_save', body)
const validateSubmitReportMR = (body) => api.post('transaction/monthly_report/validate_save', body)
const validateSubmitReportMRTP = (body) => api.post('transaction/monthly_report_tp/validate_save', body)
const getPerBSiMontlyReportLOCF = (body) => api.post('transaction/monthly_report_locf/get_per_bs', body)
const checkUploadMonthlyReportLOCF = (body) => api.post('transaction/monthly_report_locf/check_import', body)
const uploadMonthlyReportLOCF = (body) => api.post('transaction/monthly_report_locf/import_monthly_report', body)
// const validateSubmitReportMRTP = (body) => api.post('transaction/monthly_report_tp/validate_save', body)
const validateSubmitReportMRTP = (body) => api.post('transaction/tax_planning/monthly_report/validate_save', body)
const getPerBSiMontlyReportLOCF = (body) => api.post('transaction/locf/monthly_report/get_per_bs', body)
const checkUploadMonthlyReportLOCF = (body) => api.post('transaction/locf/monthly_report/check_import', body)
const uploadMonthlyReportLOCF = (body) => api.post('transaction/locf/monthly_report/import_monthly_report', body)
const validateSubmitReportOI = (body) => api.post('transaction/monthly_report_oi/validate_save', body)
// MonthlyPL
const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body)
const createMonthlyReportPL = (body) => api.post('transaction/monthly_report_pl/create_monthly_report', body)
const checkUploadMonthlyReportPL = (body) => api.post('transaction/monthly_report_pl/check_import', body)
const uploadMonthlyReportPL = (body) => api.post('transaction/monthly_report_pl/import_monthly_report', body)
const validateSubmitReportPL = (body) => api.post('transaction/monthly_report_pl/validate_save', body)
// const getHierarkiMontlyReportPL = (body) => api.post('transaction/monthly_report_pl/get_report_hierarki', body)
// const createMonthlyReportPL = (body) => api.post('transaction/monthly_report_pl/create_monthly_report', body)
// const checkUploadMonthlyReportPL = (body) => api.post('transaction/monthly_report_pl/check_import', body)
// const uploadMonthlyReportPL = (body) => api.post('transaction/monthly_report_pl/import_monthly_report', body)
// const validateSubmitReportPL = (body) => api.post('transaction/monthly_report_pl/validate_save', body)
const getHierarkiMontlyReportPL = (body) => api.post('transaction/profit_loss/monthly_report/get_report_hierarki', body)
const createMonthlyReportPL = (body) => api.post('transaction/profit_loss/monthly_report/create_monthly_report', body)
const checkUploadMonthlyReportPL = (body) => api.post('transaction/profit_loss/monthly_report/check_import', body)
const uploadMonthlyReportPL = (body) => api.post('transaction/profit_loss/monthly_report/import_monthly_report', body)
const validateSubmitReportPL = (body) => api.post('transaction/profit_loss/monthly_report/validate_save', body)
//Template
const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`)
......
......@@ -70,7 +70,8 @@ export default class BudgetTahunan extends Component {
isAdmin: false,
btncreate: false,
loadview: false,
permissionhandle: false
permissionhandle: false,
userType: ''
}
this.myRef = React.createRef()
this.fileHandler = this.fileHandler.bind(this);
......@@ -84,7 +85,7 @@ export default class BudgetTahunan extends Component {
})
this.props.selectIndex('Master Budget & CAT')
if (this.props.location.state !== undefined) {
console.log(this.props);
// console.log(this.props);
this.setState({ userType: this.props.location.state.userType, intent: 'Home', lastPeriod: this.props.location.state.rawData.periode, rawData: this.props.location.state.rawData }, () => {
this.getPermission()
// this.checkApprover()
......@@ -100,7 +101,7 @@ export default class BudgetTahunan extends Component {
menu: "Master Budget & CAT"
}
api.create().getPermission(payload).then(response => {
console.log(response)
// console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({
......@@ -133,7 +134,7 @@ export default class BudgetTahunan extends Component {
if (response.ok) {
if (response.data.status === 'success') {
// this.setState({ tempData: response.data.data, privileges: response.data.data.privileges })
// // console.log(response.data.data)
// // // console.log(response.data.data)
if (String(response.data.data.role_name).toLocaleLowerCase() == 'superadmin') {
this.setState({ isAdmin: true })
}
......@@ -162,10 +163,10 @@ export default class BudgetTahunan extends Component {
checkApprover() {
api.create().checkApprover().then(response => {
console.log(response.data.data)
// console.log(response.data.data)
if (response.data) {
if (response.data.status === "success") {
// // console.log(response);
// // // console.log(response);
if (response.data.data.is_approver === true) {
this.setState({ isApprover: true, permissionhandle: true, checkApprover: true }, () =>
{
......@@ -196,7 +197,7 @@ export default class BudgetTahunan extends Component {
"periode": this.state.periode.periode
}
api.create().getCompanySubmitted(body).then(response => {
// // console.log(response);
// // // console.log(response);
if (response.data) {
if (response.data.status === 'success') {
if (response.data.data.length > 0) {
......@@ -218,7 +219,7 @@ export default class BudgetTahunan extends Component {
}
this.setState({ listCompany: defaultProps, company: indexID == null ? companyData[0] : companyData[indexID] }, () => {
// // console.log(response.data.data);
// // // console.log(response.data.data);
if (response.data.data.length > 0) {
this.getRevision()
} else {
......@@ -254,13 +255,13 @@ export default class BudgetTahunan extends Component {
"revision": this.state.revision.revision,
}
api.create().getMasterBudgetAtt(payload).then(response => {
// // console.log(response)
// // // console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({ listAttachment: response.data.data })
}
}
// // console.log(response);
// // // console.log(response);
})
}
......@@ -271,7 +272,7 @@ export default class BudgetTahunan extends Component {
"report_type": "Master Budget",
}
api.create().getReportTypeBody(payload).then(response => {
// console.log(response);
// // console.log(response);
if (response.data) {
if (response.data.status === "success") {
let dataTable = response.data.data.map((item, index) => {
......@@ -296,7 +297,7 @@ export default class BudgetTahunan extends Component {
])
}
})
// // console.log(dataTableRevision);
// // // console.log(dataTableRevision);
this.setState({ dataTable, loading: false, dataTableRevision: dataTableRevision.sort((a, b) => a.number - b.number), dataForRevision: response.data.data }, () => {
document.body.style.overflow = 'unset';
})
......@@ -315,7 +316,7 @@ export default class BudgetTahunan extends Component {
"periode": this.state.periode.periode
}
api.create().getSubmitMasterBudget(body).then(response => {
// // console.log(response);
// // // console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.setState({ isSubmit: response.data.data.is_can_submit }, () => {
......@@ -345,7 +346,7 @@ export default class BudgetTahunan extends Component {
getCompanyActive() {
api.create().getPerusahaanActive().then((response) => {
// // console.log(response);
// // // console.log(response);
if (response.data) {
if (response.data.status === 'success') {
let data = response.data.data
......@@ -393,7 +394,7 @@ export default class BudgetTahunan extends Component {
api.create().getLastPeriod(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 }, () => {
this.setState({ lastPeriod: this.state.userType !== ''? this.state.lastPeriod : response.data.data.last_periode, latestPeriode: response.data.data.latest_periode }, () => {
this.getPeriode()
})
}
......@@ -405,7 +406,7 @@ export default class BudgetTahunan extends Component {
// let dateNow = new Date
// let year = this.state.rawData ? this.state.rawData.periode : format(dateNow, 'yyyy')
let currentYear = new Date().getFullYear()
// // console.log(currentYear)
// // // console.log(currentYear)
if (response.data) {
if (response.data.status === "success") {
let data = []
......@@ -431,10 +432,10 @@ export default class BudgetTahunan 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)
// // console.log(data)
// // console.log(this.state.latestPeriode)
// // console.log(periodeData)
// // console.log(index)
// // console.log(this.props.location.state.rawData)
// console.log(this.state.lastPeriod)
// console.log(periodeData)
// // // console.log(index)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
if (this.state.isApprover === true) {
this.getCompanySubmitted()
......@@ -453,7 +454,7 @@ export default class BudgetTahunan extends Component {
"periode": this.state.periode.periode
}
api.create().getRevision(payload).then(response => {
// // console.log(response);
// // // console.log(response);
if (response.data) {
if (response.data.status === "success") {
let data = response.data.data
......@@ -495,7 +496,7 @@ export default class BudgetTahunan extends Component {
"is_approver": this.state.permissionhandle? this.state.permissionhandle : this.state.isApprover
}
api.create().getSubmission(payload).then(response => {
console.log(response)
// console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({
......@@ -507,13 +508,13 @@ export default class BudgetTahunan extends Component {
btnApprove: response.data.data.is_submit,
// loading: false
}, () => {
// console.log(response.data.data.is_submit);
// console.log(this.state.btnApprove)
// // console.log(response.data.data.is_submit);
// // console.log(this.state.btnApprove)
this.historyApproval()
this.getLatestPeriodSubmit()
api.create().checkApprover().then(response => {
// console.log(this.state.btncreate);
// console.log(this.state.btnedit)
// // console.log(this.state.btncreate);
// // console.log(this.state.btnedit)
if (this.state.btncreate === true && this.state.btnedit === true) {
this.setState({ isApprover: false }, () => {
if (response.data.data.is_approver === true) {
......@@ -557,7 +558,7 @@ export default class BudgetTahunan extends Component {
"periode": this.state.periode.periode
}
api.create().historyApproval(body).then(response => {
// // console.log(response);
// // // console.log(response);
if (response.data.data.length > 0) {
let dataTableHistory = response.data.data.map(item => {
return [
......@@ -589,11 +590,11 @@ export default class BudgetTahunan extends Component {
"min_periode": moment(this.state.minDateRevision).format('YYYY-MM-DD'),
"max_periode": moment(this.state.maxDateRevision).format('YYYY-MM-DD')
}
// // console.log(payload)
// console.log(this.props.location);
// console.log(body)
// // // console.log(payload)
// // console.log(this.props.location);
// // console.log(body)
api.create().approvalSubmission(body).then((res) => {
// // console.log(res)
// // // console.log(res)
// this.setState({ loading: false }, () => {
// })
if (type == 'revision') {
......@@ -610,7 +611,7 @@ export default class BudgetTahunan extends Component {
} else {
items = item
}
// // console.log(this.state.dataForRevision);
// // // console.log(this.state.dataForRevision);
this.state.dataForRevision.map(i => {
if (i.report_name === items) {
if (i.revision !== revision) {
......@@ -697,9 +698,9 @@ export default class BudgetTahunan extends Component {
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
// // console.log(resp)
// // // console.log(resp)
if (err) {
// // console.log(err);
// // // console.log(err);
}
else {
const formData = new FormData();
......@@ -726,7 +727,7 @@ export default class BudgetTahunan extends Component {
deleteAttachment(item) {
api.create().deleteAttachment(item.attachment_id).then(response => {
// // console.log(response);
// // // console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.getSubmission()
......@@ -743,7 +744,7 @@ export default class BudgetTahunan extends Component {
this.setState({ loading: true }, () => {
document.body.style.overflow = 'hidden';
})
// // console.log(JSON.stringify(data));
// // // console.log(JSON.stringify(data));
api.create('UPLOAD').createSubmitReport(data).then(response => {
if (response.data) {
......@@ -774,9 +775,9 @@ export default class BudgetTahunan extends Component {
async downloadAttachment(fileurl, name) {
let length = name.split(".").length
let fileType = name.split(".")[length - 1]
// // console.log(fileType);
// // // console.log(fileType);
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/download_attachment?fileName=${fileurl}&&fileType=${fileType}`
// // console.log(url);
// // // console.log(url);
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/download_attachment?fileName=${fileurl}&&fileType=${fileType}`
)
......@@ -817,7 +818,7 @@ export default class BudgetTahunan extends Component {
submission_id: this.state.submissionID
}
api.create().submitMasterBudget(body).then(response => {
// // console.log(response);
// // // console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.getSubmission()
......@@ -830,9 +831,9 @@ export default class BudgetTahunan extends Component {
})
}
// if (array.includes("not-yet" || "draft")) {
// // console.log('gagal');
// // // console.log('gagal');
// } else {
// // console.log('masuk');
// // // console.log('masuk');
// }
}
......@@ -846,7 +847,7 @@ export default class BudgetTahunan extends Component {
remarksKosong += 1
}
})
// console.log(arrayRevisi)
// // console.log(arrayRevisi)
if (arrayRevisi.length == 0 || remarksKosong > 0) {
this.setState({ alert: true, messageAlert: 'Remarks Cannot be Empty', tipeAlert: 'error' })
} else {
......@@ -877,7 +878,7 @@ export default class BudgetTahunan extends Component {
<Select
value={val}
onChange={event => {
// // console.log(event.target)
// // // console.log(event.target)
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
......@@ -1005,10 +1006,10 @@ export default class BudgetTahunan extends Component {
defaultValue={value}
color={"#5198ea"}
onBlur={(event) => {
// // console.log(event.target.value)
// // // console.log(event.target.value)
// updateValue(event.target.value)
handleChangeText(event.target.value, tableMeta)
// // console.log(dataTable2)
// // // console.log(dataTable2)
}}
/>}
/>
......@@ -1044,7 +1045,7 @@ export default class BudgetTahunan extends Component {
}
let indexDataRevisi = this.state.dataTableRevision.findIndex((val) => val[3] == value[3])
let indexId = detailRevisiCheck.sort((a, b) => a.number - b.number).findIndex((val) => val.number == value[3])
// console.log(indexId)
// // console.log(indexId)
if (indexId == -1) {
this.state.dataTableRevision.map((item, index) => {
if (index > indexDataRevisi) {
......@@ -1081,7 +1082,7 @@ export default class BudgetTahunan extends Component {
}
}
this.setState({ detailRevisiCheck: detailRevisiCheck.sort((a, b) => a.number - b.number) })
// console.log(detailRevisiCheck)
// // console.log(detailRevisiCheck)
}
const options = {
......
......@@ -684,6 +684,7 @@ export default class CorporateAnnualTarget extends Component {
let weightReal = null
let handleKosongKPIMAXYTD = false
let stateFR = false
console.log(this.state.dataTable)
this.state.dataTable.map((i, index) => {
if (i[0] == 1) {
dataTampung.push({
......@@ -746,6 +747,10 @@ export default class CorporateAnnualTarget extends Component {
}
// // console.log(String(weightReal).substr(0,String(weightReal).length-1))
// // console.log(Number(String(weightReal).substr(0,String(weightReal).length-1)).toFixed(1));
console.log(weightReal)
console.log(i[7])
let b = []
// console.log(i[13].value == undefined? 'Y' : 'N')
data.push({
"item_report_id": i[1] == "" || i[1] == null ? 0 : i[1],
"item_name": String(i[6]),
......@@ -756,24 +761,26 @@ export default class CorporateAnnualTarget extends Component {
"max_ach": i[10] == null ? "" : i[10].value,
"formula": i[11] == null ? "" : i[11].value,
"total_actual_before": String(i[12]) == "" ? "0.0" : String(i[12]),
"january": stateFR ? String(i[13].value) : String(i[13]) == "" ? "0.0" : String(i[13]),
"february": stateFR ? String(i[14].value) : String(i[14]) == "" ? "0.0" : String(i[14]),
"march": stateFR ? String(i[15].value) : String(i[15]) == "" ? "0.0" : String(i[15]),
"april": stateFR ? String(i[16].value) : String(i[16]) == "" ? "0.0" : String(i[16]),
"may": stateFR ? String(i[17].value) : String(i[17]) == "" ? "0.0" : String(i[17]),
"june": stateFR ? String(i[18].value) : String(i[18]) == "" ? "0.0" : String(i[18]),
"july": stateFR ? String(i[19].value) : String(i[19]) == "" ? "0.0" : String(i[19]),
"august": stateFR ? String(i[20].value) : String(i[20]) == "" ? "0.0" : String(i[20]),
"september": stateFR ? String(i[21].value) : String(i[21]) == "" ? "0.0" : String(i[21]),
"october": stateFR ? String(i[22].value) : String(i[22]) == "" ? "0.0" : String(i[22]),
"november": stateFR ? String(i[23].value) : String(i[23]) == "" ? "0.0" : String(i[23]),
"december": stateFR ? String(i[24].value) : String(i[24]) == "" ? "0.0" : String(i[24]),
"january": i[13].value == undefined? (String(i[13]) == ''? "0.0" : String(i[13])) : String(i[13].value),
// "january": stateFR ? String(i[13].value) : String(i[13]) == "" ? "0.0" : String(i[13]),
"february": i[14].value == undefined? (String(i[14]) == ''? "0.0" : String(i[14])) : String(i[14].value),
"march": i[15].value == undefined? (String(i[15]) == ''? "0.0" : String(i[15])) : String(i[15].value),
"april": i[16].value == undefined? (String(i[16]) == ''? "0.0" : String(i[16])) : String(i[16].value),
"may": i[17].value == undefined? (String(i[17]) == ''? "0.0" : String(i[17])) : String(i[17].value),
"june": i[18].value == undefined? (String(i[18]) == ''? "0.0" : String(i[18])) : String(i[18].value),
"july": i[19].value == undefined? (String(i[19]) == ''? "0.0" : String(i[19])) : String(i[19].value),
"august": i[20].value == undefined? (String(i[20]) == ''? "0.0" : String(i[20])) : String(i[20].value),
"september": i[21].value == undefined? (String(i[21]) == ''? "0.0" : String(i[21])) : String(i[21].value),
"october": i[22].value == undefined? (String(i[22]) == ''? "0.0" : String(i[22])) : String(i[22].value),
"november": i[23].value == undefined? (String(i[23]) == ''? "0.0" : String(i[23])) : String(i[23].value),
"december": i[24].value == undefined? (String(i[24]) == ''? "0.0" : String(i[24])) : String(i[24].value),
"total_current_year": String(i[25]) == "" ? "0.0" : String(i[25]),
"total_next_year": String(i[26]) == "" ? "0.0" : String(i[26]),
"total_more_year": String(i[27]) == "" ? "0.0" : String(i[27]),
"strategic": String(i[28]),
"pic": String(i[29])
})
stateFR = false
})
// // // // console.log(dataTableBaru)
......@@ -793,8 +800,9 @@ export default class CorporateAnnualTarget extends Component {
} else if (totalWeight < 100) {
this.setState({ alert: true, messageAlert: 'Total weight less than 100%', tipeAlert: 'warning', loading: false, editable: true })
} else {
console.log(JSON.stringify(payload))
api.create().validateSubmitReport(payload).then((response) => {
// // // // console.log(response)
console.log(response)
if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: false, buttonDraft: false })
} else {
......@@ -867,7 +875,7 @@ export default class CorporateAnnualTarget extends Component {
"status": type,
"cat": data
}
// console.log(JSON.stringify(payload));
console.log(JSON.stringify(payload));
this.deleteReport(payload)
}
......
......@@ -53,7 +53,8 @@ export default class BalanceSheetMR extends Component {
updateBy: '-',
notes: "",
judulColumn: null,
get_for: "view"
get_for: "view",
kansas: 0
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -253,7 +254,7 @@ export default class BalanceSheetMR extends Component {
downloadTemplate = async () => {
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_bs/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/monthly_report/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
)
res = await res.blob()
// console.log(res)
......@@ -267,10 +268,10 @@ export default class BalanceSheetMR extends Component {
}
async downloadAllData() {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_bs/export_monthly_report?monthly_report_id=${this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/monthly_report/export_monthly_report?monthly_report_id=${this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
console.log(url);
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_bs/export_monthly_report?monthly_report_id=${this.props.monthlyReportId === null ? "" : this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/monthly_report/export_monthly_report?monthly_report_id=${this.props.monthlyReportId === null ? "" : this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
)
res = await res.blob()
this.setState({ loading: false })
......@@ -475,7 +476,7 @@ export default class BalanceSheetMR extends Component {
}
api.create('UPLOAD').createMonthlyReportBS(payload).then(response => {
console.log(response);
// console.log(JSON.stringify(payload))
console.log(JSON.stringify(payload))
if (response.data) {
if (response.data.status === "success") {
this.props.saveToMonthlyReport()
......@@ -493,10 +494,12 @@ export default class BalanceSheetMR extends Component {
handleValidate() {
let data = []
let err = false
let errorContrl = this.state.buttonError
let errorContrl = false
let editAble = this.state.editAble
console.log(this.state.dataTable)
this.state.dataTable.map((i, index) => {
let dataTable = this.state.dataTable
let kansas = this.state.kansas
console.log(dataTable[dataTable.length-1])
dataTable.map((i, index) => {
if(i[0] === 3) {
// console.log(i);
if ( i[17] === "" && (Number(i[12]) < this.state.minValue || Number(i[12]) > this.state.maxValue)) {
......@@ -506,23 +509,15 @@ export default class BalanceSheetMR extends Component {
} else if ( i[18] === "" && (Number(i[14]) < this.state.minValue || Number(i[14]) > this.state.maxValue)) {
console.log('msk 2');
err = true
} else if ( i[19] === "" && (Number(i[16]) < this.state.minValue || Number(i[16]) > this.state.maxValue)) {
console.log('msk 3');
err = true
}
}
if (String(i[5]) == "Control (should be nil)") {
i.map((j, indexj) => {
if (indexj >= 6 && indexj <= 16) {
if (Number(j) < this.state.minValue || Number(j) > this.state.maxValue ) {
console.log("masuk error")
if (Number(i[9]) < this.state.minValue || Number(i[9]) > this.state.maxValue ) {
errorContrl = true
editAble = true
}
}
})
}
data.push({
"item_report_id": i[1],
......@@ -584,8 +579,22 @@ export default class BalanceSheetMR extends Component {
if (response.data.status === "success") {
if (response.data.data.result && err === false && errorContrl === false ) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
if (kansas == 0) {
this.setState({kansas: 1, loading: true}, () => {
this.handleValidate()
})
} else {
this.setState({kansas: 0})
}
} else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
if (kansas == 0) {
this.setState({kansas: 1, loading: true}, () => {
this.handleValidate()
})
} else {
this.setState({kansas: 0})
}
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
......@@ -614,10 +623,10 @@ export default class BalanceSheetMR extends Component {
// console.log(dataTable2[tableMeta.rowIndex]);
}
const handleChange = (value, tableMeta, type) => {
console.log(dataTable2);
let val = String(value).split(",").join("")
if (type === "actual") {
dataTable2[tableMeta.rowIndex][9] = Number(val).toFixed(1)
console.log(dataTable2);
} else {
let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[tableMeta.rowIndex][2])
if (indexParent > 0) {
......@@ -635,6 +644,7 @@ export default class BalanceSheetMR extends Component {
dataTable2[tableMeta.rowIndex][9] = Number(val).toFixed(1)
}
}
console.log(dataTable2);
}
const handleValue = (data, type) => {
......@@ -1105,7 +1115,7 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
null :
this.state.get_for == 'view'?
// this.state.get_for == 'view'?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
......@@ -1114,35 +1124,35 @@ export default class BalanceSheetMR extends Component {
disabled={true}
value={Number(tableMeta.rowData[7]).toFixed(1)}
/>
:
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 0)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 7)).toFixed(1)}
/>
}
/>
</div> :
// :
// tableMeta.rowData[0] === 2 ?
// <span style={{ fontSize: 12, textAlign: 'right' }}>
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValue(tableMeta, 0)).toFixed(1)}
// />
// </span> :
// tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={val}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(tableMeta, 7)).toFixed(1)}
// />
// }
// />
// </div> :
// tableMeta.rowData[0] === 7 ?
// (Number(handleValueFormula(tableMeta, 7)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 7)).toFixed(1) <= Number(this.state.maxValue)) ?
// <NumberFormat
......@@ -1179,22 +1189,22 @@ export default class BalanceSheetMR extends Component {
// />
// </LightTooltip>
// :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[7]).toFixed(1)}
/>
}
/>
</div>
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={val}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(tableMeta.rowData[7]).toFixed(1)}
// />
// }
// />
// </div>
}
</div>
</div>
......@@ -1202,7 +1212,7 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
null :
this.state.get_for == 'view'?
// this.state.get_for == 'view'?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
......@@ -1211,35 +1221,35 @@ export default class BalanceSheetMR extends Component {
disabled={true}
value={Number(tableMeta.rowData[8]).toFixed(1)}
/>
:
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta, 1)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(tableMeta, 8)).toFixed(1)}
/>
}
/>
</div> :
// :
// tableMeta.rowData[0] === 2 ?
// <span style={{ fontSize: 12, textAlign: 'right' }}>
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValue(tableMeta, 1)).toFixed(1)}
// />
// </span> :
// tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={val}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(tableMeta, 8)).toFixed(1)}
// />
// }
// />
// </div> :
// tableMeta.rowData[0] === 7 ?
// (Number(handleValueFormula(tableMeta, 8)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 8)).toFixed(1) <= Number(this.state.maxValue)) ?
// <NumberFormat
......@@ -1276,22 +1286,22 @@ export default class BalanceSheetMR extends Component {
// />
// </LightTooltip>
// :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[8]).toFixed(1)}
/>
}
/>
</div>
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={val}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(tableMeta.rowData[8]).toFixed(1)}
// />
// }
// />
// </div>
}
</div>
</div>
......@@ -1656,6 +1666,7 @@ export default class BalanceSheetMR extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
suffix={'%'}
disabled={true}
value={Number(tableMeta.rowData[12]).toFixed(1)}
/>
......@@ -1799,6 +1810,7 @@ export default class BalanceSheetMR extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
suffix={'%'}
disabled={true}
value={Number(tableMeta.rowData[14]).toFixed(1)}
/>
......@@ -1941,6 +1953,7 @@ export default class BalanceSheetMR extends Component {
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
suffix={'%'}
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[16]).toFixed(1)}
......@@ -2045,10 +2058,25 @@ export default class BalanceSheetMR extends Component {
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
{tableMeta.rowData[0] !== 3 ?
null :
this.state.get_for == 'view'?
tableMeta.rowData[17]
(this.state.get_for == 'view'?
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
// disabled={Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? false : true}
disabled={true}
multiline={true}
defaultValue={tableMeta.rowData[17]}
inputProps={{
style: {
color:'black',
textAlign: 'left'
}
}}
/>
:
<FormControlLabel
style={{ margin: 0 }}
......@@ -2134,16 +2162,31 @@ export default class BalanceSheetMR extends Component {
}}
/>
}
/>}
/>)}
</div>
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ? null :
this.state.get_for == 'view'?
tableMeta.rowData[18]
{tableMeta.rowData[0] !== 3 ? null :
(this.state.get_for == 'view'?
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
// disabled={Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? false : true}
disabled={true}
multiline={true}
defaultValue={tableMeta.rowData[18]}
inputProps={{
style: {
color:'black',
textAlign: 'left'
}
}}
/>
:
<FormControlLabel
style={{ margin: 0 }}
......@@ -2229,45 +2272,60 @@ export default class BalanceSheetMR extends Component {
}}
/>
}
/>}
/>)}
</div>
</div>
</div>
<div className="col-3">
<div style={{ textAlign: 'right', width: 90 }}>
<div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ? null :
this.state.get_for == 'view'?
tableMeta.rowData[19]
:
<FormControlLabel
style={{ margin: 0 }}
// value={value}
control={
tableMeta.rowData[19] === "" && (Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue) ?
<LightTooltip title={"MTD Explanation vs RB is Reqiured"} arrow>
{tableMeta.rowData[0] !== 3 ? null :
(this.state.get_for == 'view'?
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
multiline={true}
placeholder=""
// disabled={false}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
// disabled={Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? false : true}
disabled={true}
multiline={true}
defaultValue={tableMeta.rowData[19]}
inputProps={{
style: {
color: "#5198ea",
textAlign: 'left',
backgroundColor: '#ffac99'
color:'black',
textAlign: 'left'
}
}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 19)
}}
/>
</LightTooltip>
:
<FormControlLabel
style={{ margin: 0 }}
// value={value}
control={
// tableMeta.rowData[19] === "" && (Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue) ?
// <LightTooltip title={"MTD Explanation vs RB is Reqiured"} arrow>
// <Input
// disableUnderline={true}
// style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// multiline={true}
// placeholder=""
// // disabled={false}
// disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
// defaultValue={tableMeta.rowData[19]}
// inputProps={{
// style: {
// color: "#5198ea",
// textAlign: 'left',
// backgroundColor: '#ffac99'
// }
// }}
// onBlur={(event) => {
// handleText(event.target.value, tableMeta, 19)
// }}
// />
// </LightTooltip>
// :
// tableMeta.rowData[0] === 7 ?
// (Number(handleValueFormula(tableMeta, 19)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 19)).toFixed(1) <= Number(this.state.maxValue)) ?
// <NumberFormat
......@@ -2324,7 +2382,7 @@ export default class BalanceSheetMR extends Component {
}}
/>
}
/>}
/>)}
</div>
</div>
</div>
......@@ -2571,7 +2629,7 @@ export default class BalanceSheetMR extends Component {
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
this.setState({ loading: true, dataTable: dataTable2 }, () => {
setTimeout(() => {
this.handleValidate()
}, 100);
......@@ -2689,7 +2747,7 @@ export default class BalanceSheetMR extends Component {
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
this.setState({ loading: true, dataTable: dataTable2 }, () => {
setTimeout(() => {
this.handleValidate()
}, 100);
......
......@@ -142,7 +142,7 @@ export default class CorporateAnnualTargetMR extends Component {
let payload = {
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"periode": "2021",
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId,
"months": this.props.month.month_id,
......@@ -1296,14 +1296,14 @@ export default class CorporateAnnualTargetMR extends Component {
<div style={{ flex: 1, textAlign: 'right' }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
value={Number(value).toFixed(1)}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.state.get_for == 'view'? "black" : handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta)? "#5198ea" : 'black', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={ tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6? Number(handleValueFormula(value, tableMeta, tableMeta.columnIndex)) : Number(value).toFixed(1)}
value={ tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6? Number(handleValueFormula(value, tableMeta, tableMeta.columnIndex)).toFixed(1) : Number(value).toFixed(1)}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled={this.state.get_for == 'view'? true : !handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta)}
decimalScale={1}
......@@ -1336,7 +1336,7 @@ export default class CorporateAnnualTargetMR extends Component {
null :
<FormControlLabel
style={{ margin: 0 }}
value={value}
value={Number(value).toFixed(1)}
control={
<NumberFormat
thousandSeparator={true}
......@@ -1381,14 +1381,14 @@ export default class CorporateAnnualTargetMR extends Component {
:
<FormControlLabel
style={{ margin: 0 }}
value={value}
value={Number(value).toFixed(1)}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={handleAchiement(tableMeta)}
value={handleAchiement(tableMeta).toFixed(1)}
decimalScale={1}
disabled={true}
/>
......@@ -1426,7 +1426,7 @@ export default class CorporateAnnualTargetMR extends Component {
:
<FormControlLabel
style={{ margin: 0 }}
value={value}
value={Number(value).toFixed(1)}
control={
<NumberFormat
thousandSeparator={true}
......@@ -1479,7 +1479,7 @@ export default class CorporateAnnualTargetMR extends Component {
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={handleTotal(tableMeta)}
value={handleTotal(tableMeta).toFixed(1)}
decimalScale={2}
disabled={true}
/>
......
......@@ -83,6 +83,18 @@ const theme2 = createMuiTheme({
},
});
const theme3 = createMuiTheme({
overrides: {
// Style sheet name ⚛️
MuiInputBase: {
input: {
color: '#black',
textAlign: 'center'
}
}
},
});
export default class ListOfCreditFacilities extends Component {
constructor(props) {
super(props)
......@@ -216,7 +228,7 @@ export default class ListOfCreditFacilities extends Component {
item.locf.borrower_comp_name === null || item.locf.borrower_comp_name === "" ? this.props.company.company_name : item.locf.borrower_comp_name,
item.locf.bank_name === null ? null : item.locf.bank_name === "" ? null : {value: item.locf.bank_name},
item.locf.type_of_credit === null ? null : item.locf.type_of_credit === "" ? null : {value: item.locf.type_of_credit},
item.locf.remarks === null ? "0.0" : item.locf.remarks === "" ? "0.0" : item.locf.remarks,
item.locf.remarks === null || item.locf.remarks === "" ? "" : item.locf.remarks,
item.locf.loan_maturity_date === null || item.locf.loan_maturity_date === "" ? null : item.locf.loan_maturity_date,
item.locf.interest === null || item.locf.interest === "" ? "0.00" : item.locf.interest,
item.locf.currency === null || item.locf.currency === "" ? "" : item.locf.currency,
......@@ -272,7 +284,7 @@ export default class ListOfCreditFacilities extends Component {
item.locf.borrower_comp_name === null || item.locf.borrower_comp_name === "" ? this.props.company.company_name : item.locf.borrower_comp_name,
item.locf.bank_name === null ? null : item.locf.bank_name === "" ? null : {value: item.locf.bank_name},
item.locf.type_of_credit === null ? null : item.locf.type_of_credit === "" ? null : {value: item.locf.type_of_credit},
item.locf.remarks === null ? "0.0" : item.locf.remarks === "" ? "0.0" : item.locf.remarks,
item.locf.remarks === null || item.locf.remarks === "" ? "" : item.locf.remarks,
item.locf.loan_maturity_date === null || item.locf.loan_maturity_date === "" ? null : item.locf.loan_maturity_date,
item.locf.interest === null || item.locf.interest === "" ? "0.00" : item.locf.interest,
item.locf.currency === null || item.locf.currency === "" ? "" : item.locf.currency,
......@@ -601,6 +613,11 @@ export default class ListOfCreditFacilities extends Component {
if (i[6] == null || i[7] == null || i[8] == "" || i[9] == "" || i[10] == "" || i[11] == "") {
error = true
}
if (i[7].value == 'Others' && i[18] == '') {
error = true
}
data.push({
"item_report_id": i[1],
"borrower_comp_name": i[5],
......@@ -786,7 +803,7 @@ export default class ListOfCreditFacilities extends Component {
downloadTemplate = async () => {
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_locf/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&months=${this.props.month.month_id}`
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/locf/monthly_report/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&months=${this.props.month.month_id}`
)
res = await res.blob()
// console.log(this.props.report_id)
......@@ -803,8 +820,8 @@ export default class ListOfCreditFacilities extends Component {
}
async downloadAllData() {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_locf/export_monthly_report?monthly_report_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
let urls = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_locf/export_monthly_report?monthly_report_id=${this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/locf/monthly_report/export_monthly_report?monthly_report_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
let urls = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/locf/monthly_report/export_monthly_report?monthly_report_id=${this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
// console.log(url);
// console.log(urls);
let res = await fetch(
......@@ -855,6 +872,7 @@ export default class ListOfCreditFacilities extends Component {
"months": this.props.month.month_id
}
api.create().getPerBSiMontlyReportLOCF(payload).then((response) => {
console.log(response)
if (response.data.status == "success") {
this.setState({perBS: response.data.data.per_bs == null || response.data.data.per_bs == ''? 0.0 : Number(response.data.data.per_bs).toFixed(1)})
}
......@@ -980,6 +998,9 @@ export default class ListOfCreditFacilities extends Component {
if (i[6] == null || i[7] == null || i[8] == "" || i[9] == "" || i[10] == "" || i[11] == "") {
error = true
}
if (i[7].value == 'Others' && i[18] == '') {
error = true
}
data.push({
"item_report_id": i[1],
"borrower_comp_name": i[5],
......@@ -1781,13 +1802,14 @@ export default class ListOfCreditFacilities extends Component {
textAlign: 'center',
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
color: this.state.get_for == 'view'? "black" : '#5198ea',
backgroundColor: (tableMeta.rowData[9] == null || tableMeta.rowData[9] == '') && this.state.get_for == 'edit'? '#ffac99' : 'white'
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085',
color: '#5198ea',
fontFamily: 'Nunito Sans, sans-serif',
}
}}
......@@ -1814,12 +1836,12 @@ export default class ListOfCreditFacilities extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] == 8 || tableMeta.rowData[0] == 9?
null :
<FormControlLabel
style={{ margin: 0, backgroundColor: (tableMeta.rowData[10] == '0.00' || tableMeta.rowData[10] == '') && this.state.get_for == 'edit'? '#ffac99' : 'white' }}
style={{ margin: 0}}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96}}
style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: (tableMeta.rowData[10] == '0.00' || tableMeta.rowData[10] == '') && this.state.get_for == 'edit'? '#ffac99' : 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
......@@ -1853,7 +1875,7 @@ export default class ListOfCreditFacilities extends Component {
<div style={{ display: 'flex'}}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] == 8 || tableMeta.rowData[0] == 9?
null :
<ThemeProvider theme={theme2}>
<ThemeProvider theme={this.state.get_for == 'view'? theme3 : theme2}>
<Input
disableUnderline={true}
style={{ width: 96, color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', backgroundColor: tableMeta.rowData[11] == '' && this.state.get_for == 'edit'? '#ffac99' : 'white' }}
......@@ -2058,7 +2080,7 @@ export default class ListOfCreditFacilities extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Investment Loan'? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.state.get_for == 'view'? "black" : (tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Investment Loan'? "#5198ea" : "black"), fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.state.get_for == 'view'? true : tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Investment Loan'? false : true}
......@@ -2102,7 +2124,7 @@ export default class ListOfCreditFacilities extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Investment Loan'? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.state.get_for == 'view'? "black" : (tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Investment Loan'? "#5198ea" : "black"), fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.state.get_for == 'view'? true : tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Investment Loan'? false : true}
......@@ -2181,7 +2203,7 @@ export default class ListOfCreditFacilities extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Revolving Loan (KMK)'? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.state.get_for == 'view'? "black" : (tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Revolving Loan (KMK)'? "#5198ea" : "black"), fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.state.get_for == 'view'? true : tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Revolving Loan (KMK)'? false : true}
......@@ -2225,7 +2247,7 @@ export default class ListOfCreditFacilities extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Revolving Loan (KMK)'? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.state.get_for == 'view'? "black" : (tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Revolving Loan (KMK)'? "#5198ea" : "black"), fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.state.get_for == 'view'? true : tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Revolving Loan (KMK)'? false : true}
......@@ -2302,10 +2324,10 @@ export default class ListOfCreditFacilities extends Component {
// </div>
:
<div style={{ flex: 1 }}>
<ThemeProvider theme={theme}>
<ThemeProvider theme={this.state.get_for == 'view'? theme3 : theme2}>
<Input
disableUnderline={true}
style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Others'? "#5198ea" : "black", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
style={{ width: 96, color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Others'? "#5198ea" : "black", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', backgroundColor: tableMeta.rowData[7] == null? "transparent" : tableMeta.rowData[7].value == 'Others' && tableMeta.rowData[18] == ''? "#ffac99" : "transparent" }}
type="text"
placeholder=""
disabled={this.state.get_for == 'view'? true : tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Others'? false : true}
......@@ -2351,7 +2373,7 @@ export default class ListOfCreditFacilities extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Others'? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.state.get_for == 'view'? "black" : (tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Others'? "#5198ea" : "black"), fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.state.get_for == 'view'? true : tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Others'? false : true}
......@@ -2395,10 +2417,10 @@ export default class ListOfCreditFacilities extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Others'? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: this.state.get_for == 'view'? "black" : (tableMeta.rowData[7] == null? "black" : tableMeta.rowData[7].value == 'Others'? "#5198ea" : "black"), fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
disabled={this.state.get_for == 'view'? true : tableMeta.rowData[7] == null? true : tableMeta.rowData[7].value == 'Others'? false : true}
value={Number(tableMeta.rowData[20]).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, 20)
......@@ -2653,10 +2675,10 @@ export default class ListOfCreditFacilities extends Component {
<th style={{ ...style2, color: '#fff', backgroundColor: '#1c71b8', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 43, fontSize: 12, fontWeight: 'bold', padding: 5, textAlign: 'center' }}>{columnMeta.name}</div>
<div className="grid grid-2x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", height: 45, display: 'grid', alignItems: 'center', backgroundColor: '#07a7d0', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", height: 43, display: 'grid', alignItems: 'center', backgroundColor: '#07a7d0', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<span>{"Financial Covenant"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: 45, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: 43, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<span>{"Current Testing"}</span>
</div>
</div>
......@@ -2679,22 +2701,25 @@ export default class ListOfCreditFacilities extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null :
<div style={{ flex: 1 }}>
<ThemeProvider theme={theme}>
<Input
disableUnderline={true}
style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[25]}
fixedDecimalScale={2}
decimalScale={2}
value={Number(tableMeta.rowData[25]).toFixed(2)}
onBlur={(event) => {
// // // console.log(event.target.value)
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta, 25)
// // // console.log(dataTable2)
}}
/>
</ThemeProvider>
}
/>
</div>
}
</div>
......@@ -2734,10 +2759,10 @@ export default class ListOfCreditFacilities extends Component {
<th style={{ ...style2, color: '#fff', backgroundColor: '#1c71b8', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 43, fontSize: 12, fontWeight: 'bold', padding: 5, textAlign: 'center' }}>{columnMeta.name}</div>
<div className="grid grid-2x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", height: 45, display: 'grid', alignItems: 'center', backgroundColor: '#07a7d0', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", height: 43, display: 'grid', alignItems: 'center', backgroundColor: '#07a7d0', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<span>{"Financial Covenant"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: 45, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: 43, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<span>{"Current Testing"}</span>
</div>
</div>
......@@ -2759,22 +2784,25 @@ export default class ListOfCreditFacilities extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null :
<div style={{ flex: 1 }}>
<ThemeProvider theme={theme}>
<Input
disableUnderline={true}
style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[27]}
fixedDecimalScale={2}
decimalScale={2}
value={Number(tableMeta.rowData[27]).toFixed(2)}
onBlur={(event) => {
// // // console.log(event.target.value)
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta, 27)
// // // console.log(dataTable2)
}}
/>
</ThemeProvider>
}
/>
</div>
}
</div>
......@@ -2814,10 +2842,10 @@ export default class ListOfCreditFacilities extends Component {
<th style={{ ...style2, color: '#fff', backgroundColor: '#1c71b8', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 43, fontSize: 12, fontWeight: 'bold', padding: 5, textAlign: 'center' }}>{columnMeta.name}</div>
<div className="grid grid-2x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", height: 45, display: 'grid', alignItems: 'center', backgroundColor: '#07a7d0', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", height: 43, display: 'grid', alignItems: 'center', backgroundColor: '#07a7d0', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<span>{"Financial Covenant"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: 45, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: 43, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<span>{"Current Testing"}</span>
</div>
</div>
......@@ -2839,22 +2867,25 @@ export default class ListOfCreditFacilities extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null :
<div style={{ flex: 1 }}>
<ThemeProvider theme={theme}>
<Input
disableUnderline={true}
style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[29]}
fixedDecimalScale={2}
decimalScale={2}
value={Number(tableMeta.rowData[29]).toFixed(2)}
onBlur={(event) => {
// // // console.log(event.target.value)
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta, 29)
// // // console.log(dataTable2)
}}
/>
</ThemeProvider>
}
/>
</div>
}
</div>
......@@ -2894,10 +2925,10 @@ export default class ListOfCreditFacilities extends Component {
<th style={{ ...style2, color: '#fff', backgroundColor: '#1c71b8', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 43, fontSize: 12, fontWeight: 'bold', padding: 5, textAlign: 'center' }}>{columnMeta.name}</div>
<div className="grid grid-2x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", height: 45, display: 'grid', alignItems: 'center', backgroundColor: '#07a7d0', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", height: 43, display: 'grid', alignItems: 'center', backgroundColor: '#07a7d0', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<span>{"Financial Covenant"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: 45, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: 43, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 14 : 6 }}>
<span>{"Current Testing"}</span>
</div>
</div>
......@@ -2919,22 +2950,25 @@ export default class ListOfCreditFacilities extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null :
<div style={{ flex: 1 }}>
<ThemeProvider theme={theme}>
<Input
disableUnderline={true}
style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
defaultValue={tableMeta.rowData[31]}
fixedDecimalScale={2}
decimalScale={2}
value={Number(tableMeta.rowData[31]).toFixed(2)}
onBlur={(event) => {
// // // console.log(event.target.value)
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta, 31)
// // // console.log(dataTable2)
}}
/>
</ThemeProvider>
}
/>
</div>
}
</div>
......@@ -2974,13 +3008,13 @@ export default class ListOfCreditFacilities extends Component {
<th style={{ ...style2, color: '#fff', backgroundColor: '#1c71b8', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 43, fontSize: 12, fontWeight: 'bold', padding: 5, textAlign: 'center' }}>{columnMeta.name}</div>
<div className="grid grid-3x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", backgroundColor: '#07a7d0', height: 45, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", backgroundColor: '#07a7d0', height: 43, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<span>{"Ratio Name"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", backgroundColor: '#07a7d0', height: 45, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", backgroundColor: '#07a7d0', height: 43, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<span>{"Financial Covenant"}</span>
</div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: 45, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: 43, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<span>{"Current Testing"}</span>
</div>
</div>
......@@ -3002,7 +3036,7 @@ export default class ListOfCreditFacilities extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null :
<div style={{ flex: 1 }}>
<ThemeProvider theme={theme}>
<ThemeProvider theme={this.state.get_for == 'view'? theme3 : theme}>
<Input
disableUnderline={true}
style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
......@@ -3087,13 +3121,13 @@ export default class ListOfCreditFacilities extends Component {
<th style={{ ...style2, color: '#fff', backgroundColor: '#1c71b8', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 43, fontSize: 12, fontWeight: 'bold', padding: 5, textAlign: 'center' }}>{columnMeta.name}</div>
<div className="grid grid-3x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", backgroundColor: '#07a7d0', height: 45, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", backgroundColor: '#07a7d0', height: 43, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<span>{"Ratio Name"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", backgroundColor: '#07a7d0', height: 45, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", backgroundColor: '#07a7d0', height: 43, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<span>{"Financial Covenant"}</span>
</div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: 45, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: 43, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<span>{"Current Testing"}</span>
</div>
</div>
......@@ -3115,7 +3149,7 @@ export default class ListOfCreditFacilities extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null :
<div style={{ flex: 1 }}>
<ThemeProvider theme={theme}>
<ThemeProvider theme={this.state.get_for == 'view'? theme3 : theme}>
<Input
disableUnderline={true}
style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
......@@ -3200,13 +3234,13 @@ export default class ListOfCreditFacilities extends Component {
<th style={{ ...style2, color: '#fff', backgroundColor: '#1c71b8', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 43, fontSize: 12, fontWeight: 'bold', padding: 5, textAlign: 'center' }}>{columnMeta.name}</div>
<div className="grid grid-3x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", backgroundColor: '#07a7d0', height: 45, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", backgroundColor: '#07a7d0', height: 43, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<span>{"Ratio Name"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", backgroundColor: '#07a7d0', height: 45, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", backgroundColor: '#07a7d0', height: 43, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<span>{"Financial Covenant"}</span>
</div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: 45, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: 43, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<span>{"Current Testing"}</span>
</div>
</div>
......@@ -3228,7 +3262,7 @@ export default class ListOfCreditFacilities extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null :
<div style={{ flex: 1 }}>
<ThemeProvider theme={theme}>
<ThemeProvider theme={this.state.get_for == 'view'? theme3 : theme}>
<Input
disableUnderline={true}
style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
......@@ -3313,13 +3347,13 @@ export default class ListOfCreditFacilities extends Component {
<th style={{ ...style2, color: '#fff', backgroundColor: '#1c71b8', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 43, fontSize: 12, fontWeight: 'bold', padding: 5, textAlign: 'center' }}>{columnMeta.name}</div>
<div className="grid grid-3x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", backgroundColor: '#07a7d0', height: 45, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", backgroundColor: '#07a7d0', height: 43, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<span>{"Ratio Name"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", backgroundColor: '#07a7d0', height: 45, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', borderRight: "1px #fff solid", backgroundColor: '#07a7d0', height: 43, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<span>{"Financial Covenant"}</span>
</div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: 45, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', backgroundColor: '#07a7d0', height: 43, display: 'grid', alignItems: 'center', padding: dataTable2.length == 0 ? 13 : 5, paddingBottom: dataTable2.length == 0 ? 48 : 5 }}>
<span>{"Current Testing"}</span>
</div>
</div>
......@@ -3341,7 +3375,7 @@ export default class ListOfCreditFacilities extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 8 || tableMeta.rowData[0] === 9?
null :
<div style={{ flex: 1 }}>
<ThemeProvider theme={theme}>
<ThemeProvider theme={this.state.get_for == 'view'? theme3 : theme}>
<Input
disableUnderline={true}
style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent', marginBottom: -105 }}
......@@ -3727,8 +3761,8 @@ export default class ListOfCreditFacilities extends Component {
<div style={{padding: 5}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Diff</Typography>
</div>
<div style={{borderStyle: 'solid', borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end', backgroundColor: this.state.get_for == 'edit' && Number(this.state.diff) > 0? '#ffac99' : 'transparent'}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{formatSeparator(this.state.diff)}</Typography>
<div style={{borderStyle: 'solid', borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end'}}>
<Typography style={{ fontSize: '11px', color: Number(this.state.diff) > 0? '#ffac99' :'#4b4b4b' }}>{formatSeparator(this.state.diff)}</Typography>
</div>
</div>
</div>
......@@ -3920,8 +3954,8 @@ export default class ListOfCreditFacilities extends Component {
<div style={{padding: 5}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Diff</Typography>
</div>
<div style={{borderStyle: 'solid', borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end', backgroundColor: this.state.get_for == 'edit' && Number(this.state.diff) > 0? '#ffac99' : 'transparent'}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{formatSeparator(this.state.diff)}</Typography>
<div style={{borderStyle: 'solid', borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end'}}>
<Typography style={{ fontSize: '11px', color: Number(this.state.diff) > 0? '#ffac99' :'#4b4b4b' }}>{formatSeparator(this.state.diff)}</Typography>
</div>
</div>
</div>
......
......@@ -64,6 +64,7 @@ export default class OperatingIndicatorMR extends Component {
emptyData: false,
templateNull: true,
judulColumn: null,
saveDraft: true,
get_for: 'view'
}
this.fileHandler = this.fileHandler.bind(this);
......@@ -88,7 +89,7 @@ export default class OperatingIndicatorMR extends Component {
"report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode,
"months": this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null
"months": this.props.months
}
// console.log(payload);
api.create().getLastestUpdateMROI(payload).then(response => {
......@@ -123,7 +124,7 @@ export default class OperatingIndicatorMR extends Component {
}
api.create().getAllSettingByType(body).then(response => {
// console.log(response);
console.log(response);
if (response.data) {
if (response.data.status === 'success') {
this.setState({
......@@ -153,7 +154,7 @@ export default class OperatingIndicatorMR extends Component {
let payload = {
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode,
"months": this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null
"months": this.props.months
}
api.create().getMonthlyOI(payload).then(response => {
// console.log(response);
......@@ -180,18 +181,29 @@ export default class OperatingIndicatorMR extends Component {
"report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode,
"months": this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null,
"months": this.props.months,
"get_for": this.state.get_for
}
// console.log(payload);
console.log(payload);
api.create().getHierarkiMontlyReportOI(payload).then(response => {
// console.log(response);
console.log(response);
let dataTable = []
let err = false
if (response.data) {
let res = response.data.data
// console.log(res);
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (item.type_report_id === 3) {
if (item.monthly_report.mtd_vs_mb === "" && (Number(item.monthly_report.percent_act_vs_mb) < this.state.minValue || Number(item.monthly_report.percent_act_vs_mb) > this.state.maxValue)) {
err = true
}
if (item.monthly_report.mtd_vs_rb === "" && (Number(item.monthly_report.percent_act_vs_rb) < this.state.minValue || Number(item.monthly_report.percent_act_vs_rb) > this.state.maxValue)) {
console.log('msk 2');
err = true
}
}
if (indexIDzz === -1) {
dataTable.push([
item.type_report_id,
......@@ -223,6 +235,16 @@ export default class OperatingIndicatorMR extends Component {
}
}
res.map((item, index) => {
if (item.type_report_id === 3) {
if (item.monthly_report.mtd_vs_mb === "" && (Number(item.monthly_report.percent_act_vs_mb) < this.state.minValue || Number(item.monthly_report.percent_act_vs_mb) > this.state.maxValue)) {
err = true
}
if (item.monthly_report.mtd_vs_rb === "" && (Number(item.monthly_report.percent_act_vs_rb) < this.state.minValue || Number(item.monthly_report.percent_act_vs_rb) > this.state.maxValue)) {
console.log('msk 2');
err = true
}
}
dataTable.push([
item.type_report_id,
item.id,
......@@ -251,13 +273,16 @@ export default class OperatingIndicatorMR extends Component {
}
}
})
this.setState({ dataTable, loading: false }, () => {
if (err === true) {
this.setState({ bebas: true })
}
this.setState({ dataTable, loading: false, buttonError: true, saveDraft: true }, () => {
if (this.state.dataTable.length == 0) {
this.setState({ emptyData: true })
}
})
}
// console.log(dataTable);
console.log(dataTable);
})
}
......@@ -277,10 +302,11 @@ export default class OperatingIndicatorMR extends Component {
}
async downloadAllData() {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_oi/export_monthly_report?operating_indicator_id=${this.props.data.operatingIndID == null ? "" : this.props.data.operatingIndID}&&report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}&&months=${this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null}`
// console.log(this.props.months);
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_oi/export_monthly_report?operating_indicator_id=${this.props.data.operatingIndID == null ? "" : this.props.data.operatingIndID}&&report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}&&months=${this.props.months}`
console.log(url);
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_oi/export_monthly_report?operating_indicator_id=${this.props.data.operatingIndID === null ? "" : this.props.data.operatingIndID}&&report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}&&months=${this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null}`
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_oi/export_monthly_report?operating_indicator_id=${this.props.data.operatingIndID === null ? "" : this.props.data.operatingIndID}&&report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}&&months=${this.props.months}`
)
res = await res.blob()
this.setState({ loading: false })
......@@ -317,7 +343,7 @@ export default class OperatingIndicatorMR extends Component {
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode,
"status": type,
"months": this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null,
"months": this.props.months,
"monthly_report": data
}
console.log(payload);
......@@ -356,7 +382,7 @@ export default class OperatingIndicatorMR extends Component {
company_id: this.props.data.company.company_id,
periode: this.props.data.periode,
report_id: this.props.data.report_id,
months: this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null,
months: this.props.months,
monthly_report: payload
}
console.log(body)
......@@ -435,7 +461,7 @@ export default class OperatingIndicatorMR extends Component {
periode: this.props.data.periode,
report_id: this.props.data.report_id,
status: type,
months: this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null,
months: this.props.months,
monthly_report: data
}
// console.log(body);
......@@ -460,6 +486,15 @@ export default class OperatingIndicatorMR extends Component {
let data = []
let err = false
this.state.dataTable.map((i, index) => {
if (i[0] === 3) {
if (i[15] === "" && (Number(i[12]) < this.state.minValue || Number(i[12]) > this.state.maxValue)) {
console.log('msk 1');
err = true
} else if (i[16] === "" && (Number(i[14]) < this.state.minValue || Number(i[14]) > this.state.maxValue)) {
console.log('msk 2');
err = true
}
}
data.push({
"item_report_id": i[1],
"uom": i[6],
......@@ -475,16 +510,6 @@ export default class OperatingIndicatorMR extends Component {
"mtd_vs_rb": i[16]
})
})
// console.log(JSON.stringify(data));
data.map(i => {
if (i.mtd_vs_mb === "" && (Number(i.percent_act_vs_mb) < this.state.minValue || Number(i.percent_act_vs_mb) > this.state.maxValue)) {
console.log('msk 1');
err = true
} else if (i.mtd_vs_rb === "" && (Number(i.percent_act_vs_rb) < this.state.minValue || Number(i.percent_act_vs_rb) > this.state.maxValue)) {
console.log('msk 2');
err = true
}
})
// console.log(JSON.stringify(data))
let payload = {
......@@ -493,7 +518,7 @@ export default class OperatingIndicatorMR extends Component {
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode,
"status": "submitted",
"months": this.props.data.report_id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : null,
"months": this.props.months,
"monthly_report": data
}
// console.log(JSON.stringify(payload));
......@@ -580,12 +605,10 @@ export default class OperatingIndicatorMR extends Component {
const handleVariancePercent = (tableMeta, dex, type) => {
let total = 0
if (dex === 1) {
// total = Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8])
total = R.equals((Number(Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100 ), NaN) ? '0' : R.equals((Number(Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100 ), Infinity) ? '0' : Number(Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8]) * 100)
total = R.equals(Number((Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100), NaN) ? '0' : R.equals(Number((Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100), Infinity) ? '0' : Number((Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100 == "-Infinity" ? '0' : (Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
} else if (dex === 2) {
// total = Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9])
total = R.equals((Number(Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9])) * 100 ), NaN) ? '0' : R.equals((Number(Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9])) * 100 ), Infinity) ? '0' : Number(Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9])* 100)
total = R.equals(Number((Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9])) * 100), NaN) ? '0' : R.equals(Number((Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9]))* 100), Infinity) ? '0' : Number((Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9])) * 100 == "-Infinity" ? '0' : (Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9])) * 100)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
}
return total
......@@ -1048,6 +1071,24 @@ export default class OperatingIndicatorMR extends Component {
/>
</div>
:
tableMeta.rowData[0] === 6 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={ Number(tableMeta.rowData[8]).toFixed(1)}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(val, tableMeta, 1)).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -1177,6 +1218,7 @@ export default class OperatingIndicatorMR extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
suffix={'%'}
disabled={true}
value={Number(tableMeta.rowData[12]).toFixed(1)}
/>
......@@ -1184,11 +1226,11 @@ export default class OperatingIndicatorMR extends Component {
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={Number(tableMeta.rowData[12]).toFixed(1)}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? 'red' : 'black', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? 'red' : '#000000b0', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
suffix={'%'}
......@@ -1250,6 +1292,7 @@ export default class OperatingIndicatorMR extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
suffix={'%'}
disabled={true}
value={Number(tableMeta.rowData[14]).toFixed(1)}
/>
......@@ -1257,11 +1300,11 @@ export default class OperatingIndicatorMR extends Component {
<div style={{ flex: 1, width: 120 }}>
<FormControlLabel
style={{ margin: 0 }}
value={Number(tableMeta.rowData[14]).toFixed(1)}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? 'red' : 'black', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? 'red' : '#000000b0', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
......@@ -1330,28 +1373,51 @@ export default class OperatingIndicatorMR extends Component {
<div>
<div className="grid grid-2x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? null :
this.state.get_for == 'view' ? tableMeta.rowData[15] :
<div style={{ textAlign: 'left', width: 90 }}>
<div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 3 ?
this.state.get_for == 'view' ?
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
multiline={true}
disabled={true}
defaultValue={tableMeta.rowData[15]}
inputProps={{
style: {
color: Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? "#5198ea" : '#5198ea',
textAlign: 'left'
}
}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 0)
}}
/>
:
<FormControlLabel
style={{ margin: 0 }}
// value={value}
// value={tableMeta.rowData[15]}
control={
tableMeta.rowData[15] === "" && (Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue) ?
<LightTooltipError title={"MTD Explanation vs Prev Month is Reqiured"} arrow>
<LightTooltipError title={"MTD Explanation vs MB is Reqiured"} arrow>
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', minHeight: 30 , padding: 0 }}
type="text"
placeholder=""
// disabled={false}
disabled={this.state.get_for == 'view'}
multiline={true}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
// value={tableMeta.rowData[15]}
defaultValue={tableMeta.rowData[15]}
inputProps={{
style: {
color: this.state.get_for == 'view'? "black" : "#5198ea",
textAlign: 'right',
backgroundColor: '#ffac99'
color: "#5198ea",
textAlign: 'left',
backgroundColor: '#ffac99',
minHeight: 30,
padding: 0
}
}}
onBlur={(event) => {
......@@ -1362,15 +1428,16 @@ export default class OperatingIndicatorMR extends Component {
:
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
multiline={true}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
defaultValue={tableMeta.rowData[15]}
inputProps={{
style: {
color: Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? "#5198ea" : '#5198ea',
textAlign: 'right'
textAlign: 'left'
}
}}
onBlur={(event) => {
......@@ -1379,63 +1446,94 @@ export default class OperatingIndicatorMR extends Component {
/>
}
/>
:
null
}
</div>
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? null :
this.state.get_for == 'view' ? tableMeta.rowData[16] :
<div style={{ textAlign: 'left', width: 90 }}>
<div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 3 ?
this.state.get_for == 'view' ?
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
multiline={true}
disabled={true}
defaultValue={tableMeta.rowData[16]}
inputProps={{
style: {
color: Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? "#5198ea" : '#5198ea',
textAlign: 'left'
}
}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 0)
}}
/>
:
<FormControlLabel
style={{ margin: 0 }}
// value={value}
// value={tableMeta.rowData[16]}
control={
tableMeta.rowData[16] === "" && (Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue) ?
<LightTooltipError title={"MTD Explanation vs Prev Month is Reqiured"} arrow>
<LightTooltipError title={"MTD Explanation vs RB is Reqiured"} arrow>
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', minHeight: 30 , padding: 0 }}
type="text"
placeholder=""
disabled={this.state.get_for == 'view'}
multiline={true}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
// value={tableMeta.rowData[16]}
defaultValue={tableMeta.rowData[16]}
inputProps={{
style: {
color: this.state.get_for == 'view'? "black" : "#5198ea",
textAlign: 'right',
backgroundColor: '#ffac99'
color: "#5198ea",
textAlign: 'left',
backgroundColor: '#ffac99',
minHeight: 30,
padding: 0
}
}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 1)
handleText(event.target.value, tableMeta, 0)
}}
/>
</LightTooltipError>
:
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
multiline={true}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
defaultValue={tableMeta.rowData[16]}
disabled={this.state.get_for == 'view'}
inputProps={{
style: {
color: Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? "#5198ea" : '#5198ea',
textAlign: 'right'
textAlign: 'left'
}
}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 1)
handleText(event.target.value, tableMeta, 0)
}}
/>
}
/>
:
null
}
</div>
</div>
</div>
</div>
</div>
)
}
}
......@@ -1481,18 +1579,18 @@ export default class OperatingIndicatorMR extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>
Period : {
this.props.data.report_id === 22 ? 'JAN' :
this.props.data.report_id === 23 ? 'FEB' :
this.props.data.report_id === 24 ? 'MAR' :
this.props.data.report_id === 25 ? 'APR' :
this.props.data.report_id === 26 ? 'MAY' :
this.props.data.report_id === 27 ? 'JUN' :
this.props.data.report_id === 28 ? 'JUL' :
this.props.data.report_id === 29 ? 'AUG' :
this.props.data.report_id === 30 ? 'SEP' :
this.props.data.report_id === 31 ? 'OCT' :
this.props.data.report_id === 32 ? 'NOV' :
this.props.data.report_id === 33 ? 'DEC' : "" } {this.props.data.periode}
this.props.months === 1 ? 'JAN' :
this.props.months === 2 ? 'FEB' :
this.props.months === 3 ? 'MAR' :
this.props.months === 4 ? 'APR' :
this.props.months === 5 ? 'MAY' :
this.props.months === 6 ? 'JUN' :
this.props.months === 7 ? 'JUL' :
this.props.months === 8 ? 'AUG' :
this.props.months === 9 ? 'SEP' :
this.props.months === 10 ? 'OCT' :
this.props.months === 11 ? 'NOV' :
this.props.months === 12 ? 'DEC' : "" } {this.props.data.periode}
</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
......@@ -1599,7 +1697,7 @@ export default class OperatingIndicatorMR extends Component {
this.setState({ loading: true, editable: false }, () => {
setTimeout(() => {
this.handleValidate()
this.setState({ loading: false, buttonError: false })
// this.setState({ loading: false, buttonError: false })
}, 100);
})
}
......@@ -1621,7 +1719,7 @@ export default class OperatingIndicatorMR extends Component {
marginRight: 20
}}
onClick={() =>
this.state.editable === true ?
this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.setState({ loading: true }, () => {
......@@ -1631,13 +1729,7 @@ export default class OperatingIndicatorMR extends Component {
})}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
{this.state.editable === true?
<LightTooltip title={"Data Incomplete"} arrow>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</LightTooltip>
:
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
}
</div>
</button>}
{this.state.get_for == 'edit' && <button
......@@ -1661,13 +1753,7 @@ export default class OperatingIndicatorMR extends Component {
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
{this.state.editable === true ?
<LightTooltip title={"Data Incomplete"} arrow>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</LightTooltip>
:
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
}
</div>
</button>}
</div>}
......@@ -1681,18 +1767,18 @@ export default class OperatingIndicatorMR extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>
Period : {
this.props.data.report_id === 22 ? 'JAN' :
this.props.data.report_id === 23 ? 'FEB' :
this.props.data.report_id === 24 ? 'MAR' :
this.props.data.report_id === 25 ? 'APR' :
this.props.data.report_id === 26 ? 'MAY' :
this.props.data.report_id === 27 ? 'JUN' :
this.props.data.report_id === 28 ? 'JUL' :
this.props.data.report_id === 29 ? 'AUG' :
this.props.data.report_id === 30 ? 'SEP' :
this.props.data.report_id === 31 ? 'OCT' :
this.props.data.report_id === 32 ? 'NOV' :
this.props.data.report_id === 33 ? 'DEC' : "" } {this.props.data.periode}
this.props.months === 1 ? 'JAN' :
this.props.months === 2 ? 'FEB' :
this.props.months === 3 ? 'MAR' :
this.props.months === 4 ? 'APR' :
this.props.months === 5 ? 'MAY' :
this.props.months === 6 ? 'JUN' :
this.props.months === 7 ? 'JUL' :
this.props.months === 8 ? 'AUG' :
this.props.months === 9 ? 'SEP' :
this.props.months === 10 ? 'OCT' :
this.props.months === 11 ? 'NOV' :
this.props.months === 12 ? 'DEC' : "" } {this.props.data.periode}
</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
......@@ -1737,7 +1823,8 @@ export default class OperatingIndicatorMR extends Component {
onClick={() =>
this.setState({ loading: true, editable: false }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: false })
this.handleValidate()
// this.setState({ loading: false, buttonError: false })
}, 100);
})
}
......@@ -1759,25 +1846,30 @@ export default class OperatingIndicatorMR extends Component {
}}
// disabled={this.state.editable}
onClick={() =>
this.state.editable === true ?
null : this.setState({ loading: true }, () => {
this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadOI("draft")
}, 100);
})}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
{this.state.editable === true?
<LightTooltip title={"Data Incomplete"} arrow>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</LightTooltip>
:
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
}
</div>
</button>
<button
className="button"
type="button"
// disabled={this.state.editable}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.editable === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
......@@ -1787,23 +1879,10 @@ export default class OperatingIndicatorMR extends Component {
this.uploadOI("submitted")
}, 100);
})}
// disabled={this.state.editable}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
{this.state.editable === true ?
<LightTooltip title={"Data Incomplete"} arrow>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</LightTooltip>
:
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
}
</div>
</button>
</div>}
......
......@@ -201,16 +201,9 @@ export default class ProfitLossMR extends Component {
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (item.type_report_id === 3) {
if (item.profit_loss.mtd_vs_previous_month == "" && Number(item.profit_loss.percent_act_vs_previous_month) < this.state.minValue || Number(item.profit_loss.percent_act_vs_previous_month) > this.state.maxValue) {
err = true
}
if (item.profit_loss.mtd_vs_mb == "" && Number(item.profit_loss.percent_act_vs_mb) < this.state.minValue || Number(item.profit_loss.percent_act_vs_mb) > this.state.maxValue) {
err = true
}
if (item.profit_loss.mtd_vs_rb == "" && Number(item.profit_loss.percent_act_vs_rb) < this.state.minValue || Number(item.profit_loss.percent_act_vs_rb) > this.state.maxValue) {
err = true
}
}
if (indexIDzz === -1) {
dataTable.push([
......@@ -233,9 +226,9 @@ export default class ProfitLossMR extends Component {
item.profit_loss.percent_act_vs_mb === null ? "0.0" : item.profit_loss.percent_act_vs_mb === "" ? "0.0" : item.profit_loss.percent_act_vs_mb,
item.profit_loss.amount_act_vs_rb === null ? "0.0" : item.profit_loss.amount_act_vs_rb === "" ? "0.0" : item.profit_loss.amount_act_vs_rb,
item.profit_loss.percent_act_vs_rb === null ? "0.0" : item.profit_loss.percent_act_vs_rb === "" ? "0.0" : item.profit_loss.percent_act_vs_rb,
item.profit_loss.mtd_vs_previous_month === null ? "" : item.profit_loss.mtd_vs_previous_month,
item.profit_loss.mtd_vs_mb === null ? "" : item.profit_loss.mtd_vs_mb,
item.profit_loss.mtd_vs_rb === null ? "" : item.profit_loss.mtd_vs_rb,
item.profit_loss.mtd_vs_previous_month === null ? "" : item.profit_loss.mtd_vs_previous_month,
item.order,
item.profit_loss.ytd_actual === null ? "0.0" : item.profit_loss.ytd_actual === "" ? "0.0" : item.profit_loss.ytd_actual,
])
......@@ -250,16 +243,9 @@ export default class ProfitLossMR extends Component {
}
res.map((item, index) => {
if (item.type_report_id === 3 ) {
if (item.profit_loss.mtd_vs_previous_month == "" && Number(item.profit_loss.percent_act_vs_previous_month) < this.state.minValue || Number(item.profit_loss.percent_act_vs_previous_month) > this.state.maxValue) {
err = true
}
if (item.profit_loss.mtd_vs_mb == "" && Number(item.profit_loss.percent_act_vs_mb) < this.state.minValue || Number(item.profit_loss.percent_act_vs_mb) > this.state.maxValue) {
err = true
}
if (item.profit_loss.mtd_vs_rb == "" && Number(item.profit_loss.percent_act_vs_rb) < this.state.minValue || Number(item.profit_loss.percent_act_vs_rb) > this.state.maxValue) {
err = true
}
}
dataTable.push([
item.type_report_id,
......@@ -281,9 +267,9 @@ export default class ProfitLossMR extends Component {
item.profit_loss.percent_act_vs_mb === null ? "0.0" : item.profit_loss.percent_act_vs_mb === "" ? "0.0" : item.profit_loss.percent_act_vs_mb,
item.profit_loss.amount_act_vs_rb === null ? "0.0" : item.profit_loss.amount_act_vs_rb === "" ? "0.0" : item.profit_loss.amount_act_vs_rb,
item.profit_loss.percent_act_vs_rb === null ? "0.0" : item.profit_loss.percent_act_vs_rb === "" ? "0.0" : item.profit_loss.percent_act_vs_rb,
item.profit_loss.mtd_vs_previous_month === null ? "" : item.profit_loss.mtd_vs_previous_month,
item.profit_loss.mtd_vs_mb === null ? "" : item.profit_loss.mtd_vs_mb,
item.profit_loss.mtd_vs_rb === null ? "" : item.profit_loss.mtd_vs_rb,
item.profit_loss.mtd_vs_previous_month === null ? "" : item.profit_loss.mtd_vs_previous_month,
item.order,
item.profit_loss.ytd_actual === null ? "0.0" : item.profit_loss.ytd_actual === "" ? "0.0" : item.profit_loss.ytd_actual,
])
......@@ -318,7 +304,7 @@ export default class ProfitLossMR extends Component {
downloadTemplate = async () => {
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_pl/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/profit_loss/monthly_report/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
)
res = await res.blob()
// console.log(res)
......@@ -332,10 +318,10 @@ export default class ProfitLossMR extends Component {
}
async downloadAllData() {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_pl/export_monthly_report?monthly_report_id=${this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/profit_loss/monthly_report/export_monthly_report?monthly_report_id=${this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
console.log(url);
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_pl/export_monthly_report?monthly_report_id=${this.props.monthlyReportId === null ? "" : this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/profit_loss/monthly_report/export_monthly_report?monthly_report_id=${this.props.monthlyReportId === null ? "" : this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
)
res = await res.blob()
this.setState({ loading: false })
......@@ -368,9 +354,9 @@ export default class ProfitLossMR extends Component {
"percent_act_vs_mb": i[16],
"amount_act_vs_rb": i[17],
"percent_act_vs_rb": i[18],
"mtd_vs_previous_month": i[19],
"mtd_vs_mb": i[20],
"mtd_vs_rb": i[21]
"mtd_vs_mb": i[19],
"mtd_vs_rb": i[20],
"mtd_vs_previous_month": i[21],
})
})
let payload = {
......@@ -382,6 +368,7 @@ export default class ProfitLossMR extends Component {
"months": this.props.month.month_id,
"profit_loss": data
}
console.log(payload);
// console.log(JSON.stringify(payload));
api.create('UPLOAD').createMonthlyReportPL(payload).then(response => {
console.log(response);
......@@ -426,9 +413,9 @@ export default class ProfitLossMR extends Component {
item_report: i[2] === undefined ? "" : String(i[2]).trim(),
notes: i[3] === undefined ? "" : String(i[3]).trim(),
actual: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
mtd_vs_previous_month: i[5] === undefined ? "" : String(i[5]).trim(),
mtd_vs_mb: i[6] === undefined ? "" : String(i[6]).trim(),
mtd_vs_rb: i[7] === undefined ? "" : String(i[7]).trim(),
mtd_vs_mb: i[5] === undefined ? "" : String(i[5]).trim(),
mtd_vs_rb: i[6] === undefined ? "" : String(i[6]).trim(),
mtd_vs_previous_month: i[7] === undefined ? "" : String(i[7]).trim(),
})
}
})
......@@ -479,9 +466,9 @@ export default class ProfitLossMR extends Component {
// item.percent_act_vs_mb,
// item.amount_act_vs_rb,
// item.percent_act_vs_rb,
item.mtd_vs_previous_month ,
item.mtd_vs_mb ,
item.mtd_vs_rb ,
item.mtd_vs_previous_month ,
item.orders,
item.ytd_actual === null ? "" : item.ytd_actual === "" ? "" : item.ytd_actual,
item.error
......@@ -520,9 +507,9 @@ export default class ProfitLossMR extends Component {
percent_act_vs_mb: String(Number(i[16]).toFixed(1)),
amount_act_vs_rb: String(Number(i[17]).toFixed(1)),
percent_act_vs_rb: String(Number(i[18]).toFixed(1)),
mtd_vs_previous_month: String(i[19]),
mtd_vs_mb: String(i[20]),
mtd_vs_rb: String(i[21]),
mtd_vs_mb: String(i[19]),
mtd_vs_rb: String(i[20]),
mtd_vs_previous_month: String(i[21]),
})
})
let body = {
......@@ -558,7 +545,7 @@ export default class ProfitLossMR extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false, handleTekTekTek: 0 })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false, handleTekTekTek: 0 })
this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false, handleTekTekTek: 0 })
}
})
}
......@@ -569,17 +556,18 @@ export default class ProfitLossMR extends Component {
this.state.dataTable.map((i, index) => {
if(i[0] === 3 ) {
// console.log(i);
if ( i[19] === "" && (Number(i[14]) < this.state.minValue || Number(i[14]) > this.state.maxValue)) {
if ( i[19] === "" && (Number(i[16]) < this.state.minValue || Number(i[16]) > this.state.maxValue)) {
console.log('msk 1');
// console.log(i);
err = true
} else if ( i[20] === "" && (Number(i[16]) < this.state.minValue || Number(i[16]) > this.state.maxValue)) {
console.log('msk 2');
err = true
} else if ( i[21] === "" && (Number(i[18]) < this.state.minValue || Number(i[18]) > this.state.maxValue)) {
console.log('msk 3');
err = true
}
// else if ( i[20] === "" && (Number(i[16]) < this.state.minValue || Number(i[16]) > this.state.maxValue)) {
// console.log('msk 2');
// err = true
// } else if ( i[21] === "" && (Number(i[18]) < this.state.minValue || Number(i[18]) > this.state.maxValue)) {
// console.log('msk 3');
// err = true
// }
}
data.push({
"item_report_id": i[1],
......@@ -596,9 +584,9 @@ export default class ProfitLossMR extends Component {
"percent_act_vs_mb": i[16],
"amount_act_vs_rb": i[17],
"percent_act_vs_rb": i[18],
"mtd_vs_previous_month": i[19],
"mtd_vs_mb": i[20],
"mtd_vs_rb": i[21]
"mtd_vs_mb": i[19],
"mtd_vs_rb": i[20],
"mtd_vs_previous_month": i[21],
})
})
......@@ -1274,7 +1262,7 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[11]).toFixed(1) }
value={Number(tableMeta.rowData[23]).toFixed(1) }
/>
:
// tableMeta.rowData[0] === 2 ?
......@@ -1736,13 +1724,13 @@ export default class ProfitLossMR extends Component {
<div style={{ borderBottom: "1px #fff solid", justifyContent: 'center', display: 'flex', alignItems: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, height: 40 }}>{columnMeta.name}</div>
<div className="grid grid-3x" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<span>{"vs Prev Month"}</span>
<span>{"vs MB"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<span>{"vs MB"}</span>
<span>{"vs RB"}</span>
</div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
<span>{"vs RB"}</span>
<span>{"vs Prev Month"}</span>
</div>
</div>
</th>
......@@ -1772,7 +1760,7 @@ export default class ProfitLossMR extends Component {
defaultValue={tableMeta.rowData[19]}
inputProps={{
style: {
color: Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? "#5198ea" : '#5198ea',
color: Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue ? "#5198ea" : '#5198ea',
textAlign: 'left'
}
}}
......@@ -1785,8 +1773,8 @@ export default class ProfitLossMR extends Component {
style={{ margin: 0 }}
// value={tableMeta.rowData[19]}
control={
tableMeta.rowData[19] === "" && (Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue) ?
<LightTooltipError title={"MTD Explanation vs Prev. Month is Reqiured"} arrow>
tableMeta.rowData[19] === "" && (Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue) ?
<LightTooltipError title={"MTD Explanation vs MB is Reqiured"} arrow>
<Input
disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', minHeight: 30 , padding: 0 }}
......@@ -1817,13 +1805,11 @@ export default class ProfitLossMR extends Component {
type="text"
placeholder=""
multiline={true}
// disabled={Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? false : true}
// value={tableMeta.rowData[19]}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
defaultValue={tableMeta.rowData[19]}
inputProps={{
style: {
color: Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? "#5198ea" : '#5198ea',
color: Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue ? "#5198ea" : '#5198ea',
textAlign: 'left'
}
}}
......@@ -1854,7 +1840,7 @@ export default class ProfitLossMR extends Component {
defaultValue={tableMeta.rowData[20]}
inputProps={{
style: {
color: Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue ? "#5198ea" : '#5198ea',
color: '#5198ea',
textAlign: 'left'
}
}}
......@@ -1867,45 +1853,17 @@ export default class ProfitLossMR extends Component {
style={{ margin: 0 }}
// value={value}
control={
tableMeta.rowData[20] === "" && (Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue) ?
<LightTooltipError title={"MTD Explanation vs MB is Reqiured"} arrow>
<Input
disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', minHeight: 30 , padding: 0 }}
type="text"
placeholder=""
multiline={true}
// value={tableMeta.rowData[20]}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
defaultValue={tableMeta.rowData[20]}
inputProps={{
style: {
color: "#5198ea",
textAlign: 'left',
backgroundColor: '#ffac99',
minHeight: 30 ,
padding: 0
}
}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 1)
}}
/>
</LightTooltipError>
:
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
multiline={true}
// disabled={Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue ? false : true}
// value={tableMeta.rowData[20]}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
defaultValue={tableMeta.rowData[20]}
inputProps={{
style: {
color: Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue ? "#5198ea" : '#5198ea',
color: '#5198ea',
textAlign: 'left'
}
}}
......@@ -1936,7 +1894,7 @@ export default class ProfitLossMR extends Component {
defaultValue={tableMeta.rowData[21]}
inputProps={{
style: {
color: Number(tableMeta.rowData[18]) < this.state.minValue || Number(tableMeta.rowData[18]) > this.state.maxValue ? "#5198ea" : '#5198ea',
color: '#5198ea',
textAlign: 'left'
}
}}
......@@ -1949,45 +1907,17 @@ export default class ProfitLossMR extends Component {
style={{ margin: 0 }}
// value={value}
control={
tableMeta.rowData[21] === "" && (Number(tableMeta.rowData[18]) < this.state.minValue || Number(tableMeta.rowData[18]) > this.state.maxValue) ?
<LightTooltipError title={"MTD Explanation vs RB is Reqiured"} arrow>
<Input
disableUnderline={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', minHeight: 30 , padding: 0 }}
type="text"
placeholder=""
multiline={true}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
// value={tableMeta.rowData[21]}
defaultValue={tableMeta.rowData[21]}
inputProps={{
style: {
color: "#5198ea",
textAlign: 'left',
backgroundColor: '#ffac99',
minHeight: 30 ,
padding: 0
}
}}
onBlur={(event) => {
handleText(event.target.value, tableMeta, 2)
}}
/>
</LightTooltipError>
:
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
multiline={true}
// disabled={Number(tableMeta.rowData[18]) < this.state.minValue || Number(tableMeta.rowData[18]) > this.state.maxValue ? false : true}
// value={tableMeta.rowData[21]}
disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
defaultValue={tableMeta.rowData[21]}
inputProps={{
style: {
color: Number(tableMeta.rowData[18]) < this.state.minValue || Number(tableMeta.rowData[18]) > this.state.maxValue ? "#5198ea" : '#5198ea',
color: '#5198ea',
textAlign: 'left'
}
}}
......
......@@ -340,8 +340,8 @@ export default class TaxPlanningMR extends Component {
checkUpload() {
api.create().checkUploadMonthlyReportTP(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
// console.log(this.state.payload)
// console.log(response)
console.log(this.state.payload)
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleTP: false, loading: true })
......@@ -410,7 +410,7 @@ export default class TaxPlanningMR extends Component {
api.create('UPLOAD').uploadMonthlyReportTP(body).then(response => {
// console.log(body);
// console.log(JSON.stringify(body));
// console.log(response);
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.props.saveToMonthlyReport()
......@@ -448,7 +448,7 @@ export default class TaxPlanningMR extends Component {
})
if (String(i[8]) == "Control (should be nil)") {
if (i[9].tbf < this.state.minValue || i[9].tbf > this.state.maxValue || i[10] < this.state.minValue || i[10] > this.state.maxValue) {
if (i[9].tbf < this.state.minValue || i[9].tbf > this.state.maxValue) {
errorContrl = true
editAble = true
} else {
......@@ -496,7 +496,7 @@ export default class TaxPlanningMR extends Component {
downloadTemplate = async () => {
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_tp/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/monthly_report/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
)
res = await res.blob()
// console.log(res)
......@@ -510,8 +510,8 @@ export default class TaxPlanningMR extends Component {
}
async downloadAllData() {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_tp/export_monthly_report?monthly_report_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
let urls = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_tp/export_monthly_report?monthly_report_id=${this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/monthly_report/export_monthly_report?monthly_report_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
let urls = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/monthly_report/export_monthly_report?monthly_report_id=${this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
// console.log(url);
console.log(urls);
let res = await fetch(
......@@ -1207,7 +1207,7 @@ export default class TaxPlanningMR extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
{tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 || tableMeta.rowData[3] === 7?
null
:
this.state.get_for == 'view'?
......@@ -1240,46 +1240,46 @@ export default class TaxPlanningMR extends Component {
/>
</span>
:
tableMeta.rowData[3] === 7 ?
(Number(handleValueFormula(value, tableMeta, 4)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 4)).toFixed(1) <= Number(this.state.maxValue)) ?
// (Number(value).toFixed(1) >= Number(this.state.minValue) && Number(value).toFixed(1) <= Number(this.state.maxValue)) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
value={Number(value).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[14].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 4)).toFixed(1)}
value={Number(value).toFixed(1)}
/>
</LightTooltip>
:
// tableMeta.rowData[3] === 7 ?
// (Number(handleValueFormula(value, tableMeta, 4)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 4)).toFixed(1) <= Number(this.state.maxValue)) ?
// // (Number(value).toFixed(1) >= Number(this.state.minValue) && Number(value).toFixed(1) <= Number(this.state.maxValue)) ?
// <NumberFormat
// thousandSeparator={true}
// style={{
// fontSize: 12,
// textAlign: 'right',
// borderColor: 'transparent',
// margin: 0,
// width: 96,
// backgroundColor: 'transparent',
// color: 'black'
// }}
// type="text"
// placeholder=""
// disabled={true}
// // value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
// value={Number(value).toFixed(1)}
// /> :
// <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[14].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
// <NumberFormat
// thousandSeparator={true}
// style={{
// fontSize: 12,
// textAlign: 'right',
// borderColor: 'transparent',
// margin: 0,
// width: 96,
// backgroundColor: 'transparent',
// color: 'red'
// }}
// type="text"
// placeholder=""
// disabled={true}
// // value={Number(handleValueFormula(value, tableMeta, 4)).toFixed(1)}
// value={Number(value).toFixed(1)}
// />
// </LightTooltip>
// :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......
......@@ -111,6 +111,7 @@ export default class OperatingIndicator extends Component {
"periode": this.state.periode.periode,
"report_type": "operating indicator",
}
console.log(payload);
api.create().getAllOperatingInd(payload).then(response => {
console.log(response);
if (response.data) {
......@@ -312,6 +313,18 @@ export default class OperatingIndicator extends Component {
})
} else if (String(item[1]).toLocaleLowerCase().includes("monthly report")) {
console.log(item);
let month = String(item[1]).toLocaleLowerCase().includes('jan') ? 1 :
String(item[1]).toLocaleLowerCase().includes('feb') ? 2 :
String(item[1]).toLocaleLowerCase().includes('mar') ? 3 :
String(item[1]).toLocaleLowerCase().includes('apr') ? 4 :
String(item[1]).toLocaleLowerCase().includes('may') ? 5 :
String(item[1]).toLocaleLowerCase().includes('jun') ? 6 :
String(item[1]).toLocaleLowerCase().includes('jul') ? 7 :
String(item[1]).toLocaleLowerCase().includes('aug') ? 8 :
String(item[1]).toLocaleLowerCase().includes('sep') ? 9 :
String(item[1]).toLocaleLowerCase().includes('oct') ? 10 :
String(item[1]).toLocaleLowerCase().includes('nov') ? 11 :
String(item[1]).toLocaleLowerCase().includes('dec') ? 12 : null
this.setState({
statusDetail: String(item[2]).toLocaleLowerCase(),
dataDetail: { ...this.state.dataReport[index], periode: this.state.periode.periode, operatingIndID: this.state.operatingIndID, company: this.state.company },
......@@ -319,7 +332,7 @@ export default class OperatingIndicator extends Component {
visibleDetailOpt: false,
visibleDetailMonthly: true,
visibleDetailRolling: false,
months: id === 22 ? 1 : 23 ? 2 : 24 ? 3 : 25 ? 4 : 27 ? 5 : 28 ? 6 : 29 ? 7 : 31 ? 8 : 32 ? 9 : 33 ? 10 : 35 ? 11 : 36 ? 12 : 0
months: month
})
......
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