first step in making accounts editable.
This commit is contained in:
@@ -1,23 +1,15 @@
|
||||
(ns auto-ap.views.pages.admin.accounts
|
||||
(:require-macros [cljs.core.async.macros :refer [go]]
|
||||
[clojure.string :as str])
|
||||
(:require [re-frame.core :as re-frame]
|
||||
|
||||
[reagent.core :as reagent]
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.string :as str]
|
||||
(:require [auto-ap.forms :as forms]
|
||||
[auto-ap.subs :as subs]
|
||||
[auto-ap.forms :as forms]
|
||||
[auto-ap.events :as events]
|
||||
[auto-ap.entities.clients :as entity]
|
||||
[auto-ap.views.components.address :refer [address-field]]
|
||||
[auto-ap.views.components.layouts :refer [side-bar-layout appearing-side-bar]]
|
||||
[auto-ap.views.components.admin.side-bar :refer [admin-side-bar]]
|
||||
[auto-ap.views.utils :refer [login-url dispatch-event dispatch-value-change bind-field horizontal-field]]
|
||||
[auto-ap.views.components.modal :refer [action-modal]]
|
||||
[cljs.reader :as edn]
|
||||
[auto-ap.routes :as routes]
|
||||
[bidi.bidi :as bidi]))
|
||||
[auto-ap.views.utils :refer [dispatch-event]]
|
||||
[auto-ap.views.components.layouts
|
||||
:refer
|
||||
[appearing-side-bar side-bar-layout]]
|
||||
[auto-ap.views.pages.admin.accounts.form :as account-form]
|
||||
[re-frame.core :as re-frame]))
|
||||
|
||||
|
||||
|
||||
(defn accounts-table [{:keys [accounts]} ]
|
||||
|
||||
@@ -27,18 +19,21 @@
|
||||
^{:key account-set}
|
||||
[:div
|
||||
[:h2.title.is-4 account-set]
|
||||
[:table.table
|
||||
[:table.table.compact
|
||||
[:thead
|
||||
[:th "Code"]
|
||||
[:th "Name"]
|
||||
[:th "Type"]]
|
||||
[:th "Type"]
|
||||
[:th {:style {:width "5em"}}]
|
||||
]
|
||||
[:tbody
|
||||
(for [{:keys [id numeric-code name type]} (sort-by :numeric-code accounts)]
|
||||
(for [{:keys [id numeric-code name type] :as account} (sort-by :numeric-code accounts)]
|
||||
^{:key id}
|
||||
[:tr
|
||||
[:td numeric-code]
|
||||
[:td name]
|
||||
[:td type]])]]]))])
|
||||
[:td type]
|
||||
[:td [:a.button {:on-click (dispatch-event [::account-form/editing account])} [:span [:span.icon [:i.fa.fa-pencil]]]]]])]]]))])
|
||||
|
||||
(defn admin-accounts-content []
|
||||
[:div
|
||||
@@ -48,5 +43,7 @@
|
||||
[accounts-table {:accounts accounts}]])])
|
||||
|
||||
(defn admin-accounts-page []
|
||||
[side-bar-layout {:side-bar [admin-side-bar {}]
|
||||
:main [admin-accounts-content]}])
|
||||
(let [{:keys [active?]} @(re-frame/subscribe [::forms/form ::account-form/form])]
|
||||
[side-bar-layout {:side-bar [admin-side-bar {}]
|
||||
:main [admin-accounts-content]
|
||||
:right-side-bar [appearing-side-bar {:visible? active?} [account-form/form]]}]))
|
||||
|
||||
Reference in New Issue
Block a user