applying feedback

This commit is contained in:
2024-11-20 09:48:07 -08:00
parent d534b9e10f
commit a4a40fc9c2
6 changed files with 73 additions and 40 deletions

View File

@@ -44,11 +44,14 @@
(def query-schema (mc/schema
[:maybe [:map
[:client {:unspecified/value :all}
[:or
[:or
[:enum :all]
[:vector {:coerce? true :min 1 }
[:entity-map {:pull [:db/id :client/name]}]]
]]
[:vector {:coerce? true :min 1}
[:entity-map {:pull [:db/id :client/name]}]]]]
[:include-deltas {:default false}
[:boolean {:decode/string {:enter #(if (= % "on") true
(boolean %))}}]]
[:date {:unspecified/fn (fn [] [(atime/local-now)])}
[:vector {:coerce? true
:decode/string (fn [s] (if (string? s) (str/split s #", ")
@@ -146,36 +149,12 @@
(fc/with-field :date
(com/validated-inline-field {:label "Date"
:errors (fc/field-errors)}
[:div {:x-data (hx/json {:dates (map #(atime/unparse-local % atime/normal-date) (fc/field-value))}) }
[:template {:x-for "v in dates"}
[:input {:type "hidden"
:name (fc/field-name)
:x-model "v"}] ]
(com/a-button {"x-tooltip.on.click.theme.dropdown.placement.bottom.interactive" "{content: ()=> $refs.tooltip.innerHTML, allowHTML: true, appendTo: $root}"
:indicator? false}
[:template {:x-if "dates.length == 0"}
[:span.text-left.text-gray-400 "None selected"]]
[:template { :x-if "dates.length < 3 && dates.length > 0"}
[:span.inline-flex.gap-2
[:template {:x-for "v in dates" }
(com/pill {:color :secondary}
[:span {:x-text "v"}])]]]
[:template {:x-if "dates.length >= 3"}
(com/pill {:color :secondary}
[:span {:x-text "dates.length"}]
" dates")]
[:div {:class "w-3 h-3 m-1 inline ml-1 justify-self-end text-gray-500 self-center"}
svg/drop-down])
[:template {:x-ref "tooltip"}
[:div.p-4 {:class "bg-gray-100 dark:bg-gray-600 rounded-lg shadow-2xl w-max z-50 ring-1 p-4"}
[:div.flex.flex-col.gap-2
(com/multi-calendar-input {:placeholder "12/21/2020"
:x-model "dates" })
(com/a-button {"@click" "dates=getFourWeekPeriods(dates[dates.length -1])"} "13 periods")
(com/a-button {"@click" "dates=withLastYear(dates[dates.length -1])"} "Add prior year")
(com/a-button {"@click" "dates=[]"} "Clear")]]]]))
(com/dates-dropdown {:value (fc/field-value)
:name (fc/field-name)})))
(fc/with-field :include-deltas
(com/toggle {:name (fc/field-name)
:checked (fc/field-value)}
"Include Deltas"))
(com/button {:color :primary :class "w-32"}
"Run")
(com/button {:formaction (bidi.bidi/path-for ssr-routes/only-routes ::route/export-balance-sheet) } "Export PDF")]]] ]