IO-2731 Payment Edit

Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
This commit is contained in:
Allan Carr
2024-04-08 12:23:04 -07:00
parent 19ec4cb021
commit 88a71dd647
7 changed files with 59 additions and 20 deletions

View File

@@ -7,10 +7,12 @@ import { createStructuredSelector } from "reselect";
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
import { UPDATE_PAYMENT } from "../../graphql/payments.queries";
import { setModalContext } from "../../redux/modals/modals.actions";
import { selectPayment } from "../../redux/modals/modals.selectors";
import { selectCurrentUser } from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({
currentUser: selectCurrentUser,
paymentModal: selectPayment,
});
const mapDispatchToProps = (dispatch) => ({
@@ -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", {