                                                                       (get-value! :current-page))])))]
     (http-get "http://localhost:8193/documents/all" onres)))
 
-(defn document-template []
-  [:div {:id "add" :class "form-group"}
-   [:div#dn (input "Documentname" :text :documentname )]
-   [:div#tl (input "Title" :text :title)]
-   [:div#empn (input "EmployeeName" :text :employeename)]
-   [:div#dt (input "Date":Date :date)]
-   [:div#loc (input "Location":text :location)]
-   [:input {:type "button" :value "Save"
-            :class "btn btn-primary" :on-click save}]
-   [:input {:type "button" :value "Cancel"
-            :class "btn btn-primary" :on-click cancel}]])
-
-(defn get-update-documents-formdata []
-  {
-   :id (getinputvalue "id")
-   :documentname (getinputvalue "upd_documentname")
-   :title (getinputvalue "upd_title")
-   :employeename (getinputvalue "upd_employeename")
-   :date (getinputvalue "upd_date")
-   :location (getinputvalue "upd_location")})
-
 (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 document-update-template [id dmt]
-  [:div.form-group {:id "update" :class "form-group"}
-   [:div [:input {:type "hidden" :value id :id "id"}]]
-   [:div (input "Documentname" :text :upd_documentname (.-documentname dmt))]
-   [:div (input "Title" :text :upd_title (.-title dmt))]
-   [:div (input "EmployeeName" :text :upd_employeename (.-employeename dmt))]
-   [:div (input "Date":Date :upd_date  (f/unparse (f/formatter "yyyy-MM-dd")(f/parse (.-date dmt))))]
-   [:div (input "Location":text :upd_location (.-location dmt))]
-   [:input {:type "button" :value "Save"
-            :class "btn btn-primary" :on-click docupdate}]
-   [:input {:type "button" :value "Cancel"
-            :class "btn btn-primary" :on-click cancel}]])
+;; (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]

         [:span {:class span-class}]
         [input-element id ttype data-set placeholder input-focus]]
        (if (or @input-focus @focus)
          (if (= nil (validator @data-set))
            [:div]
            [:div {:style  {:color "red"}}
             [:b
              (str (first ((validator @data-set) id)))]]  )
          [:div])]])))


(defn submit-login [data-set focus]
  (if (= nil (validator @data-set))
    (let [onresp (fn [json] (if (= (get-status json) 200) ((set-key-value :user (getdata json))
                                                          (secretary/dispatch! "/documents"))))]
      (http-post "http://localhost:8193/user/authenticate"
                 onresp (.serialize (Serializer.)
                                    (clj->js {:email (getinputvalue "username-email")
                                              :password (getinputvalue "password")} ))))
    (reset! focus "yes")))

(defn button [value ttype data-set focus]
  [:div.form-group
   [:div.col-md-6
    [:button.btn.btn-primary {:type ttype
                              :on-click #(submit-login data-set focus)} value]]])

(defn login []
  (let [my-data (r/atom  {})

  (xhr/send url callback "DELETE"  (structs/Map. (clj->js {:Content-Type "application/json"}))))


;; =====================================================================================================
;; login-form with validations
;; =====================================================================================================

(defn login-validator [data-set]
  (first (b/validate data-set
                     :email [[v/required :message "Filed is required"]
                             [v/email :message "Enter valid email-id"]]
                     :password [[v/required :message "Filed is required"]
                                [v/string  :message "Enter valid password"]])))

