From 2c0748df10a8032f70bbdca2c2ef8b6a5d234b97 Mon Sep 17 00:00:00 2001 From: Oliver Lewandowski <109145288+olewandowski1@users.noreply.github.com> Date: Fri, 1 Mar 2024 11:30:53 +0100 Subject: [PATCH] OP-1822: add possibility to disable policy selection (#86) --- src/components/FamilyOrInsureePoliciesSummary.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/FamilyOrInsureePoliciesSummary.js b/src/components/FamilyOrInsureePoliciesSummary.js index 0bbee5b..e9eecb0 100644 --- a/src/components/FamilyOrInsureePoliciesSummary.js +++ b/src/components/FamilyOrInsureePoliciesSummary.js @@ -202,7 +202,13 @@ class FamilyOrInsureePoliciesSummary extends PagedDataHandler { } onChangeSelection = (i) => { - this.props.selectPolicy(i[0] || null); + const { selectPolicy, disableSelection } = this.props; + + if (disableSelection) { + return; + } + + selectPolicy(i[0] || null); }; toggleCheckbox = (key) => { @@ -353,6 +359,7 @@ class FamilyOrInsureePoliciesSummary extends PagedDataHandler { readOnly, className, hideAddPolicyButton = false, + disableSelection, } = this.props; if ((!family || !family.uuid) && (!insuree || !insuree.uuid)) { return null; @@ -417,7 +424,7 @@ class FamilyOrInsureePoliciesSummary extends PagedDataHandler { items={policies} fetching={fetchingPolicies} error={errorPolicies} - withSelection={"single"} + withSelection={disableSelection ? false : "single"} onChangeSelection={this.onChangeSelection} onDoubleClick={this.onDoubleClick} withPagination={true}