In directory List view when only single email and phone number in list view but user can add multiple phone number and email ids.
This commit is contained in:
parent
697c9acfa6
commit
ac8815d674
@ -15,6 +15,10 @@ const ListViewDirectory = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const { dirActions, setDirActions } = useDir();
|
const { dirActions, setDirActions } = useDir();
|
||||||
|
|
||||||
|
// Get the first email and phone number if they exist
|
||||||
|
const firstEmail = contact.contactEmails?.[0];
|
||||||
|
const firstPhone = contact.contactPhones?.[0];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<tr className={!IsActive ? "bg-light" : ""}>
|
<tr className={!IsActive ? "bg-light" : ""}>
|
||||||
<td
|
<td
|
||||||
@ -47,36 +51,38 @@ const ListViewDirectory = ({
|
|||||||
|
|
||||||
<td className="px-2" style={{ width: "20%" }}>
|
<td className="px-2" style={{ width: "20%" }}>
|
||||||
<div className="d-flex flex-column align-items-start text-truncate">
|
<div className="d-flex flex-column align-items-start text-truncate">
|
||||||
{contact.contactEmails.length > 0 ? (contact.contactEmails?.map((email, index) => (
|
{firstEmail ? (
|
||||||
<span key={email.id} className="text-truncate">
|
<span key={firstEmail.id} className="text-truncate">
|
||||||
<i
|
<i
|
||||||
className={getEmailIcon(email.label)}
|
className={getEmailIcon(firstEmail.label)}
|
||||||
style={{ fontSize: "12px" }}
|
style={{ fontSize: "12px" }}
|
||||||
></i>
|
></i>
|
||||||
<a
|
<a
|
||||||
href={`mailto:${email.emailAddress}`}
|
href={`mailto:${firstEmail.emailAddress}`}
|
||||||
className="text-decoration-none ms-1"
|
className="text-decoration-none ms-1"
|
||||||
>
|
>
|
||||||
{email.emailAddress}
|
{firstEmail.emailAddress}
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
))):(<span className="small-text m-0 px-2">NA</span>)}
|
) : (
|
||||||
|
<span className="small-text m-0 px-2">NA</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td className="px-2" style={{ width: "20%" }}>
|
<td className="px-2" style={{ width: "20%" }}>
|
||||||
<div className="d-flex flex-column align-items-start text-truncate">
|
<div className="d-flex flex-column align-items-start text-truncate">
|
||||||
{contact.contactPhones?.length > 0 ? (
|
{firstPhone ? (
|
||||||
contact.contactPhones?.map((phone, index) => (
|
<span key={firstPhone.id}>
|
||||||
<span key={phone.id}>
|
|
||||||
<i
|
<i
|
||||||
className={getPhoneIcon(phone.label)}
|
className={getPhoneIcon(firstPhone.label)}
|
||||||
style={{ fontSize: "12px" }}
|
style={{ fontSize: "12px" }}
|
||||||
></i>
|
></i>
|
||||||
<span className="ms-1">{phone.phoneNumber}</span>
|
<span className="ms-1">{firstPhone.phoneNumber}</span>
|
||||||
</span>
|
</span>
|
||||||
))
|
) : (
|
||||||
):(<span className="text-small m-0 px-2">NA</span>)}
|
<span className="text-small m-0 px-2">NA</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
@ -88,12 +94,6 @@ const ListViewDirectory = ({
|
|||||||
{contact.organization}
|
{contact.organization}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
{/* <td className="px-2" style={{ width: "10%" }}>
|
|
||||||
<span className="badge badge-outline-secondary">
|
|
||||||
{contact?.contactCategory?.name || "Other"}
|
|
||||||
</span>
|
|
||||||
</td> */}
|
|
||||||
|
|
||||||
<td className="px-2" style={{ width: "10%" }}>
|
<td className="px-2" style={{ width: "10%" }}>
|
||||||
<span className="text-truncate">
|
<span className="text-truncate">
|
||||||
{contact?.contactCategory?.name || "Other"}
|
{contact?.contactCategory?.name || "Other"}
|
||||||
@ -118,9 +118,10 @@ const ListViewDirectory = ({
|
|||||||
)}
|
)}
|
||||||
{!IsActive && (
|
{!IsActive && (
|
||||||
<i
|
<i
|
||||||
className={`bx ${
|
className={`bx ${
|
||||||
dirActions.action && dirActions.id === contact.id ? "bx-loader-alt bx-spin"
|
dirActions.action && dirActions.id === contact.id
|
||||||
: "bx-recycle"
|
? "bx-loader-alt bx-spin"
|
||||||
|
: "bx-recycle"
|
||||||
} me-1 text-primary cursor-pointer`}
|
} me-1 text-primary cursor-pointer`}
|
||||||
title="Restore"
|
title="Restore"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user