Commit 78d155a1 authored by Deni Rinaldi's avatar Deni Rinaldi

last but not least

parent 0932a41f
...@@ -170,7 +170,7 @@ export default class BudgetTahunan extends Component { ...@@ -170,7 +170,7 @@ export default class BudgetTahunan extends Component {
item.number, item.number,
item.report_name, item.report_name,
item.revision, item.revision,
item.current_status, this.state.isSubmit === false ? "CLOSED" : item.current_status,
item.report_id, item.report_id,
Number(item.revision) > 0 ? (item.current_status == "not-yet" ? false : item.is_can_upload) : item.is_can_upload, Number(item.revision) > 0 ? (item.current_status == "not-yet" ? false : item.is_can_upload) : item.is_can_upload,
item.revision item.revision
...@@ -184,9 +184,7 @@ export default class BudgetTahunan extends Component { ...@@ -184,9 +184,7 @@ export default class BudgetTahunan extends Component {
] ]
}) })
// console.log(dataTable); // console.log(dataTable);
this.setState({ dataTable, loading: false, dataTableRevision, dataForRevision: response.data.data }, () => { this.setState({ dataTable, loading: false, dataTableRevision, dataForRevision: response.data.data })
this.getLatestPeriodSubmit()
})
} }
} else { } else {
this.setState({ loading: false }) this.setState({ loading: false })
...@@ -203,7 +201,10 @@ export default class BudgetTahunan extends Component { ...@@ -203,7 +201,10 @@ export default class BudgetTahunan extends Component {
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 }, () => {
this.getReport()
this.getReportAttachment()
})
} }
} }
}) })
...@@ -375,8 +376,7 @@ export default class BudgetTahunan extends Component { ...@@ -375,8 +376,7 @@ export default class BudgetTahunan extends Component {
}, () => { }, () => {
console.log(this.state.lastStatus); console.log(this.state.lastStatus);
this.historyApproval() this.historyApproval()
this.getReport() this.getLatestPeriodSubmit()
this.getReportAttachment()
api.create().checkApprover().then(response => { api.create().checkApprover().then(response => {
// console.log(response); // console.log(response);
if (response.data.data.is_approver === true) { if (response.data.data.is_approver === true) {
...@@ -539,8 +539,7 @@ export default class BudgetTahunan extends Component { ...@@ -539,8 +539,7 @@ export default class BudgetTahunan extends Component {
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ visibleUpload: false }, () => { this.setState({ visibleUpload: false }, () => {
this.getReport() this.getSubmission()
this.getReportAttachment()
}) })
} }
} }
...@@ -551,8 +550,7 @@ export default class BudgetTahunan extends Component { ...@@ -551,8 +550,7 @@ export default class BudgetTahunan extends Component {
api.create().deleteAttachment(item.attachment_id).then(response => { api.create().deleteAttachment(item.attachment_id).then(response => {
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.getReport() this.getSubmission()
this.getReportAttachment()
} }
} }
}) })
...@@ -696,6 +694,8 @@ export default class BudgetTahunan extends Component { ...@@ -696,6 +694,8 @@ export default class BudgetTahunan extends Component {
<span>APPROVAL REVIEW</span> : <span>APPROVAL REVIEW</span> :
val === "not-yet" ? val === "not-yet" ?
<span>OPEN</span> : <span>OPEN</span> :
val === "CLOSED" ?
<span>CLOSED</span> :
<img src={Images.cross} style={{ width: 31, height: 24 }} /> <img src={Images.cross} style={{ width: 31, height: 24 }} />
} }
</div > </div >
...@@ -712,10 +712,11 @@ export default class BudgetTahunan extends Component { ...@@ -712,10 +712,11 @@ export default class BudgetTahunan extends Component {
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: tableMeta.rowData[5] ? 'pointer' : 'default', cursor: this.state.isSubmit === false ? 'default' : tableMeta.rowData[5] ? 'pointer' : 'default',
borderColor: 'transparent' borderColor: 'transparent'
}} }}
onClick={() => onClick={() =>
this.state.isSubmit === false ? null :
tableMeta.rowData[5] == true ? tableMeta.rowData[5] == true ?
this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3]) this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3])
: null : null
...@@ -725,7 +726,7 @@ export default class BudgetTahunan extends Component { ...@@ -725,7 +726,7 @@ export default class BudgetTahunan extends Component {
(tableMeta.rowData[5] ? '#5198ea' : 'GrayText') : (tableMeta.rowData[5] ? '#5198ea' : 'GrayText') :
(this.state.lastRevision == 0 ? (tableMeta.rowData[5] ? '#5198ea' : 'GrayText') : (this.state.lastRevision == 0 ? (tableMeta.rowData[5] ? '#5198ea' : 'GrayText') :
(tableMeta.rowData[3] !== 'submitted' ? '#5198ea' : 'GrayText'))} */} (tableMeta.rowData[3] !== 'submitted' ? '#5198ea' : 'GrayText'))} */}
<Typography style={{ color: tableMeta.rowData[5] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography> <Typography style={{ color: this.state.isSubmit === false ? 'GrayText' : tableMeta.rowData[5] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography>
</button> </button>
</div > </div >
); );
...@@ -952,13 +953,13 @@ export default class BudgetTahunan extends Component { ...@@ -952,13 +953,13 @@ export default class BudgetTahunan extends Component {
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: this.state.isSubmit === false ? 'default' : 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none' outline: 'none'
}} }}
onClick={() => this.setState({ visibleUpload: true })} onClick={() => this.state.isSubmit === false ? null : this.setState({ visibleUpload: true })}
> >
<Typography style={{ fontSize: '16px', color: '#5198ea' }}>Upload File</Typography> <Typography style={{ fontSize: '16px', color: this.state.isSubmit === false ? 'GrayText' : '#5198ea' }}>Upload File</Typography>
</button> </button>
</div> </div>
)} )}
...@@ -1001,14 +1002,14 @@ export default class BudgetTahunan extends Component { ...@@ -1001,14 +1002,14 @@ export default class BudgetTahunan extends Component {
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: this.state.isSubmit === false ? 'default' : 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
display: 'grid' display: 'grid'
}} }}
onClick={() => this.deleteAttachment(item)} onClick={() => this.state.isSubmit === false ? null : this.deleteAttachment(item)}
> >
<Typography style={{ fontSize: '13px', color: '#ff3939' }}>Delete</Typography> <Typography style={{ fontSize: '13px', color: this.state.isSubmit === false ? 'GrayText' : '#ff3939' }}>Delete</Typography>
</button> </button>
) )
}) })
......
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