Skip to content

Commit

Permalink
overridden: DocumentDetails: Add InfoPopup when item has no shelf
Browse files Browse the repository at this point in the history
  • Loading branch information
sakshamarora1 authored and kpsherva committed Jun 28, 2024
1 parent 0b32a02 commit 2d6aa82
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ function getLoanableItem(locations) {
});

for (const item of allRelevantItems) {
const itemStatus = _get(item, "circulation.state");
// If item is not on loan, return item's shelf value
if (!invenioConfig.CIRCULATION.loanActiveStates.includes(itemStatus)) {
const circulationStatus = _get(item, "circulation.state");
const itemStatus = _get(item, "status");
// If item is not on loan and it can be circulated, return item's shelf value
if (
!invenioConfig.CIRCULATION.loanActiveStates.includes(circulationStatus) &&
invenioConfig.ITEMS.canCirculateStatuses.includes(itemStatus)
) {
return item;
}
}
Expand Down
18 changes: 10 additions & 8 deletions ui/src/overridden/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { invenioConfig } from "@inveniosoftware/react-invenio-app-ils";
import { InfoPopup, invenioConfig } from "@inveniosoftware/react-invenio-app-ils";
import { Icon } from "semantic-ui-react";
import _get from "lodash/get";

Expand Down Expand Up @@ -47,16 +47,18 @@ export const shelfLinkComponent = (
const linkToShelf = shelfLink(shelfNumber, {
popupContent: { "Title": title, "Call number": callNumber },
});
return (
return shelfNumber ? (
<>
{shelfNumber && (
<a href={linkToShelf} target="_blank" rel="noreferrer">
<Icon name={iconName} />
{shelfNumber}
</a>
)}{" "}
<a href={linkToShelf} target="_blank" rel="noreferrer">
<Icon name={iconName} />
{shelfNumber}
</a>{" "}
{callNumber}
</>
) : (
<InfoPopup message="Please request online or ask at the Library desk.">
{callNumber}
</InfoPopup>
);
};

Expand Down

0 comments on commit 2d6aa82

Please sign in to comment.