From 8f04c5a12caacf4e0b2a5e281461b1685f7a2ede Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Tue, 22 Aug 2023 09:15:10 -0700 Subject: [PATCH] IO-2368 Successful Export Notification for QBO --- .../jobs-close-export-button.component.jsx | 14 ++++++++++---- .../jobs-export-all-button.component.jsx | 10 ++++++++-- .../payable-export-all-button.component.jsx | 17 +++++++++++------ .../payable-export-button.component.jsx | 16 +++++++++++----- .../payment-export-button.component.jsx | 9 ++++++++- .../payments-export-all-button.component.jsx | 9 ++++++++- 6 files changed, 56 insertions(+), 19 deletions(-) diff --git a/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx b/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx index 1c95b9975..f18bd25d7 100644 --- a/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx +++ b/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx @@ -4,16 +4,15 @@ import axios from "axios"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; +import { useHistory } from "react-router-dom"; import { createStructuredSelector } from "reselect"; -import { auth } from "../../firebase/firebase.utils"; +import { auth, logImEXEvent } from "../../firebase/firebase.utils"; +import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries"; import { UPDATE_JOB } from "../../graphql/jobs.queries"; import { selectBodyshop, selectCurrentUser, } from "../../redux/user/user.selectors"; -import { logImEXEvent } from "../../firebase/firebase.utils"; -import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries"; -import { useHistory } from "react-router-dom"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -173,6 +172,13 @@ export function JobsCloseExportButton({ }); } } + if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) { + notification.open({ + type: "success", + key: "jobsuccessexport", + message: t("jobs.successes.exported"), + }); + } if (setSelectedJobs) { setSelectedJobs((selectedJobs) => { return selectedJobs.filter((i) => i !== jobId); diff --git a/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx b/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx index 750a5188b..2f5878351 100644 --- a/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx +++ b/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx @@ -169,14 +169,20 @@ export function JobsExportAllButton({ }); } } + if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) { + notification.open({ + type: "success", + key: "jobsuccessexport", + message: t("jobs.successes.exported"), + }); + } } }) ); - if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) refetch(); if (!!completedCallback) completedCallback([]); if (!!loadingCallback) loadingCallback(false); - + if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) refetch(); setLoading(false); }; diff --git a/client/src/components/payable-export-all-button/payable-export-all-button.component.jsx b/client/src/components/payable-export-all-button/payable-export-all-button.component.jsx index 7aa13f5e3..7596dea7c 100644 --- a/client/src/components/payable-export-all-button/payable-export-all-button.component.jsx +++ b/client/src/components/payable-export-all-button/payable-export-all-button.component.jsx @@ -1,20 +1,19 @@ import { useMutation } from "@apollo/client"; import { Button, notification } from "antd"; import axios from "axios"; +import _ from "lodash"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; +import { Link } from "react-router-dom"; import { createStructuredSelector } from "reselect"; -import { auth } from "../../firebase/firebase.utils"; +import { auth, logImEXEvent } from "../../firebase/firebase.utils"; +import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries"; import { UPDATE_BILLS } from "../../graphql/bills.queries"; import { selectBodyshop, selectCurrentUser, } from "../../redux/user/user.selectors"; -import { logImEXEvent } from "../../firebase/firebase.utils"; -import _ from "lodash"; -import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries"; -import { Link } from "react-router-dom"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -164,6 +163,13 @@ export function PayableExportAll({ }); } } + if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) { + notification.open({ + type: "success", + key: "billsuccessexport", + message: t("bills.successes.exported"), + }); + } } })() ); @@ -173,7 +179,6 @@ export function PayableExportAll({ if (!!completedCallback) completedCallback([]); if (!!loadingCallback) loadingCallback(false); if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) refetch(); - setLoading(false); }; diff --git a/client/src/components/payable-export-button/payable-export-button.component.jsx b/client/src/components/payable-export-button/payable-export-button.component.jsx index de0d3efdf..fc5254073 100644 --- a/client/src/components/payable-export-button/payable-export-button.component.jsx +++ b/client/src/components/payable-export-button/payable-export-button.component.jsx @@ -4,16 +4,15 @@ import axios from "axios"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; +import { Link } from "react-router-dom"; import { createStructuredSelector } from "reselect"; -import { auth } from "../../firebase/firebase.utils"; +import { auth, logImEXEvent } from "../../firebase/firebase.utils"; +import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries"; import { UPDATE_BILLS } from "../../graphql/bills.queries"; import { selectBodyshop, selectCurrentUser, } from "../../redux/user/user.selectors"; -import { logImEXEvent } from "../../firebase/firebase.utils"; -import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries"; -import { Link } from "react-router-dom"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -167,7 +166,13 @@ export function PayableExportButton({ }); } } - if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) refetch(); + if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) { + notification.open({ + type: "success", + key: "billsuccessexport", + message: t("bills.successes.exported"), + }); + } if (setSelectedBills) { setSelectedBills((selectedBills) => { @@ -177,6 +182,7 @@ export function PayableExportButton({ } if (!!loadingCallback) loadingCallback(false); + if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) refetch(); setLoading(false); }; diff --git a/client/src/components/payment-export-button/payment-export-button.component.jsx b/client/src/components/payment-export-button/payment-export-button.component.jsx index 5e5868579..471e2389e 100644 --- a/client/src/components/payment-export-button/payment-export-button.component.jsx +++ b/client/src/components/payment-export-button/payment-export-button.component.jsx @@ -172,8 +172,15 @@ export function PaymentExportButton({ }); } } - if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) refetch(); + if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) { + notification.open({ + type: "success", + key: "paymentsuccessexport", + message: t("payments.successes.exported"), + }); + } if (!!loadingCallback) loadingCallback(false); + if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) refetch(); setLoading(false); }; diff --git a/client/src/components/payments-export-all-button/payments-export-all-button.component.jsx b/client/src/components/payments-export-all-button/payments-export-all-button.component.jsx index 3f9d7fffd..e4218cc3b 100644 --- a/client/src/components/payments-export-all-button/payments-export-all-button.component.jsx +++ b/client/src/components/payments-export-all-button/payments-export-all-button.component.jsx @@ -25,7 +25,7 @@ export function PaymentsExportAllButton({ disabled, loadingCallback, completedCallback, - refetch + refetch, }) { const { t } = useTranslation(); const [updatePayments] = useMutation(UPDATE_PAYMENTS); @@ -150,6 +150,13 @@ export function PaymentsExportAllButton({ }); } } + if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) { + notification.open({ + type: "success", + key: "paymentsuccessexport", + message: t("payments.successes.exported"), + }); + } } })() );