diff --git a/client/src/components/bill-detail-edit/bill-detail-edit-component.jsx b/client/src/components/bill-detail-edit/bill-detail-edit-component.jsx index 93d115254..4380c77d2 100644 --- a/client/src/components/bill-detail-edit/bill-detail-edit-component.jsx +++ b/client/src/components/bill-detail-edit/bill-detail-edit-component.jsx @@ -1,5 +1,5 @@ import { useMutation, useQuery } from "@apollo/client"; -import { Button, Form, PageHeader, Popconfirm, Space } from "antd"; +import { Button, Divider, Form, PageHeader, Popconfirm, Space } from "antd"; import moment from "moment"; import queryString from "query-string"; import React, { useState } from "react"; @@ -208,7 +208,7 @@ export function BillDetailEditcontainer({ layout="vertical" > - + {t("general.labels.media")} {bodyshop.uselocalmediaserver ? ( 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); }; 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/jobs-detail-header/jobs-detail-header.component.jsx b/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx index 694fea5d7..4d737ee67 100644 --- a/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx +++ b/client/src/components/jobs-detail-header/jobs-detail-header.component.jsx @@ -5,6 +5,7 @@ import { WarningFilled, } from "@ant-design/icons"; import { Card, Col, Divider, Row, Space, Tag, Tooltip } from "antd"; +import moment from "moment"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; @@ -26,7 +27,6 @@ import ProductionListColumnComment from "../production-list-columns/production-l import ProductionListColumnProductionNote from "../production-list-columns/production-list-columns.productionnote.component"; import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component"; import "./jobs-detail-header.styles.scss"; -import moment from "moment"; const mapStateToProps = createStructuredSelector({ jobRO: selectJobReadOnly, @@ -101,7 +101,11 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) { {job.status === bodyshop.md_ro_statuses.default_scheduled && job.scheduled_in ? ( - + {job.scheduled_in} @@ -221,6 +225,12 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) { {job.owner?.tax_number || ""} )} + + {job.owner?.note || ""} + 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/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 1379535e1..31f9be07c 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -704,6 +704,7 @@ export const GET_JOB_BY_PK = gql` other_amount_payable owner { id + note ownr_fn ownr_ln ownr_co_nm 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"), diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index b70828672..de1c35af8 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1114,6 +1114,7 @@ "loadingshop": "Loading shop data...", "loggingin": "Authorizing...", "markedexported": "Manually marked as exported.", + "media": "Media", "message": "Message", "monday": "Monday", "na": "N/A", diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index 0467fae39..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: @@ -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;