 (defn index
   ([entity-id] (index entity-id {}))
   ([entity-id options]
-   (with-layout "Transactions" options
-     [:div.row
-      [:div.col-md-6
-       [:table.table.table-striped
-        [:tr
-         [:th.col-sm-2 "Date"]
-         [:th.col-sm-8 "Description"]
-         [:th.col-sm-2 "&nbsp;"]]
-        (map transaction-row (transactions/select-by-entity-id (env :db) entity-id))]
-       [:a.btn.btn-primary
-        {:href (str"/entities/" entity-id "/transactions/new")
-         :title "Click here to enter a new transaction."}
-        "Add"]]])))
+   (with-transactions-layout "Transactions" entity-id options
+     [:table.table.table-striped
+      [:tr
+       [:th.col-sm-2 "Date"]
+       [:th.col-sm-8 "Description"]
+       [:th.col-sm-2 "&nbsp;"]]
+      (map transaction-row (transactions/select-by-entity-id (env :db) entity-id))]
+     [:a.btn.btn-primary
+      {:href (str"/entities/" entity-id "/transactions/new")
+       :title "Click here to enter a new transaction."}
+      "Add"])))
 
 (defn- item-row
   "Renders an individual row for a transaction item"

(defn edit
  ([id-or-trans] (edit id-or-trans {}))
  ([id-or-trans options]
   (with-layout "New Transaction" options
     [:div.row
      [:div.col-md-6
       (let [transaction (if (map? id-or-trans)
                           id-or-trans
                           (transactions/find-by-id (env :db) id-or-trans))
             action (cond-> (path "/transactions"
                                  (:id transaction))

                      (:redirect options)
                      (query {:redirect (url-encode (:redirect options))})

                      true
                      format-url)]
         [:form {:action action
                 :method :post}
          (form-fields transaction (redirect-url (:entity-id transaction) options))])]])))

(defn update
  [params]

            [clj-money.validation :as validation]
            [clj-money.models.accounts :as accounts]
            [clj-money.models.transactions :as transactions]
            [clj-money.web.money-shared :refer [account-options
                                                budget-monitors]]
            [clj-money.util :refer [format-date]]
            [clj-money.schema :as schema])
  (:use [clj-money.web.shared :refer :all]))

(defmacro with-transactions-layout
  [page-title entity-id options & content]
  `(with-layout
     ~page-title (assoc ~options :side-bar (budget-monitors ~entity-id))
     ~@content))

(defn- transaction-row
  "Renders a row in the transaction table"
