Skip to content

Commit 3d4e58b

Browse files
committed
add phone and email to table
1 parent 2f7cbac commit 3d4e58b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

server/controllers/processes/roomAssignmentsList.js

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const INDEX_PIPELINE = [
3737
firstName: 1,
3838
lastName: 1,
3939
email: 1,
40+
phone: 1,
4041
affiliations: 1
4142
}
4243
}

src/processes/RoomAssignmentsList.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ function AssignmentsList() {
4444
const searchableText = `
4545
${person.firstName?.toLowerCase() || ''}
4646
${person.lastName?.toLowerCase() || ''}
47+
${person.email?.toLowerCase() || ''}
48+
${person.phone?.toLowerCase() || ''}
4749
${person.affiliations?.map(aff => aff.name?.toLowerCase()).join(' ') || ''}
4850
${roomData.floor?.toString().toLowerCase() || ''}
4951
${roomData.number?.toString().toLowerCase() || ''}
@@ -151,7 +153,7 @@ function RoomAssignmentsTable({ assignments }) {
151153

152154
return (
153155
<table className="table table-striped table-bordered">
154-
<thead className="table-dark">
156+
<thead className="table-dark">
155157
<tr>
156158
<th scope="col">Piano</th>
157159
<th scope="col">Stanza</th>
@@ -162,7 +164,7 @@ function RoomAssignmentsTable({ assignments }) {
162164
<tbody>
163165
{assignments.map((assignment) => {
164166
const { person, room, startDate, endDate } = assignment;
165-
const { firstName, lastName, affiliations } = person;
167+
const { firstName, lastName, affiliations, email, phone } = person;
166168
const roomData = room[0] || {};
167169

168170
const period =
@@ -174,12 +176,16 @@ function RoomAssignmentsTable({ assignments }) {
174176
? `Fino al ${myDateFormat(endDate)}`
175177
: "";
176178

179+
const affiliationNames = affiliations.map((aff) => aff.name).join(", ");
180+
const contactDetails = [phone, email].filter(Boolean).join(" | ");
181+
177182
return (
178183
<tr key={assignment._id}>
179184
<td>{roomData.floor}</td>
180185
<td>{roomData.number}</td>
181186
<td>
182-
{firstName} {lastName} ({affiliations.map((aff) => aff.name).join(", ")})
187+
{firstName} {lastName} ({affiliationNames}
188+
{contactDetails ? `, ${contactDetails}` : ""})
183189
</td>
184190
<td>{period}</td>
185191
</tr>

0 commit comments

Comments
 (0)