Commit 2469e397 authored by Riri Novita's avatar Riri Novita

Fixing Parameter

parent 7777ddf3
......@@ -11,6 +11,7 @@ import { ExcelRenderer } from 'react-excel-renderer';
import * as R from 'ramda'
import MuiAlert from '@material-ui/lab/Alert';
import Constant from '../../library/Constant';
import { Autocomplete } from '@material-ui/lab';
const LightTooltip = withStyles((theme) => ({
tooltip: {
......@@ -58,6 +59,8 @@ export default class BalanceSheet extends Component {
alert: false,
tipeAlert: '',
messageAlert: '',
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -263,6 +266,7 @@ export default class BalanceSheet extends Component {
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"currency_id": this.props.defaultCurrency.id,
"status": type,
"balance_sheet": data
}
......@@ -352,7 +356,11 @@ export default class BalanceSheet extends Component {
}
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)
if (response.data) {
if (response.data.status === 'success') {
......@@ -441,6 +449,7 @@ export default class BalanceSheet extends Component {
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
currency_id: this.state.defaultCurrencyUpload?.id,
balance_sheet: data,
status: type
}
......@@ -466,7 +475,7 @@ export default class BalanceSheet extends Component {
this.props.getReport()
}
} 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")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
......@@ -528,6 +537,7 @@ export default class BalanceSheet extends Component {
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"currency_id": this.props.defaultCurrency.id,
"balance_sheet": data,
"status": "submitted"
}
......@@ -3769,21 +3779,83 @@ export default class BalanceSheet extends Component {
</button>
</div>
</div>
<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 className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '20px 30px' }}>
<div className="column-1">
<Autocomplete
id="tipe"
disableClearable
options={this.props.currency}
getOptionLabel={(option) => option.value}
value={this.state.defaultCurrencyUpload}
onChange={(event, newInputValue) => this.setState({ defaultCurrencyUpload: newInputValue })}
renderInput={(params) =>
<TextField
{...params}
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>
)}
......
......@@ -320,10 +320,10 @@ export default class BudgetTahunan extends Component {
let indexC = String(item.current_status).toLocaleUpperCase().indexOf('C')
let status_approv = ''
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)}`
} else {
// console.log("tes 2");
console.log("tes 2");
status_approv = String(item.current_status)
}
const handleOpbal = (item) => {
......@@ -335,6 +335,9 @@ export default class BudgetTahunan extends Component {
}
return isUpload
}
console.log(this.state.lastStatus);
console.log(this.state.isSubmit);
console.log(status_approv);
return [
item.number,
item.report_name === 'CAT' ? 'Corporate Annual Target' : item.report_name,
......@@ -2310,8 +2313,8 @@ export default class BudgetTahunan extends Component {
this.setState({ loading: true }, () => {
document.body.style.overflow = 'hidden';
})
// console.log(data);
// // // console.log(JSON.stringify(data));
console.log(data);
// // console.log(JSON.stringify(data));
api.create('UPLOAD').createSubmitReport(data).then(response => {
console.log(response);
if (response.data) {
......
......@@ -84,7 +84,7 @@ export default class ProfitLoss extends Component {
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"submission_id": this.props.submissionID,
"currency_id": this.props.defaultCurrency.id
// "currency_id": this.props.defaultCurrency.id
}
api.create().getLastestUpdateMB(payload).then(response => {
if (response.data) {
......@@ -3041,16 +3041,13 @@ export default class ProfitLoss extends Component {
<button
type="button"
disabled={this.state.buttonError}
onClick={() =>
this.setState({ visibleAlertSave: true })
}
// onClick={() => this.state.buttonError ?
// this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
// :
// this.state.handleDoubleClick == 1 ? null :
// this.setState({ handleDoubleClick: 1 }, () => {
// this.backToMasterBudget('submitted')
// })}
onClick={() => this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
this.backToMasterBudget('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
......
......@@ -93,7 +93,6 @@ export default class TaxPlanning extends Component {
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"submission_id": this.props.submissionID,
"currency_id": this.props.defaultCurrency.id
}
api.create().getLastestUpdateMB(payload).then(response => {
console.log(response)
......@@ -354,6 +353,7 @@ export default class TaxPlanning extends Component {
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"currency_id": this.props.defaultCurrency.id,
"status": type,
"tax_planning": data
}
......@@ -468,6 +468,10 @@ export default class TaxPlanning extends Component {
}
checkUpload() {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
api.create().checkUploadMB(this.state.payload).then(response => {
// console.log(this.state.payload);
// console.log(response)
......@@ -625,6 +629,7 @@ export default class TaxPlanning extends Component {
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
currency_id: this.props.defaultCurrency.id,
tax_planning: data,
status: type
}
......@@ -737,6 +742,7 @@ export default class TaxPlanning extends Component {
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"currency_id": this.props.defaultCurrency.id,
"tax_planning": data,
"status": "submitted"
}
......
......@@ -609,7 +609,7 @@ export default class CreateParameter extends Component {
"setting_group_id": this.state.getTypes.setting_group_id,
"setting_type_id": this.state.getParameter.setting_type_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,
"orders": this.state.tempData.order,
"value": this.state.tempData.value,
......@@ -627,7 +627,7 @@ export default class CreateParameter extends Component {
"setting_group_id": this.state.getTypes.setting_group_id,
"setting_type_id": this.state.getParameter.setting_type_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,
"orders": this.state.order,
"value": this.state.value,
......@@ -636,7 +636,7 @@ export default class CreateParameter extends Component {
"start_date": this.state.startDate,
"end_date": this.state.endDate
}
// console.log(body);
console.log(body);
this.props.createParameter(body)
}
......
......@@ -198,6 +198,7 @@ export default class Parameter extends Component {
createParameter = (payload) => {
this.setState({ visibleCreate: false })
api.create().createParameter(payload).then(response => {
console.log(response);
if (response.data) {
if (response.ok) {
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