From 2215c8439e706f7232e983747e823252c1f51b50 Mon Sep 17 00:00:00 2001 From: Dave Richer Date: Fri, 15 Mar 2024 16:12:27 -0400 Subject: [PATCH 01/10] - Hasura Migration Changes Signed-off-by: Dave Richer --- hasura/metadata/tables.yaml | 194 +++++++++++++++++- .../down.sql | 1 + .../up.sql | 18 ++ 3 files changed, 212 insertions(+), 1 deletion(-) create mode 100644 hasura/migrations/1710532848432_create_table_public_tasks/down.sql create mode 100644 hasura/migrations/1710532848432_create_table_public_tasks/up.sql diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index 587fa8ac3..2f47a4e8f 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -569,6 +569,13 @@ table: name: parts_orders schema: public + - name: tasks + using: + foreign_key_constraint_on: + column: billid + table: + name: tasks + schema: public insert_permissions: - role: user permission: @@ -818,6 +825,13 @@ table: name: inventory schema: public + - name: ioevents + using: + foreign_key_constraint_on: + column: bodyshopid + table: + name: ioevents + schema: public - name: jobs using: foreign_key_constraint_on: @@ -846,6 +860,13 @@ table: name: phonebook schema: public + - name: tasks + using: + foreign_key_constraint_on: + column: bodyshopid + table: + name: tasks + schema: public - name: timetickets using: foreign_key_constraint_on: @@ -2675,6 +2696,13 @@ - table: name: ioevents schema: public + object_relationships: + - name: bodyshop + using: + foreign_key_constraint_on: bodyshopid + - name: user + using: + foreign_key_constraint_on: useremail - table: name: job_ar_schema schema: public @@ -2824,6 +2852,13 @@ table: name: parts_order_lines schema: public + - name: tasks + using: + foreign_key_constraint_on: + column: joblineid + table: + name: tasks + schema: public insert_permissions: - role: user permission: @@ -3311,6 +3346,13 @@ table: name: scoreboard schema: public + - name: tasks + using: + foreign_key_constraint_on: + column: jobid + table: + name: tasks + schema: public - name: timetickets using: foreign_key_constraint_on: @@ -4200,7 +4242,7 @@ interval_sec: 10 num_retries: 0 timeout_sec: 60 - webhook_from_env: HASURA_API_URL + webhook: https://worktest.home.irony.online headers: - name: event-secret value_from_env: EVENT_SECRET @@ -5008,6 +5050,13 @@ table: name: parts_order_lines schema: public + - name: tasks + using: + foreign_key_constraint_on: + column: partsorderid + table: + name: tasks + schema: public insert_permissions: - role: user permission: @@ -5623,6 +5672,128 @@ _eq: X-Hasura-User-Id - active: _eq: true +- table: + name: tasks + schema: public + object_relationships: + - name: bill + using: + foreign_key_constraint_on: billid + - name: bodyshop + using: + foreign_key_constraint_on: bodyshopid + - name: job + using: + foreign_key_constraint_on: jobid + - name: jobline + using: + foreign_key_constraint_on: joblineid + - name: parts_order + using: + foreign_key_constraint_on: partsorderid + - name: user + using: + foreign_key_constraint_on: assigned_to + - name: userByCreatedBy + using: + foreign_key_constraint_on: created_by + insert_permissions: + - role: user + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - completed + - deleted + - priority + - assigned_to + - created_by + - description + - title + - completed_at + - created_at + - deleted_at + - due_date + - remind_at + - updated_at + - billid + - bodyshopid + - id + - jobid + - joblineid + - partsorderid + select_permissions: + - role: user + permission: + columns: + - completed + - deleted + - priority + - assigned_to + - created_by + - description + - title + - completed_at + - created_at + - deleted_at + - due_date + - remind_at + - updated_at + - billid + - bodyshopid + - id + - jobid + - joblineid + - partsorderid + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + update_permissions: + - role: user + permission: + columns: + - completed + - deleted + - priority + - assigned_to + - created_by + - description + - title + - completed_at + - created_at + - deleted_at + - due_date + - remind_at + - updated_at + - billid + - bodyshopid + - id + - jobid + - joblineid + - partsorderid + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + check: null - table: name: timetickets schema: public @@ -6006,6 +6177,13 @@ table: name: exportlog schema: public + - name: ioevents + using: + foreign_key_constraint_on: + column: useremail + table: + name: ioevents + schema: public - name: messages using: foreign_key_constraint_on: @@ -6034,6 +6212,20 @@ table: name: parts_orders schema: public + - name: tasks + using: + foreign_key_constraint_on: + column: assigned_to + table: + name: tasks + schema: public + - name: tasksByCreatedBy + using: + foreign_key_constraint_on: + column: created_by + table: + name: tasks + schema: public - name: timetickets using: foreign_key_constraint_on: diff --git a/hasura/migrations/1710532848432_create_table_public_tasks/down.sql b/hasura/migrations/1710532848432_create_table_public_tasks/down.sql new file mode 100644 index 000000000..ba949320f --- /dev/null +++ b/hasura/migrations/1710532848432_create_table_public_tasks/down.sql @@ -0,0 +1 @@ +DROP TABLE "public"."tasks"; diff --git a/hasura/migrations/1710532848432_create_table_public_tasks/up.sql b/hasura/migrations/1710532848432_create_table_public_tasks/up.sql new file mode 100644 index 000000000..f5e9db3c6 --- /dev/null +++ b/hasura/migrations/1710532848432_create_table_public_tasks/up.sql @@ -0,0 +1,18 @@ +CREATE TABLE "public"."tasks" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "title" text NOT NULL, "description" Text, "deleted" boolean NOT NULL DEFAULT false, "deleted_at" timestamptz, "due_date" timestamptz, "created_by" text NOT NULL, "assigned_to" Text, "completed" boolean NOT NULL DEFAULT false, "completed_at" timestamptz, "remind_at" timestamptz, "priority" numeric, "bodyshopid" UUID NOT NULL, "jobid" UUID NOT NULL, "joblineid" UUID, "partsorderid" UUID, "billid" UUID, PRIMARY KEY ("id") , FOREIGN KEY ("created_by") REFERENCES "public"."users"("email") ON UPDATE restrict ON DELETE restrict, FOREIGN KEY ("assigned_to") REFERENCES "public"."users"("email") ON UPDATE restrict ON DELETE restrict, FOREIGN KEY ("bodyshopid") REFERENCES "public"."bodyshops"("id") ON UPDATE restrict ON DELETE restrict, FOREIGN KEY ("jobid") REFERENCES "public"."jobs"("id") ON UPDATE cascade ON DELETE cascade, FOREIGN KEY ("joblineid") REFERENCES "public"."joblines"("id") ON UPDATE set null ON DELETE set null, FOREIGN KEY ("partsorderid") REFERENCES "public"."parts_orders"("id") ON UPDATE set null ON DELETE set null, FOREIGN KEY ("billid") REFERENCES "public"."bills"("id") ON UPDATE set null ON DELETE set null); +CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"() +RETURNS TRIGGER AS $$ +DECLARE + _new record; +BEGIN + _new := NEW; + _new."updated_at" = NOW(); + RETURN _new; +END; +$$ LANGUAGE plpgsql; +CREATE TRIGGER "set_public_tasks_updated_at" +BEFORE UPDATE ON "public"."tasks" +FOR EACH ROW +EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"(); +COMMENT ON TRIGGER "set_public_tasks_updated_at" ON "public"."tasks" +IS 'trigger to set value of column "updated_at" to current timestamp on row update'; +CREATE EXTENSION IF NOT EXISTS pgcrypto; From bc25c2398246b6a2edbfb48ae6b830673ec277e3 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 18 Mar 2024 15:41:32 -0700 Subject: [PATCH 02/10] Resolve event env var. --- hasura/metadata/tables.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index 2f47a4e8f..1dd02cf6a 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -4242,7 +4242,7 @@ interval_sec: 10 num_retries: 0 timeout_sec: 60 - webhook: https://worktest.home.irony.online + webhook_from_env: HASURA_API_URL headers: - name: event-secret value_from_env: EVENT_SECRET From f35ea026b8376198ca3029df469167834acd64df Mon Sep 17 00:00:00 2001 From: Dave Richer Date: Tue, 19 Mar 2024 16:25:21 -0400 Subject: [PATCH 03/10] - Hasura Migration Changes Signed-off-by: Dave Richer --- .../job-lifecycle/job-lifecycle-dashboard.component.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/dashboard-components/job-lifecycle/job-lifecycle-dashboard.component.jsx b/client/src/components/dashboard-components/job-lifecycle/job-lifecycle-dashboard.component.jsx index 417907eb9..85e8ef8fc 100644 --- a/client/src/components/dashboard-components/job-lifecycle/job-lifecycle-dashboard.component.jsx +++ b/client/src/components/dashboard-components/job-lifecycle/job-lifecycle-dashboard.component.jsx @@ -19,7 +19,7 @@ export default function JobLifecycleDashboardComponent({data, bodyshop, ...cardP setLoading(true); const response = await axios.post("/job/lifecycle", { jobids: data.job_lifecycle.map(x => x.id), - statuses: bodyshop.md_order_statuses + statuses: bodyshop.md_ro_statuses }); setLifecycleData(response.data.durations); setLoading(false); From d1132e7d4579b35934c0c58fb691d6a98543abec Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Tue, 19 Mar 2024 14:30:31 -0700 Subject: [PATCH 04/10] IO-2711 Check Box Visibility Signed-off-by: Allan Carr --- .../job-reconciliation-bills-table.component.jsx | 2 +- .../production-list-columns.data.js | 2 +- client/src/pages/bills/bills.page.component.jsx | 8 +++----- .../src/pages/export-logs/export-logs.page.component.jsx | 4 +--- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/client/src/components/job-reconciliation-bills-table/job-reconciliation-bills-table.component.jsx b/client/src/components/job-reconciliation-bills-table/job-reconciliation-bills-table.component.jsx index 5cbe83620..f40da850a 100644 --- a/client/src/components/job-reconciliation-bills-table/job-reconciliation-bills-table.component.jsx +++ b/client/src/components/job-reconciliation-bills-table/job-reconciliation-bills-table.component.jsx @@ -82,7 +82,7 @@ export default function JobReconciliationBillsTable({ state.sortedInfo.order, render: (text, record) => ( - + ), }, ]; diff --git a/client/src/components/production-list-columns/production-list-columns.data.js b/client/src/components/production-list-columns/production-list-columns.data.js index 7e706e430..6677c2127 100644 --- a/client/src/components/production-list-columns/production-list-columns.data.js +++ b/client/src/components/production-list-columns/production-list-columns.data.js @@ -302,7 +302,7 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => { onFilter: (value, record) => value.includes(record.special_coverage_policy), render: (text, record) => ( - + ), }, diff --git a/client/src/pages/bills/bills.page.component.jsx b/client/src/pages/bills/bills.page.component.jsx index 169a94a5e..43e199ae5 100644 --- a/client/src/pages/bills/bills.page.component.jsx +++ b/client/src/pages/bills/bills.page.component.jsx @@ -13,8 +13,8 @@ import { setModalContext } from "../../redux/modals/modals.actions"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; import { DateFormatter } from "../../utils/DateFormatter"; import { TemplateList } from "../../utils/TemplateConstants"; +import { pageLimit } from "../../utils/config"; import { alphaSort, dateSort } from "../../utils/sorters"; -import {pageLimit} from "../../utils/config"; const mapDispatchToProps = (dispatch) => ({ setPartsOrderContext: (context) => @@ -125,9 +125,7 @@ export function BillsListPage({ sortOrder: state.sortedInfo.columnKey === "is_credit_memo" && state.sortedInfo.order, - render: (text, record) => ( - - ), + render: (text, record) => , }, { title: t("bills.fields.exported"), @@ -136,7 +134,7 @@ export function BillsListPage({ sorter: (a, b) => a.exported - b.exported, sortOrder: state.sortedInfo.columnKey === "exported" && state.sortedInfo.order, - render: (text, record) => , + render: (text, record) => , }, { title: t("general.labels.actions"), diff --git a/client/src/pages/export-logs/export-logs.page.component.jsx b/client/src/pages/export-logs/export-logs.page.component.jsx index 8e090a712..565b13510 100644 --- a/client/src/pages/export-logs/export-logs.page.component.jsx +++ b/client/src/pages/export-logs/export-logs.page.component.jsx @@ -167,9 +167,7 @@ export function ExportLogsPageComponent({ bodyshop }) { { text: "False", value: false }, ], onFilter: (value, record) => record.successful === value, - render: (text, record) => ( - - ), + render: (text, record) => , }, { title: t("general.labels.message"), From 8f9b05b974b90205b924c8f857feac8c8445236f Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Tue, 19 Mar 2024 14:41:34 -0700 Subject: [PATCH 05/10] IO-2698 Fuel Level & Sorter Signed-off-by: Allan Carr --- .../courtesy-cars-list/courtesy-cars-list.component.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx b/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx index 3bd49d6e7..de1c6f0ed 100644 --- a/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx +++ b/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx @@ -178,7 +178,7 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) { title: t("courtesycars.fields.fuel"), dataIndex: "fuel", key: "fuel", - sorter: (a, b) => alphaSort(a.fuel, b.fuel), + sorter: (a, b) => a.fuel - b.fuel, sortOrder: state.sortedInfo.columnKey === "fuel" && state.sortedInfo.order, render: (text, record) => { @@ -187,12 +187,14 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) { return t("courtesycars.labels.fuel.full"); case 88: return t("courtesycars.labels.fuel.78"); + case 75: + return t("courtesycars.labels.fuel.34"); case 63: return t("courtesycars.labels.fuel.58"); case 50: return t("courtesycars.labels.fuel.12"); case 38: - return t("courtesycars.labels.fuel.34"); + return t("courtesycars.labels.fuel.38"); case 25: return t("courtesycars.labels.fuel.14"); case 13: From 23b5b740cb609c8a12c8f3d1534ce47015a8cdcd Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Tue, 19 Mar 2024 17:17:15 -0700 Subject: [PATCH 06/10] IO-2686 Disable Return Item button on Bill Drawer if InHouse Signed-off-by: Allan Carr --- .../bill-detail-edit/bill-detail-edit-return.component.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/components/bill-detail-edit/bill-detail-edit-return.component.jsx b/client/src/components/bill-detail-edit/bill-detail-edit-return.component.jsx index 3935fc5f2..87ea3e730 100644 --- a/client/src/components/bill-detail-edit/bill-detail-edit-return.component.jsx +++ b/client/src/components/bill-detail-edit/bill-detail-edit-return.component.jsx @@ -173,7 +173,11 @@ export function BillDetailEditReturn({ diff --git a/client/src/components/job-employee-assignments/job-employee-assignments.container.jsx b/client/src/components/job-employee-assignments/job-employee-assignments.container.jsx index a5feb3fa7..cd04d4fa1 100644 --- a/client/src/components/job-employee-assignments/job-employee-assignments.container.jsx +++ b/client/src/components/job-employee-assignments/job-employee-assignments.container.jsx @@ -43,13 +43,13 @@ export function JobEmployeeAssignmentsContainer({ }); if (refetch) refetch(); - insertAuditTrail({ - jobid: job.id, - operation: AuditTrailMapping.jobassignmentchange(operation, name), - type: "jobassignmentchange", - }); - - if (!!result.errors) { + if (!!!result.errors) { + insertAuditTrail({ + jobid: job.id, + operation: AuditTrailMapping.jobassignmentchange(operation, name), + type: "jobassignmentchange", + }); + } else { notification["error"]({ message: t("jobs.errors.assigning", { message: JSON.stringify(result.errors), @@ -67,18 +67,19 @@ export function JobEmployeeAssignmentsContainer({ variables: { jobId: job.id, job: { [empAssignment]: null } }, }); - if (!!result.errors) { + if (!!!result.errors) { + insertAuditTrail({ + jobid: job.id, + operation: AuditTrailMapping.jobassignmentremoved(operation), + type: "jobassignmentremoved", + }); + } else { notification["error"]({ message: t("jobs.errors.assigning", { message: JSON.stringify(result.errors), }), }); } - insertAuditTrail({ - jobid: job.id, - operation: AuditTrailMapping.jobassignmentremoved(operation), - type: "jobassignmentremoved", - }); setLoading(false); }; From b1ca09bd4fa908ed8b71bccde03b633b69d4100f Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Tue, 19 Mar 2024 17:55:59 -0700 Subject: [PATCH 09/10] IO-2710 Prettierr Signed-off-by: Allan Carr --- .../job-employee-assignments.component.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/client/src/components/job-employee-assignments/job-employee-assignments.component.jsx b/client/src/components/job-employee-assignments/job-employee-assignments.component.jsx index 5962d40fe..283a49447 100644 --- a/client/src/components/job-employee-assignments/job-employee-assignments.component.jsx +++ b/client/src/components/job-employee-assignments/job-employee-assignments.component.jsx @@ -23,7 +23,6 @@ export function JobEmployeeAssignments({ jobRO, body, refinish, - prep, csr, handleAdd, From 1f896b1edea948bfe079becf34b28bb94a0d4906 Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Thu, 21 Mar 2024 11:09:13 -0700 Subject: [PATCH 10/10] IO-2719 Missing CC Filter Signed-off-by: Allan Carr --- .../courtesy-cars-list/courtesy-cars-list.component.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx b/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx index 3bd49d6e7..fd3dfa15e 100644 --- a/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx +++ b/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx @@ -61,6 +61,10 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) { text: t("courtesycars.status.in"), value: "courtesycars.status.in", }, + { + text: t("courtesycars.status.inservice"), + value: "courtesycars.status.inservice", + }, { text: t("courtesycars.status.out"), value: "courtesycars.status.out", @@ -74,7 +78,7 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) { value: "courtesycars.status.leasereturn", }, ], - onFilter: (value, record) => value.includes(record.status), + onFilter: (value, record) => record.status === value, sortOrder: state.sortedInfo.columnKey === "status" && state.sortedInfo.order, render: (text, record) => {