Reformat all project files to use the prettier config file.
This commit is contained in:
@@ -1,88 +1,71 @@
|
||||
import {useQuery} from "@apollo/client";
|
||||
import React, {useEffect} from "react";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {connect} from "react-redux";
|
||||
import {createStructuredSelector} from "reselect";
|
||||
import { useQuery } from "@apollo/client";
|
||||
import React, { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import AccountingPayablesTable from "../../components/accounting-payables-table/accounting-payables-table.component";
|
||||
import AlertComponent from "../../components/alert/alert.component";
|
||||
import {checkPartnerStatus} from "../../components/partner-ping/partner-ping.component";
|
||||
import { checkPartnerStatus } from "../../components/partner-ping/partner-ping.component";
|
||||
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
import {QUERY_BILLS_FOR_EXPORT} from "../../graphql/accounting.queries";
|
||||
import {setBreadcrumbs, setSelectedHeader,} from "../../redux/application/application.actions";
|
||||
import {selectPartnerVersion} from "../../redux/application/application.selectors";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import { QUERY_BILLS_FOR_EXPORT } from "../../graphql/accounting.queries";
|
||||
import { setBreadcrumbs, setSelectedHeader } from "../../redux/application/application.actions";
|
||||
import { selectPartnerVersion } from "../../redux/application/application.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import FeatureWrapperComponent from "../../components/feature-wrapper/feature-wrapper.component";
|
||||
import InstanceRenderManager from '../../utils/instanceRenderMgr';
|
||||
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
partnerVersion: selectPartnerVersion,
|
||||
bodyshop: selectBodyshop,
|
||||
partnerVersion: selectPartnerVersion
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
setSelectedHeader: (key) => dispatch(setSelectedHeader(key)),
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
setSelectedHeader: (key) => dispatch(setSelectedHeader(key))
|
||||
});
|
||||
|
||||
export function AccountingPayablesContainer({
|
||||
bodyshop,
|
||||
setBreadcrumbs,
|
||||
setSelectedHeader,
|
||||
partnerVersion,
|
||||
}) {
|
||||
const {t} = useTranslation();
|
||||
export function AccountingPayablesContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, partnerVersion }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
document.title = t("titles.accounting-payables",{app: InstanceRenderManager({imex:'$t(titles.imexonline)', rome: '$t(titles.romeonline)', promanager: '$t(titles.promanager)'})});
|
||||
setSelectedHeader("payables");
|
||||
setBreadcrumbs([
|
||||
{
|
||||
link: "/manage/accounting/payables",
|
||||
label: t("titles.bc.accounting-payables"),
|
||||
},
|
||||
]);
|
||||
checkPartnerStatus(bodyshop, true);
|
||||
}, [t, setBreadcrumbs, setSelectedHeader, bodyshop]);
|
||||
|
||||
const {loading, error, data, refetch} = useQuery(QUERY_BILLS_FOR_EXPORT, {
|
||||
fetchPolicy: "network-only",
|
||||
nextFetchPolicy: "network-only",
|
||||
useEffect(() => {
|
||||
document.title = t("titles.accounting-payables", {
|
||||
app: InstanceRenderManager({
|
||||
imex: "$t(titles.imexonline)",
|
||||
rome: "$t(titles.romeonline)",
|
||||
promanager: "$t(titles.promanager)"
|
||||
})
|
||||
});
|
||||
setSelectedHeader("payables");
|
||||
setBreadcrumbs([
|
||||
{
|
||||
link: "/manage/accounting/payables",
|
||||
label: t("titles.bc.accounting-payables")
|
||||
}
|
||||
]);
|
||||
checkPartnerStatus(bodyshop, true);
|
||||
}, [t, setBreadcrumbs, setSelectedHeader, bodyshop]);
|
||||
|
||||
if (error) return <AlertComponent message={error.message} type="error"/>;
|
||||
const { loading, error, data, refetch } = useQuery(QUERY_BILLS_FOR_EXPORT, {
|
||||
fetchPolicy: "network-only",
|
||||
nextFetchPolicy: "network-only"
|
||||
});
|
||||
|
||||
const noPath =
|
||||
!partnerVersion?.qbpath &&
|
||||
!(
|
||||
bodyshop &&
|
||||
(bodyshop.cdk_dealerid ||
|
||||
bodyshop.pbs_serialnumber ||
|
||||
bodyshop.accountingconfig.qbo)
|
||||
);
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<FeatureWrapperComponent featureName='export'>
|
||||
<RbacWrapper action="accounting:payables">
|
||||
{noPath && (
|
||||
<AlertComponent
|
||||
type="error"
|
||||
message={t("general.messages.noacctfilepath")}
|
||||
/>
|
||||
)}
|
||||
<AccountingPayablesTable
|
||||
loadaing={loading}
|
||||
bills={data ? data.bills : []}
|
||||
refetch={refetch}
|
||||
/>
|
||||
</RbacWrapper>
|
||||
</FeatureWrapperComponent>
|
||||
</div>
|
||||
);
|
||||
const noPath =
|
||||
!partnerVersion?.qbpath &&
|
||||
!(bodyshop && (bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber || bodyshop.accountingconfig.qbo));
|
||||
|
||||
return (
|
||||
<div>
|
||||
<FeatureWrapperComponent featureName="export">
|
||||
<RbacWrapper action="accounting:payables">
|
||||
{noPath && <AlertComponent type="error" message={t("general.messages.noacctfilepath")} />}
|
||||
<AccountingPayablesTable loadaing={loading} bills={data ? data.bills : []} refetch={refetch} />
|
||||
</RbacWrapper>
|
||||
</FeatureWrapperComponent>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(AccountingPayablesContainer);
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(AccountingPayablesContainer);
|
||||
|
||||
Reference in New Issue
Block a user