side panel saving.

This commit is contained in:
BC
2019-01-30 10:30:57 -08:00
parent 684c5343ac
commit bda66868c9
2 changed files with 25 additions and 2 deletions

View File

@@ -111,6 +111,14 @@
(update-in [:admin :client :locations] conj (:location client))
(update-in [:admin :client] dissoc :location))})))
(re-frame/reg-event-fx
::add-new-location
(fn [{:keys [db]} _]
(let [client (:new-client @(re-frame/subscribe [::subs/admin]))]
{:db (-> db
(update-in [:admin :new-client :locations] conj (:location client))
(update-in [:admin :new-client] dissoc :location))})))
(re-frame/reg-event-fx
::add-new-bank-account
(fn [{:keys [db]} _]
@@ -145,7 +153,7 @@
(re-frame/reg-event-db
::remove-new-bank-account
(fn [db [_ index]]
(update-in db [:admin :client :new-bank-accounts]
(update-in db [:admin :new-client :new-bank-accounts]
(fn [bas]
(vec (concat (take index bas)
(drop (inc index) bas)))))))
@@ -384,7 +392,7 @@
:field :location
:event ::change-new
:subscription new-client}]]]
[:p.control [:button.button.is-primary {:on-click (dispatch-event [::add-location])} "Add"]]]
[:p.control [:button.button.is-primary {:on-click (dispatch-event [::add-new-location])} "Add"]]]
[:ul
(for [location (:locations new-client)]
^{:key location} [:li location ])]]]

View File

@@ -0,0 +1,15 @@
package auto_ap;
public class Sortable implements Comparable<Sortable> {
public String a;
public Object b;
public Sortable(String a, Object b) {
this.a = a;
this.b = b;
}
public int compareTo(Sortable other) {
return a.compareTo(other.a);
}
}