From 04f4ce97ed162e0a91dd8a6aab950dd7e04061be Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 18 Oct 2022 09:00:21 -0700 Subject: [PATCH] IO-2059 Add invoice history to job line expander. --- bodyshop_translations.babel | 21 +++++++++ .../job-lines-expander.component.jsx | 43 ++++++++++++++++++- client/src/graphql/jobs.queries.js | 16 +++++++ client/src/translations/en_us/common.json | 1 + client/src/translations/es/common.json | 1 + client/src/translations/fr/common.json | 1 + 6 files changed, 82 insertions(+), 1 deletion(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index b6274d250..c4ef6e2fa 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -37395,6 +37395,27 @@ + + parts_invoice_label_single + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + parts_label_multiple false diff --git a/client/src/components/job-detail-lines/job-lines-expander.component.jsx b/client/src/components/job-detail-lines/job-lines-expander.component.jsx index b875a61b1..7f8408aae 100644 --- a/client/src/components/job-detail-lines/job-lines-expander.component.jsx +++ b/client/src/components/job-detail-lines/job-lines-expander.component.jsx @@ -6,6 +6,8 @@ import { useTranslation } from "react-i18next"; import AlertComponent from "../alert/alert.component"; import { DateFormatter } from "../../utils/DateFormatter"; import { Link } from "react-router-dom"; +import CurrencyFormatter from "../../utils/CurrencyFormatter"; +import DataLabel from "../data-label/data-label.component"; export default function JobLinesExpander({ jobline, jobid }) { const { t } = useTranslation(); @@ -48,7 +50,46 @@ export default function JobLinesExpander({ jobline, jobid }) { )} - + + {t("bills.labels.bills")} + + {data.billlines.length > 0 ? ( + data.billlines.map((line) => ( + + + + + {line.bill.invoice_number} + + + + + {`${t("billlines.fields.actual_price")}: `} + {line.actual_price} + + + + + {`${t("billlines.fields.actual_cost")}: `} + {line.actual_cost} + + + + {line.bill.date} + + {line.bill.vendor.name} + + + )) + ) : ( + + {t("parts_orders.labels.notyetordered")} + + )} + + ); } diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 7d0bcb8f0..4bf702cee 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -2120,6 +2120,22 @@ export const DELETE_RELATED_RO = gql` `; export const GET_JOB_LINE_ORDERS = gql` query GET_JOB_LINE_ORDERS($joblineid: uuid!) { + billlines(where: { joblineid: { _eq: $joblineid } }) { + actual_cost + actual_price + billid + quantity + bill { + id + invoice_number + date + vendorid + vendor { + id + name + } + } + } parts_order_lines(where: { job_line_id: { _eq: $joblineid } }) { id act_price diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 12e52e1a5..fb0b5535c 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -2215,6 +2215,7 @@ "mpi_eglass_auth": "MPI - eGlass Auth", "mpi_final_acct_sheet": "MPI - Final Accounting Sheet", "paint_grid": "Paint Grid", + "parts_invoice_label_single": "Parts Label Single", "parts_label_multiple": "Parts Label - Multi", "parts_label_single": "Parts Label - Single", "parts_list": "Parts List", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 6bba2a817..9f93cc0e8 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -2215,6 +2215,7 @@ "mpi_eglass_auth": "", "mpi_final_acct_sheet": "", "paint_grid": "", + "parts_invoice_label_single": "", "parts_label_multiple": "", "parts_label_single": "", "parts_list": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 1c446e2a3..35cec2c41 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -2215,6 +2215,7 @@ "mpi_eglass_auth": "", "mpi_final_acct_sheet": "", "paint_grid": "", + "parts_invoice_label_single": "", "parts_label_multiple": "", "parts_label_single": "", "parts_list": "",