Commit 2f93e808 authored by Petter Goksøyr Åsen's avatar Petter Goksøyr Åsen Committed by Petter Goksøyr Åsen
Browse files

DEICH-5481 Hide 'Bestill' text when no items can be ordered

Also show number of items/reserves when items cannot be ordered
or checked out, but can be found in the library. (Ikke til hjemlån)
parent 11dcd84f
......@@ -204,11 +204,30 @@ export default function ReservePublicationWidget({
return (
<div data-animate-in="top" data-animation-order="4">
<div className="reserve-work-widget">
<h3>{title}</h3>
<p>
{reasons.length === 1 && <>{reasons[0]}</>}
{reasons.length > 1 && "Kan ikke bestilles"}
</p>
{reasons.length > 1 || (reasons.length === 1 && reasons[0] !== "Til bruk i biblioteket") &&
<h3>Denne er ikke tilgjengelig</h3>
}
<Block>
<p>
{reasons.length === 1 && <>{reasons[0]}</>}
{reasons.length > 1 && "Kan ikke bestilles"}
</p>
</Block>
{reasons.length === 1 && reasons[0] === "Til bruk i biblioteket" &&
<Block top={4}>
<Availability items={copies[currentPublication.recordId].items} />
<div className="numHolds">
, {getNumHolds(copies, currentPublication.recordId)} venteliste
</div>
<PublicationDetailsButton
className="link"
publication={currentPublication}
copies={copies}
>
Finn i biblioteket
</PublicationDetailsButton>
</Block>
}
</div>
</div>
);
......@@ -329,7 +348,7 @@ export function notReservableReason(publication, copies) {
const items = copies[publication.recordId]?.items || [];
const isReservable = items.filter(item => item.reservable).length > 0;
const isOnlyForBranchUse = items.every(item => item.notforloan);
const isOnlyForBranchUse = items.length > 0 && items.every(item => item.notforloan);
if (
publication.formats?.includes(
......
......@@ -226,7 +226,7 @@ const getWorkItemsByRecordIds = (recordIds, categorycode) => {
holdsByRecordId[itemResponse.biblio.biblionumber] = itemResponse.biblio;
const items = {};
itemResponse.items.forEach(item => {
if (item.status === "Utilgjengelig") {
if (!item.countable) {
// Theese items should not count, or be processed further,
// as they are not available to end users.
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment