           (notifications/clear-button-state :vubis :vubis-file)))))
 
 (rf/reg-event-db
- ::ack-failure
+ ::ack-extract-failure
  (fn [db [_ response]]
    (-> db
        (assoc-in [:errors :version] (or (get-in response [:response :status-text])
                                         (get response :status-text)))
        (notifications/clear-button-state :vubis :vubis-file))))
+
+(rf/reg-event-fx
+  ::save-production
+  (fn [{:keys [db]} [_ id]]
+    (let [production (get-in db [:productions :vubis id])
+          cleaned (dissoc production :uuid)]
+      {:db (notifications/set-button-state db id :vubis)
+       :http-xhrio
+       (as-transit
+        {:method          :put
+         :headers         (auth/auth-header db)
+         :uri             "/api/productions"
+         :params          cleaned
+         :on-success      [::ack-save id]
+         :on-failure      [::ack-failure id :vubis]})})))
+
+(rf/reg-event-db
+  ::ack-save
+  (fn [db [_ id]]
+    (-> db
+        (update-in [:productions :vubis] dissoc id)
+        (notifications/clear-button-state id :vubis))))
+
+(rf/reg-event-db
+ ::ack-failure
+ (fn [db [_ id request-type response]]
+   (-> db
+       (assoc-in [:errors request-type] (or (get-in response [:response :status-text])
+                                            (get response :status-text)))
+       (notifications/clear-button-state id request-type))))
+
+(rf/reg-event-fx
+  ::save-all-productions
+  (fn [{:keys [db]} _]
+    (let [ids (keys (get-in db [:productions :vubis]))]
+      {:dispatch-n (map (fn [id] [::save-production id]) ids)})))
+
+(rf/reg-event-db
+  ::ignore-production
+  (fn [db [_ uuid]]
+    (update-in db [:productions :vubis] dissoc uuid)))
+
+(rf/reg-event-db
+  ::ignore-all-productions
+  (fn [db _]
+    (update-in db [:productions] dissoc :vubis)))
 
 (rf/reg-sub
  ::productions

      [:button.button
       {:disabled (or (nil? file) (not admin?))
        :class klass
        :on-click (fn [e] (rf/dispatch [::vubis-file file]))}
       [:span.icon.is-small
        [:span.material-icons "upload_file"]]]]]))

(defn- production [id]
  (let [{:keys [title creator source description
                library_number source_publisher source_date]
         :as production} @(rf/subscribe [::production id])]
    (println title)
    (println id)
    [:tr
     [:td title]
     [:td creator]

     [:td description]
     [:td library_number]
     [:td source_publisher]
     [:td (tf/unparse (tf/formatters :date) source_date)]
     [:td [buttons id]]]))

(defn- productions []
  [:<>
