feat(overview): rework filter builder with editable chips and native date ranges
Editable filter chips, uniformly-sized value controls, working field-picker search, and native date-range inputs with relative presets in place of the vendored calendar — native inputs give year-jump, manual entry and keyboard accessibility for free.
This commit is contained in:
parent
c0d1550401
commit
8303a39041
23 changed files with 1905 additions and 565 deletions
|
|
@ -60,16 +60,23 @@ defmodule MvWeb.FilterBuilderHelpers do
|
|||
end
|
||||
|
||||
@doc """
|
||||
Applies a payment-count filter (and optionally a period) through the builder.
|
||||
`filter` is one of `"all"`, `"fully_paid"`, `"unpaid_1"`, `"unpaid_2"`,
|
||||
`"unpaid_3"`; `from`/`to` are ISO-8601 strings or `""`.
|
||||
Applies a payment status filter (and optionally a period) through the builder.
|
||||
`status` is `"fully_paid"` or `"has_unpaid"`; `from`/`to` are ISO-8601 strings
|
||||
or `""`. For `"has_unpaid"` the open-cycle range defaults to `min` 1 / no max.
|
||||
"""
|
||||
def apply_payment_filter(view, filter, from \\ "", to \\ "") do
|
||||
def apply_payment_filter(view, status, from \\ "", to \\ "", min \\ "1", max \\ "") do
|
||||
pick_field(view, "payment")
|
||||
|
||||
view
|
||||
|> element("[data-testid='value-control-payment']")
|
||||
|> render_change(%{"pay" => filter, "pay_from" => from, "pay_to" => to})
|
||||
|> render_change(%{
|
||||
"__payment" => "1",
|
||||
"pay" => status,
|
||||
"pay_min" => min,
|
||||
"pay_max" => max,
|
||||
"pay_from" => from,
|
||||
"pay_to" => to
|
||||
})
|
||||
|
||||
flush_and_patch(view)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue