MAJOR CHANGE: Renamed invoices to bills BOD-410

This commit is contained in:
Patrick Fic
2020-09-22 17:01:03 -07:00
parent 95ee3ae2bc
commit f84520c260
91 changed files with 2510 additions and 2624 deletions

View File

@@ -1,8 +1,8 @@
import { Col, Row } from "antd";
import React from "react";
import AlertComponent from "../alert/alert.component";
import InvoicesListTableComponent from "../invoices-list-table/invoices-list-table.component";
import JobInvoicesTotalsComponent from "../job-invoices-total/job-invoices-total.component";
import BillsListTable from "../bills-list-table/bills-list-table.component";
import JobBillsTotal from "../job-bills-total/job-bills-total.component";
import PartsOrderModal from "../parts-order-modal/parts-order-modal.container";
import PartsOrderListTableComponent from "../parts-order-list-table/parts-order-list-table.component";
const tableCol = {
@@ -25,37 +25,33 @@ const totalsCol = {
export default function JobsDetailPliComponent({
job,
invoicesQuery,
handleInvoiceOnRowClick,
billsQuery,
handleBillOnRowClick,
handlePartsOrderOnRowClick,
selectedInvoice,
}) {
return (
<div>
<PartsOrderModal />
{invoicesQuery.error ? (
<AlertComponent message={invoicesQuery.error.message} type="error" />
{billsQuery.error ? (
<AlertComponent message={billsQuery.error.message} type="error" />
) : null}
<Row>
<Col {...tableCol}>
<PartsOrderListTableComponent
job={job}
loading={invoicesQuery.loading}
handleOnRowClick={handlePartsOrderOnRowClick}
selectedInvoice={selectedInvoice}
invoicesQuery={invoicesQuery}
billsQuery={billsQuery}
/>
<InvoicesListTableComponent
<BillsListTable
job={job}
loading={invoicesQuery.loading}
handleOnRowClick={handleInvoiceOnRowClick}
invoicesQuery={invoicesQuery}
handleOnRowClick={handleBillOnRowClick}
billsQuery={billsQuery}
/>
</Col>
<Col {...totalsCol}>
<JobInvoicesTotalsComponent
invoices={invoicesQuery.data ? invoicesQuery.data.invoices : []}
loading={invoicesQuery.loading}
<JobBillsTotal
bills={billsQuery.data ? billsQuery.data.bills : []}
loading={billsQuery.loading}
jobTotals={job.job_totals}
/>
</Col>

View File

@@ -2,25 +2,25 @@ import { useQuery } from "@apollo/react-hooks";
import queryString from "query-string";
import React from "react";
import { useHistory, useLocation } from "react-router-dom";
import { QUERY_INVOICES_BY_JOBID } from "../../graphql/invoices.queries";
import { QUERY_BILLS_BY_JOBID } from "../../graphql/bills.queries";
import JobsDetailPliComponent from "./jobs-detail-pli.component";
export default function JobsDetailPliContainer({ job }) {
const invoicesQuery = useQuery(QUERY_INVOICES_BY_JOBID, {
const billsQuery = useQuery(QUERY_BILLS_BY_JOBID, {
variables: { jobid: job.id },
});
const search = queryString.parse(useLocation().search);
const history = useHistory();
const handleInvoiceOnRowClick = (record) => {
const handleBillOnRowClick = (record) => {
if (record) {
if (record.id) {
search.invoiceid = record.id;
search.billid = record.id;
history.push({ search: queryString.stringify(search) });
}
} else {
delete search.invoiceid;
delete search.billid;
history.push({ search: queryString.stringify(search) });
}
};
@@ -40,8 +40,8 @@ export default function JobsDetailPliContainer({ job }) {
return (
<JobsDetailPliComponent
job={job}
invoicesQuery={invoicesQuery}
handleInvoiceOnRowClick={handleInvoiceOnRowClick}
billsQuery={billsQuery}
handleBillOnRowClick={handleBillOnRowClick}
handlePartsOrderOnRowClick={handlePartsOrderOnRowClick}
/>
);