Skip to content

Commit c58cc0a

Browse files
committed
frontside: hide shelf link if patron cant access location
1 parent d43e3d9 commit c58cc0a

File tree

1 file changed

+43
-34
lines changed

1 file changed

+43
-34
lines changed

src/lib/pages/frontsite/Documents/DocumentDetails/DocumentItems/DocumentItemBody.js

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -34,46 +34,55 @@ export default class DocumentItemBody extends Component {
3434
identifiersToDisplayInFrontside,
3535
} = this.props;
3636

37-
return items.map((item) => (
38-
<Table.Row key={item.pid}>
39-
<Table.Cell
40-
data-label="Barcode"
41-
className="document-item-table-itemCell"
42-
>
43-
{item.barcode}
44-
</Table.Cell>
45-
<Table.Cell data-label="Shelf" className="document-item-table-itemCell">
46-
{shelfLink !== null
47-
? shelfLink(item, documentDetails)
48-
: _get(item, 'shelf')}
49-
</Table.Cell>
37+
return items.map((item) => {
38+
const showShelfLink = item.internal_location.accessible_by_patrons;
5039

51-
{identifiersToDisplayInFrontside.map((identifier) => (
40+
return (
41+
<Table.Row key={item.pid}>
5242
<Table.Cell
53-
key={identifier}
54-
data-label={identifier.text}
43+
data-label="Barcode"
5544
className="document-item-table-itemCell"
5645
>
57-
{
58-
item.identifiers?.find((entry) => {
59-
return entry.scheme === identifier.key;
60-
})?.value
61-
}
46+
{item.barcode}
47+
</Table.Cell>
48+
<Table.Cell
49+
data-label="Shelf"
50+
className="document-item-table-itemCell"
51+
>
52+
{showShelfLink
53+
? shelfLink !== null
54+
? shelfLink(item, documentDetails)
55+
: _get(item, 'shelf')
56+
: 'Available on Request'}
6257
</Table.Cell>
63-
))}
6458

65-
<Table.Cell data-label="Status">{this.statusLabel(item)}</Table.Cell>
66-
<Table.Cell data-label="Medium">
67-
{getDisplayVal('ITEMS.mediums', item.medium)}
68-
</Table.Cell>
69-
<Table.Cell data-label="Restrictions">
70-
{getDisplayVal(
71-
'ITEMS.circulationRestrictions',
72-
item.circulation_restriction
73-
)}
74-
</Table.Cell>
75-
</Table.Row>
76-
));
59+
{identifiersToDisplayInFrontside.map((identifier) => (
60+
<Table.Cell
61+
key={identifier}
62+
data-label={identifier.text}
63+
className="document-item-table-itemCell"
64+
>
65+
{
66+
item.identifiers?.find((entry) => {
67+
return entry.scheme === identifier.key;
68+
})?.value
69+
}
70+
</Table.Cell>
71+
))}
72+
73+
<Table.Cell data-label="Status">{this.statusLabel(item)}</Table.Cell>
74+
<Table.Cell data-label="Medium">
75+
{getDisplayVal('ITEMS.mediums', item.medium)}
76+
</Table.Cell>
77+
<Table.Cell data-label="Restrictions">
78+
{getDisplayVal(
79+
'ITEMS.circulationRestrictions',
80+
item.circulation_restriction
81+
)}
82+
</Table.Cell>
83+
</Table.Row>
84+
);
85+
});
7786
}
7887
}
7988

0 commit comments

Comments
 (0)