Skip to content

Commit

Permalink
CM-880: added picker for source and task type
Browse files Browse the repository at this point in the history
  • Loading branch information
sniedzielski committed Apr 24, 2024
1 parent 0a16121 commit 3a4f124
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 8 deletions.
26 changes: 19 additions & 7 deletions src/components/TaskAllFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,30 @@ function TaskAllFilter({
return (
<Grid container className={classes.form}>
<Grid item xs={3} className={classes.item}>
<TextInput
<PublishedComponent
pubRef="tasksManagement.taskSourcesPicker"
module={MODULE_NAME}
label="task.source"
value={filterTextFieldValue('source')}
onChange={onChangeStringFilter('source', CONTAINS_LOOKUP)}
withLabel
nullLabel={formatMessage(intl, MODULE_NAME, 'any')}
withNull
value={filterValue('source')}
onChange={(value) => onChangeFilters([
{
id: 'source',
value,
filter: value ? `source: "${value}"` : EMPTY_STRING,
},
])}
/>
</Grid>
<Grid item xs={3} className={classes.item}>
<TextInput
<PublishedComponent
pubRef="tasksManagement.taskTypesPicker"
module={MODULE_NAME}
label="task.type"
value={filterTextFieldValue('businessEvent')}
withLabel
nullLabel={formatMessage(intl, MODULE_NAME, 'any')}
withNull
value={filterValue('businessEvent')}
onChange={onChangeStringFilter('businessEvent', CONTAINS_LOOKUP)}
/>
</Grid>
Expand Down
26 changes: 26 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,29 @@ export const FAILED = 'FAILED';
export const DOT = '.';

export const TASK_ROUTE = 'tasksManagement.route.task';

export const TASK_AVAILABLE_SOURCES = [
'IndividualService',
'GroupIndividualService',
'CreateGroupAndMoveIndividualService',
'BenefitPlanService',
'BeneficiaryService',
'calcrule_social_protection',
'import_valid_items',
'payroll',
'payroll_reconciliation',
'payroll_reject',
'payroll_delete',
'CreateDeduplicationReviewTasksService',
];

export const TASK_AVAILABLE_TYPES = [
'create',
'update',
'calculate',
'import_valid_items',
'accept_payroll',
'payroll_reconciliation',
'payroll_reject',
'payroll_delete',
];
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import getAdminMainMenuContributions from './contributions/AdminMainMenuContribu
import { TASK_ROUTE } from './constants';
import { fetchTask, resolveTask } from './actions';
import TasksAllPage from './pages/TasksAllPage';
import TaskTypesPicker from './pickers/TaskTypesPicker';
import TaskSourcesPicker from './pickers/TaskSourcesPicker';

const ROUTE_TASKS_MANAGEMENT = 'tasks';
const ROUTE_TASK_MANAGEMENT = 'tasks/task';
Expand All @@ -41,6 +43,8 @@ const DEFAULT_CONFIG = {
{ key: TASK_ROUTE, ref: ROUTE_TASK_MANAGEMENT },
{ key: 'tasksManagement.route.group', ref: ROUTE_GROUP_MANAGEMENT },
{ key: 'tasksManagement.taskStatusPicker', ref: TaskStatusPicker },
{ key: 'tasksManagement.taskTypesPicker', ref: TaskTypesPicker },
{ key: 'tasksManagement.taskSourcesPicker', ref: TaskSourcesPicker },
{ key: 'tasksManagement.taskPreviewCell', ref: TaskPreviewCell },
{ key: 'tasksManagement.taskGroupPicker', ref: TaskGroupPicker },
{ key: 'tasksManagement.taskSearcher', ref: TaskSearcher },
Expand Down
25 changes: 25 additions & 0 deletions src/pickers/TaskSourcesPicker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import { ConstantBasedPicker } from '@openimis/fe-core';
import { TASK_AVAILABLE_SOURCES } from '../constants';

function TaskSourcesPicker(props) {
const {
required, withNull, readOnly, onChange, value, nullLabel, withLabel,
} = props;
return (
<ConstantBasedPicker
module="tasksManagement"
label="task.source"
constants={TASK_AVAILABLE_SOURCES}
onChange={onChange}
value={value}
required={required}
readOnly={readOnly}
withNull={withNull}
nullLabel={nullLabel}
withLabel={withLabel}
/>
);
}

export default TaskSourcesPicker;
25 changes: 25 additions & 0 deletions src/pickers/TaskTypesPicker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import { ConstantBasedPicker } from '@openimis/fe-core';
import { TASK_AVAILABLE_TYPES } from '../constants';

function TaskTypesPicker(props) {
const {
required, withNull, readOnly, onChange, value, nullLabel, withLabel,
} = props;
return (
<ConstantBasedPicker
module="tasksManagement"
label="task.type"
constants={TASK_AVAILABLE_TYPES}
onChange={onChange}
value={value}
required={required}
readOnly={readOnly}
withNull={withNull}
nullLabel={nullLabel}
withLabel={withLabel}
/>
);
}

export default TaskTypesPicker;
23 changes: 22 additions & 1 deletion src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,26 @@
"tasksManagement.menu.taskExecutionerGroups": "Task Executioner Groups",
"tasksManagement.TaskSourcePicker.label": "Task Sources",
"tasksManagement.TaskSourcePicker.placeholder": "Search for task sources...",
"tasksManagement.entries.tasksManagementAllView": "All Tasks"
"tasksManagement.entries.tasksManagementAllView": "All Tasks",
"tasksManagement.task.source.mutationLabel": "Resolving task",
"tasksManagement.task.source.IndividualService": "Individual Service",
"tasksManagement.task.source.GroupIndividualService": "Group Individual Service",
"tasksManagement.task.source.CreateGroupAndMoveIndividualService": "Create Group And Move Individual Service",
"tasksManagement.task.source.BenefitPlanService": "Benefit Plan Service",
"tasksManagement.task.source.BeneficiaryService": "Beneficiary Service",
"tasksManagement.task.source.calcrule_social_protection": "Calculation Rule: Social Protection",
"tasksManagement.task.source.import_valid_items": "Import Valid Items",
"tasksManagement.task.source.payroll": "Payroll",
"tasksManagement.task.source.payroll_reconciliation": "Payroll Reconciliation",
"tasksManagement.task.source.payroll_reject": "Reject Payroll",
"tasksManagement.task.source.payroll_delete": "Delete Payroll",
"tasksManagement.task.source.CreateDeduplicationReviewTasksService": "Create Deduplication Review Tasks Service",
"tasksManagement.task.type.create": "Create",
"tasksManagement.task.type.update": "Update",
"tasksManagement.task.type.calculate": "Calculate",
"tasksManagement.task.type.import_valid_items": "Import Valid Items",
"tasksManagement.task.type.accept_payroll": "Reject Payroll",
"tasksManagement.task.type.payroll_reconciliation": "Payroll Reconciliation",
"tasksManagement.task.type.payroll_reject": "Reject Payroll",
"tasksManagement.task.type.payroll_delete": "Delete Payroll"
}

0 comments on commit 3a4f124

Please sign in to comment.