side panel saving.
This commit is contained in:
@@ -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 ])]]]
|
||||
|
||||
15
src/java/main/auto_ap/Sortable.java
Normal file
15
src/java/main/auto_ap/Sortable.java
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user