@@ -45,6 +45,7 @@ export function BillDetailEditReturn({
|
|||||||
actions: {},
|
actions: {},
|
||||||
context: {
|
context: {
|
||||||
jobId: data.bills_by_pk.jobid,
|
jobId: data.bills_by_pk.jobid,
|
||||||
|
job: data.bills_by_pk.job,
|
||||||
vendorId: data.bills_by_pk.vendorid,
|
vendorId: data.bills_by_pk.vendorid,
|
||||||
returnFromBill: data.bills_by_pk.id,
|
returnFromBill: data.bills_by_pk.id,
|
||||||
invoiceNumber: data.bills_by_pk.invoice_number,
|
invoiceNumber: data.bills_by_pk.invoice_number,
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export function BillsListTableComponent({
|
|||||||
)}
|
)}
|
||||||
<BillDeleteButton bill={record} jobid={job.id} />
|
<BillDeleteButton bill={record} jobid={job.id} />
|
||||||
<BillDetailEditReturnComponent
|
<BillDetailEditReturnComponent
|
||||||
data={{ bills_by_pk: { ...record, jobid: job.id } }}
|
data={{ bills_by_pk: { ...record, jobid: job.id, job: job } }}
|
||||||
disabled={
|
disabled={
|
||||||
record.is_credit_memo ||
|
record.is_credit_memo ||
|
||||||
record.vendorid === bodyshop.inhousevendorid ||
|
record.vendorid === bodyshop.inhousevendorid ||
|
||||||
|
|||||||
@@ -7,10 +7,12 @@ import { createStructuredSelector } from "reselect";
|
|||||||
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
||||||
import { UPDATE_PAYMENT } from "../../graphql/payments.queries";
|
import { UPDATE_PAYMENT } from "../../graphql/payments.queries";
|
||||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||||
|
import { selectPayment } from "../../redux/modals/modals.selectors";
|
||||||
import { selectCurrentUser } from "../../redux/user/user.selectors";
|
import { selectCurrentUser } from "../../redux/user/user.selectors";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
|
paymentModal: selectPayment,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
@@ -24,6 +26,7 @@ const PaymentMarkForExportButton = ({
|
|||||||
refetch,
|
refetch,
|
||||||
setPaymentContext,
|
setPaymentContext,
|
||||||
currentUser,
|
currentUser,
|
||||||
|
paymentModal,
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [insertExportLog, { loading: exportLogLoading }] =
|
const [insertExportLog, { loading: exportLogLoading }] =
|
||||||
@@ -65,16 +68,22 @@ const PaymentMarkForExportButton = ({
|
|||||||
refetch,
|
refetch,
|
||||||
},
|
},
|
||||||
context: {
|
context: {
|
||||||
|
...paymentModal.context,
|
||||||
...payment,
|
...payment,
|
||||||
exportedat: today,
|
exportedat: today,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (refetch)
|
if (refetch) {
|
||||||
refetch(
|
if (paymentModal.context.refetchRequiresContext) {
|
||||||
paymentUpdateResponse &&
|
refetch(
|
||||||
paymentUpdateResponse.data.update_payments.returning[0]
|
paymentUpdateResponse &&
|
||||||
);
|
paymentUpdateResponse.data.update_payments.returning[0]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
refetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("payments.errors.exporting", {
|
message: t("payments.errors.exporting", {
|
||||||
|
|||||||
@@ -96,16 +96,21 @@ function PaymentModalContainer({
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!!!updatedPayment.errors) {
|
if (!!!updatedPayment.errors) {
|
||||||
notification["success"]({ message: t("payments.successes.payment") });
|
notification["success"]({ message: t("payments.successes.paymentupdate") });
|
||||||
} else {
|
} else {
|
||||||
notification["error"]({ message: t("payments.errors.payment") });
|
notification["error"]({ message: t("payments.errors.paymentupdate") });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actions.refetch)
|
if (actions.refetch) {
|
||||||
actions.refetch(
|
if (context.refetchRequiresContext) {
|
||||||
updatedPayment && updatedPayment.data.update_payments.returning[0]
|
actions.refetch(
|
||||||
);
|
updatedPayment && updatedPayment.data.update_payments.returning[0]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
actions.refetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (enterAgain) {
|
if (enterAgain) {
|
||||||
const prev = form.getFieldsValue(["date"]);
|
const prev = form.getFieldsValue(["date"]);
|
||||||
|
|||||||
@@ -3,15 +3,25 @@ import { Button, notification } from "antd";
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
import { UPDATE_PAYMENT } from "../../graphql/payments.queries";
|
import { UPDATE_PAYMENT } from "../../graphql/payments.queries";
|
||||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||||
|
import { selectPayment } from "../../redux/modals/modals.selectors";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
paymentModal: selectPayment,
|
||||||
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
setPaymentContext: (context) =>
|
setPaymentContext: (context) =>
|
||||||
dispatch(setModalContext({ context: context, modal: "payment" })),
|
dispatch(setModalContext({ context: context, modal: "payment" })),
|
||||||
});
|
});
|
||||||
|
|
||||||
const PaymentReexportButton = ({ payment, refetch, setPaymentContext }) => {
|
const PaymentReexportButton = ({
|
||||||
|
paymentModal,
|
||||||
|
payment,
|
||||||
|
refetch,
|
||||||
|
setPaymentContext,
|
||||||
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [updatePayment, { loading }] = useMutation(UPDATE_PAYMENT);
|
const [updatePayment, { loading }] = useMutation(UPDATE_PAYMENT);
|
||||||
|
|
||||||
@@ -35,15 +45,21 @@ const PaymentReexportButton = ({ payment, refetch, setPaymentContext }) => {
|
|||||||
refetch,
|
refetch,
|
||||||
},
|
},
|
||||||
context: {
|
context: {
|
||||||
|
...paymentModal.context,
|
||||||
...payment,
|
...payment,
|
||||||
exportedat: null,
|
exportedat: null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (refetch)
|
if (refetch) {
|
||||||
refetch(
|
if (paymentModal.context.refetchRequiresContext) {
|
||||||
paymentUpdateResponse &&
|
refetch(
|
||||||
paymentUpdateResponse.data.update_payments.returning[0]
|
paymentUpdateResponse &&
|
||||||
);
|
paymentUpdateResponse.data.update_payments.returning[0]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
refetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("payments.errors.exporting", {
|
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);
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ import { selectBodyshop } from "../../redux/user/user.selectors";
|
|||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter";
|
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter";
|
||||||
import { TemplateList } from "../../utils/TemplateConstants";
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
|
import { pageLimit } from "../../utils/config";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
import { alphaSort } from "../../utils/sorters";
|
||||||
import CaBcEtfTableModalContainer from "../ca-bc-etf-table-modal/ca-bc-etf-table-modal.container";
|
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 OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||||
import PrintWrapperComponent from "../print-wrapper/print-wrapper.component";
|
import PrintWrapperComponent from "../print-wrapper/print-wrapper.component";
|
||||||
import {pageLimit} from "../../utils/config";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
//currentUser: selectCurrentUser
|
//currentUser: selectCurrentUser
|
||||||
@@ -184,7 +184,10 @@ export function PaymentsListPaginated({
|
|||||||
}
|
}
|
||||||
: refetch,
|
: refetch,
|
||||||
},
|
},
|
||||||
context: apolloResults ? apolloResults : record,
|
context: {
|
||||||
|
...(apolloResults ? apolloResults : record),
|
||||||
|
refetchRequiresContext: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -2333,6 +2333,7 @@
|
|||||||
"markexported": "Payment(s) marked exported.",
|
"markexported": "Payment(s) marked exported.",
|
||||||
"markreexported": "Payment marked for re-export successfully",
|
"markreexported": "Payment marked for re-export successfully",
|
||||||
"payment": "Payment created successfully. ",
|
"payment": "Payment created successfully. ",
|
||||||
|
"paymentupdate": "Payment updated successfully. ",
|
||||||
"stripe": "Credit card transaction charged successfully."
|
"stripe": "Credit card transaction charged successfully."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2331,6 +2331,7 @@
|
|||||||
"markexported": "",
|
"markexported": "",
|
||||||
"markreexported": "",
|
"markreexported": "",
|
||||||
"payment": "",
|
"payment": "",
|
||||||
|
"paymentupdate": "",
|
||||||
"stripe": ""
|
"stripe": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2331,6 +2331,7 @@
|
|||||||
"markexported": "",
|
"markexported": "",
|
||||||
"markreexported": "",
|
"markreexported": "",
|
||||||
"payment": "",
|
"payment": "",
|
||||||
|
"paymentupdate": "",
|
||||||
"stripe": ""
|
"stripe": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user