working on calendar.

This commit is contained in:
Bryce Covert
2018-05-28 11:55:26 -07:00
parent fe4859d2e5
commit d38059cb1d
9 changed files with 680 additions and 7 deletions

View File

@@ -74,6 +74,7 @@
(re-frame/reg-event-db
::change-form
(fn [db [_ location field value]]
(println field value)
(assoc-in db (into location field) value)))
(re-frame/reg-event-db

View File

@@ -13,7 +13,8 @@
[auto-ap.views.components.modal :refer [modal action-modal]]
[auto-ap.views.components.typeahead :refer [typeahead]]
[auto-ap.subs :as subs]
[auto-ap.events :as events]))
[auto-ap.events :as events]
[bulma-calendar.core :as bc]))
(re-frame/reg-sub
::invoice-page
@@ -265,6 +266,15 @@
:max outstanding-balance
:step "0.01"}]]]]]])]]])))
(defn my-date [props]
(let [cal (r/atom nil)]
(r/create-class
{:component-did-mount (fn [this]
(reset! cal (new bc (r/dom-node this) (clj->js {:overlay false :dateFormat "mm/dd/yyyy"} )))
nil)
:reagent-render (fn [props]
[:input.input (merge props {:on-blur (fn [] (js/setTimeout 100 #(.hide @cal)) )}) ])})))
(defn new-invoice-modal []
@@ -275,6 +285,7 @@
:action-text "Create"
:save-event [::create-invoice]
:can-submit? (s/valid? ::invoice/invoice data)}
[horizontal-field
[:label.label "Vendor"]
[bind-field
@@ -286,13 +297,14 @@
:subscription data}]]]
[horizontal-field
[:label.label "Date"]
[bind-field
[:input.input {:type "text"
:field [:date]
:event change-event
:spec ::invoice/date
:subscription data}]]]
[bind-field
[my-date {:type "text"
:field [:date]
:event change-event
:spec ::invoice/date
:subscription data}]]]
[horizontal-field
[:label.label "Company"]
[bind-field