Commit 836f886d authored by Riri Novita's avatar Riri Novita

Merge branch 'dev/riri' into 'ENV-DEV'

Fixing Parameter

See merge request !1806
parents ad60d078 70a8b289
...@@ -11,6 +11,7 @@ import { ExcelRenderer } from 'react-excel-renderer'; ...@@ -11,6 +11,7 @@ import { ExcelRenderer } from 'react-excel-renderer';
import * as R from 'ramda' import * as R from 'ramda'
import MuiAlert from '@material-ui/lab/Alert'; import MuiAlert from '@material-ui/lab/Alert';
import Constant from '../../library/Constant'; import Constant from '../../library/Constant';
import { Autocomplete } from '@material-ui/lab';
const LightTooltip = withStyles((theme) => ({ const LightTooltip = withStyles((theme) => ({
tooltip: { tooltip: {
...@@ -58,6 +59,8 @@ export default class BalanceSheet extends Component { ...@@ -58,6 +59,8 @@ export default class BalanceSheet extends Component {
alert: false, alert: false,
tipeAlert: '', tipeAlert: '',
messageAlert: '', messageAlert: '',
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -263,6 +266,7 @@ export default class BalanceSheet extends Component { ...@@ -263,6 +266,7 @@ export default class BalanceSheet extends Component {
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"periode": this.props.periode, "periode": this.props.periode,
"report_id": this.props.report_id, "report_id": this.props.report_id,
"currency_id": this.props.defaultCurrency.id,
"status": type, "status": type,
"balance_sheet": data "balance_sheet": data
} }
...@@ -352,7 +356,11 @@ export default class BalanceSheet extends Component { ...@@ -352,7 +356,11 @@ export default class BalanceSheet extends Component {
} }
checkUpload() { checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => { let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
api.create().checkUploadMB(payload).then(response => {
// console.log(response) // console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
...@@ -441,6 +449,7 @@ export default class BalanceSheet extends Component { ...@@ -441,6 +449,7 @@ export default class BalanceSheet extends Component {
company_id: this.props.company.company_id, company_id: this.props.company.company_id,
periode: this.props.periode, periode: this.props.periode,
report_id: this.props.report_id, report_id: this.props.report_id,
currency_id: this.state.defaultCurrencyUpload?.id,
balance_sheet: data, balance_sheet: data,
status: type status: type
} }
...@@ -466,7 +475,7 @@ export default class BalanceSheet extends Component { ...@@ -466,7 +475,7 @@ export default class BalanceSheet extends Component {
this.props.getReport() this.props.getReport()
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { this.setState({ visibleAlertSave: true, alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
...@@ -528,6 +537,7 @@ export default class BalanceSheet extends Component { ...@@ -528,6 +537,7 @@ export default class BalanceSheet extends Component {
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"periode": this.props.periode, "periode": this.props.periode,
"report_id": this.props.report_id, "report_id": this.props.report_id,
"currency_id": this.props.defaultCurrency.id,
"balance_sheet": data, "balance_sheet": data,
"status": "submitted" "status": "submitted"
} }
...@@ -3769,21 +3779,83 @@ export default class BalanceSheet extends Component { ...@@ -3769,21 +3779,83 @@ export default class BalanceSheet extends Component {
</button> </button>
</div> </div>
</div> </div>
<UploadFile <div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '20px 30px' }}>
type={this.state.uploadStatus} <div className="column-1">
percentage={this.state.percentage} <Autocomplete
result={this.state.result} id="tipe"
acceptedFiles={["xlsx"]} disableClearable
onHandle={(dt) => { options={this.props.currency}
this.fileHandler(dt) getOptionLabel={(option) => option.value}
this.setState({ uploadStatus: 'idle', percentage: '0' }) value={this.state.defaultCurrencyUpload}
}} onChange={(event, newInputValue) => this.setState({ defaultCurrencyUpload: newInputValue })}
onUpload={() => { renderInput={(params) =>
String(this.state.judul).includes("MASTER") && String(this.state.judul).includes("BUDGET") && String(this.state.judul).includes("BALANCE") && String(this.state.judul).includes("SHEET") ? <TextField
this.checkUpload() : {...params}
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' }) variant="standard"
}} label="Default Currency"
/> margin="normal"
style={{ marginBottom: 10 }}
// InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
// InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>
}
/>
</div>
</div>
<div style={{ padding: '10px 30px' }}>
<UploadFile
type={this.state.uploadStatus}
percentage={this.state.percentage}
result={this.state.result}
acceptedFiles={["xlsx"]}
onHandle={(dt) => {
this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
String(this.state.judul).includes("MASTER") && String(this.state.judul).includes("BUDGET") && String(this.state.judul).includes("BALANCE") && String(this.state.judul).includes("SHEET") ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
/>
</div>
</div>
</div>
)}
{this.state.visibleAlertSave && (
<div className="test app-popup-show">
<div className="popup-content border-radius" style={{ background: '#FFF27D', borderRadius: 10, width: 715, height: 238 }}>
<div style={{ margin: 30 }}>
<div style={{ display: 'flex', marginTop: 76, marginBottom: 43 }}>
<div style={{ alignSelf: 'center', marginRight: 25 }}>
<img src={Images.warning} />
</div>
<div style={{ justifyContent: 'center', fontSize: 20, color: '#1D2995', marginTop: 10 }}>
<b>Rate Currency USD</b> pada periode yang dipilih <b>belum</b> diatur.<br /> Silahkan menghubungi Superadmin
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<button
className="button"
type="button"
style={{
background: '#F6F7F9',
cursor: 'pointer',
border: '1px solid #3549609e',
outline: 'none',
marginRight: 20,
borderRadius: 9
}}
onClick={() => this.setState({ visibleAlertSave: false })}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 30, borderRadius: 9, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #3549609e' }}>
<Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
</div>
</button>
</div>
</div>
</div> </div>
</div> </div>
)} )}
......
...@@ -320,10 +320,10 @@ export default class BudgetTahunan extends Component { ...@@ -320,10 +320,10 @@ export default class BudgetTahunan extends Component {
let indexC = String(item.current_status).toLocaleUpperCase().indexOf('C') let indexC = String(item.current_status).toLocaleUpperCase().indexOf('C')
let status_approv = '' let status_approv = ''
if (String(item.current_status).toLocaleUpperCase().includes('CC')) { if (String(item.current_status).toLocaleUpperCase().includes('CC')) {
// console.log("tes 1"); console.log("tes 1");
status_approv = `${String(item.current_status).substr(0, indexC)}${String(item.current_status).substr(indexC + 1, String(item.current_status).length)}` status_approv = `${String(item.current_status).substr(0, indexC)}${String(item.current_status).substr(indexC + 1, String(item.current_status).length)}`
} else { } else {
// console.log("tes 2"); console.log("tes 2");
status_approv = String(item.current_status) status_approv = String(item.current_status)
} }
const handleOpbal = (item) => { const handleOpbal = (item) => {
...@@ -335,6 +335,9 @@ export default class BudgetTahunan extends Component { ...@@ -335,6 +335,9 @@ export default class BudgetTahunan extends Component {
} }
return isUpload return isUpload
} }
console.log(this.state.lastStatus);
console.log(this.state.isSubmit);
console.log(status_approv);
return [ return [
item.number, item.number,
item.report_name === 'CAT' ? 'Corporate Annual Target' : item.report_name, item.report_name === 'CAT' ? 'Corporate Annual Target' : item.report_name,
...@@ -2310,8 +2313,8 @@ export default class BudgetTahunan extends Component { ...@@ -2310,8 +2313,8 @@ export default class BudgetTahunan extends Component {
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
document.body.style.overflow = 'hidden'; document.body.style.overflow = 'hidden';
}) })
// console.log(data); console.log(data);
// // // console.log(JSON.stringify(data)); // // console.log(JSON.stringify(data));
api.create('UPLOAD').createSubmitReport(data).then(response => { api.create('UPLOAD').createSubmitReport(data).then(response => {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
......
...@@ -84,7 +84,7 @@ export default class ProfitLoss extends Component { ...@@ -84,7 +84,7 @@ export default class ProfitLoss extends Component {
"periode": this.props.periode, "periode": this.props.periode,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"submission_id": this.props.submissionID, "submission_id": this.props.submissionID,
"currency_id": this.props.defaultCurrency.id // "currency_id": this.props.defaultCurrency.id
} }
api.create().getLastestUpdateMB(payload).then(response => { api.create().getLastestUpdateMB(payload).then(response => {
if (response.data) { if (response.data) {
...@@ -3041,16 +3041,13 @@ export default class ProfitLoss extends Component { ...@@ -3041,16 +3041,13 @@ export default class ProfitLoss extends Component {
<button <button
type="button" type="button"
disabled={this.state.buttonError} disabled={this.state.buttonError}
onClick={() => onClick={() => this.state.buttonError ?
this.setState({ visibleAlertSave: true }) this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
} :
// onClick={() => this.state.buttonError ? this.state.handleDoubleClick == 1 ? null :
// this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) this.setState({ handleDoubleClick: 1 }, () => {
// : this.backToMasterBudget('submitted')
// this.state.handleDoubleClick == 1 ? null : })}
// this.setState({ handleDoubleClick: 1 }, () => {
// this.backToMasterBudget('submitted')
// })}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer', cursor: this.state.buttonError === true ? 'default' : 'pointer',
......
...@@ -93,7 +93,6 @@ export default class TaxPlanning extends Component { ...@@ -93,7 +93,6 @@ export default class TaxPlanning extends Component {
"periode": this.props.periode, "periode": this.props.periode,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"submission_id": this.props.submissionID, "submission_id": this.props.submissionID,
"currency_id": this.props.defaultCurrency.id
} }
api.create().getLastestUpdateMB(payload).then(response => { api.create().getLastestUpdateMB(payload).then(response => {
console.log(response) console.log(response)
...@@ -354,6 +353,7 @@ export default class TaxPlanning extends Component { ...@@ -354,6 +353,7 @@ export default class TaxPlanning extends Component {
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"periode": this.props.periode, "periode": this.props.periode,
"report_id": this.props.report_id, "report_id": this.props.report_id,
"currency_id": this.props.defaultCurrency.id,
"status": type, "status": type,
"tax_planning": data "tax_planning": data
} }
...@@ -468,6 +468,10 @@ export default class TaxPlanning extends Component { ...@@ -468,6 +468,10 @@ export default class TaxPlanning extends Component {
} }
checkUpload() { checkUpload() {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
api.create().checkUploadMB(this.state.payload).then(response => { api.create().checkUploadMB(this.state.payload).then(response => {
// console.log(this.state.payload); // console.log(this.state.payload);
// console.log(response) // console.log(response)
...@@ -625,6 +629,7 @@ export default class TaxPlanning extends Component { ...@@ -625,6 +629,7 @@ export default class TaxPlanning extends Component {
company_id: this.props.company.company_id, company_id: this.props.company.company_id,
periode: this.props.periode, periode: this.props.periode,
report_id: this.props.report_id, report_id: this.props.report_id,
currency_id: this.props.defaultCurrency.id,
tax_planning: data, tax_planning: data,
status: type status: type
} }
...@@ -737,6 +742,7 @@ export default class TaxPlanning extends Component { ...@@ -737,6 +742,7 @@ export default class TaxPlanning extends Component {
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"periode": this.props.periode, "periode": this.props.periode,
"report_id": this.props.report_id, "report_id": this.props.report_id,
"currency_id": this.props.defaultCurrency.id,
"tax_planning": data, "tax_planning": data,
"status": "submitted" "status": "submitted"
} }
......
...@@ -609,7 +609,7 @@ export default class CreateParameter extends Component { ...@@ -609,7 +609,7 @@ export default class CreateParameter extends Component {
"setting_group_id": this.state.getTypes.setting_group_id, "setting_group_id": this.state.getTypes.setting_group_id,
"setting_type_id": this.state.getParameter.setting_type_id, "setting_type_id": this.state.getParameter.setting_type_id,
"company_id": this.state.getPerusahaan.company_id, "company_id": this.state.getPerusahaan.company_id,
"reference_id": this.state.getReportName.setting_type_id, "reference_id": this.state.getReportName == null ? null : this.state.getReportName.setting_type_id,
"description": this.state.tempData.description, "description": this.state.tempData.description,
"orders": this.state.tempData.order, "orders": this.state.tempData.order,
"value": this.state.tempData.value, "value": this.state.tempData.value,
...@@ -627,7 +627,7 @@ export default class CreateParameter extends Component { ...@@ -627,7 +627,7 @@ export default class CreateParameter extends Component {
"setting_group_id": this.state.getTypes.setting_group_id, "setting_group_id": this.state.getTypes.setting_group_id,
"setting_type_id": this.state.getParameter.setting_type_id, "setting_type_id": this.state.getParameter.setting_type_id,
"company_id": this.state.getPerusahaan.company_id, "company_id": this.state.getPerusahaan.company_id,
"reference_id": this.state.getReportName.setting_type_id, "reference_id": this.state.getReportName == null ? null : this.state.getReportName.setting_type_id,
"description": this.state.description, "description": this.state.description,
"orders": this.state.order, "orders": this.state.order,
"value": this.state.value, "value": this.state.value,
...@@ -636,7 +636,7 @@ export default class CreateParameter extends Component { ...@@ -636,7 +636,7 @@ export default class CreateParameter extends Component {
"start_date": this.state.startDate, "start_date": this.state.startDate,
"end_date": this.state.endDate "end_date": this.state.endDate
} }
// console.log(body); console.log(body);
this.props.createParameter(body) this.props.createParameter(body)
} }
......
...@@ -198,6 +198,7 @@ export default class Parameter extends Component { ...@@ -198,6 +198,7 @@ export default class Parameter extends Component {
createParameter = (payload) => { createParameter = (payload) => {
this.setState({ visibleCreate: false }) this.setState({ visibleCreate: false })
api.create().createParameter(payload).then(response => { api.create().createParameter(payload).then(response => {
console.log(response);
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status == 'success') { if (response.data.status == 'success') {
......
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