QOL items
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
(com/a-icon-button {:x-ref "link" "@click.prevent" "show=!show; $nextTick(() => popper.update());" :class "relative"}
|
(com/a-icon-button {:x-ref "link" "@click.prevent" "show=!show; $nextTick(() => popper.update());" :class "relative"}
|
||||||
svg/paperclip
|
svg/paperclip
|
||||||
(com/badge {} (count links)))
|
(com/badge {:color "blue"} (count links)))
|
||||||
[:div.divide-y.divide-gray-200.bg-white.rounded-lg.shadow.z-50 (hx/alpine-appear {:x-ref "tooltip" :x-show "show" :data-key "show"})
|
[:div.divide-y.divide-gray-200.bg-white.rounded-lg.shadow.z-50 (hx/alpine-appear {:x-ref "tooltip" :x-show "show" :data-key "show"})
|
||||||
[:div {:class "p-3 overflow-y-auto text-sm text-gray-700 dark:text-gray-200"}
|
[:div {:class "p-3 overflow-y-auto text-sm text-gray-700 dark:text-gray-200"}
|
||||||
[:div.flex.flex-col.gap-y-2
|
[:div.flex.flex-col.gap-y-2
|
||||||
|
|||||||
@@ -21,4 +21,9 @@
|
|||||||
children))
|
children))
|
||||||
|
|
||||||
(defn badge- [params & children]
|
(defn badge- [params & children]
|
||||||
[:div {:class (hh/add-class "absolute inline-flex items-center justify-center w-6 h-6 text-xs font-black text-white bg-red-300 border-3 border-white rounded-full -top-2 -right-2 dark:border-gray-900" (:class params))} children])
|
[:div {:class (-> (hh/add-class "absolute inline-flex items-center justify-center w-6 h-6 text-xs font-black text-white
|
||||||
|
border-3 border-white rounded-full -top-2 -right-2 dark:border-gray-900"
|
||||||
|
(:class params)
|
||||||
|
)
|
||||||
|
(hh/add-class (or (some-> (:color params) (#(str "bg-" % "-300")))
|
||||||
|
"bg-red-300")))} children])
|
||||||
|
|||||||
@@ -430,17 +430,36 @@
|
|||||||
(com/a-icon-button {"@click.prevent.stop" "show=false; setTimeout(() => $refs.p.remove(), 500)"} svg/x))))
|
(com/a-icon-button {"@click.prevent.stop" "show=false; setTimeout(() => $refs.p.remove(), 500)"} svg/x))))
|
||||||
|
|
||||||
(defn invoice-expense-account-total* [request]
|
(defn invoice-expense-account-total* [request]
|
||||||
(format "$%,.2f" (->> (-> request
|
(let [total (->> (-> request
|
||||||
:multi-form-state
|
:multi-form-state
|
||||||
:step-params
|
:step-params
|
||||||
:invoice/expense-accounts)
|
:invoice/expense-accounts)
|
||||||
(map (fnil :invoice-expense-account/amount 0.0))
|
(map (fnil :invoice-expense-account/amount 0.0))
|
||||||
(filter number?)
|
(filter number?)
|
||||||
(reduce + 0.0))))
|
(reduce + 0.0))]
|
||||||
|
(format "$%,.2f" total)))
|
||||||
|
|
||||||
|
(defn invoice-expense-account-balance* [request]
|
||||||
|
(let [total (->> (-> request
|
||||||
|
:multi-form-state
|
||||||
|
:step-params
|
||||||
|
:invoice/expense-accounts)
|
||||||
|
(map (fnil :invoice-expense-account/amount 0.0))
|
||||||
|
(filter number?)
|
||||||
|
(reduce + 0.0))
|
||||||
|
balance (-
|
||||||
|
(-> request :multi-form-state :snapshot :invoice/total)
|
||||||
|
total)]
|
||||||
|
[:span {:class (when-not (dollars= 0.0 balance)
|
||||||
|
"text-red-300")}
|
||||||
|
(format "$%,.2f" balance)]))
|
||||||
|
|
||||||
(defn invoice-expense-account-total [request]
|
(defn invoice-expense-account-total [request]
|
||||||
(html-response (invoice-expense-account-total* request)))
|
(html-response (invoice-expense-account-total* request)))
|
||||||
|
|
||||||
|
(defn invoice-expense-account-balance [request]
|
||||||
|
(html-response (invoice-expense-account-balance* request)))
|
||||||
|
|
||||||
(defrecord AccountsStep [linear-wizard]
|
(defrecord AccountsStep [linear-wizard]
|
||||||
mm/ModalWizardStep
|
mm/ModalWizardStep
|
||||||
(step-name [_]
|
(step-name [_]
|
||||||
@@ -490,6 +509,19 @@
|
|||||||
:hx-swap "innerHTML"}
|
:hx-swap "innerHTML"}
|
||||||
(invoice-expense-account-total* request))
|
(invoice-expense-account-total* request))
|
||||||
(com/data-grid-cell {}))
|
(com/data-grid-cell {}))
|
||||||
|
|
||||||
|
(com/data-grid-row {}
|
||||||
|
(com/data-grid-cell {})
|
||||||
|
(com/data-grid-cell {:class "text-right"} [:span.font-bold.text-right "BALANCE"])
|
||||||
|
(com/data-grid-cell {:id "total"
|
||||||
|
:class "text-right"
|
||||||
|
:hx-trigger "change from:closest form target:.amount-field"
|
||||||
|
:hx-put (bidi.bidi/path-for ssr-routes/only-routes ::route/expense-account-balance)
|
||||||
|
:hx-target "this"
|
||||||
|
:hx-swap "innerHTML"}
|
||||||
|
(invoice-expense-account-balance* request))
|
||||||
|
(com/data-grid-cell {}))
|
||||||
|
|
||||||
(com/data-grid-row {}
|
(com/data-grid-row {}
|
||||||
|
|
||||||
(com/data-grid-cell {})
|
(com/data-grid-cell {})
|
||||||
@@ -822,6 +854,9 @@
|
|||||||
::route/expense-account-total (-> invoice-expense-account-total
|
::route/expense-account-total (-> invoice-expense-account-total
|
||||||
(mm/wrap-wizard new-wizard)
|
(mm/wrap-wizard new-wizard)
|
||||||
(mm/wrap-decode-multi-form-state))
|
(mm/wrap-decode-multi-form-state))
|
||||||
|
::route/expense-account-balance (-> invoice-expense-account-balance
|
||||||
|
(mm/wrap-wizard new-wizard)
|
||||||
|
(mm/wrap-decode-multi-form-state))
|
||||||
::route/location-select (-> location-select
|
::route/location-select (-> location-select
|
||||||
(wrap-schema-enforce :query-schema [:map
|
(wrap-schema-enforce :query-schema [:map
|
||||||
[:name :string]
|
[:name :string]
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
"/account/new" ::new-wizard-new-account
|
"/account/new" ::new-wizard-new-account
|
||||||
"/account/location-select" ::location-select
|
"/account/location-select" ::location-select
|
||||||
"/account/prediction" ::account-prediction
|
"/account/prediction" ::account-prediction
|
||||||
"/total" ::expense-account-total}
|
"/total" ::expense-account-total
|
||||||
|
"/balance" ::expense-account-balance}
|
||||||
|
|
||||||
"/pay-button" ::pay-button
|
"/pay-button" ::pay-button
|
||||||
"/pay" {:get ::pay-wizard
|
"/pay" {:get ::pay-wizard
|
||||||
|
|||||||
Reference in New Issue
Block a user