Added payment export BOD-147

This commit is contained in:
Patrick Fic
2020-06-30 16:23:25 -07:00
parent f1f9d7424b
commit 044fb4b9e0
29 changed files with 960 additions and 286 deletions

View File

@@ -0,0 +1,48 @@
import { useQuery } from "@apollo/react-hooks";
import React, { useEffect } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import AccountingPaymentsTable from "../../components/accounting-payments-table/accounting-payments-table.component";
import AlertComponent from "../../components/alert/alert.component";
import { QUERY_PAYMENTS_FOR_EXPORT } from "../../graphql/accounting.queries";
import { setBreadcrumbs } from "../../redux/application/application.actions";
import { selectBodyshop } from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
});
export function AccountingPaymentsContainer({ bodyshop, setBreadcrumbs }) {
const { t } = useTranslation();
useEffect(() => {
document.title = t("titles.accounting-payments");
setBreadcrumbs([
{
link: "/manage/accounting/payments",
label: t("titles.bc.accounting-payments"),
},
]);
}, [t, setBreadcrumbs]);
const { loading, error, data } = useQuery(QUERY_PAYMENTS_FOR_EXPORT);
if (error) return <AlertComponent message={error.message} type="error" />;
return (
<div>
<AccountingPaymentsTable
loadaing={loading}
payments={data ? data.payments : []}
/>
</div>
);
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(AccountingPaymentsContainer);

View File

@@ -104,6 +104,9 @@ const AccountingReceivables = lazy(() =>
const AccountingPayables = lazy(() =>
import("../accounting-payables/accounting-payables.container")
);
const AccountingPayments = lazy(() =>
import("../accounting-payments/accounting-payments.container")
);
const AllJobs = lazy(() => import("../jobs-all/jobs-all.container"));
const JobsClose = lazy(() => import("../jobs-close/jobs-close.container"));
const ShopCsiPageContainer = lazy(() =>
@@ -163,10 +166,8 @@ export function Manage({ match, conflict }) {
<Elements stripe={stripePromise}>
<PaymentModalContainer />
</Elements>
<Route exact path={`${match.path}`} component={ManageRootPage} />
<Route exact path={`${match.path}/jobs`} component={JobsPage} />
<Switch>
<Route
exact
@@ -304,6 +305,11 @@ export function Manage({ match, conflict }) {
path={`${match.path}/accounting/payables`}
component={AccountingPayables}
/>
<Route
exact
path={`${match.path}/accounting/payments`}
component={AccountingPayments}
/>
<Route
exact
path={`${match.path}/payments`}

View File

@@ -1,21 +1,8 @@
import { useQuery } from "@apollo/react-hooks";
import queryString from "query-string";
import React from "react";
import { useHistory, useLocation } from "react-router-dom";
import TechLookupJobsList from "../../components/tech-lookup-jobs-list/tech-lookup-jobs-list.component";
import { SEARCH_FOR_JOBS } from "../../graphql/jobs.queries";
import { Row, Col } from "antd";
import TechLookupJobsDrawer from "../../components/tech-lookup-jobs-drawer/tech-lookup-jobs-drawer.component";
import TechLookupJobsList from "../../components/tech-lookup-jobs-list/tech-lookup-jobs-list.component";
export default function TechLookupContainer() {
const search = queryString.parse(useLocation().search);
const history = useHistory();
const { loading, error, data, refetch } = useQuery(SEARCH_FOR_JOBS, {
variables: { search: `%${search.ro_number}%` },
skip: !!!search.ro_number,
});
return (
<div>
<TechLookupJobsList />