Commit 3aa796cb authored by EKSAD's avatar EKSAD

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

parents bbbad0b4 e1084a51
......@@ -312,7 +312,7 @@ export default class BudgetTahunan extends Component {
saveToMasterBudget(data) {
this.setState({ loading: true })
// console.log(JSON.stringify(data));
api.create().createSubmitReport(data).then(response => {
api.create('UPLOAD').createSubmitReport(data).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
......@@ -674,6 +674,7 @@ export default class BudgetTahunan extends Component {
)}
{this.state.visibleTP && (
<TaxPlanning
open={this.props.open}
report_id={this.state.report_id}
height={this.props.height}
width={this.props.width}
......@@ -683,6 +684,8 @@ export default class BudgetTahunan extends Component {
submissionID={this.state.submissionID}
saveToMasterBudget={this.saveToMasterBudget.bind(this)}
onClickClose={() => this.setState({ visibleTP: false, visibleBudgetTahunan: true })}
getReport={this.getReport.bind(this)}
getReportAttachment={this.getReportAttachment.bind(this)}
/>
)}
{this.state.visibleFAM && (
......
......@@ -31,18 +31,7 @@ export default class BalanceSheet extends Component {
constructor(props) {
super(props)
this.state = {
dataTable: [
// ["TOTAL ASSETS", "11,247,249", "10,702,196"],
// ["TOTAL CURRENT ASSETS", "2,647,647", "2,058,898"],
// ["Cash & Cash Equivalent", "1,464,571", "729,743"],
// ["Cash & Bank Balance", "938,707", "265,584"],
// ["Time & Call Deposit", "525,864", "464,159"],
// ["BI Deposit", "", ""],
// ["Marketable Securities", "150,250", "154,500"],
// ["Notes Receivable", "", ""],
// ["Accounts Receivable", "172,031", "97,112"],
// ["Trade Receivables - Third Party", "142,668", "77,480"],
],
dataTable: [],
visibleBalanceSheet: true,
disabledSave: true
}
......@@ -66,12 +55,12 @@ export default class BalanceSheet extends Component {
}
api.create().getDetailReportMB(payload).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
let dataTable = []
response.data.data.map((item, index) => {
if (item.children && item.children.length > 0) {
let res = response.data.data
console.log(res)
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) {
dataTable.push([
item.type_report_id,
item.id,
......@@ -96,564 +85,16 @@ export default class BalanceSheet extends Component {
item.balance_sheet.total_next_year,
item.balance_sheet.total_more_year
])
item.children.map(i => {
if (i.children) {
if (i.children.length > 0) {
dataTable.push([
i.type_report_id,
i.id,
i.parent,
i.formula,
i.level,
i.description,
i.balance_sheet.total_actual_before,
i.balance_sheet.january,
i.balance_sheet.february,
i.balance_sheet.march,
i.balance_sheet.april,
i.balance_sheet.may,
i.balance_sheet.june,
i.balance_sheet.july,
i.balance_sheet.august,
i.balance_sheet.september,
i.balance_sheet.october,
i.balance_sheet.november,
i.balance_sheet.december,
i.balance_sheet.total_current_year,
i.balance_sheet.total_next_year,
i.balance_sheet.total_more_year
])
i.children.map(val => {
if (val.children && val.children.length > 0) {
dataTable.push([
val.type_report_id,
val.id,
val.parent,
val.formula,
val.level,
val.description,
val.balance_sheet.total_actual_before,
val.balance_sheet.january,
val.balance_sheet.february,
val.balance_sheet.march,
val.balance_sheet.april,
val.balance_sheet.may,
val.balance_sheet.june,
val.balance_sheet.july,
val.balance_sheet.august,
val.balance_sheet.september,
val.balance_sheet.october,
val.balance_sheet.november,
val.balance_sheet.december,
val.balance_sheet.total_current_year,
val.balance_sheet.total_next_year,
val.balance_sheet.total_more_year
])
val.children.map(items => {
if (items.children && items.children.length > 0) {
dataTable.push([
items.type_report_id,
items.id,
items.parent,
items.formula,
items.level,
items.description,
items.balance_sheet.total_actual_before,
items.balance_sheet.january,
items.balance_sheet.february,
items.balance_sheet.march,
items.balance_sheet.april,
items.balance_sheet.may,
items.balance_sheet.june,
items.balance_sheet.july,
items.balance_sheet.august,
items.balance_sheet.september,
items.balance_sheet.october,
items.balance_sheet.november,
items.balance_sheet.december,
items.balance_sheet.total_current_year,
items.balance_sheet.total_next_year,
items.balance_sheet.total_more_year
])
items.children.map(itemss => {
if (itemss.children && itemss.children.length > 0) {
dataTable.push([
itemss.type_report_id,
itemss.id,
itemss.parent,
itemss.formula,
itemss.level,
itemss.description,
itemss.balance_sheet.total_actual_before,
itemss.balance_sheet.january,
itemss.balance_sheet.february,
itemss.balance_sheet.march,
itemss.balance_sheet.april,
itemss.balance_sheet.may,
itemss.balance_sheet.june,
itemss.balance_sheet.july,
itemss.balance_sheet.august,
itemss.balance_sheet.september,
itemss.balance_sheet.october,
itemss.balance_sheet.november,
itemss.balance_sheet.december,
itemss.balance_sheet.total_current_year,
itemss.balance_sheet.total_next_year,
itemss.balance_sheet.total_more_year
])
itemss.children.map(item1 => {
if (item1.children && item1.children.length > 0) {
dataTable.push([
item1.type_report_id,
item1.id,
item1.parent,
item1.formula,
item1.level,
item1.description,
item1.balance_sheet.total_actual_before,
item1.balance_sheet.january,
item1.balance_sheet.february,
item1.balance_sheet.march,
item1.balance_sheet.april,
item1.balance_sheet.may,
item1.balance_sheet.june,
item1.balance_sheet.july,
item1.balance_sheet.august,
item1.balance_sheet.september,
item1.balance_sheet.october,
item1.balance_sheet.november,
item1.balance_sheet.december,
item1.balance_sheet.total_current_year,
item1.balance_sheet.total_next_year,
item1.balance_sheet.total_more_year
])
item1.children.map(item2 => {
if (item2.children && item2.children.length > 0) {
dataTable.push([
item2.type_report_id,
item2.id,
item2.parent,
item2.formula,
item2.level,
item2.description,
item2.balance_sheet.total_actual_before,
item2.balance_sheet.january,
item2.balance_sheet.february,
item2.balance_sheet.march,
item2.balance_sheet.april,
item2.balance_sheet.may,
item2.balance_sheet.june,
item2.balance_sheet.july,
item2.balance_sheet.august,
item2.balance_sheet.september,
item2.balance_sheet.october,
item2.balance_sheet.november,
item2.balance_sheet.december,
item2.balance_sheet.total_current_year,
item2.balance_sheet.total_next_year,
item2.balance_sheet.total_more_year
])
item2.children.map(item3 => {
if (item3.children && item3.children.length > 0) {
dataTable.push([
item3.type_report_id,
item3.id,
item3.parent,
item3.formula,
item3.level,
item3.description,
item3.balance_sheet.total_actual_before,
item3.balance_sheet.january,
item3.balance_sheet.february,
item3.balance_sheet.march,
item3.balance_sheet.april,
item3.balance_sheet.may,
item3.balance_sheet.june,
item3.balance_sheet.july,
item3.balance_sheet.august,
item3.balance_sheet.september,
item3.balance_sheet.october,
item3.balance_sheet.november,
item3.balance_sheet.december,
item3.balance_sheet.total_current_year,
item3.balance_sheet.total_next_year,
item3.balance_sheet.total_more_year
])
item3.children.map(item4 => {
if (item4.children && item4.children.length > 0) {
dataTable.push([
item4.type_report_id,
item4.id,
item4.parent,
item4.formula,
item4.level,
item4.description,
item4.balance_sheet.total_actual_before,
item4.balance_sheet.january,
item4.balance_sheet.february,
item4.balance_sheet.march,
item4.balance_sheet.april,
item4.balance_sheet.may,
item4.balance_sheet.june,
item4.balance_sheet.july,
item4.balance_sheet.august,
item4.balance_sheet.september,
item4.balance_sheet.october,
item4.balance_sheet.november,
item4.balance_sheet.december,
item4.balance_sheet.total_current_year,
item4.balance_sheet.total_next_year,
item4.balance_sheet.total_more_year
])
item4.children.map(item5 => {
if (item5.children && item5.children.length > 0) {
dataTable.push([
item5.type_report_id,
item5.id,
item5.parent,
item5.formula,
item5.level,
item5.description,
item5.balance_sheet.total_actual_before,
item5.balance_sheet.january,
item5.balance_sheet.february,
item5.balance_sheet.march,
item5.balance_sheet.april,
item5.balance_sheet.may,
item5.balance_sheet.june,
item5.balance_sheet.july,
item5.balance_sheet.august,
item5.balance_sheet.september,
item5.balance_sheet.october,
item5.balance_sheet.november,
item5.balance_sheet.december,
item5.balance_sheet.total_current_year,
item5.balance_sheet.total_next_year,
item5.balance_sheet.total_more_year
])
item5.children.map(item6 => {
if (item6.children && item.children.length > 0) {
dataTable.push([
item6.type_report_id,
item6.id,
item6.parent,
item6.formula,
item6.level,
item6.description,
item6.balance_sheet.total_actual_before,
item6.balance_sheet.january,
item6.balance_sheet.february,
item6.balance_sheet.march,
item6.balance_sheet.april,
item6.balance_sheet.may,
item6.balance_sheet.june,
item6.balance_sheet.july,
item6.balance_sheet.august,
item6.balance_sheet.september,
item6.balance_sheet.october,
item6.balance_sheet.november,
item6.balance_sheet.december,
item6.balance_sheet.total_current_year,
item6.balance_sheet.total_next_year,
item6.balance_sheet.total_more_year
])
} else {
dataTable.push([
item6.type_report_id,
item6.id,
item6.parent,
item6.formula,
item6.level,
item6.description,
item6.balance_sheet.total_actual_before,
item6.balance_sheet.january,
item6.balance_sheet.february,
item6.balance_sheet.march,
item6.balance_sheet.april,
item6.balance_sheet.may,
item6.balance_sheet.june,
item6.balance_sheet.july,
item6.balance_sheet.august,
item6.balance_sheet.september,
item6.balance_sheet.october,
item6.balance_sheet.november,
item6.balance_sheet.december,
item6.balance_sheet.total_current_year,
item6.balance_sheet.total_next_year,
item6.balance_sheet.total_more_year
])
}
})
} else {
dataTable.push([
item5.type_report_id,
item5.id,
item5.parent,
item5.formula,
item5.level,
item5.description,
item5.balance_sheet.total_actual_before,
item5.balance_sheet.january,
item5.balance_sheet.february,
item5.balance_sheet.march,
item5.balance_sheet.april,
item5.balance_sheet.may,
item5.balance_sheet.june,
item5.balance_sheet.july,
item5.balance_sheet.august,
item5.balance_sheet.september,
item5.balance_sheet.october,
item5.balance_sheet.november,
item5.balance_sheet.december,
item5.balance_sheet.total_current_year,
item5.balance_sheet.total_next_year,
item5.balance_sheet.total_more_year
])
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
} else {
dataTable.push([
item4.type_report_id,
item4.id,
item4.parent,
item4.formula,
item4.level,
item4.description,
item4.balance_sheet.total_actual_before,
item4.balance_sheet.january,
item4.balance_sheet.february,
item4.balance_sheet.march,
item4.balance_sheet.april,
item4.balance_sheet.may,
item4.balance_sheet.june,
item4.balance_sheet.july,
item4.balance_sheet.august,
item4.balance_sheet.september,
item4.balance_sheet.october,
item4.balance_sheet.november,
item4.balance_sheet.december,
item4.balance_sheet.total_current_year,
item4.balance_sheet.total_next_year,
item4.balance_sheet.total_more_year
])
}
})
} else {
dataTable.push([
item3.type_report_id,
item3.id,
item3.parent,
item3.formula,
item3.level,
item3.description,
item3.balance_sheet.total_actual_before,
item3.balance_sheet.january,
item3.balance_sheet.february,
item3.balance_sheet.march,
item3.balance_sheet.april,
item3.balance_sheet.may,
item3.balance_sheet.june,
item3.balance_sheet.july,
item3.balance_sheet.august,
item3.balance_sheet.september,
item3.balance_sheet.october,
item3.balance_sheet.november,
item3.balance_sheet.december,
item3.balance_sheet.total_current_year,
item3.balance_sheet.total_next_year,
item3.balance_sheet.total_more_year
])
}
})
} else {
dataTable.push([
item2.type_report_id,
item2.id,
item2.parent,
item2.formula,
item2.level,
item2.description,
item2.balance_sheet.total_actual_before,
item2.balance_sheet.january,
item2.balance_sheet.february,
item2.balance_sheet.march,
item2.balance_sheet.april,
item2.balance_sheet.may,
item2.balance_sheet.june,
item2.balance_sheet.july,
item2.balance_sheet.august,
item2.balance_sheet.september,
item2.balance_sheet.october,
item2.balance_sheet.november,
item2.balance_sheet.december,
item2.balance_sheet.total_current_year,
item2.balance_sheet.total_next_year,
item2.balance_sheet.total_more_year
])
}
})
} else {
dataTable.push([
item1.type_report_id,
item1.id,
item1.parent,
item1.formula,
item1.level,
item1.description,
item1.balance_sheet.total_actual_before,
item1.balance_sheet.january,
item1.balance_sheet.february,
item1.balance_sheet.march,
item1.balance_sheet.april,
item1.balance_sheet.may,
item1.balance_sheet.june,
item1.balance_sheet.july,
item1.balance_sheet.august,
item1.balance_sheet.september,
item1.balance_sheet.october,
item1.balance_sheet.november,
item1.balance_sheet.december,
item1.balance_sheet.total_current_year,
item1.balance_sheet.total_next_year,
item1.balance_sheet.total_more_year
])
}
})
} else {
dataTable.push([
itemss.type_report_id,
itemss.id,
itemss.parent,
itemss.formula,
itemss.level,
itemss.description,
itemss.balance_sheet.total_actual_before,
itemss.balance_sheet.january,
itemss.balance_sheet.february,
itemss.balance_sheet.march,
itemss.balance_sheet.april,
itemss.balance_sheet.may,
itemss.balance_sheet.june,
itemss.balance_sheet.july,
itemss.balance_sheet.august,
itemss.balance_sheet.september,
itemss.balance_sheet.october,
itemss.balance_sheet.november,
itemss.balance_sheet.december,
itemss.balance_sheet.total_current_year,
itemss.balance_sheet.total_next_year,
itemss.balance_sheet.total_more_year
])
}
})
} else {
dataTable.push([
items.type_report_id,
items.id,
items.parent,
items.formula,
items.level,
items.description,
items.balance_sheet.total_actual_before,
items.balance_sheet.january,
items.balance_sheet.february,
items.balance_sheet.march,
items.balance_sheet.april,
items.balance_sheet.may,
items.balance_sheet.june,
items.balance_sheet.july,
items.balance_sheet.august,
items.balance_sheet.september,
items.balance_sheet.october,
items.balance_sheet.november,
items.balance_sheet.december,
items.balance_sheet.total_current_year,
items.balance_sheet.total_next_year,
items.balance_sheet.total_more_year
])
}
})
} else {
dataTable.push([
val.type_report_id,
val.id,
val.parent,
val.formula,
val.level,
val.description,
val.balance_sheet.total_actual_before,
val.balance_sheet.january,
val.balance_sheet.february,
val.balance_sheet.march,
val.balance_sheet.april,
val.balance_sheet.may,
val.balance_sheet.june,
val.balance_sheet.july,
val.balance_sheet.august,
val.balance_sheet.september,
val.balance_sheet.october,
val.balance_sheet.november,
val.balance_sheet.december,
val.balance_sheet.total_current_year,
val.balance_sheet.total_next_year,
val.balance_sheet.total_more_year
])
}
})
} else {
dataTable.push([
i.type_report_id,
i.id,
i.parent,
i.formula,
i.level,
i.description,
i.balance_sheet.total_actual_before,
i.balance_sheet.january,
i.balance_sheet.february,
i.balance_sheet.march,
i.balance_sheet.april,
i.balance_sheet.may,
i.balance_sheet.june,
i.balance_sheet.july,
i.balance_sheet.august,
i.balance_sheet.september,
i.balance_sheet.october,
i.balance_sheet.november,
i.balance_sheet.december,
i.balance_sheet.total_current_year,
i.balance_sheet.total_next_year,
i.balance_sheet.total_more_year
])
}
} else {
dataTable.push([
i.type_report_id,
i.id,
i.parent,
i.formula,
i.level,
i.description,
i.balance_sheet.total_actual_before,
i.balance_sheet.january,
i.balance_sheet.february,
i.balance_sheet.march,
i.balance_sheet.april,
i.balance_sheet.may,
i.balance_sheet.june,
i.balance_sheet.july,
i.balance_sheet.august,
i.balance_sheet.september,
i.balance_sheet.october,
i.balance_sheet.november,
i.balance_sheet.december,
i.balance_sheet.total_current_year,
i.balance_sheet.total_next_year,
i.balance_sheet.total_more_year
])
}
})
} else {
res.map((item, index) => {
dataTable.push([
item.type_report_id,
item.id,
......@@ -678,15 +119,17 @@ export default class BalanceSheet extends Component {
item.balance_sheet.total_next_year,
item.balance_sheet.total_more_year
])
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
console.log(dataTable);
this.setState({ dataTable, loading: false })
}
} else {
this.setState({ loading: false })
}
})
this.setState({ dataTable, loading: false })
})
}
handleValue(data) {
......@@ -908,6 +351,21 @@ export default class BalanceSheet extends Component {
})
}
async downloadAllData() {
let res = await fetch(
`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}`
)
res = await res.blob()
this.setState({ loading: false })
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Balance Sheet.xlsx';
a.click();
}
}
render() {
let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta) => {
......@@ -2511,7 +1969,12 @@ export default class BalanceSheet extends Component {
borderColor: 'transparent',
margin: 5
}}
onClick={() => null}
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
})}
>
<img src={Images.download} />
</button>
......
......@@ -670,7 +670,7 @@ export default class FixedAssetsMovement extends Component {
])
}
})
// console.log(dataTable);
console.log(dataTable);
this.setState({ dataTable, loading: false })
}
} else {
......@@ -853,6 +853,8 @@ export default class FixedAssetsMovement extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 300 }}>
{console.log(val)}
{console.log(tableMeta)}
{tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
:
......@@ -897,7 +899,7 @@ export default class FixedAssetsMovement extends Component {
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
tableMeta.rowData[0] === 5 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -944,7 +946,7 @@ export default class FixedAssetsMovement extends Component {
value={Number(value)}
/>
:
<span>validasi</span>
<span>-</span>
}
</div>
)
......@@ -983,7 +985,7 @@ export default class FixedAssetsMovement extends Component {
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
tableMeta.rowData[0] === 5 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -1005,7 +1007,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1015,7 +1017,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -1030,7 +1032,7 @@ export default class FixedAssetsMovement extends Component {
value={Number(value)}
/>
:
<span>validasi</span>
<span>-</span>
}
</div>
)
......@@ -1069,7 +1071,7 @@ export default class FixedAssetsMovement extends Component {
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
tableMeta.rowData[0] === 5 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -1091,7 +1093,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1101,7 +1103,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -1116,7 +1118,7 @@ export default class FixedAssetsMovement extends Component {
value={Number(value)}
/>
:
<span>validasi</span>
<span>-</span>
}
</div>
)
......@@ -1155,7 +1157,7 @@ export default class FixedAssetsMovement extends Component {
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
tableMeta.rowData[0] === 5 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -1177,7 +1179,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1187,7 +1189,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -1202,7 +1204,7 @@ export default class FixedAssetsMovement extends Component {
value={Number(value)}
/>
:
<span>validasi</span>
<span>-</span>
}
</div>
)
......@@ -1241,7 +1243,7 @@ export default class FixedAssetsMovement extends Component {
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
tableMeta.rowData[0] === 5 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -1263,7 +1265,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1273,7 +1275,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -1288,7 +1290,7 @@ export default class FixedAssetsMovement extends Component {
value={Number(value)}
/>
:
<span>validasi</span>
<span>-</span>
}
</div>
)
......@@ -1327,7 +1329,7 @@ export default class FixedAssetsMovement extends Component {
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
tableMeta.rowData[0] === 5 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -1349,7 +1351,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1359,7 +1361,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -1374,7 +1376,7 @@ export default class FixedAssetsMovement extends Component {
value={Number(value)}
/>
:
<span>validasi</span>
<span>-</span>
}
</div>
)
......@@ -1413,7 +1415,7 @@ export default class FixedAssetsMovement extends Component {
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
tableMeta.rowData[0] === 5 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -1435,7 +1437,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1445,7 +1447,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -1460,7 +1462,7 @@ export default class FixedAssetsMovement extends Component {
value={Number(value)}
/>
:
<span>validasi</span>
<span>-</span>
}
</div>
)
......@@ -1499,7 +1501,7 @@ export default class FixedAssetsMovement extends Component {
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
tableMeta.rowData[0] === 5 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -1521,7 +1523,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1531,7 +1533,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -1546,7 +1548,7 @@ export default class FixedAssetsMovement extends Component {
value={Number(value)}
/>
:
<span>validasi</span>
<span>-</span>
}
</div>
)
......@@ -1585,7 +1587,7 @@ export default class FixedAssetsMovement extends Component {
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
tableMeta.rowData[0] === 5 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -1607,7 +1609,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1617,7 +1619,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -1632,7 +1634,7 @@ export default class FixedAssetsMovement extends Component {
value={Number(value)}
/>
:
<span>validasi</span>
<span>-</span>
}
</div>
)
......@@ -1671,7 +1673,7 @@ export default class FixedAssetsMovement extends Component {
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
tableMeta.rowData[0] === 5 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -1693,7 +1695,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1703,7 +1705,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -1718,7 +1720,7 @@ export default class FixedAssetsMovement extends Component {
value={Number(value)}
/>
:
<span>validasi</span>
<span>-</span>
}
</div>
)
......@@ -1757,7 +1759,7 @@ export default class FixedAssetsMovement extends Component {
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
tableMeta.rowData[0] === 5 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -1779,7 +1781,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1789,7 +1791,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -1804,7 +1806,7 @@ export default class FixedAssetsMovement extends Component {
value={Number(value)}
/>
:
<span>validasi</span>
<span>-</span>
}
</div>
)
......@@ -1843,7 +1845,7 @@ export default class FixedAssetsMovement extends Component {
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
tableMeta.rowData[0] === 5 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -1865,7 +1867,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1875,7 +1877,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -1890,7 +1892,7 @@ export default class FixedAssetsMovement extends Component {
value={Number(value)}
/>
:
<span>validasi</span>
<span>-</span>
}
</div>
)
......@@ -1929,7 +1931,7 @@ export default class FixedAssetsMovement extends Component {
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
tableMeta.rowData[0] === 5 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -1951,7 +1953,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1961,7 +1963,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -1976,7 +1978,7 @@ export default class FixedAssetsMovement extends Component {
value={Number(value)}
/>
:
<span>validasi</span>
<span>-</span>
}
</div>
)
......@@ -2015,7 +2017,7 @@ export default class FixedAssetsMovement extends Component {
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
tableMeta.rowData[0] === 5 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -2037,7 +2039,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -2047,7 +2049,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -2062,7 +2064,7 @@ export default class FixedAssetsMovement extends Component {
value={Number(value)}
/>
:
<span>validasi</span>
<span>-</span>
}
</div>
)
......@@ -2072,8 +2074,8 @@ export default class FixedAssetsMovement extends Component {
name: "31 Dec 2022 Total",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
<Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
......@@ -2101,7 +2103,7 @@ export default class FixedAssetsMovement extends Component {
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
tableMeta.rowData[0] === 5 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -2123,7 +2125,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -2133,7 +2135,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -2148,7 +2150,7 @@ export default class FixedAssetsMovement extends Component {
value={Number(value)}
/>
:
<span>validasi</span>
<span>-</span>
}
</div>
)
......@@ -2158,8 +2160,8 @@ export default class FixedAssetsMovement extends Component {
name: "31 Dec 2023 Total",
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#354960', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
<Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({ style2 }),
......@@ -2187,7 +2189,7 @@ export default class FixedAssetsMovement extends Component {
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
tableMeta.rowData[0] === 5 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
......@@ -2209,7 +2211,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -2219,7 +2221,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -2234,7 +2236,7 @@ export default class FixedAssetsMovement extends Component {
value={Number(value)}
/>
:
<span>validasi</span>
<span>-</span>
}
</div>
)
......@@ -2319,7 +2321,7 @@ export default class FixedAssetsMovement extends Component {
</div>
</div>
<div style={{ marginTop: 20, width: this.props.width - 200, height: this.props.height-200 }}>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150), height: this.props.height - 200 }}>
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
......
......@@ -9,6 +9,7 @@ import ReactTooltip from 'react-tooltip';
import PopUpDelete from "./PopUpDelete";
import api from '../../api';
import CreateManagementDoc from './CreateManagementDoc';
import EditManagementDoc from './EditManagementDoc';
var ct = require("../../library/CustomTable");
......@@ -24,6 +25,7 @@ export default class AuditTahunan extends Component {
this.state = {
dataTable: [],
visibleCreate: false,
visibleEdit: false,
refresh: '',
alert: false,
popupDel: false,
......@@ -122,7 +124,11 @@ export default class AuditTahunan extends Component {
})
}
if (type === 'edit') {
alert("edit")
this.setState({
id: this.state.docId[val],
rowData: index,
visibleEdit: true
})
}
}
......@@ -154,6 +160,32 @@ export default class AuditTahunan extends Component {
})
}
updateDocument(payload) {
api.create().updateDocument(payload).then(response => {
console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
this.getData()
this.setState({ konfirmasi: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success', visibleEdit: false })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
closeAlert() {
this.setState({ alert: false })
......@@ -252,6 +284,15 @@ export default class AuditTahunan extends Component {
deleteDoc={this.deleteDoc.bind(this)}
/>
)}
{this.state.visibleEdit && (
<EditManagementDoc
type={"edit"}
onClickClose={() => this.setState({ visibleEdit: false })}
data={this.state.rowData}
idoc={this.state.id}
updateDocument={this.updateDocument.bind(this)}
/>
)}
</div>
)
}
......
......@@ -9,6 +9,7 @@ import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
import PopUpDelete from "./PopUpDelete";
import CreateManagementDoc from './CreateManagementDoc';
import EditManagementDoc from './EditManagementDoc';
var ct = require("../../library/CustomTable");
......@@ -24,6 +25,7 @@ export default class BOD extends Component {
this.state = {
dataTable: [],
visibleCreate: false,
visibleEdit: false,
refresh: '',
alert: false,
popupDel: false,
......@@ -125,10 +127,41 @@ export default class BOD extends Component {
})
}
if (type === 'edit') {
alert("edit")
this.setState({
id: this.state.docId[val],
rowData: index,
visibleEdit: true
})
}
}
updateDocument(payload) {
api.create().updateDocument(payload).then(response => {
console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
this.getData()
this.setState({ konfirmasi: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success', visibleEdit: false })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
closeAlert() {
this.setState({ alert: false })
}
......@@ -255,6 +288,15 @@ export default class BOD extends Component {
deleteDoc={this.deleteDoc.bind(this)}
/>
)}
{this.state.visibleEdit && (
<EditManagementDoc
type={"edit"}
onClickClose={() => this.setState({ visibleEdit: false })}
data={this.state.rowData}
idoc={this.state.id}
updateDocument={this.updateDocument.bind(this)}
/>
)}
</div>
)
}
......
......@@ -186,6 +186,9 @@ export default class DocumentManagement extends Component {
</div>
<div style={{ padding: 20 }}>
<Paper style={{ padding: 20 }}>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
{this.state.btncreate && <span>
<a data-tip={'Add'} data-for="add">
<div style={{ display: 'grid', justifyContent: 'flex-end' }}>
<button
type="button"
......@@ -195,6 +198,10 @@ export default class DocumentManagement extends Component {
<img src={Images.add} />
</button>
</div>
</a>
<ReactTooltip border={true} id="add" place="bottom" type="light" effect="solid" />
</span>}
</div>
<div style={{ display: 'flex' }}>
<Tabs
orientation="vertical"
......@@ -275,7 +282,6 @@ export default class DocumentManagement extends Component {
// getDataDocument={this.getDataDocument.bind(this)}
createDocument={this.createDocument.bind(this)}
setting_id={this.state.id}
btncreate={this.state.btncreate}
/>
)}
</div>
......
import React, { Component } from 'react'
import Images from '../../assets/Images'
import { TextField, withStyles, Snackbar } from '@material-ui/core'
import { TextField, withStyles, Snackbar, Typography } from '@material-ui/core'
import MuiAlert from '@material-ui/lab/Alert';
import api from '../../api'
import Autocomplete from '@material-ui/lab/Autocomplete'
......@@ -61,11 +61,11 @@ export default class EditManagementDoc extends Component {
categoryId: data.setting_id,
categoryName: data.values,
period: data.document_periode,
description: data.description
description: data.description,
// id: data.approval_matrix_id,
// status: data.status,
// created: data.created,
// updated: data.updated === null ? "" : data.updated
created: data.created,
updated: data.updated === null ? "" : data.updated
}, () => {
this.getDataCompany()
this.getDataDocument()
......@@ -225,8 +225,9 @@ export default class EditManagementDoc extends Component {
formData.append("documentPeriode", this.state.periode.periode);
formData.append("description", this.state.description);
formData.append("extension", this.state.fileType);
formData.append("documentId", this.props.idoc);
this.setState({ formData }, ()=> {
this.props.createDocument(this.state.formData, this.props.setting_id)
this.props.updateDocument(this.state.formData)
})
}
}
......@@ -368,6 +369,16 @@ export default class EditManagementDoc extends Component {
>
</TextField>
</div>
<div className="margin-top-10px" style={{ paddingLeft: 30, paddingRight: 30, borderRadius: 5, paddingBottom: 20 }}>
<div style={{ display: 'flex' }}>
<Typography style={{ fontSize: 11, width: '12%' }}>Created By</Typography>
<Typography style={{ fontSize: 11 }}>: {this.state.created}</Typography>
</div>
<div style={{ display: 'flex' }}>
<Typography style={{ fontSize: 11, width: '12%' }}>Updated By</Typography>
<Typography style={{ fontSize: 11 }}>: {this.state.updated == - null ? "" : this.state.updated}</Typography>
</div>
</div>
<div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1" style={{ alignSelf: 'center' }}>
<button
......
......@@ -161,6 +161,33 @@ export default class ManualBookTia extends Component {
})
}
updateDocument(payload) {
api.create().updateDocument(payload).then(response => {
console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
this.getData()
this.setState({ konfirmasi: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success', visibleEdit: false })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
render() {
let columns = [{
name: "Action",
......@@ -260,7 +287,7 @@ export default class ManualBookTia extends Component {
onClickClose={() => this.setState({ visibleEdit: false })}
data={this.state.rowData}
idoc={this.state.id}
// updateAM={this.updateAM.bind(this)}
updateDocument={this.updateDocument.bind(this)}
/>
)}
</div>
......
......@@ -9,6 +9,7 @@ import ReactTooltip from 'react-tooltip';
import api from '../../api';
import PopUpDelete from "./PopUpDelete";
import CreateManagementDoc from './CreateManagementDoc';
import EditManagementDoc from './EditManagementDoc';
var ct = require("../../library/CustomTable");
......@@ -24,6 +25,7 @@ export default class QReview extends Component {
this.state = {
dataTable: [],
visibleCreate: false,
visibleEdit: false,
refresh: '',
alert: false,
popupDel: false,
......@@ -121,7 +123,11 @@ export default class QReview extends Component {
})
}
if (type === 'edit') {
alert("edit")
this.setState({
id: this.state.docId[val],
rowData: index,
visibleEdit: true
})
}
}
......@@ -157,6 +163,33 @@ export default class QReview extends Component {
})
}
updateDocument(payload) {
api.create().updateDocument(payload).then(response => {
console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
this.getData()
this.setState({ konfirmasi: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success', visibleEdit: false })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
render() {
let columns = [{
name: "Action",
......@@ -247,6 +280,15 @@ export default class QReview extends Component {
deleteDoc={this.deleteDoc.bind(this)}
/>
)}
{this.state.visibleEdit && (
<EditManagementDoc
type={"edit"}
onClickClose={() => this.setState({ visibleEdit: false })}
data={this.state.rowData}
idoc={this.state.id}
updateDocument={this.updateDocument.bind(this)}
/>
)}
</div>
)
}
......
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