Makes accounts not loaded.
This commit is contained in:
@@ -1,7 +1,11 @@
|
|||||||
(ns auto-ap.datomic.accounts
|
(ns auto-ap.datomic.accounts
|
||||||
(:require [datomic.api :as d]
|
(:require
|
||||||
[auto-ap.graphql.utils :refer [->graphql]]
|
[auto-ap.datomic
|
||||||
[auto-ap.datomic :refer [uri merge-query conn]]))
|
:refer [add-sorter-fields apply-pagination apply-sort-3 conn merge-query uri]]
|
||||||
|
[clojure.string :as str]
|
||||||
|
[datomic.api :as d]
|
||||||
|
[clojure.tools.logging :as log]))
|
||||||
|
|
||||||
(defn <-datomic [a]
|
(defn <-datomic [a]
|
||||||
(update a :account/applicability :db/ident))
|
(update a :account/applicability :db/ident))
|
||||||
|
|
||||||
@@ -86,4 +90,50 @@
|
|||||||
(map <-datomic)
|
(map <-datomic)
|
||||||
(first))))
|
(first))))
|
||||||
|
|
||||||
#_(get-account-by-numeric-code-and-sets 5110 nil)
|
(defn raw-graphql-ids [db args]
|
||||||
|
(println args)
|
||||||
|
(let [query (cond-> {:query {:find []
|
||||||
|
:in ['$]
|
||||||
|
:where []}
|
||||||
|
:args [db]}
|
||||||
|
(:sort args) (add-sorter-fields {"name" ['[?e :account/name ?sort-name]]}
|
||||||
|
args)
|
||||||
|
|
||||||
|
(:numeric-code args)
|
||||||
|
(merge-query {:query {:in ['?numeric-code]
|
||||||
|
:where ['[?e :account/numeric-code ?numeric-code]]}
|
||||||
|
:args [(:numeric-code args)]})
|
||||||
|
|
||||||
|
(not (str/blank? (:name-like args)))
|
||||||
|
(merge-query {:query {:in ['?name-like]
|
||||||
|
:where ['[?e :account/name ?n]
|
||||||
|
'[(re-find ?name-like ?n)]]}
|
||||||
|
:args [(re-pattern (str "(?i)" (:name-like args)))]})
|
||||||
|
|
||||||
|
true
|
||||||
|
(merge-query {:query {:find ['?sort-default '?e ]
|
||||||
|
:where ['[?e :account/name]
|
||||||
|
'[?e :account/numeric-code ?sort-default]]}}))]
|
||||||
|
|
||||||
|
|
||||||
|
(cond->> query
|
||||||
|
true (d/query)
|
||||||
|
true (apply-sort-3 args)
|
||||||
|
true (apply-pagination args))))
|
||||||
|
|
||||||
|
|
||||||
|
(defn graphql-results [ids db args]
|
||||||
|
(let [results (->> (d/pull-many db default-read ids)
|
||||||
|
(group-by :db/id))
|
||||||
|
accounts (->> ids
|
||||||
|
(map results)
|
||||||
|
(map first)
|
||||||
|
(map <-datomic))]
|
||||||
|
accounts))
|
||||||
|
|
||||||
|
(defn get-graphql [args]
|
||||||
|
(log/info "ARGS" args)
|
||||||
|
(let [db (d/db conn)
|
||||||
|
{ids-to-retrieve :ids matching-count :count} (raw-graphql-ids db args)]
|
||||||
|
[(->> (graphql-results ids-to-retrieve db args))
|
||||||
|
matching-count]))
|
||||||
|
|||||||
@@ -305,6 +305,12 @@
|
|||||||
:start {:type 'Int}
|
:start {:type 'Int}
|
||||||
:end {:type 'Int}}}
|
:end {:type 'Int}}}
|
||||||
|
|
||||||
|
:account_page {:fields {:accounts {:type '(list :account)}
|
||||||
|
:count {:type 'Int}
|
||||||
|
:total {:type 'Int}
|
||||||
|
:start {:type 'Int}
|
||||||
|
:end {:type 'Int}}}
|
||||||
|
|
||||||
:reminder_page {:fields {:reminders {:type '(list :reminder)}
|
:reminder_page {:fields {:reminders {:type '(list :reminder)}
|
||||||
:count {:type 'Int}
|
:count {:type 'Int}
|
||||||
:total {:type 'Int}
|
:total {:type 'Int}
|
||||||
@@ -358,9 +364,13 @@
|
|||||||
:args {:client_id {:type :id}}
|
:args {:client_id {:type :id}}
|
||||||
:resolve :get-yodlee-provider-account-page}
|
:resolve :get-yodlee-provider-account-page}
|
||||||
|
|
||||||
:accounts {:type '(list :account)
|
:account_page {:type :account_page
|
||||||
:args {:account_set {:type 'String}}
|
:args {:name_like {:type 'String}
|
||||||
:resolve :get-accounts}
|
:numeric_code {:type 'Int}
|
||||||
|
:start {:type 'Int}
|
||||||
|
:per_page {:type 'Int}
|
||||||
|
:sort {:type '(list :sort_item)}}
|
||||||
|
:resolve :get-accounts}
|
||||||
|
|
||||||
:search_vendor {:type '(list :search_result)
|
:search_vendor {:type '(list :search_result)
|
||||||
:args {:query {:type 'String}}
|
:args {:query {:type 'String}}
|
||||||
@@ -409,10 +419,6 @@
|
|||||||
:per_page {:type 'Int}
|
:per_page {:type 'Int}
|
||||||
:sort {:type '(list :sort_item)}}
|
:sort {:type '(list :sort_item)}}
|
||||||
:resolve :get-sales-order-page}
|
:resolve :get-sales-order-page}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
:vendor {:type :vendor_page
|
:vendor {:type :vendor_page
|
||||||
:args {:name_like {:type 'String}
|
:args {:name_like {:type 'String}
|
||||||
:start {:type 'Int}
|
:start {:type 'Int}
|
||||||
@@ -803,7 +809,7 @@
|
|||||||
(attach-resolvers {
|
(attach-resolvers {
|
||||||
:get-yodlee-provider-account-page gq-yodlee2/get-yodlee-provider-account-page
|
:get-yodlee-provider-account-page gq-yodlee2/get-yodlee-provider-account-page
|
||||||
:get-all-sales-orders get-all-sales-orders
|
:get-all-sales-orders get-all-sales-orders
|
||||||
:get-accounts gq-accounts/get-accounts
|
:get-accounts gq-accounts/get-graphql
|
||||||
:get-sales-order-page gq-sales-orders/get-sales-orders-page
|
:get-sales-order-page gq-sales-orders/get-sales-orders-page
|
||||||
:get-transaction-rule-page gq-transaction-rules/get-transaction-rule-page
|
:get-transaction-rule-page gq-transaction-rules/get-transaction-rule-page
|
||||||
:get-transaction-rule-matches gq-transaction-rules/get-transaction-rule-matches
|
:get-transaction-rule-matches gq-transaction-rules/get-transaction-rule-matches
|
||||||
|
|||||||
@@ -1,16 +1,21 @@
|
|||||||
(ns auto-ap.graphql.accounts
|
(ns auto-ap.graphql.accounts
|
||||||
(:require
|
(:require
|
||||||
[auto-ap.datomic :refer [audit-transact remove-nils conn]]
|
[auto-ap.datomic :refer [audit-transact conn remove-nils]]
|
||||||
[auto-ap.datomic.accounts :as d-accounts]
|
[auto-ap.datomic.accounts :as d-accounts]
|
||||||
[auto-ap.graphql.utils
|
[auto-ap.graphql.utils
|
||||||
:refer [->graphql <-graphql assert-can-see-client enum->keyword]]
|
:refer [->graphql
|
||||||
[datomic.api :as d]
|
<-graphql
|
||||||
[clojure.tools.logging :as log]))
|
assert-admin
|
||||||
|
assert-can-see-client
|
||||||
(defn get-accounts [_ args _]
|
enum->keyword
|
||||||
(->graphql (d-accounts/get-accounts (<-graphql args))))
|
result->page]]
|
||||||
|
[datomic.api :as d]))
|
||||||
|
|
||||||
|
(defn get-graphql [context args _]
|
||||||
|
(assert-admin (:id context))
|
||||||
|
(let [args (assoc args :id (:id context))
|
||||||
|
[accounts accounts-count ] (d-accounts/get-graphql (<-graphql args))]
|
||||||
|
(result->page accounts accounts-count :accounts args)))
|
||||||
|
|
||||||
(defn default-for-vendor [context args _]
|
(defn default-for-vendor [context args _]
|
||||||
(assert-can-see-client (:id context) (:client_id args))
|
(assert-can-see-client (:id context) (:client_id args))
|
||||||
|
|||||||
@@ -62,11 +62,7 @@
|
|||||||
:query-params (auto-ap.views.utils/query-params)
|
:query-params (auto-ap.views.utils/query-params)
|
||||||
:user token)
|
:user token)
|
||||||
:graphql {:token token
|
:graphql {:token token
|
||||||
:query-obj {:venia/queries [[:client
|
:query-obj {:venia/queries [[:client (client-query token)]]}
|
||||||
|
|
||||||
(client-query token)]
|
|
||||||
|
|
||||||
[:accounts [:numeric-code :location :name :type :account_set :applicability :id [:client-overrides [:name :id [:client [:name :id]]]]]]]}
|
|
||||||
:on-success [::received-initial]
|
:on-success [::received-initial]
|
||||||
:on-error [::failed-initial]}}))))
|
:on-error [::failed-initial]}}))))
|
||||||
|
|
||||||
@@ -80,10 +76,7 @@
|
|||||||
::logged-in
|
::logged-in
|
||||||
(fn [{:keys [db]} [_ token user]]
|
(fn [{:keys [db]} [_ token user]]
|
||||||
{:graphql {:token token
|
{:graphql {:token token
|
||||||
:query-obj {:venia/queries [[:client
|
:query-obj {:venia/queries [[:client (client-query token)]]}
|
||||||
(client-query token)]
|
|
||||||
|
|
||||||
[:accounts [:numeric-code :name :location :type :account_set :applicability :id [:client-overrides [:name [:client [:name :id]]]]]]]}
|
|
||||||
|
|
||||||
:on-success [::received-initial]
|
:on-success [::received-initial]
|
||||||
:on-error [::failed-initial]}
|
:on-error [::failed-initial]}
|
||||||
@@ -93,12 +86,11 @@
|
|||||||
|
|
||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
::received-initial
|
::received-initial
|
||||||
(fn [{:keys [db]} [_ {accounts :accounts clients :client}]]
|
(fn [{:keys [db]} [_ {clients :client}]]
|
||||||
|
|
||||||
{:db (-> db
|
{:db (-> db
|
||||||
(assoc :clients (by :id clients) )
|
(assoc :clients (by :id clients) )
|
||||||
(assoc :is-initial-loading? false)
|
(assoc :is-initial-loading? false)
|
||||||
(assoc :accounts accounts )
|
|
||||||
(assoc :client (or (when (= 1 (count clients)) (->> clients first :id ))
|
(assoc :client (or (when (= 1 (count clients)) (->> clients first :id ))
|
||||||
(->> clients
|
(->> clients
|
||||||
(map :id)
|
(map :id)
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
[auto-ap.utils :refer [replace-by]]
|
[auto-ap.utils :refer [replace-by]]
|
||||||
[auto-ap.views.components.admin.side-bar :refer [admin-side-bar]]
|
[auto-ap.views.components.admin.side-bar :refer [admin-side-bar]]
|
||||||
[auto-ap.views.pages.admin.accounts.side-bar :as side-bar]
|
[auto-ap.views.pages.admin.accounts.side-bar :as side-bar]
|
||||||
[auto-ap.views.utils :refer [dispatch-event action-cell-width]]
|
[auto-ap.views.pages.admin.accounts.table :as table]
|
||||||
|
[auto-ap.views.utils :refer [dispatch-event action-cell-width with-user]]
|
||||||
[auto-ap.views.components.layouts
|
[auto-ap.views.components.layouts
|
||||||
:refer
|
:refer
|
||||||
[appearing-side-bar side-bar-layout]]
|
[appearing-side-bar side-bar-layout]]
|
||||||
@@ -15,96 +16,55 @@
|
|||||||
[auto-ap.views.components.buttons :as buttons]
|
[auto-ap.views.components.buttons :as buttons]
|
||||||
[reagent.core :as reagent]
|
[reagent.core :as reagent]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[vimsical.re-frame.fx.track :as track]))
|
[vimsical.re-frame.fx.track :as track]
|
||||||
|
[auto-ap.views.pages.data-page :as data-page]
|
||||||
|
[clojure.set :as set]
|
||||||
|
[auto-ap.effects.forward :as forward]))
|
||||||
|
|
||||||
|
(def default-read [:numeric-code :name :location :type :account_set :applicability :id [:client-overrides [:name [:client [:name :id]]]]])
|
||||||
|
|
||||||
|
|
||||||
(re-frame/reg-event-db
|
|
||||||
::edit-completed
|
|
||||||
(fn [db [_ edit-account]]
|
|
||||||
(-> db
|
|
||||||
(update :accounts replace-by :id (assoc edit-account :class "live-added")))))
|
|
||||||
(re-frame/reg-event-db
|
|
||||||
::table-params-changed
|
|
||||||
(fn [db [_ p]]
|
|
||||||
(assoc db ::table-params p)))
|
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
::params-change
|
::params-change
|
||||||
(fn [db [_ p]]
|
[with-user]
|
||||||
{:set-uri-params p}))
|
(fn [{:keys [user]} [_ params]]
|
||||||
|
{:set-uri-params params
|
||||||
(re-frame/reg-sub
|
:graphql {:token user
|
||||||
::table-params
|
:owns-state {:single [::data-page/page ::page]}
|
||||||
(fn [db]
|
:query-obj {:venia/queries [{:query/data [:account_page
|
||||||
(-> db ::table-params)))
|
{:sort (:sort params)
|
||||||
|
:start (:start params 0)
|
||||||
(re-frame/reg-sub
|
:per-page (:per-page params)
|
||||||
::params
|
:name-like (:name-like params)
|
||||||
:<- [::table-params]
|
:numeric-code (some-> params :numeric-code not-empty js/parseInt)}
|
||||||
:<- [::side-bar/filter-params]
|
[[:accounts default-read]
|
||||||
(fn [[table-params filter-params]]
|
:total
|
||||||
(cond-> {}
|
:start
|
||||||
(seq filter-params) (merge filter-params)
|
:end]]
|
||||||
(seq table-params) (merge table-params))))
|
:query/alias :result}]}
|
||||||
|
:on-success (fn [result]
|
||||||
|
[::data-page/received ::page
|
||||||
|
(set/rename-keys (:result result)
|
||||||
|
{:accounts :data})])}}))
|
||||||
|
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
::unmounted
|
::unmounted
|
||||||
(fn [{:keys [db]} _]
|
(fn [_ _]
|
||||||
{:db (dissoc db ::table-params ::side-bar/filter-params)
|
{::track/dispose {:id ::params}
|
||||||
::track/dispose {:id ::params}}))
|
::forward/dispose [{:id ::updated}]}))
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
::mounted
|
::mounted
|
||||||
(fn [{:keys [db]} _]
|
(fn [_ _]
|
||||||
{::track/register {:id ::params
|
{::track/register {:id ::params
|
||||||
:subscription [::params]
|
:subscription [::data-page/params ::page]
|
||||||
:event-fn (fn [params] [::params-change params])}}))
|
:event-fn (fn [params] [::params-change params])}
|
||||||
(re-frame/reg-sub
|
::forward/register [{:id ::updated
|
||||||
::account-page
|
:events #{::account-form/edited}
|
||||||
:<- [::params]
|
:event-fn (fn [[_ edited-account]]
|
||||||
:<- [::subs/all-accounts]
|
[::data-page/updated-entity ::page (:upsert-account edited-account)])}]}))
|
||||||
(fn [[params all-accounts]]
|
|
||||||
(let [matching-accounts (cond->> all-accounts
|
|
||||||
(:name-like params) (filter #(str/includes? (str/lower-case (or (:name %) ""))
|
|
||||||
(str/lower-case (:name-like params))))
|
|
||||||
(not-empty (:code-like params)) (filter #(str/starts-with? (str (or (:numeric-code %) ""))
|
|
||||||
(str/lower-case (:code-like params)))))]
|
|
||||||
(assoc (grid/virtual-paginate-controls (:start params ) (:per-page params) matching-accounts)
|
|
||||||
:data (grid/virtual-paginate (:start params)
|
|
||||||
(:per-page params)
|
|
||||||
(sort-by :numeric-code matching-accounts))))))
|
|
||||||
|
|
||||||
(defn accounts-table [{:keys [accounts]}]
|
|
||||||
(let [status @(re-frame/subscribe [::status/single ::page])
|
|
||||||
opc (fn [p]
|
|
||||||
(re-frame/dispatch [::table-params-changed p]))
|
|
||||||
params @(re-frame/subscribe [::params])]
|
|
||||||
|
|
||||||
[:div
|
|
||||||
[grid/grid {:status status
|
|
||||||
:on-params-change opc
|
|
||||||
:params params
|
|
||||||
:column-count 5}
|
|
||||||
[grid/controls accounts]
|
|
||||||
[grid/table {:fullwidth true}
|
|
||||||
[grid/header
|
|
||||||
[grid/row {}
|
|
||||||
[grid/header-cell {} "Code"]
|
|
||||||
[grid/header-cell {} "Name"]
|
|
||||||
[grid/header-cell {} "Type"]
|
|
||||||
[grid/header-cell {} "Location"]
|
|
||||||
[grid/header-cell {:style {:width (action-cell-width 1)}} ]]]
|
|
||||||
[grid/body
|
|
||||||
(for [{:keys [id numeric-code name type location class] :as account} (:data accounts)]
|
|
||||||
^{:key id}
|
|
||||||
[grid/row {:class (:class account) :id id}
|
|
||||||
[grid/cell {} numeric-code]
|
|
||||||
[grid/cell {} name]
|
|
||||||
[grid/cell {} type]
|
|
||||||
[grid/cell {} location]
|
|
||||||
[grid/cell {}
|
|
||||||
[buttons/fa-icon {:event [::account-form/editing account [::edit-completed]]
|
|
||||||
:icon "fa-pencil"}]]])]]]]))
|
|
||||||
|
|
||||||
(defn admin-accounts-content []
|
(defn admin-accounts-content []
|
||||||
[:div
|
[:div
|
||||||
@@ -114,9 +74,8 @@
|
|||||||
:class "is-primary"
|
:class "is-primary"
|
||||||
:event [::account-form/editing
|
:event [::account-form/editing
|
||||||
{:type :asset
|
{:type :asset
|
||||||
:account-set "default"}
|
:account-set "default"}]}]]
|
||||||
[::edit-completed]]}]]
|
[table/accounts-table {:data-page ::page}]])
|
||||||
[accounts-table {:accounts @(re-frame/subscribe [::account-page])}]])
|
|
||||||
|
|
||||||
(defn admin-accounts-page []
|
(defn admin-accounts-page []
|
||||||
(reagent/create-class
|
(reagent/create-class
|
||||||
@@ -127,6 +86,6 @@
|
|||||||
(fn []
|
(fn []
|
||||||
(let [{:keys [active?]} @(re-frame/subscribe [::forms/form ::account-form/form])]
|
(let [{:keys [active?]} @(re-frame/subscribe [::forms/form ::account-form/form])]
|
||||||
[side-bar-layout {:side-bar [admin-side-bar {}
|
[side-bar-layout {:side-bar [admin-side-bar {}
|
||||||
[side-bar/accounts-side-bar]]
|
[side-bar/accounts-side-bar {:data-page ::page}]]
|
||||||
:main [admin-accounts-content]
|
:main [admin-accounts-content]
|
||||||
:right-side-bar [appearing-side-bar {:visible? active?} [account-form/form ]]}]))}))
|
:right-side-bar [appearing-side-bar {:visible? active?} [account-form/form ]]}]))}))
|
||||||
|
|||||||
@@ -2,78 +2,24 @@
|
|||||||
(:require
|
(:require
|
||||||
[re-frame.core :as re-frame]
|
[re-frame.core :as re-frame]
|
||||||
[auto-ap.subs :as subs]
|
[auto-ap.subs :as subs]
|
||||||
[auto-ap.views.utils :refer [active-when dispatch-value-change]]))
|
[auto-ap.views.utils :refer [dispatch-value-change]]
|
||||||
|
[auto-ap.views.pages.data-page :as data-page]))
|
||||||
|
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(defn accounts-side-bar [{:keys [data-page]}]
|
||||||
::specific-filters
|
|
||||||
(fn [db ]
|
|
||||||
(::filters db nil)))
|
|
||||||
|
|
||||||
(re-frame/reg-sub
|
|
||||||
::filters
|
|
||||||
:<- [::specific-filters]
|
|
||||||
:<- [::subs/query-params]
|
|
||||||
(fn [[specific-filters query-params] ]
|
|
||||||
(let [url-filters (-> query-params
|
|
||||||
(select-keys #{:name-like :code-like})
|
|
||||||
(update :name-like #(some-> % str))
|
|
||||||
(update :code-like #(some-> % str)))]
|
|
||||||
(merge url-filters specific-filters ))))
|
|
||||||
|
|
||||||
(re-frame/reg-sub
|
|
||||||
::filter
|
|
||||||
:<- [::filters]
|
|
||||||
(fn [filters [_ which]]
|
|
||||||
(get filters which)))
|
|
||||||
|
|
||||||
(re-frame/reg-sub
|
|
||||||
::settled-filters
|
|
||||||
(fn [db ]
|
|
||||||
(::settled-filters db)))
|
|
||||||
|
|
||||||
(re-frame/reg-sub
|
|
||||||
::filter-params
|
|
||||||
:<- [::settled-filters]
|
|
||||||
:<- [::filters]
|
|
||||||
:<- [::subs/active-page]
|
|
||||||
(fn [[settled-filters filters ap ]]
|
|
||||||
(let [filters (or settled-filters filters)]
|
|
||||||
{:name-like (:name-like filters)
|
|
||||||
:code-like (:code-like filters)})))
|
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
|
||||||
::filters-settled
|
|
||||||
(fn [{:keys [db]} [_ & params]]
|
|
||||||
{:db (assoc db ::settled-filters @(re-frame/subscribe [::filters]))}))
|
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
|
||||||
::filter-changed
|
|
||||||
(fn [{:keys [db]} [_ & params]]
|
|
||||||
(let [[a b c] params
|
|
||||||
[which val] (if (= 3 (count params))
|
|
||||||
[(into [a] b) c]
|
|
||||||
[[a] b])]
|
|
||||||
{:db (assoc-in db (into [::filters] which) val)
|
|
||||||
:dispatch-debounce {:event [::filters-settled]
|
|
||||||
:time 800
|
|
||||||
:key ::filters}})))
|
|
||||||
|
|
||||||
|
|
||||||
(defn accounts-side-bar []
|
|
||||||
[:div
|
[:div
|
||||||
[:p.menu-label "Name"]
|
[:p.menu-label "Name"]
|
||||||
|
|
||||||
[:div.field
|
[:div.field
|
||||||
[:div.control [:input.input {:placeholder "Food Cost"
|
[:div.control [:input.input {:placeholder "Food Cost"
|
||||||
:value @(re-frame/subscribe [::filter :name-like])
|
:value @(re-frame/subscribe [::data-page/filter data-page :name-like])
|
||||||
:on-change (dispatch-value-change [::filter-changed :name-like])} ]]]
|
:on-change (dispatch-value-change [::data-page/filter-changed data-page :name-like])} ]]]
|
||||||
|
|
||||||
[:p.menu-label "Code"]
|
[:p.menu-label "Code"]
|
||||||
|
|
||||||
[:div.field
|
[:div.field
|
||||||
[:div.control [:input.input {:placeholder "11000"
|
[:div.control [:input.input {:placeholder "11000"
|
||||||
:value @(re-frame/subscribe [::filter :code-like])
|
:value @(re-frame/subscribe [::data-page/filter data-page :numeric-code])
|
||||||
:on-change (dispatch-value-change [::filter-changed :code-like])}]]]])
|
:on-change (dispatch-value-change [::data-page/filter-changed data-page :numeric-code])}]]]])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
36
src/cljs/auto_ap/views/pages/admin/accounts/table.cljs
Normal file
36
src/cljs/auto_ap/views/pages/admin/accounts/table.cljs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
(ns auto-ap.views.pages.admin.accounts.table
|
||||||
|
(:require
|
||||||
|
[auto-ap.status :as status]
|
||||||
|
[auto-ap.views.components.buttons :as buttons]
|
||||||
|
[auto-ap.views.components.grid :as grid]
|
||||||
|
[auto-ap.views.pages.admin.accounts.form :as account-form]
|
||||||
|
[auto-ap.views.utils :refer [action-cell-width]]
|
||||||
|
[re-frame.core :as re-frame]
|
||||||
|
[auto-ap.views.pages.data-page :as data-page]))
|
||||||
|
|
||||||
|
(defn accounts-table [{:keys [data-page]}]
|
||||||
|
(let [{:keys [data]} @(re-frame/subscribe [::data-page/page data-page])]
|
||||||
|
|
||||||
|
[:div
|
||||||
|
[grid/grid {:data-page data-page
|
||||||
|
:column-count 5}
|
||||||
|
[grid/controls data]
|
||||||
|
[grid/table {:fullwidth true}
|
||||||
|
[grid/header
|
||||||
|
[grid/row {}
|
||||||
|
[grid/header-cell {} "Code"]
|
||||||
|
[grid/header-cell {} "Name"]
|
||||||
|
[grid/header-cell {} "Type"]
|
||||||
|
[grid/header-cell {} "Location"]
|
||||||
|
[grid/header-cell {:style {:width (action-cell-width 1)}} ]]]
|
||||||
|
[grid/body
|
||||||
|
(for [{:keys [id numeric-code name type location class] :as account} (:data data)]
|
||||||
|
^{:key id}
|
||||||
|
[grid/row {:class (:class account) :id id}
|
||||||
|
[grid/cell {} numeric-code]
|
||||||
|
[grid/cell {} name]
|
||||||
|
[grid/cell {} type]
|
||||||
|
[grid/cell {} location]
|
||||||
|
[grid/cell {}
|
||||||
|
[buttons/fa-icon {:event [::account-form/editing account [::edit-completed]]
|
||||||
|
:icon "fa-pencil"}]]])]]]]))
|
||||||
Reference in New Issue
Block a user