[FIX] Filters are not being applied correctly in Omnichannel Current Chats list (#20320)

* fix capitalized "All" to "all" value.

* fix date filtering issue.

* refactor client and server to accept only 'from' and 'to' dates to list rooms.

* set previous date limit to selected date on 'to' field.

* permitting users to filter date and hour selecting only 'start' date/time.

* Revert "permitting users to filter date and hour selecting only 'start' date/time."

This reverts commit a48f0abc94.

* set a specific date format to server side read properly.

* check on the server side if dates are valid.

* Revert "check on the server side if dates are valid."

This reverts commit 5a1047621b.

* Code style improvements.

* Revert unnecessary changes.

Co-authored-by: Renato Becker <renato.augusto.becker@gmail.com>
pull/20586/head
Rafael Ferreira 5 years ago committed by GitHub
parent fcfd1c619c
commit 61ca8bf2b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      client/components/AutoCompleteDepartment.js
  2. 7
      client/views/omnichannel/currentChats/CurrentChatsRoute.js

@ -11,7 +11,7 @@ export const AutoCompleteDepartment = React.memo((props) => {
const { label } = props;
const options = useMemo(() => (data && [{ value: 'All', label: label && t('All') }, ...data.departments.map((department) => ({ value: department._id, label: department.name }))]) || [{ value: 'All', label: label || t('All') }], [data, label, t]);
const options = useMemo(() => (data && [{ value: 'all', label: label && t('All') }, ...data.departments.map((department) => ({ value: department._id, label: department.name }))]) || [{ value: 'all', label: label || t('All') }], [data, label, t]);
return <AutoComplete
{...props}

@ -68,8 +68,11 @@ const useQuery = ({ guest, servedBy, department, status, from, to, tags, customF
...current && { offset: current },
};
if (from && to) {
query.createdAt = JSON.stringify({ start: from, end: to });
if (from || to) {
query.createdAt = JSON.stringify({
...from && { start: moment(new Date(from)).set({ hour: '00', minutes: '00', seconds: '00' }).format('YYYY-MM-DDTHH:mm:ss') },
...to && { end: moment(new Date(to)).set({ hour: '23', minutes: '59', seconds: '59' }).format('YYYY-MM-DDTHH:mm:ss') },
});
}
if (status !== 'all') {
query.open = status === 'opened';

Loading…
Cancel
Save