permissions

This commit is contained in:
2024-04-03 20:19:10 -07:00
parent dfccbf35cd
commit 543c09118a

View File

@@ -100,44 +100,50 @@
:href "/"} :href "/"}
"Dashboard")] "Dashboard")]
(menu-button- {"@click.prevent" "if (selected == 'invoices') {selected = null } else { selected = 'invoices'} " (when (can? (:identity request)
:icon svg/accounting-invoice-mail} {:subject :invoice-page})
"Invoices") (list
(sub-menu- (menu-button- {"@click.prevent" "if (selected == 'invoices') {selected = null } else { selected = 'invoices'} "
{:selector "invoices" :icon svg/accounting-invoice-mail}
:active? (= "invoices" selected)} "Invoices")
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes (sub-menu-
::invoice-route/all-page) {:selector "invoices"
{:date-range "month"}) :active? (= "invoices" selected)}
:active? (= ::invoice-route/all-page (:matched-route request)) (menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
:hx-boost "true"} ::invoice-route/all-page)
{:date-range "month"})
:active? (= ::invoice-route/all-page (:matched-route request))
:hx-boost "true"}
"All") "All")
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes (menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::invoice-route/paid-page) ::invoice-route/paid-page)
{:date-range "month"}) {:date-range "month"})
:active? (= ::invoice-route/paid-page (:matched-route request)) :active? (= ::invoice-route/paid-page (:matched-route request))
:hx-boost "true"} :hx-boost "true"}
"Paid") "Paid")
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes (menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::invoice-route/unpaid-page) ::invoice-route/unpaid-page)
{:date-range "month"}) {:date-range "month"})
:active? (= ::invoice-route/unpaid-page (:matched-route request)) :active? (= ::invoice-route/unpaid-page (:matched-route request))
:hx-boost "true"} :hx-boost "true"}
"Unpaid") "Unpaid")
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes (menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::invoice-route/voided-page) ::invoice-route/voided-page)
{:date-range "month"}) {:date-range "month"})
:active? (= ::invoice-route/voided-page (:matched-route request)) :active? (= ::invoice-route/voided-page (:matched-route request))
:hx-boost "true"} :hx-boost "true"}
"Voided") "Voided")
(menu-button- {:href (bidi/path-for client-routes/routes (menu-button- {:href (bidi/path-for client-routes/routes
:import-invoices)} "Import") :import-invoices)} "Import")
#_(menu-button- {:href (bidi/path-for ssr-routes/only-routes (when (can? (:identity request)
::oi-routes/new) {:subject :ar-invoice
:active? (= ::oi-routes/new (:matched-route request)) :activity :read})
:hx-boost "true"} (menu-button- {:href (bidi/path-for ssr-routes/only-routes
"Create outgoing")) ::oi-routes/new)
:active? (= ::oi-routes/new (:matched-route request))
:hx-boost "true"}
"Create outgoing")))))
(when (when
(can? (:identity request) {:subject :sales :activity :read}) (can? (:identity request) {:subject :sales :activity :read})