From 112aefa8af3074f3698e18d21d3d821b6e2a5330 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Mon, 10 May 2021 13:48:38 -0700 Subject: [PATCH] IO-1036 Update phonebook sorting. --- .../parts-receive-modal.container.jsx | 5 +---- .../src/pages/phonebook/phonebook.page.component.jsx | 11 ++++++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/client/src/components/parts-receive-modal/parts-receive-modal.container.jsx b/client/src/components/parts-receive-modal/parts-receive-modal.container.jsx index 887b9fb8e..ba5334625 100644 --- a/client/src/components/parts-receive-modal/parts-receive-modal.container.jsx +++ b/client/src/components/parts-receive-modal/parts-receive-modal.container.jsx @@ -5,10 +5,7 @@ import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { logImEXEvent } from "../../firebase/firebase.utils"; -import { - RECEIVE_PARTS_LINE, - UPDATE_JOB_LINE, -} from "../../graphql/jobs-lines.queries"; +import { RECEIVE_PARTS_LINE } from "../../graphql/jobs-lines.queries"; import { toggleModalVisible } from "../../redux/modals/modals.actions"; import { selectPartsReceive } from "../../redux/modals/modals.selectors"; import { diff --git a/client/src/pages/phonebook/phonebook.page.component.jsx b/client/src/pages/phonebook/phonebook.page.component.jsx index 0340cda9f..e213745a2 100644 --- a/client/src/pages/phonebook/phonebook.page.component.jsx +++ b/client/src/pages/phonebook/phonebook.page.component.jsx @@ -12,6 +12,7 @@ import AlertComponent from "../../components/alert/alert.component"; import { QUERY_PHONEBOOK_PAGINATED } from "../../graphql/phonebook.queries"; import { selectBodyshop } from "../../redux/user/user.selectors"; import ChatOpenButton from "../../components/chat-open-button/chat-open-button.component"; +import { alphaSort } from "../../utils/sorters"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -35,7 +36,7 @@ export function PhonebookPageComponent({ bodyshop }) { ? sortorder === "descend" ? "desc" : "asc" - : "desc", + : "asc", }, ], }, @@ -65,21 +66,29 @@ export function PhonebookPageComponent({ bodyshop }) { title: t("phonebook.fields.firstname"), dataIndex: "firstname", key: "firstname", + sorter: (a, b) => alphaSort(a.firstname, b.firstname), + sortOrder: sortcolumn === "firstname" && sortorder, }, { title: t("phonebook.fields.lastname"), dataIndex: "lastname", key: "lastname", + sorter: (a, b) => alphaSort(a.lastname, b.lastname), + sortOrder: sortcolumn === "lastname" && sortorder, }, { title: t("phonebook.fields.company"), dataIndex: "company", key: "company", + sorter: (a, b) => alphaSort(a.company, b.company), + sortOrder: sortcolumn === "company" && sortorder, }, { title: t("phonebook.fields.category"), dataIndex: "category", key: "category", + sorter: (a, b) => alphaSort(a.category, b.category), + sortOrder: sortcolumn === "category" && sortorder, }, { title: t("phonebook.fields.email"),