Commit e57dcc56 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'faisal' into 'master'

update fam 240920 sore

See merge request !368
parents b6066f57 b9f82eca
......@@ -46,7 +46,8 @@ export default class FixedAssetsMovement extends Component {
disabledSave: true,
editable: false,
buttonError: false,
judulColumn: null
judulColumn: null,
updateBy: '-'
}
this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this);
......@@ -54,9 +55,29 @@ export default class FixedAssetsMovement extends Component {
componentDidMount() {
this.getItemHierarki()
this.getLatestUpdate()
console.log(this.props);
}
getLatestUpdate() {
let payload = {
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"submission_id": this.props.submissionID
}
api.create().getLastestUpdateMB(payload).then(response => {
if (response.data) {
if (response.data.status === "success") {
this.setState({
updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update
})
}
}
})
}
getItemHierarki() {
this.setState({ loading: true })
let payload = {
......@@ -180,22 +201,22 @@ export default class FixedAssetsMovement extends Component {
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
total_actual_before: String(i[6]),
january: String(i[7]),
february: String(i[8]),
march: String(i[9]),
april: String(i[10]),
may: String(i[11]),
june: String(i[12]),
july: String(i[13]),
august: String(i[14]),
september: String(i[15]),
october: String(i[16]),
november: String(i[17]),
december: String(i[18]),
total_current_year: String(i[19]),
total_next_year: String(i[20]),
total_more_year: String(i[21])
total_actual_before: String(Number(i[6]).toFixed(1)),
january: String(Number(i[7]).toFixed(1)),
february: String(Number(i[8]).toFixed(1)),
march: String(Number(i[9]).toFixed(1)),
april: String(Number(i[10]).toFixed(1)),
may: String(Number(i[11]).toFixed(1)),
june: String(Number(i[12]).toFixed(1)),
july: String(Number(i[13]).toFixed(1)),
august: String(Number(i[14]).toFixed(1)),
september: String(Number(i[15]).toFixed(1)),
october: String(Number(i[16]).toFixed(1)),
november: String(Number(i[17]).toFixed(1)),
december: String(Number(i[18]).toFixed(1)),
total_current_year: String(Number(i[19]).toFixed(1)),
total_next_year: String(Number(i[20]).toFixed(1)),
total_more_year: String(Number(i[21]).toFixed(1))
})
})
......@@ -207,7 +228,7 @@ export default class FixedAssetsMovement extends Component {
"status": type,
"fixed_asset_movement": data
}
console.log(data);
// console.log(data);
this.props.saveToMasterBudget(payload)
this.props.onClickClose()
}
......@@ -222,7 +243,7 @@ export default class FixedAssetsMovement extends Component {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Template Fixed Assets Movement.xlsx';
a.download = 'Template Master Budget Fixed Assets Movement.xlsx';
a.click();
}
}
......@@ -264,10 +285,12 @@ export default class FixedAssetsMovement extends Component {
}
})
let body = {
submission_id: this.props.submissionID,
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
fixed_asset_movement: payload
}
console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
......@@ -370,7 +393,8 @@ export default class FixedAssetsMovement extends Component {
}
async downloadAllData() {
console.log(this.props)
let url = `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}`
console.log(url);
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}`
)
......@@ -380,45 +404,45 @@ export default class FixedAssetsMovement extends Component {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Fixed Assets Movement.xlsx';
a.download = 'Master Budget Fixed Assets Movement.xlsx';
a.click();
}
}
handleValidate() {
let data = []
// console.log(this.state.dataTable)
console.log(this.state.dataTable)
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
total_actual_before: String(i[6]),
january: String(i[7]),
february: String(i[8]),
march: String(i[9]),
april: String(i[10]),
may: String(i[11]),
june: String(i[12]),
july: String(i[13]),
august: String(i[14]),
september: String(i[15]),
october: String(i[16]),
november: String(i[17]),
december: String(i[18]),
total_current_year: String(i[19]),
total_next_year: String(i[20]),
total_more_year: String(i[21])
january: i[0] === 3 && i[7] === "" ? "0" : String(i[7]),
february: i[0] === 3 && i[8] === "" ? "0" : String(i[8]),
march: i[0] === 3 && i[9] === "" ? "0" : String(i[9]),
april: i[0] === 3 && i[10] === "" ? "0" : String(i[10]),
may: i[0] === 3 && i[11] === "" ? "0" : String(i[11]),
june: i[0] === 3 && i[12] === "" ? "0" : String(i[12]),
july: i[0] === 3 && i[13] === "" ? "0" : String(i[13]),
august: i[0] === 3 && i[14] === "" ? "0" : String(i[14]),
september: i[0] === 3 && i[15] === "" ? "0" : String(i[15]),
october: i[0] === 3 && i[16] === "" ? "0" : String(i[16]),
november: i[0] === 3 && i[17] === "" ? "0" : String(i[17]),
december: i[0] === 3 && i[18] === "" ? "0" : String(i[18]),
total_current_year: i[0] === 3 && i[19] === "" ? "0" : String(i[19]),
total_next_year: i[0] === 3 && i[20] === "" ? "0" : String(i[20]),
total_more_year: i[0] === 3 && i[21] === "" ? "0" : String(i[21])
})
})
// 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,
fixed_asset_movement: data,
status: "submitted"
"submission_id": this.props.submissionID,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"fixed_asset_movement": data,
"status": "submitted"
}
console.log(payload)
// console.log(payload)
api.create().validateSubmitReport(payload).then((response) => {
console.log(response)
if (response.data.data.result) {
......@@ -609,7 +633,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={value}
value={Number(value).toFixed(1)}
/>
}
/>
......@@ -642,7 +666,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
console.log(dataTable2)
......@@ -659,7 +683,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -730,7 +754,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -748,7 +772,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -819,7 +843,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -837,7 +861,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -908,7 +932,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -926,7 +950,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -997,7 +1021,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1015,7 +1039,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1086,7 +1110,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1104,7 +1128,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1175,7 +1199,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1193,7 +1217,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1264,7 +1288,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1282,7 +1306,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1353,7 +1377,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1371,7 +1395,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1442,7 +1466,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1460,7 +1484,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1531,7 +1555,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1549,7 +1573,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1620,7 +1644,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1638,7 +1662,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1707,7 +1731,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span> :
<span style={{ fontSize: 12, textAlign: 'right' }}>
......@@ -1717,7 +1741,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleTotal(tableMeta)}
value={Number(handleTotal(tableMeta)).toFixed(1)}
/>
</span>}
</div>
......@@ -1747,7 +1771,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1765,7 +1789,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1836,7 +1860,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={Number(value).toFixed(1)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1854,7 +1878,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={handleValue(tableMeta)}
value={Number(handleValue(tableMeta)).toFixed(1)}
/>
</span>
:
......@@ -1918,19 +1942,19 @@ export default class FixedAssetsMovement extends Component {
return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Pengajuan Budget Tahunan</Typography>
<Typography style={{ fontSize: '16px', color: 'white' }}>Master Budget Submission</Typography>
</div>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert}
</Alert>
</Snackbar>
{this.state.loading && loadingComponent}
{/* {this.state.loading && loadingComponent} */}
<div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visibleFixedAssetsMovement === true ?
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Budget Tahunan - Fixed Assets Movement</Typography>
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Fixed Assets Movement</Typography>
</div>
<div style={{ padding: 20 }}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
......@@ -1993,43 +2017,19 @@ export default class FixedAssetsMovement extends Component {
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
{this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>}
</MuiThemeProvider>
</div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography>
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
<button
type="button"
onClick={() => this.state.editable === true ?
this.setState({ loading: true }, () => {
setTimeout(() => {
this.backToMasterBudget('draft')
}, 100);
}) :
this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 100);
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%'}}>
<button
className="button"
type="button"
......@@ -2046,10 +2046,12 @@ export default class FixedAssetsMovement extends Component {
}, 100);
})}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
</div>
</button>
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%'}}>
<button
className="button"
type="button"
......@@ -2073,6 +2075,32 @@ export default class FixedAssetsMovement extends Component {
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
className="button"
type="button"
onClick={() => this.state.editable === true ?
this.setState({ loading: true }, () => {
setTimeout(() => {
this.backToMasterBudget('draft')
}, 100);
}) :
this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 100);
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
// disabled={this.state.buttonError}
......@@ -2110,13 +2138,14 @@ export default class FixedAssetsMovement extends Component {
</div>
{this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
{this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>}
</MuiThemeProvider>
</div>
)}
</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