(ns auto-ap.views.pages.admin.reminders (:require-macros [cljs.core.async.macros :refer [go]]) (:require [re-frame.core :as re-frame] [reagent.core :as reagent] [auto-ap.subs :as subs] [auto-ap.events.admin.reminders :as events] [auto-ap.views.utils :refer [login-url dispatch-value-change dispatch-event]] [cljs.reader :as edn] [auto-ap.routes :as routes] [bidi.bidi :as bidi])) (defn reminders-table [] (let [reminders (or @(re-frame/subscribe [::subs/reminders]) [])] [:table {:class "table", :style {:width "100%"}} [:thead [:tr [:th "Vendor"] [:th "Scheduled Date"] [:th "Status"]]] [:tbody (for [{:keys [id vendor-name scheduled sent]} reminders] ^{:key id} [:tr [:td vendor-name] [:td (str scheduled)] [:td (when sent [:span [:span.icon [:i.fa.fa-check]] "Sent " (str sent)]) ]])]])) (defn admin-reminders-page [] [(with-meta (fn [] [:div {:class "inbox-messages"} [:div.hero [:div.hero-body [:div.container [:div [:h1.title "Reminders"] [reminders-table]]]]]]) {:component-did-mount (fn [] (re-frame/dispatch [::events/mounted]))})])