New vendor everywhere

This commit is contained in:
Bryce Covert
2019-05-17 22:02:26 -07:00
parent 598c58a6bd
commit 9396bbb7eb
7 changed files with 27 additions and 34 deletions

View File

@@ -45,8 +45,4 @@
[:span {:class "name"} "Import Invoices"]]])]]
[:div
rest]
[:div {:class "compose has-text-centered"}
[:a {:class "button is-primary is-outlined is-block is-bold"
:on-click (dispatch-event [::events/modal-status :auto-ap.views.main/user-editing-vendor {:visible? true}])}
[:span "New Vendor"]]]]))
rest]]))

View File

@@ -8,6 +8,7 @@
[auto-ap.subs :as subs]
[auto-ap.events :as events]
[auto-ap.views.utils :refer [active-when active-when= login-url dispatch-event appearing css-transition-group]]
[auto-ap.views.components.vendor-dialog :refer [vendor-dialog]]
[auto-ap.views.components.vendor-dialog :refer [vendor-dialog]]))
@@ -20,12 +21,12 @@
(fn [children]
children)})))
(defn navbar-drop-down [{:keys [ header id]} child]
(defn navbar-drop-down [{:keys [ header id class]} child]
(let [menu-active? (re-frame/subscribe [::subs/menu-active? id])]
(reagent/create-class
{:reagent-render (fn [{:keys [header id]} child]
(let [menu-active? @(re-frame/subscribe [::subs/menu-active? id])]
[:div { :class (str "navbar-item has-dropdown " (when menu-active? "is-active"))}
[:div { :class (str "navbar-item has-dropdown " (when menu-active? "is-active " ) " " class)}
[:a {:class "navbar-link login" :on-click (fn [e]
(.preventDefault e)
(.stopPropagation e)
@@ -82,6 +83,12 @@
[:span]
[:span]]
[:div.navbar-end
[:div.navbar-item
[:a.button.is-primary.is-outlined
{:on-click (dispatch-event [::events/modal-status :auto-ap.views.main/user-editing-vendor {:visible? true}])}
[:span.icon [:i.fa.fa-plus] ] [:span "Vendor"]]]
(when (> (count @clients) 1)
[navbar-drop-down {:header (str "Client: " (if @client (:name @client)
"All"))
@@ -89,8 +96,7 @@
[:div
[:a {:class "navbar-item"
:on-click (fn []
(re-frame/dispatch [::events/swap-client nil]))
} "Allo" ]
(re-frame/dispatch [::events/swap-client nil]))} "All" ]
[:hr {:class "navbar-divider"}]
(for [{:keys [name id] :as client} @clients]
^{:key id }
@@ -133,7 +139,11 @@
right-side-bar)
]
#_[footer]
bottom
[:div
[vendor-dialog {:vendor @(re-frame/subscribe [::subs/user-editing-vendor])
:save-event [::events/save-vendor]
:change-event [::events/change-nested-form-state [:user-editing-vendor]] :id :auto-ap.views.main/user-editing-vendor}]
bottom]
[:div#dz-hidden]]))