From a90c3d18afbf69e084d5786f66ba8425577eb3bf Mon Sep 17 00:00:00 2001 From: BC Date: Thu, 5 Jul 2018 20:42:29 -0700 Subject: [PATCH] company is hidden if company is selected. --- .../auto_ap/views/pages/unpaid_invoices.cljs | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/cljs/auto_ap/views/pages/unpaid_invoices.cljs b/src/cljs/auto_ap/views/pages/unpaid_invoices.cljs index 8d6e52d5..a6f6751d 100644 --- a/src/cljs/auto_ap/views/pages/unpaid_invoices.cljs +++ b/src/cljs/auto_ap/views/pages/unpaid_invoices.cljs @@ -221,7 +221,8 @@ (re-frame/reg-event-fx ::new-invoice (fn [{:keys [db]} _] - {:dispatch [::events/modal-status ::new-invoice {:visible? true}]})) + {:dispatch [::events/modal-status ::new-invoice {:visible? true}] + :db (assoc-in db [::new-invoice] {:company-id (:id @(re-frame/subscribe [::subs/company]))})})) (re-frame/reg-event-fx ::create-invoice @@ -550,15 +551,16 @@ :spec ::invoice/date :subscription data}]]] - [horizontal-field - [:label.label "Company"] - [bind-field - [typeahead {:matches (map (fn [x] [(:id x) (:name x)]) @(re-frame/subscribe [::subs/companies])) - :type "typeahead" - :field [:company-id] - :event change-event - :spec ::invoice/company-id - :subscription data}]]] + (when-not @(re-frame/subscribe [::subs/company]) + [horizontal-field + [:label.label "Company"] + [bind-field + [typeahead {:matches (map (fn [x] [(:id x) (:name x)]) @(re-frame/subscribe [::subs/companies])) + :type "typeahead" + :field [:company-id] + :event change-event + :spec ::invoice/company-id + :subscription data}]]]) [horizontal-field [:label.label "Invoice #"]