              [:input {:style {:margin-left 3 :margin-right 3 :width 75}
                       :id    (str "rest-input" id) :type "number" :defaultValue rest :min 0}]
              [:span "sek"]]
-            [:a.pure-u-1-3.pure-button.pure-button-primary {:style   {:margin "5px 5px 5px 5px"}
-                                                            :onClick (fn [e] (.preventDefault e) (update-movement {:id id :m m :parts parts :part-number part-number :pos pos}))
+            [:a.pure-u-1-3.pure-button.pure-button-primary {:style      {:margin "5px 5px 5px 5px"}
+                                                            :onClick    (fn [e] (.preventDefault e) (update-movement {:id id :m m :parts parts :part-number part-number :pos pos}))
                                                             :onTouchEnd (fn [e] (.preventDefault e) (update-movement {:id id :m m :parts parts :part-number part-number :pos pos}))}
              "Oppdater"]]
            [:div.pure-g

                             ))
             :style      {:margin-right '50 :cursor 'pointer}}])
         [:i.fa.fa-search-plus.fa-3x
          {:onClick #(all-movements % show-search-input?)
           :onTouchEnd #(all-movements % show-search-input?)
           :style {:cursor 'pointer}}]]
        (when @show-search-input?
          (let [id (str "mtags" part-number)
                movements-ac-comp (with-meta text-input-component

    [movement.text :refer [text-edit-component text-input-component auto-complete-did-mount]]))

#_(defn replace-movement [event {:keys [kw movement part-number]}]
    (.preventDefault event)
    (cond
      (= :swap kw) (let [slot-category (:slot-category movement)
                         category (if slot-category
                                    (name (first (shuffle slot-category)))
                                    (name (first (shuffle (:category movement)))))]
                     (GET "movement-from-category" {:params        {:user-id  (:user-id (session/get :user))
                                                                    :category category}
                                                    :handler       (fn [new-movement]
                                                                     (let [old-movement (dissoc movement :next :previous) ; remove data that may not be overwritten by merging with the new movement
                                                                           part (session/get-in [:movement-session :parts part-number])
                                                                           pos (first (positions #{movement} part))
                                                                           new-part (assoc part pos (merge old-movement (first new-movement)))]
                                                                       (session/assoc-in! [:movement-session :parts part-number] new-part)))
                                                    :error-handler (fn [r] nil)}))
      (or (= :next kw)
          (= :previous kw)) (let [new-movement (first (shuffle (kw movement)))]
                              (GET "movement" {:params        {:user-id (:user-id (session/get :user))
                                                               :name    new-movement}
                                               :handler       (fn [new-movement]
                                                                (let [old-movement (dissoc movement :next :previous) ; remove data that may not be overwritten by merging with the new movement
                                                                      part (session/get-in [:movement-session :parts part-number])
                                                                      pos (first (positions #{movement} part))
                                                                      new-part (assoc part pos (merge old-movement new-movement))]
                                                                  (session/assoc-in! [:movement-session :parts part-number] new-part)))
                                               :error-handler (fn [r] nil)}))
      :else nil))

#_(defn add-movement [category part-number]
    (GET "movement-from-category" {:params        {:user-id  (:user-id (session/get :user))
                                                   :category (name category)}
                                   :handler       (fn [[new-movement]]
                                                    (let [part (session/get-in [:movement-session :parts part-number])
                                                          new-part (conj part new-movement)]
                                                      (session/assoc-in! [:movement-session :parts part-number] new-part)))
                                   :error-handler (fn [r] nil)}))

#_(defn add-movement-from-search [name part-number]
    (GET "movement" {:params        {:user-id (:user-id (session/get :user))
                                     :name    name}
                     :handler       (fn [new-movement]
                                      (let [part (session/get-in [:movement-session :parts part-number])
                                            new-part (conj part new-movement)]
                                        (session/assoc-in! [:movement-session :parts part-number] new-part)))
                     :error-handler (fn [r] nil)}))

(defn inc-set-completed [event m part-number]
  (.preventDefault event)
  (let [part (session/get-in [:movement-session :parts part-number])
        pos (positions #{m} part)
        new-part (assoc part (first pos) (update m :performed-sets inc))]
    (session/assoc-in! [:movement-session :parts part-number] new-part)))

(defn dec-set-completed [event m part-number]
  (.preventDefault event)
  (let [part (session/get-in [:movement-session :parts part-number])
        pos (positions #{m} part)
