Virtual pagination for accounts page
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
[clojure.spec.alpha :as s]
|
||||
[auto-ap.subs :as subs]
|
||||
[auto-ap.entities.account :as entity]
|
||||
[auto-ap.views.components.layouts :refer [side-bar]]
|
||||
[auto-ap.views.utils :refer [bind-field dispatch-event]]
|
||||
[auto-ap.views.components.typeahead :refer [typeahead-entity]]
|
||||
[re-frame.core :as re-frame]))
|
||||
@@ -86,73 +87,74 @@
|
||||
change-event [::forms/change ::form]]
|
||||
|
||||
^{:key (:id account)}
|
||||
[form {:title (if (:id account)
|
||||
[side-bar {:on-close (dispatch-event [::forms/form-closing ::form])}
|
||||
[form {:title (if (:id account)
|
||||
"Edit account"
|
||||
"Add account")}
|
||||
|
||||
[field "Account Set"
|
||||
[:input.input {:type "text"
|
||||
:field :account-set
|
||||
:disabled (boolean (:id account))
|
||||
:spec ::entity/account-set}]]
|
||||
|
||||
[field "Account Set"
|
||||
[:input.input {:type "text"
|
||||
:field :account-set
|
||||
:disabled (boolean (:id account))
|
||||
:spec ::entity/account-set}]]
|
||||
|
||||
|
||||
[field "Code"
|
||||
[:input.input {:type "text"
|
||||
:field :numeric-code
|
||||
:disabled (boolean (:id account))
|
||||
:spec ::entity/numeric-code}]]
|
||||
|
||||
[field "Code"
|
||||
[:input.input {:type "text"
|
||||
:field :numeric-code
|
||||
:disabled (boolean (:id account))
|
||||
:spec ::entity/numeric-code}]]
|
||||
|
||||
|
||||
[field "Name"
|
||||
[:input.input {:type "text"
|
||||
:field :name
|
||||
:spec ::entity/name}]]
|
||||
[field "Name"
|
||||
[:input.input {:type "text"
|
||||
:field :name
|
||||
:spec ::entity/name}]]
|
||||
|
||||
|
||||
[field-holder "Account Type"
|
||||
[:div.select
|
||||
[raw-field
|
||||
[:select {:type "select"
|
||||
:field :type
|
||||
:spec (set types)}
|
||||
(map (fn [l]
|
||||
[:option {:value (name l)} (str/capitalize (name l))]) types)]]]]
|
||||
|
||||
|
||||
[field "Location"
|
||||
[:input.input.known-field.location {:type "text"
|
||||
:field :location
|
||||
:spec ::entity/location}]]
|
||||
|
||||
[:h2.subtitle "Client"]
|
||||
[field-holder "Applicability"
|
||||
[:div.select
|
||||
[raw-field
|
||||
[:select {:type "select"
|
||||
:field :applicability
|
||||
:spec (set applicabilities)}
|
||||
(map (fn [l]
|
||||
[:option {:value (name l)} (str/capitalize (name l))]) applicabilities)]]]]
|
||||
[field-holder "Customizations"
|
||||
[:div.field.has-addons
|
||||
[:p.control
|
||||
^{:key (count (:client-overrides account))} ;; resets after adding
|
||||
|
||||
[field-holder "Account Type"
|
||||
[:div.select
|
||||
[raw-field
|
||||
[typeahead-entity {:matches @(re-frame/subscribe [::subs/clients])
|
||||
:match->text :name
|
||||
:type "typeahead"
|
||||
:field [:new-client-override :client]}]]]
|
||||
[:p.control
|
||||
[raw-field
|
||||
[:input.input {:type "text"
|
||||
:placeholder "Bubblegum"
|
||||
:field [:new-client-override :name]}]]]
|
||||
[:p.control [:button.button.is-primary {:on-click (dispatch-event [::add-client-override])} "Add"]]]]
|
||||
[:ul
|
||||
(for [client-override (:client-overrides account)]
|
||||
^{:key (:name client-override)}
|
||||
[:li (:name (:client client-override)) "-" (:name client-override)])]
|
||||
[error-notification]
|
||||
[:select {:type "select"
|
||||
:field :type
|
||||
:spec (set types)}
|
||||
(map (fn [l]
|
||||
[:option {:value (name l)} (str/capitalize (name l))]) types)]]]]
|
||||
|
||||
[submit-button "Save"]]))
|
||||
|
||||
[field "Location"
|
||||
[:input.input.known-field.location {:type "text"
|
||||
:field :location
|
||||
:spec ::entity/location}]]
|
||||
|
||||
[:h2.subtitle "Client"]
|
||||
[field-holder "Applicability"
|
||||
[:div.select
|
||||
[raw-field
|
||||
[:select {:type "select"
|
||||
:field :applicability
|
||||
:spec (set applicabilities)}
|
||||
(map (fn [l]
|
||||
[:option {:value (name l)} (str/capitalize (name l))]) applicabilities)]]]]
|
||||
[field-holder "Customizations"
|
||||
[:div.field.has-addons
|
||||
[:p.control
|
||||
^{:key (count (:client-overrides account))} ;; resets after adding
|
||||
[raw-field
|
||||
[typeahead-entity {:matches @(re-frame/subscribe [::subs/clients])
|
||||
:match->text :name
|
||||
:type "typeahead"
|
||||
:field [:new-client-override :client]}]]]
|
||||
[:p.control
|
||||
[raw-field
|
||||
[:input.input {:type "text"
|
||||
:placeholder "Bubblegum"
|
||||
:field [:new-client-override :name]}]]]
|
||||
[:p.control [:button.button.is-primary {:on-click (dispatch-event [::add-client-override])} "Add"]]]]
|
||||
[:ul
|
||||
(for [client-override (:client-overrides account)]
|
||||
^{:key (:name client-override)}
|
||||
[:li (:name (:client client-override)) "-" (:name client-override)])]
|
||||
[error-notification]
|
||||
|
||||
[submit-button "Save"]]]))
|
||||
|
||||
Reference in New Issue
Block a user