From abe183edb456c30f4505aab5cf3710b1a56819f7 Mon Sep 17 00:00:00 2001 From: Frederic Stahel Date: Mon, 4 Dec 2023 07:11:38 +0100 Subject: [PATCH 1/3] Disable coordinates inputs when status does not allow editing or editing mode is not active. --- .../borehole/segments/coordinatesSegment.js | 18 ++++++++++++------ .../form/domain/dropdown/domainDropdown.js | 8 +++++++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/client/src/commons/form/borehole/segments/coordinatesSegment.js b/src/client/src/commons/form/borehole/segments/coordinatesSegment.js index 5a38f16ed..76bba5cb8 100644 --- a/src/client/src/commons/form/borehole/segments/coordinatesSegment.js +++ b/src/client/src/commons/form/borehole/segments/coordinatesSegment.js @@ -388,7 +388,7 @@ const CoordinatesSegment = props => { } + control={} label={ { } + control={} label={ { autoCapitalize="off" autoComplete="off" autoCorrect="off" - readOnly={!isLV95} + readOnly={!isLV95 || !isEditable} onChange={e => { changeCoordinate("LV95", "X", e.target.value); }} @@ -479,7 +479,7 @@ const CoordinatesSegment = props => { autoCapitalize="off" autoComplete="off" autoCorrect="off" - readOnly={!isLV95} + readOnly={!isLV95 || !isEditable} onChange={e => { changeCoordinate("LV95", "Y", e.target.value); }} @@ -516,7 +516,7 @@ const CoordinatesSegment = props => { autoCapitalize="off" autoComplete="off" autoCorrect="off" - readOnly={isLV95} + readOnly={isLV95 || !isEditable} onChange={e => { changeCoordinate("LV03", "X", e.target.value); }} @@ -551,7 +551,7 @@ const CoordinatesSegment = props => { autoCapitalize="off" autoComplete="off" autoCorrect="off" - readOnly={isLV95} + readOnly={isLV95 || !isEditable} onChange={e => { changeCoordinate("LV03", "Y", e.target.value); }} @@ -576,6 +576,7 @@ const CoordinatesSegment = props => { }} schema="qt_location" selected={borehole.data.qt_location} + readOnly={!isEditable} /> @@ -597,6 +598,7 @@ const CoordinatesSegment = props => { spellCheck="false" value={borehole.data.elevation_z ?? ""} thousandSeparator="'" + readOnly={!isEditable} /> @@ -610,6 +612,7 @@ const CoordinatesSegment = props => { }} schema="qt_elevation" selected={borehole.data.qt_elevation} + readOnly={!isEditable} /> @@ -640,6 +643,7 @@ const CoordinatesSegment = props => { spellCheck="false" value={borehole.data.reference_elevation ?? ""} thousandSeparator="'" + readOnly={!isEditable} /> @@ -652,6 +656,7 @@ const CoordinatesSegment = props => { }} schema="qt_elevation" selected={borehole.data.qt_reference_elevation} + readOnly={!isEditable} /> @@ -668,6 +673,7 @@ const CoordinatesSegment = props => { }} schema="ibor117" selected={borehole.data.reference_elevation_type} + readOnly={!isEditable} /> diff --git a/src/client/src/commons/form/domain/dropdown/domainDropdown.js b/src/client/src/commons/form/domain/dropdown/domainDropdown.js index cbdab07af..d83f285fb 100644 --- a/src/client/src/commons/form/domain/dropdown/domainDropdown.js +++ b/src/client/src/commons/form/domain/dropdown/domainDropdown.js @@ -107,7 +107,8 @@ class DomainDropdown extends React.Component { } render() { - const { domains, schema, search, multiple, additionalValues } = this.props, + const { domains, schema, search, multiple, additionalValues, readOnly } = + this.props, { selected } = this.state; if (!domains.data.hasOwnProperty(schema)) { if (domains.isFetching === true) { @@ -222,6 +223,10 @@ class DomainDropdown extends React.Component { ), })), ); + if (readOnly) { + let selectedOption = options.find(option => option.value === selected); + return ; + } return ( Date: Mon, 4 Dec 2023 07:11:38 +0100 Subject: [PATCH 2/3] Disable coordinates inputs when status does not allow editing or editing mode is not active. --- .../borehole/segments/coordinatesSegment.js | 18 ++++++++++++------ .../form/domain/dropdown/domainDropdown.js | 8 +++++++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/client/src/commons/form/borehole/segments/coordinatesSegment.js b/src/client/src/commons/form/borehole/segments/coordinatesSegment.js index 5a38f16ed..76bba5cb8 100644 --- a/src/client/src/commons/form/borehole/segments/coordinatesSegment.js +++ b/src/client/src/commons/form/borehole/segments/coordinatesSegment.js @@ -388,7 +388,7 @@ const CoordinatesSegment = props => { } + control={} label={ { } + control={} label={ { autoCapitalize="off" autoComplete="off" autoCorrect="off" - readOnly={!isLV95} + readOnly={!isLV95 || !isEditable} onChange={e => { changeCoordinate("LV95", "X", e.target.value); }} @@ -479,7 +479,7 @@ const CoordinatesSegment = props => { autoCapitalize="off" autoComplete="off" autoCorrect="off" - readOnly={!isLV95} + readOnly={!isLV95 || !isEditable} onChange={e => { changeCoordinate("LV95", "Y", e.target.value); }} @@ -516,7 +516,7 @@ const CoordinatesSegment = props => { autoCapitalize="off" autoComplete="off" autoCorrect="off" - readOnly={isLV95} + readOnly={isLV95 || !isEditable} onChange={e => { changeCoordinate("LV03", "X", e.target.value); }} @@ -551,7 +551,7 @@ const CoordinatesSegment = props => { autoCapitalize="off" autoComplete="off" autoCorrect="off" - readOnly={isLV95} + readOnly={isLV95 || !isEditable} onChange={e => { changeCoordinate("LV03", "Y", e.target.value); }} @@ -576,6 +576,7 @@ const CoordinatesSegment = props => { }} schema="qt_location" selected={borehole.data.qt_location} + readOnly={!isEditable} /> @@ -597,6 +598,7 @@ const CoordinatesSegment = props => { spellCheck="false" value={borehole.data.elevation_z ?? ""} thousandSeparator="'" + readOnly={!isEditable} /> @@ -610,6 +612,7 @@ const CoordinatesSegment = props => { }} schema="qt_elevation" selected={borehole.data.qt_elevation} + readOnly={!isEditable} /> @@ -640,6 +643,7 @@ const CoordinatesSegment = props => { spellCheck="false" value={borehole.data.reference_elevation ?? ""} thousandSeparator="'" + readOnly={!isEditable} /> @@ -652,6 +656,7 @@ const CoordinatesSegment = props => { }} schema="qt_elevation" selected={borehole.data.qt_reference_elevation} + readOnly={!isEditable} /> @@ -668,6 +673,7 @@ const CoordinatesSegment = props => { }} schema="ibor117" selected={borehole.data.reference_elevation_type} + readOnly={!isEditable} /> diff --git a/src/client/src/commons/form/domain/dropdown/domainDropdown.js b/src/client/src/commons/form/domain/dropdown/domainDropdown.js index cbdab07af..d83f285fb 100644 --- a/src/client/src/commons/form/domain/dropdown/domainDropdown.js +++ b/src/client/src/commons/form/domain/dropdown/domainDropdown.js @@ -107,7 +107,8 @@ class DomainDropdown extends React.Component { } render() { - const { domains, schema, search, multiple, additionalValues } = this.props, + const { domains, schema, search, multiple, additionalValues, readOnly } = + this.props, { selected } = this.state; if (!domains.data.hasOwnProperty(schema)) { if (domains.isFetching === true) { @@ -222,6 +223,10 @@ class DomainDropdown extends React.Component { ), })), ); + if (readOnly) { + let selectedOption = options.find(option => option.value === selected); + return ; + } return ( Date: Mon, 11 Dec 2023 07:46:45 +0100 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bb493f97..e0f4c5c3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Use numeric input instead of dropdown for top bedrock quality fields. - Proxy requests to legacy api through .NET API with authentication. +- Disable spatial reference inputs when editing mode is not active or borehole status does not allow editing. ## v2.0.476 - 2023-12-08