          [: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  {})

        [:div.panel-heading
         [:h2 "Log-in"]]
        [:div.panel-body
         [input-validate :username-email "Email"  "input-group-addon glyphicon glyphicon-user" "email" my-data "Email" focus]
         [input-validate :password "Password"  "input-group-addon glyphicon glyphicon-lock" "password" my-data "password" focus]
         [button "Sign-in" "button" my-data focus ]]]])))

(defn is-authenticated? []
  (not (nil? (get-value! :user))))

                        (get-new-page-data (get-value! :documents)
                                           (get-value! :current-page))]))))

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

(defn form-validator [data-set]
  (first (b/validate data-set
                     :documentname [[v/required :message "Filed is required"]
                                    [v/string :message "Enter valid Document Name"]]
                     :title [[v/required :message "Filed is required"]
                             [v/string :message "Enter valid Title"]]
                     :employeename [[v/required :message "Filed is required"]
                                    [v/string  :message "Enter valid Employee name"]]
                     :date [[v/required :message "Filed is required"]
                            [v/datetime  :message "Enter valid Date"]]
                     :location [[v/required :message "Filed is required"]
                                [v/string  :message "Enter valid Location"]])))

(defn form-input-element [id label ttype data-set focus]
  (let [input-focus (r/atom nil)]
    (fn []
      [:div.form-group
       [:div.col-md-12
        [:div.row
         [:div.col-md-2 [:label label]]
         [:div.col-md-6 [input-element id ttype data-set label input-focus]]
         [:div.col-md-4 (if (or @input-focus @focus)
                          (if (= nil (form-validator @data-set))
                            [:div]
                            [:div {:style  {:color "red"}}
                             [:b (str (first ((form-validator @data-set) id)))]])
                          [:div])]]]] )))


(defn button [data-set focus fun value]
  [:button.btn.btn-primary {:type "button"
                            :on-click fun} value] )

(defn form-save [data-set focus]
  (if (= nil (form-validator @data-set))
    (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-post "http://localhost:8193/documents/add"
                 onres  (.serialize (Serializer.) (clj->js @data-set))))
    (reset! focus "on")))

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

(defn document-template-form [doc-name data-set focus]
  [:div#add.container
   [:div.panel.panel-primary.model-dialog
    [:div.panel-heading
     [:h2 doc-name]]
    [:div.panel-boby
     [:div.container
      [:div.form-group
       [form-input-element :documentname "Document Name" "text" data-set focus]
       [form-input-element :title "Title" "text" data-set focus ]
       [form-input-element :employeename "Employee name" "text" data-set focus]
       [form-input-element :date "Date" "date" data-set focus]
       [form-input-element :location "Location" "text" data-set focus]
       [button data-set focus #(form-save data-set focus) "Save"]
       [button data-set focus form-cancel "cancel"]]]]]])

(defn document-update-template1 [id dmt]
  (let [add-data (r/atom {:documentname (.-documentname dmt)
                          :title (.-title dmt)
                          :employeename (.-employeename dmt)
                          :date (f/unparse (f/formatter "yyyy-MM-dd")(f/parse (.-date dmt)))
                          :location (.-location dmt)})
        focus (r/atom nil)]
    (fn [] [document-template-form "Update Document" add-data focus])))

(defn document-template1 []
  (let [add-data (r/atom {})
        focus (r/atom nil)]
    (fn [] [document-template-form "New Document" add-data focus])))

;; ===============================================================================================
;; end of add-update form coding
;; ===============================================================================================



(defn get-all-click [event]
  (let [onres (fn [json]
