progress on combinining everything
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -113,6 +113,10 @@
|
|||||||
(= :secondary (:color params)) (str " text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700")
|
(= :secondary (:color params)) (str " text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700")
|
||||||
(= :primary (:color params)) (str " text-white bg-green-500 hover:bg-green-600 focus:ring-green-300 dark:bg-green-600 dark:hover:bg-green-700 ")
|
(= :primary (:color params)) (str " text-white bg-green-500 hover:bg-green-600 focus:ring-green-300 dark:bg-green-600 dark:hover:bg-green-700 ")
|
||||||
(= :secondary-light (:color params)) (str " text-blue-800 bg-white-200 border-gray-100 border hover:bg-blue-100 focus:ring-blue-100 dark:bg-blue-400 dark:hover:bg-blue-800 ")
|
(= :secondary-light (:color params)) (str " text-blue-800 bg-white-200 border-gray-100 border hover:bg-blue-100 focus:ring-blue-100 dark:bg-blue-400 dark:hover:bg-blue-800 ")
|
||||||
|
|
||||||
|
(not (nil? (:color params)))
|
||||||
|
(str " text-white " (bg-colors (:color params) (:disabled params)))
|
||||||
|
|
||||||
(nil? (:color params))
|
(nil? (:color params))
|
||||||
(str " bg-white dark:bg-gray-600 border-gray-300 dark:border-gray-700 text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-100 font-medium border border-gray-300 dark:border-gray-700")))
|
(str " bg-white dark:bg-gray-600 border-gray-300 dark:border-gray-700 text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-100 font-medium border border-gray-300 dark:border-gray-700")))
|
||||||
(assoc :tabindex 0)
|
(assoc :tabindex 0)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
children))
|
children))
|
||||||
|
|
||||||
(defn badge- [params & children]
|
(defn badge- [params & children]
|
||||||
[:div (merge params {:class (-> (hh/add-class "absolute inline-flex items-center justify-center w-6 h-6 text-xs font-black text-white
|
[:div (merge params {:class (-> (hh/add-class "absolute inline-flex items-center z-10 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"
|
border-3 border-white rounded-full -top-2 -right-2 dark:border-gray-900"
|
||||||
(:class params)
|
(:class params)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -794,7 +794,7 @@
|
|||||||
[])
|
[])
|
||||||
|
|
||||||
(step-schema [_]
|
(step-schema [_]
|
||||||
[:map])
|
(mut/select-keys (mm/form-schema linear-wizard) #{:transaction/accounts}))
|
||||||
|
|
||||||
(render-step [this {{:keys [snapshot] :as multi-form-state} :multi-form-state :as request}]
|
(render-step [this {{:keys [snapshot] :as multi-form-state} :multi-form-state :as request}]
|
||||||
(mm/default-render-step
|
(mm/default-render-step
|
||||||
@@ -804,105 +804,94 @@
|
|||||||
{}
|
{}
|
||||||
[:div
|
[:div
|
||||||
(payment-info-view request)
|
(payment-info-view request)
|
||||||
[:div.mt-4
|
[:div {:x-data "{ activeForm: null }"}
|
||||||
[:h2.text-xl.font-bold.mb-6 "Select an Action"]
|
[:div {:class "flex space-x-2 mb-4"}
|
||||||
|
(com/button-group {:name "method"}
|
||||||
|
(com/button-group-button {"@click" "activeForm = 'payment'" :value "payment" ":class" "{ '!bg-primary-200 text-primary-800': activeForm === 'payment'}" :class "relative"}
|
||||||
|
(let [count (count-payment-matches request)]
|
||||||
|
(when (> count 0)
|
||||||
|
(com/badge {:color "green"} (str count))))
|
||||||
|
"Link to payment")
|
||||||
|
(com/button-group-button {"@click" "activeForm = 'unpaid'" :value "unpaid" ":class" "{ '!bg-primary-200 text-primary-800': activeForm === 'unpaid'}" :class "relative"}
|
||||||
|
(let [count (count-unpaid-invoice-matches request)]
|
||||||
|
(when (> count 0)
|
||||||
|
(com/badge {:color "green"} (str count))))
|
||||||
|
"Link to unpaid invoices")
|
||||||
|
(com/button-group-button {"@click" "activeForm = 'autopay'" :value "autopay" ":class" "{ '!bg-primary-200 text-primary-800': activeForm === 'autopay'}" :class "relative"}
|
||||||
|
(let [count (count-autopay-invoice-matches request)]
|
||||||
|
(when (> count 0)
|
||||||
|
(com/badge {:color "green"} (str count))))
|
||||||
|
"Link to autopay invoices")
|
||||||
|
(com/button-group-button {"@click" "activeForm = 'rule'" :value "rule" ":class" "{ '!bg-primary-200 text-primary-800': activeForm === 'rule'}" :class "relative"}
|
||||||
|
(let [count (count-rule-matches request)]
|
||||||
|
(when (> count 0)
|
||||||
|
(com/badge {:color "green"} (str count))))
|
||||||
|
"Apply rule")
|
||||||
|
(com/button-group-button {"@click" "activeForm = 'manual'" :value "manual" ":class" "{ '!bg-primary-200 text-primary-800': activeForm === 'manual'}"}
|
||||||
|
"Manual"))]
|
||||||
|
[:div {:x-show "activeForm === 'payment'", :x-transition:enter "transition ease-out duration-500", :x-transition:enter-start "opacity-0 transform scale-95", :x-transition:enter-end "opacity-100 transform scale-100"}
|
||||||
|
(payment-matches-view request)]
|
||||||
|
[:div {:x-show "activeForm === 'unpaid'", :x-transition:enter "transition ease-out duration-500", :x-transition:enter-start "opacity-0 transform scale-95", :x-transition:enter-end "opacity-100 transform scale-100"}
|
||||||
|
(unpaid-invoices-view request)]
|
||||||
|
[:div {:x-show "activeForm === 'autopay'", :x-transition:enter "transition ease-out duration-500", :x-transition:enter-start "opacity-0 transform scale-95", :x-transition:enter-end "opacity-100 transform scale-100"}
|
||||||
|
(autopay-invoices-view request)]
|
||||||
|
[:div {:x-show "activeForm === 'rule'", :x-transition:enter "transition ease-out duration-500", :x-transition:enter-start "opacity-0 transform scale-95", :x-transition:enter-end "opacity-100 transform scale-100"}
|
||||||
|
(transaction-rules-view request)]
|
||||||
|
[:div {:x-show "activeForm === 'manual'", :x-transition:enter "transition ease-out duration-500", :x-transition:enter-start "opacity-0 transform scale-95", :x-transition:enter-end "opacity-100 transform scale-100"}
|
||||||
|
[:div {}
|
||||||
|
|
||||||
|
(fc/with-field :transaction/accounts
|
||||||
|
(com/validated-field
|
||||||
|
{:errors (fc/field-errors)}
|
||||||
|
(com/data-grid {:headers [(com/data-grid-header {} "Account")
|
||||||
|
(com/data-grid-header {:class "w-32"} "Location")
|
||||||
|
(com/data-grid-header {:class "w-16"} "$")
|
||||||
|
(com/data-grid-header {:class "w-16"})]}
|
||||||
|
(fc/cursor-map #(transaction-account-row* {:value %
|
||||||
|
:client-id (:transaction/client snapshot)}))
|
||||||
|
|
||||||
;; Radio selection for the different options
|
(com/data-grid-new-row {:colspan 4
|
||||||
[:div {:x-data (hx/json {:selectedAction nil})}
|
:hx-get (bidi/path-for ssr-routes/only-routes
|
||||||
|
::route/edit-wizard-new-account)
|
||||||
;; Option cards with counts as badges
|
:row-offset 0
|
||||||
[:div.space-y-4
|
:index (count (fc/field-value))
|
||||||
|
:tr-params {:hx-vals (hx/json {:client-id (:transaction/client snapshot)})}}
|
||||||
;; Link to Payment Option
|
"New account")
|
||||||
[:div.border.rounded-lg.p-4.transition-colors.duration-150
|
(com/data-grid-row {}
|
||||||
{#_#_:class "hover:border-blue-500 cursor-pointer"
|
(com/data-grid-cell {})
|
||||||
:class {:bg-blue-50 "selectedAction === 'payment'"}
|
(com/data-grid-cell {:class "text-right"} [:span.font-bold.text-right "TOTAL"])
|
||||||
"@click" "selectedAction = 'payment'"}
|
(com/data-grid-cell {:id "total"
|
||||||
[:div.flex.justify-between.items-center
|
:class "text-right"
|
||||||
[:div.font-semibold "Link to Payment"]
|
:hx-trigger "change from:closest form target:.amount-field"
|
||||||
(let [count (count-payment-matches request)]
|
:hx-put (bidi.bidi/path-for ssr-routes/only-routes ::route/account-total)
|
||||||
[:div.bg-blue-100.text-blue-800.rounded-full.px-2.py-1.text-xs.font-medium
|
:hx-target "this"
|
||||||
(str count " " (if (= count 1) "match" "matches"))])]]
|
:hx-swap "innerHTML"}
|
||||||
|
(account-total* request))
|
||||||
;; Link to Autopay Invoices Option
|
(com/data-grid-cell {}))
|
||||||
[:div.border.rounded-lg.p-4.transition-colors.duration-150
|
|
||||||
{#_#_:class "hover:border-blue-500 cursor-pointer"
|
(com/data-grid-row {}
|
||||||
:class {:bg-blue-50 "selectedAction === 'autopay'"}
|
(com/data-grid-cell {})
|
||||||
"@click" "selectedAction = 'autopay'"}
|
(com/data-grid-cell {:class "text-right"} [:span.font-bold.text-right "BALANCE"])
|
||||||
[:div.flex.justify-between.items-center
|
(com/data-grid-cell {:id "total"
|
||||||
[:div.font-semibold "Link to Autopay Invoices"]
|
:class "text-right"
|
||||||
(let [count (count-autopay-invoice-matches request)]
|
:hx-trigger "change from:closest form target:.amount-field"
|
||||||
[:div.bg-blue-100.text-blue-800.rounded-full.px-2.py-1.text-xs.font-medium
|
:hx-put (bidi.bidi/path-for ssr-routes/only-routes ::route/account-balance)
|
||||||
(str count " " (if (= count 1) "match" "matches"))])]]
|
:hx-target "this"
|
||||||
|
:hx-swap "innerHTML"}
|
||||||
;; Link to Unpaid Invoices Option
|
(account-balance* request))
|
||||||
[:div.border.rounded-lg.p-4.transition-colors.duration-150
|
(com/data-grid-cell {}))
|
||||||
{#_#_:class "hover:border-blue-500 cursor-pointer"
|
|
||||||
:class {:bg-blue-50 "selectedAction === 'unpaid'"}
|
(com/data-grid-row {}
|
||||||
"@click" "selectedAction = 'unpaid'"}
|
|
||||||
[:div.flex.justify-between.items-center
|
(com/data-grid-cell {})
|
||||||
[:div.font-semibold "Link to Unpaid Invoices"]
|
(com/data-grid-cell {:class "text-right"} [:span.font-bold.text-right "TRANSACTION TOTAL"])
|
||||||
(let [count (count-unpaid-invoice-matches request)]
|
(com/data-grid-cell {:class "text-right"}
|
||||||
[:div.bg-blue-100.text-blue-800.rounded-full.px-2.py-1.text-xs.font-medium
|
(format "$%,.2f" (Math/abs (:transaction/amount snapshot))))
|
||||||
(str count " " (if (= count 1) "match" "matches"))])]]
|
(com/data-grid-cell {})))))]]] ])
|
||||||
|
|
||||||
;; Apply Transaction Rule Option
|
|
||||||
[:div.border.rounded-lg.p-4.transition-colors.duration-150
|
|
||||||
{#_#_:class "hover:border-blue-500 cursor-pointer"
|
|
||||||
:class {:bg-blue-50 "selectedAction === 'rule'"}
|
|
||||||
"@click" "selectedAction = 'rule'"}
|
|
||||||
[:div.flex.justify-between.items-center
|
|
||||||
[:div.font-semibold "Apply Transaction Rule"]
|
|
||||||
(let [count (count-rule-matches request)]
|
|
||||||
[:div.bg-blue-100.text-blue-800.rounded-full.px-2.py-1.text-xs.font-medium
|
|
||||||
(str count " " (if (= count 1) "match" "matches"))])]]
|
|
||||||
|
|
||||||
;; Manually Code Option
|
|
||||||
[:div.border.rounded-lg.p-4.transition-colors.duration-150
|
|
||||||
{#_#_:class "hover:border-blue-500 cursor-pointer"
|
|
||||||
:class {:bg-blue-50 "selectedAction === 'manual'"}
|
|
||||||
"@click" "selectedAction = 'manual'"}
|
|
||||||
[:div.flex.justify-between.items-center
|
|
||||||
[:div.font-semibold "Manually Code Transaction"]
|
|
||||||
[:div.bg-gray-100.text-gray-800.rounded-full.px-2.py-1.text-xs.font-medium "Always available"]]]]
|
|
||||||
|
|
||||||
;; Display selected content based on choice
|
|
||||||
[:div.mt-6 {:x-show "selectedAction !== null"}
|
|
||||||
;; Link to Payment
|
|
||||||
[:div {:x-show "selectedAction === 'payment'"}
|
|
||||||
[:h3.text-lg.font-bold.mb-4 "Available Payments"]
|
|
||||||
(payment-matches-view request)]
|
|
||||||
|
|
||||||
;; Link to Autopay Invoices
|
|
||||||
[:div {:x-show "selectedAction === 'autopay'"}
|
|
||||||
[:h3.text-lg.font-bold.mb-4 "Available Autopay Invoices"]
|
|
||||||
(autopay-invoices-view request)]
|
|
||||||
|
|
||||||
;; Link to Unpaid Invoices
|
|
||||||
[:div {:x-show "selectedAction === 'unpaid'"}
|
|
||||||
[:h3.text-lg.font-bold.mb-4 "Available Unpaid Invoices"]
|
|
||||||
(unpaid-invoices-view request)]
|
|
||||||
|
|
||||||
;; Apply Transaction Rules
|
|
||||||
[:div {:x-show "selectedAction === 'rule'"}
|
|
||||||
[:h3.text-lg.font-bold.mb-4 "Available Transaction Rules"]
|
|
||||||
(transaction-rules-view request)]
|
|
||||||
|
|
||||||
;; Manually Code
|
|
||||||
[:div {:x-show "selectedAction === 'manual'"}
|
|
||||||
[:div.p-4.bg-blue-50.rounded-lg
|
|
||||||
[:h3.text-lg.font-bold.mb-2 "Manual Coding Instructions"]
|
|
||||||
[:p "To manually code this transaction:"]
|
|
||||||
[:ol.list-decimal.pl-6.mt-2
|
|
||||||
[:li "Click \"Done\" below to proceed"]
|
|
||||||
[:li "Go to the \"Accounting Codes\" tab"]
|
|
||||||
[:li "Add accounts and amounts as needed"]
|
|
||||||
[:li "Save your changes"]]]]]]]])
|
|
||||||
:footer
|
:footer
|
||||||
(mm/default-step-footer linear-wizard this :validation-route ::route/edit-wizard-navigate
|
(mm/default-step-footer linear-wizard this :validation-route ::route/edit-wizard-navigate
|
||||||
:next-button (com/button {:color :primary :x-ref "next" :class "w-32"} "Done"))
|
:next-button (com/button {:color :primary :x-ref "next" :class "w-32"} "Done"))
|
||||||
:validation-route ::route/edit-wizard-navigate)))
|
:validation-route ::route/edit-wizard-navigate)))
|
||||||
|
|
||||||
(defrecord EditWizard [_ current-step]
|
(defrecord EditWizard [_ current-step]
|
||||||
mm/LinearModalWizard
|
mm/LinearModalWizard
|
||||||
(hydrate-from-request
|
(hydrate-from-request
|
||||||
@@ -921,7 +910,7 @@
|
|||||||
(-> mm/default-form-props
|
(-> mm/default-form-props
|
||||||
(assoc :hx-post
|
(assoc :hx-post
|
||||||
(str (bidi/path-for ssr-routes/only-routes ::route/edit-submit))))
|
(str (bidi/path-for ssr-routes/only-routes ::route/edit-submit))))
|
||||||
:render-timeline? true))
|
:render-timeline? false))
|
||||||
(steps [_]
|
(steps [_]
|
||||||
[:basic-details
|
[:basic-details
|
||||||
:links
|
:links
|
||||||
|
|||||||
Reference in New Issue
Block a user