Claim list, with insuree information
If the Claim module provides by default a "searcher" on id (of course this is not realistic... but this is not the point, here):
The result of the search is a list of claims... in which insuree information is contributed by the "insuree" plugin:
extract of plugins/claims/ClaimList.js (React Component):
render() {
const { classes } = this.props;
return (
<div className={classes.root}>
<List component="nav">
{this.state.claims.map((claim, index) => (
<ClaimListItem claim={claim} key={`claim${index}`} />
))}
</List>
</div>
);
}
extract of plugins/claims/ClaimListItem.js (React Component):
render() {
const { claim } =this.props;
return (
<ListItembuttononClick={this.handleClick}>
<ContributedComponent {...claim}contributionKey="claims.claim.listItem">
<ListItemText primary={`${claim.declaration_date} [${claim.id}]`}/>
</ContributedComponent>
</ListItem>
);
}
The ContributedComponent component is a openIMIS Web FE core component, that enables other plugins (modules) to contribute. In this example, the contribution key is claims.claim.listItem.
So the insuree plugin can contribute by implementing
plugins/insurees/InsureeListItemContribution.js
function InsureeListItemContribution(props) {
if (!props.insuree) return null;
return (
props.insuree.name + " " + props.insuree.surname + " " + props.insuree.birth_date
);
}
export default InsureeListItemContribution;
... which gives the above (screenshot) result.
The key in such mechanism is that, while the claim module (list) displays insuree information, it doesn't have any explicite reference to it.
So if another implementation of the insuree module provide another "list item contribution", the claim module will display it, without noticing.
Example, if, for a country we have "middle names", the insuree plugin can be adpated to provide the following contribution:
plugins/insurees/InsureeListItemContribution.js
function InsureeListItemContribution(props) {
if (!props.insuree) return null;
return (
props.insuree.name + " " +
(!!props.insuree.extended_attributes ? props.insuree.extended_attributes["middlename"] + " " : "" ) +
props.insuree.surname + " " +
props.insuree.birth_date
);
}
export default InsureeListItemContribution;
... resulting in:
(where "Roberts" is the middle name of John Doe,...)
Did you encounter a problem or do you have a suggestion?
Please contact our Service Desk
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. https://creativecommons.org/licenses/by-sa/4.0/