                                  [render-documents (get-new-page-data (get-value! :documents)
                                                                       (get-value! :current-page))])))]
     (http-get "http://localhost:8193/documents/all" onres)))
-
-(defn click-update[id]
-  (secretary/dispatch! (str "#/documents/update/" id)))
-
-;; (defn docupdate [event]
-;;   (let [onres (fn[data]
-;;                 (secretary/dispatch! "/documents"))]
-;;     (http-post "http://localhost:8193/documents/update"
-;;                onres (.serialize (Serializer.) (clj->js (get-update-documents-formdata))))))
-
-(defn delete[id]
-  (let [onres (fn [json]
-                (do
-                  (set-key-value :documents (getdata json))
-                  (set-key-value :page-location
-                                 [render-documents (get-new-page-data (get-value! :documents)
-                                                                      (get-value! :current-page))])))]
-    (http-delete (str "http://localhost:8193/documents/delete/" id)  onres)))
-
-(defn add [event]
-  (secretary/dispatch! "/documents/add"))
 
 (defn render-documents [documents]
   [:div

                                           (get-value! :current-page))]))))

;; ========================================================================================
;; Add and Update form creation validation
;; ========================================================================================

(defn form-validator [data-set]

                 onres  (.serialize (Serializer.) (clj->js @data-set))))
    (reset! focus "on")))

(defn update-form-onclick [data-set focus]
  (if (= nil (form-validator @data-set))
    (let [onres (fn[data]
                  (secretary/dispatch! "/documents"))]
      (http-post "http://localhost:8193/documents/update"
                 onres (.serialize (Serializer.) (clj->js @data-set))))
    (reset! focus "on")))

(defn form-cancel [event]
  (secretary/dispatch! "/documents"))

(defn document-template [doc-name data-set focus save-function]
  [:div.container
   [:div.panel.panel-primary.model-dialog
    [:div.panel-heading
     [:h2 doc-name]]
