From 3ed48b26f1443d6e4225cdbfc949f7225ac638cc Mon Sep 17 00:00:00 2001 From: swtmply Date: Wed, 12 Apr 2023 01:44:45 +0800 Subject: [PATCH 1/6] IO-2338 Changed vehicle column to be a hyperlink --- .../production-list-columns.data.js | 10 ++++++---- client/src/graphql/jobs.queries.js | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) 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 bd2f15817..7d122200d 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 @@ -91,11 +91,13 @@ const r = ({ technician, state, activeStatuses, bodyshop }) => { b.v_make_desc + b.v_model_desc ), sortOrder: - state.sortedInfo.columnKey === "ownr" && state.sortedInfo.order, + state.sortedInfo.columnKey === "vehicle" && state.sortedInfo.order, render: (text, record) => ( - {`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${ - record.v_model_desc || "" - } ${record.v_color || ""} ${record.plate_no || ""}`} + {`${ + record.v_model_yr || "" + } ${record.v_make_desc || ""} ${record.v_model_desc || ""} ${ + record.v_color || "" + } ${record.plate_no || ""}`} ), }, { diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index dce7aff66..a6273edc4 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -284,6 +284,7 @@ export const QUERY_JOBS_IN_PRODUCTION = gql` clm_no v_make_desc v_color + vehicleid plate_no actual_in scheduled_completion From 9fa995f00221c0d531874c31232b67045ad9b3ef Mon Sep 17 00:00:00 2001 From: swtmply Date: Wed, 12 Apr 2023 03:13:19 +0800 Subject: [PATCH 2/6] IO-2239 Added totals on cards in job scoreboards --- .../scoreboard-day-stats.component.jsx | 6 +++ .../scoreboard-targets-table.component.jsx | 48 +++++++++++++++++-- client/src/translations/en_us/common.json | 1 + 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/client/src/components/scoreboard-day-stats/scoreboard-day-stats.component.jsx b/client/src/components/scoreboard-day-stats/scoreboard-day-stats.component.jsx index 36b4a028b..497eab209 100644 --- a/client/src/components/scoreboard-day-stats/scoreboard-day-stats.component.jsx +++ b/client/src/components/scoreboard-day-stats/scoreboard-day-stats.component.jsx @@ -4,6 +4,7 @@ import React from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; +import { useTranslation } from "react-i18next"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, }); @@ -13,6 +14,7 @@ const mapDispatchToProps = (dispatch) => ({ export function ScoreboardDayStats({ bodyshop, date, entries }) { const { dailyPaintTarget, dailyBodyTarget } = bodyshop.scoreboard_target; + const { t } = useTranslation(); //let totalHrs = 0; const paintHrs = entries.reduce((acc, value) => { @@ -41,6 +43,10 @@ export function ScoreboardDayStats({ bodyshop, date, entries }) { label="P" value={paintHrs.toFixed(1)} /> + ); } diff --git a/client/src/components/scoreboard-targets-table/scoreboard-targets-table.component.jsx b/client/src/components/scoreboard-targets-table/scoreboard-targets-table.component.jsx index 6f22b3b8a..558b217b6 100644 --- a/client/src/components/scoreboard-targets-table/scoreboard-targets-table.component.jsx +++ b/client/src/components/scoreboard-targets-table/scoreboard-targets-table.component.jsx @@ -184,14 +184,56 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) { value={(values.todayPaint + values.todayBody).toFixed(1)} /> - + + + - - + + + + + + Date: Wed, 12 Apr 2023 13:02:45 -0700 Subject: [PATCH 3/6] IO-2243 Capture successful CDK posting details. --- hasura/metadata/tables.yaml | 200 +++++++++++++++++- .../down.sql | 4 + .../up.sql | 2 + server/cdk/cdk-job-export.js | 3 + 4 files changed, 198 insertions(+), 11 deletions(-) create mode 100644 hasura/migrations/1681329377686_alter_table_public_exportlog_add_column_metadata/down.sql create mode 100644 hasura/migrations/1681329377686_alter_table_public_exportlog_add_column_metadata/up.sql diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index a576c160e..6fe62169b 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -761,6 +761,13 @@ table: name: email_audit_trail schema: public + - name: employee_teams + using: + foreign_key_constraint_on: + column: bodyshopid + table: + name: employee_teams + schema: public - name: employees using: foreign_key_constraint_on: @@ -1945,6 +1952,165 @@ - active: _eq: true check: null +- table: + name: employee_team_members + schema: public + object_relationships: + - name: employee + using: + foreign_key_constraint_on: employeeid + - name: employee_team + using: + foreign_key_constraint_on: teamid + insert_permissions: + - role: user + permission: + check: + employee_team: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - labor_rates + - percentage + - created_at + - updated_at + - employeeid + - id + - teamid + select_permissions: + - role: user + permission: + columns: + - labor_rates + - percentage + - created_at + - updated_at + - employeeid + - id + - teamid + filter: + employee_team: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + update_permissions: + - role: user + permission: + columns: + - labor_rates + - percentage + - created_at + - updated_at + - employeeid + - id + - teamid + filter: + employee_team: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + check: null + delete_permissions: + - role: user + permission: + backend_only: false + filter: + employee_team: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true +- table: + name: employee_teams + schema: public + object_relationships: + - name: bodyshop + using: + foreign_key_constraint_on: bodyshopid + array_relationships: + - name: employee_team_members + using: + foreign_key_constraint_on: + column: teamid + table: + name: employee_team_members + schema: public + insert_permissions: + - role: user + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - active + - name + - created_at + - updated_at + - bodyshopid + - id + select_permissions: + - role: user + permission: + columns: + - active + - name + - created_at + - updated_at + - bodyshopid + - id + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + update_permissions: + - role: user + permission: + columns: + - active + - bodyshopid + - name + - updated_at + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + check: null - table: name: employee_vacation schema: public @@ -2045,6 +2211,13 @@ table: name: allocations schema: public + - name: employee_team_members + using: + foreign_key_constraint_on: + column: employeeid + table: + name: employee_team_members + schema: public - name: employee_vacations using: foreign_key_constraint_on: @@ -2218,30 +2391,32 @@ - active: _eq: true columns: - - id - - created_at - - updated_at - - jobid - billid + - bodyshopid + - created_at + - id + - jobid + - message + - metadata - paymentid - successful - - message - - bodyshopid + - updated_at - useremail select_permissions: - role: user permission: columns: - - successful - - message - - useremail - - created_at - - updated_at - billid - bodyshopid + - created_at - id - jobid + - message + - metadata - paymentid + - successful + - updated_at + - useremail filter: bodyshop: associations: @@ -2493,6 +2668,7 @@ _eq: true columns: - act_price + - act_price_before_ppc - ah_detail_line - alt_co_id - alt_overrd @@ -2559,6 +2735,7 @@ permission: columns: - act_price + - act_price_before_ppc - ah_detail_line - alt_co_id - alt_overrd @@ -2637,6 +2814,7 @@ permission: columns: - act_price + - act_price_before_ppc - ah_detail_line - alt_co_id - alt_overrd diff --git a/hasura/migrations/1681329377686_alter_table_public_exportlog_add_column_metadata/down.sql b/hasura/migrations/1681329377686_alter_table_public_exportlog_add_column_metadata/down.sql new file mode 100644 index 000000000..3c175e747 --- /dev/null +++ b/hasura/migrations/1681329377686_alter_table_public_exportlog_add_column_metadata/down.sql @@ -0,0 +1,4 @@ +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- alter table "public"."exportlog" add column "metadata" jsonb +-- null; diff --git a/hasura/migrations/1681329377686_alter_table_public_exportlog_add_column_metadata/up.sql b/hasura/migrations/1681329377686_alter_table_public_exportlog_add_column_metadata/up.sql new file mode 100644 index 000000000..621b8481c --- /dev/null +++ b/hasura/migrations/1681329377686_alter_table_public_exportlog_add_column_metadata/up.sql @@ -0,0 +1,2 @@ +alter table "public"."exportlog" add column "metadata" jsonb + null; diff --git a/server/cdk/cdk-job-export.js b/server/cdk/cdk-job-export.js index d5fb6b295..3987d21bc 100644 --- a/server/cdk/cdk-job-export.js +++ b/server/cdk/cdk-job-export.js @@ -224,6 +224,7 @@ async function CdkSelectedCustomer(socket, selectedCustomerId) { } finally { //Ensure we always insert logEvents //GQL to insert logevents. + CdkBase.createLogEvent( socket, "DEBUG", @@ -1213,6 +1214,7 @@ async function GenerateTransWips(socket) { wips.push(item); }); + socket.transWips = wips; return wips; } @@ -1388,6 +1390,7 @@ async function MarkJobExported(socket, jobid) { jobid: jobid, successful: true, useremail: socket.user.email, + metadata: socket.transWips, }, bill: { exported: true, From 3d9a07bd393014de7e332d6c45467a7e2fbc7d30 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Wed, 12 Apr 2023 13:08:39 -0700 Subject: [PATCH 4/6] Include employee team changes from Payroll Based Changes. --- hasura/metadata/tables.yaml | 22 +++++++++---------- .../down.sql | 1 + .../up.sql | 18 +++++++++++++++ .../down.sql | 1 + .../up.sql | 18 +++++++++++++++ 5 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 hasura/migrations/1681155844658_create_table_public_employee_teams/down.sql create mode 100644 hasura/migrations/1681155844658_create_table_public_employee_teams/up.sql create mode 100644 hasura/migrations/1681156265693_create_table_public_employee_team_members/down.sql create mode 100644 hasura/migrations/1681156265693_create_table_public_employee_team_members/up.sql diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index 6fe62169b..0055e4b7a 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -2391,32 +2391,30 @@ - active: _eq: true columns: - - billid - - bodyshopid - - created_at - id + - created_at + - updated_at - jobid - - message - - metadata + - billid - paymentid - successful - - updated_at + - message + - bodyshopid - useremail select_permissions: - role: user permission: columns: + - successful + - message + - useremail + - created_at + - updated_at - billid - bodyshopid - - created_at - id - jobid - - message - - metadata - paymentid - - successful - - updated_at - - useremail filter: bodyshop: associations: diff --git a/hasura/migrations/1681155844658_create_table_public_employee_teams/down.sql b/hasura/migrations/1681155844658_create_table_public_employee_teams/down.sql new file mode 100644 index 000000000..1639caf73 --- /dev/null +++ b/hasura/migrations/1681155844658_create_table_public_employee_teams/down.sql @@ -0,0 +1 @@ +DROP TABLE "public"."employee_teams"; diff --git a/hasura/migrations/1681155844658_create_table_public_employee_teams/up.sql b/hasura/migrations/1681155844658_create_table_public_employee_teams/up.sql new file mode 100644 index 000000000..994e15280 --- /dev/null +++ b/hasura/migrations/1681155844658_create_table_public_employee_teams/up.sql @@ -0,0 +1,18 @@ +CREATE TABLE "public"."employee_teams" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "bodyshopid" uuid NOT NULL, "name" text NOT NULL, "active" boolean NOT NULL DEFAULT true, PRIMARY KEY ("id") , FOREIGN KEY ("bodyshopid") REFERENCES "public"."bodyshops"("id") ON UPDATE cascade ON DELETE cascade); +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_employee_teams_updated_at" +BEFORE UPDATE ON "public"."employee_teams" +FOR EACH ROW +EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"(); +COMMENT ON TRIGGER "set_public_employee_teams_updated_at" ON "public"."employee_teams" +IS 'trigger to set value of column "updated_at" to current timestamp on row update'; +CREATE EXTENSION IF NOT EXISTS pgcrypto; diff --git a/hasura/migrations/1681156265693_create_table_public_employee_team_members/down.sql b/hasura/migrations/1681156265693_create_table_public_employee_team_members/down.sql new file mode 100644 index 000000000..14ab424ce --- /dev/null +++ b/hasura/migrations/1681156265693_create_table_public_employee_team_members/down.sql @@ -0,0 +1 @@ +DROP TABLE "public"."employee_team_members"; diff --git a/hasura/migrations/1681156265693_create_table_public_employee_team_members/up.sql b/hasura/migrations/1681156265693_create_table_public_employee_team_members/up.sql new file mode 100644 index 000000000..e6a32938f --- /dev/null +++ b/hasura/migrations/1681156265693_create_table_public_employee_team_members/up.sql @@ -0,0 +1,18 @@ +CREATE TABLE "public"."employee_team_members" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "teamid" uuid NOT NULL, "employeeid" uuid NOT NULL, "labor_rates" jsonb NOT NULL DEFAULT jsonb_build_object(), "percentage" numeric NOT NULL DEFAULT 0, PRIMARY KEY ("id") , FOREIGN KEY ("teamid") REFERENCES "public"."employee_teams"("id") ON UPDATE cascade ON DELETE cascade, FOREIGN KEY ("employeeid") REFERENCES "public"."employees"("id") ON UPDATE cascade ON DELETE cascade); +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_employee_team_members_updated_at" +BEFORE UPDATE ON "public"."employee_team_members" +FOR EACH ROW +EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"(); +COMMENT ON TRIGGER "set_public_employee_team_members_updated_at" ON "public"."employee_team_members" +IS 'trigger to set value of column "updated_at" to current timestamp on row update'; +CREATE EXTENSION IF NOT EXISTS pgcrypto; From 1460fa6fd73cc82e9688c64adc9012f72060c237 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Wed, 12 Apr 2023 13:13:51 -0700 Subject: [PATCH 5/6] Add ppc field to job lines. --- .../down.sql | 4 ++++ .../up.sql | 2 ++ 2 files changed, 6 insertions(+) create mode 100644 hasura/migrations/1679343513178_alter_table_public_joblines_add_column_act_price_before_ppc/down.sql create mode 100644 hasura/migrations/1679343513178_alter_table_public_joblines_add_column_act_price_before_ppc/up.sql diff --git a/hasura/migrations/1679343513178_alter_table_public_joblines_add_column_act_price_before_ppc/down.sql b/hasura/migrations/1679343513178_alter_table_public_joblines_add_column_act_price_before_ppc/down.sql new file mode 100644 index 000000000..641b06fc4 --- /dev/null +++ b/hasura/migrations/1679343513178_alter_table_public_joblines_add_column_act_price_before_ppc/down.sql @@ -0,0 +1,4 @@ +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- alter table "public"."joblines" add column "act_price_before_ppc" numeric +-- null; diff --git a/hasura/migrations/1679343513178_alter_table_public_joblines_add_column_act_price_before_ppc/up.sql b/hasura/migrations/1679343513178_alter_table_public_joblines_add_column_act_price_before_ppc/up.sql new file mode 100644 index 000000000..c817ce67a --- /dev/null +++ b/hasura/migrations/1679343513178_alter_table_public_joblines_add_column_act_price_before_ppc/up.sql @@ -0,0 +1,2 @@ +alter table "public"."joblines" add column "act_price_before_ppc" numeric + null; From f48fb7130edabcb7bde0209e758789dc778f77ba Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Wed, 12 Apr 2023 13:16:18 -0700 Subject: [PATCH 6/6] IO-2137 Adjust PBS company name logic for posting. --- server/accounting/pbs/pbs-job-export.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/accounting/pbs/pbs-job-export.js b/server/accounting/pbs/pbs-job-export.js index ee0b3c8a8..cfbe71a19 100644 --- a/server/accounting/pbs/pbs-job-export.js +++ b/server/accounting/pbs/pbs-job-export.js @@ -249,10 +249,10 @@ async function QueryCustomersFromDms(socket) { SerialNumber: socket.JobData.bodyshop.pbs_serialnumber, //ContactId: "00000000000000000000000000000000", // ContactCode: socket.JobData.owner.accountingid, - FirstName: socket.JobData.ownr_co_nm + FirstName: socket.JobData.ownr_fn, + LastName: socket.JobData.ownr_co_nm ? socket.JobData.ownr_co_nm - : socket.JobData.ownr_fn, - LastName: socket.JobData.ownr_ln, + : socket.JobData.ownr_ln, PhoneNumber: socket.JobData.ownr_ph1, EmailAddress: socket.JobData.ownr_ea, // ModifiedSince: "0001-01-01T00:00:00.0000000Z",