Streamlines more user interface
This commit is contained in:
@@ -74,7 +74,7 @@
|
||||
(def new-form-schema
|
||||
[:map
|
||||
[:customize-due-and-scheduled? {:optional true :default false :decode/arbitrary (fn [x] (if (= "" x)
|
||||
false
|
||||
false
|
||||
x))} [:maybe :boolean]]
|
||||
[:invoice/client entity-id]
|
||||
[:invoice/date clj-date-schema]
|
||||
@@ -143,7 +143,6 @@
|
||||
(mut/select-keys (mm/form-schema linear-wizard) #{:invoice/client :invoice/vendor :invoice/date :invoice/due :invoice/scheduled-payment :invoice/total :invoice/invoice-number :customize-due-and-scheduled?}))
|
||||
|
||||
(render-step [this request]
|
||||
(alog/peek ::check (:multi-form-state request))
|
||||
(mm/default-render-step
|
||||
linear-wizard this
|
||||
:head [:div.p-2 "New invoice"]
|
||||
@@ -194,7 +193,7 @@
|
||||
:x-model "vendorId"})]))
|
||||
|
||||
|
||||
[:div.flex.items-center.gap-2
|
||||
[:div.flex.items-center.gap-2
|
||||
(fc/with-field :invoice/date
|
||||
(com/validated-field
|
||||
{:label "Date"
|
||||
@@ -437,7 +436,6 @@
|
||||
mm/Initializable
|
||||
(init-step-params
|
||||
[_ current request]
|
||||
(alog/peek ::step (:step-params current))
|
||||
(if (not (seq (:invoice/expense-accounts (:step-params current))))
|
||||
(assoc (:step-params current) :invoice/expense-accounts [{:db/id "123"
|
||||
:invoice-expense-account/location "Shared"
|
||||
@@ -473,10 +471,12 @@
|
||||
(com/button {:color :primary
|
||||
:class "w-24"
|
||||
:hx-get (hu/url (bidi.bidi/path-for ssr-routes/only-routes ::route/pay-wizard)
|
||||
{:selected (:db/id snapshot)})} "Pay now")
|
||||
{:selected (:db/id snapshot)
|
||||
:replace-modal true})} "Pay now")
|
||||
(com/button {:color :secondary
|
||||
:class "w-24"
|
||||
:hx-get (bidi.bidi/path-for ssr-routes/only-routes ::route/new-wizard)} "Add another")
|
||||
:hx-get (hu/url (bidi.bidi/path-for ssr-routes/only-routes ::route/new-wizard)
|
||||
{:replace-modal true})} "Add another")
|
||||
(com/button {:class "w-24"
|
||||
"@click" "$dispatch('modalclose')"}
|
||||
"Close")])
|
||||
@@ -552,7 +552,6 @@
|
||||
[:basic-details
|
||||
:accounts
|
||||
:next-steps])
|
||||
|
||||
(get-step [this step-key]
|
||||
(let [step-key-result (mc/parse mm/step-key-schema step-key)
|
||||
[step-key-type step-key] step-key-result]
|
||||
@@ -562,7 +561,6 @@
|
||||
step-key)))
|
||||
(form-schema [_] new-form-schema)
|
||||
(submit [this {:keys [multi-form-state request-method identity] :as request}]
|
||||
|
||||
(let [invoice (:snapshot multi-form-state)
|
||||
client-id (->db-id (:invoice/client invoice))
|
||||
vendor-id (->db-id (:invoice/vendor invoice))
|
||||
@@ -584,8 +582,6 @@
|
||||
(maybe-spread-locations)
|
||||
(update :invoice/date coerce/to-date)
|
||||
(update :invoice/due coerce/to-date))]]
|
||||
(alog/peek ::test transaction)
|
||||
|
||||
(assert-invoice-amounts-add-up (second transaction))
|
||||
(assert-no-conflicting invoice)
|
||||
(exception->4xx #(assert-can-see-client (:identity request) client-id))
|
||||
@@ -612,6 +608,8 @@
|
||||
#_(html-response [:div]
|
||||
:headers {"hx-trigger" "modalclose,invalidated"})))
|
||||
|
||||
|
||||
|
||||
(def new-wizard (->NewWizard2 nil nil))
|
||||
|
||||
|
||||
@@ -667,13 +665,13 @@
|
||||
|
||||
(defn account-prediction [{:keys [multi-form-state form-errors]}]
|
||||
(let [vendor (clientize-vendor (get-vendor (:invoice/vendor (:step-params multi-form-state)))
|
||||
(->db-id (:invoice/client (:step-params multi-form-state)))) ]
|
||||
(->db-id (:invoice/client (:step-params multi-form-state))))]
|
||||
|
||||
(html-response
|
||||
(if-let [account-name (:account/name (:vendor/default-account vendor))]
|
||||
[:div {:class "transition duration-300 ease-in-out htmx-added:opacity-0 opacity-100"}
|
||||
[:label {:class "block mb-2 text-sm font-medium text-gray-900 dark:text-white"} "Default expense account"]
|
||||
[:div.flex.gap-2.items-center (com/pill {:color :primary} account-name)
|
||||
[:label {:class "block mb-2 text-sm font-medium text-gray-900 dark:text-white"} "Default expense account"]
|
||||
[:div.flex.gap-2.items-center (com/pill {:color :primary} account-name)
|
||||
(com/validated-save-button (cond-> {:errors form-errors
|
||||
;;:x-data (hx/json {})
|
||||
:class "w-24"
|
||||
|
||||
Reference in New Issue
Block a user