          [:span {:class span-class}]
          [input-element id ttype data-set placeholder input-focus]]
         (if (or @input-focus @focus)
-          (if (= nil (validator @data-set))
+          (if (= nil (login-validator @data-set))
             [:div]
-            [:div {:style  {:color "red"}}
-             [:b
-              (str (first ((validator @data-set) id)))]]  )
+            [:div {:style  {:color "red"}} [:b (str (first ((login-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"))))]
+  (if (= nil (login-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")} ))))
+                 onresp (.serialize (Serializer.) (clj->js @data-set ))))
     (reset! focus "yes")))
 
-(defn button [value ttype data-set focus]
+(defn sign-in-button [data-set focus]
   [:div.form-group
    [:div.col-md-6
-    [:button.btn.btn-primary {:type ttype
-                              :on-click #(submit-login data-set focus)} value]]])
+    [:button.btn.btn-primary {:type "button"
+                              :on-click #(submit-login data-set focus)} "Sign-in"]]])
 
 (defn login []
   (let [my-data (r/atom  {})

                                                                      (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 delete[id]
  (let [onres (fn [json]



(defroute documents-path "/documents/add" []
  (set-page! [document-template1]))

(defroute documents-path1 "/documents/update/:id" [id]
  (set-page! [document-update-template1 id
              (first (filter (fn[obj]
                               (=(.-id obj) (.parseInt js/window id))) (get-value! :documents)))]))

