From 28326f2628686dc091f84b511dc5cdee7907194c Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Tue, 1 Jun 2021 16:49:54 -0700 Subject: [PATCH 1/6] IO-1176 Move duplication totals to server side. --- ...bs-detail-header-actions.duplicate.util.js | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util.js b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util.js index 2a86cd9f7..f7f21864f 100644 --- a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util.js +++ b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util.js @@ -39,24 +39,20 @@ export default async function DuplicateJob( line.manual_line = true; }); newJob.joblines = keepJobLines ? _tempLines : []; - newJob.job_totals = ( - await Axios.post("/job/totals", { - job: newJob, - }) - ).data; delete newJob.joblines; newJob.joblines = keepJobLines ? { data: _tempLines } : null; - apolloClient - .mutate({ - mutation: INSERT_NEW_JOB, - variables: { job: [newJob] }, - }) - .then((res2) => { - if (completionCallback) - completionCallback(res2.data.insert_jobs.returning[0].id); - }); + const res2 = await apolloClient.mutate({ + mutation: INSERT_NEW_JOB, + variables: { job: [newJob] }, + }); + await Axios.post("/job/totalsssu", { + id: res2.data.insert_jobs.returning[0].id, + }); + + if (completionCallback) + completionCallback(res2.data.insert_jobs.returning[0].id); //insert the new job. call the callback with the returned ID when done. From 9ff9baa78ccdbd213ebb3ad0e298cb28383bd3ca Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 2 Jun 2021 08:49:10 -0700 Subject: [PATCH 2/6] IO-1096 Added order by to Parts Order --- bodyshop_translations.babel | 21 +++++++++ .../chat-conversation-title.component.jsx | 27 +++++------ .../chat-tag-ro/chat-tag-ro.component.jsx | 46 +++++++++---------- .../job-documents.utility.js | 2 +- .../jobs-documents-gallery.component.jsx | 1 - .../parts-order-list-table.component.jsx | 6 +++ .../parts-order-modal.component.jsx | 1 + .../parts-order-modal.container.jsx | 1 + client/src/graphql/bills.queries.js | 2 +- client/src/translations/en_us/common.json | 1 + client/src/translations/es/common.json | 1 + client/src/translations/fr/common.json | 1 + .../down.yaml | 5 ++ .../up.yaml | 6 +++ .../down.yaml | 5 ++ .../up.yaml | 5 ++ .../down.yaml | 5 ++ .../up.yaml | 10 ++++ .../down.yaml | 37 +++++++++++++++ .../up.yaml | 38 +++++++++++++++ .../down.yaml | 38 +++++++++++++++ .../up.yaml | 39 ++++++++++++++++ .../down.yaml | 36 +++++++++++++++ .../up.yaml | 37 +++++++++++++++ .../down.yaml | 30 ++++++++++++ .../up.yaml | 31 +++++++++++++ .../down.yaml | 29 ++++++++++++ .../up.yaml | 30 ++++++++++++ hasura/migrations/metadata.yaml | 17 ++++--- 29 files changed, 461 insertions(+), 47 deletions(-) create mode 100644 hasura/migrations/1622647828371_alter_table_public_conversations_add_column_archived/down.yaml create mode 100644 hasura/migrations/1622647828371_alter_table_public_conversations_add_column_archived/up.yaml create mode 100644 hasura/migrations/1622648039058_alter_table_public_parts_orders_add_column_orderedby/down.yaml create mode 100644 hasura/migrations/1622648039058_alter_table_public_parts_orders_add_column_orderedby/up.yaml create mode 100644 hasura/migrations/1622648063952_set_fk_public_parts_orders_orderedby/down.yaml create mode 100644 hasura/migrations/1622648063952_set_fk_public_parts_orders_orderedby/up.yaml create mode 100644 hasura/migrations/1622648072730_update_permission_user_public_table_parts_orders/down.yaml create mode 100644 hasura/migrations/1622648072730_update_permission_user_public_table_parts_orders/up.yaml create mode 100644 hasura/migrations/1622648079209_update_permission_user_public_table_parts_orders/down.yaml create mode 100644 hasura/migrations/1622648079209_update_permission_user_public_table_parts_orders/up.yaml create mode 100644 hasura/migrations/1622648087365_update_permission_user_public_table_parts_orders/down.yaml create mode 100644 hasura/migrations/1622648087365_update_permission_user_public_table_parts_orders/up.yaml create mode 100644 hasura/migrations/1622648112396_update_permission_user_public_table_conversations/down.yaml create mode 100644 hasura/migrations/1622648112396_update_permission_user_public_table_conversations/up.yaml create mode 100644 hasura/migrations/1622648118751_update_permission_user_public_table_conversations/down.yaml create mode 100644 hasura/migrations/1622648118751_update_permission_user_public_table_conversations/up.yaml diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 8d960bdfe..afae10463 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -26853,6 +26853,27 @@ + + orderedby + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + quantity false diff --git a/client/src/components/chat-conversation-title/chat-conversation-title.component.jsx b/client/src/components/chat-conversation-title/chat-conversation-title.component.jsx index 61cc3147c..7fa5bf585 100644 --- a/client/src/components/chat-conversation-title/chat-conversation-title.component.jsx +++ b/client/src/components/chat-conversation-title/chat-conversation-title.component.jsx @@ -1,3 +1,4 @@ +import { Space } from "antd"; import React from "react"; import PhoneNumberFormatter from "../../utils/PhoneFormatter"; import ChatConversationTitleTags from "../chat-conversation-title-tags/chat-conversation-title-tags.component"; @@ -5,20 +6,16 @@ import ChatTagRoContainer from "../chat-tag-ro/chat-tag-ro.container"; export default function ChatConversationTitle({ conversation }) { return ( -
-
- - -
-
- - {conversation && conversation.phone_num} - -
-
+ + + {conversation && conversation.phone_num} + + + + ); } diff --git a/client/src/components/chat-tag-ro/chat-tag-ro.component.jsx b/client/src/components/chat-tag-ro/chat-tag-ro.component.jsx index 106e91393..fef423b69 100644 --- a/client/src/components/chat-tag-ro/chat-tag-ro.component.jsx +++ b/client/src/components/chat-tag-ro/chat-tag-ro.component.jsx @@ -1,5 +1,5 @@ import { CloseCircleOutlined, LoadingOutlined } from "@ant-design/icons"; -import { Select, Empty } from "antd"; +import { Select, Empty, Space } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; @@ -13,27 +13,27 @@ export default function ChatTagRoComponent({ const { t } = useTranslation(); return ( -
- + +
+ +
{loading ? : null} {loading ? ( @@ -41,6 +41,6 @@ export default function ChatTagRoComponent({ ) : ( setVisible(false)} /> )} -
+ ); } diff --git a/client/src/components/jobs-documents-gallery/job-documents.utility.js b/client/src/components/jobs-documents-gallery/job-documents.utility.js index 054c51063..49ac4fbef 100644 --- a/client/src/components/jobs-documents-gallery/job-documents.utility.js +++ b/client/src/components/jobs-documents-gallery/job-documents.utility.js @@ -2,7 +2,7 @@ import { DetermineFileType } from "../documents-upload/documents-upload.utility" export const GenerateSrcUrl = (value) => { let extension = value.extension; - if (extension && extension.includes("heic")) extension = "jpg"; + if (extension && extension.toLowerCase().includes("heic")) extension = "jpg"; return `${process.env.REACT_APP_CLOUDINARY_ENDPOINT}/${DetermineFileType( value.type diff --git a/client/src/components/jobs-documents-gallery/jobs-documents-gallery.component.jsx b/client/src/components/jobs-documents-gallery/jobs-documents-gallery.component.jsx index 4a543401c..2b29a7b3c 100644 --- a/client/src/components/jobs-documents-gallery/jobs-documents-gallery.component.jsx +++ b/client/src/components/jobs-documents-gallery/jobs-documents-gallery.component.jsx @@ -166,7 +166,6 @@ function JobsDocumentsComponent({ zIndex: "5", }} onClick={() => { - console.log(`Clicked`); const newWindow = window.open( `${window.location.protocol}//${window.location.host}/edit?documentId=${galleryImages.images[index].id}`, "_blank", diff --git a/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx b/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx index 9ae6695e5..436229c0c 100644 --- a/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx +++ b/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx @@ -237,6 +237,11 @@ export function PartsOrderListTableComponent({ {record.deliver_by} ), }, + { + title: t("parts_orders.fields.orderedby"), + dataIndex: "orderedby", + key: "orderedby", + }, { title: t("general.labels.actions"), dataIndex: "actions", @@ -336,6 +341,7 @@ export function PartsOrderListTableComponent({ /> ), }, + { title: t("general.labels.actions"), dataIndex: "actions", diff --git a/client/src/components/parts-order-modal/parts-order-modal.component.jsx b/client/src/components/parts-order-modal/parts-order-modal.component.jsx index 81c289d95..03f6d4edd 100644 --- a/client/src/components/parts-order-modal/parts-order-modal.component.jsx +++ b/client/src/components/parts-order-modal/parts-order-modal.component.jsx @@ -73,6 +73,7 @@ export default function PartsOrderModalComponent({ Date: Wed, 2 Jun 2021 09:00:18 -0700 Subject: [PATCH 3/6] IO-1116 Notes Multiline display --- .../job-detail-cards/job-detail-cards.notes.component.jsx | 2 +- client/src/components/jobs-notes/jobs.notes.component.jsx | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/components/job-detail-cards/job-detail-cards.notes.component.jsx b/client/src/components/job-detail-cards/job-detail-cards.notes.component.jsx index 39b27c5f6..57fdec9ba 100644 --- a/client/src/components/job-detail-cards/job-detail-cards.notes.component.jsx +++ b/client/src/components/job-detail-cards/job-detail-cards.notes.component.jsx @@ -29,7 +29,7 @@ export default function JobDetailCardsNotesComponent({ loading, data }) { bordered dataSource={data.notes} renderItem={(item) => ( - + {item.critical ? ( ) : null} diff --git a/client/src/components/jobs-notes/jobs.notes.component.jsx b/client/src/components/jobs-notes/jobs.notes.component.jsx index e8354b026..2f3459211 100644 --- a/client/src/components/jobs-notes/jobs.notes.component.jsx +++ b/client/src/components/jobs-notes/jobs.notes.component.jsx @@ -57,6 +57,9 @@ export function JobNotesComponent({ dataIndex: "text", key: "text", ellipsis: true, + render: (text, record) => ( + {text} + ), }, { From 9d4f98d3ee5213656ed87b7ce9fea544fd8de1fd Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 2 Jun 2021 09:07:29 -0700 Subject: [PATCH 4/6] IO-1167 Resolve sorting on payments table. --- .../accounting-payments-table.component.jsx | 2 +- .../job-payments/job-payments.component.jsx | 18 +++++++++--------- client/src/graphql/jobs.queries.js | 1 + 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx b/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx index f2a72dd92..94ca9e50b 100644 --- a/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx +++ b/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx @@ -54,7 +54,7 @@ export default function AccountingPayablesTableComponent({ ellipsis: true, sorter: (a, b) => alphaSort(a.job.ownr_ln, b.job.ownr_ln), sortOrder: - state.sortedInfo.columnKey === "ownr_ln" && state.sortedInfo.order, + state.sortedInfo.columnKey === "owner" && state.sortedInfo.order, render: (text, record) => { return record.job.owner ? ( diff --git a/client/src/components/job-payments/job-payments.component.jsx b/client/src/components/job-payments/job-payments.component.jsx index eae8bc76e..fd2558492 100644 --- a/client/src/components/job-payments/job-payments.component.jsx +++ b/client/src/components/job-payments/job-payments.component.jsx @@ -8,8 +8,8 @@ import { selectJobReadOnly } from "../../redux/application/application.selectors import { setModalContext } from "../../redux/modals/modals.actions"; import { selectBodyshop } from "../../redux/user/user.selectors"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; -import { DateTimeFormatter } from "../../utils/DateFormatter"; -import { alphaSort } from "../../utils/sorters"; +import { DateFormatter } from "../../utils/DateFormatter"; +import { alphaSort, dateSort } from "../../utils/sorters"; import { TemplateList } from "../../utils/TemplateConstants"; import DataLabel from "../data-label/data-label.component"; import PrintWrapperComponent from "../print-wrapper/print-wrapper.component"; @@ -40,14 +40,14 @@ export function JobPayments({ }); const columns = [ { - title: t("payments.fields.created_at"), - dataIndex: "created_at", - key: "created_at", + title: t("payments.fields.date"), + dataIndex: "date", + key: "date", + sorter: (a, b) => dateSort(a.date, b.date), + sortOrder: - state.sortedInfo.columnKey === "created_at" && state.sortedInfo.order, - render: (text, record) => ( - {record.created_at} - ), + state.sortedInfo.columnKey === "date" && state.sortedInfo.order, + render: (text, record) => {record.date}, }, { title: t("payments.fields.payer"), diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 0ae54a202..62ba766cb 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -565,6 +565,7 @@ export const GET_JOB_BY_PK = gql` stripeid transactionid memo + date } cccontracts { id From 9dfff36edf26ab046b81b1446c60264499e0f5e8 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 2 Jun 2021 09:13:42 -0700 Subject: [PATCH 5/6] IO-1174 Adjust bill delete export log FK --- .../down.yaml | 12 ++++++++++++ .../up.yaml | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 hasura/migrations/1622650359491_set_fk_public_exportlog_billid/down.yaml create mode 100644 hasura/migrations/1622650359491_set_fk_public_exportlog_billid/up.yaml diff --git a/hasura/migrations/1622650359491_set_fk_public_exportlog_billid/down.yaml b/hasura/migrations/1622650359491_set_fk_public_exportlog_billid/down.yaml new file mode 100644 index 000000000..4cbdba134 --- /dev/null +++ b/hasura/migrations/1622650359491_set_fk_public_exportlog_billid/down.yaml @@ -0,0 +1,12 @@ +- args: + cascade: false + read_only: false + sql: |- + alter table "public"."exportlog" drop constraint "exportlog_billid_fkey", + add constraint "exportlog_billid_fkey" + foreign key ("billid") + references "public"."bills" + ("id") + on update restrict + on delete restrict; + type: run_sql diff --git a/hasura/migrations/1622650359491_set_fk_public_exportlog_billid/up.yaml b/hasura/migrations/1622650359491_set_fk_public_exportlog_billid/up.yaml new file mode 100644 index 000000000..34ec41ec8 --- /dev/null +++ b/hasura/migrations/1622650359491_set_fk_public_exportlog_billid/up.yaml @@ -0,0 +1,10 @@ +- args: + cascade: false + read_only: false + sql: |- + alter table "public"."exportlog" drop constraint "exportlog_billid_fkey", + add constraint "exportlog_billid_fkey" + foreign key ("billid") + references "public"."bills" + ("id") on update cascade on delete cascade; + type: run_sql From b897795c2726996f01f4b2e3295373a11b384e16 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 2 Jun 2021 10:08:51 -0700 Subject: [PATCH 6/6] Move MAPA/MASH to parts profit centers --- server/job/job-costing.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/server/job/job-costing.js b/server/job/job-costing.js index 179b96d4d..e9de9b5ff 100644 --- a/server/job/job-costing.js +++ b/server/job/job-costing.js @@ -265,11 +265,11 @@ function GenerateCostingData(job) { acc.labor[laborProfitCenter].add(laborAmount); if (val.mod_lbr_ty === "LAR") { - if (!acc.labor[defaultProfits["MAPA"]]) - acc.labor[defaultProfits["MAPA"]] = Dinero(); + if (!acc.parts[defaultProfits["MAPA"]]) + acc.parts[defaultProfits["MAPA"]] = Dinero(); materialsHours.mapaHrs += val.mod_lb_hrs || 0; - acc.labor[defaultProfits["MAPA"]] = acc.labor[ + acc.parts[defaultProfits["MAPA"]] = acc.parts[ defaultProfits["MAPA"] ].add( Dinero({ @@ -277,11 +277,11 @@ function GenerateCostingData(job) { }).multiply(val.mod_lb_hrs || 0) ); } - if (!acc.labor[defaultProfits["MASH"]]) - acc.labor[defaultProfits["MASH"]] = Dinero(); + if (!acc.parts[defaultProfits["MASH"]]) + acc.parts[defaultProfits["MASH"]] = Dinero(); if (val.mod_lbr_ty !== "LAR") { - acc.labor[defaultProfits["MASH"]] = acc.labor[ + acc.parts[defaultProfits["MASH"]] = acc.parts[ defaultProfits["MASH"] ].add( Dinero({ @@ -402,6 +402,7 @@ function GenerateCostingData(job) { }).multiply(materialsHours.mapaHrs) ); } + if (job.bodyshop.jc_hourly_rates && job.bodyshop.jc_hourly_rates.mash) { if ( !billTotalsByCostCenters[