Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Version published after converting to the new editor

If the Claim module provides by default a "searcher" on id (of course this is not realistic... but this is not the point, here):

...

extract of plugins/claims/ClaimList.js (React Component):
render() {
  const { classes } =this.props;
  return (
    <divclassName={classes.root}>
      <Listcomponent="nav">
        {this.state.claims.map((claim, index) => (
          <ClaimListItemclaim={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
functionInsureeListItemContribution(props) {
  if (!props.insuree) returnnull;
  return (
    props.insuree.name" "props.insuree.surname" "+props.insuree.birth_date
  );
}

exportdefaultInsureeListItemContribution;
... which gives the above (screenshot) result.

...

plugins/insurees/InsureeListItemContribution.js
functionInsureeListItemContribution(props) {
  if (!props.insuree) returnnull;
  return (
    props.insuree.name" "+
    (!!props.insuree.extended_attributes?props.insuree.extended_attributes["middlename"] +" ":"" ) +
    props.insuree.surname+" "+
    props.insuree.birth_date
  );
}

exportdefaultInsureeListItemContribution;
... resulting in:
 (where "Roberts" is the middle name of John Doe,...)