Skip to content

Commit

Permalink
pages: Display idnetifiers of Item in frontsite and backoffice
Browse files Browse the repository at this point in the history
  • Loading branch information
sakshamarora1 committed Apr 4, 2024
1 parent 595a3a3 commit f90ea50
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ export default class ItemMetadata extends Component {
</List>
),
},
{
name: 'Identifiers',
value: (
<List>
{itemDetails.metadata.identifiers
? itemDetails.metadata.identifiers.map((identifier) => (
<List.Item key={identifier.value}>
{identifier.value}
{` (${identifier.scheme})`}
</List.Item>
))
: '-'}
</List>
),
},
];

const rightMetadata = [
Expand Down
19 changes: 19 additions & 0 deletions src/lib/pages/backoffice/Item/ItemEditor/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,25 @@ export const schema = () => {
type: 'string',
title: 'Shelf',
},
identifiers: {
items: {
properties: {
scheme: {
title: 'Scheme name',
type: 'string',
},
value: {
title: 'Value',
type: 'string',
},
},
required: ['scheme', 'value'],
title: 'Identifier',
type: 'object',
},
title: 'Identifiers',
type: 'array',
},
status: {
enum: invenioConfig.ITEMS.statuses.map((status) => status.value),
enumNames: invenioConfig.ITEMS.statuses.map((status) => status.text),
Expand Down
26 changes: 24 additions & 2 deletions src/lib/pages/backoffice/Item/ItemEditor/uiSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ export const uiSchema = (title) => {
],
},
},
identifiers: {
'ui:options': {
orderable: false,
semantic: {
wrapItem: true,
},
},
items: {
'custom:grid': [
{
scheme: 10,
value: 6,
},
],
},
},
price: {
currency: {
'ui:widget': 'vocabulary',
Expand Down Expand Up @@ -64,8 +80,8 @@ export const uiSchema = (title) => {
'custom:divider': 16,
},
{
isbns: 10,
internal_notes: 6,
isbns: 6,
internal_notes: 4,
},
{
'custom:divider': 16,
Expand All @@ -81,6 +97,12 @@ export const uiSchema = (title) => {
acquisition_pid: 6,
price: 10,
},
{
'custom:divider': 16,
},
{
identifiers: 10,
},
],
'custom:root': {
'custom:formTitle': title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class DocumentItem extends Component {
<Table.Row data-test="header">
<Table.HeaderCell>Barcode</Table.HeaderCell>
<Table.HeaderCell>Shelf</Table.HeaderCell>
<Table.HeaderCell>Call Number</Table.HeaderCell>
<Table.HeaderCell>Status</Table.HeaderCell>
<Table.HeaderCell>Medium</Table.HeaderCell>
<Table.HeaderCell>Loan restriction</Table.HeaderCell>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import React, { Component } from 'react';
import _get from 'lodash/get';
import { PropTypes } from 'prop-types';
import { Table } from 'semantic-ui-react';
import { Media } from '@components/Media';
import { getDisplayVal, invenioConfig } from '@config';

export default class DocumentItemBody extends Component {
constructor(props) {
super(props);
}

itemStatus = (item) => ({
canCirculate: () =>
invenioConfig.ITEMS.canCirculateStatuses.includes(item.status),
Expand All @@ -30,6 +27,17 @@ export default class DocumentItemBody extends Component {
return getDisplayVal('ITEMS.statuses', item.status);
};

callNumber = (items) => {
const identifiers = _get(items, 'identifiers', []);
if (identifiers === null) {
return '-';
}
const callNumber = identifiers.find(
(identifier) => identifier.scheme.toLowerCase() === 'call number'
);
return callNumber ? callNumber.value : '-';
};

render() {
const { items } = this.props;

Expand Down Expand Up @@ -60,6 +68,9 @@ export default class DocumentItemBody extends Component {
</Table.Cell>
</Media>

<Table.Cell data-label="Call Number">
{this.callNumber(item)}
</Table.Cell>
<Table.Cell data-label="Status">{this.statusLabel(item)}</Table.Cell>
<Table.Cell data-label="Medium">
{getDisplayVal('ITEMS.mediums', item.medium)}
Expand Down

0 comments on commit f90ea50

Please sign in to comment.