Skip to content

Commit

Permalink
CM-919: added benefit tab for group (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
sniedzielski authored Jun 6, 2024
1 parent 6de548c commit 9f19b40
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const GROUP_FULL_PROJECTION = [
'id',
'code',
'isDeleted',
'head {firstName, lastName}',
'head {firstName, lastName, uuid}',
'dateCreated',
'dateUpdated',
'jsonExt',
Expand Down
44 changes: 44 additions & 0 deletions src/components/BenefitsGroupTab.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from 'react';
import { Tab } from '@material-ui/core';
import {
formatMessage, PublishedComponent,
} from '@openimis/fe-core';
import { BENEFITS_TAB_VALUE, BENEFITS_CONTRIBUTION_KEY } from '../constants';

function BenefitsGroupTabLabel({
intl, onChange, tabStyle, isSelected, group,
}) {
if (!group) return null;
return (
<Tab
onChange={onChange}
className={tabStyle(BENEFITS_TAB_VALUE)}
selected={isSelected(BENEFITS_TAB_VALUE)}
value={BENEFITS_TAB_VALUE}
label={formatMessage(intl, 'individual', 'benefits.label')}
/>
);
}

function BenefitsGroupTabPanel({
value, group, rights, classes,
}) {
if (!group) return null;
return (
<PublishedComponent
pubRef="policyHolder.TabPanel"
module="individual"
index={BENEFITS_TAB_VALUE}
value={value}
>
<PublishedComponent
pubRef={BENEFITS_CONTRIBUTION_KEY}
individualUuid={group?.head?.uuid}
rights={rights}
classes={classes}
/>
</PublishedComponent>
);
}

export { BenefitsGroupTabLabel, BenefitsGroupTabPanel };
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import {
} from './components/tasks/GroupImportTasks';
import EnrollmentGroupPage from './pages/EnrollmentGroupPage';
import GroupMenu from './components/dialogs/GroupMenu';
import { BenefitsGroupTabLabel, BenefitsGroupTabPanel } from './components/BenefitsGroupTab';

const ROUTE_INDIVIDUALS = 'individuals';
const ROUTE_INDIVIDUAL = 'individuals/individual';
Expand Down Expand Up @@ -136,12 +137,14 @@ const DEFAULT_CONFIG = {
IndividualsListTabLabel,
BenefitPlansListTabLabel,
GroupChangelogTabLabel,
BenefitsGroupTabLabel,
GroupTaskTabLabel,
],
'group.TabPanel.panel': [
IndividualsListTabPanel,
BenefitPlansListTabPanel,
GroupChangelogTabPanel,
BenefitsGroupTabPanel,
GroupTaskTabPanel,
],
'individual.BenefitPlansListTabLabel': [BENEFIT_PLAN_TABS_LABEL_REF_KEY],
Expand Down

0 comments on commit 9f19b40

Please sign in to comment.