diff --git a/CHANGELOG.md b/CHANGELOG.md index 85e51e2e..11c5fc75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ * [UITEN-282] (https://issues.folio.org/browse/UITEN-282) Reading Room Access (settings): Update reading room. * [UITEN-283] (https://issues.folio.org/browse/UITEN-283) Reading Room Access (settings): Delete reading room. * [UITEN-281](https://folio-org.atlassian.net/browse/UITEN-281) Add Routing service point option to Service point page(ECS only). +* [UITEN-285](https://folio-org.atlassian.net/browse/UITEN-285) Disable edit of Routing service point field (ECS only). ## [8.1.0](https://github.com/folio-org/ui-tenant-settings/tree/v8.1.0)(2024-03-19) [Full Changelog](https://github.com/folio-org/ui-tenant-settings/compare/v8.0.0...v8.1.0) diff --git a/src/settings/ServicePoints/ServicePointForm.js b/src/settings/ServicePoints/ServicePointForm.js index fc2ecec9..5e40c3ff 100644 --- a/src/settings/ServicePoints/ServicePointForm.js +++ b/src/settings/ServicePoints/ServicePointForm.js @@ -55,8 +55,11 @@ export const SELECTED_ROUTING_SERVICE_POINT_VALUE = 'true'; export const SELECTED_PICKUP_LOCATION_VALUE = 'true'; export const UNSELECTED_PICKUP_LOCATION_VALUE = 'false'; export const LAYER_EDIT = 'layer=edit'; +export const isLayerEdit = (search) => ( + search.includes(LAYER_EDIT) +); export const isConfirmPickupLocationChangeModalShouldBeVisible = (search, value) => ( - search.includes(LAYER_EDIT) && value === UNSELECTED_PICKUP_LOCATION_VALUE + isLayerEdit(search) && value === UNSELECTED_PICKUP_LOCATION_VALUE ); const ServicePointForm = ({ @@ -309,7 +312,7 @@ const ServicePointForm = ({ component={Select} dataOptions={selectOptions} onChange={handleEcsRequestRoutingChange} - disabled={disabled} + disabled={disabled || isLayerEdit(search)} /> diff --git a/src/settings/ServicePoints/ServicePointForm.test.js b/src/settings/ServicePoints/ServicePointForm.test.js index c224887d..3e5e5889 100644 --- a/src/settings/ServicePoints/ServicePointForm.test.js +++ b/src/settings/ServicePoints/ServicePointForm.test.js @@ -2,13 +2,24 @@ import { SELECTED_PICKUP_LOCATION_VALUE, UNSELECTED_PICKUP_LOCATION_VALUE, LAYER_EDIT, + isLayerEdit, isConfirmPickupLocationChangeModalShouldBeVisible, } from './ServicePointForm'; describe('ServicePointForm', () => { - describe('isConfirmPickupLocationChangeModalShouldBeVisible', () => { - const OTHER_LAYER = 'other'; + const OTHER_LAYER = 'other'; + + describe('isLayerEdit', () => { + it(`should return true for layer equal "${LAYER_EDIT}"`, () => { + expect(isLayerEdit(LAYER_EDIT)).toBe(true); + }); + it(`should return false for layer not equal "${LAYER_EDIT}"(${OTHER_LAYER})`, () => { + expect(isLayerEdit(OTHER_LAYER)).toBe(false); + }); + }); + + describe('isConfirmPickupLocationChangeModalShouldBeVisible', () => { it(`should return true for layer equal "${LAYER_EDIT}" and value "${UNSELECTED_PICKUP_LOCATION_VALUE}"`, () => { expect(isConfirmPickupLocationChangeModalShouldBeVisible(LAYER_EDIT, UNSELECTED_PICKUP_LOCATION_VALUE)).toBe(true); });