From 613ab4c540acb185599a6ff1029e40082cbc9f52 Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Fri, 19 Mar 2021 15:36:18 -0700
Subject: [PATCH] IO-789 Adjust main job query to pull bill data.
---
.../job-detail-lines/job-lines.component.jsx | 52 ++++++++-----------
.../job-lines-bill-reference.component.jsx | 20 +------
client/src/graphql/bill-lines.queries.js | 23 --------
client/src/graphql/jobs.queries.js | 14 +++++
4 files changed, 38 insertions(+), 71 deletions(-)
diff --git a/client/src/components/job-detail-lines/job-lines.component.jsx b/client/src/components/job-detail-lines/job-lines.component.jsx
index 382f6da86..211ebb909 100644
--- a/client/src/components/job-detail-lines/job-lines.component.jsx
+++ b/client/src/components/job-detail-lines/job-lines.component.jsx
@@ -1,11 +1,10 @@
import { DeleteFilled, FilterFilled, SyncOutlined } from "@ant-design/icons";
-import { useMutation, useQuery } from "@apollo/client";
+import { useMutation } from "@apollo/client";
import { Button, Dropdown, Input, Menu, Space, Table } from "antd";
-import React, { useMemo, useState } from "react";
+import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
-import { QUERY_BILLS_BY_JOB_REF } from "../../graphql/bill-lines.queries";
import { DELETE_JOB_LINE_BY_PK } from "../../graphql/jobs-lines.queries";
import { selectJobReadOnly } from "../../redux/application/application.selectors";
import { setModalContext } from "../../redux/modals/modals.actions";
@@ -48,26 +47,26 @@ export function JobLinesComponent({
}) {
const [deleteJobLine] = useMutation(DELETE_JOB_LINE_BY_PK);
- const {
- loading: billLinesLoading,
- error: billLinesError,
- data: billLinesData,
- } = useQuery(QUERY_BILLS_BY_JOB_REF, {
- variables: { jobId: job && job.id },
- skip: loading || !job,
- });
+ // const {
+ // loading: billLinesLoading,
+ // error: billLinesError,
+ // data: billLinesData,
+ // } = useQuery(QUERY_BILLS_BY_JOB_REF, {
+ // variables: { jobId: job && job.id },
+ // skip: loading || !job,
+ // });
- const billLinesDataObj = useMemo(() => {
- if (!billLinesData) return {};
- const ret = {};
- billLinesData.billlines.map((b) => {
- if (b.joblineid) {
- ret[b.joblineid] = { ...b, total: b.actual_price * b.quantity };
- }
- return null;
- });
- return ret;
- }, [billLinesData]);
+ // const billLinesDataObj = useMemo(() => {
+ // if (!billLinesData) return {};
+ // const ret = {};
+ // billLinesData.billlines.map((b) => {
+ // if (b.joblineid) {
+ // ret[b.joblineid] = { ...b, total: b.actual_price * b.quantity };
+ // }
+ // return null;
+ // });
+ // return ret;
+ // }, [billLinesData]);
const [state, setState] = useState({
sortedInfo: {},
@@ -231,14 +230,7 @@ export function JobLinesComponent({
title: t("joblines.labels.billref"),
dataIndex: "billref",
key: "billref",
- render: (text, record) => (
-