Commit ab9fa1c1 authored by Riri Novita's avatar Riri Novita

update code

parent 53dea80a
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -486,7 +486,7 @@ export default class ProfitLoss extends Component { ...@@ -486,7 +486,7 @@ export default class ProfitLoss 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({ visibleUpload: false, visibleProfitLoss: false, loading: true, visibleButtonUpload: true }) this.setState({ visibleUploadSimulasi: false, visibleProfitLoss: false, loading: true, visibleButtonUpload: true })
let dataTable = response.data.data.map((item, index) => { let dataTable = response.data.data.map((item, index) => {
return [ return [
item.type_report_id, item.type_report_id,
...@@ -3261,129 +3261,222 @@ export default class ProfitLoss extends Component { ...@@ -3261,129 +3261,222 @@ export default class ProfitLoss extends Component {
</div> </div>
</Paper> </Paper>
: :
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}> this.state.visibleButtonUpload === true ?
<div> <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ padding: 25 }}> <div>
<div> <div style={{ padding: 25 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
{this.props.defaultCurrency.id === 1 ? <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> {this.props.defaultCurrency.id === 1 ?
: <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography> :
} <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
</div> }
{this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.loading && loadingComponent}
{!this.state.loading && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div> </div>
)} {this.state.dataLoaded && (
</div> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.loading && loadingComponent}
<div className="grid grid-2x" style={{ marginTop: 20 }}> {!this.state.loading && (
<div className="col-1"> <MuiThemeProvider theme={getMuiTheme()}>
<button <MUIDataTable
type="button" data={dataTable2}
onClick={() => this.setState({ loading: true, dataTable: [], fromUpload: false }, () => { columns={columns}
setTimeout(() => { options={options}
this.getItemHierarki() />
}, 100); </MuiThemeProvider>
})} )}
style={{ marginRight: 20 }}
>
<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> </div>
</button> )}
</div> </div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button <div className="grid grid-2x" style={{ marginTop: 20 }}>
className="button" <div className="col-1">
type="button" <button
disabled={this.state.buttonError} type="button"
style={{ onClick={() => this.setState({ loading: true, dataTable: [], fromUpload: false }, () => {
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false }) this.getItemHierarki()
}, 100); }, 100);
}) })}
}} style={{ marginRight: 20 }}
> >
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div> </div>
</button> </button>
<button </div>
type="button" <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
style={{ <button
backgroundColor: 'transparent', className="button"
cursor: this.state.editable !== true ? 'pointer' : 'default', type="button"
borderColor: 'transparent', disabled={this.state.buttonError}
outline: 'none', style={{
marginRight: 20 backgroundColor: 'transparent',
}} cursor: this.state.buttonError === true ? 'default' : 'pointer',
onClick={() => borderColor: 'transparent',
this.state.editable === true ? outline: 'none',
null : marginRight: 20
this.setState({ loading: true, fromUpload: false }, () => }}
this.state.handleDoubleClick == 1 ? null : onClick={() => {
this.setState({ handleDoubleClick: 1 }, () => { this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.uploadProfitLoss('draft') this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false })
}, 100); }, 100);
}) })
) }}
} >
> <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography> </div>
</div> </button>
</button> <button
<button type="button"
type="button" // disabled={this.state.buttonError}
style={{ onClick={() =>
backgroundColor: 'transparent', this.setState({ handleDoubleClick: 1, loading: true }, () => {
cursor: this.state.editable !== true ? 'pointer' : 'default', this.uploadSimulasi('submitted')
borderColor: 'transparent', })}
outline: 'none',
}} style={{
onClick={() => backgroundColor: 'transparent',
this.state.editable === true ? cursor: 'pointer',
null : borderColor: 'transparent',
this.setState({ loading: true, fromUpload: false }, () => outline: 'none',
this.state.handleDoubleClick == 1 ? null : }}
this.setState({ handleDoubleClick: 1 }, () => { >
setTimeout(() => { <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
this.uploadProfitLoss('submitted') <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save Data</Typography>
}, 100); </div>
}) </button>
) </div>
</div>
</div>
</Paper>
:
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div>
<div style={{ padding: 25 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode}</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
} }
> </div>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> {this.state.dataLoaded && (
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.loading && loadingComponent}
{!this.state.loading && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div> </div>
</button> )}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
<button
type="button"
onClick={() => this.setState({ loading: true, dataTable: [], fromUpload: false }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 100);
})}
style={{ marginRight: 20 }}
>
<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"
disabled={this.state.buttonError}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false })
}, 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' }}>Calculate</Typography>
</div>
</button>
<button
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.editable === true ?
null :
this.setState({ loading: true, fromUpload: false }, () =>
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
setTimeout(() => {
this.uploadProfitLoss('draft')
}, 100);
})
)
}
>
<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"
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() =>
this.state.editable === true ?
null :
this.setState({ loading: true, fromUpload: false }, () =>
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
setTimeout(() => {
this.uploadProfitLoss('submitted')
}, 100);
})
)
}
>
<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 & Complete</Typography>
</div>
</button>
</div>
</div> </div>
</div> </div>
</div> </Paper>}
</Paper>}
</div> </div>
{/* {this.state.visibleUpload && ( {/* {this.state.visibleUpload && (
...@@ -3503,7 +3596,7 @@ export default class ProfitLoss extends Component { ...@@ -3503,7 +3596,7 @@ export default class ProfitLoss extends Component {
}} }}
/> />
</div> </div>
{this.state.visibleButtonUpload && {/* {this.state.visibleButtonUpload &&
<div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}> <div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}>
<div> <div>
<button <button
...@@ -3527,7 +3620,7 @@ export default class ProfitLoss extends Component { ...@@ -3527,7 +3620,7 @@ export default class ProfitLoss extends Component {
</button> </button>
</div> </div>
</div> </div>
} } */}
{/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */} {/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */}
</div> </div>
</div> </div>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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