Compare commits
3 Commits
ec4f88b7fc
...
f9438ba983
| Author | SHA1 | Date | |
|---|---|---|---|
| f9438ba983 | |||
| 7d34b8a5f6 | |||
| c09d85ede6 |
@@ -28,7 +28,7 @@
|
|||||||
(com/data-grid-header {} "Synced count")
|
(com/data-grid-header {} "Synced count")
|
||||||
(com/data-grid-header {} "Approved transactions")
|
(com/data-grid-header {} "Approved transactions")
|
||||||
(com/data-grid-header {} "Unapproved transactions")
|
(com/data-grid-header {} "Unapproved transactions")
|
||||||
(com/data-grid-header {} "Requires feedback transactions")
|
(com/data-grid-header {} "Client Review transactions")
|
||||||
(com/data-grid-header {} "Missing transactions")])
|
(com/data-grid-header {} "Missing transactions")])
|
||||||
#_#_:thead-params {:class "sticky top-0 z-50"}}
|
#_#_:thead-params {:class "sticky top-0 z-50"}}
|
||||||
(for [row report]
|
(for [row report]
|
||||||
|
|||||||
@@ -138,6 +138,33 @@
|
|||||||
[:div.space-y-1 {}
|
[:div.space-y-1 {}
|
||||||
children])
|
children])
|
||||||
|
|
||||||
|
(defn flatten-form-errors
|
||||||
|
"Walks a malli-humanized error structure and returns a flat sequence of
|
||||||
|
human-readable strings, prefixing each leaf message with the nearest
|
||||||
|
field name for context. Lets the footer's error bar surface every
|
||||||
|
validation error for the whole form, even ones whose field lives on a
|
||||||
|
hidden step/tab and so would otherwise be invisible."
|
||||||
|
([errors] (flatten-form-errors nil errors))
|
||||||
|
([field errors]
|
||||||
|
(let [label (cond (keyword? field) (name field)
|
||||||
|
(string? field) field
|
||||||
|
:else nil)
|
||||||
|
decorate (fn [msg] (if label (str label ": " msg) msg))]
|
||||||
|
(cond
|
||||||
|
(map? errors)
|
||||||
|
(mapcat (fn [[k v]] (flatten-form-errors k v)) errors)
|
||||||
|
|
||||||
|
(and (sequential? errors) (every? string? errors))
|
||||||
|
(map decorate errors)
|
||||||
|
|
||||||
|
(sequential? errors)
|
||||||
|
(mapcat #(flatten-form-errors field %) errors)
|
||||||
|
|
||||||
|
(string? errors)
|
||||||
|
[(decorate errors)]
|
||||||
|
|
||||||
|
:else nil))))
|
||||||
|
|
||||||
(defn default-step-footer [linear-wizard step & {:keys [validation-route
|
(defn default-step-footer [linear-wizard step & {:keys [validation-route
|
||||||
discard-button
|
discard-button
|
||||||
next-button
|
next-button
|
||||||
@@ -146,7 +173,8 @@
|
|||||||
[:div.flex.items-baseline.gap-x-4
|
[:div.flex.items-baseline.gap-x-4
|
||||||
(let [step-errors (:step-params fc/*form-errors*)]
|
(let [step-errors (:step-params fc/*form-errors*)]
|
||||||
(com/form-errors {:errors (or (:errors step-errors)
|
(com/form-errors {:errors (or (:errors step-errors)
|
||||||
(when (sequential? step-errors) step-errors))}))
|
(when (sequential? step-errors) step-errors)
|
||||||
|
(seq (distinct (flatten-form-errors step-errors))))}))
|
||||||
(when (not= (first (steps linear-wizard))
|
(when (not= (first (steps linear-wizard))
|
||||||
(step-key step))
|
(step-key step))
|
||||||
(when validation-route
|
(when validation-route
|
||||||
|
|||||||
@@ -206,7 +206,7 @@
|
|||||||
["approved" "Approved"]
|
["approved" "Approved"]
|
||||||
["unapproved" "Unapproved"]
|
["unapproved" "Unapproved"]
|
||||||
["suppressed" "Suppressed"]
|
["suppressed" "Suppressed"]
|
||||||
["requires_feedback" "Requires Feedback"]]})))]
|
["requires-feedback" "Client Review"]]})))]
|
||||||
|
|
||||||
;; Accounts section
|
;; Accounts section
|
||||||
[:div.col-span-2.pt-4
|
[:div.col-span-2.pt-4
|
||||||
|
|||||||
@@ -72,17 +72,11 @@
|
|||||||
(or (not= approval-status :transaction-approval-status/approved)
|
(or (not= approval-status :transaction-approval-status/approved)
|
||||||
(seq accounts)))]])
|
(seq accounts)))]])
|
||||||
|
|
||||||
(def edit-form-schema
|
(def account-coding-schema
|
||||||
(mc/schema
|
"Validation for manually-coded transaction account rows. Applied only for
|
||||||
[:and
|
the :manual action: link / apply-rule actions build their own accounts
|
||||||
[:map
|
server-side, so the (often blank) account row carried along by the manual
|
||||||
[:db/id {:optional true} [:maybe entity-id]]
|
tab must not be required when one of those actions is submitted."
|
||||||
[:action [:enum :apply-rule :unlink-payment :link-unpaid-invoices :link-autopay-invoices :link-payment :manual]]
|
|
||||||
[:transaction/memo {:optional true} [:maybe [:string {:decode/string strip}]]]
|
|
||||||
[:transaction/vendor {:optional true} [:maybe entity-id]]
|
|
||||||
[:transaction/approval-status {:optional true} [:maybe (ref->enum-schema "transaction-approval-status")]]
|
|
||||||
[:amount-mode {:optional true} [:maybe [:enum "$" "%"]]]
|
|
||||||
[:transaction/accounts {:optional true}
|
|
||||||
[:maybe
|
[:maybe
|
||||||
[:vector {:coerce? true}
|
[:vector {:coerce? true}
|
||||||
[:and
|
[:and
|
||||||
@@ -97,7 +91,18 @@
|
|||||||
:error/path [:transaction-account/location]}
|
:error/path [:transaction-account/location]}
|
||||||
(fn [iea]
|
(fn [iea]
|
||||||
(check-location-belongs (:transaction-account/location iea)
|
(check-location-belongs (:transaction-account/location iea)
|
||||||
(:transaction-account/account iea)))]]]]]]
|
(:transaction-account/account iea)))]]]])
|
||||||
|
|
||||||
|
(def edit-form-schema
|
||||||
|
(mc/schema
|
||||||
|
[:and
|
||||||
|
[:map
|
||||||
|
[:db/id {:optional true} [:maybe entity-id]]
|
||||||
|
[:action [:enum :apply-rule :unlink-payment :link-unpaid-invoices :link-autopay-invoices :link-payment :manual]]
|
||||||
|
[:transaction/memo {:optional true} [:maybe [:string {:decode/string strip}]]]
|
||||||
|
[:transaction/vendor {:optional true} [:maybe entity-id]]
|
||||||
|
[:transaction/approval-status {:optional true} [:maybe (ref->enum-schema "transaction-approval-status")]]
|
||||||
|
[:amount-mode {:optional true} [:maybe [:enum "$" "%"]]]]
|
||||||
[:multi {:dispatch :action}
|
[:multi {:dispatch :action}
|
||||||
[:apply-rule [:map
|
[:apply-rule [:map
|
||||||
[:rule-id {:optional true} [:maybe entity-id]]]]
|
[:rule-id {:optional true} [:maybe entity-id]]]]
|
||||||
@@ -110,7 +115,8 @@
|
|||||||
[:autopay-invoice-ids {:decode/string (fn [x] (edn/read-string x))} [:vector {:coerce? true} entity-id]]]]
|
[:autopay-invoice-ids {:decode/string (fn [x] (edn/read-string x))} [:vector {:coerce? true} entity-id]]]]
|
||||||
[:link-payment [:map
|
[:link-payment [:map
|
||||||
[:payment-id entity-id]]]
|
[:payment-id entity-id]]]
|
||||||
[:manual (require-approval [:map])]]]))
|
[:manual (require-approval [:map
|
||||||
|
[:transaction/accounts {:optional true} account-coding-schema]])]]]))
|
||||||
|
|
||||||
(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]
|
||||||
(if (nil? vendor)
|
(if (nil? vendor)
|
||||||
|
|||||||
@@ -211,7 +211,7 @@
|
|||||||
(com/data-grid-cell {} (fc/with-field :description-original
|
(com/data-grid-cell {} (fc/with-field :description-original
|
||||||
(com/text-input {:value (fc/field-value) :name (fc/field-name)})))
|
(com/text-input {:value (fc/field-value) :name (fc/field-name)})))
|
||||||
(com/data-grid-cell {} (fc/with-field :amount
|
(com/data-grid-cell {} (fc/with-field :amount
|
||||||
(com/money-input {:value (fc/field-value) :name (fc/field-name) :class "w-28"})))
|
(com/text-input {:value (fc/field-value) :name (fc/field-name) :class "w-28 text-right" :inputmode "decimal"})))
|
||||||
(com/data-grid-cell {} (fc/with-field :bank-account-code
|
(com/data-grid-cell {} (fc/with-field :bank-account-code
|
||||||
(com/text-input {:value (fc/field-value) :name (fc/field-name) :class "w-28"})))
|
(com/text-input {:value (fc/field-value) :name (fc/field-name) :class "w-28"})))
|
||||||
(com/data-grid-cell {} (fc/with-field :client-code
|
(com/data-grid-cell {} (fc/with-field :client-code
|
||||||
|
|||||||
Reference in New Issue
Block a user