Skip to content

Commit

Permalink
Merge branch 'master' into UIREQMED-27
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-blazhko committed Jul 10, 2024
2 parents 84a26bb + 66980c6 commit 0cca3d4
Show file tree
Hide file tree
Showing 61 changed files with 939 additions and 183 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Add caret to `react` peer dependency. Refs UIREQMED-23.
* Add Search field for Mediated requests activity page. Refs UIREQMED-3.
* Add Filters for Mediated requests actions page. Refs UIREQMED-4.
* Update permission for Mediated requests. Refs UIREQMED-29.
* Implement `Create mediated request` form with basic functionality. Refs UIREQMED-27.

## 1.0.0
Expand Down
43 changes: 36 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,31 +91,60 @@
"mod-settings.global.read.circulation",
"mod-settings.entries.collection.get",
"mod-settings.entries.item.get",
"settings.requests-mediated.enabled"
"settings.requests-mediated.enabled",

"circulation.items-by-instance.get",
"circulation.loans.collection.get",
"circulation.requests.collection.get",
"circulation.requests.item.get",
"circulation-storage.loans.collection.get",
"circulation-storage.loans.item.get",
"circulation-storage.requests.collection.get",
"circulation-storage.requests.item.get",
"users.collection.get",
"users.item.get",
"configuration.entries.collection.get"
],
"visible": true
},
{
"permissionName": "ui-requests-mediated.view-create",
"displayName": "Mediated requests: View, create",
"permissionName": "ui-requests-mediated.view-create-edit",
"displayName": "Mediated requests: View, create, edit",
"subPermissions": [
"ui-requests-mediated.view",

"circulation.requests.item.post",
"circulation.requests.item.put",
"circulation.requests.allowed-service-points.get",
"circulation-storage.requests.item.post",
"circulation-storage.requests.item.put",
"circulation-storage.requests.item.delete",
"circulation-storage.request-preferences.collection.get"
],
"visible": true
},
{
"permissionName": "ui-requests-mediated.view-decline",
"displayName": "Mediated requests: View, decline",
"subPermissions": [
"ui-requests-mediated.view"
],
"visible": true
},
{
"permissionName": "ui-requests-mediated.view-edit-cancel",
"displayName": "Mediated requests: View, edit, cancel",
"permissionName": "ui-requests-mediated.view-edit-decline",
"displayName": "Mediated requests: View, edit, decline",
"subPermissions": [
"ui-requests-mediated.view-create"
"ui-requests-mediated.view-decline"
],
"visible": true
},
{
"permissionName": "ui-requests-mediated.all",
"displayName": "Mediated requests: All permissions",
"subPermissions": [
"ui-requests-mediated.view-edit-cancel"
"ui-requests-mediated.view-create-edit",
"ui-requests-mediated.view-decline"
],
"visible": true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ class InstanceInformation extends Component {
</Col>
<Col xs={3}>
<Button
id="selectInstanceButton"
buttonStyle="primary noRadius"
buttonClass={enterButtonClass}
fullWidth
Expand Down Expand Up @@ -245,7 +246,7 @@ class InstanceInformation extends Component {
instanceId={request?.instanceId || selectedInstance.id}
titleLevelRequestsCount={titleLevelRequestsCount}
title={selectedInstance.title}
contributors={selectedInstance.contributors || selectedInstance.contributorNames}
contributors={selectedInstance.contributors}
publications={selectedInstance.publication}
editions={selectedInstance.editions}
identifiers={selectedInstance.identifiers}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const ItemDetail = ({
const count = request?.itemRequestCount || requestCount || DEFAULT_COUNT_VALUE;
const status = item.status?.name || item.status;
const statusMessage = status ? <FormattedMessage id={ITEM_STATUS_TRANSLATIONS[status]} /> : <NoValue />;
const effectiveLocationName = item.effectiveLocation?.name || item.location?.name || <NoValue />;
const effectiveLocationName = item.location?.name || <NoValue />;
const dueDate = loan?.dueDate ? <FormattedDate value={loan.dueDate} /> : <NoValue />;
const effectiveCallNumberString = effectiveCallNumber(item);
const positionLink = count
Expand Down Expand Up @@ -114,10 +114,7 @@ const ItemDetail = ({
{dueDate}
</KeyValue>
</Col>
<Col
data-test-requests-on-item
xs={4}
>
<Col xs={4}>
<KeyValue
label={<FormattedMessage id="ui-requests-mediated.itemDetails.requestsOnItem" />}
value={positionLink}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class ItemInformation extends Component {
</Col>
<Col xs={3}>
<Button
id="clickable-select-item"
id="selectItemButton"
buttonStyle="primary noRadius"
buttonClass={enterButtonClass}
fullWidth
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ describe('ItemsDialog', () => {
visibleColumns: COLUMN_NAMES,
columnMapping: COLUMN_MAP,
columnWidths: COLUMN_WIDTHS,
formatter: formatter,
formatter,
maxHeight: MAX_HEIGHT,
onRowClick: defaultProps.onRowClick,
interactive: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import PropTypes from 'prop-types';

import {
MediatedRequestLevelFilter,
MediatedRequestStatusFilter,
Expand Down Expand Up @@ -30,4 +32,8 @@ const MediatedRequestsFilters = ({ settings }) => {
);
};

MediatedRequestsFilters.propTypes = {
settings: PropTypes.object.isRequired,
};

export default MediatedRequestsFilters;
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class RequestForm extends React.Component {
handleSubmit: PropTypes.func.isRequired,
findResource: PropTypes.func.isRequired,
request: PropTypes.object.isRequired,
settings: PropTypes.shape({
items: PropTypes.arrayOf(PropTypes.object),
}),
initialValues: PropTypes.object.isRequired,
location: PropTypes.shape({
search: PropTypes.string,
Expand All @@ -56,7 +59,7 @@ class RequestForm extends React.Component {
onSetSelectedInstance: PropTypes.func.isRequired,
pristine: PropTypes.bool,
submitting: PropTypes.bool,
patronGroups: PropTypes.arrayOf(PropTypes.object), // todo ddddd
patronGroups: PropTypes.arrayOf(PropTypes.object),
selectedItem: PropTypes.object,
selectedInstance: PropTypes.object,
selectedUser: PropTypes.object,
Expand All @@ -73,7 +76,7 @@ class RequestForm extends React.Component {
const {
request,
settings,
} = props;
} = props;
const { loan } = (request || {});
const { titleLevelRequestsFeatureEnabled } = getTlrSettings(settings?.items[0]?.value);

Expand All @@ -88,33 +91,6 @@ class RequestForm extends React.Component {
}

componentDidMount() {
const { location } = this.props;
const {
userId,
userBarcode,
itemBarcode,
itemId,
instanceId,
} = parse(location?.search);

if (userBarcode) {
this.findUser(RESOURCE_KEYS.BARCODE, userBarcode);
} else if (userId) {
this.findUser(RESOURCE_KEYS.ID, userId);
}

if (itemBarcode) {
this.findItem(RESOURCE_KEYS.BARCODE, itemBarcode);
}

if (itemId) {
this.findItem(RESOURCE_KEYS.ID, itemId);
}

if (instanceId && !itemBarcode && !itemId) {
this.findInstance(instanceId);
}

this.setTlrCheckboxInitialState();
}

Expand All @@ -124,29 +100,13 @@ class RequestForm extends React.Component {
request,
onSetSelectedItem,
onSetSelectedUser,
location,
settings,
} = this.props;
const {
initialValues: prevInitialValues,
request: prevRequest,
location: prevLocation,
settings: prevSettings,
} = prevProps;
const {
userId,
userBarcode,
itemBarcode,
itemId,
instanceId,
} = parse(location?.search);
const {
userId: prevUserId,
userBarcode: prevUserBarcode,
itemBarcode: prevItemBarcode,
itemId: prevItemId,
instanceId: prevInstanceId,
} = parse(prevLocation?.search);
const newSettings = settings?.items[0]?.value;

if (
Expand All @@ -160,27 +120,6 @@ class RequestForm extends React.Component {
this.setState({ selectedLoan: request.loan });
}

if (prevUserBarcode !== userBarcode) {
this.findUser(RESOURCE_KEYS.BARCODE, userBarcode);
}

if (prevUserId !== userId) {
this.findUser(RESOURCE_KEYS.ID, userId);
}

if (prevItemBarcode !== itemBarcode) {
this.findItem(RESOURCE_KEYS.BARCODE, itemBarcode);
}

if (prevItemId !== itemId) {
this.findItem(RESOURCE_KEYS.ID, itemId);
}

if (prevInstanceId !== instanceId) {
this.findInstance(instanceId);
this.setTlrCheckboxInitialState();
}

if (prevSettings?.items[0]?.value !== newSettings) {
const { titleLevelRequestsFeatureEnabled } = getTlrSettings(newSettings);

Expand Down Expand Up @@ -512,7 +451,7 @@ class RequestForm extends React.Component {
const { onCancel } = this.props;
const keepEditBtn = document.getElementById('clickable-cancel-editing-confirmation-confirm');

if (isItemsDialogOpen){
if (isItemsDialogOpen) {
handleKeyCommand(this.handleItemsDialogClose);
} else if (keepEditBtn) {
keepEditBtn.click();
Expand Down
Loading

0 comments on commit 0cca3d4

Please sign in to comment.