Slightly better UX
This commit is contained in:
@@ -192,7 +192,9 @@
|
|||||||
head)
|
head)
|
||||||
#_(com/modal-header-attachment {})
|
#_(com/modal-header-attachment {})
|
||||||
[:div.flex.shrink.overflow-auto.grow
|
[: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 {}
|
(com/modal-body {}
|
||||||
body)]
|
body)]
|
||||||
|
|
||||||
@@ -276,8 +278,9 @@
|
|||||||
(assoc :multi-form-state (merge-multi-form-state multi-form-state)))))
|
(assoc :multi-form-state (merge-multi-form-state multi-form-state)))))
|
||||||
(wrap-ensure-step)))
|
(wrap-ensure-step)))
|
||||||
|
|
||||||
(defn default-render-wizard [linear-wizard {:keys [multi-form-state form-errors snapshot current-step] :as request} & {:keys [form-params]}]
|
(defn default-render-wizard [linear-wizard {:keys [multi-form-state form-errors snapshot current-step] :as request} & {:keys [form-params render-timeline?]
|
||||||
(let [current-step (get-current-step linear-wizard)
|
:or {render-timeline? true}}]
|
||||||
|
(let [current-step (get-current-step (assoc linear-wizard :render-timeline? render-timeline?))
|
||||||
edit-path (edit-path current-step request)]
|
edit-path (edit-path current-step request)]
|
||||||
[:form#wizard-form form-params
|
[:form#wizard-form form-params
|
||||||
(fc/start-form multi-form-state (when form-errors {:step-params form-errors})
|
(fc/start-form multi-form-state (when form-errors {:step-params form-errors})
|
||||||
|
|||||||
@@ -129,7 +129,6 @@
|
|||||||
|
|
||||||
;; TODO account / vendor search should use allowances
|
;; TODO account / vendor search should use allowances
|
||||||
|
|
||||||
|
|
||||||
(defrecord BasicDetailsStep [linear-wizard]
|
(defrecord BasicDetailsStep [linear-wizard]
|
||||||
mm/ModalWizardStep
|
mm/ModalWizardStep
|
||||||
(step-name [_]
|
(step-name [_]
|
||||||
@@ -195,25 +194,25 @@
|
|||||||
:x-model "vendorId"})]))
|
:x-model "vendorId"})]))
|
||||||
|
|
||||||
|
|
||||||
(fc/with-field :invoice/date
|
[:div.flex.items-center.gap-2
|
||||||
(com/validated-field
|
(fc/with-field :invoice/date
|
||||||
{:label "Date"
|
(com/validated-field
|
||||||
:errors (fc/field-errors)}
|
{:label "Date"
|
||||||
[:div {:class "w-24"}
|
:errors (fc/field-errors)}
|
||||||
(com/date-input {:value (some-> (fc/field-value)
|
[:div {:class "w-24"}
|
||||||
(atime/unparse-local atime/normal-date))
|
(com/date-input {:value (some-> (fc/field-value)
|
||||||
:name (fc/field-name)
|
(atime/unparse-local atime/normal-date))
|
||||||
:error? (fc/field-errors)
|
:name (fc/field-name)
|
||||||
:x-model "date"
|
:error? (fc/field-errors)
|
||||||
:placeholder "1/1/2024"})]))
|
:x-model "date"
|
||||||
(com/validated-field {}
|
:placeholder "1/1/2024"})]))
|
||||||
[:div {:x-show "!customizeDueAndScheduled"}
|
[:div {:x-show "!customizeDueAndScheduled"}
|
||||||
(com/link {"@click" "customizeDueAndScheduled=true"
|
(com/link {"@click" "customizeDueAndScheduled=true"
|
||||||
:x-show "!due && !scheduledPayment"}
|
:x-show "!due && !scheduledPayment"}
|
||||||
"Add due / scheduled payment date")
|
"Add due / scheduled payment date")
|
||||||
(com/link {"@click" "customizeDueAndScheduled=true"
|
(com/link {"@click" "customizeDueAndScheduled=true"
|
||||||
:x-show "due || scheduledPayment"}
|
:x-show "due || scheduledPayment"}
|
||||||
"Change due / scheduled payment date")])
|
"Change due / scheduled payment date")]]
|
||||||
(fc/with-field :invoice/due
|
(fc/with-field :invoice/due
|
||||||
(com/validated-field
|
(com/validated-field
|
||||||
(hx/alpine-appear {:label "Due (optional)"
|
(hx/alpine-appear {:label "Due (optional)"
|
||||||
@@ -221,9 +220,6 @@
|
|||||||
:x-show "customizeDueAndScheduled"})
|
:x-show "customizeDueAndScheduled"})
|
||||||
[:div {:class "w-24"
|
[:div {:class "w-24"
|
||||||
:hx-put (bidi.bidi/path-for ssr-routes/only-routes ::route/due-date)
|
: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]"
|
:x-dispatch:changed "[clientId, vendorId, date]"
|
||||||
:hx-trigger "changed"
|
:hx-trigger "changed"
|
||||||
:hx-target "this"
|
:hx-target "this"
|
||||||
@@ -392,7 +388,6 @@
|
|||||||
(mut/select-keys (mm/form-schema linear-wizard) #{:invoice/expense-accounts}))
|
(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}]
|
(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
|
(mm/default-render-step
|
||||||
linear-wizard this
|
linear-wizard this
|
||||||
:head [:div.p-2 "Invoice accounts "]
|
:head [:div.p-2 "Invoice accounts "]
|
||||||
@@ -551,7 +546,8 @@
|
|||||||
:form-params
|
:form-params
|
||||||
(-> mm/default-form-props
|
(-> mm/default-form-props
|
||||||
(assoc :hx-post
|
(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 [_]
|
(steps [_]
|
||||||
[:basic-details
|
[:basic-details
|
||||||
:accounts
|
:accounts
|
||||||
|
|||||||
Reference in New Issue
Block a user