IO-1036 Update phonebook sorting.
This commit is contained in:
@@ -5,10 +5,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import {
|
import { RECEIVE_PARTS_LINE } from "../../graphql/jobs-lines.queries";
|
||||||
RECEIVE_PARTS_LINE,
|
|
||||||
UPDATE_JOB_LINE,
|
|
||||||
} from "../../graphql/jobs-lines.queries";
|
|
||||||
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
||||||
import { selectPartsReceive } from "../../redux/modals/modals.selectors";
|
import { selectPartsReceive } from "../../redux/modals/modals.selectors";
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import AlertComponent from "../../components/alert/alert.component";
|
|||||||
import { QUERY_PHONEBOOK_PAGINATED } from "../../graphql/phonebook.queries";
|
import { QUERY_PHONEBOOK_PAGINATED } from "../../graphql/phonebook.queries";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import ChatOpenButton from "../../components/chat-open-button/chat-open-button.component";
|
import ChatOpenButton from "../../components/chat-open-button/chat-open-button.component";
|
||||||
|
import { alphaSort } from "../../utils/sorters";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -35,7 +36,7 @@ export function PhonebookPageComponent({ bodyshop }) {
|
|||||||
? sortorder === "descend"
|
? sortorder === "descend"
|
||||||
? "desc"
|
? "desc"
|
||||||
: "asc"
|
: "asc"
|
||||||
: "desc",
|
: "asc",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -65,21 +66,29 @@ export function PhonebookPageComponent({ bodyshop }) {
|
|||||||
title: t("phonebook.fields.firstname"),
|
title: t("phonebook.fields.firstname"),
|
||||||
dataIndex: "firstname",
|
dataIndex: "firstname",
|
||||||
key: "firstname",
|
key: "firstname",
|
||||||
|
sorter: (a, b) => alphaSort(a.firstname, b.firstname),
|
||||||
|
sortOrder: sortcolumn === "firstname" && sortorder,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("phonebook.fields.lastname"),
|
title: t("phonebook.fields.lastname"),
|
||||||
dataIndex: "lastname",
|
dataIndex: "lastname",
|
||||||
key: "lastname",
|
key: "lastname",
|
||||||
|
sorter: (a, b) => alphaSort(a.lastname, b.lastname),
|
||||||
|
sortOrder: sortcolumn === "lastname" && sortorder,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("phonebook.fields.company"),
|
title: t("phonebook.fields.company"),
|
||||||
dataIndex: "company",
|
dataIndex: "company",
|
||||||
key: "company",
|
key: "company",
|
||||||
|
sorter: (a, b) => alphaSort(a.company, b.company),
|
||||||
|
sortOrder: sortcolumn === "company" && sortorder,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("phonebook.fields.category"),
|
title: t("phonebook.fields.category"),
|
||||||
dataIndex: "category",
|
dataIndex: "category",
|
||||||
key: "category",
|
key: "category",
|
||||||
|
sorter: (a, b) => alphaSort(a.category, b.category),
|
||||||
|
sortOrder: sortcolumn === "category" && sortorder,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("phonebook.fields.email"),
|
title: t("phonebook.fields.email"),
|
||||||
|
|||||||
Reference in New Issue
Block a user