Commit 35ed8ee7 authored by EKSAD's avatar EKSAD

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

parents 3a36d3ae 69f1194b
...@@ -92,8 +92,8 @@ export default class ApprovalMatrix extends Component { ...@@ -92,8 +92,8 @@ export default class ApprovalMatrix extends Component {
let body = { let body = {
approval_matrix: payload approval_matrix: payload
} }
console.log(resp.rows[1])
this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] }) this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] })
console.log(this.state.payload)
} }
}); });
} }
...@@ -621,7 +621,7 @@ export default class ApprovalMatrix extends Component { ...@@ -621,7 +621,7 @@ export default class ApprovalMatrix extends Component {
filter: false, filter: false,
sort: false, sort: false,
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
console.log(tableMeta) // console.log(tableMeta)
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{this.state.btnedit && <span> {this.state.btnedit && <span>
......
...@@ -46,8 +46,7 @@ export default class TaxPlanning extends Component { ...@@ -46,8 +46,7 @@ export default class TaxPlanning extends Component {
disabledSave: true, disabledSave: true,
editable: false, editable: false,
buttonError: false, buttonError: false,
judulColumn: null, judulColumn: null
reportName: ''
} }
this.handleValue = this.handleValue.bind(this) this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -148,7 +147,7 @@ export default class TaxPlanning extends Component { ...@@ -148,7 +147,7 @@ export default class TaxPlanning extends Component {
} }
} }
}) })
this.setState({ dataTable, loading: false, buttonError: true, reportName: res[0].report_name }) this.setState({ dataTable, loading: false, buttonError: true })
} else { } else {
this.setState({ dataTable, loading: false, buttonError: true }) this.setState({ dataTable, loading: false, buttonError: true })
} }
...@@ -295,7 +294,6 @@ export default class TaxPlanning extends Component { ...@@ -295,7 +294,6 @@ export default class TaxPlanning extends Component {
if (i.length > 0) { if (i.length > 0) {
payload.push({ payload.push({
item_report_id: i[0] === undefined ? "" : String(i[0]).trim(), item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
// item_report_name: this.state.reportName,
item_report: i[1] === undefined ? "" : String(i[1]).trim(), item_report: i[1] === undefined ? "" : String(i[1]).trim(),
january: { january: {
tbc: i[2] === undefined ? "" : String(i[2]).trim(), tbc: i[2] === undefined ? "" : String(i[2]).trim(),
...@@ -403,21 +401,63 @@ export default class TaxPlanning extends Component { ...@@ -403,21 +401,63 @@ export default class TaxPlanning extends Component {
// {tbc: item.formula.tbc, fcp: item.formula.fcp, tbf: item.formula.tbf}, // {tbc: item.formula.tbc, fcp: item.formula.fcp, tbf: item.formula.tbf},
item.level, item.level,
item.item_report, item.item_report,
{tbc : item.january.tbc, fcp: item.january.fcp, tbf: item.january.tbf}, {tbc : Number(item.type_report_id.tbc) === 3 && item.january.tbc === "" ? "0" : item.january.tbc ,
{tbc : item.february.tbc, fcp: item.february.fcp, tbf: item.february.tbf}, fcp: Number(item.type_report_id.fcp) === 3 && item.january.fcp === "" ? "0" : item.january.fcp,
{tbc : item.march.tbc, fcp: item.march.fcp, tbf: item.march.tbf}, tbf: Number(item.type_report_id.tbf) === 3 && item.january.tbf === "" ? "0" : item.january.tbf
{tbc : item.april.tbc, fcp: item.april.fcp, tbf: item.april.tbf}, },
{tbc : item.may.tbc, fcp: item.may.fcp, tbf: item.may.tbf}, { tbc : Number(item.type_report_id.tbc) === 3 && item.february.tbc === "" ? "0" : item.february.tbc,
{tbc : item.june.tbc, fcp: item.june.fcp, tbf: item.june.tbf}, fcp: Number(item.type_report_id.fcp) === 3 && item.january.fcp === "" ? "0" : item.january.fcp,
{tbc : item.july.tbc, fcp: item.july.fcp, tbf: item.july.tbf}, tbf: Number(item.type_report_id.tbf) === 3 && item.february.tbf === "" ? "0" : item.february.tbf
{tbc : item.august.tbc, fcp: item.august.fcp, tbf: item.august.tbf}, },
{tbc : item.september.tbc, fcp: item.september.fcp, tbf: item.september.tbf}, { tbc: Number(item.type_report_id.tbc) === 3 && item.march.tbc === "" ? "0" : item.march.tbc,
{tbc : item.october.tbc, fcp: item.october.fcp, tbf: item.october.tbf}, fcp: Number(item.type_report_id.fcp) === 3 && item.march.fcp === "" ? "0" : item.march.fcp,
{tbc : item.november.tbc, fcp: item.november.fcp, tbf: item.november.tbf}, tbf: Number(item.type_report_id.tbf) === 3 && item.march.tbf === "" ? "0" : item.march.tbf
{tbc : item.december.tbc, fcp: item.december.fcp, tbf: item.december.tbf}, },
{ tbc: Number(item.type_report_id.tbc) === 3 && item.april.tbc === "" ? "0" : item.april.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.april.fcp === "" ? "0" : item.april.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.april.tbf === "" ? "0" : item.april.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.may.tbc === "" ? "0" : item.may.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.may.fcp === "" ? "0" : item.may.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.may.tbf === "" ? "0" : item.may.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.june.tbc === "" ? "0" : item.june.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.june.fcp === "" ? "0" : item.june.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.june.tbf === "" ? "0" : item.june.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.july.tbc === "" ? "0" : item.july.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.july.fcp === "" ? "0" : item.july.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.july.tbf === "" ? "0" : item.july.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.august.tbc === "" ? "0" : item.august.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.august.fcp === "" ? "0" : item.august.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.august.tbf === "" ? "0" : item.august.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.september.tbc === "" ? "0" : item.september.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.september.fcp === "" ? "0" : item.september.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.september.tbf === "" ? "0" : item.september.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.october.tbc === "" ? "0" : item.october.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.october.fcp === "" ? "0" : item.october.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.october.tbf === "" ? "0" : item.october.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.november.tbc === "" ? "0" : item.november.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.november.fcp === "" ? "0" : item.november.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.november.tbf === "" ? "0" : item.november.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.december.tbc === "" ? "0" : item.december.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.december.fcp === "" ? "0" : item.december.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.december.tbf === "" ? "0" : item.december.tbf
},
item.total_current_year, item.total_current_year,
{tbc : item.total_next_year.tbc, fcp: item.total_next_year.fcp, tbf: item.total_next_year.tbf}, { tbc: Number(item.type_report_id.tbc) === 3 && item.total_next_year.tbc === "" ? "0" : item.total_next_year.tbc,
{tbc : item.total_more_year.tbc, fcp: item.total_more_year.fcp, tbf: item.total_more_year.tbf}, fcp: Number(item.type_report_id.fcp) === 3 && item.total_next_year.fcp === "" ? "0" : item.total_next_year.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.total_next_year.tbf === "" ? "0" : item.total_next_year.tbf
},
{ tbc: Number(item.type_report_id.tbc) === 3 && item.total_more_year.tbc === "" ? "0" : item.total_more_year.tbc,
fcp: Number(item.type_report_id.fcp) === 3 && item.total_more_year.fcp === "" ? "0" : item.total_more_year.fcp,
tbf: Number(item.type_report_id.tbf) === 3 && item.total_more_year.tbf === "" ? "0" : item.total_more_year.tbf
},
item.error item.error
] ]
}) })
...@@ -536,6 +576,104 @@ export default class TaxPlanning extends Component { ...@@ -536,6 +576,104 @@ export default class TaxPlanning extends Component {
}) })
} }
handleValidate() {
let data = []
console.log(this.state.dataTable)
this.state.dataTable.map(i => {
data.push({
item_report_id: i[4],
january: {
tbc: String(i[9].tbc),
fcp: String(i[9].fcp),
tbf: String(i[9].tbf)
},
february: {
tbc: String(i[10].tbc),
fcp: String(i[10].fcp),
tbf: String(i[10].tbf)
},
march: {
tbc: String(i[11].tbc),
fcp: String(i[11].fcp),
tbf: String(i[11].tbf)
},
april: {
tbc: String(i[12].tbc),
fcp: String(i[12].fcp),
tbf: String(i[12].tbf)
},
may: {
tbc: String(i[13].tbc),
fcp: String(i[13].fcp),
tbf: String(i[13].tbf)
},
june: {
tbc: String(i[14].tbc),
fcp: String(i[14].fcp),
tbf: String(i[14].tbf)
},
july: {
tbc: String(i[15].tbc),
fcp: String(i[15].fcp),
tbf: String(i[15].tbf)
},
august: {
tbc: String(i[16].tbc),
fcp: String(i[16].fcp),
tbf: String(i[16].tbf)
},
september: {
tbc: String(i[17].tbc),
fcp: String(i[17].fcp),
tbf: String(i[17].tbf)
},
october: {
tbc: String(i[18].tbc),
fcp: String(i[18].fcp),
tbf: String(i[18].tbf)
},
november: {
tbc: String(i[19].tbc),
fcp: String(i[19].fcp),
tbf: String(i[19].tbf)
},
december: {
tbc: String(i[20].tbc),
fcp: String(i[20].fcp),
tbf: String(i[20].tbf)
},
total_current_year: String(i[21]),
total_next_year: {
tbc: String(i[22].tbc),
fcp: String(i[22].fcp),
tbf: String(i[22].tbf)
},
total_more_year: {
tbc: String(i[23].tbc),
fcp: String(i[23].fcp),
tbf: String(i[23].tbf)
}
})
})
console.log(JSON.stringify(data))
let payload = {
"submission_id": this.props.submissionID,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"balance_sheet": data,
"status": "submitted"
}
api.create().validateSubmitReport(payload).then((response) => {
console.log(response)
if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: true })
} else {
this.setState({ loading: false, buttonError: true, editable: true })
}
})
}
downloadTemplate = async () => { downloadTemplate = async () => {
let res = await fetch( let res = await fetch(
`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}`
...@@ -587,13 +725,13 @@ export default class TaxPlanning extends Component { ...@@ -587,13 +725,13 @@ export default class TaxPlanning extends Component {
let total = 0 let total = 0
dataTable2[tableMeta.rowIndex].map((item, index) => { dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 9 && index <= 20) { if (index >= 9 && index <= 20) {
let valItem = item == undefined || item == "" ? 0 : item console.log(item);
let valItem = item.fcp == undefined || item.fcp == "" ? 0 : item.fcp
total += Number(valItem) total += Number(valItem)
} }
}) })
dataTable2[tableMeta.rowIndex][19] = total dataTable2[tableMeta.rowIndex][21] = total
return total return total
// console.log(total);
} }
const handleValue = (data) => { const handleValue = (data) => {
let total = 0 let total = 0
...@@ -3941,19 +4079,27 @@ export default class TaxPlanning extends Component { ...@@ -3941,19 +4079,27 @@ export default class TaxPlanning extends Component {
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={value.tbc} value={value}
control={ control={
// <NumberFormat
// thousandSeparator={true}
// style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// value={value.tbc}
// onBlur={(event) => {
// // updateValue(event.target.value)
// // handleChange(event.target.value, tableMeta)
// console.log(event.target.value)
// }}
// />
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", 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=""
value={value.tbc} disabled={true}
onBlur={(event) => { value={handleTotal(tableMeta)}
// updateValue(event.target.value)
// handleChange(event.target.value, tableMeta)
console.log(event.target.value)
}}
/> />
} }
/> />
...@@ -4706,6 +4852,7 @@ export default class TaxPlanning extends Component { ...@@ -4706,6 +4852,7 @@ export default class TaxPlanning extends Component {
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false, buttonError: false, editable: true }) this.setState({ loading: false, buttonError: false, editable: true })
// this.handleValidate()
}, 100); }, 100);
}) })
}} }}
...@@ -4771,7 +4918,7 @@ export default class TaxPlanning extends Component { ...@@ -4771,7 +4918,7 @@ export default class TaxPlanning extends Component {
<button <button
className="button" className="button"
type="button" type="button"
disabled={this.state.buttonError} // disabled={this.state.buttonError}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer', cursor: this.state.buttonError === true ? 'default' : 'pointer',
......
...@@ -64,7 +64,7 @@ export default class CreateManagementDoc extends Component { ...@@ -64,7 +64,7 @@ export default class CreateManagementDoc extends Component {
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
sizeUpload: response.data.data[0].value sizeUpload: response.data.data[0] ? response.data.data[0].value === undefined ? "1" : response.data.data[0].value : "1"
}) })
} }
} }
......
...@@ -66,7 +66,7 @@ export default class EditManagementDoc extends Component { ...@@ -66,7 +66,7 @@ export default class EditManagementDoc extends Component {
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
sizeUpload: response.data.data[0].value sizeUpload: response.data.data[0] ? response.data.data[0].value === undefined ? "1" : response.data.data[0].value : "1"
}) })
} }
} }
...@@ -88,6 +88,7 @@ export default class EditManagementDoc extends Component { ...@@ -88,6 +88,7 @@ export default class EditManagementDoc extends Component {
period: data.document_periode, period: data.document_periode,
getMonthName: data.document_month, getMonthName: data.document_month,
description: data.description, description: data.description,
filePath: data.document_filepath,
file: data.document_filepath, file: data.document_filepath,
document_name: data.document_name, document_name: data.document_name,
document_size: data.document_size, document_size: data.document_size,
...@@ -279,6 +280,10 @@ export default class EditManagementDoc extends Component { ...@@ -279,6 +280,10 @@ export default class EditManagementDoc extends Component {
// this.setState({ errorDocument: true, msgErrorDocument: 'File Cannot be Empty' }) // this.setState({ errorDocument: true, msgErrorDocument: 'File Cannot be Empty' })
} else { } else {
const formData = new FormData(); const formData = new FormData();
if (this.state.file == this.state.filePath){
formData.append("updated", 0);
}
formData.append("updated", 1);
formData.append("file", this.state.file); formData.append("file", this.state.file);
formData.append("companyId", this.state.getPerusahaan.company_id); formData.append("companyId", this.state.getPerusahaan.company_id);
formData.append("settingId", this.state.getDocument.document_category_id); formData.append("settingId", this.state.getDocument.document_category_id);
...@@ -290,6 +295,7 @@ export default class EditManagementDoc extends Component { ...@@ -290,6 +295,7 @@ export default class EditManagementDoc extends Component {
this.setState({ formData }, () => { this.setState({ formData }, () => {
this.props.updateDocument(this.state.formData) this.props.updateDocument(this.state.formData)
}) })
console.log(JSON.stringify(formData))
} }
} }
......
...@@ -69,11 +69,11 @@ export default class Parameter extends Component { ...@@ -69,11 +69,11 @@ export default class Parameter extends Component {
type: 'MAX_FILE_SIZE' type: 'MAX_FILE_SIZE'
} }
api.create().getAllSettingByType(body).then(response => { api.create().getAllSettingByType(body).then(response => {
console.log(response); console.log(response.data.data[0]);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
sizeUpload: response.data.data[0].value sizeUpload: response.data.data[0] ? response.data.data[0].value === undefined ? "1" : response.data.data[0].value : "1"
}) })
} }
} }
......
...@@ -240,7 +240,7 @@ export default class UnitBisnis extends Component { ...@@ -240,7 +240,7 @@ export default class UnitBisnis extends Component {
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
sizeUpload: response.data.data[0].value sizeUpload: response.data.data[0] ? response.data.data[0].value === undefined ? "1" : response.data.data[0].value : "1"
}) })
} }
} }
......
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