Updates page as needed.

This commit is contained in:
Bryce
2024-03-29 10:43:15 -07:00
parent 6496eea485
commit d34e125b6f
4 changed files with 19 additions and 24 deletions

View File

@@ -22,6 +22,7 @@
[auto-ap.ssr.utils
:refer [->db-id apply-middleware-to-all-handlers clj-date-schema
entity-id form-validation-error html-response money strip
->OOBElements
wrap-schema-enforce]]
[auto-ap.time :as atime]
[bidi.bidi :as bidi]
@@ -127,8 +128,6 @@
vendor))
;; TODO account / vendor search should use allowances
(defrecord BasicDetailsStep [linear-wizard]
mm/ModalWizardStep
(step-name [_]
@@ -482,7 +481,8 @@
hx/trigger-click-or-enter) "Add another")
(com/navigation-button {:class "w-48" :next-arrow? false
"@click" "$dispatch('modalclose') "
"@keyup.enter.stop" "$dispatch('modalclose')"} "Close")))
"@keyup.enter.stop" "$dispatch('modalclose')"}
"Close")))
:footer
nil
:validation-route ::route/new-wizard-navigate)))
@@ -494,7 +494,6 @@
:invoice/client (->db-id client)}))
(form-validation-error (str "Invoice '" invoice-number "' already exists."))))
;; TODO warn on account usage based on allowance
(defn assert-invoice-amounts-add-up [{:keys [:invoice/expense-accounts :invoice/total]}]
(let [expense-account-total (reduce + 0 (map (fn [x] (:invoice-expense-account/amount x)) expense-accounts))]
@@ -592,24 +591,10 @@
(exception->4xx #(assert-not-locked client-id (:invoice/date invoice)))
(let [transaction-result (audit-transact [transaction] (:identity request))]
(solr/touch-with-ledger (get-in transaction-result [:tempids "invoice"]))
(mm/render-navigate {:request (assoc-in request [:multi-form-state :snapshot :db/id] (get-in transaction-result [:tempids "invoice"]))
:to-step :next-steps})
#_(html-response
(@(resolve 'auto-ap.ssr.invoices/row*)
identity
(dc/pull (dc/db conn) default-read (get-in transaction-result [:tempids "invoice"]))
{:flash? true
:request request})
:headers {"hx-trigger" "modalclose"
"hx-retarget" "#entity-table tbody"
"hx-reswap" "afterbegin"
#_(format "#entity-table tr[data-id=\"%d\"]" (get-in transaction-result [:tempids "invoice"]))})))
#_(html-response [:div]
:headers {"hx-trigger" "modalclose,invalidated"})))
(assoc-in (mm/render-navigate {:request (assoc-in request [:multi-form-state :snapshot :db/id] (get-in transaction-result [:tempids "invoice"]))
:to-step :next-steps
})
[:headers "hx-trigger"] "invalidated")))))
@@ -676,6 +661,7 @@
[: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
:color :secondary
;;:x-data (hx/json {})
:class "w-24"
:hx-put (hu/url (bidi/path-for ssr-routes/only-routes ::route/new-wizard-navigate)