add filter for last seen days
This commit is contained in:
parent
b1cbe8505a
commit
8d32c2cbd7
2 changed files with 19 additions and 0 deletions
|
|
@ -32,6 +32,9 @@ const fetchData = async (user: User, baseQueyrUri: string, parameters: Parameter
|
|||
if (parameters.min_sqm) {
|
||||
queryString.append("min_sqm", parameters.min_sqm.toString());
|
||||
}
|
||||
if (parameters.last_seen_days) {
|
||||
queryString.append("last_seen_days", parameters.last_seen_days.toString());
|
||||
}
|
||||
|
||||
const response = await fetch(baseQueyrUri + '?' + queryString,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ export interface ParameterValues {
|
|||
min_price?: number
|
||||
max_price?: number
|
||||
min_sqm?: number
|
||||
last_seen_days?: number
|
||||
}
|
||||
|
||||
export function Parameters(
|
||||
|
|
@ -52,6 +53,7 @@ export function Parameters(
|
|||
max_price: z.number().optional(),
|
||||
min_price: z.number().min(0).optional(),
|
||||
min_sqm: z.number().optional(),
|
||||
last_seen_days: z.number().min(0).optional(),
|
||||
})
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
|
|
@ -62,6 +64,7 @@ export function Parameters(
|
|||
max_price: 3000,
|
||||
min_price: 2000,
|
||||
min_sqm: 0,
|
||||
last_seen_days: 7,
|
||||
},
|
||||
})
|
||||
// 2. Define a submit handler.
|
||||
|
|
@ -200,6 +203,19 @@ export function Parameters(
|
|||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="last_seen_days"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Last seen days</FormLabel>
|
||||
<FormControl >
|
||||
<Input type="number" placeholder={"days"} {...field} onChange={(e) => field.onChange(Number(e.target.value))} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Button type="submit" value={"visualize"} onClick={() => setAction("visualize")}>Visualize</Button>
|
||||
<Button type="submit" value={"fetch-data"} onClick={() => setAction("fetch-data")}>Fetch data</Button>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue