feature/IO-3182-Phone-Number-Consent - Checkpoint
This commit is contained in:
@@ -1,17 +1,20 @@
|
||||
import { useQuery } from "@apollo/client";
|
||||
import { Input, Space, Table, Typography } from "antd";
|
||||
import { Link } from "react-router-dom";
|
||||
import { useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Input, Table, Typography } from "antd";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors";
|
||||
import { GET_PHONE_NUMBER_OPT_OUTS, SEARCH_OWNERS_BY_PHONE_NUMBERS } from "../../graphql/phone-number-opt-out.queries";
|
||||
import PhoneNumberFormatter from "../../utils/PhoneFormatter";
|
||||
import { GET_PHONE_NUMBER_OPT_OUTS } from "../../graphql/phone-number-opt-out.queries";
|
||||
import { TimeAgoFormatter } from "../../utils/DateFormatter";
|
||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||
import ChatOpenButton from "../chat-open-button/chat-open-button.component";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useState } from "react";
|
||||
|
||||
const { Paragraph } = Typography; // Destructure Paragraph from Typography
|
||||
const { Paragraph } = Typography;
|
||||
|
||||
// Commented out Associated Owners section for now
|
||||
//import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||
//import { Link } from "react-router-dom";
|
||||
//import { useMemo, useState } from "react";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -30,7 +33,8 @@ function PhoneNumberConsentList({ bodyshop, currentUser }) {
|
||||
fetchPolicy: "network-only"
|
||||
});
|
||||
|
||||
// Prepare phone numbers for owner query
|
||||
// Commented out Associated Owners section for now
|
||||
/*// Prepare phone numbers for owner query
|
||||
const phoneNumbers = useMemo(() => {
|
||||
return optOutData?.phone_number_opt_out?.map((item) => item.phone_number) || [];
|
||||
}, [optOutData?.phone_number_opt_out]);
|
||||
@@ -74,16 +78,17 @@ function PhoneNumberConsentList({ bodyshop, currentUser }) {
|
||||
: t("consent.phone_2")
|
||||
: null
|
||||
}));
|
||||
};
|
||||
};*/
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: t("consent.phone_number"),
|
||||
dataIndex: "phone_number",
|
||||
render: (text) => <PhoneNumberFormatter>{text}</PhoneNumberFormatter>,
|
||||
render: (text) => <ChatOpenButton phone={text} />,
|
||||
sorter: (a, b) => a.phone_number.localeCompare(b.phone_number)
|
||||
},
|
||||
{
|
||||
// Commented out Associated Owners section for now
|
||||
/*{
|
||||
title: t("consent.associated_owners"),
|
||||
dataIndex: "phone_number",
|
||||
render: (phoneNumber) => {
|
||||
@@ -109,7 +114,7 @@ function PhoneNumberConsentList({ bodyshop, currentUser }) {
|
||||
const bName = bOwners[0] ? `${bOwners[0].ownr_fn} ${bOwners[0].ownr_ln}` : "";
|
||||
return aName.localeCompare(bName);
|
||||
}
|
||||
},
|
||||
},*/
|
||||
{
|
||||
title: t("consent.created_at"),
|
||||
dataIndex: "created_at",
|
||||
@@ -130,7 +135,7 @@ function PhoneNumberConsentList({ bodyshop, currentUser }) {
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={optOutData?.phone_number_opt_out}
|
||||
loading={optOutLoading || ownersLoading}
|
||||
loading={optOutLoading /* || ownersLoading*/}
|
||||
rowKey="id"
|
||||
style={{ marginTop: 16 }}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user