Commit 056df3b5 authored by Riri Novita's avatar Riri Novita

Update

parent 3e43fc8f
......@@ -56,6 +56,7 @@ const Images = {
dotOverdue: require('./dot-overdue.svg'),
dotOpen: require('./dot-open.svg'),
zip: require('./zip.png'),
warning: require('./warning.png'),
}
export default Images
\ No newline at end of file
......@@ -312,7 +312,6 @@ export default class BudgetTahunan extends Component {
"report_type": "Master Budget",
"currency_id": this.state.defaultCurrency.id
}
// console.log(payload);
api.create().getReportTypeBody(payload).then(response => {
// console.log(response);
if (response.data) {
......@@ -2316,7 +2315,7 @@ export default class BudgetTahunan extends Component {
// console.log(data);
// // // console.log(JSON.stringify(data));
api.create('UPLOAD').createSubmitReport(data).then(response => {
// console.log(response);
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
......@@ -2518,7 +2517,7 @@ export default class BudgetTahunan extends Component {
// }
async handleGenerateReport(data) {
let { selectReport, submissionID, company, periode, month, downloadedFileReportId } = this.state
let { selectReport, submissionID, company, periode, month, downloadedFileReportId, defaultCurrency } = this.state
if (selectReport.length > 0) {
let result = []
// console.log('mulai hit')
......@@ -2526,8 +2525,8 @@ export default class BudgetTahunan extends Component {
let datas = data.findIndex((val) => val[4] == items)
let report = data[datas]
if (items === 6) {
let resReal = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/master_budget/export_master_budget?submission_id=${submissionID}&company_id=${company.company_id}&year=${periode.periode}&revision=${report[2]}&report_id=${report[4]}&download_file_report_id=${downloadedFileReportId}`
let resNull = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/master_budget/export_master_budget?submission_id=&&company_id=${company.company_id}&year=${periode.periode}&revision=${report[2]}&report_id=${report[4]}&download_file_report_id=${downloadedFileReportId}`
let resReal = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/master_budget/export_master_budget?submission_id=${submissionID}&company_id=${company.company_id}&year=${periode.periode}&revision=${report[2]}&report_id=${report[4]}&download_file_report_id=${downloadedFileReportId}&currency_id=${defaultCurrency.id}`
let resNull = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/cash_flow/master_budget/export_master_budget?submission_id=&&company_id=${company.company_id}&year=${periode.periode}&revision=${report[2]}&report_id=${report[4]}&download_file_report_id=${downloadedFileReportId}&currency_id=${defaultCurrency.id}`
let res = await fetch(
submissionID == null ? resNull : resReal
......@@ -2541,8 +2540,8 @@ export default class BudgetTahunan extends Component {
result = [...result, res];
}
} else {
let resReal = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID}&report_id=${report[4]}&company_id=${company.company_id}&year=${periode.periode}&revision=${report[2]}&download_file_report_id=${downloadedFileReportId}`
let resNull = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=&report_id=${report[4]}&company_id=${company.company_id}&year=${periode.periode}&revision=${report[2]}&download_file_report_id=${downloadedFileReportId}`
let resReal = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${submissionID}&report_id=${report[4]}&company_id=${company.company_id}&year=${periode.periode}&revision=${report[2]}&download_file_report_id=${downloadedFileReportId}&currency_id=${defaultCurrency.id}`
let resNull = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=&report_id=${report[4]}&company_id=${company.company_id}&year=${periode.periode}&revision=${report[2]}&download_file_report_id=${downloadedFileReportId}&currency_id=${defaultCurrency.id}`
let res = await fetch(
submissionID == null ? resNull : resReal
......@@ -2604,7 +2603,7 @@ export default class BudgetTahunan extends Component {
async handleZip() {
// console.log('mulai zip')
api.create().createZipReport(this.state.downloadedFileReportId).then((response) => {
// console.log(response)
console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
......@@ -2968,12 +2967,15 @@ export default class BudgetTahunan extends Component {
options={this.state.currency}
getOptionLabel={(option) => option.value}
value={this.state.defaultCurrency}
onChange={(event, newInputValue) => this.setState({ defaultCurrency: newInputValue })}
// onChange={(event, newInputValue) => this.setState({ defaultCurrency: newInputValue })}
onChange={(event, newInputValue) => this.setState({ defaultCurrency: newInputValue }, () => {
this.getRevision()
})}
renderInput={(params) =>
<TextField
{...params}
variant="standard"
label="Default Currency"
label="Currency"
margin="normal"
style={{ marginTop: 6 }}
// InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
......@@ -3387,6 +3389,7 @@ export default class BudgetTahunan extends Component {
width={this.props.width}
company={this.state.company}
defaultCurrency={this.state.defaultCurrency}
currency={this.state.currency}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
submissionID={this.state.submissionID}
......@@ -3434,6 +3437,7 @@ export default class BudgetTahunan extends Component {
width={this.props.width}
company={this.state.company}
defaultCurrency={this.state.defaultCurrency}
currency={this.state.currency}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
submissionID={this.state.submissionID}
......@@ -3457,6 +3461,7 @@ export default class BudgetTahunan extends Component {
width={this.props.width}
company={this.state.company}
defaultCurrency={this.state.defaultCurrency}
currency={this.state.currency}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
submissionID={this.state.submissionID}
......@@ -3480,6 +3485,7 @@ export default class BudgetTahunan extends Component {
width={this.props.width}
company={this.state.company}
defaultCurrency={this.state.defaultCurrency}
currency={this.state.currency}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
submissionID={this.state.submissionID}
......@@ -3506,6 +3512,7 @@ export default class BudgetTahunan extends Component {
width={this.props.width}
company={this.state.company}
defaultCurrency={this.state.defaultCurrency}
currency={this.state.currency}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
submissionID={this.state.submissionID}
......
......@@ -64,7 +64,8 @@ export default class ProfitLoss extends Component {
buttonDraft: true,
handleDoubleClick: 0,
fromUpload: false,
defaultCurrencyUpload: this.props.defaultCurrency
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
}
this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this);
......@@ -250,6 +251,7 @@ export default class ProfitLoss extends Component {
}
backToMasterBudget(type) {
// tambahin currency
let data = []
this.state.dataTable.map(i => {
data.push({
......@@ -278,10 +280,11 @@ export default class ProfitLoss 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,
"profit_loss": data
}
// console.log(data);
console.log(payload);
this.setState({ loading: false })
if (type == 'submitted') {
this.props.saveToMasterBudget(payload, 'PL')
......@@ -359,10 +362,10 @@ export default class ProfitLoss extends Component {
checkUpload() {
let payload = {
...this.state.payload,
currency_id : this.state.defaultCurrencyUpload?.id
currency_id: this.state.defaultCurrencyUpload?.id
}
api.create().checkUploadMB(payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
console.log(JSON.stringify(this.state.payload));
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
......@@ -407,7 +410,7 @@ export default class ProfitLoss extends Component {
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', visibleAlertSave: true, loading: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
......@@ -449,6 +452,7 @@ export default class ProfitLoss 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,
profit_loss: data,
status: type
}
......@@ -533,6 +537,7 @@ export default class ProfitLoss 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,
"profit_loss": data,
"status": "submitted"
}
......@@ -554,7 +559,7 @@ export default class ProfitLoss extends Component {
render() {
let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta, type) => {
console.log(dataTable2);
// console.log(dataTable2);
let val = String(value).split(",").join("")
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
}
......@@ -3027,6 +3032,7 @@ export default class ProfitLoss extends Component {
this.backToMasterBudget('draft')
})
}
>
<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>
......@@ -3035,13 +3041,16 @@ export default class ProfitLoss extends Component {
<button
type="button"
disabled={this.state.buttonError}
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.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')
// })}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
......@@ -3243,6 +3252,43 @@ export default class ProfitLoss extends Component {
</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({ popupDownload: 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>
);
}
......
......@@ -97,10 +97,11 @@ export default class ReportItems extends Component {
formula_ytd: item[13] === undefined ? "" : item[13],
start_date: item[14] === undefined ? "" : item[14],
end_date: item[15] === undefined ? "" : item[15],
is_can_convert_value: item[16] === undefined ? "" : item[16],
is_can_convert_value: item[16] === undefined ? "" : item[16] === "Yes" || item[16] === "yes" ? 1 : 0,
})
}
})
console.log(payload);
let body = {
item_report: payload
}
......@@ -142,7 +143,7 @@ export default class ReportItems extends Component {
item.formula_ytd,
item.start_date,
item.end_date,
item.is_can_convert_value,
item.is_can_convert_value == 1 ? "Yes" : "No",
item.error,
]
})
......@@ -537,7 +538,7 @@ export default class ReportItems extends Component {
customBodyRender: (val, tableMeta) => {
let check = null
if (tableMeta.rowData[17] != null) {
check = tableMeta.rowData[17].findIndex((val) => val.field.includes('company'))
check = tableMeta.rowData[17].findIndex((val) => val.field.includes('is_can_convert_value'))
if (check > -1) {
this.setState({ buttonError: true })
}
......
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