From 6d8463265cb76eebab12b1801e5aaa6714237f8a Mon Sep 17 00:00:00 2001 From: swtmply Date: Tue, 6 Jun 2023 02:07:30 +0800 Subject: [PATCH 01/11] IO-2317 Messaging screen on mobile --- .../chat-conversation-title.component.jsx | 23 +++++++++++++++++-- .../chat-popup/chat-popup.component.jsx | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) 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 1503bf46f..9fb9776a3 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,14 +1,31 @@ -import { Space } from "antd"; +import { Space, Button, Col } from "antd"; import React from "react"; import PhoneNumberFormatter from "../../utils/PhoneFormatter"; import ChatArchiveButton from "../chat-archive-button/chat-archive-button.component"; import ChatConversationTitleTags from "../chat-conversation-title-tags/chat-conversation-title-tags.component"; import ChatLabelComponent from "../chat-label/chat-label.component"; import ChatTagRoContainer from "../chat-tag-ro/chat-tag-ro.container"; +import { connect } from "react-redux"; +import { setSelectedConversation } from "../../redux/messaging/messaging.actions"; +import { LeftOutlined } from "@ant-design/icons"; -export default function ChatConversationTitle({ conversation }) { +const mapDispatchToProps = (dispatch) => ({ + setSelectedConversation: (conversationId) => + dispatch(setSelectedConversation(conversationId)), +}); + +function ChatConversationTitle({ conversation, setSelectedConversation }) { return ( + + + {conversation && conversation.phone_num} @@ -23,3 +40,5 @@ export default function ChatConversationTitle({ conversation }) { ); } + +export default connect(null, mapDispatchToProps)(ChatConversationTitle); diff --git a/client/src/components/chat-popup/chat-popup.component.jsx b/client/src/components/chat-popup/chat-popup.component.jsx index 1c80d7c4c..45b2a332f 100644 --- a/client/src/components/chat-popup/chat-popup.component.jsx +++ b/client/src/components/chat-popup/chat-popup.component.jsx @@ -112,7 +112,7 @@ export function ChatPopupComponent({ /> - + {loading ? ( ) : ( From 6d5dbf3145d3e4b12087ad1aaf7f2c79a4ab8e9f Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Mon, 5 Jun 2023 17:13:31 -0700 Subject: [PATCH 02/11] IO-2281 Hover Row Color --- client/src/App/App.styles.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/App/App.styles.scss b/client/src/App/App.styles.scss index b57e94677..ddf87ac42 100644 --- a/client/src/App/App.styles.scss +++ b/client/src/App/App.styles.scss @@ -145,7 +145,7 @@ //Update row highlighting on production board. .ant-table-tbody > tr.ant-table-row:hover > td { - background: #eaeaea !important; + background: #e7f3ff !important; } .job-line-manual { From 5a3ddfad0fb23b9b10c08f098848b8d160046faf Mon Sep 17 00:00:00 2001 From: swtmply Date: Tue, 6 Jun 2023 22:20:22 +0800 Subject: [PATCH 03/11] IO-2280 fixed query params in shop config --- client/src/components/header/header.component.jsx | 4 +++- client/src/components/shop-info/shop-info.component.jsx | 4 +++- client/src/pages/shop/shop.page.component.jsx | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client/src/components/header/header.component.jsx b/client/src/components/header/header.component.jsx index 1ed3f526d..f0edf82d2 100644 --- a/client/src/components/header/header.component.jsx +++ b/client/src/components/header/header.component.jsx @@ -311,7 +311,9 @@ function Header({ icon={} > }> - {t("menus.header.shop_config")} + + {t("menus.header.shop_config")} + }> {t("menus.header.dashboard")} diff --git a/client/src/components/shop-info/shop-info.component.jsx b/client/src/components/shop-info/shop-info.component.jsx index efabb6d5b..8803500ef 100644 --- a/client/src/components/shop-info/shop-info.component.jsx +++ b/client/src/components/shop-info/shop-info.component.jsx @@ -52,7 +52,9 @@ export function ShopInfoComponent({ bodyshop, form, saveLoading }) { - history.push({ search: `?tab=${search.tab}&subtab=${key}` }) + history.push({ + search: `?tab=${search.tab}&subtab=${key}`, + }) } > diff --git a/client/src/pages/shop/shop.page.component.jsx b/client/src/pages/shop/shop.page.component.jsx index 47107be43..de6b267d5 100644 --- a/client/src/pages/shop/shop.page.component.jsx +++ b/client/src/pages/shop/shop.page.component.jsx @@ -40,6 +40,10 @@ export function ShopPage({ bodyshop, setSelectedHeader, setBreadcrumbs }) { ]); }, [t, setSelectedHeader, setBreadcrumbs, bodyshop.shopname]); + useEffect(() => { + if (!search.tab) history.push({ search: "?tab=info" }); + }, [history, search]); + return ( Date: Tue, 6 Jun 2023 22:39:39 +0800 Subject: [PATCH 04/11] IO-2311 fixed tile height --- .../chat-conversation-list.component.jsx | 97 +++++++++++-------- 1 file changed, 59 insertions(+), 38 deletions(-) diff --git a/client/src/components/chat-conversation-list/chat-conversation-list.component.jsx b/client/src/components/chat-conversation-list/chat-conversation-list.component.jsx index ffc087ae2..e9afdc83d 100644 --- a/client/src/components/chat-conversation-list/chat-conversation-list.component.jsx +++ b/client/src/components/chat-conversation-list/chat-conversation-list.component.jsx @@ -7,7 +7,12 @@ import { selectSelectedConversation } from "../../redux/messaging/messaging.sele import { TimeAgoFormatter } from "../../utils/DateFormatter"; import PhoneFormatter from "../../utils/PhoneFormatter"; import OwnerNameDisplay from "../owner-name-display/owner-name-display.component"; -import { List as VirtualizedList, AutoSizer } from "react-virtualized"; +import { + List as VirtualizedList, + AutoSizer, + CellMeasurerCache, + CellMeasurer, +} from "react-virtualized"; import "./chat-conversation-list.styles.scss"; @@ -33,48 +38,64 @@ function ChatConversationListComponent({ [] ); - const rowRenderer = ({ index, key, style }) => { + const cache = new CellMeasurerCache({ + fixedWidth: true, + defaultHeight: 60, + }); + + const rowRenderer = ({ index, key, style, parent }) => { const item = conversationList[index]; return ( - setSelectedConversation(item.id)} - className={`chat-list-item ${ - item.id === selectedConversation - ? "chat-list-selected-conversation" - : null - }`} - style={style} + cache={cache} + parent={parent} + columnIndex={0} + rowIndex={index} > -
- {item.label &&
{item.label}
} - {item.job_conversations.length > 0 ? ( -
- {item.job_conversations.map((j, idx) => ( -
- -
- ))} -
- ) : ( - {item.phone_num} - )} -
-
-
- {item.job_conversations.length > 0 - ? item.job_conversations.map((j, idx) => ( - - {j.job.ro_number} - - )) - : null} + setSelectedConversation(item.id)} + className={`chat-list-item ${ + item.id === selectedConversation + ? "chat-list-selected-conversation" + : null + }`} + style={style} + > +
+ {item.label &&
{item.label}
} + {item.job_conversations.length > 0 ? ( +
+ {item.job_conversations.map((j, idx) => ( +
+ +
+ ))} +
+ ) : ( + {item.phone_num} + )}
- {item.updated_at} -
- - +
+
+ {item.job_conversations.length > 0 + ? item.job_conversations.map((j, idx) => ( + + {j.job.ro_number} + + )) + : null} +
+ {item.updated_at} +
+ + + ); }; @@ -86,7 +107,7 @@ function ChatConversationListComponent({ height={height} width={width} rowCount={conversationList.length} - rowHeight={60} + rowHeight={cache.rowHeight} rowRenderer={rowRenderer} onScroll={({ scrollTop, scrollHeight, clientHeight }) => { if (scrollTop + clientHeight === scrollHeight) { From 33af544deda0c1ccc84e8d62813fe4afc00fbf91 Mon Sep 17 00:00:00 2001 From: swtmply Date: Tue, 6 Jun 2023 22:47:20 +0800 Subject: [PATCH 05/11] IO-2322 added search function to insurance dropdown --- .../jobs-convert-button/jobs-convert-button.component.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/src/components/jobs-convert-button/jobs-convert-button.component.jsx b/client/src/components/jobs-convert-button/jobs-convert-button.component.jsx index b48deb3b5..6e469cb57 100644 --- a/client/src/components/jobs-convert-button/jobs-convert-button.component.jsx +++ b/client/src/components/jobs-convert-button/jobs-convert-button.component.jsx @@ -108,7 +108,12 @@ export function JobsConvertButton({ }, ]} > - { + return option.value.toLowerCase().includes(input.toLowerCase()); + }} + > {bodyshop.md_ins_cos.map((s, i) => ( {s.name} From 371e148e0909b881565b5b99484261e67dc8a020 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 6 Jun 2023 13:18:44 -0700 Subject: [PATCH 06/11] IO-2278 Track parts dispatch relationships. --- hasura/metadata/tables.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index b86dd17fb..4b1d4d27a 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -2690,6 +2690,13 @@ table: name: inventory schema: public + - name: parts_dispatch_lines + using: + foreign_key_constraint_on: + column: joblineid + table: + name: parts_dispatch_lines + schema: public - name: parts_order_lines using: foreign_key_constraint_on: @@ -3131,6 +3138,13 @@ table: name: notes schema: public + - name: parts_dispatches + using: + foreign_key_constraint_on: + column: jobid + table: + name: parts_dispatch + schema: public - name: parts_orders using: foreign_key_constraint_on: @@ -4556,6 +4570,20 @@ template_engine: Kriti url: '{{$base_url}}/opensearch' version: 2 +- table: + name: parts_dispatch + schema: public + object_relationships: + - name: job + using: + foreign_key_constraint_on: jobid +- table: + name: parts_dispatch_lines + schema: public + object_relationships: + - name: jobline + using: + foreign_key_constraint_on: joblineid - table: name: parts_order_lines schema: public From 1f9c4e92f1f1a41d93b0a503e33f3564834e5849 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 6 Jun 2023 13:21:40 -0700 Subject: [PATCH 07/11] IO-2278 Add parts dispatch relationship. --- .../down.sql | 1 + .../up.sql | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 hasura/migrations/1686082869359_set_fk_public_parts_dispatch_lines_partsdispatchid/down.sql create mode 100644 hasura/migrations/1686082869359_set_fk_public_parts_dispatch_lines_partsdispatchid/up.sql diff --git a/hasura/migrations/1686082869359_set_fk_public_parts_dispatch_lines_partsdispatchid/down.sql b/hasura/migrations/1686082869359_set_fk_public_parts_dispatch_lines_partsdispatchid/down.sql new file mode 100644 index 000000000..ce1f733b9 --- /dev/null +++ b/hasura/migrations/1686082869359_set_fk_public_parts_dispatch_lines_partsdispatchid/down.sql @@ -0,0 +1 @@ +alter table "public"."parts_dispatch_lines" drop constraint "parts_dispatch_lines_partsdispatchid_fkey"; diff --git a/hasura/migrations/1686082869359_set_fk_public_parts_dispatch_lines_partsdispatchid/up.sql b/hasura/migrations/1686082869359_set_fk_public_parts_dispatch_lines_partsdispatchid/up.sql new file mode 100644 index 000000000..b0503febb --- /dev/null +++ b/hasura/migrations/1686082869359_set_fk_public_parts_dispatch_lines_partsdispatchid/up.sql @@ -0,0 +1,5 @@ +alter table "public"."parts_dispatch_lines" + add constraint "parts_dispatch_lines_partsdispatchid_fkey" + foreign key ("partsdispatchid") + references "public"."parts_dispatch" + ("id") on update cascade on delete cascade; From c4c11528b936e827953e70e6e0030a568bfc94c3 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 6 Jun 2023 13:22:51 -0700 Subject: [PATCH 08/11] IO-2278 Add relationship tracking to parts dispatch. --- hasura/metadata/tables.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index 4b1d4d27a..9aa3b196e 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -4577,6 +4577,14 @@ - name: job using: foreign_key_constraint_on: jobid + array_relationships: + - name: parts_dispatch_lines + using: + foreign_key_constraint_on: + column: partsdispatchid + table: + name: parts_dispatch_lines + schema: public - table: name: parts_dispatch_lines schema: public @@ -4584,6 +4592,9 @@ - name: jobline using: foreign_key_constraint_on: joblineid + - name: parts_dispatch + using: + foreign_key_constraint_on: partsdispatchid - table: name: parts_order_lines schema: public From c45c3b4037e642284195f9a25608a9da16b14355 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 6 Jun 2023 13:33:03 -0700 Subject: [PATCH 09/11] IO-2278 Add permissions for parts dispatch. --- hasura/metadata/tables.yaml | 67 +++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index 9aa3b196e..952644a60 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -4585,6 +4585,73 @@ table: name: parts_dispatch_lines schema: public + insert_permissions: + - role: user + permission: + check: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - id + - created_at + - updated_at + - jobid + - number + - employeeid + - dispatched_at + - dispatched_by + select_permissions: + - role: user + permission: + columns: + - number + - dispatched_by + - created_at + - dispatched_at + - updated_at + - employeeid + - id + - jobid + filter: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + update_permissions: + - role: user + permission: + columns: + - number + - dispatched_by + - created_at + - dispatched_at + - updated_at + - employeeid + - id + - jobid + filter: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + check: null - table: name: parts_dispatch_lines schema: public From 86e14967caf568f352ac8d807af07b56c8a262ef Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 6 Jun 2023 13:38:51 -0700 Subject: [PATCH 10/11] IO-2278 Additional permission for dispatch lines. --- hasura/metadata/tables.yaml | 67 +++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index 952644a60..111374fb5 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -4662,6 +4662,73 @@ - name: parts_dispatch using: foreign_key_constraint_on: partsdispatchid + insert_permissions: + - role: user + permission: + check: + parts_dispatch: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - id + - created_at + - updated_at + - partsdispatchid + - joblineid + - quantity + - accepted_at + select_permissions: + - role: user + permission: + columns: + - quantity + - accepted_at + - created_at + - updated_at + - id + - joblineid + - partsdispatchid + filter: + parts_dispatch: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + update_permissions: + - role: user + permission: + columns: + - id + - created_at + - updated_at + - partsdispatchid + - joblineid + - quantity + - accepted_at + filter: + parts_dispatch: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + check: null - table: name: parts_order_lines schema: public From 50230e9f50be6389c644dd31340fa22e0f378eb2 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 6 Jun 2023 13:41:38 -0700 Subject: [PATCH 11/11] IO-2278 adjust schema for parts dispatch. --- .../down.sql | 1 + .../up.sql | 1 + 2 files changed, 2 insertions(+) create mode 100644 hasura/migrations/1686084082349_alter_table_public_parts_dispatch_lines_alter_column_accepted_at/down.sql create mode 100644 hasura/migrations/1686084082349_alter_table_public_parts_dispatch_lines_alter_column_accepted_at/up.sql diff --git a/hasura/migrations/1686084082349_alter_table_public_parts_dispatch_lines_alter_column_accepted_at/down.sql b/hasura/migrations/1686084082349_alter_table_public_parts_dispatch_lines_alter_column_accepted_at/down.sql new file mode 100644 index 000000000..b88b44672 --- /dev/null +++ b/hasura/migrations/1686084082349_alter_table_public_parts_dispatch_lines_alter_column_accepted_at/down.sql @@ -0,0 +1 @@ +alter table "public"."parts_dispatch_lines" alter column "accepted_at" set not null; diff --git a/hasura/migrations/1686084082349_alter_table_public_parts_dispatch_lines_alter_column_accepted_at/up.sql b/hasura/migrations/1686084082349_alter_table_public_parts_dispatch_lines_alter_column_accepted_at/up.sql new file mode 100644 index 000000000..723108120 --- /dev/null +++ b/hasura/migrations/1686084082349_alter_table_public_parts_dispatch_lines_alter_column_accepted_at/up.sql @@ -0,0 +1 @@ +alter table "public"."parts_dispatch_lines" alter column "accepted_at" drop not null;