Skip to content

Commit a5f91ed

Browse files
authored
Merge pull request mngoe#166 from Y-Note-SAS/feature-33173
disable unecessary field in searcher OP-2554
2 parents 535a546 + f1d16e2 commit a5f91ed

File tree

6 files changed

+29
-8
lines changed

6 files changed

+29
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ npm-debug.log*
2121
yarn-debug.log*
2222
yarn-error.log*
2323
yarn.lock
24+
coverage

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,9 @@ None
104104
the current user as the enrolment officer during family or insuree creation. If 'True', the officer is inferred from session; if 'False', manual selection remains available. (default: 'False)
105105
- `isDefaultFetchInsureeActivated`, manage default fetch behavior of insuree searcher ; default: true
106106
- `isDefaultFetchFamilyActivated`, manage default fetch behavior of family searcher ; default: true
107+
- `searcherColumnsConfig`, manage columns visibility in searcher ; default: {}, e.g {email : "H", phone : "H"}
108+
the default value of the configuration is an empty object, which means that all columns are visible.
109+
110+
111+
107112

src/components/FamilyFilter.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class FamilyFilter extends Component {
3434

3535
constructor(props) {
3636
super(props);
37+
this.columns = props.modulesManager.getConf("fe-insuree", "columns", {});
3738
this.filterFamiliesOnMembers = props.modulesManager.getConf("fe-insuree", "filterFamiliesOnMembers", true);
3839
this.renderLastNameFirst = props.modulesManager.getConf(
3940
"fe-insuree",
@@ -204,6 +205,7 @@ class FamilyFilter extends Component {
204205
</Grid>
205206
}
206207
/>
208+
{!this.columns?.email === "H" && (
207209
<ControlledField
208210
module="insuree"
209211
id={`FamilyFilter.${anchor}.email`}
@@ -227,6 +229,7 @@ class FamilyFilter extends Component {
227229
</Grid>
228230
}
229231
/>
232+
)}
230233
<ControlledField
231234
module="insuree"
232235
id={`FamilyFilter.${anchor}.dob`}
@@ -350,6 +353,7 @@ class FamilyFilter extends Component {
350353
</Grid>
351354
}
352355
/>
356+
{this.columns?.confirmationNo !== "H" && (
353357
<ControlledField
354358
module="insuree"
355359
id="FamilyFilter.confirmationNo"
@@ -373,6 +377,7 @@ class FamilyFilter extends Component {
373377
</Grid>
374378
}
375379
/>
380+
)}
376381
<ControlledField
377382
module="insuree"
378383
id="PolicyFilter.officer"

src/components/FamilySearcher.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class FamilySearcher extends Component {
3737
"familyFilter.rowsPerPageOptions",
3838
[10, 20, 50, 100],
3939
);
40+
this.columns = props.modulesManager.getConf("fe-insuree", "searcherColumnsConfig", {});
4041
this.defaultPageSize = props.modulesManager.getConf("fe-insuree", "familyFilter.defaultPageSize", 10);
4142
this.locationLevels = this.props.modulesManager.getConf("fe-location", "location.Location.MaxLevels", 4);
4243
this.renderLastNameFirst = props.modulesManager.getConf(
@@ -116,16 +117,16 @@ class FamilySearcher extends Component {
116117
"insuree.familySummaries.insuranceNo",
117118
this.renderLastNameFirst ? "insuree.familySummaries.lastName" : "insuree.familySummaries.otherNames",
118119
!this.renderLastNameFirst ? "insuree.familySummaries.lastName" : "insuree.familySummaries.otherNames",
119-
"insuree.familySummaries.email",
120+
this.columns.email !== "H" ? "insuree.familySummaries.email" : null,
120121
"insuree.familySummaries.phone",
121122
"insuree.familySummaries.dob",
122123
];
123124
for (var i = 0; i < this.locationLevels; i++) {
124125
h.push(`location.locationType.${i}`);
125126
}
126127
h.push(
127-
"insuree.familySummaries.poverty",
128-
"insuree.familySummaries.confirmationNo",
128+
this.columns.poverty !== "H" ? "insuree.familySummaries.poverty" : null,
129+
this.columns.confirmationNo !== "H" ? "insuree.familySummaries.confirmationNo" : null,
129130
filters?.showHistory?.value ? "insuree.familySummaries.validityFrom" : null,
130131
filters?.showHistory?.value ? "insuree.familySummaries.validityTo" : null,
131132
"insuree.familySummaries.openNewTab",
@@ -194,7 +195,7 @@ class FamilySearcher extends Component {
194195
(family.headInsuree && !this.renderLastNameFirst
195196
? family.headInsuree.lastName
196197
: family.headInsuree.otherNames) || "",
197-
(family) => (!!family.headInsuree ? family.headInsuree.email : ""),
198+
this.columns.email !== "H" ? (family) => (!!family.headInsuree ? family.headInsuree.email : "") : null,
198199
(family) => (!!family.headInsuree ? family.headInsuree.phone : ""),
199200
(family) =>
200201
!!family.headInsuree
@@ -207,8 +208,8 @@ class FamilySearcher extends Component {
207208
formatters.push((family) => this.parentLocation(family.location, j));
208209
}
209210
formatters.push(
210-
(family) => <Checkbox color="primary" checked={family.poverty} readOnly />,
211-
(family) => family.confirmationNo,
211+
this.columns.poverty !== "H" ? (family) => <Checkbox color="primary" checked={family.poverty} readOnly /> : null,
212+
this.columns.confirmationNo !== "H" ? (family) => family.confirmationNo : null,
212213
filters?.showHistory?.value
213214
? (family) => formatDateFromISO(this.props.modulesManager, this.props.intl, family.validityFrom)
214215
: null,

src/components/InsureeFilter.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const INSUREE_FILTER_CONTRIBUTION_KEY = "insuree.Filter";
3232
class InsureeFilter extends Component {
3333
constructor(props) {
3434
super(props);
35+
this.columns = props.modulesManager.getConf("fe-insuree", "columns", {});
3536
this.renderLastNameFirst = props.modulesManager.getConf(
3637
"fe-insuree",
3738
"renderLastNameFirst",
@@ -222,6 +223,7 @@ class InsureeFilter extends Component {
222223
/>
223224
</Grid>
224225
</Grid>
226+
{this.columns?.email !== "H" && (
225227
<ControlledField
226228
module="insuree"
227229
id="InsureeFilter.email"
@@ -245,6 +247,7 @@ class InsureeFilter extends Component {
245247
</Grid>
246248
}
247249
/>
250+
)}
248251
<ControlledField
249252
module="insuree"
250253
id="InsureeFilter.phone"
@@ -388,4 +391,8 @@ class InsureeFilter extends Component {
388391
}
389392
}
390393

394+
const mapStateToProps = (state) => ({
395+
rights: !!state.core && !!state.core.user && !!state.core.user.i_user ? state.core.user.i_user.rights : [],
396+
});
397+
391398
export default withModulesManager(injectIntl(withTheme(withStyles(styles)(InsureeFilter))));

src/components/InsureeSearcher.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class InsureeSearcher extends Component {
4747
"insureeFilter.rowsPerPageOptions",
4848
[10, 20, 50, 100],
4949
);
50+
this.columns = props.modulesManager.getConf("fe-insuree", "columns", {});
51+
this.fields = props.modulesManager.getConf("fe-insuree", "fields", {});
5052
this.defaultPageSize = props.modulesManager.getConf("fe-insuree", "insureeFilter.defaultPageSize", 10);
5153
this.locationLevels = this.props.modulesManager.getConf("fe-location", "location.Location.MaxLevels", 4);
5254
this.renderLastNameFirst = props.modulesManager.getConf(
@@ -130,7 +132,7 @@ class InsureeSearcher extends Component {
130132
!this.renderLastNameFirst ? "insuree.insureeSummaries.lastName" : "insuree.insureeSummaries.otherNames",
131133
"insuree.insureeSummaries.maritalStatus",
132134
"insuree.insureeSummaries.gender",
133-
"insuree.insureeSummaries.email",
135+
this.columns.email !== "H" ? "insuree.insureeSummaries.email" : null,
134136
"insuree.insureeSummaries.phone",
135137
"insuree.insureeSummaries.dob",
136138
...Array.from(Array(this.locationLevels)).map((_, i) => (`location.locationType.${i}`)),
@@ -217,7 +219,7 @@ class InsureeSearcher extends Component {
217219
value={!!insuree.gender ? insuree.gender.code : null}
218220
/>
219221
),
220-
(insuree) => insuree.email,
222+
this.columns.email !== "H" ? (insuree) => insuree.email : null,
221223
(insuree) => insuree.phone,
222224
(insuree) => formatDateFromISO(this.props.modulesManager, this.props.intl, insuree.dob),
223225
];

0 commit comments

Comments
 (0)