diff --git a/src/lib/pages/backoffice/Location/InternalLocationEditor/schema.js b/src/lib/pages/backoffice/Location/InternalLocationEditor/schema.js index 8c8d226c4..b42d02abd 100644 --- a/src/lib/pages/backoffice/Location/InternalLocationEditor/schema.js +++ b/src/lib/pages/backoffice/Location/InternalLocationEditor/schema.js @@ -22,6 +22,11 @@ export const schema = () => { type: 'string', title: 'Physical location', }, + accessible_by_patrons: { + type: 'boolean', + title: 'Is this location accessible by patrons?', + default: true, + }, }, }; return _merge(_schema, invenioConfig.INTERNAL_LOCATIONS.editorSchema); diff --git a/src/lib/pages/backoffice/Location/InternalLocationEditor/uiSchema.js b/src/lib/pages/backoffice/Location/InternalLocationEditor/uiSchema.js index f569e7f0b..61f8af29c 100644 --- a/src/lib/pages/backoffice/Location/InternalLocationEditor/uiSchema.js +++ b/src/lib/pages/backoffice/Location/InternalLocationEditor/uiSchema.js @@ -10,14 +10,9 @@ export const uiSchema = (title) => { 'ui:widget': 'textarea', }, 'custom:grid': [ - { - name: 8, - location_pid: 8, - }, - { - physical_location: 8, - notes: 8, - }, + { name: 8, location_pid: 8 }, + { physical_location: 8, notes: 8 }, + { accessible_by_patrons: 8 }, ], 'custom:root': { 'custom:formTitle': title, diff --git a/src/lib/pages/backoffice/Location/LocationList/InternalLocationList/InternalLocationList.js b/src/lib/pages/backoffice/Location/LocationList/InternalLocationList/InternalLocationList.js index 43d6d8987..e1849a3de 100644 --- a/src/lib/pages/backoffice/Location/LocationList/InternalLocationList/InternalLocationList.js +++ b/src/lib/pages/backoffice/Location/LocationList/InternalLocationList/InternalLocationList.js @@ -66,6 +66,14 @@ export default class InternalLocationList extends Component { { title: 'Name', field: 'metadata.name' }, { title: 'Physical location', field: 'metadata.physical_location' }, { title: 'Location e-mail', field: 'metadata.location.email' }, + { + title: 'Accessible by patrons', + field: 'metadata.accessible_by_patrons', + formatter: ({ row }) => + row.metadata.accessible_by_patrons ? ( + + ) : null, + }, { title: 'Actions', field: '', formatter: this.rowActions }, ]; diff --git a/src/lib/pages/frontsite/Documents/DocumentDetails/DocumentItems/DocumentItemBody.js b/src/lib/pages/frontsite/Documents/DocumentDetails/DocumentItems/DocumentItemBody.js index 99c86c386..186275cd7 100644 --- a/src/lib/pages/frontsite/Documents/DocumentDetails/DocumentItems/DocumentItemBody.js +++ b/src/lib/pages/frontsite/Documents/DocumentDetails/DocumentItems/DocumentItemBody.js @@ -34,46 +34,55 @@ export default class DocumentItemBody extends Component { identifiersToDisplayInFrontside, } = this.props; - return items.map((item) => ( - - - {item.barcode} - - - {shelfLink !== null - ? shelfLink(item, documentDetails) - : _get(item, 'shelf')} - + return items.map((item) => { + const showShelfLink = item.internal_location.accessible_by_patrons; - {identifiersToDisplayInFrontside.map((identifier) => ( + return ( + - { - item.identifiers?.find((entry) => { - return entry.scheme === identifier.key; - })?.value - } + {item.barcode} + + + {showShelfLink + ? shelfLink !== null + ? shelfLink(item, documentDetails) + : _get(item, 'shelf') + : 'Available on Request'} - ))} - {this.statusLabel(item)} - - {getDisplayVal('ITEMS.mediums', item.medium)} - - - {getDisplayVal( - 'ITEMS.circulationRestrictions', - item.circulation_restriction - )} - - - )); + {identifiersToDisplayInFrontside.map((identifier) => ( + + { + item.identifiers?.find((entry) => { + return entry.scheme === identifier.key; + })?.value + } + + ))} + + {this.statusLabel(item)} + + {getDisplayVal('ITEMS.mediums', item.medium)} + + + {getDisplayVal( + 'ITEMS.circulationRestrictions', + item.circulation_restriction + )} + + + ); + }); } } diff --git a/src/testData/internal_locations.json b/src/testData/internal_locations.json index 781274b75..229097e4a 100644 --- a/src/testData/internal_locations.json +++ b/src/testData/internal_locations.json @@ -2,16 +2,19 @@ { "pid": "ilocid-1", "location_pid": "locid-1", - "name": "Internal Library 1" + "name": "Internal Library 1", + "accessible_by_patrons": true }, { "pid": "ilocid-2", "location_pid": "locid-1", - "name": "Internal Library 2" + "name": "Internal Library 2", + "accessible_by_patrons": true }, { "pid": "ilocid-3", "location_pid": "locid-1", - "name": "Unused Internal Library" + "name": "Unused Internal Library", + "accessible_by_patrons": true } ]