Minor fixes

This commit is contained in:
Bryce Covert
2020-09-17 22:28:53 -07:00
parent 2e18e2da26
commit 12f9982cd7
5 changed files with 66 additions and 5 deletions

View File

@@ -15,7 +15,9 @@
[cljs-time.core :as c]
[clojure.spec.alpha :as s]
[clojure.string :as str]
[re-frame.core :as re-frame]))
[re-frame.core :as re-frame]
[vimsical.re-frame.fx.track :as track]
[reagent.core :as r]))
;; SUBS
(re-frame/reg-sub
@@ -228,7 +230,20 @@
:submit-event [::saving ]
:id ::form}))
(defn form [{:keys [can-change-amount?] :as params}]
(re-frame/reg-event-fx
::mounted
(fn []
{::track/register [{:id ::client
:subscription [::subs/client]
:event-fn (fn [c]
[::changed [:client] c])}]}))
(re-frame/reg-event-fx
::unmounted
(fn []
{::track/dispose [{:id ::client}]}))
(defn form-content [{:keys [can-change-amount?] :as params}]
[layouts/side-bar {:on-close (dispatch-event [::forms/form-closing ::form ])}
(let [{:keys [data active? error id]} @(re-frame/subscribe [::forms/form ::form])
{:keys [form-inline field raw-field error-notification submit-button ]} invoice-form
@@ -349,3 +364,12 @@
(submit-button "Save")]]])
{:key id}))])
(defn form [p]
(r/create-class
{:display-name "invoice-form"
:component-did-mount #(re-frame/dispatch [::mounted])
:component-will-unmount #(re-frame/dispatch [::unmounted])
:reagent-render (fn [p]
[form-content p])}))