This commit is contained in:
2022-04-26 17:05:58 -07:00
parent cae28589d2
commit 96a796522c
7 changed files with 48 additions and 71 deletions

View File

@@ -228,7 +228,8 @@
:event [::unvoid-invoice i]}])
(when (and (get actions :void)
(= ":paid" (:status i))
(:scheduled-payment i))
(:scheduled-payment i)
(not (seq (:payments i))))
[buttons/fa-icon {:icon "fa-undo"
:class (status/class-for (get unautopay-states (:id i)))
:event [::unautopay i]}])]]]))

View File

@@ -22,30 +22,30 @@
children)})))
(defn navbar-drop-down [{:keys [ header id class]} child]
(let [menu-active? (re-frame/subscribe [::subs/menu-active? id])]
(r/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 " ) " " class)}
[:a {:class "navbar-link login" :on-click (fn [e]
(.preventDefault e)
(.stopPropagation e)
(re-frame/dispatch [::events/toggle-menu id])
true)} header]
[appearing {:visible? menu-active? :enter-class "appear" :exit-class "disappear" :timeout 200}
[:div {:class "navbar-dropdown"}
[navbar-drop-down-contents {:id id}
[:div child]]]]]))})))
(r/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 " ) " " class)}
[:a {:class "navbar-link login" :on-click (fn [e]
(.preventDefault e)
(.stopPropagation e)
(re-frame/dispatch [::events/toggle-menu id])
true)} header]
[appearing {:visible? menu-active? :enter-class "appear" :exit-class "disappear" :timeout 200}
[:div {:class "navbar-dropdown"}
[navbar-drop-down-contents {:id id}
[:div child]]]]]))}))
(defn login-dropdown []
(let [user (re-frame/subscribe [::subs/user])
menu (re-frame/subscribe [::subs/menu])]
(let [user (re-frame/subscribe [::subs/user])]
(if @user
[navbar-drop-down {:header [:span [:span.icon [:i.fa.fa-user] ]
[:span (:user/name @user)]] :id ::account}
[:div
[:a {:class "navbar-item"
:href (bidi/path-for routes/routes :reports)} "My company"]
[:a.dropdown-item {:on-click (dispatch-event-with-propagation [::vendor-dialog/started {}])} "New Vendor"]
[:a.dropdown-item {:on-click (dispatch-event-with-propagation [::vendor-dialog/edit {}])} "Edit Vendor"]
(when (= "admin" (:user/role @user))
[:a {:class "navbar-item" :href (bidi/path-for routes/routes :admin)} "Administration"])
[:hr {:class "navbar-divider"}]
@@ -131,18 +131,6 @@
(when-not is-initial-loading
[:div.navbar-end
[:div.navbar-item
[drop-down {:header [:a.button.is-outlined {:aria-haspopup true
:type "button"
:on-click (dispatch-event-with-propagation [::events/toggle-menu ::vendor ])}
"Vendors "
[:span " "]
[:span.icon [:i.fa.fa-angle-down {:aria-hidden "true"}]]]
:id ::vendor}
[:<>
[:a.dropdown-item {:on-click (dispatch-event-with-propagation [::vendor-dialog/started {}])} "New"]
[:a.dropdown-item {:on-click (dispatch-event-with-propagation [::vendor-dialog/edit {}])} "Edit"]]]]
(when (> (count @clients) 1)
[navbar-drop-down {:header (str "Company: " (if @client (:name @client)
@@ -193,8 +181,7 @@
(defn side-bar-layout [{:keys [side-bar main ap bottom right-side-bar]}]
(let [ap @(re-frame/subscribe [::subs/active-page])
client @(re-frame/subscribe [::subs/client])
is-initial-loading @(re-frame/subscribe [::subs/is-initial-loading?])]
client @(re-frame/subscribe [::subs/client])]
[:div
[modal/global-modal]
[navbar ap]