                     (js->clj result)))
         [])))
 
+(defn reset-search! [owner]
+  (let [search (om/observe owner (search))]
+    (om/update! search :name "")
+    (om/update! search :results nil)))
+
+(defn reset-selection! [owner]
+  (let [selection (om/observe owner (selection))]
+    (om/update! selection :party nil)
+    (om/update! selection :guests nil)))
+
+(defn select-party! [owner party]
+  (let [selection (om/observe owner (selection))]
+    (go (om/update! selection :party party)
+        (let [guests (mapv #(dissoc % :party)
+                           (<! (guests-in-party (:id party))))]
+          (om/update! selection :guests guests)))))
+
+(defn party-selected? [owner]
+  (let [{:keys [party guests] :as selection} (om/observe owner (selection))]
+    (every? some? [party guests])))
+
+(defn reset-response! [owner]
+  (let [response (om/observe owner (response))]
+    (om/update! response :contact nil)
+    (om/update! response :food-preferences "")
+    (om/update! response :infos {})
+    (om/update! response :sent false)))
+
+(defn reset-all! [owner]
+  (reset-search! owner)
+  (reset-selection! owner)
+  #_(reset-response! owner))
+
 (defn nav-view [{:keys [selected rsvp-search]} owner]
   (reify om/IRender
     (render [_]

                        [:li
                         [:span name]
                         [:button
                          {:onClick (fn [_]
                                      (go (om/update! data :party (assoc party
                                                                         :guests (<! (guests-in-party (:id party)))))))}
                          "Select"]])
                      results)]
        [:p "Can't find your RSVP? "
          [:a {:href "???"} "Search again"]]]))))

(defn rsvp-confirmation-view [response owner]
  (om/component

              (map (fn [[key text]]
                     [:li (if (= selected [key]) {:class "selected"} {})
                      [:a {:href "#"
                           :onClick #(do (reset-all! owner)
                                         (om/update! selected 0 key))}
                       text]])
                   (partition 2 [:details       "Details"
