(ns auto-ap.views.components.admin.side-bar
  (:require [re-frame.core :as re-frame]
            [reagent.core :as r]
            [clojure.string :as str]
            [clojure.spec.alpha :as s]
            [cljs-time.core :as c]
            [goog.string :as gstring]
            [bidi.bidi :as bidi]
            [auto-ap.routes :as routes]
            [auto-ap.views.utils :refer [active-when dispatch-event bind-field horizontal-field date->str str->date pretty standard]]
            [auto-ap.subs :as subs]
            [auto-ap.events :as events]))

(defn admin-side-bar [params & rest]
  (let [ap @(re-frame/subscribe [::subs/active-page])]
    [:div
      [:p.menu-label "General"]
      [:p.menu-item
       [:a {:href (bidi/path-for routes/routes :admin) , :class (str "item" (active-when  ap = :admin))}
        [:span {:class "icon"}
         [:i {:class "fa fa-tachometer"}]]
        [:span {:class "name"} "Dashboard"]]]

      [:p.menu-label "Setup"]
      [:ul.menu-list
       [:li.menu-item
        [:a {:href (bidi/path-for routes/routes :admin-clients) , :class (str "item" (active-when ap = :admin-clients))}
         [:span {:class "icon"}
          [:i {:class "fa fa-star-o"}]]
         
         [:span {:class "name"} "Clients"]]]
       [:li.menu-item
        [:a {:href (bidi/path-for routes/routes :admin-vendors) , :class (str "item" (active-when ap = :admin-vendors))}
         [:span {:class "icon"}
          [:i {:class "fa fa-star-o"}]]
         
         [:span {:class "name"} "Vendors"]]]
       [:li.menu-item
        [:a {:href (bidi/path-for routes/routes :admin-users), :class (str "item" (active-when ap = :admin-users))}
         [:span {:class "icon"}
          [:i {:class "fa fa-envelope-o"}]]
         [:span {:class "name"} "Users"]]]

       
       [:li.menu-item
        [:a {:href (bidi/path-for routes/routes :admin-yodlee), :class (str "item" (active-when ap = :admin-yodlee))}
         [:span {:class "icon"}
          [:i {:class "fa fa-envelope-o"}]]
         [:span {:class "name"} "Yodlee Link"]]]
       
       [:ul ]]
      [:p.menu-label "History"]
      [:ul.menu-list
       [:li.menu-item
        [:a {:href (bidi/path-for routes/routes :admin-reminders) , :class (str "item" (active-when ap = :admin-reminders))}
         [:span {:class "icon"}
          [:i {:class "fa fa-star-o"}]]
         
         [:span {:class "name"} "Reminders"]]]]
      [:p.menu-label "Import"]
      [:ul.menu-list
       [:li.menu-item
        [:a {:href (bidi/path-for routes/routes :admin-excel-import) , :class (str "item" (active-when ap = :admin-excel-import))}
         [:span {:class "icon"}
          [:i {:class "fa fa-download"}]]
         
         [:span {:class "name"} "Excel Invoices"]]]]
     [:div rest]]))
