         [:h2 "RSVP"]
         [:form {:id "rsvpsubmit"
                 :onSubmit #(do (.. % (preventDefault))
-                               (js/alert (str "Submitting " (pr-str card))))}
+                               (om/update! card :sent true))}
          [:section {:class "guests"}
           (map-indexed
            (fn [n {:keys [name] :as guest}]

(ns app.core
  (:require [clojure.string :as str]
            [om.core :as om :include-macros true]
            [sablono.core :as html :refer-macros [html]]))


        1 (om/build rsvp-card-view (select-keys data [:results :card]))
        0 "Zero!"))))

(defn rsvp-confirmation-view [card owner]
  (om/component
   (html
    [:main
     [:h1 "Confirmed!"]
     [:pre (with-out-str (pp/pprint @card))]])))

(defn rsvp-view [{results :results, {:keys [sent] :as card} :card, :as data} owner]
  (reify om/IRender
    (render [_]
      (if sent
        (om/build rsvp-confirmation-view card)
        (if (nil? results)
          (om/build rsvp-search-view data)
          (om/build rsvp-search-results-view data))))))

(defn main-view [{:keys [selected rsvp-search] :as data} owner]
  (reify om/IRender
