Skip to content

Commit

Permalink
UIREQ-1190 - initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Terala-Priyanka committed Dec 4, 2024
1 parent 97b0544 commit f24ebbd
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/components/RequestsFilters/RequestsFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
} from '../../constants';

import { PickupServicePointFilter } from './PickupServicePointFilter';
import { RetrievalServicePointFilter } from './RetrievalServicePointFilter';
import { RequestLevelFilter } from './RequestLevelFilter';

export default class RequestsFilters extends React.Component {
Expand All @@ -35,6 +36,7 @@ export default class RequestsFilters extends React.Component {
requestType: PropTypes.arrayOf(PropTypes.string),
tags: PropTypes.arrayOf(PropTypes.string),
pickupServicePoints: PropTypes.arrayOf(PropTypes.string),
retrievalServicePoints: PropTypes.arrayOf(PropTypes.string),
printStatus: PropTypes.arrayOf(PropTypes.string),
}).isRequired,
resources: PropTypes.object.isRequired,
Expand Down Expand Up @@ -65,6 +67,7 @@ export default class RequestsFilters extends React.Component {
requestType = [],
requestStatus = [],
pickupServicePoints = [],
retrievalServicePoints= [],

Check failure on line 70 in src/components/RequestsFilters/RequestsFilters.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Operator '=' must be spaced
requestLevels = [],
printStatus = [],
},
Expand Down Expand Up @@ -146,6 +149,11 @@ export default class RequestsFilters extends React.Component {
onChange={onChange}
onClear={onClear}
/>
<RetrievalServicePointFilter
activeValues={retrievalServicePoints}
onChange={onChange}
onClear={onClear}
/>
{isViewPrintDetailsEnabled && (
<Accordion
displayClearButton={!isEmpty(printStatus)}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import React, {
useCallback,
useMemo,

Check warning on line 3 in src/components/RequestsFilters/RetrievalServicePointFilter/RetrievalServicePointFilter.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

'useMemo' is defined but never used. Allowed unused vars must match /React/u
} from 'react';
import { FormattedMessage } from 'react-intl';
import { isEmpty } from 'lodash';
import PropTypes from 'prop-types';

import {
Accordion,
FilterAccordionHeader,
} from '@folio/stripes/components';
import {
MultiSelectionFilter,
} from '@folio/stripes/smart-components';

import {
requestFilterTypes,
} from '../../../constants';

const RetrievalServicePointFilter = ({
activeValues,
onChange,
onClear,
}) => {
const name = requestFilterTypes.RETRIEVAL_SERVICE_POINT;
const clearFilter = useCallback(() => {
onClear(name);
}, [name, onClear]);

const filterOptions = [];

return (
<div>
<Accordion
displayClearButton={!isEmpty(activeValues)}
id={name}
header={FilterAccordionHeader}
label={<FormattedMessage id="ui-requests.retrievalServicePoint.name" />}
name={name}
separator={false}
onClearFilter={clearFilter}
>
<MultiSelectionFilter
ariaLabelledBy={`accordion-toggle-button-${name}`}
dataOptions={filterOptions}
id="req-retrieval-service-point-filter"
name={name}
onChange={onChange}
selectedValues={activeValues}
/>
</Accordion>
</div>
);
};

RetrievalServicePointFilter.propTypes = {
activeValues: PropTypes.arrayOf(PropTypes.string),
onChange: PropTypes.func.isRequired,
onClear: PropTypes.func.isRequired,
};
export default RetrievalServicePointFilter;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as RetrievalServicePointFilter } from './RetrievalServicePointFilter';
1 change: 1 addition & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ export const requestFilterTypes = {
REQUEST_STATUS: 'requestStatus',
REQUEST_LEVELS: 'requestLevels',
PICKUP_SERVICE_POINT: 'pickupServicePoints',
RETRIEVAL_SERVICE_POINT: 'retrievalServicePoints',
PRINT_STATUS: 'printStatus',
};

Expand Down
5 changes: 4 additions & 1 deletion src/routes/RequestsRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,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 @@ -334,6 +335,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 @@ -1416,6 +1418,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" />,
proxy: <FormattedMessage id="ui-requests.requests.proxy" />,
...(isViewPrintDetailsEnabled && {
Expand Down Expand Up @@ -1686,7 +1689,7 @@ class RequestsRoute extends React.Component {
resultIsSelected={this.resultIsSelected}
onFilterChange={this.handleFilterChange}
sortableColumns={['requestDate', 'title', 'year', 'itemBarcode', 'callNumber', 'type', 'requestStatus',
'position', 'servicePoint', 'requester', 'requesterBarcode', 'proxy', 'copies', 'printed']}
'position', 'servicePoint', 'retrievalServicePoint', 'requester', 'requesterBarcode', 'proxy', 'copies', 'printed']}
pageAmount={100}
pagingType={MCLPagingTypes.PREV_NEXT}
/>
Expand Down
2 changes: 2 additions & 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 Expand Up @@ -197,6 +198,7 @@
"deliveryAddress": "Delivery address",
"requester.pickupLocation": "Pickup location",
"pickupServicePoint.name": "Pickup service point",
"retrievalServicePoint.name": "Retrieval service point",
"requester.patronGroup.group": "Requester patron group",
"tags.tagList": "Tags",
"printDetails.printCount": "# Copies",
Expand Down

0 comments on commit f24ebbd

Please sign in to comment.