Skip to content

Commit

Permalink
CM-820: added adjustments for custom filters and download
Browse files Browse the repository at this point in the history
  • Loading branch information
sniedzielski committed May 27, 2024
1 parent 57179f2 commit 387ac8f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 38 deletions.
47 changes: 9 additions & 38 deletions src/components/BenefitPackageMembersSearcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ import {
DialogContent,
} from '@material-ui/core';
import VisibilityIcon from '@material-ui/icons/Visibility';
import HistoryIcon from '@material-ui/icons/History';
import SentimentVeryDissatisfiedIcon from '@material-ui/icons/SentimentVeryDissatisfied';
import { connect, useDispatch } from 'react-redux';
import {
BENEFIT_PLAN_LABEL,

Check failure on line 23 in src/components/BenefitPackageMembersSearcher.js

View workflow job for this annotation

GitHub Actions / lint

'BENEFIT_PLAN_LABEL' is defined but never used
DEFAULT_PAGE_SIZE, EMPTY_STRING, MODULE_NAME, RIGHT_INDIVIDUAL_UPDATE, ROWS_PER_PAGE_OPTIONS,
DEFAULT_PAGE_SIZE, EMPTY_STRING, INDIVIDUAL_LABEL, INDIVIDUAL_MODULE_NAME, MODULE_NAME, RIGHT_INDIVIDUAL_UPDATE, ROWS_PER_PAGE_OPTIONS,

Check failure on line 24 in src/components/BenefitPackageMembersSearcher.js

View workflow job for this annotation

GitHub Actions / lint

This line has a length of 137. Maximum allowed is 120

Check failure on line 24 in src/components/BenefitPackageMembersSearcher.js

View workflow job for this annotation

GitHub Actions / lint

'MODULE_NAME' is defined but never used
} from '../constants';
import BenefitPackageMembersFilters from './BenefitPackageMembersFilters';
import { applyNumberCircle } from '../util/searcher-utils';
Expand Down Expand Up @@ -79,34 +77,6 @@ function BenefitPackageMembersSearcher({
(individual) => individual.lastName,
(individual) => (individual.dob ? formatDateFromISO(modulesManager, intl, individual.dob) : EMPTY_STRING),
];
if (rights.includes(RIGHT_INDIVIDUAL_UPDATE)) {
formatters.push(() => (
<Tooltip title={formatMessage(intl, 'socialProtection', 'benefitPackage.members.tooltip.paymentHistory')}>
{ /* TODO: Implement payments */ }
{ /* Blocked by: Payments has to be implemented to show payments history */ }
{ /* Additional notes: Right in if statement has to be adjusted */}
<IconButton
disabled
>
<HistoryIcon />
</IconButton>
</Tooltip>
));
}
if (rights.includes(RIGHT_INDIVIDUAL_UPDATE)) {
formatters.push(() => (
<Tooltip title={formatMessage(intl, 'socialProtection', 'benefitPackage.members.tooltip.grievanceHistory')}>
{ /* TODO: Implement grievances */ }
{ /* Blocked by: Grievances has to be implemented to show grievances history */ }
{ /* Additional notes: Right in if statement has to be adjusted */}
<IconButton
disabled
>
<SentimentVeryDissatisfiedIcon />
</IconButton>
</Tooltip>
));
}
if (rights.includes(RIGHT_INDIVIDUAL_UPDATE)) {
formatters.push((individual) => (
<Tooltip title={formatMessage(intl, 'socialProtection', 'benefitPackage.members.tooltip.viewDetails')}>
Expand Down Expand Up @@ -164,6 +134,7 @@ function BenefitPackageMembersSearcher({
}, [errorMembersExport]);

useEffect(() => {
console.log(membersExport, 'members export');

Check warning on line 137 in src/components/BenefitPackageMembersSearcher.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
if (membersExport) {
downloadExport(membersExport, `${formatMessage(intl, 'socialProtection', 'export.filename')}.csv`)();
dispatch(clearIndividualExportRef());
Expand Down Expand Up @@ -220,9 +191,9 @@ function BenefitPackageMembersSearcher({
exportFieldLabel={formatMessage(intl, 'individual', 'export.label')}
cacheFiltersKey="individualsFilterCache"
isCustomFiltering
objectForCustomFiltering={benefitPlan}
moduleName={MODULE_NAME}
objectType={BENEFIT_PLAN_LABEL}
additionalCustomFilterParams={{ type: 'INDIVIDUAL' }}
moduleName={INDIVIDUAL_MODULE_NAME}
objectType={INDIVIDUAL_LABEL}
appliedCustomFilters={appliedCustomFilters}
setAppliedCustomFilters={setAppliedCustomFilters}
appliedFiltersRowStructure={appliedFiltersRowStructure}
Expand Down Expand Up @@ -256,10 +227,10 @@ const mapStateToProps = (state) => ({
membersPageInfo: state.individual.individualsPageInfo,
membersTotalCount: state.individual.individualsTotalCount,
fetchingMembersExport: state.individual.fetchingIndividualsExport,
fetchedGroupsExport: state.individual.fetchedIndividualsExport,
membersExport: state.individual.individualsExport,
membersExportPageInfo: state.individual.individualsExportPageInfo,
errorMembersGroup: state.individual.errorIndividualsExport,
fetchedGroupsExport: state.individual.fetchedIndividualExport,
membersExport: state.individual.individualExport,
membersExportPageInfo: state.individual.individualExportPageInfo,
errorMembersGroup: state.individual.errorIndividualExport,
});

export default injectIntl(connect(mapStateToProps, null)(BenefitPackageMembersSearcher));
2 changes: 2 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,5 @@ export const BENEFIT_PLAN_TASK_TAB_VALUE = 'BenefitPlanTaskTab';
export const BENEFITS_CONTRIBUTION_KEY = 'payroll.benefitConsumptionPayrollSearcher';
export const PYTHON_DEFAULT_IMPORT_WORKFLOW = 'Python Beneficiaries Upload';
export const BENEFICIARIES_QUANTITY_LIMIT = 100;
export const INDIVIDUAL_LABEL = 'Individual';
export const INDIVIDUAL_MODULE_NAME = 'individual';

0 comments on commit 387ac8f

Please sign in to comment.