diff --git a/client/src/components/bill-detail-edit/bill-detail-edit-return.component.jsx b/client/src/components/bill-detail-edit/bill-detail-edit-return.component.jsx
index 87ea3e730..1121d9779 100644
--- a/client/src/components/bill-detail-edit/bill-detail-edit-return.component.jsx
+++ b/client/src/components/bill-detail-edit/bill-detail-edit-return.component.jsx
@@ -45,6 +45,7 @@ export function BillDetailEditReturn({
actions: {},
context: {
jobId: data.bills_by_pk.jobid,
+ job: data.bills_by_pk.job,
vendorId: data.bills_by_pk.vendorid,
returnFromBill: data.bills_by_pk.id,
invoiceNumber: data.bills_by_pk.invoice_number,
diff --git a/client/src/components/bills-list-table/bills-list-table.component.jsx b/client/src/components/bills-list-table/bills-list-table.component.jsx
index 5f5bd7011..621fe8e8e 100644
--- a/client/src/components/bills-list-table/bills-list-table.component.jsx
+++ b/client/src/components/bills-list-table/bills-list-table.component.jsx
@@ -60,7 +60,7 @@ export function BillsListTableComponent({
)}
({
@@ -24,6 +26,7 @@ const PaymentMarkForExportButton = ({
refetch,
setPaymentContext,
currentUser,
+ paymentModal,
}) => {
const { t } = useTranslation();
const [insertExportLog, { loading: exportLogLoading }] =
@@ -65,16 +68,22 @@ const PaymentMarkForExportButton = ({
refetch,
},
context: {
+ ...paymentModal.context,
...payment,
exportedat: today,
},
});
- if (refetch)
- refetch(
- paymentUpdateResponse &&
- paymentUpdateResponse.data.update_payments.returning[0]
- );
+ if (refetch) {
+ if (paymentModal.context.refetchRequiresContext) {
+ refetch(
+ paymentUpdateResponse &&
+ paymentUpdateResponse.data.update_payments.returning[0]
+ );
+ } else {
+ refetch();
+ }
+ }
} else {
notification["error"]({
message: t("payments.errors.exporting", {
diff --git a/client/src/components/payment-modal/payment-modal.container.jsx b/client/src/components/payment-modal/payment-modal.container.jsx
index 1785c073b..e2b108674 100644
--- a/client/src/components/payment-modal/payment-modal.container.jsx
+++ b/client/src/components/payment-modal/payment-modal.container.jsx
@@ -96,16 +96,21 @@ function PaymentModalContainer({
});
if (!!!updatedPayment.errors) {
- notification["success"]({ message: t("payments.successes.payment") });
+ notification["success"]({ message: t("payments.successes.paymentupdate") });
} else {
- notification["error"]({ message: t("payments.errors.payment") });
+ notification["error"]({ message: t("payments.errors.paymentupdate") });
}
}
- if (actions.refetch)
- actions.refetch(
- updatedPayment && updatedPayment.data.update_payments.returning[0]
- );
+ if (actions.refetch) {
+ if (context.refetchRequiresContext) {
+ actions.refetch(
+ updatedPayment && updatedPayment.data.update_payments.returning[0]
+ );
+ } else {
+ actions.refetch();
+ }
+ }
if (enterAgain) {
const prev = form.getFieldsValue(["date"]);
diff --git a/client/src/components/payment-reexport-button/payment-reexport-button.component.jsx b/client/src/components/payment-reexport-button/payment-reexport-button.component.jsx
index a7434e76d..fa6063d67 100644
--- a/client/src/components/payment-reexport-button/payment-reexport-button.component.jsx
+++ b/client/src/components/payment-reexport-button/payment-reexport-button.component.jsx
@@ -3,15 +3,25 @@ import { Button, notification } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
+import { createStructuredSelector } from "reselect";
import { UPDATE_PAYMENT } from "../../graphql/payments.queries";
import { setModalContext } from "../../redux/modals/modals.actions";
+import { selectPayment } from "../../redux/modals/modals.selectors";
+const mapStateToProps = createStructuredSelector({
+ paymentModal: selectPayment,
+});
const mapDispatchToProps = (dispatch) => ({
setPaymentContext: (context) =>
dispatch(setModalContext({ context: context, modal: "payment" })),
});
-const PaymentReexportButton = ({ payment, refetch, setPaymentContext }) => {
+const PaymentReexportButton = ({
+ paymentModal,
+ payment,
+ refetch,
+ setPaymentContext,
+}) => {
const { t } = useTranslation();
const [updatePayment, { loading }] = useMutation(UPDATE_PAYMENT);
@@ -35,15 +45,21 @@ const PaymentReexportButton = ({ payment, refetch, setPaymentContext }) => {
refetch,
},
context: {
+ ...paymentModal.context,
...payment,
exportedat: null,
},
});
- if (refetch)
- refetch(
- paymentUpdateResponse &&
- paymentUpdateResponse.data.update_payments.returning[0]
- );
+ if (refetch) {
+ if (paymentModal.context.refetchRequiresContext) {
+ refetch(
+ paymentUpdateResponse &&
+ paymentUpdateResponse.data.update_payments.returning[0]
+ );
+ } else {
+ refetch();
+ }
+ }
} else {
notification["error"]({
message: t("payments.errors.exporting", {
@@ -64,4 +80,7 @@ const PaymentReexportButton = ({ payment, refetch, setPaymentContext }) => {
);
};
-export default connect(null, mapDispatchToProps)(PaymentReexportButton);
+export default connect(
+ mapStateToProps,
+ mapDispatchToProps
+)(PaymentReexportButton);
diff --git a/client/src/components/payments-list-paginated/payment-list-paginated.component.jsx b/client/src/components/payments-list-paginated/payment-list-paginated.component.jsx
index 86ad50cb8..6fdfd108a 100644
--- a/client/src/components/payments-list-paginated/payment-list-paginated.component.jsx
+++ b/client/src/components/payments-list-paginated/payment-list-paginated.component.jsx
@@ -14,11 +14,11 @@ import { selectBodyshop } from "../../redux/user/user.selectors";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter";
import { TemplateList } from "../../utils/TemplateConstants";
+import { pageLimit } from "../../utils/config";
import { alphaSort } from "../../utils/sorters";
import CaBcEtfTableModalContainer from "../ca-bc-etf-table-modal/ca-bc-etf-table-modal.container";
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
import PrintWrapperComponent from "../print-wrapper/print-wrapper.component";
-import {pageLimit} from "../../utils/config";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
@@ -184,7 +184,10 @@ export function PaymentsListPaginated({
}
: refetch,
},
- context: apolloResults ? apolloResults : record,
+ context: {
+ ...(apolloResults ? apolloResults : record),
+ refetchRequiresContext: true,
+ },
});
}}
>
diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json
index 447cb881d..c37761373 100644
--- a/client/src/translations/en_us/common.json
+++ b/client/src/translations/en_us/common.json
@@ -2333,6 +2333,7 @@
"markexported": "Payment(s) marked exported.",
"markreexported": "Payment marked for re-export successfully",
"payment": "Payment created successfully. ",
+ "paymentupdate": "Payment updated successfully. ",
"stripe": "Credit card transaction charged successfully."
}
},
diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json
index d1a760146..30ab017ba 100644
--- a/client/src/translations/es/common.json
+++ b/client/src/translations/es/common.json
@@ -2331,6 +2331,7 @@
"markexported": "",
"markreexported": "",
"payment": "",
+ "paymentupdate": "",
"stripe": ""
}
},
diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json
index 87253cf17..8a77e2231 100644
--- a/client/src/translations/fr/common.json
+++ b/client/src/translations/fr/common.json
@@ -2331,6 +2331,7 @@
"markexported": "",
"markreexported": "",
"payment": "",
+ "paymentupdate": "",
"stripe": ""
}
},