Skip to content

Commit

Permalink
UIREQ-1188 - Add optional column 'Retrieval service point' (#1240)
Browse files Browse the repository at this point in the history
* UIREQ-1188 - Add optional column 'Retrieval service point'

* Male retieval sp column sortable

* add unit test
  • Loading branch information
Terala-Priyanka authored Dec 3, 2024
1 parent f9ea4b9 commit 7edd21a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/routes/RequestsRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ export const getListFormatter = (
'year': rq => getFormattedYears(rq.instance?.publication, DEFAULT_DISPLAYED_YEARS_AMOUNT),
'callNumber': rq => effectiveCallNumber(rq.item),
'servicePoint': rq => get(rq, 'pickupServicePoint.name', DEFAULT_FORMATTER_VALUE),
'retrievalServicePoint': rq => get(rq, 'item.retrievalServicePointName', DEFAULT_FORMATTER_VALUE),
'copies': rq => get(rq, PRINT_DETAILS_COLUMNS.COPIES, DEFAULT_FORMATTER_VALUE),
'printed': rq => (rq.printDetails ? getLastPrintedDetails(rq.printDetails, intl) : DEFAULT_FORMATTER_VALUE),
});
Expand Down Expand Up @@ -353,6 +354,7 @@ class RequestsRoute extends React.Component {
'requestStatus': 'status',
'servicePoint': 'searchIndex.pickupServicePointName',
'requesterBarcode': 'requester.barcode',
'retrievalServicePoint': 'item.retrievalServicePointName',
'requestDate': 'requestDate',
'position': 'position/number',
'proxy': 'proxy',
Expand Down Expand Up @@ -1490,6 +1492,7 @@ class RequestsRoute extends React.Component {
servicePoint: <FormattedMessage id="ui-requests.requests.servicePoint" />,
requester: <FormattedMessage id="ui-requests.requests.requester" />,
requesterBarcode: <FormattedMessage id="ui-requests.requests.requesterBarcode" />,
retrievalServicePoint: <FormattedMessage id="ui-requests.requests.retrievalServicePoint" />,
singlePrint: <FormattedMessage id="ui-requests.requests.singlePrint" />,
...(isProxyAvailable ? { proxy: <FormattedMessage id="ui-requests.requests.proxy" /> } : {}),
...(isViewPrintDetailsEnabled && {
Expand Down Expand Up @@ -1763,7 +1766,7 @@ class RequestsRoute extends React.Component {
resultIsSelected={this.resultIsSelected}
onFilterChange={this.handleFilterChange}
sortableColumns={['requestDate', 'title', 'year', 'itemBarcode', 'callNumber', 'type', 'requestStatus',
'position', 'servicePoint', 'requester', 'requesterBarcode', ...(isProxyAvailable ? ['proxy'] : []), 'copies', 'printed']}
'position', 'servicePoint', 'requester', 'requesterBarcode', 'retrievalServicePoint', ...(isProxyAvailable ? ['proxy'] : []), 'copies', 'printed']}
pageAmount={100}
pagingType={MCLPagingTypes.PREV_NEXT}
/>
Expand Down
8 changes: 8 additions & 0 deletions src/routes/RequestsRoute.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1301,6 +1301,8 @@ describe('RequestsRoute', () => {
select: 'test value',
item: {
barcode: 'itemBarcode',
retrievalServicePointId: '3a40852d-49fd-4df2-a1f9-6e2641a6e91f',
retrievalServicePointName: 'Circ Desk 1',
},
position: 'position',
proxy: {},
Expand Down Expand Up @@ -1522,6 +1524,12 @@ describe('RequestsRoute', () => {
});
});

describe('retrieval service point', () => {
it('should return retrieval service point', () => {
expect(listFormatter.retrievalServicePoint(requestWithData)).toBe(requestWithData.item.retrievalServicePointName);
});
});

describe('when formatting copies column', () => {
it('should return copies for copies column', () => {
expect(listFormatter.copies(requestWithData)).toBe(requestWithData.printDetails.printCount);
Expand Down
1 change: 1 addition & 0 deletions translations/ui-requests/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"requests.itemBarcode": "Item barcode",
"requests.callNumber": "Effective call number string",
"requests.servicePoint": "Pickup service point",
"requests.retrievalServicePoint": "Retrieval service point",
"requests.createTitleLevelRequest": "Create title level request",
"requests.singlePrint": "Single print",
"requests.printButtonLabel": "Print",
Expand Down

0 comments on commit 7edd21a

Please sign in to comment.