enable date filtering

This commit is contained in:
Winzlieb - 2022-03-09 17:19:45 +01:00
parent 36a37d1ea5
commit 7479369abd
2 changed files with 15 additions and 13 deletions

View File

@ -9,7 +9,7 @@
:place_city "", :place_city "",
:contact_phone nil, :contact_phone nil,
:place_zip "", :place_zip "",
:time_from_str "", :time_from_str "10/04/2022",
:place_country "", :place_country "",
:animals_present false, :animals_present false,
:languages (), :languages (),
@ -26,7 +26,7 @@
:place_city "", :place_city "",
:contact_phone nil, :contact_phone nil,
:place_zip "", :place_zip "",
:time_from_str "", :time_from_str "03/04/2022",
:place_country nil, :place_country nil,
:animals_present true, :animals_present true,
:languages (), :languages (),
@ -43,7 +43,7 @@
:place_city nil, :place_city nil,
:contact_phone "Q", :contact_phone "Q",
:place_zip "RD", :place_zip "RD",
:time_from_str "q", :time_from_str "03/04/2022",
:place_country nil, :place_country nil,
:animals_present true, :animals_present true,
:languages (), :languages (),
@ -60,7 +60,7 @@
:place_city "1bh", :place_city "1bh",
:contact_phone nil, :contact_phone nil,
:place_zip "PG4", :place_zip "PG4",
:time_from_str "8az", :time_from_str "03/04/2022",
:place_country "I7", :place_country "I7",
:animals_present false, :animals_present false,
:languages ("x" "ni"), :languages ("x" "ni"),
@ -77,7 +77,7 @@
:place_city "x", :place_city "x",
:contact_phone "w8l", :contact_phone "w8l",
:place_zip "1E", :place_zip "1E",
:time_from_str "6", :time_from_str "01/01/2022",
:place_country "8", :place_country "8",
:animals_present nil, :animals_present nil,
:languages (), :languages (),
@ -94,7 +94,7 @@
:place_city "6", :place_city "6",
:contact_phone "OI", :contact_phone "OI",
:place_zip "1", :place_zip "1",
:time_from_str "hS192", :time_from_str "03/04/2022",
:place_country "", :place_country "",
:animals_present false, :animals_present false,
:languages ("DX" "E" "G3wuv"), :languages ("DX" "E" "G3wuv"),
@ -111,7 +111,7 @@
:place_city "cj1A2", :place_city "cj1A2",
:contact_phone "r", :contact_phone "r",
:place_zip "cJ9z7", :place_zip "cJ9z7",
:time_from_str "", :time_from_str "03/04/2022",
:place_country "5", :place_country "5",
:animals_present true, :animals_present true,
:languages nil, :languages nil,
@ -128,7 +128,7 @@
:place_city "4ML4yG", :place_city "4ML4yG",
:contact_phone "7uQ3Px", :contact_phone "7uQ3Px",
:place_zip "kp5IS", :place_zip "kp5IS",
:time_from_str "Y5lSe", :time_from_str "03/04/2022",
:place_country nil, :place_country nil,
:animals_present true, :animals_present true,
:languages (), :languages (),
@ -145,7 +145,7 @@
:place_city "u6k41v", :place_city "u6k41v",
:contact_phone "354VW", :contact_phone "354VW",
:place_zip "DI19", :place_zip "DI19",
:time_from_str "Z0QGzI8", :time_from_str "09/04/2022",
:place_country nil, :place_country nil,
:animals_present true, :animals_present true,
:languages nil, :languages nil,
@ -162,7 +162,7 @@
:place_city "f", :place_city "f",
:contact_phone "sQdB", :contact_phone "sQdB",
:place_zip "cid1", :place_zip "cid1",
:time_from_str "KSAFC", :time_from_str "03/05/2022",
:place_country "toTz5B", :place_country "toTz5B",
:animals_present false, :animals_present false,
:languages ("vMR0zyECr"), :languages ("vMR0zyECr"),

View File

@ -8,6 +8,9 @@ import BoolFilter from '@inovua/reactdatagrid-community/BoolFilter'
import {GetOffersQuery} from "../../codegen/generates"; import {GetOffersQuery} from "../../codegen/generates";
import {TypeColumn, TypeFilterValue, TypeSingleFilterValue} from "@inovua/reactdatagrid-community/types"; import {TypeColumn, TypeFilterValue, TypeSingleFilterValue} from "@inovua/reactdatagrid-community/types";
import NumberFilter from "@inovua/reactdatagrid-community/NumberFilter"; import NumberFilter from "@inovua/reactdatagrid-community/NumberFilter";
import moment from "moment";
global.moment = moment
type HostOfferLookupTableProps = { type HostOfferLookupTableProps = {
data: GetOffersQuery data: GetOffersQuery
@ -111,7 +114,7 @@ const operatorsForType = {
const columns: TypeColumn[] = columnsRaw const columns: TypeColumn[] = columnsRaw
.map(c => ({ .map(c => ({
...c, ...c,
filterEditor: filterMappings[c.type as 'string' | 'number' | 'boolean'] filterEditor: filterMappings[c.type as 'string' | 'number' | 'boolean' | 'date']
})) }))
const defaultFilterValue: TypeFilterValue = columns const defaultFilterValue: TypeFilterValue = columns
@ -132,8 +135,7 @@ const makeColumnDefinition = (data: any ) => Object.keys(data)
type: typeof data[k]})) type: typeof data[k]}))
const HostOfferLookupTable = ({ data }: HostOfferLookupTableProps) => { const HostOfferLookupTable = ({ data }: HostOfferLookupTableProps) => {
console.log({columns}) const dataSource = data.get_offers || []
const dataSource = data.get_offers?.map((d, index) => ({...d, id: index})) || []
return <> return <>
<DataGrid <DataGrid
idProperty="id" idProperty="id"