Created
August 20, 2015 22:31
-
-
Save rwillig/e5f8fb5d3e65194be66e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defelem solution-form [{:keys [depots mappings] :as attr} kids] | |
(let [current-solution (cell nil) | |
prop (cell {:files nil}) | |
solution-schema {:id nil :label nil :depot nil :mapping nil :file nil :files nil}] | |
(form/with-form [{:keys [data error state exception loading] :as form-machine} | |
(workflow/form-machine | |
:current current-solution | |
:action (fn [& x] (.log js/console (clj->js x))) | |
:schema solution-schema | |
:success #(.log js/console "Success!"))] | |
(form :class "m-t" :role "form" | |
:submit #(let [q (js/jQuery "#problem-orders") | |
e (aget q 0)] | |
(do (reset! (:files data) (.-files e)) (workflow/submit form-machine))) | |
(form/with-field :label | |
(div :class "form-group" (form/text-input :placeholder "describe this file" :id "problem-description"))) | |
(form/with-field :depot (div :class "form-group" | |
(form/select :class "form-control m-b" :id "problem-depot" | |
(option :value "" "choose a depot") | |
(loop-tpl :bindings [[i {:keys [id label]}] (cell= (map-indexed vector depots))] | |
(option :value id :text label))))) | |
(form/with-field :mapping (div :class "form-group" | |
(form/select :class "form-control m-b" :id "problem-mapping" | |
(option :value "" "choose a tenplate") | |
(loop-tpl :bindings [[i {:keys [id label]}] (cell= (map-indexed vector mappings))] | |
(option :value id :text label))))) | |
(form/with-field :file | |
(div :class "form-group" | |
(form/file-input :id "problem-orders"))) | |
(button :type "submit" :class "btn btn-primary" "Submit"))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment