lots of improvements.
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
::edit-client-clicked
|
||||
(fn [{:keys [db]} [_ client-id]]
|
||||
{:db (-> db
|
||||
(forms/stop-form ::new-client)
|
||||
(forms/start-form ::new-client (get (:clients db) client-id)))}))
|
||||
|
||||
(re-frame/reg-sub
|
||||
@@ -120,6 +121,18 @@
|
||||
(update :location-matches conj (:location-match client))
|
||||
(dissoc :location-match))))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::remove-location-match
|
||||
[(forms/in-form ::new-client) (re-frame/path [:data])]
|
||||
(fn [client [_ i]]
|
||||
(-> client
|
||||
(update :location-matches (fn [lm]
|
||||
(->> lm
|
||||
(map vector (range))
|
||||
(filter (fn [[index item]]
|
||||
(not= index i)))
|
||||
(map second)))))))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::add-new-bank-account
|
||||
[(forms/in-form ::new-client) (re-frame/path [:data])]
|
||||
@@ -402,9 +415,11 @@
|
||||
:event change-event
|
||||
:subscription new-client}]]]
|
||||
[:p.control [:button.button.is-primary {:on-click (dispatch-event [::add-new-location-match])} "Add"]]]
|
||||
|
||||
[:ul
|
||||
(for [{:keys [location match]} (:location-matches new-client)]
|
||||
^{:key location} [:li match "->" location ])]]]
|
||||
(for [[index {:keys [location match]}] (map vector (range) (:location-matches new-client))]
|
||||
^{:key index} [:li match "->" location [:a {:on-click (dispatch-event [::remove-location-match index])} [:span.icon
|
||||
[:span.fa.fa-times]]]])]]]
|
||||
|
||||
[:div {:style {:padding-bottom "0.75em" :padding-top "0.75em"}}
|
||||
[:h2.subtitle "Address"]
|
||||
|
||||
Reference in New Issue
Block a user