Slightly better UX

This commit is contained in:
Bryce
2024-03-27 09:21:25 -07:00
parent d193691963
commit 5c2d3d4487
2 changed files with 27 additions and 28 deletions

View File

@@ -192,7 +192,9 @@
head)
#_(com/modal-header-attachment {})
[:div.flex.shrink.overflow-auto.grow
[:div.grow-0.pr-6.pt-2.bg-gray-100.self-stretch.hidden.md:block #_{:style "margin-left:-20px"} (render-timeline linear-wizard step validation-route)]
(when (:render-timeline? linear-wizard)
[:div.grow-0.pr-6.pt-2.bg-gray-100.self-stretch.hidden.md:block #_{:style "margin-left:-20px"}
(render-timeline linear-wizard step validation-route)])
(com/modal-body {}
body)]
@@ -276,8 +278,9 @@
(assoc :multi-form-state (merge-multi-form-state multi-form-state)))))
(wrap-ensure-step)))
(defn default-render-wizard [linear-wizard {:keys [multi-form-state form-errors snapshot current-step] :as request} & {:keys [form-params]}]
(let [current-step (get-current-step linear-wizard)
(defn default-render-wizard [linear-wizard {:keys [multi-form-state form-errors snapshot current-step] :as request} & {:keys [form-params render-timeline?]
:or {render-timeline? true}}]
(let [current-step (get-current-step (assoc linear-wizard :render-timeline? render-timeline?))
edit-path (edit-path current-step request)]
[:form#wizard-form form-params
(fc/start-form multi-form-state (when form-errors {:step-params form-errors})

View File

@@ -129,7 +129,6 @@
;; TODO account / vendor search should use allowances
(defrecord BasicDetailsStep [linear-wizard]
mm/ModalWizardStep
(step-name [_]
@@ -195,25 +194,25 @@
:x-model "vendorId"})]))
(fc/with-field :invoice/date
(com/validated-field
{:label "Date"
:errors (fc/field-errors)}
[:div {:class "w-24"}
(com/date-input {:value (some-> (fc/field-value)
(atime/unparse-local atime/normal-date))
:name (fc/field-name)
:error? (fc/field-errors)
:x-model "date"
:placeholder "1/1/2024"})]))
(com/validated-field {}
[:div {:x-show "!customizeDueAndScheduled"}
(com/link {"@click" "customizeDueAndScheduled=true"
:x-show "!due && !scheduledPayment"}
"Add due / scheduled payment date")
(com/link {"@click" "customizeDueAndScheduled=true"
:x-show "due || scheduledPayment"}
"Change due / scheduled payment date")])
[:div.flex.items-center.gap-2
(fc/with-field :invoice/date
(com/validated-field
{:label "Date"
:errors (fc/field-errors)}
[:div {:class "w-24"}
(com/date-input {:value (some-> (fc/field-value)
(atime/unparse-local atime/normal-date))
:name (fc/field-name)
:error? (fc/field-errors)
:x-model "date"
:placeholder "1/1/2024"})]))
[:div {:x-show "!customizeDueAndScheduled"}
(com/link {"@click" "customizeDueAndScheduled=true"
:x-show "!due && !scheduledPayment"}
"Add due / scheduled payment date")
(com/link {"@click" "customizeDueAndScheduled=true"
:x-show "due || scheduledPayment"}
"Change due / scheduled payment date")]]
(fc/with-field :invoice/due
(com/validated-field
(hx/alpine-appear {:label "Due (optional)"
@@ -221,9 +220,6 @@
:x-show "customizeDueAndScheduled"})
[:div {:class "w-24"
:hx-put (bidi.bidi/path-for ssr-routes/only-routes ::route/due-date)
:x-hx-val:client-id "clientId" ;; TODO maybe just use the whole form
:x-hx-val:vendor-id "vendorId"
:x-hx-val:date "date"
:x-dispatch:changed "[clientId, vendorId, date]"
:hx-trigger "changed"
:hx-target "this"
@@ -392,7 +388,6 @@
(mut/select-keys (mm/form-schema linear-wizard) #{:invoice/expense-accounts}))
(render-step [this {{:keys [snapshot] :as multi-form-state} :multi-form-state :as request}]
(alog/peek ::mfs (:step-params (:multi-form-state request)))
(mm/default-render-step
linear-wizard this
:head [:div.p-2 "Invoice accounts "]
@@ -551,7 +546,8 @@
:form-params
(-> mm/default-form-props
(assoc :hx-post
(str (bidi/path-for ssr-routes/only-routes ::route/new-invoice-submit))))))
(str (bidi/path-for ssr-routes/only-routes ::route/new-invoice-submit))))
:render-timeline? false))
(steps [_]
[:basic-details
:accounts