 (def jquery (js* "$"))
 (defonce app-state (atom  {:leavetypes [] :leavecode "请选择"} ))
 
+(defn leaves-to-map [leave]
+  (let [     
+      newdata {(keyword (get leave "leavecode")) leave }
+    ]
+    newdata
+  )
+)
+
+(defn leaves-to-leavecodes [leave]
+  (let [     
+      newdata {:leavecode (get leave "leavecode") :name (get leave "name") }
+    ]
+    newdata
+  )
+  
+)
 
 (defn OnGetLeaveTypes [response]
-
-   (swap! app-state assoc :leavetypes  response)
-
-   (.log js/console (:leavetypes @app-state)) 
+  ( let [ 
+    newdata (map leaves-to-map response)
+    leavecodes (map leaves-to-leavecodes response)
+  ]
+     
+     
+     (swap! app-state assoc :leavetypes  (into {} newdata) )
+     (swap! app-state assoc :leavecodes leavecodes) 
+  )
+   
+
+   ;(.log js/console (:leavetypes @app-state)) 
 
 )
 

  )
)


(defn alertselected [event]
   ;(js/alert (str event  "ClojureScript says 'Boo!'" ))
  (swap! app-state assoc :leavecode  event)

  (jquery

            [ajax.core :refer [GET POST]]
            [clojure.string :as str]
            [om-bootstrap.button :as b]
            [om-bootstrap.panel :as p]
            
  )
  (:import goog.History)
)
