diff --git a/src/components/TaskFilter.js b/src/components/TaskFilter.js index cd7f3cb..7664cb1 100644 --- a/src/components/TaskFilter.js +++ b/src/components/TaskFilter.js @@ -4,11 +4,11 @@ import { Grid } from '@material-ui/core'; import { withTheme, withStyles } from '@material-ui/core/styles'; import _debounce from 'lodash/debounce'; import { - TextInput, PublishedComponent, formatMessage, decodeId, + TextInput, PublishedComponent, formatMessage, decodeId, toISODateTime, } from '@openimis/fe-core'; import { defaultFilterStyles } from '../utils/styles'; import { - CONTAINS_LOOKUP, DEFAULT_DEBOUNCE_TIME, EMPTY_STRING, + CONTAINS_LOOKUP, DEFAULT_DEBOUNCE_TIME, EMPTY_STRING, MODULE_NAME, } from '../constants'; function TaskFilter({ @@ -44,7 +44,7 @@ function TaskFilter({ onChangeFilters([ { @@ -84,9 +84,9 @@ function TaskFilter({ onChangeFilters([ @@ -98,6 +98,36 @@ function TaskFilter({ ])} /> + + onChangeFilters([ + { + id: 'dateCreated_Gte', + value: v, + filter: `dateCreated_Gte: "${toISODateTime(v)}"`, + }, + ])} + /> + + + onChangeFilters([ + { + id: 'dateCreated_Lte', + value: v, + filter: `dateCreated_Lte: "${toISODateTime(v)}"`, + }, + ])} + /> + ); } diff --git a/src/components/TaskSearcher.js b/src/components/TaskSearcher.js index f647a67..19d32b2 100644 --- a/src/components/TaskSearcher.js +++ b/src/components/TaskSearcher.js @@ -22,7 +22,11 @@ function TaskSearcher({ const history = useHistory(); const modulesManager = useModulesManager(); const dispatch = useDispatch(); - const { formatMessage, formatMessageWithValues } = useTranslations('tasksManagement', modulesManager); + const { + formatMessage, + formatMessageWithValues, + formatDateTimeFromISO, + } = useTranslations('tasksManagement', modulesManager); const fetchingTasks = useSelector((state) => state?.tasksManagement?.fetchingTasks); const fetchedTasks = useSelector((state) => state?.tasksManagement?.fetchedTasks); @@ -52,6 +56,7 @@ function TaskSearcher({ 'task.type', 'task.entity', 'task.assignee', + 'task.dateCreated', 'task.status', ]; if (rights.includes(RIGHT_TASKS_MANAGEMENT_SEARCH)) { @@ -65,6 +70,7 @@ function TaskSearcher({ ['type', true], ['entity', true], ['assignee', true], + ['date_created', true], ['status', true], ]; @@ -73,6 +79,7 @@ function TaskSearcher({ (task) => trimBusinessEvent(task.businessEvent), (task) => task.entityString, (task) => task?.taskGroup?.code, + (task) => formatDateTimeFromISO(task?.dateCreated), (task) => task.status, (task) => ( diff --git a/src/constants.js b/src/constants.js index 5e88871..25cf369 100644 --- a/src/constants.js +++ b/src/constants.js @@ -1,4 +1,5 @@ export const TASKS_MANAGEMENT_MAIN_MENU_CONTRIBUTION_KEY = 'tasksManagement.MainMenu'; +export const MODULE_NAME = 'tasksManagement'; export const DEFAULT_DEBOUNCE_TIME = 500; export const DEFAULT_PAGE_SIZE = 10; diff --git a/src/translations/en.json b/src/translations/en.json index 4d8f29c..eff30d3 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -9,6 +9,9 @@ "tasksManagement.task.source": "Source", "tasksManagement.task.type": "Type", "tasksManagement.task.entity": "Entity", + "tasksManagement.task.dateCreated": "Date Created", + "tasksManagement.task.dateCreated.after": "Date Created From", + "tasksManagement.task.dateCreated.before": "Date Created To", "tasksManagement.task.assignee": "Task Group", "tasksManagement.task.businessStatus": "Business Status", "tasksManagement.task.status": "Status",