Commit 967d37cd authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

tinggal deni

See merge request !504
parents a1a6e308 43071f0b
...@@ -755,9 +755,9 @@ export default class BudgetTahunan extends Component { ...@@ -755,9 +755,9 @@ export default class BudgetTahunan extends Component {
borderColor: 'transparent' borderColor: 'transparent'
}} }}
onClick={() => onClick={() =>
tableMeta.rowData[5] == true ? // tableMeta.rowData[5] == true ?
this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3]) this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3])
: null // : null
} }
> >
{/* {this.state.isApprover == true ? {/* {this.state.isApprover == true ?
......
...@@ -88,7 +88,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -88,7 +88,7 @@ export default class CorporateAnnualTarget extends Component {
this.getKPIType() this.getKPIType()
this.getMaxAch() this.getMaxAch()
this.getLatestUpdate() this.getLatestUpdate()
console.log(this.props.lastStatus); // console.log(this.props.lastStatus);
} }
...@@ -101,10 +101,10 @@ export default class CorporateAnnualTarget extends Component { ...@@ -101,10 +101,10 @@ export default class CorporateAnnualTarget extends Component {
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"submission_id": this.props.submissionID "submission_id": this.props.submissionID
} }
console.log(JSON.stringify(payload)) // console.log(JSON.stringify(payload))
api.create().getDetailReportMB(payload).then(response => { api.create().getDetailReportMB(payload).then(response => {
let dataTable = [] let dataTable = []
console.log(response) // console.log(response)
let res = response.data.data let res = response.data.data
const handlePushChild = (item) => { const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id) let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
...@@ -201,7 +201,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -201,7 +201,7 @@ export default class CorporateAnnualTarget extends Component {
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}` `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
) )
res = await res.blob() res = await res.blob()
console.log(res) // console.log(res)
if (res.size > 0) { if (res.size > 0) {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
let a = document.createElement('a'); let a = document.createElement('a');
...@@ -212,16 +212,16 @@ export default class CorporateAnnualTarget extends Component { ...@@ -212,16 +212,16 @@ export default class CorporateAnnualTarget extends Component {
} }
async downloadAllData() { async downloadAllData() {
console.log('masuk') // console.log('masuk')
let bram = [this.props.submissionID, this.props.report_id, this.props.company.company_id, this.props.periode, this.props.revision] let bram = [this.props.submissionID, this.props.report_id, this.props.company.company_id, this.props.periode, this.props.revision]
console.log(bram) // console.log(bram)
let resReal = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}` let resReal = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
let resNull = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}` let resNull = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
let res = await fetch( let res = await fetch(
this.props.submissionID == null ? resNull : resReal this.props.submissionID == null ? resNull : resReal
) )
res = await res.blob() res = await res.blob()
console.log(res) // console.log(res)
this.setState({ loading: false }) this.setState({ loading: false })
if (res.size > 0) { if (res.size > 0) {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
...@@ -235,13 +235,13 @@ export default class CorporateAnnualTarget extends Component { ...@@ -235,13 +235,13 @@ export default class CorporateAnnualTarget extends Component {
fileHandler = (event) => { fileHandler = (event) => {
let fileObj = event let fileObj = event
ExcelRenderer(fileObj, (err, resp) => { ExcelRenderer(fileObj, (err, resp) => {
// console.log(resp) // // console.log(resp)
if (err) { if (err) {
console.log(err); // console.log(err);
} }
else { else {
let isi = resp.rows.slice(3) let isi = resp.rows.slice(3)
console.log(isi); // console.log(isi);
let payload = [] let payload = []
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/; let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
isi.map((i, index) => { isi.map((i, index) => {
...@@ -263,8 +263,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -263,8 +263,8 @@ export default class CorporateAnnualTarget extends Component {
} }
nilaiTotal = i[6] == 'SUM' ? total : i[6] == 'AVG' ? total / 12 : lastValz nilaiTotal = i[6] == 'SUM' ? total : i[6] == 'AVG' ? total / 12 : lastValz
} }
console.log(nilaiTotal) // console.log(nilaiTotal)
// console.log(i[2] === undefined ? "" : String(Number(i[2]*100)).length > 3? String(Number(i[2]*100).toFixed(0) + '%') : String(Number(i[2]*100)) + '%') // // console.log(i[2] === undefined ? "" : String(Number(i[2]*100)).length > 3? String(Number(i[2]*100).toFixed(0) + '%') : String(Number(i[2]*100)) + '%')
payload.push({ payload.push({
item_report_id: i[0] === undefined ? "" : reg.test(String(i[0])) === false ? "" : String(i[0]).trim(), item_report_id: i[0] === undefined ? "" : reg.test(String(i[0])) === false ? "" : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(), item_report: i[1] === undefined ? "" : String(i[1]).trim(),
...@@ -301,18 +301,18 @@ export default class CorporateAnnualTarget extends Component { ...@@ -301,18 +301,18 @@ export default class CorporateAnnualTarget extends Component {
status: '', status: '',
cat: payload cat: payload
} }
console.log(body) // console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0] }) this.setState({ payload: body, judul: resp.rows[1][0] })
} }
}); });
} }
checkUpload() { checkUpload() {
this.setState({ loading: true }) this.setState({ loading: true, dataTable: [] })
let dataDelete = this.state.dataDelete let dataDelete = this.state.dataDelete
api.create().getIdDeleteFromExcel(this.state.payload).then((response) => { api.create().getIdDeleteFromExcel(this.state.payload).then((response) => {
if (response.data) { if (response.data) {
// console.log(response.data) // // console.log(response.data)
let idDelete = response.data.data.item_report_id let idDelete = response.data.data.item_report_id
if (idDelete.length > 0) { if (idDelete.length > 0) {
idDelete.map((item, index) => { idDelete.map((item, index) => {
...@@ -322,10 +322,10 @@ export default class CorporateAnnualTarget extends Component { ...@@ -322,10 +322,10 @@ export default class CorporateAnnualTarget extends Component {
} }
} }
}) })
console.log(JSON.stringify(this.state.payload)) // console.log(JSON.stringify(this.state.payload))
api.create().checkUploadMB(this.state.payload).then(response => { api.create().checkUploadMB(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload)); // // console.log(JSON.stringify(this.state.payload));
console.log(response) // console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
// this.setState({ visibleUpload: false, visibleCAT: false }) // this.setState({ visibleUpload: false, visibleCAT: false })
...@@ -365,16 +365,16 @@ export default class CorporateAnnualTarget extends Component { ...@@ -365,16 +365,16 @@ export default class CorporateAnnualTarget extends Component {
item.error item.error
] ]
}) })
console.log(dataTable) // console.log(dataTable)
console.log(this.state.buttonError) // console.log(this.state.buttonError)
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[30].length > 0) { if (item[30].length > 0) {
console.log('masuk') // console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true }) this.setState({ buttonError: true, errorPreview: true, editable: true })
} }
}) })
// console.log(this.state.dataTable); // // console.log(this.state.dataTable);
}) })
} }
} }
...@@ -396,7 +396,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -396,7 +396,7 @@ export default class CorporateAnnualTarget extends Component {
functionUpload(type) { functionUpload(type) {
let data = [] let data = []
console.log(this.state.dataTable) // console.log(this.state.dataTable)
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
data.push({ data.push({
"item_report_id": i[1] == "" || i[1] == null ? 0 : i[1], "item_report_id": i[1] == "" || i[1] == null ? 0 : i[1],
...@@ -435,10 +435,10 @@ export default class CorporateAnnualTarget extends Component { ...@@ -435,10 +435,10 @@ export default class CorporateAnnualTarget extends Component {
"status": type, "status": type,
"cat": data "cat": data
} }
console.log(data); // console.log(data);
console.log(JSON.stringify(body)) // console.log(JSON.stringify(body))
api.create('UPLOAD').uploadMasterBudget(body).then(response => { api.create('UPLOAD').uploadMasterBudget(body).then(response => {
console.log(response); // console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.props.onClickClose() this.props.onClickClose()
...@@ -454,7 +454,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -454,7 +454,7 @@ export default class CorporateAnnualTarget extends Component {
handleValidate() { handleValidate() {
let data = [] let data = []
console.log(this.state.dataTable) // console.log(this.state.dataTable)
let totalWeight = 0 let totalWeight = 0
let dataTableBaru = this.state.dataTable let dataTableBaru = this.state.dataTable
let dataTampung = [] let dataTampung = []
...@@ -475,14 +475,14 @@ export default class CorporateAnnualTarget extends Component { ...@@ -475,14 +475,14 @@ export default class CorporateAnnualTarget extends Component {
if (i[2] !== null) { if (i[2] !== null) {
let indexID = this.state.dataTable.findIndex((val) => val[1] == i[2]) let indexID = this.state.dataTable.findIndex((val) => val[1] == i[2])
console.log(indexID) // console.log(indexID)
console.log(i[2]) // console.log(i[2])
if (indexID !== -1) { if (indexID !== -1) {
console.log(dataTableBaru[indexID][6]) // console.log(dataTableBaru[indexID][6])
if (dataTableBaru[indexID][6] == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || dataTableBaru[indexID][6] == 'CUSTOMER PERSPECTIVE') { if (dataTableBaru[indexID][6] == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || dataTableBaru[indexID][6] == 'CUSTOMER PERSPECTIVE') {
if (i[6] == "" || i[7] == "" || i[9] == null || i[10] == null || i[11] == null) { if (i[6] == "" || i[7] == "" || i[9] == null || i[10] == null || i[11] == null) {
handleKosongKPIMAXYTD = true handleKosongKPIMAXYTD = true
console.log(handleKosongKPIMAXYTD) // console.log(handleKosongKPIMAXYTD)
} }
} }
} }
...@@ -504,9 +504,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -504,9 +504,9 @@ export default class CorporateAnnualTarget extends Component {
weightReal = i[7] weightReal = i[7]
dataTampung[indexID].valChild = dataTampung[indexID].valChild + Number(i[7] == "" || i[7] == undefined ? 0 : i[7].replace('%', '')) dataTampung[indexID].valChild = dataTampung[indexID].valChild + Number(i[7] == "" || i[7] == undefined ? 0 : i[7].replace('%', ''))
} }
console.log(weightReal) // console.log(weightReal)
console.log(dataTableBaru[index][7]) // console.log(dataTableBaru[index][7])
console.log(dataTampung[indexID].valChild) // console.log(dataTampung[indexID].valChild)
} }
} }
...@@ -540,8 +540,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -540,8 +540,8 @@ export default class CorporateAnnualTarget extends Component {
}) })
}) })
console.log(dataTableBaru) // console.log(dataTableBaru)
console.log(JSON.stringify(data)) // console.log(JSON.stringify(data))
let payload = { let payload = {
"submission_id": this.props.submissionID, "submission_id": this.props.submissionID,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
...@@ -550,19 +550,19 @@ export default class CorporateAnnualTarget extends Component { ...@@ -550,19 +550,19 @@ export default class CorporateAnnualTarget extends Component {
"status": "submitted", "status": "submitted",
"cat": data "cat": data
} }
console.log(totalWeight) // console.log(totalWeight)
// this.setState({dataTable: dataTampung}) // this.setState({dataTable: dataTampung})
if (handleKosongKPIMAXYTD) { if (handleKosongKPIMAXYTD) {
this.setState({ alert: true, messageAlert: 'KPI / Weight / KPI Type / Max Ach / Formula YTD / Cannot be Empty', tipeAlert: 'warning', loading: false, buttonError: true, editable: true }) this.setState({ alert: true, messageAlert: 'KPI / Weight / KPI Type / Max Ach / Formula YTD / Cannot be Empty', tipeAlert: 'warning', loading: false, editable: true})
} else if (totalWeight < 100) { } else if (totalWeight < 100) {
this.setState({ alert: true, messageAlert: 'Total weight less than 100%', tipeAlert: 'warning', loading: false, buttonError: true, editable: true }) this.setState({ alert: true, messageAlert: 'Total weight less than 100%', tipeAlert: 'warning', loading: false, editable: true})
} else { } else {
api.create().validateSubmitReport(payload).then((response) => { api.create().validateSubmitReport(payload).then((response) => {
console.log(response) // console.log(response)
if (response.data.data.result) { if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: false }) this.setState({ loading: false, buttonError: false, editable: false, buttonDraft: false })
} else { } else {
this.setState({ loading: false, buttonError: true, editable: true }) this.setState({ loading: false, buttonError: true, editable: true, buttonDraft: true })
} }
}) })
} }
...@@ -574,9 +574,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -574,9 +574,9 @@ export default class CorporateAnnualTarget extends Component {
backToMasterBudget(type) { backToMasterBudget(type) {
let data = [] let data = []
console.log(this.state.dataTable) // console.log(this.state.dataTable)
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
// console.log(i[9] == null? "" : i[9].value) // // console.log(i[9] == null? "" : i[9].value)
data.push({ data.push({
"item_report_id": i[1] == "" ? null : i[1], "item_report_id": i[1] == "" ? null : i[1],
"item_name": String(i[6]), "item_name": String(i[6]),
...@@ -606,7 +606,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -606,7 +606,7 @@ export default class CorporateAnnualTarget extends Component {
"pic": String(i[29]) "pic": String(i[29])
}) })
}) })
console.log(JSON.stringify(data)) // console.log(JSON.stringify(data))
let payload = { let payload = {
"submission_id": this.props.submissionID, "submission_id": this.props.submissionID,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
...@@ -615,7 +615,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -615,7 +615,7 @@ export default class CorporateAnnualTarget extends Component {
"status": type, "status": type,
"cat": data "cat": data
} }
console.log(JSON.stringify(payload)); // console.log(JSON.stringify(payload));
this.deleteReport(payload) this.deleteReport(payload)
} }
...@@ -624,10 +624,10 @@ export default class CorporateAnnualTarget extends Component { ...@@ -624,10 +624,10 @@ export default class CorporateAnnualTarget extends Component {
if (this.state.dataDelete.length > 0) { if (this.state.dataDelete.length > 0) {
api.create().deleteAllItemReport(payload).then((response) => { api.create().deleteAllItemReport(payload).then((response) => {
console.log(response) // console.log(response)
// api.create().validateSubmitReport(payloadBro).then((response) => { // api.create().validateSubmitReport(payloadBro).then((response) => {
// console.log(response) // // console.log(response)
// if (response.data.data.result) { // if (response.data.data.result) {
this.props.saveToMasterBudget(payloadBro) this.props.saveToMasterBudget(payloadBro)
this.props.onClickClose() this.props.onClickClose()
...@@ -637,9 +637,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -637,9 +637,9 @@ export default class CorporateAnnualTarget extends Component {
// }) // })
}) })
} else { } else {
// console.log('sini jing') // // console.log('sini jing')
// api.create().validateSubmitReport(payloadBro).then((response) => { // api.create().validateSubmitReport(payloadBro).then((response) => {
// console.log(response) // // console.log(response)
// if (response.data.data.result) { // if (response.data.data.result) {
this.props.saveToMasterBudget(payloadBro) this.props.saveToMasterBudget(payloadBro)
this.props.onClickClose() this.props.onClickClose()
...@@ -658,12 +658,12 @@ export default class CorporateAnnualTarget extends Component { ...@@ -658,12 +658,12 @@ export default class CorporateAnnualTarget extends Component {
type: 'KPI_TYPE' type: 'KPI_TYPE'
} }
api.create().getAllSettingByType(body).then(response => { api.create().getAllSettingByType(body).then(response => {
// console.log(response) // // console.log(response)
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
let data = response.data.data let data = response.data.data
console.log(data) // console.log(data)
let inputKPI = [] let inputKPI = []
data.map((item) => { data.map((item) => {
...@@ -675,7 +675,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -675,7 +675,7 @@ export default class CorporateAnnualTarget extends Component {
options: inputKPI, options: inputKPI,
getOptionLabel: (option) => titleCase(option.value), getOptionLabel: (option) => titleCase(option.value),
}; };
console.log(defaultProps) // console.log(defaultProps)
this.setState({ kpiTypeList: defaultProps }) this.setState({ kpiTypeList: defaultProps })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
...@@ -779,7 +779,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -779,7 +779,7 @@ export default class CorporateAnnualTarget extends Component {
// }) // })
// let valz = dataTable2[tableMeta.rowIndex][11] == null ? 'SUM' : dataTable2[tableMeta.rowIndex][11].value // let valz = dataTable2[tableMeta.rowIndex][11] == null ? 'SUM' : dataTable2[tableMeta.rowIndex][11].value
// dataTable2[tableMeta.rowIndex][25] = (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz)) // dataTable2[tableMeta.rowIndex][25] = (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz))
// console.log(dataTable2[tableMeta.rowIndex]) // // console.log(dataTable2[tableMeta.rowIndex])
} }
const handleChangeDropdown = (value, tableMeta) => { const handleChangeDropdown = (value, tableMeta) => {
...@@ -808,9 +808,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -808,9 +808,9 @@ export default class CorporateAnnualTarget extends Component {
} else { } else {
index = data.findIndex((val) => val.value == value.value) index = data.findIndex((val) => val.value == value.value)
} }
console.log(value) // console.log(value)
console.log(data) // console.log(data)
console.log(index) // console.log(index)
if (index == -1) { if (index == -1) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = null dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = null
return null return null
...@@ -831,7 +831,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -831,7 +831,7 @@ export default class CorporateAnnualTarget extends Component {
// dataTable2.map((item, index) => { // dataTable2.map((item, index) => {
// if (item[2] == dataTable2[indexParentDatatable][1] && item[1] !== tableMeta.rowData[1]) { // if (item[2] == dataTable2[indexParentDatatable][1] && item[1] !== tableMeta.rowData[1]) {
// let weightItem = item[7] == "" ? 0 : item[7].replace('%', '') // let weightItem = item[7] == "" ? 0 : item[7].replace('%', '')
// console.log(weightItem) // // console.log(weightItem)
// valChild += Number(weightItem) // valChild += Number(weightItem)
// } // }
// }) // })
...@@ -839,19 +839,19 @@ export default class CorporateAnnualTarget extends Component { ...@@ -839,19 +839,19 @@ export default class CorporateAnnualTarget extends Component {
// let endVal = '' // let endVal = ''
// if ((Number(valueReal) + Number(valChild)) > Number(valParent.replace('%', ''))) { // if ((Number(valueReal) + Number(valChild)) > Number(valParent.replace('%', ''))) {
// endVal = `${Number(valParent.replace('%', '')) - (Number(valChild))}%` // endVal = `${Number(valParent.replace('%', '')) - (Number(valChild))}%`
// console.log(endVal) // // console.log(endVal)
// } else { // } else {
// endVal = `${Number(valueReal)}%` // endVal = `${Number(valueReal)}%`
// console.log(endVal)
// }
// // console.log(endVal) // // console.log(endVal)
// }
// // // console.log(endVal)
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = endVal // dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = endVal
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
} }
const handleChangeText = (value, tableMeta) => { const handleChangeText = (value, tableMeta) => {
console.log(value) // console.log(value)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
// this.setState({dataTable: dataTable2}) // this.setState({dataTable: dataTable2})
} }
...@@ -881,7 +881,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -881,7 +881,7 @@ export default class CorporateAnnualTarget extends Component {
} }
const handleTambah = (data, rowIndex) => { const handleTambah = (data, rowIndex) => {
console.log(dataTable2) // console.log(dataTable2)
let newData = [] let newData = []
dataTable2.map((item, index) => { dataTable2.map((item, index) => {
newData.push(item) newData.push(item)
...@@ -1007,7 +1007,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1007,7 +1007,7 @@ export default class CorporateAnnualTarget extends Component {
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
}} }}
// onClick={() => console.log(tableMeta.rowData[1])} // onClick={() => // console.log(tableMeta.rowData[1])}
onClick={() => { onClick={() => {
this.setState({ loading: true }) this.setState({ loading: true })
handleTambah(tableMeta.rowData[1], tableMeta.rowIndex) handleTambah(tableMeta.rowData[1], tableMeta.rowIndex)
...@@ -1063,9 +1063,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1063,9 +1063,9 @@ export default class CorporateAnnualTarget extends Component {
defaultValue={val} defaultValue={val}
// disabled={!handleAction(tableMeta.rowData[2])} // disabled={!handleAction(tableMeta.rowData[2])}
onBlur={(event) => { onBlur={(event) => {
console.log(event.target.value) // console.log(event.target.value)
handleChangeText(event.target.value, tableMeta) handleChangeText(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1180,10 +1180,10 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1180,10 +1180,10 @@ export default class CorporateAnnualTarget extends Component {
color={"#5198ea"} color={"#5198ea"}
disabled={true} disabled={true}
onBlur={(event) => { onBlur={(event) => {
console.log(event.target.value) // console.log(event.target.value)
// updateValue(event.target.value) // updateValue(event.target.value)
handleChangeText(event.target.value, tableMeta) handleChangeText(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> : /> :
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
...@@ -1196,10 +1196,10 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1196,10 +1196,10 @@ export default class CorporateAnnualTarget extends Component {
color={"#5198ea"} color={"#5198ea"}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false ? false : !handleAction(tableMeta.rowData[2]))} // disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false ? false : !handleAction(tableMeta.rowData[2]))}
onBlur={(event) => { onBlur={(event) => {
console.log(event.target.value) // console.log(event.target.value)
// updateValue(event.target.value) // updateValue(event.target.value)
handleChangeText(event.target.value, tableMeta) handleChangeText(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
</ThemeProvider> </ThemeProvider>
...@@ -1346,7 +1346,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1346,7 +1346,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1387,7 +1387,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1387,7 +1387,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1428,7 +1428,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1428,7 +1428,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1469,7 +1469,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1469,7 +1469,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1510,7 +1510,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1510,7 +1510,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1551,7 +1551,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1551,7 +1551,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1592,7 +1592,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1592,7 +1592,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1633,7 +1633,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1633,7 +1633,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1674,7 +1674,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1674,7 +1674,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1715,7 +1715,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1715,7 +1715,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1756,7 +1756,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1756,7 +1756,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1797,7 +1797,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1797,7 +1797,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1838,7 +1838,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1838,7 +1838,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1877,7 +1877,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1877,7 +1877,7 @@ export default class CorporateAnnualTarget extends Component {
// onBlur={(event) => { // onBlur={(event) => {
// // updateValue(event.target.value) // // updateValue(event.target.value)
// handleChange(event.target.value, tableMeta) // handleChange(event.target.value, tableMeta)
// console.log(dataTable2) // // console.log(dataTable2)
// }} // }}
/> />
} }
...@@ -1917,7 +1917,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1917,7 +1917,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1958,7 +1958,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1958,7 +1958,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -1994,9 +1994,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1994,9 +1994,9 @@ export default class CorporateAnnualTarget extends Component {
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.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)}
defaultValue={value} defaultValue={value}
onBlur={(event) => { onBlur={(event) => {
console.log(event.target.value) // console.log(event.target.value)
handleChangeText(event.target.value, tableMeta) handleChangeText(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
</ThemeProvider> </ThemeProvider>
...@@ -2034,10 +2034,10 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2034,10 +2034,10 @@ export default class CorporateAnnualTarget extends Component {
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.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)}
defaultValue={value} defaultValue={value}
onBlur={(event) => { onBlur={(event) => {
console.log(event.target.value) // console.log(event.target.value)
// updateValue(event.target.value) // updateValue(event.target.value)
handleChangeText(event.target.value, tableMeta) handleChangeText(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
</ThemeProvider> </ThemeProvider>
...@@ -2068,7 +2068,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2068,7 +2068,7 @@ export default class CorporateAnnualTarget extends Component {
<Typography style={{ fontSize: '16px', color: 'white' }}>Master Budget Submission</Typography> <Typography style={{ fontSize: '16px', color: 'white' }}>Master Budget Submission</Typography>
</div> </div>
{/* {this.state.loading && loadingComponent} */} {/* {this.state.loading && loadingComponent} */}
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}> <Snackbar open={this.state.alert} autoHideDuration={3000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}> <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert} {this.state.messageAlert}
</Alert> </Alert>
...@@ -2131,7 +2131,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2131,7 +2131,7 @@ export default class CorporateAnnualTarget extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => this.setState({ visibleUpload: true })} onClick={() => this.setState({ visibleUpload: true, buttonDraft: true })}
> >
<img src={Images.upload} /> <img src={Images.upload} />
</button> </button>
...@@ -2231,7 +2231,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2231,7 +2231,7 @@ export default class CorporateAnnualTarget extends Component {
disabled={this.state.buttonDraft} disabled={this.state.buttonDraft}
onClick={() => onClick={() =>
this.state.editable === true ? this.state.editable === true ?
null : this.setState({alert: true}) :
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => { this.setState({ handleTekTekTek: 1 }, () => {
this.backToMasterBudget('draft') this.backToMasterBudget('draft')
...@@ -2244,8 +2244,10 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2244,8 +2244,10 @@ export default class CorporateAnnualTarget extends Component {
</button>} </button>}
{((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')) && <button {((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')) && <button
type="button" type="button"
// disabled={this.state.buttonError} disabled={this.state.buttonDraft}
onClick={() => this.state.buttonError ? onClick={() =>
this.state.editable? this.setState({alert: true}) :
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
: :
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
...@@ -2299,7 +2301,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2299,7 +2301,7 @@ export default class CorporateAnnualTarget extends Component {
borderColor: 'transparent', borderColor: 'transparent',
}} }}
onClick={() => onClick={() =>
this.setState({ loading: true, visibleCAT: true }, () => { this.setState({ loading: true, visibleCAT: true, dataTable: []}, () => {
setTimeout(() => { setTimeout(() => {
this.getItemHierarki() this.getItemHierarki()
}, 100) }, 100)
...@@ -2317,7 +2319,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2317,7 +2319,7 @@ export default class CorporateAnnualTarget extends Component {
this.setState({ loading: true, dataTable: dataTable2, buttonDraft: false }, () => { this.setState({ loading: true, dataTable: dataTable2, buttonDraft: false }, () => {
setTimeout(() => { setTimeout(() => {
this.handleValidate() this.handleValidate()
this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false }) this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false})
}, 100) }, 100)
}) })
} }
...@@ -2338,8 +2340,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2338,8 +2340,8 @@ export default class CorporateAnnualTarget extends Component {
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => this.state.editable === true ? onClick={() => this.state.editable?
null : this.setState({ loading: true }, () => this.setState({alert: true}) : this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => { this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => { setTimeout(() => {
...@@ -2363,8 +2365,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2363,8 +2365,9 @@ export default class CorporateAnnualTarget extends Component {
}} }}
disabled={this.state.buttonDraft} disabled={this.state.buttonDraft}
onClick={() => onClick={() =>
this.state.editable === true ? this.state.editable? this.setState({alert: true}) :
null : this.setState({ loading: true }, () => this.state.buttonError === true ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) : this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => { this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => { setTimeout(() => {
......
...@@ -311,18 +311,18 @@ export default class FixedAssetsMovement extends Component { ...@@ -311,18 +311,18 @@ export default class FixedAssetsMovement extends Component {
item.level, item.level,
item.item_report, item.item_report,
item.total_actual_before, item.total_actual_before,
item.january, item.type_report_id == 5 || item.type_report_id == 6? {value: item.january, formula: item.january_formula} : item.january,
item.february, item.type_report_id == 5 || item.type_report_id == 6? {value: item.february, formula: item.february_formula} : item.february,
item.march, item.type_report_id == 5 || item.type_report_id == 6? {value: item.march, formula: item.march_formula} : item.march,
item.april, item.type_report_id == 5 || item.type_report_id == 6? {value: item.april, formula: item.april_formula} : item.april,
item.may, item.type_report_id == 5 || item.type_report_id == 6? {value: item.may, formula: item.may_formula} : item.may,
item.june, item.type_report_id == 5 || item.type_report_id == 6? {value: item.june, formula: item.june_formula} : item.june,
item.july, item.type_report_id == 5 || item.type_report_id == 6? {value: item.july, formula: item.july_formula} : item.july,
item.august, item.type_report_id == 5 || item.type_report_id == 6? {value: item.august, formula: item.august_formula} : item.august,
item.september, item.type_report_id == 5 || item.type_report_id == 6? {value: item.september, formula: item.september_formula} : item.september,
item.october, item.type_report_id == 5 || item.type_report_id == 6? {value: item.october, formula: item.october_formula} : item.october,
item.november, item.type_report_id == 5 || item.type_report_id == 6? {value: item.november, formula: item.november_formula} : item.november,
item.december, item.type_report_id == 5 || item.type_report_id == 6? {value: item.december, formula: item.december_formula} : item.december,
item.total_current_year, item.total_current_year,
item.total_next_year, item.total_next_year,
item.total_more_year, item.total_more_year,
...@@ -542,11 +542,11 @@ export default class FixedAssetsMovement extends Component { ...@@ -542,11 +542,11 @@ export default class FixedAssetsMovement extends Component {
} }
} }
}) })
console.log(dataTable2[tableMeta.rowIndex][22]) // console.log(dataTable2[tableMeta.rowIndex][22])
console.log(tableMeta.rowData[5]) // console.log(tableMeta.rowData[5])
console.log(baru) // console.log(baru)
console.log(anjay) // console.log(anjay)
console.log(total) // console.log(total)
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) { if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
// console.log([tableMeta.rowIndex][tableMeta.columnIndex]) // console.log([tableMeta.rowIndex][tableMeta.columnIndex])
......
...@@ -694,6 +694,7 @@ export default class BalanceSheet extends Component { ...@@ -694,6 +694,7 @@ export default class BalanceSheet extends Component {
placeholder="" placeholder=""
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
decimalScale={1} decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -735,6 +736,7 @@ export default class BalanceSheet extends Component { ...@@ -735,6 +736,7 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
disabled={!this.props.permission.create || !this.props.permission.edit}
decimalScale={1} decimalScale={1}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -775,6 +777,7 @@ export default class BalanceSheet extends Component { ...@@ -775,6 +777,7 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={!this.props.permission.create || !this.props.permission.edit}
decimalScale={1} decimalScale={1}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
...@@ -816,6 +819,7 @@ export default class BalanceSheet extends Component { ...@@ -816,6 +819,7 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={!this.props.permission.create || !this.props.permission.edit}
decimalScale={1} decimalScale={1}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
...@@ -858,6 +862,7 @@ export default class BalanceSheet extends Component { ...@@ -858,6 +862,7 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
decimalScale={1} decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -898,6 +903,7 @@ export default class BalanceSheet extends Component { ...@@ -898,6 +903,7 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={!this.props.permission.create || !this.props.permission.edit}
decimalScale={1} decimalScale={1}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
...@@ -940,6 +946,7 @@ export default class BalanceSheet extends Component { ...@@ -940,6 +946,7 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
decimalScale={1} decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -981,6 +988,7 @@ export default class BalanceSheet extends Component { ...@@ -981,6 +988,7 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
decimalScale={1} decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1022,6 +1030,7 @@ export default class BalanceSheet extends Component { ...@@ -1022,6 +1030,7 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
decimalScale={1} decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1063,6 +1072,7 @@ export default class BalanceSheet extends Component { ...@@ -1063,6 +1072,7 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
decimalScale={1} decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1104,6 +1114,7 @@ export default class BalanceSheet extends Component { ...@@ -1104,6 +1114,7 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
decimalScale={1} decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1145,6 +1156,7 @@ export default class BalanceSheet extends Component { ...@@ -1145,6 +1156,7 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
decimalScale={1} decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1186,6 +1198,7 @@ export default class BalanceSheet extends Component { ...@@ -1186,6 +1198,7 @@ export default class BalanceSheet extends Component {
type="text" type="text"
placeholder="" placeholder=""
decimalScale={1} decimalScale={1}
disabled={!this.props.permission.create || !this.props.permission.edit}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1245,7 +1258,7 @@ export default class BalanceSheet extends Component { ...@@ -1245,7 +1258,7 @@ export default class BalanceSheet extends Component {
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
{(this.props.permission.create && this.props.permission.edit) && <a data-tip={'Download Template'} data-for="template"> {(this.props.permission.create || this.props.permission.edit) && <a data-tip={'Download Template'} data-for="template">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -1259,7 +1272,7 @@ export default class BalanceSheet extends Component { ...@@ -1259,7 +1272,7 @@ export default class BalanceSheet extends Component {
</button> </button>
</a>} </a>}
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
{(this.props.permission.create && this.props.permission.edit) && <a data-tip={'Upload'} data-for="upload"> {(this.props.permission.create || this.props.permission.edit) && <a data-tip={'Upload'} data-for="upload">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -1267,7 +1280,7 @@ export default class BalanceSheet extends Component { ...@@ -1267,7 +1280,7 @@ export default class BalanceSheet extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => this.setState({ visibleUpload: true })} onClick={() => this.setState({ visibleUpload: true, editable: true })}
> >
<img src={Images.upload} /> <img src={Images.upload} />
</button> </button>
...@@ -1324,7 +1337,7 @@ export default class BalanceSheet extends Component { ...@@ -1324,7 +1337,7 @@ export default class BalanceSheet extends Component {
</div> </div>
</button> </button>
</div> </div>
{!this.state.emptyData && (this.props.permission.create && this.props.permission.edit) && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> {!this.state.emptyData && (this.props.permission.create || this.props.permission.edit) && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button <button
type="button" type="button"
onClick={() => onClick={() =>
...@@ -1454,6 +1467,7 @@ export default class BalanceSheet extends Component { ...@@ -1454,6 +1467,7 @@ export default class BalanceSheet extends Component {
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
disabled={this.state.editable}
onClick={() => onClick={() =>
this.state.editable === true ? this.state.editable === true ?
null : this.setState({ loading: true }, () => { null : this.setState({ loading: true }, () => {
...@@ -1476,6 +1490,7 @@ export default class BalanceSheet extends Component { ...@@ -1476,6 +1490,7 @@ export default class BalanceSheet extends Component {
this.uploadOI("submitted") this.uploadOI("submitted")
}, 100); }, 100);
})} })}
disabled={this.state.editable}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.editable === true ? 'default' : 'pointer', cursor: this.state.editable === true ? 'default' : 'pointer',
......
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