diff --git a/src/cljs/auto_ap/subs.cljs b/src/cljs/auto_ap/subs.cljs index d6b658bc..50afcc7c 100644 --- a/src/cljs/auto_ap/subs.cljs +++ b/src/cljs/auto_ap/subs.cljs @@ -38,6 +38,13 @@ [] clients)))) +(re-frame/reg-sub + ::real-bank-accounts + :<- [::client] + (fn [client] + (->> client :bank-accounts (filter #(= (:type %) :check)) (sort-by :sort-order)))) + + (re-frame/reg-sub ::clients-by-id (fn [db] diff --git a/src/cljs/auto_ap/views/pages/unpaid_invoices.cljs b/src/cljs/auto_ap/views/pages/unpaid_invoices.cljs index f5053993..ee83c8f0 100644 --- a/src/cljs/auto_ap/views/pages/unpaid_invoices.cljs +++ b/src/cljs/auto_ap/views/pages/unpaid_invoices.cljs @@ -147,7 +147,7 @@ :db (-> db (forms/stop-form ::new-invoice) (update-in [::invoice-page :print-checks-shown?] #(not %) ) - (assoc-in [::handwrite-checks] {:bank-account-id (:id (first @(re-frame/subscribe [::subs/bank-accounts]))) + (assoc-in [::handwrite-checks] {:bank-account-id (:id (first @(re-frame/subscribe [::subs/real-bank-accounts]))) :invoices invoices } ))}))) (re-frame/reg-event-db @@ -630,7 +630,7 @@ :field :bank-account-id :event change-event :subscription handwrite-checks} - (for [{:keys [id number name]} (->> current-client :bank-accounts (filter #(= (:type %) :check)) (sort-by :sort-order))] + (for [{:keys [id number name]} @(re-frame/subscribe [::subs/real-bank-accounts])] ^{:key id} [:option {:value id} name])]]]]