IO-952 add confirm to bill enter with discrepancy.
This commit is contained in:
@@ -2779,6 +2779,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>savewithdiscrepancy</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>state_tax</name>
|
<name>state_tax</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -18,8 +18,10 @@ import {
|
|||||||
selectBodyshop,
|
selectBodyshop,
|
||||||
selectCurrentUser,
|
selectCurrentUser,
|
||||||
} from "../../redux/user/user.selectors";
|
} from "../../redux/user/user.selectors";
|
||||||
|
import confirmDialog from "../../utils/asyncConfirm";
|
||||||
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
import BillFormContainer from "../bill-form/bill-form.container";
|
import BillFormContainer from "../bill-form/bill-form.container";
|
||||||
|
import { CalculateBillTotal } from "../bill-form/bill-form.totals.utility";
|
||||||
import { handleUpload } from "../documents-upload/documents-upload.utility";
|
import { handleUpload } from "../documents-upload/documents-upload.utility";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
@@ -66,6 +68,13 @@ function BillEnterModalContainer({
|
|||||||
}, [billEnterModal, bodyshop]);
|
}, [billEnterModal, bodyshop]);
|
||||||
|
|
||||||
const handleFinish = async (values) => {
|
const handleFinish = async (values) => {
|
||||||
|
let totals = CalculateBillTotal(values);
|
||||||
|
if (totals.discrepancy.getAmount() !== 0) {
|
||||||
|
if (!(await confirmDialog(t("bills.labels.savewithdiscrepancy")))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const { upload, location, ...remainingValues } = values;
|
const { upload, location, ...remainingValues } = values;
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import {
|
|||||||
selectBodyshop,
|
selectBodyshop,
|
||||||
selectCurrentUser,
|
selectCurrentUser,
|
||||||
} from "../../redux/user/user.selectors";
|
} from "../../redux/user/user.selectors";
|
||||||
|
import confirmDialog from "../../utils/asyncConfirm";
|
||||||
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import JobsAvailableScan from "../jobs-available-scan/jobs-available-scan.component";
|
import JobsAvailableScan from "../jobs-available-scan/jobs-available-scan.component";
|
||||||
@@ -394,14 +395,6 @@ function replaceEmpty(someObj, replaceValue = null) {
|
|||||||
return JSON.parse(temp);
|
return JSON.parse(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
function confirmDialog(msg) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
let confirmed = window.confirm(msg);
|
|
||||||
|
|
||||||
return confirmed ? resolve(true) : resolve(false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async function CheckTaxRates(estData, bodyshop) {
|
async function CheckTaxRates(estData, bodyshop) {
|
||||||
//LKQ Check
|
//LKQ Check
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -179,6 +179,7 @@
|
|||||||
"noneselected": "No bill selected.",
|
"noneselected": "No bill selected.",
|
||||||
"onlycmforinvoiced": "Only credit memos can be entered for any job that has been invoiced, exported, or voided.",
|
"onlycmforinvoiced": "Only credit memos can be entered for any job that has been invoiced, exported, or voided.",
|
||||||
"retailtotal": "Bills Retail Total",
|
"retailtotal": "Bills Retail Total",
|
||||||
|
"savewithdiscrepancy": "You are about to save this bill with a discrepancy. The system will continue to use the calculated amount using the bill lines. Press cancel to return to the bill.",
|
||||||
"state_tax": "Provincial/State Tax",
|
"state_tax": "Provincial/State Tax",
|
||||||
"subtotal": "Subtotal",
|
"subtotal": "Subtotal",
|
||||||
"totalreturns": "Total Returns"
|
"totalreturns": "Total Returns"
|
||||||
|
|||||||
@@ -179,6 +179,7 @@
|
|||||||
"noneselected": "",
|
"noneselected": "",
|
||||||
"onlycmforinvoiced": "",
|
"onlycmforinvoiced": "",
|
||||||
"retailtotal": "",
|
"retailtotal": "",
|
||||||
|
"savewithdiscrepancy": "",
|
||||||
"state_tax": "",
|
"state_tax": "",
|
||||||
"subtotal": "",
|
"subtotal": "",
|
||||||
"totalreturns": ""
|
"totalreturns": ""
|
||||||
|
|||||||
@@ -179,6 +179,7 @@
|
|||||||
"noneselected": "",
|
"noneselected": "",
|
||||||
"onlycmforinvoiced": "",
|
"onlycmforinvoiced": "",
|
||||||
"retailtotal": "",
|
"retailtotal": "",
|
||||||
|
"savewithdiscrepancy": "",
|
||||||
"state_tax": "",
|
"state_tax": "",
|
||||||
"subtotal": "",
|
"subtotal": "",
|
||||||
"totalreturns": ""
|
"totalreturns": ""
|
||||||
|
|||||||
9
client/src/utils/asyncConfirm.js
Normal file
9
client/src/utils/asyncConfirm.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
function confirmDialog(msg) {
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
let confirmed = window.confirm(msg);
|
||||||
|
|
||||||
|
return confirmed ? resolve(true) : resolve(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export default confirmDialog;
|
||||||
Reference in New Issue
Block a user