 (ns clj-money.views.accounts
-  (:require-macros [cljs.core.async.macros :refer [go go-loop]])
-  (:require [cljs.core.async :refer [<! >! chan]]
+  (:require-macros [cljs.core.async.macros :refer [go]])
+  (:require [cljs.core.async :refer [timeout]]
             [reagent.core :as r]
             [reagent-forms.core :refer [bind-fields]]
             [reagent.format :refer [currency-format]]

                      notify/danger)

    (with-layout
      [:div.row
       [:div.col-md-6
        [account-header account]
        [items-table transaction-items]]])))

(secretary/defroute new-account-path "/accounts/new" []
  (r/render [new-account] (app-element)))

(defn- items-table
  [items]
  [:table.table.table-striped.table-hover
   [:thead
    [:tr
     [:th.col-sm-2.text-right "Date"]
     [:th.col-sm-6 "Description"]
     [:th.col-sm-2.text-right "Amount"]
     [:th.col-sm-2.text-right "Balance"]]]
   [:tbody
    (if @items
      (map item-row @items)
      [:tr [:td {:colSpan 4} [:span.inline-status "Loading..."]]])]])
