IO-2731 Payment Edit
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
This commit is contained in:
@@ -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", {
|
||||
|
||||
Reference in New Issue
Block a user