-
+ ) : (
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+ )}
);
@@ -99,7 +150,7 @@ export default function ScoreboardAddButton({
setLoading(true);
const v = job.joblines.reduce(
(acc, val) => {
- if (val.mod_lbr_ty === "LAB")
+ if (val.mod_lbr_ty !== "LAR")
acc = { ...acc, bodyhrs: acc.bodyhrs + val.mod_lb_hrs };
if (val.mod_lbr_ty === "LAR")
acc = { ...acc, painthrs: acc.painthrs + val.mod_lb_hrs };
diff --git a/client/src/components/jobs-available-table/jobs-available-table.container.jsx b/client/src/components/jobs-available-table/jobs-available-table.container.jsx
index b4758f361..19a1ea69f 100644
--- a/client/src/components/jobs-available-table/jobs-available-table.container.jsx
+++ b/client/src/components/jobs-available-table/jobs-available-table.container.jsx
@@ -99,7 +99,7 @@ export function JobsAvailableContainer({
return;
}
//IO-539 Check for Parts Rate on PAL for SGI use case.
- await CheckTaxRates(estData, bodyshop);
+ await CheckTaxRates(estData.est_data, bodyshop);
const newTotals = (
await Axios.post("/job/totals", {
@@ -140,16 +140,17 @@ export function JobsAvailableContainer({
: {}),
};
+ if (selectedOwner) {
+ newJob.ownerid = selectedOwner;
+ delete newJob.owner;
+ }
+ if (newJob.vehicleid) {
+ delete newJob.vehicle;
+ }
+
insertNewJob({
variables: {
- job: selectedOwner
- ? Object.assign(
- {},
- newJob,
- { owner: null },
- { ownerid: selectedOwner }
- )
- : newJob,
+ job: newJob,
},
})
.then((r) => {
@@ -199,11 +200,10 @@ export function JobsAvailableContainer({
message: t("jobs.errors.creating", { error: "No job data present." }),
});
} else {
- //IO-539 Check for Parts Rate on PAL for SGI use case.
- await CheckTaxRates(estData, bodyshop);
-
//create upsert job
let supp = replaceEmpty({ ...estData.est_data });
+ //IO-539 Check for Parts Rate on PAL for SGI use case.
+ await CheckTaxRates(supp, bodyshop);
delete supp.owner;
delete supp.vehicle;
@@ -391,101 +391,104 @@ function replaceEmpty(someObj, replaceValue = null) {
value === "" ? replaceValue || null : value;
//^ because you seem to want to replace (strings) "null" or "undefined" too
const temp = JSON.stringify(someObj, replacer);
- console.log("Parsed", JSON.parse(temp));
return JSON.parse(temp);
}
async function CheckTaxRates(estData, bodyshop) {
+ console.log(
+ "🚀 ~ file: jobs-available-table.container.jsx ~ line 398 ~ estData",
+ estData
+ );
//LKQ Check
if (
- !estData.est_data.parts_tax_rates?.PAL ||
- estData.est_data.parts_tax_rates?.PAL?.prt_tax_rt === null ||
- estData.est_data.parts_tax_rates?.PAL?.prt_tax_rt === 0
+ !estData.parts_tax_rates?.PAL ||
+ estData.parts_tax_rates?.PAL?.prt_tax_rt === null ||
+ estData.parts_tax_rates?.PAL?.prt_tax_rt === 0
) {
const res = await confirmDialog(
`ImEX Online has detected that there is a missing tax rate for LKQ parts. Pressing OK will set the tax rate to ${bodyshop.bill_tax_rates.state_tax_rate}% and enable the rate. Pressing cancel will keep the tax rate as is.`
);
if (res) {
- if (!estData.est_data.parts_tax_rates.PAL) {
- estData.est_data.parts_tax_rates.PAL = {
+ if (!estData.parts_tax_rates.PAL) {
+ estData.parts_tax_rates.PAL = {
prt_discp: 0,
prt_mktyp: true,
prt_mkupp: 0,
prt_type: "PAL",
};
}
- estData.est_data.parts_tax_rates.PAL.prt_tax_rt =
+ estData.parts_tax_rates.PAL.prt_tax_rt =
bodyshop.bill_tax_rates.state_tax_rate / 100;
- estData.est_data.parts_tax_rates.PAL.prt_tax_in = true;
+ estData.parts_tax_rates.PAL.prt_tax_in = true;
}
}
//PAC Check
if (
- !estData.est_data.parts_tax_rates?.PAC ||
- estData.est_data.parts_tax_rates?.PAC?.prt_tax_rt === null ||
- estData.est_data.parts_tax_rates?.PAC?.prt_tax_rt === 0
+ !estData.parts_tax_rates?.PAC ||
+ estData.parts_tax_rates?.PAC?.prt_tax_rt === null ||
+ estData.parts_tax_rates?.PAC?.prt_tax_rt === 0
) {
const res = await confirmDialog(
`ImEX Online has detected that there is a missing tax rate for rechromed parts. Pressing OK will set the tax rate to ${bodyshop.bill_tax_rates.state_tax_rate}% and enable the rate. Pressing cancel will keep the tax rate as is.`
);
if (res) {
- if (!estData.est_data.parts_tax_rates.PAC) {
- estData.est_data.parts_tax_rates.PAC = {
+ if (!estData.parts_tax_rates.PAC) {
+ estData.parts_tax_rates.PAC = {
prt_discp: 0,
prt_mktyp: true,
prt_mkupp: 0,
prt_type: "PAC",
};
}
- estData.est_data.parts_tax_rates.PAC.prt_tax_rt =
+ estData.parts_tax_rates.PAC.prt_tax_rt =
bodyshop.bill_tax_rates.state_tax_rate / 100;
- estData.est_data.parts_tax_rates.PAC.prt_tax_in = true;
+ estData.parts_tax_rates.PAC.prt_tax_in = true;
}
}
//PAM Check
if (
- !estData.est_data.parts_tax_rates?.PAM ||
- estData.est_data.parts_tax_rates?.PAM?.prt_tax_rt === null ||
- estData.est_data.parts_tax_rates?.PAM?.prt_tax_rt === 0
+ !estData.parts_tax_rates?.PAM ||
+ estData.parts_tax_rates?.PAM?.prt_tax_rt === null ||
+ estData.parts_tax_rates?.PAM?.prt_tax_rt === 0
) {
const res = await confirmDialog(
`ImEX Online has detected that there is a missing tax rate for remanufactured parts. Pressing OK will set the tax rate to ${bodyshop.bill_tax_rates.state_tax_rate}% and enable the rate. Pressing cancel will keep the tax rate as is.`
);
if (res) {
- if (!estData.est_data.parts_tax_rates.PAM) {
- estData.est_data.parts_tax_rates.PAM = {
+ if (!estData.parts_tax_rates.PAM) {
+ estData.parts_tax_rates.PAM = {
prt_discp: 0,
prt_mktyp: true,
prt_mkupp: 0,
prt_type: "PAM",
};
}
- estData.est_data.parts_tax_rates.PAM.prt_tax_rt =
+ estData.parts_tax_rates.PAM.prt_tax_rt =
bodyshop.bill_tax_rates.state_tax_rate / 100;
- estData.est_data.parts_tax_rates.PAM.prt_tax_in = true;
+ estData.parts_tax_rates.PAM.prt_tax_in = true;
}
}
if (
- !estData.est_data.parts_tax_rates?.PAR ||
- estData.est_data.parts_tax_rates?.PAR?.prt_tax_rt === null ||
- estData.est_data.parts_tax_rates?.PAR?.prt_tax_rt === 0
+ !estData.parts_tax_rates?.PAR ||
+ estData.parts_tax_rates?.PAR?.prt_tax_rt === null ||
+ estData.parts_tax_rates?.PAR?.prt_tax_rt === 0
) {
const res = await confirmDialog(
`ImEX Online has detected that there is a missing tax rate for recored parts. Pressing OK will set the tax rate to ${bodyshop.bill_tax_rates.state_tax_rate}% and enable the rate. Pressing cancel will keep the tax rate as is.`
);
if (res) {
- if (!estData.est_data.parts_tax_rates.PAR) {
- estData.est_data.parts_tax_rates.PAR = {
+ if (!estData.parts_tax_rates.PAR) {
+ estData.parts_tax_rates.PAR = {
prt_discp: 0,
prt_mktyp: true,
prt_mkupp: 0,
prt_type: "PAR",
};
}
- estData.est_data.parts_tax_rates.PAR.prt_tax_rt =
+ estData.parts_tax_rates.PAR.prt_tax_rt =
bodyshop.bill_tax_rates.state_tax_rate / 100;
- estData.est_data.parts_tax_rates.PAR.prt_tax_in = true;
+ estData.parts_tax_rates.PAR.prt_tax_in = true;
}
}
}
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 0566adc4c..b104212ca 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
@@ -34,6 +34,7 @@ export function JobsCloseExportButton({
const [loading, setLoading] = useState(false);
const handleQbxml = async () => {
+ //Check if it's a CDK setup.
if (bodyshop.cdk_dealerid) {
history.push(`/manage/dms?jobId=${jobId}`);
return;
@@ -41,48 +42,58 @@ export function JobsCloseExportButton({
logImEXEvent("jobs_close_export");
setLoading(true);
- let QbXmlResponse;
- try {
- QbXmlResponse = await axios.post(
- "/accounting/qbxml/receivables",
- { jobIds: [jobId] },
- {
- headers: {
- Authorization: `Bearer ${await auth.currentUser.getIdToken()}`,
- },
- }
- );
- console.log("handle -> XML", QbXmlResponse);
- } catch (error) {
- console.log("Error getting QBXML from Server.", error);
- notification["error"]({
- message: t("jobs.errors.exporting", {
- error: "Unable to retrieve QBXML. " + JSON.stringify(error.message),
- }),
- });
- setLoading(false);
- return;
- }
-
+ //Check if it's a QBO Setup.
let PartnerResponse;
- try {
- PartnerResponse = await axios.post(
- "http://localhost:1337/qb/",
- // "http://609feaeae986.ngrok.io/qb/",
- QbXmlResponse.data,
- {
- headers: {
- Authorization: `Bearer ${await auth.currentUser.getIdToken()}`,
- },
- }
- );
- } catch (error) {
- console.log("Error connecting to quickbooks or partner.", error);
- notification["error"]({
- message: t("jobs.errors.exporting-partner"),
+ if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) {
+ PartnerResponse = await axios.post(`/qbo/receivables`, {
+ withCredentials: true,
+ jobIds: [jobId],
});
- setLoading(false);
- return;
+ } else {
+ //Default is QBD
+
+ let QbXmlResponse;
+ try {
+ QbXmlResponse = await axios.post(
+ "/accounting/qbxml/receivables",
+ { jobIds: [jobId] },
+ {
+ headers: {
+ Authorization: `Bearer ${await auth.currentUser.getIdToken()}`,
+ },
+ }
+ );
+ console.log("handle -> XML", QbXmlResponse);
+ } catch (error) {
+ console.log("Error getting QBXML from Server.", error);
+ notification["error"]({
+ message: t("jobs.errors.exporting", {
+ error: "Unable to retrieve QBXML. " + JSON.stringify(error.message),
+ }),
+ });
+ setLoading(false);
+ return;
+ }
+
+ try {
+ PartnerResponse = await axios.post(
+ "http://localhost:1337/qb/",
+ // "http://609feaeae986.ngrok.io/qb/",
+ QbXmlResponse.data,
+ {
+ headers: {
+ Authorization: `Bearer ${await auth.currentUser.getIdToken()}`,
+ },
+ }
+ );
+ } catch (error) {
+ console.log("Error connecting to quickbooks or partner.", error);
+ notification["error"]({
+ message: t("jobs.errors.exporting-partner"),
+ });
+ setLoading(false);
+ return;
+ }
}
console.log("PartnerResponse", PartnerResponse);
diff --git a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.csi.component.jsx b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.csi.component.jsx
index c205e3088..b603fb31a 100644
--- a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.csi.component.jsx
+++ b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.csi.component.jsx
@@ -104,7 +104,7 @@ export function JobsDetailHeaderCsi({
replyTo: bodyshop.email,
},
template: {
- name: TemplateList("job").csi_invitation.key,
+ name: TemplateList("job_special").csi_invitation_action.key,
variables: {
id: result.data.insert_csi.returning[0].id,
},
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 e0be5621c..69b15dcfc 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
@@ -34,53 +34,61 @@ export function JobsExportAllButton({
const [loading, setLoading] = useState(false);
const handleQbxml = async () => {
logImEXEvent("jobs_export_all");
-
- setLoading(true);
- let QbXmlResponse;
- try {
- QbXmlResponse = await axios.post(
- "/accounting/qbxml/receivables",
- { jobIds: jobIds },
- {
- headers: {
- Authorization: `Bearer ${await auth.currentUser.getIdToken()}`,
- },
- }
- );
- } catch (error) {
- console.log("Error getting QBXML from Server.", error);
- notification["error"]({
- message: t("jobs.errors.exporting", {
- error: "Unable to retrieve QBXML. " + JSON.stringify(error.message),
- }),
- });
- setLoading(false);
- return;
- }
-
let PartnerResponse;
- try {
- PartnerResponse = await axios.post(
- "http://localhost:1337/qb/",
- // "http://609feaeae986.ngrok.io/qb/",
- QbXmlResponse.data,
- {
- headers: {
- Authorization: `Bearer ${await auth.currentUser.getIdToken()}`,
- },
- }
- );
- } catch (error) {
- console.log("Error connecting to quickbooks or partner.", error);
- notification["error"]({
- message: t("jobs.errors.exporting-partner"),
+ setLoading(true);
+ if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) {
+ PartnerResponse = await axios.post(`/qbo/receivables`, {
+ withCredentials: true,
+ jobIds: jobIds,
});
- setLoading(false);
- return;
- }
+ } else {
+ let QbXmlResponse;
+ try {
+ QbXmlResponse = await axios.post(
+ "/accounting/qbxml/receivables",
+ { jobIds: jobIds },
+ {
+ headers: {
+ Authorization: `Bearer ${await auth.currentUser.getIdToken()}`,
+ },
+ }
+ );
+ } catch (error) {
+ console.log("Error getting QBXML from Server.", error);
+ notification["error"]({
+ message: t("jobs.errors.exporting", {
+ error: "Unable to retrieve QBXML. " + JSON.stringify(error.message),
+ }),
+ });
+ setLoading(false);
+ return;
+ }
+ try {
+ PartnerResponse = await axios.post(
+ "http://localhost:1337/qb/",
+ // "http://609feaeae986.ngrok.io/qb/",
+ QbXmlResponse.data,
+ {
+ headers: {
+ Authorization: `Bearer ${await auth.currentUser.getIdToken()}`,
+ },
+ }
+ );
+ } catch (error) {
+ console.log("Error connecting to quickbooks or partner.", error);
+ notification["error"]({
+ message: t("jobs.errors.exporting-partner"),
+ });
+ setLoading(false);
+ return;
+ }
+ }
console.log("PartnerResponse", PartnerResponse);
- const groupedData = _.groupBy(PartnerResponse.data, "id");
+ const groupedData = _.groupBy(
+ PartnerResponse.data,
+ bodyshop.accountingconfig.qbo ? "jobid" : "id"
+ );
await Promise.all(
Object.keys(groupedData).map(async (key) => {
@@ -157,6 +165,7 @@ export function JobsExportAllButton({
if (!!completedCallback) completedCallback([]);
if (!!loadingCallback) loadingCallback(false);
+
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 4583251f9..5845fbb73 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
@@ -35,52 +35,61 @@ export function PayableExportAll({
const handleQbxml = async () => {
logImEXEvent("accounting_payables_export_all");
+ let PartnerResponse;
setLoading(true);
if (!!loadingCallback) loadingCallback(true);
-
- let QbXmlResponse;
- try {
- QbXmlResponse = await axios.post(
- "/accounting/qbxml/payables",
- { bills: billids },
- {
- headers: {
- Authorization: `Bearer ${await auth.currentUser.getIdToken()}`,
- },
- }
- );
- } catch (error) {
- console.log("Error getting QBXML from Server.", error);
- notification["error"]({
- message: t("bills.errors.exporting", {
- error: "Unable to retrieve QBXML. " + JSON.stringify(error.message),
- }),
+ if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) {
+ PartnerResponse = await axios.post(`/qbo/receivables`, {
+ withCredentials: true,
+ bills: billids,
});
- if (loadingCallback) loadingCallback(false);
- setLoading(false);
- return;
- }
+ } else {
+ let QbXmlResponse;
+ try {
+ QbXmlResponse = await axios.post(
+ "/accounting/qbxml/payables",
+ { bills: billids },
+ {
+ headers: {
+ Authorization: `Bearer ${await auth.currentUser.getIdToken()}`,
+ },
+ }
+ );
+ } catch (error) {
+ console.log("Error getting QBXML from Server.", error);
+ notification["error"]({
+ message: t("bills.errors.exporting", {
+ error: "Unable to retrieve QBXML. " + JSON.stringify(error.message),
+ }),
+ });
+ if (loadingCallback) loadingCallback(false);
+ setLoading(false);
+ return;
+ }
- let PartnerResponse;
-
- try {
- PartnerResponse = await axios.post(
- "http://localhost:1337/qb/",
- QbXmlResponse.data
- );
- } catch (error) {
- console.log("Error connecting to quickbooks or partner.", error);
- notification["error"]({
- message: t("bills.errors.exporting-partner"),
- });
- if (!!loadingCallback) loadingCallback(false);
- setLoading(false);
- return;
+ try {
+ PartnerResponse = await axios.post(
+ "http://localhost:1337/qb/",
+ QbXmlResponse.data
+ );
+ } catch (error) {
+ console.log("Error connecting to quickbooks or partner.", error);
+ notification["error"]({
+ message: t("bills.errors.exporting-partner"),
+ });
+ if (!!loadingCallback) loadingCallback(false);
+ setLoading(false);
+ return;
+ }
}
console.log("handleQbxml -> PartnerResponse", PartnerResponse);
- const groupedData = _.groupBy(PartnerResponse.data, "id");
+ const groupedData = _.groupBy(
+ PartnerResponse.data,
+ bodyshop.accountingconfig.qbo ? "billid" : "id"
+ );
+
const proms = [];
Object.keys(groupedData).forEach((key) => {
proms.push(
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 d531b308f..6a9fd2494 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
@@ -38,44 +38,53 @@ export function PayableExportButton({
setLoading(true);
if (!!loadingCallback) loadingCallback(true);
- let QbXmlResponse;
- try {
- QbXmlResponse = await axios.post(
- "/accounting/qbxml/payables",
- { bills: [billId] },
- {
- headers: {
- Authorization: `Bearer ${await auth.currentUser.getIdToken()}`,
- },
- }
- );
- } catch (error) {
- console.log("Error getting QBXML from Server.", error);
- notification["error"]({
- message: t("bills.errors.exporting", {
- error: "Unable to retrieve QBXML. " + JSON.stringify(error.message),
- }),
- });
- if (loadingCallback) loadingCallback(false);
- setLoading(false);
- return;
- }
-
+ //Check if it's a QBO Setup.
let PartnerResponse;
-
- try {
- PartnerResponse = await axios.post(
- "http://localhost:1337/qb/",
- QbXmlResponse.data
- );
- } catch (error) {
- console.log("Error connecting to quickbooks or partner.", error);
- notification["error"]({
- message: t("bills.errors.exporting-partner"),
+ if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) {
+ PartnerResponse = await axios.post(`/qbo/payables`, {
+ withCredentials: true,
+ bills: [billId],
});
- if (!!loadingCallback) loadingCallback(false);
- setLoading(false);
- return;
+ } else {
+ //Default is QBD
+
+ let QbXmlResponse;
+ try {
+ QbXmlResponse = await axios.post(
+ "/accounting/qbxml/payables",
+ { bills: [billId] },
+ {
+ headers: {
+ Authorization: `Bearer ${await auth.currentUser.getIdToken()}`,
+ },
+ }
+ );
+ } catch (error) {
+ console.log("Error getting QBXML from Server.", error);
+ notification["error"]({
+ message: t("bills.errors.exporting", {
+ error: "Unable to retrieve QBXML. " + JSON.stringify(error.message),
+ }),
+ });
+ if (loadingCallback) loadingCallback(false);
+ setLoading(false);
+ return;
+ }
+
+ try {
+ PartnerResponse = await axios.post(
+ "http://localhost:1337/qb/",
+ QbXmlResponse.data
+ );
+ } catch (error) {
+ console.log("Error connecting to quickbooks or partner.", error);
+ notification["error"]({
+ message: t("bills.errors.exporting-partner"),
+ });
+ if (!!loadingCallback) loadingCallback(false);
+ setLoading(false);
+ return;
+ }
}
console.log("handleQbxml -> PartnerResponse", PartnerResponse);
@@ -123,7 +132,14 @@ export function PayableExportButton({
});
const billUpdateResponse = await updateBill({
variables: {
- billIdList: successfulTransactions.map((st) => st.id),
+ billIdList: successfulTransactions.map(
+ (st) =>
+ st[
+ bodyshop.accountingconfig && bodyshop.accountingconfig.qbo
+ ? "billid"
+ : "id"
+ ]
+ ),
bill: {
exported: true,
exported_at: new Date(),
diff --git a/client/src/components/print-center-jobs/print-center-jobs.component.jsx b/client/src/components/print-center-jobs/print-center-jobs.component.jsx
index bf641ae74..7773a89df 100644
--- a/client/src/components/print-center-jobs/print-center-jobs.component.jsx
+++ b/client/src/components/print-center-jobs/print-center-jobs.component.jsx
@@ -1,28 +1,35 @@
import { Card, Col, Input, Row, Space, Typography } from "antd";
import _ from "lodash";
import React, { useState } from "react";
+import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectPrintCenter } from "../../redux/modals/modals.selectors";
+import { selectBodyshop } from "../../redux/user/user.selectors";
import { TemplateList } from "../../utils/TemplateConstants";
import Jobd3RdPartyModal from "../job-3rd-party-modal/job-3rd-party-modal.component";
import PrintCenterItem from "../print-center-item/print-center-item.component";
import PrintCenterSpeedPrint from "../print-center-speed-print/print-center-speed-print.component";
-import { useTranslation } from "react-i18next";
const mapStateToProps = createStructuredSelector({
printCenterModal: selectPrintCenter,
+ bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({});
-export function PrintCenterJobsComponent({ printCenterModal }) {
+export function PrintCenterJobsComponent({ printCenterModal, bodyshop }) {
const [search, setSearch] = useState("");
const { id: jobId } = printCenterModal.context;
const tempList = TemplateList("job", {});
const { t } = useTranslation();
- const JobsReportsList = Object.keys(tempList).map((key) => {
- return tempList[key];
- });
+ const JobsReportsList = Object.keys(tempList)
+ .map((key) => {
+ return tempList[key];
+ })
+ .filter(
+ (temp) =>
+ !temp.regions || (temp.regions && temp.regions[bodyshop.region_config])
+ );
const filteredJobsReportsList =
search !== ""
diff --git a/client/src/components/qbo-authorize/qbo-authorize.component.jsx b/client/src/components/qbo-authorize/qbo-authorize.component.jsx
index 839466f70..1f159afb0 100644
--- a/client/src/components/qbo-authorize/qbo-authorize.component.jsx
+++ b/client/src/components/qbo-authorize/qbo-authorize.component.jsx
@@ -1,19 +1,18 @@
-import { Button, Space } from "antd";
+import { Space, Tag } from "antd";
import Axios from "axios";
-import React, { useEffect } from "react";
-//import QboImg from "./qbo_signin.png";
import queryString from "query-string";
-import { useLocation } from "react-router-dom";
+import React, { useEffect } from "react";
import { useCookies } from "react-cookie";
+import { useHistory, useLocation } from "react-router-dom";
+import QboSignIn from "../../assets/qbo/C2QB_green_btn_med_default.svg";
export default function QboAuthorizeComponent() {
const location = useLocation();
-
- const [, setCookie] = useCookies(["access_token", "refresh_token"]);
+ const history = useHistory();
+ const [cookies, setCookie] = useCookies(["access_token", "refresh_token"]);
const handleQbSignIn = async () => {
const result = await Axios.post("/qbo/authorize");
- console.log("pushing to history", result.data);
window.location.href = result.data;
};
const qs = queryString.parse(location.search);
@@ -35,42 +34,24 @@ export default function QboAuthorizeComponent() {
path: "/",
expires,
});
+
+ history.push({ pathname: `/manage/accounting/receivables` });
}
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [qs, location, setCookie]);
return (
-