- Merge Test-AIO

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-04-08 20:25:08 -04:00
11 changed files with 66 additions and 45 deletions

View File

@@ -34,6 +34,7 @@ export function BillDetailEditReturn({ setPartsOrderContext, insertAuditTrail, b
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,

View File

@@ -76,7 +76,7 @@ export function BillsListTableComponent({
</Button> </Button>
<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={record.is_credit_memo || record.vendorid === bodyshop.inhousevendorid || jobRO} disabled={record.is_credit_memo || record.vendorid === bodyshop.inhousevendorid || jobRO}
/> />

View File

@@ -1,5 +1,6 @@
import {useLazyQuery} from "@apollo/client"; import { LoadingOutlined } from "@ant-design/icons";
import {Select, Space, Spin, Tag} from "antd"; import { useLazyQuery } from "@apollo/client";
import { Select, Space, Spin, Tag } from "antd";
import _ from "lodash"; import _ from "lodash";
import React, {forwardRef, useEffect, useState} from "react"; import React, {forwardRef, useEffect, useState} from "react";
import {useTranslation} from "react-i18next"; import {useTranslation} from "react-i18next";
@@ -8,8 +9,7 @@ import {
SEARCH_JOBS_FOR_AUTOCOMPLETE SEARCH_JOBS_FOR_AUTOCOMPLETE
} from "../../graphql/jobs.queries"; } from "../../graphql/jobs.queries";
import AlertComponent from "../alert/alert.component"; import AlertComponent from "../alert/alert.component";
import {OwnerNameDisplayFunction} from "../owner-name-display/owner-name-display.component"; import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component";
import {LoadingOutlined} from "@ant-design/icons";
const {Option} = Select; const {Option} = Select;
@@ -28,9 +28,14 @@ const JobSearchSelect = (
const [theOptions, setTheOptions] = useState([]); const [theOptions, setTheOptions] = useState([]);
const [callSearch, {loading, error, data}] = useLazyQuery(SEARCH_JOBS_FOR_AUTOCOMPLETE, {}); const [callSearch, {loading, error, data}] = useLazyQuery(SEARCH_JOBS_FOR_AUTOCOMPLETE, {});
const [callIdSearch, {loading: idLoading, error: idError, data: idData}] = useLazyQuery( const [
SEARCH_JOBS_BY_ID_FOR_AUTOCOMPLETE callIdSearch,
); {
//loading: idLoading,
error: idError,
data: idData
}
] = useLazyQuery(SEARCH_JOBS_BY_ID_FOR_AUTOCOMPLETE);
const executeSearch = (v) => { const executeSearch = (v) => {
if (v && v.variables?.search !== "" && v.variables.search.length >= 2) callSearch(v); if (v && v.variables?.search !== "" && v.variables.search.length >= 2) callSearch(v);
@@ -95,9 +100,9 @@ const JobSearchSelect = (
<span> <span>
{`${clm_no && o.clm_no ? `${o.clm_no} | ` : ""}${ {`${clm_no && o.clm_no ? `${o.clm_no} | ` : ""}${
o.ro_number || t("general.labels.na") o.ro_number || t("general.labels.na")
} | ${OwnerNameDisplayFunction(o)} | ${ } | ${OwnerNameDisplayFunction(o)} | ${o.v_model_yr || ""} ${o.v_make_desc || ""} ${
o.v_model_yr || "" o.v_model_desc || ""
} ${o.v_make_desc || ""} ${o.v_model_desc || ""}`} }`}
</span> </span>
<Tag> <Tag>
<strong>{o.status}</strong> <strong>{o.status}</strong>

View File

@@ -237,7 +237,7 @@ export function JobsAvailableContainer({ bodyshop, currentUser, insertAuditTrail
executeFunction: true, executeFunction: true,
rome: ResolveCCCLineIssues, rome: ResolveCCCLineIssues,
promanager: ResolveCCCLineIssues, promanager: ResolveCCCLineIssues,
args: [(supp, bodyshop)] args: [supp, bodyshop]
}); });
await InstanceRenderManager({ await InstanceRenderManager({

View File

@@ -7,17 +7,19 @@ 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) => ({
setPaymentContext: (context) => dispatch(setModalContext({ context: context, modal: "payment" })) setPaymentContext: (context) => dispatch(setModalContext({ context: context, modal: "payment" }))
}); });
const PaymentMarkForExportButton = ({ bodyshop, payment, refetch, setPaymentContext, currentUser }) => { const PaymentMarkForExportButton = ({ bodyshop, payment, refetch, setPaymentContext, currentUser, paymentModal }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const [insertExportLog, { loading: exportLogLoading }] = useMutation(INSERT_EXPORT_LOG); const [insertExportLog, { loading: exportLogLoading }] = useMutation(INSERT_EXPORT_LOG);
const [updatePayment, { loading: updatePaymentLoading }] = useMutation(UPDATE_PAYMENT); const [updatePayment, { loading: updatePaymentLoading }] = useMutation(UPDATE_PAYMENT);
@@ -56,17 +58,21 @@ const PaymentMarkForExportButton = ({ bodyshop, payment, refetch, setPaymentCont
refetch refetch
}, },
context: { context: {
...paymentModal.context,
...paymentModal.context,
...payment, ...payment,
smartRefetch: true, smartRefetch: true,
exportedat: today exportedat: today
} }
}); });
if (refetch) if (refetch) {
refetch( if (paymentModal.context.refetchRequiresContext) {
paymentUpdateResponse && refetch(paymentUpdateResponse && paymentUpdateResponse.data.update_payments.returning[0]);
paymentUpdateResponse.data.update_payments.returning[0] } else {
); refetch();
}
}
} else { } else {
notification["error"]({ notification["error"]({
message: t("payments.errors.exporting", { message: t("payments.errors.exporting", {

View File

@@ -32,7 +32,6 @@ function PaymentModalContainer({paymentModal, toggleModalVisible, bodyshop }) {
const { t } = useTranslation(); const { t } = useTranslation();
const { context, actions, open } = paymentModal; const { context, actions, open } = paymentModal;
const smartRefetch = context?.smartRefetch || false;
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const handleFinish = async (values) => { const handleFinish = async (values) => {
@@ -82,15 +81,18 @@ function PaymentModalContainer({paymentModal, toggleModalVisible, bodyshop }) {
}); });
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) {
const updatedData = smartRefetch && updatedPayment ? updatedPayment.data.update_payments.returning[0] : undefined; if (context.refetchRequiresContext) {
actions.refetch(updatedData); actions.refetch(updatedPayment && updatedPayment.data.update_payments.returning[0]);
} else {
actions.refetch();
}
} }
if (enterAgain) { if (enterAgain) {
@@ -166,13 +168,7 @@ function PaymentModalContainer({paymentModal, toggleModalVisible, bodyshop }) {
</Space> </Space>
)} )}
<Form <Form onFinish={handleFinish} autoComplete={"off"} form={form} layout="vertical" disabled={context?.exportedat}>
onFinish={handleFinish}
autoComplete={"off"}
form={form}
layout="vertical"
disabled={context?.exportedat}
>
<PaymentForm form={form} /> <PaymentForm form={form} />
</Form> </Form>
</Modal> </Modal>

View File

@@ -3,14 +3,20 @@ 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) => dispatch(setModalContext({ context: context, modal: "payment" })) setPaymentContext: (context) => 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);
@@ -34,16 +40,20 @@ const PaymentReexportButton = ({ payment, refetch, setPaymentContext }) => {
refetch refetch
}, },
context: { context: {
smartRefetch: true, ...paymentModal.context,
...paymentModal.context,
...payment, ...payment,
exportedat: null exportedat: null
} }
}); });
if (refetch)
refetch( if (refetch) {
paymentUpdateResponse && if (paymentModal.context.refetchRequiresContext) {
paymentUpdateResponse.data.update_payments.returning[0] refetch(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", {
@@ -60,4 +70,4 @@ const PaymentReexportButton = ({ payment, refetch, setPaymentContext }) => {
); );
}; };
export default connect(null, mapDispatchToProps)(PaymentReexportButton); export default connect(mapStateToProps, mapDispatchToProps)(PaymentReexportButton);

View File

@@ -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
@@ -171,7 +171,7 @@ export function PaymentsListPaginated({
} }
: refetch : refetch
}, },
context: apolloResults ? { smartRefetch: true, ...apolloResults} : {smartRefetch: true, ...record} context: { ...(apolloResults ? apolloResults : record), refetchRequiresContext: true }
}); });
}} }}
> >

View File

@@ -2595,7 +2595,8 @@
"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. ",
"stripe": "Credit card transaction charged successfully." "paymentupdate": "Payment updated successfully. ",
"stripe": "Credit card transaction charged successfully."
} }
}, },
"phonebook": { "phonebook": {

View File

@@ -2594,7 +2594,8 @@
"markexported": "", "markexported": "",
"markreexported": "", "markreexported": "",
"payment": "", "payment": "",
"stripe": "" "paymentupdate": "",
"stripe": ""
} }
}, },
"phonebook": { "phonebook": {

View File

@@ -2594,7 +2594,8 @@
"markexported": "", "markexported": "",
"markreexported": "", "markreexported": "",
"payment": "", "payment": "",
"stripe": "" "paymentupdate": "",
"stripe": ""
} }
}, },
"phonebook": { "phonebook": {