Commit 81aff5b2 authored by Riri Novita's avatar Riri Novita

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into riri

parents 5a0ab914 6daeda8b
...@@ -70,7 +70,8 @@ export default class BudgetTahunan extends Component { ...@@ -70,7 +70,8 @@ export default class BudgetTahunan extends Component {
isAdmin: false, isAdmin: false,
btncreate: false, btncreate: false,
loadview: false, loadview: false,
permissionhandle: false permissionhandle: false,
userType: ''
} }
this.myRef = React.createRef() this.myRef = React.createRef()
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -84,7 +85,7 @@ export default class BudgetTahunan extends Component { ...@@ -84,7 +85,7 @@ export default class BudgetTahunan extends Component {
}) })
this.props.selectIndex('Master Budget & CAT') this.props.selectIndex('Master Budget & CAT')
if (this.props.location.state !== undefined) { 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.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.getPermission()
// this.checkApprover() // this.checkApprover()
...@@ -100,7 +101,7 @@ export default class BudgetTahunan extends Component { ...@@ -100,7 +101,7 @@ export default class BudgetTahunan extends Component {
menu: "Master Budget & CAT" menu: "Master Budget & CAT"
} }
api.create().getPermission(payload).then(response => { api.create().getPermission(payload).then(response => {
console.log(response) // console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
...@@ -133,7 +134,7 @@ export default class BudgetTahunan extends Component { ...@@ -133,7 +134,7 @@ export default class BudgetTahunan extends Component {
if (response.ok) { if (response.ok) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
// this.setState({ tempData: response.data.data, privileges: response.data.data.privileges }) // 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') { if (String(response.data.data.role_name).toLocaleLowerCase() == 'superadmin') {
this.setState({ isAdmin: true }) this.setState({ isAdmin: true })
} }
...@@ -162,10 +163,10 @@ export default class BudgetTahunan extends Component { ...@@ -162,10 +163,10 @@ export default class BudgetTahunan extends Component {
checkApprover() { checkApprover() {
api.create().checkApprover().then(response => { api.create().checkApprover().then(response => {
console.log(response.data.data) // console.log(response.data.data)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
// // console.log(response); // // // console.log(response);
if (response.data.data.is_approver === true) { if (response.data.data.is_approver === true) {
this.setState({ isApprover: true, permissionhandle: true, checkApprover: true }, () => this.setState({ isApprover: true, permissionhandle: true, checkApprover: true }, () =>
{ {
...@@ -196,7 +197,7 @@ export default class BudgetTahunan extends Component { ...@@ -196,7 +197,7 @@ export default class BudgetTahunan extends Component {
"periode": this.state.periode.periode "periode": this.state.periode.periode
} }
api.create().getCompanySubmitted(body).then(response => { api.create().getCompanySubmitted(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') {
if (response.data.data.length > 0) { if (response.data.data.length > 0) {
...@@ -218,7 +219,7 @@ export default class BudgetTahunan extends Component { ...@@ -218,7 +219,7 @@ export default class BudgetTahunan extends Component {
} }
this.setState({ listCompany: defaultProps, company: indexID == null ? companyData[0] : companyData[indexID] }, () => { 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) { if (response.data.data.length > 0) {
this.getRevision() this.getRevision()
} else { } else {
...@@ -254,13 +255,13 @@ export default class BudgetTahunan extends Component { ...@@ -254,13 +255,13 @@ export default class BudgetTahunan extends Component {
"revision": this.state.revision.revision, "revision": this.state.revision.revision,
} }
api.create().getMasterBudgetAtt(payload).then(response => { api.create().getMasterBudgetAtt(payload).then(response => {
// // console.log(response) // // // console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ listAttachment: response.data.data }) this.setState({ listAttachment: response.data.data })
} }
} }
// // console.log(response); // // // console.log(response);
}) })
} }
...@@ -271,7 +272,7 @@ export default class BudgetTahunan extends Component { ...@@ -271,7 +272,7 @@ export default class BudgetTahunan extends Component {
"report_type": "Master Budget", "report_type": "Master Budget",
} }
api.create().getReportTypeBody(payload).then(response => { api.create().getReportTypeBody(payload).then(response => {
// console.log(response); // // console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
let dataTable = response.data.data.map((item, index) => { let dataTable = response.data.data.map((item, index) => {
...@@ -296,7 +297,7 @@ export default class BudgetTahunan extends Component { ...@@ -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 }, () => { this.setState({ dataTable, loading: false, dataTableRevision: dataTableRevision.sort((a, b) => a.number - b.number), dataForRevision: response.data.data }, () => {
document.body.style.overflow = 'unset'; document.body.style.overflow = 'unset';
}) })
...@@ -315,7 +316,7 @@ export default class BudgetTahunan extends Component { ...@@ -315,7 +316,7 @@ export default class BudgetTahunan extends Component {
"periode": this.state.periode.periode "periode": this.state.periode.periode
} }
api.create().getSubmitMasterBudget(body).then(response => { api.create().getSubmitMasterBudget(body).then(response => {
// // console.log(response); // // // console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ isSubmit: response.data.data.is_can_submit }, () => { this.setState({ isSubmit: response.data.data.is_can_submit }, () => {
...@@ -345,7 +346,7 @@ export default class BudgetTahunan extends Component { ...@@ -345,7 +346,7 @@ export default class BudgetTahunan extends Component {
getCompanyActive() { getCompanyActive() {
api.create().getPerusahaanActive().then((response) => { api.create().getPerusahaanActive().then((response) => {
// // console.log(response); // // // console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
let data = response.data.data let data = response.data.data
...@@ -393,7 +394,7 @@ export default class BudgetTahunan extends Component { ...@@ -393,7 +394,7 @@ export default class BudgetTahunan extends Component {
api.create().getLastPeriod(this.state.company.company_id).then(response => { api.create().getLastPeriod(this.state.company.company_id).then(response => {
// // console.log(response); // // console.log(response);
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ lastPeriod: response.data.data.last_periode, latestPeriode: response.data.data.latest_periode }, () => { this.setState({ lastPeriod: this.state.userType !== ''? this.state.lastPeriod : response.data.data.last_periode, latestPeriode: response.data.data.latest_periode }, () => {
this.getPeriode() this.getPeriode()
}) })
} }
...@@ -405,7 +406,7 @@ export default class BudgetTahunan extends Component { ...@@ -405,7 +406,7 @@ export default class BudgetTahunan extends Component {
// let dateNow = new Date // let dateNow = new Date
// let year = this.state.rawData ? this.state.rawData.periode : format(dateNow, 'yyyy') // let year = this.state.rawData ? this.state.rawData.periode : format(dateNow, 'yyyy')
let currentYear = new Date().getFullYear() let currentYear = new Date().getFullYear()
// // console.log(currentYear) // // // console.log(currentYear)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
let data = [] let data = []
...@@ -431,10 +432,10 @@ export default class BudgetTahunan extends Component { ...@@ -431,10 +432,10 @@ export default class BudgetTahunan extends Component {
}; };
let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod) let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod)
let index = data.sort((a, b) => a - b).findIndex((val) => val === periode) let index = data.sort((a, b) => a - b).findIndex((val) => val === periode)
// // console.log(data) // // console.log(this.props.location.state.rawData)
// // console.log(this.state.latestPeriode) // console.log(this.state.lastPeriod)
// // console.log(periodeData) // console.log(periodeData)
// // console.log(index) // // // console.log(index)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => { this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
if (this.state.isApprover === true) { if (this.state.isApprover === true) {
this.getCompanySubmitted() this.getCompanySubmitted()
...@@ -453,7 +454,7 @@ export default class BudgetTahunan extends Component { ...@@ -453,7 +454,7 @@ export default class BudgetTahunan extends Component {
"periode": this.state.periode.periode "periode": this.state.periode.periode
} }
api.create().getRevision(payload).then(response => { api.create().getRevision(payload).then(response => {
// // console.log(response); // // // console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
let data = response.data.data let data = response.data.data
...@@ -495,7 +496,7 @@ export default class BudgetTahunan extends Component { ...@@ -495,7 +496,7 @@ export default class BudgetTahunan extends Component {
"is_approver": this.state.permissionhandle? this.state.permissionhandle : this.state.isApprover "is_approver": this.state.permissionhandle? this.state.permissionhandle : this.state.isApprover
} }
api.create().getSubmission(payload).then(response => { api.create().getSubmission(payload).then(response => {
console.log(response) // console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
...@@ -507,13 +508,13 @@ export default class BudgetTahunan extends Component { ...@@ -507,13 +508,13 @@ export default class BudgetTahunan extends Component {
btnApprove: response.data.data.is_submit, btnApprove: response.data.data.is_submit,
// loading: false // loading: false
}, () => { }, () => {
// console.log(response.data.data.is_submit); // // console.log(response.data.data.is_submit);
// console.log(this.state.btnApprove) // // console.log(this.state.btnApprove)
this.historyApproval() this.historyApproval()
this.getLatestPeriodSubmit() this.getLatestPeriodSubmit()
api.create().checkApprover().then(response => { api.create().checkApprover().then(response => {
// console.log(this.state.btncreate); // // console.log(this.state.btncreate);
// console.log(this.state.btnedit) // // console.log(this.state.btnedit)
if (this.state.btncreate === true && this.state.btnedit === true) { if (this.state.btncreate === true && this.state.btnedit === true) {
this.setState({ isApprover: false }, () => { this.setState({ isApprover: false }, () => {
if (response.data.data.is_approver === true) { if (response.data.data.is_approver === true) {
...@@ -557,7 +558,7 @@ export default class BudgetTahunan extends Component { ...@@ -557,7 +558,7 @@ export default class BudgetTahunan extends Component {
"periode": this.state.periode.periode "periode": this.state.periode.periode
} }
api.create().historyApproval(body).then(response => { api.create().historyApproval(body).then(response => {
// // console.log(response); // // // console.log(response);
if (response.data.data.length > 0) { if (response.data.data.length > 0) {
let dataTableHistory = response.data.data.map(item => { let dataTableHistory = response.data.data.map(item => {
return [ return [
...@@ -589,11 +590,11 @@ export default class BudgetTahunan extends Component { ...@@ -589,11 +590,11 @@ export default class BudgetTahunan extends Component {
"min_periode": moment(this.state.minDateRevision).format('YYYY-MM-DD'), "min_periode": moment(this.state.minDateRevision).format('YYYY-MM-DD'),
"max_periode": moment(this.state.maxDateRevision).format('YYYY-MM-DD') "max_periode": moment(this.state.maxDateRevision).format('YYYY-MM-DD')
} }
// // console.log(payload) // // // console.log(payload)
// console.log(this.props.location); // // console.log(this.props.location);
// console.log(body) // // console.log(body)
api.create().approvalSubmission(body).then((res) => { api.create().approvalSubmission(body).then((res) => {
// // console.log(res) // // // console.log(res)
// this.setState({ loading: false }, () => { // this.setState({ loading: false }, () => {
// }) // })
if (type == 'revision') { if (type == 'revision') {
...@@ -610,7 +611,7 @@ export default class BudgetTahunan extends Component { ...@@ -610,7 +611,7 @@ export default class BudgetTahunan extends Component {
} else { } else {
items = item items = item
} }
// // console.log(this.state.dataForRevision); // // // console.log(this.state.dataForRevision);
this.state.dataForRevision.map(i => { this.state.dataForRevision.map(i => {
if (i.report_name === items) { if (i.report_name === items) {
if (i.revision !== revision) { if (i.revision !== revision) {
...@@ -697,9 +698,9 @@ export default class BudgetTahunan extends Component { ...@@ -697,9 +698,9 @@ export default class BudgetTahunan 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 {
const formData = new FormData(); const formData = new FormData();
...@@ -726,7 +727,7 @@ export default class BudgetTahunan extends Component { ...@@ -726,7 +727,7 @@ export default class BudgetTahunan extends Component {
deleteAttachment(item) { deleteAttachment(item) {
api.create().deleteAttachment(item.attachment_id).then(response => { api.create().deleteAttachment(item.attachment_id).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.getSubmission() this.getSubmission()
...@@ -743,7 +744,7 @@ export default class BudgetTahunan extends Component { ...@@ -743,7 +744,7 @@ export default class BudgetTahunan extends Component {
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
document.body.style.overflow = 'hidden'; document.body.style.overflow = 'hidden';
}) })
// // console.log(JSON.stringify(data)); // // // console.log(JSON.stringify(data));
api.create('UPLOAD').createSubmitReport(data).then(response => { api.create('UPLOAD').createSubmitReport(data).then(response => {
if (response.data) { if (response.data) {
...@@ -774,9 +775,9 @@ export default class BudgetTahunan extends Component { ...@@ -774,9 +775,9 @@ export default class BudgetTahunan extends Component {
async downloadAttachment(fileurl, name) { async downloadAttachment(fileurl, name) {
let length = name.split(".").length let length = name.split(".").length
let fileType = name.split(".")[length - 1] 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}` 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( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/download_attachment?fileName=${fileurl}&&fileType=${fileType}` `${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 { ...@@ -817,7 +818,7 @@ export default class BudgetTahunan extends Component {
submission_id: this.state.submissionID submission_id: this.state.submissionID
} }
api.create().submitMasterBudget(body).then(response => { api.create().submitMasterBudget(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.getSubmission() this.getSubmission()
...@@ -830,9 +831,9 @@ export default class BudgetTahunan extends Component { ...@@ -830,9 +831,9 @@ export default class BudgetTahunan extends Component {
}) })
} }
// if (array.includes("not-yet" || "draft")) { // if (array.includes("not-yet" || "draft")) {
// // console.log('gagal'); // // // console.log('gagal');
// } else { // } else {
// // console.log('masuk'); // // // console.log('masuk');
// } // }
} }
...@@ -846,7 +847,7 @@ export default class BudgetTahunan extends Component { ...@@ -846,7 +847,7 @@ export default class BudgetTahunan extends Component {
remarksKosong += 1 remarksKosong += 1
} }
}) })
// console.log(arrayRevisi) // // console.log(arrayRevisi)
if (arrayRevisi.length == 0 || remarksKosong > 0) { if (arrayRevisi.length == 0 || remarksKosong > 0) {
this.setState({ alert: true, messageAlert: 'Remarks Cannot be Empty', tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: 'Remarks Cannot be Empty', tipeAlert: 'error' })
} else { } else {
...@@ -877,7 +878,7 @@ export default class BudgetTahunan extends Component { ...@@ -877,7 +878,7 @@ export default class BudgetTahunan extends Component {
<Select <Select
value={val} value={val}
onChange={event => { onChange={event => {
// // console.log(event.target) // // // console.log(event.target)
updateValue(event.target.value) updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta) this.handleChange(event.target.value, tableMeta)
}} }}
...@@ -1005,10 +1006,10 @@ export default class BudgetTahunan extends Component { ...@@ -1005,10 +1006,10 @@ export default class BudgetTahunan extends Component {
defaultValue={value} defaultValue={value}
color={"#5198ea"} color={"#5198ea"}
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)
}} }}
/>} />}
/> />
...@@ -1044,7 +1045,7 @@ export default class BudgetTahunan extends Component { ...@@ -1044,7 +1045,7 @@ export default class BudgetTahunan extends Component {
} }
let indexDataRevisi = this.state.dataTableRevision.findIndex((val) => val[3] == value[3]) 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]) 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) { if (indexId == -1) {
this.state.dataTableRevision.map((item, index) => { this.state.dataTableRevision.map((item, index) => {
if (index > indexDataRevisi) { if (index > indexDataRevisi) {
...@@ -1081,7 +1082,7 @@ export default class BudgetTahunan extends Component { ...@@ -1081,7 +1082,7 @@ export default class BudgetTahunan extends Component {
} }
} }
this.setState({ detailRevisiCheck: detailRevisiCheck.sort((a, b) => a.number - b.number) }) this.setState({ detailRevisiCheck: detailRevisiCheck.sort((a, b) => a.number - b.number) })
// console.log(detailRevisiCheck) // // console.log(detailRevisiCheck)
} }
const options = { const options = {
......
...@@ -53,7 +53,8 @@ export default class BalanceSheetMR extends Component { ...@@ -53,7 +53,8 @@ export default class BalanceSheetMR extends Component {
updateBy: '-', updateBy: '-',
notes: "", notes: "",
judulColumn: null, judulColumn: null,
get_for: "view" get_for: "view",
kansas: 0
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -493,10 +494,12 @@ export default class BalanceSheetMR extends Component { ...@@ -493,10 +494,12 @@ export default class BalanceSheetMR extends Component {
handleValidate() { handleValidate() {
let data = [] let data = []
let err = false let err = false
let errorContrl = this.state.buttonError let errorContrl = false
let editAble = this.state.editAble let editAble = this.state.editAble
console.log(this.state.dataTable) let dataTable = this.state.dataTable
this.state.dataTable.map((i, index) => { let kansas = this.state.kansas
console.log(dataTable[dataTable.length-1])
dataTable.map((i, index) => {
if(i[0] === 3) { if(i[0] === 3) {
// console.log(i); // console.log(i);
if ( i[17] === "" && (Number(i[12]) < this.state.minValue || Number(i[12]) > this.state.maxValue)) { if ( i[17] === "" && (Number(i[12]) < this.state.minValue || Number(i[12]) > this.state.maxValue)) {
...@@ -513,15 +516,10 @@ export default class BalanceSheetMR extends Component { ...@@ -513,15 +516,10 @@ export default class BalanceSheetMR extends Component {
} }
if (String(i[5]) == "Control (should be nil)") { if (String(i[5]) == "Control (should be nil)") {
i.map((j, indexj) => { if (Number(i[9]) < this.state.minValue || Number(i[9]) > this.state.maxValue ) {
if (indexj >= 6 && indexj <= 16) { errorContrl = true
if (Number(j) < this.state.minValue || Number(j) > this.state.maxValue ) { editAble = true
console.log("masuk error") }
errorContrl = true
editAble = true
}
}
})
} }
data.push({ data.push({
...@@ -584,8 +582,22 @@ export default class BalanceSheetMR extends Component { ...@@ -584,8 +582,22 @@ export default class BalanceSheetMR extends Component {
if (response.data.status === "success") { if (response.data.status === "success") {
if (response.data.data.result && err === false && errorContrl === false ) { if (response.data.data.result && err === false && errorContrl === false ) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: 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 { } else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false }) 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 { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
...@@ -614,10 +626,10 @@ export default class BalanceSheetMR extends Component { ...@@ -614,10 +626,10 @@ export default class BalanceSheetMR extends Component {
// console.log(dataTable2[tableMeta.rowIndex]); // console.log(dataTable2[tableMeta.rowIndex]);
} }
const handleChange = (value, tableMeta, type) => { const handleChange = (value, tableMeta, type) => {
console.log(dataTable2);
let val = String(value).split(",").join("") let val = String(value).split(",").join("")
if (type === "actual") { if (type === "actual") {
dataTable2[tableMeta.rowIndex][9] = Number(val).toFixed(1) dataTable2[tableMeta.rowIndex][9] = Number(val).toFixed(1)
console.log(dataTable2);
} else { } else {
let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[tableMeta.rowIndex][2]) let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[tableMeta.rowIndex][2])
if (indexParent > 0) { if (indexParent > 0) {
...@@ -635,6 +647,7 @@ export default class BalanceSheetMR extends Component { ...@@ -635,6 +647,7 @@ export default class BalanceSheetMR extends Component {
dataTable2[tableMeta.rowIndex][9] = Number(val).toFixed(1) dataTable2[tableMeta.rowIndex][9] = Number(val).toFixed(1)
} }
} }
console.log(dataTable2);
} }
const handleValue = (data, type) => { const handleValue = (data, type) => {
...@@ -1105,7 +1118,7 @@ export default class BalanceSheetMR extends Component { ...@@ -1105,7 +1118,7 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
null : null :
this.state.get_for == 'view'? // this.state.get_for == 'view'?
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
...@@ -1114,35 +1127,35 @@ export default class BalanceSheetMR extends Component { ...@@ -1114,35 +1127,35 @@ export default class BalanceSheetMR extends Component {
disabled={true} disabled={true}
value={Number(tableMeta.rowData[7]).toFixed(1)} value={Number(tableMeta.rowData[7]).toFixed(1)}
/> />
: // :
tableMeta.rowData[0] === 2 ? // tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}> // <span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(handleValue(tableMeta, 0)).toFixed(1)} // value={Number(handleValue(tableMeta, 0)).toFixed(1)}
/> // />
</span> : // </span> :
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ? // tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<div style={{ flex: 1 }}> // <div style={{ flex: 1 }}>
<FormControlLabel // <FormControlLabel
style={{ margin: 0 }} // style={{ margin: 0 }}
value={val} // value={val}
control={ // control={
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(handleValueFormula(tableMeta, 7)).toFixed(1)} // value={Number(handleValueFormula(tableMeta, 7)).toFixed(1)}
/> // />
} // }
/> // />
</div> : // </div> :
// tableMeta.rowData[0] === 7 ? // tableMeta.rowData[0] === 7 ?
// (Number(handleValueFormula(tableMeta, 7)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 7)).toFixed(1) <= Number(this.state.maxValue)) ? // (Number(handleValueFormula(tableMeta, 7)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 7)).toFixed(1) <= Number(this.state.maxValue)) ?
// <NumberFormat // <NumberFormat
...@@ -1179,22 +1192,22 @@ export default class BalanceSheetMR extends Component { ...@@ -1179,22 +1192,22 @@ export default class BalanceSheetMR extends Component {
// /> // />
// </LightTooltip> // </LightTooltip>
// : // :
<div style={{ flex: 1 }}> // <div style={{ flex: 1 }}>
<FormControlLabel // <FormControlLabel
style={{ margin: 0 }} // style={{ margin: 0 }}
value={val} // value={val}
control={ // control={
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(tableMeta.rowData[7]).toFixed(1)} // value={Number(tableMeta.rowData[7]).toFixed(1)}
/> // />
} // }
/> // />
</div> // </div>
} }
</div> </div>
</div> </div>
...@@ -1202,7 +1215,7 @@ export default class BalanceSheetMR extends Component { ...@@ -1202,7 +1215,7 @@ export default class BalanceSheetMR extends Component {
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
null : null :
this.state.get_for == 'view'? // this.state.get_for == 'view'?
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
...@@ -1211,35 +1224,35 @@ export default class BalanceSheetMR extends Component { ...@@ -1211,35 +1224,35 @@ export default class BalanceSheetMR extends Component {
disabled={true} disabled={true}
value={Number(tableMeta.rowData[8]).toFixed(1)} value={Number(tableMeta.rowData[8]).toFixed(1)}
/> />
: // :
tableMeta.rowData[0] === 2 ? // tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}> // <span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(handleValue(tableMeta, 1)).toFixed(1)} // value={Number(handleValue(tableMeta, 1)).toFixed(1)}
/> // />
</span> : // </span> :
tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ? // tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
<div style={{ flex: 1 }}> // <div style={{ flex: 1 }}>
<FormControlLabel // <FormControlLabel
style={{ margin: 0 }} // style={{ margin: 0 }}
value={val} // value={val}
control={ // control={
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(handleValueFormula(tableMeta, 8)).toFixed(1)} // value={Number(handleValueFormula(tableMeta, 8)).toFixed(1)}
/> // />
} // }
/> // />
</div> : // </div> :
// tableMeta.rowData[0] === 7 ? // tableMeta.rowData[0] === 7 ?
// (Number(handleValueFormula(tableMeta, 8)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 8)).toFixed(1) <= Number(this.state.maxValue)) ? // (Number(handleValueFormula(tableMeta, 8)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 8)).toFixed(1) <= Number(this.state.maxValue)) ?
// <NumberFormat // <NumberFormat
...@@ -1276,22 +1289,22 @@ export default class BalanceSheetMR extends Component { ...@@ -1276,22 +1289,22 @@ export default class BalanceSheetMR extends Component {
// /> // />
// </LightTooltip> // </LightTooltip>
// : // :
<div style={{ flex: 1 }}> // <div style={{ flex: 1 }}>
<FormControlLabel // <FormControlLabel
style={{ margin: 0 }} // style={{ margin: 0 }}
value={val} // value={val}
control={ // control={
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(tableMeta.rowData[8]).toFixed(1)} // value={Number(tableMeta.rowData[8]).toFixed(1)}
/> // />
} // }
/> // />
</div> // </div>
} }
</div> </div>
</div> </div>
...@@ -2045,9 +2058,9 @@ export default class BalanceSheetMR extends Component { ...@@ -2045,9 +2058,9 @@ export default class BalanceSheetMR extends Component {
<div className="col-1"> <div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ? {tableMeta.rowData[0] !== 3 ?
null : null :
this.state.get_for == 'view'? (this.state.get_for == 'view'?
tableMeta.rowData[17] tableMeta.rowData[17]
: :
<FormControlLabel <FormControlLabel
...@@ -2134,15 +2147,15 @@ export default class BalanceSheetMR extends Component { ...@@ -2134,15 +2147,15 @@ export default class BalanceSheetMR extends Component {
}} }}
/> />
} }
/>} />)}
</div> </div>
</div> </div>
</div> </div>
<div className="col-2"> <div className="col-2">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ? null : {tableMeta.rowData[0] !== 3 ? null :
this.state.get_for == 'view'? (this.state.get_for == 'view'?
tableMeta.rowData[18] tableMeta.rowData[18]
: :
<FormControlLabel <FormControlLabel
...@@ -2229,15 +2242,15 @@ export default class BalanceSheetMR extends Component { ...@@ -2229,15 +2242,15 @@ export default class BalanceSheetMR extends Component {
}} }}
/> />
} }
/>} />)}
</div> </div>
</div> </div>
</div> </div>
<div className="col-3"> <div className="col-3">
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ? null : {tableMeta.rowData[0] !== 3 ? null :
this.state.get_for == 'view'? (this.state.get_for == 'view'?
tableMeta.rowData[19] tableMeta.rowData[19]
: :
<FormControlLabel <FormControlLabel
...@@ -2324,7 +2337,7 @@ export default class BalanceSheetMR extends Component { ...@@ -2324,7 +2337,7 @@ export default class BalanceSheetMR extends Component {
}} }}
/> />
} }
/>} />)}
</div> </div>
</div> </div>
</div> </div>
...@@ -2571,7 +2584,7 @@ export default class BalanceSheetMR extends Component { ...@@ -2571,7 +2584,7 @@ export default class BalanceSheetMR extends Component {
marginRight: 20 marginRight: 20
}} }}
onClick={() => { onClick={() => {
this.setState({ loading: true }, () => { this.setState({ loading: true, dataTable: dataTable2 }, () => {
setTimeout(() => { setTimeout(() => {
this.handleValidate() this.handleValidate()
}, 100); }, 100);
...@@ -2689,7 +2702,7 @@ export default class BalanceSheetMR extends Component { ...@@ -2689,7 +2702,7 @@ export default class BalanceSheetMR extends Component {
marginRight: 20 marginRight: 20
}} }}
onClick={() => { onClick={() => {
this.setState({ loading: true }, () => { this.setState({ loading: true, dataTable: dataTable2 }, () => {
setTimeout(() => { setTimeout(() => {
this.handleValidate() this.handleValidate()
}, 100); }, 100);
......
...@@ -142,7 +142,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -142,7 +142,7 @@ export default class CorporateAnnualTargetMR extends Component {
let payload = { let payload = {
"report_id": this.props.report_id, "report_id": this.props.report_id,
"revision": Number(this.props.revision), "revision": Number(this.props.revision),
"periode": "2021", "periode": this.props.periode,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId, "monthly_report_id": this.props.monthlyReportId,
"months": this.props.month.month_id, "months": this.props.month.month_id,
......
...@@ -1275,7 +1275,7 @@ export default class ProfitLossMR extends Component { ...@@ -1275,7 +1275,7 @@ export default class ProfitLossMR extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(tableMeta.rowData[11]).toFixed(1) } value={Number(tableMeta.rowData[23]).toFixed(1) }
/> />
: :
// tableMeta.rowData[0] === 2 ? // tableMeta.rowData[0] === 2 ?
......
...@@ -410,7 +410,7 @@ export default class TaxPlanningMR extends Component { ...@@ -410,7 +410,7 @@ export default class TaxPlanningMR extends Component {
api.create('UPLOAD').uploadMonthlyReportTP(body).then(response => { api.create('UPLOAD').uploadMonthlyReportTP(body).then(response => {
// console.log(body); // console.log(body);
// console.log(JSON.stringify(body)); // console.log(JSON.stringify(body));
// console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.props.saveToMonthlyReport() this.props.saveToMonthlyReport()
......
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