Can edit locations now.

This commit is contained in:
Bryce Covert
2019-04-14 08:32:24 -07:00
parent 4018d9aa8d
commit c44a36c815
8 changed files with 50 additions and 20 deletions

View File

@@ -28,14 +28,16 @@
[:th "Code"]
[:th "Name"]
[:th "Type"]
[:th "Location"]
[:th {:style {:width "5em"}}]]]
[:tbody
(for [{:keys [id numeric-code name type] :as account} (sort-by :numeric-code accounts)]
(for [{:keys [id numeric-code name type location] :as account} (sort-by :numeric-code accounts)]
^{:key id}
[:tr
[:td numeric-code]
[:td name]
[:td type]
[:td location]
[:td [:a.button {:on-click (dispatch-event [::account-form/editing account])} [:span [:span.icon [:i.fa.fa-pencil]]]]]])]]])])
(defn admin-accounts-content []

View File

@@ -16,9 +16,12 @@
(re-frame/reg-sub
::account-request
:<- [::forms/form ::form]
(fn [{{:keys [id type numeric-code name account-set]} :data}]
(fn [{{:keys [id location type numeric-code name account-set]} :data}]
{:id id
:type (keyword type)
:location (if (clojure.string/blank? location)
nil
location)
:numeric-code numeric-code
:name name
:account-set account-set}))
@@ -47,7 +50,7 @@
:operation/name "UpsertAccount"}
:venia/queries [{:query/data [:upsert-account
{:account @(re-frame/subscribe [::account-request])}
[:id :type :name :account-set :numeric-code]]}]}
[:id :type :name :account-set :numeric-code :location]]}]}
:on-success [::edited edit-completed]
:on-error [::forms/save-error ::form]}}))))
@@ -112,6 +115,17 @@
(map (fn [l]
[:option {:value (name l)} (str/capitalize (name l))]) types)]]]]]
[:div.field
[:p.help "Location"]
[:div.control
[bind-field
[:input.input.known-field.location {:type "text"
:field :location
:spec ::entity/location
:event change-event
:subscription account}]]]]
(when error
[:div.notification.is-warning.animated.fadeInUp
error])