Tweaks for editing invoices
This commit is contained in:
@@ -39,58 +39,58 @@
|
|||||||
|
|
||||||
(defn typeahead- [params]
|
(defn typeahead- [params]
|
||||||
[:div.relative {:x-data (hx/json {:open false
|
[:div.relative {:x-data (hx/json {:open false
|
||||||
:baseUrl (if (str/includes? (:url params) "?")
|
:baseUrl (if (str/includes? (:url params) "?")
|
||||||
(str (:url params) "&q=")
|
(str (:url params) "&q=")
|
||||||
(str (:url params) "?q="))
|
(str (:url params) "?q="))
|
||||||
:value {:value ((:value-fn params identity) (:value params)) :label ((:content-fn params identity) (:value params))}
|
:value {:value ((:value-fn params identity) (:value params)) :label ((:content-fn params identity) (:value params))}
|
||||||
:search ""
|
:search ""
|
||||||
:active -1
|
:active -1
|
||||||
:elements (if ((:value-fn params identity) (:value params))
|
:elements (if ((:value-fn params identity) (:value params))
|
||||||
[{:value ((:value-fn params identity) (:value params)) :label ((:content-fn params identity) (:value params))}]
|
[{:value ((:value-fn params identity) (:value params)) :label ((:content-fn params identity) (:value params))}]
|
||||||
[])
|
[])
|
||||||
:popper nil
|
:popper nil
|
||||||
:warning_badge nil})
|
:warning_badge nil})
|
||||||
:x-modelable "value.value"
|
:x-modelable "value.value"
|
||||||
:x-model (:x-model params)
|
:x-model (:x-model params)
|
||||||
:x-init "popper = Popper.createPopper($refs.input, $refs.dropdown, {placement: 'bottom-start', strategy: 'fixed', modifiers: {name: 'offset', options: {offset: [0, 10]}}})
|
:x-init "popper = Popper.createPopper($refs.input, $refs.dropdown, {placement: 'bottom-start', strategy: 'fixed', modifiers: {name: 'offset', options: {offset: [0, 10]}}})
|
||||||
warning_badge = Popper.createPopper($refs.warning_badge, $refs.warning_pop, {placement: 'top', strategy: 'fixed', modifiers: {name: 'offset', options: {offset: [10,0 ]}}})"
|
warning_badge = Popper.createPopper($refs.warning_badge, $refs.warning_pop, {placement: 'top', strategy: 'fixed', modifiers: {name: 'offset', options: {offset: [10,0 ]}}})"}
|
||||||
}
|
(if (:disabled params)
|
||||||
[:a {:class (-> (hh/add-class (or (:class params) "") default-input-classes)
|
[:span {:x-text "value.label"}]
|
||||||
(hh/add-class "cursor-pointer"))
|
[:a {:class (-> (hh/add-class (or (:class params) "") default-input-classes)
|
||||||
"@click.prevent" "open = !open; popper.update()"
|
(hh/add-class "cursor-pointer"))
|
||||||
"@keydown.down.prevent.stop" "open = true; popper.update()"
|
"@click.prevent" "open = !open; popper.update()"
|
||||||
"@keydown.backspace" "value = {value: '', label: '' }"
|
"@keydown.down.prevent.stop" "open = true; popper.update()"
|
||||||
:tabindex 0
|
"@keydown.backspace" "value = {value: '', label: '' }"
|
||||||
:x-init (:x-init params)
|
:tabindex 0
|
||||||
:x-ref "input"
|
:x-init (:x-init params)
|
||||||
}
|
:x-ref "input"}
|
||||||
[:input (-> params
|
[:input (-> params
|
||||||
(dissoc :class)
|
(dissoc :class)
|
||||||
(dissoc :value-fn)
|
(dissoc :value-fn)
|
||||||
(dissoc :content-fn)
|
(dissoc :content-fn)
|
||||||
|
|
||||||
(dissoc :placeholder)
|
(dissoc :placeholder)
|
||||||
(dissoc :x-model)
|
(dissoc :x-model)
|
||||||
(assoc
|
|
||||||
"x-ref" "hidden"
|
(assoc
|
||||||
:type "hidden"
|
"x-ref" "hidden"
|
||||||
":value" "value.value"
|
:type "hidden"
|
||||||
:x-init (hiccup/raw (str "$watch('value', v => $dispatch('change')); "))))]
|
":value" "value.value"
|
||||||
[:div.flex.w-full.justify-items-stretch
|
:x-init (hiccup/raw (str "$watch('value', v => $dispatch('change')); "))))]
|
||||||
[:span.flex-grow.text-left {"x-text" "value.label"}]
|
[:div.flex.w-full.justify-items-stretch
|
||||||
[:div {:class "w-3 h-3 m-1 inline ml-1 justify-self-end text-gray-500 self-center"}
|
[:span.flex-grow.text-left {"x-text" "value.label"}]
|
||||||
svg/drop-down]
|
[:div {:class "w-3 h-3 m-1 inline ml-1 justify-self-end text-gray-500 self-center"}
|
||||||
[:div {:x-show "value.warning"
|
svg/drop-down]
|
||||||
:x-ref "warning_badge"
|
[:div {:x-show "value.warning"
|
||||||
:x-effect "if (value.warning) { $nextTick(()=> warning_badge.update()) }"}
|
:x-ref "warning_badge"
|
||||||
(tags/badge- {:class "peer"} "!")
|
:x-effect "if (value.warning) { $nextTick(()=> warning_badge.update()) }"}
|
||||||
|
(tags/badge- {:class "peer"} "!")
|
||||||
|
|
||||||
|
|
||||||
[:div {:x-show "value.warning"
|
[:div {:x-show "value.warning"
|
||||||
:x-ref "warning_pop"
|
:x-ref "warning_pop"
|
||||||
:class "hidden peer-hover:block bg-red-50 dark:bg-gray-600 rounded-lg shadow-2xl w-max z-50 p-4"
|
:class "hidden peer-hover:block bg-red-50 dark:bg-gray-600 rounded-lg shadow-2xl w-max z-50 p-4"
|
||||||
:x-text "value.warning"}
|
:x-text "value.warning"}]]]])
|
||||||
]]]]
|
|
||||||
|
|
||||||
[:ul.dropdown-contents {:class "bg-gray-100 dark:bg-gray-600 rounded-lg shadow-2xl w-max z-50 ring-1"
|
[:ul.dropdown-contents {:class "bg-gray-100 dark:bg-gray-600 rounded-lg shadow-2xl w-max z-50 ring-1"
|
||||||
"x-ref" "dropdown"
|
"x-ref" "dropdown"
|
||||||
@@ -104,12 +104,12 @@
|
|||||||
"x-show " "open"
|
"x-show " "open"
|
||||||
"x-trap" "open"
|
"x-trap" "open"
|
||||||
"@click.outside" "open=false;"}
|
"@click.outside" "open=false;"}
|
||||||
|
|
||||||
[:input {:type "text"
|
[:input {:type "text"
|
||||||
:class (-> (:class params)
|
:class (-> (:class params)
|
||||||
(or "")
|
(or "")
|
||||||
(hh/add-class default-input-classes)
|
(hh/add-class default-input-classes)
|
||||||
(hh/replace-wildcard ["rounded" "border"] "border-bottom bg-gray-100 rounded-t-lg w-full"))
|
(hh/replace-wildcard ["rounded" "border"] "border-bottom bg-gray-100 rounded-t-lg w-full"))
|
||||||
"x-model" "search"
|
"x-model" "search"
|
||||||
"placeholder" (:placeholder params)
|
"placeholder" (:placeholder params)
|
||||||
"@keydown.down.prevent" "active ++; active = active >= elements.length - 1 ? elements.length - 1 : active"
|
"@keydown.down.prevent" "active ++; active = active >= elements.length - 1 ? elements.length - 1 : active"
|
||||||
@@ -127,8 +127,7 @@
|
|||||||
"x-html" "element.label"}]]]
|
"x-html" "element.label"}]]]
|
||||||
[:template {:x-if "elements.length == 0"}
|
[:template {:x-if "elements.length == 0"}
|
||||||
[:li {:class "px-4 py-2 flex gap-2 items-center outline-0 focus:bg-neutral-100 hover:bg-neutral-100 whitespace-nowrap [&.active]:bg-primary-500 text-gray-800 dark:text-gray-100 text-xs "}
|
[:li {:class "px-4 py-2 flex gap-2 items-center outline-0 focus:bg-neutral-100 hover:bg-neutral-100 whitespace-nowrap [&.active]:bg-primary-500 text-gray-800 dark:text-gray-100 text-xs "}
|
||||||
"No results found"]]]
|
"No results found"]]]]])
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
(defn use-size [size]
|
(defn use-size [size]
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
(:require [auto-ap.datomic
|
(:require [auto-ap.datomic
|
||||||
:refer [audit-transact conn pull-attr]]
|
:refer [audit-transact conn pull-attr]]
|
||||||
[auto-ap.datomic.accounts :as d-accounts]
|
[auto-ap.datomic.accounts :as d-accounts]
|
||||||
|
[auto-ap.ssr.invoice.common :refer [default-read]]
|
||||||
[auto-ap.datomic.invoices :as d-invoices]
|
[auto-ap.datomic.invoices :as d-invoices]
|
||||||
[auto-ap.graphql.utils :refer [assert-can-see-client
|
[auto-ap.graphql.utils :refer [assert-can-see-client
|
||||||
assert-not-locked exception->4xx]]
|
assert-not-locked exception->4xx]]
|
||||||
[auto-ap.logging :as alog]
|
|
||||||
[auto-ap.routes.invoice :as route]
|
[auto-ap.routes.invoice :as route]
|
||||||
[auto-ap.routes.utils
|
[auto-ap.routes.utils
|
||||||
:refer [wrap-client-redirect-unauthenticated]]
|
:refer [wrap-client-redirect-unauthenticated]]
|
||||||
@@ -22,7 +22,6 @@
|
|||||||
[auto-ap.ssr.utils
|
[auto-ap.ssr.utils
|
||||||
:refer [->db-id apply-middleware-to-all-handlers clj-date-schema
|
:refer [->db-id apply-middleware-to-all-handlers clj-date-schema
|
||||||
entity-id form-validation-error html-response money strip
|
entity-id form-validation-error html-response money strip
|
||||||
->OOBElements
|
|
||||||
wrap-schema-enforce]]
|
wrap-schema-enforce]]
|
||||||
[auto-ap.time :as atime]
|
[auto-ap.time :as atime]
|
||||||
[bidi.bidi :as bidi]
|
[bidi.bidi :as bidi]
|
||||||
@@ -70,10 +69,15 @@
|
|||||||
(defn check-vendor-default-account [vendor-id]
|
(defn check-vendor-default-account [vendor-id]
|
||||||
(some? (:vendor/default-account (get-vendor vendor-id))))
|
(some? (:vendor/default-account (get-vendor vendor-id))))
|
||||||
|
|
||||||
|
;; TODO negative expense accounts for negative invoices?
|
||||||
|
;; TODO make changing expense accounts work for editing invoices
|
||||||
|
;; TODO make a change of total automatically change the expense accounts when editing
|
||||||
|
;; TODO just close when editing, don't go to print screen
|
||||||
|
|
||||||
|
|
||||||
(def new-form-schema
|
(def new-form-schema
|
||||||
[:map
|
[:map
|
||||||
|
[:db/id {:optional true} [:maybe entity-id]]
|
||||||
[:customize-due-and-scheduled? {:optional true :default false :decode/arbitrary (fn [x] (if (= "" x)
|
[:customize-due-and-scheduled? {:optional true :default false :decode/arbitrary (fn [x] (if (= "" x)
|
||||||
false
|
false
|
||||||
x))} [:maybe :boolean]]
|
x))} [:maybe :boolean]]
|
||||||
@@ -81,10 +85,11 @@
|
|||||||
[:invoice/date clj-date-schema]
|
[:invoice/date clj-date-schema]
|
||||||
[:invoice/due {:optional true} [:maybe clj-date-schema]]
|
[:invoice/due {:optional true} [:maybe clj-date-schema]]
|
||||||
[:invoice/scheduled-payment {:optional true} [:maybe clj-date-schema]]
|
[:invoice/scheduled-payment {:optional true} [:maybe clj-date-schema]]
|
||||||
[:invoice/vendor [:and entity-id
|
[:invoice/vendor {:optional true}
|
||||||
[:fn {:error/message "Vendor is missing default expense account"}
|
[:and entity-id
|
||||||
check-vendor-default-account]]]
|
[:fn {:error/message "Vendor is missing default expense account"}
|
||||||
[:invoice/invoice-number [:string {:min 1 :decode/string strip}]]
|
check-vendor-default-account]]]
|
||||||
|
[:invoice/invoice-number {:optional true} [:string {:min 1 :decode/string strip}]]
|
||||||
[:invoice/total money]
|
[:invoice/total money]
|
||||||
[:invoice/expense-accounts
|
[:invoice/expense-accounts
|
||||||
[:vector {:coerce? true}
|
[:vector {:coerce? true}
|
||||||
@@ -98,6 +103,15 @@
|
|||||||
[:fn {:error/fn (fn [r x] (:type r))
|
[:fn {:error/fn (fn [r x] (:type r))
|
||||||
:error/path [:invoice-expense-account/location]} check-invoice-expense-account-location]]]]])
|
:error/path [:invoice-expense-account/location]} check-invoice-expense-account-location]]]]])
|
||||||
|
|
||||||
|
(defn wrap-schema [s]
|
||||||
|
[:and s
|
||||||
|
[:fn (fn [{:keys [:db/id :invoice/invoice-number :invoice/vendor] :as z}]
|
||||||
|
(println "HERE" id invoice-number vendor z)
|
||||||
|
(if id
|
||||||
|
true
|
||||||
|
(and invoice-number vendor)))]])
|
||||||
|
|
||||||
|
|
||||||
(defn clientize-vendor [{:vendor/keys [terms-overrides automatically-paid-when-due default-account account-overrides] :as vendor} client-id]
|
(defn clientize-vendor [{:vendor/keys [terms-overrides automatically-paid-when-due default-account account-overrides] :as vendor} client-id]
|
||||||
(let [terms-override (->> terms-overrides
|
(let [terms-override (->> terms-overrides
|
||||||
(filter (fn [to]
|
(filter (fn [to]
|
||||||
@@ -139,7 +153,7 @@
|
|||||||
[])
|
[])
|
||||||
|
|
||||||
(step-schema [_]
|
(step-schema [_]
|
||||||
(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?}))
|
(wrap-schema (mut/select-keys (mm/form-schema linear-wizard) #{:invoice/client :invoice/vendor :invoice/date :invoice/due :invoice/scheduled-payment :invoice/total :invoice/invoice-number :db/id :customize-due-and-scheduled?})))
|
||||||
|
|
||||||
(render-step [this request]
|
(render-step [this request]
|
||||||
(mm/default-render-step
|
(mm/default-render-step
|
||||||
@@ -157,6 +171,12 @@
|
|||||||
:scheduledPayment (some-> (fc/field-value (:invoice/scheduled-payment fc/*current*))
|
:scheduledPayment (some-> (fc/field-value (:invoice/scheduled-payment fc/*current*))
|
||||||
(atime/unparse-local atime/normal-date))
|
(atime/unparse-local atime/normal-date))
|
||||||
:customizeDueAndScheduled (fc/field-value (:customize-due-and-scheduled? fc/*current*))})}
|
:customizeDueAndScheduled (fc/field-value (:customize-due-and-scheduled? fc/*current*))})}
|
||||||
|
(fc/with-field :db/id
|
||||||
|
(when (fc/field-value)
|
||||||
|
(com/hidden {:name (fc/field-name)
|
||||||
|
:value (fc/field-value)})))
|
||||||
|
|
||||||
|
|
||||||
(fc/with-field :customize-due-and-scheduled?
|
(fc/with-field :customize-due-and-scheduled?
|
||||||
(com/hidden {:name (fc/field-name)
|
(com/hidden {:name (fc/field-name)
|
||||||
:value (fc/field-value)
|
:value (fc/field-value)
|
||||||
@@ -184,6 +204,7 @@
|
|||||||
[:div.w-96
|
[:div.w-96
|
||||||
(com/typeahead {:name (fc/field-name)
|
(com/typeahead {:name (fc/field-name)
|
||||||
:error? (fc/error?)
|
:error? (fc/error?)
|
||||||
|
:disabled (boolean (-> request :multi-form-state :snapshot :db/id))
|
||||||
:class "w-96"
|
:class "w-96"
|
||||||
:placeholder "Search..."
|
:placeholder "Search..."
|
||||||
:url (bidi/path-for ssr-routes/only-routes :vendor-search)
|
:url (bidi/path-for ssr-routes/only-routes :vendor-search)
|
||||||
@@ -254,6 +275,7 @@
|
|||||||
:errors (fc/field-errors)}
|
:errors (fc/field-errors)}
|
||||||
[:div {:class "w-24"}
|
[:div {:class "w-24"}
|
||||||
(com/text-input {:value (-> (fc/field-value))
|
(com/text-input {:value (-> (fc/field-value))
|
||||||
|
:disabled (boolean (-> request :multi-form-state :snapshot :db/id))
|
||||||
:name (fc/field-name)
|
:name (fc/field-name)
|
||||||
:error? (fc/field-errors)
|
:error? (fc/field-errors)
|
||||||
:placeholder "HA-123"})]))
|
:placeholder "HA-123"})]))
|
||||||
@@ -302,7 +324,7 @@
|
|||||||
[:div.flex.flex-col
|
[:div.flex.flex-col
|
||||||
(com/typeahead {:name name
|
(com/typeahead {:name name
|
||||||
:placeholder "Search..."
|
:placeholder "Search..."
|
||||||
:url (hu/url (bidi/path-for ssr-routes/only-routes :account-search)
|
:url (hu/url (bidi/path-for ssr-routes/only-routes :account-search)
|
||||||
{:client-id client-id
|
{:client-id client-id
|
||||||
:purpose "invoice"})
|
:purpose "invoice"})
|
||||||
:id name
|
:id name
|
||||||
@@ -468,7 +490,7 @@
|
|||||||
:body (mm/default-step-body
|
:body (mm/default-step-body
|
||||||
{}
|
{}
|
||||||
[:p.text-lg "Would you like to pay this invoice now?"]
|
[:p.text-lg "Would you like to pay this invoice now?"]
|
||||||
|
|
||||||
(com/navigation-button-list {}
|
(com/navigation-button-list {}
|
||||||
(com/navigation-button (-> {:class "w-48"
|
(com/navigation-button (-> {:class "w-48"
|
||||||
:hx-get (hu/url (bidi.bidi/path-for ssr-routes/only-routes ::route/pay-wizard)
|
:hx-get (hu/url (bidi.bidi/path-for ssr-routes/only-routes ::route/pay-wizard)
|
||||||
@@ -481,7 +503,7 @@
|
|||||||
hx/trigger-click-or-enter) "Add another")
|
hx/trigger-click-or-enter) "Add another")
|
||||||
(com/navigation-button {:class "w-48" :next-arrow? false
|
(com/navigation-button {:class "w-48" :next-arrow? false
|
||||||
"@click" "$dispatch('modalclose') "
|
"@click" "$dispatch('modalclose') "
|
||||||
"@keyup.enter.stop" "$dispatch('modalclose')"}
|
"@keyup.enter.stop" "$dispatch('modalclose')"}
|
||||||
"Close")))
|
"Close")))
|
||||||
:footer
|
:footer
|
||||||
nil
|
nil
|
||||||
@@ -561,15 +583,16 @@
|
|||||||
:accounts (->AccountsStep this)
|
:accounts (->AccountsStep this)
|
||||||
:next-steps (->NextSteps this)}
|
:next-steps (->NextSteps this)}
|
||||||
step-key)))
|
step-key)))
|
||||||
(form-schema [_] new-form-schema)
|
(form-schema [_]
|
||||||
|
new-form-schema)
|
||||||
(submit [this {:keys [multi-form-state request-method identity] :as request}]
|
(submit [this {:keys [multi-form-state request-method identity] :as request}]
|
||||||
(let [invoice (:snapshot multi-form-state)
|
(let [invoice (:snapshot multi-form-state)
|
||||||
client-id (->db-id (:invoice/client invoice))
|
client-id (->db-id (:invoice/client invoice))
|
||||||
vendor-id (->db-id (:invoice/vendor invoice))
|
vendor-id (->db-id (:invoice/vendor invoice))
|
||||||
transaction [:upsert-invoice (-> multi-form-state
|
transaction [:upsert-invoice (-> multi-form-state
|
||||||
:snapshot
|
:snapshot
|
||||||
(assoc :db/id "invoice")
|
(assoc :db/id (or (:db/id invoice) "invoice"))
|
||||||
(dissoc :customize-due-and-scheduled?)
|
(dissoc :customize-due-and-scheduled? :invoice/journal-entry :invoice/payments)
|
||||||
(assoc :invoice/expense-accounts (if-let [ieas (seq (-> multi-form-state :snapshot :invoice/expense-accounts))]
|
(assoc :invoice/expense-accounts (if-let [ieas (seq (-> multi-form-state :snapshot :invoice/expense-accounts))]
|
||||||
ieas
|
ieas
|
||||||
[{:db/id "123"
|
[{:db/id "123"
|
||||||
@@ -585,15 +608,15 @@
|
|||||||
(update :invoice/date coerce/to-date)
|
(update :invoice/date coerce/to-date)
|
||||||
(update :invoice/due coerce/to-date))]]
|
(update :invoice/due coerce/to-date))]]
|
||||||
(assert-invoice-amounts-add-up (second transaction))
|
(assert-invoice-amounts-add-up (second transaction))
|
||||||
(assert-no-conflicting invoice)
|
(when-not (:db/id invoice)
|
||||||
|
(assert-no-conflicting invoice))
|
||||||
(exception->4xx #(assert-can-see-client (:identity request) client-id))
|
(exception->4xx #(assert-can-see-client (:identity request) client-id))
|
||||||
|
|
||||||
(exception->4xx #(assert-not-locked client-id (:invoice/date invoice)))
|
(exception->4xx #(assert-not-locked client-id (:invoice/date invoice)))
|
||||||
(let [transaction-result (audit-transact [transaction] (:identity request))]
|
(let [transaction-result (audit-transact [transaction] (:identity request))]
|
||||||
(solr/touch-with-ledger (get-in transaction-result [:tempids "invoice"]))
|
(solr/touch-with-ledger (get-in transaction-result [:tempids "invoice"]))
|
||||||
(assoc-in (mm/render-navigate {:request (assoc-in request [:multi-form-state :snapshot :db/id] (get-in transaction-result [:tempids "invoice"]))
|
(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
|
:to-step :next-steps})
|
||||||
})
|
|
||||||
[:headers "hx-trigger"] "invalidated")))))
|
[:headers "hx-trigger"] "invalidated")))))
|
||||||
|
|
||||||
(def new-wizard (->NewWizard2 nil nil))
|
(def new-wizard (->NewWizard2 nil nil))
|
||||||
@@ -604,6 +627,17 @@
|
|||||||
[]
|
[]
|
||||||
{:invoice/date (time/now)}))
|
{:invoice/date (time/now)}))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(defn initial-edit-wizard-state [request]
|
||||||
|
(let [entity (dc/pull (dc/db conn) default-read (:db/id (:route-params request)))
|
||||||
|
entity (select-keys entity (mut/keys new-form-schema))]
|
||||||
|
|
||||||
|
(mm/->MultiStepFormState entity
|
||||||
|
[]
|
||||||
|
entity)))
|
||||||
|
|
||||||
(defn location-select [{{:keys [name account-id client-id value] :as qp} :query-params}]
|
(defn location-select [{{:keys [name account-id client-id value] :as qp} :query-params}]
|
||||||
(html-response (location-select* {:name name
|
(html-response (location-select* {:name name
|
||||||
:value value
|
:value value
|
||||||
@@ -676,6 +710,10 @@
|
|||||||
{::route/new-wizard (-> mm/open-wizard-handler
|
{::route/new-wizard (-> mm/open-wizard-handler
|
||||||
(mm/wrap-wizard new-wizard)
|
(mm/wrap-wizard new-wizard)
|
||||||
(mm/wrap-init-multi-form-state initial-new-wizard-state))
|
(mm/wrap-init-multi-form-state initial-new-wizard-state))
|
||||||
|
::route/edit-wizard (-> mm/open-wizard-handler
|
||||||
|
(mm/wrap-wizard new-wizard)
|
||||||
|
(mm/wrap-init-multi-form-state initial-edit-wizard-state)
|
||||||
|
(wrap-schema-enforce :route-schema [:map [:db/id entity-id]]))
|
||||||
::route/due-date (-> due-date
|
::route/due-date (-> due-date
|
||||||
(mm/wrap-wizard new-wizard)
|
(mm/wrap-wizard new-wizard)
|
||||||
(mm/wrap-decode-multi-form-state)
|
(mm/wrap-decode-multi-form-state)
|
||||||
|
|||||||
@@ -407,7 +407,11 @@
|
|||||||
::route/delete
|
::route/delete
|
||||||
:db/id (:db/id entity))
|
:db/id (:db/id entity))
|
||||||
:hx-confirm "Are you sure you want to void this invoice?"}
|
:hx-confirm "Are you sure you want to void this invoice?"}
|
||||||
svg/trash))])
|
svg/trash))
|
||||||
|
(com/icon-button {:hx-put (bidi/path-for ssr-routes/only-routes
|
||||||
|
::route/edit-wizard
|
||||||
|
:db/id (:db/id entity)) }
|
||||||
|
svg/pencil)])
|
||||||
:breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes ::route/page)}
|
:breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes ::route/page)}
|
||||||
"Invoices"]]
|
"Invoices"]]
|
||||||
:title (fn [r]
|
:title (fn [r]
|
||||||
|
|||||||
@@ -12,13 +12,15 @@
|
|||||||
"/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}
|
||||||
|
|
||||||
"/pay-button" ::pay-button
|
"/pay-button" ::pay-button
|
||||||
"/pay" {:get ::pay-wizard
|
"/pay" {:get ::pay-wizard
|
||||||
"/navigate" ::pay-wizard-navigate
|
"/navigate" ::pay-wizard-navigate
|
||||||
:post ::pay-submit}
|
:post ::pay-submit}
|
||||||
"/bulk-delete" {:get ::bulk-delete
|
"/bulk-delete" {:get ::bulk-delete
|
||||||
:delete ::bulk-delete-confirm}
|
:delete ::bulk-delete-confirm}
|
||||||
["/" [#"\d+" :db/id]] {:delete ::delete}
|
["/" [#"\d+" :db/id]] {:delete ::delete
|
||||||
|
"/edit" ::edit-wizard}
|
||||||
"/table" ::table
|
"/table" ::table
|
||||||
|
|
||||||
"/glimpse" {"" {:get :invoice-glimpse
|
"/glimpse" {"" {:get :invoice-glimpse
|
||||||
|
|||||||
Reference in New Issue
Block a user