IO-256 QBO Improvements.

This commit is contained in:
Patrick Fic
2021-10-13 21:12:02 -07:00
parent b54d5beb76
commit b56742bcb2
8 changed files with 88 additions and 20 deletions

View File

@@ -8,6 +8,8 @@ import { createStructuredSelector } from "reselect";
import { auth, logImEXEvent } from "../../firebase/firebase.utils";
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
import { UPDATE_PAYMENTS } from "../../graphql/payments.queries";
import { useCookies } from "react-cookie";
import {
selectBodyshop,
selectCurrentUser,
@@ -30,6 +32,7 @@ export function PaymentExportButton({
const [updatePayment] = useMutation(UPDATE_PAYMENTS);
const [loading, setLoading] = useState(false);
const [insertExportLog] = useMutation(INSERT_EXPORT_LOG);
const [cookies] = useCookies();
const handleQbxml = async () => {
logImEXEvent("accounting_payment_export");
@@ -174,7 +177,16 @@ export function PaymentExportButton({
};
return (
<Button onClick={handleQbxml} loading={loading} disabled={disabled}>
<Button
onClick={handleQbxml}
loading={loading}
disabled={
disabled ||
(bodyshop.accountingconfig &&
bodyshop.accountingconfig.qbo &&
!cookies.qbo_realmId)
}
>
{t("jobs.actions.export")}
</Button>
);