Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CM-715: added benefits tab to visualize benefits #51

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions src/components/BenefitsTab.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 BenefitsTabLabel({
intl, onChange, tabStyle, isSelected, individual,
}) {
if (!individual) 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 BenefitsTabPanel({
value, individual, rights, classes,
}) {
if (!individual) return null;
return (
<PublishedComponent
pubRef="policyHolder.TabPanel"
module="individual"
index={BENEFITS_TAB_VALUE}
value={value}
>
<PublishedComponent
pubRef={BENEFITS_CONTRIBUTION_KEY}
individualUuid={individual?.id}
rights={rights}
classes={classes}
/>
</PublishedComponent>
);
}

export { BenefitsTabLabel, BenefitsTabPanel };
3 changes: 3 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ export const INDIVIDUAL_CHANGELOG_TAB_VALUE = 'IndividualChangelogTab';
export const INDIVIDUAL_TASK_TAB_VALUE = 'IndividualTaskTab';
export const GROUP_CHANGELOG_TAB_VALUE = 'GroupChangelogTab';
export const GROUP_TASK_TAB_VALUE = 'GroupTaskTab';
export const BENEFITS_TAB_VALUE = 'BenefitTaskTab';
export const INDIVIDUAL_TABS_LABEL_CONTRIBUTION_KEY = 'individual.TabPanel.label';
export const INDIVIDUAL_TABS_PANEL_CONTRIBUTION_KEY = 'individual.TabPanel.panel';

export const BENEFIT_PLAN_TABS_LABEL_CONTRIBUTION_KEY = 'individual.BenefitPlansListTabLabel';
export const BENEFIT_PLAN_TABS_PANEL_CONTRIBUTION_KEY = 'individual.BenefitPlansListTabPanel';
export const TASK_CONTRIBUTION_KEY = 'tasksManagement.tasks';
export const BENEFITS_CONTRIBUTION_KEY = 'payroll.benefitConsumptionPayrollSearcher';

export const BENEFICIARY_STATUS = {
POTENTIAL: 'POTENTIAL',
Expand All @@ -54,6 +56,7 @@ export const GROUP_INDIVIDUAL_ROLES_LIST = [
export const BENEFIT_PLAN_LABEL = 'BenefitPlan';
export const INDIVIDUAL_LABEL = 'Individual';
export const GROUP_LABEL = 'Group';
export const BENEFITS_LABEL = 'Benefits';

export const INDIVIDUAL_MODULE_NAME = 'individual';

Expand Down
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
import { GROUP_LABEL, INDIVIDUAL_LABEL } from './constants';
import { GroupCreateTaskItemFormatters, GroupCreateTaskTableHeaders } from './components/tasks/GroupCreateTasks';
import IndividualsUploadDialog from './components/dialogs/IndividualsUploadDialog';
import { BenefitsTabLabel, BenefitsTabPanel } from './components/BenefitsTab';

const ROUTE_INDIVIDUALS = 'individuals';
const ROUTE_INDIVIDUAL = 'individuals/individual';
Expand Down Expand Up @@ -83,6 +84,7 @@ const DEFAULT_CONFIG = {
GroupChangelogTabLabel,
GroupTaskTabLabel,
IndividalTaskTabLabel,
BenefitsTabLabel,
],
'individual.TabPanel.panel': [
IndividualsListTabPanel,
Expand All @@ -91,6 +93,7 @@ const DEFAULT_CONFIG = {
IndividalChangelogTabPanel,
GroupTaskTabPanel,
IndividalTaskTabPanel,
BenefitsTabPanel,
],
'individual.BenefitPlansListTabLabel': [BENEFIT_PLAN_TABS_LABEL_REF_KEY],
'individual.BenefitPlansListTabPanel': [BENEFIT_PLAN_TABS_PANEL_REF_KEY],
Expand Down
3 changes: 3 additions & 0 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"lastName": "Last Name",
"dob": "Day of birth",
"mandatoryFieldsEmptyError": "* These fields are required",
"benefits": {
"label": "Benefits"
},
"delete": {
"confirm": {
"title": "Delete {firstName} {lastName}?",
Expand Down
Loading