company is hidden if company is selected.

This commit is contained in:
BC
2018-07-05 20:42:29 -07:00
parent 6d685ffd3b
commit a90c3d18af

View File

@@ -221,7 +221,8 @@
(re-frame/reg-event-fx (re-frame/reg-event-fx
::new-invoice ::new-invoice
(fn [{:keys [db]} _] (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 (re-frame/reg-event-fx
::create-invoice ::create-invoice
@@ -550,15 +551,16 @@
:spec ::invoice/date :spec ::invoice/date
:subscription data}]]] :subscription data}]]]
[horizontal-field (when-not @(re-frame/subscribe [::subs/company])
[:label.label "Company"] [horizontal-field
[bind-field [:label.label "Company"]
[typeahead {:matches (map (fn [x] [(:id x) (:name x)]) @(re-frame/subscribe [::subs/companies])) [bind-field
:type "typeahead" [typeahead {:matches (map (fn [x] [(:id x) (:name x)]) @(re-frame/subscribe [::subs/companies]))
:field [:company-id] :type "typeahead"
:event change-event :field [:company-id]
:spec ::invoice/company-id :event change-event
:subscription data}]]] :spec ::invoice/company-id
:subscription data}]]])
[horizontal-field [horizontal-field
[:label.label "Invoice #"] [:label.label "Invoice #"]