Skip to content

Commit

Permalink
put landlord col to right of RS units (#958)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwansim committed Jul 30, 2024
1 parent 68f19f9 commit 6a34640
Showing 1 changed file with 56 additions and 56 deletions.
112 changes: 56 additions & 56 deletions client/src/components/PortfolioTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,62 @@ const PortfolioTableWithoutI18n = React.memo((props: PortfolioTableProps) => {
},
],
},
{
header: i18n._(t`Landlord`),
footer: (props) => props.column.id,
columns: [
{
accessorFn: (row) => {
// Group all contact info by the name of each person/corporate entity (same as on overview tab)
var ownerList =
row.allcontacts &&
Object.entries(_groupBy(row.allcontacts, "value"))
.sort(sortContactsByImportance)
.map((contact) => contact[0]);
return ownerList || [];
},
id: "ownernames",
header: i18n._(t`Person/Entity`),
cell: ({ row }) => {
var contacts =
row.original.allcontacts &&
Object.entries(_groupBy(row.original.allcontacts, "value")).sort(
sortContactsByImportance
);

if (!contacts) return "";

const contactWords = contacts[0][0].trim().split(/\s+/) || [contacts[0][0]];

return (
<>
{contactWords.length > 1 && contactWords.slice(0, 1).join(" ") + " "}
<span className="col-ownernames-last-word">
{contactWords.slice(-1)}
{row.getCanExpand() && contacts && contacts.length > 1 ? (
<button
className="contacts-expand"
onClick={() => {
row.getToggleExpandedHandler()();
!row.getIsExpanded() &&
logPortfolioAnalytics("portfolioRowExpanded", { column: "ownernames" });
}}
>
+{contacts.length - 1}
</button>
) : (
<></>
)}
</span>
</>
);
},
footer: (props) => props.column.id,
filterFn: "arrIncludesSome",
minSize: 100,
},
],
},
{
header: i18n._(t`HPD Complaints`),
footer: (props) => props.column.id,
Expand Down Expand Up @@ -343,62 +399,6 @@ const PortfolioTableWithoutI18n = React.memo((props: PortfolioTableProps) => {
},
],
},
{
header: i18n._(t`Landlord`),
footer: (props) => props.column.id,
columns: [
{
accessorFn: (row) => {
// Group all contact info by the name of each person/corporate entity (same as on overview tab)
var ownerList =
row.allcontacts &&
Object.entries(_groupBy(row.allcontacts, "value"))
.sort(sortContactsByImportance)
.map((contact) => contact[0]);
return ownerList || [];
},
id: "ownernames",
header: i18n._(t`Person/Entity`),
cell: ({ row }) => {
var contacts =
row.original.allcontacts &&
Object.entries(_groupBy(row.original.allcontacts, "value")).sort(
sortContactsByImportance
);

if (!contacts) return "";

const contactWords = contacts[0][0].trim().split(/\s+/) || [contacts[0][0]];

return (
<>
{contactWords.length > 1 && contactWords.slice(0, 1).join(" ") + " "}
<span className="col-ownernames-last-word">
{contactWords.slice(-1)}
{row.getCanExpand() && contacts && contacts.length > 1 ? (
<button
className="contacts-expand"
onClick={() => {
row.getToggleExpandedHandler()();
!row.getIsExpanded() &&
logPortfolioAnalytics("portfolioRowExpanded", { column: "ownernames" });
}}
>
+{contacts.length - 1}
</button>
) : (
<></>
)}
</span>
</>
);
},
footer: (props) => props.column.id,
filterFn: "arrIncludesSome",
minSize: 100,
},
],
},
{
header: i18n._(t`Tax Exemptions`),
footer: (props) => props.column.id,
Expand Down

0 comments on commit 6a34640

Please sign in to comment.