adding power user role.

This commit is contained in:
2021-01-26 09:52:28 -08:00
parent 20634e73ef
commit 7eeb1737ab
7 changed files with 42 additions and 17 deletions

View File

@@ -251,6 +251,13 @@
(fn [user]
(= "admin" (:user/role user))))
(re-frame/reg-sub
::is-power-user?
:<- [::user]
(fn [user]
(or (= "power-user" (:user/role user))
(= "power_user" (:user/role user)))))
(re-frame/reg-sub
::user
(fn [db]

View File

@@ -91,8 +91,9 @@
[:option {:value ":none"} "None"]
[:option {:value ":user"} "User"]
[:option {:value ":manager"} "Manager"]
[:option {:value ":power_user"} "Power User"]
[:option {:value ":admin"} "Admin"]]]]]]
(when (#{":user" ":manager"} (:role data))
(when (#{":user" ":manager" ":power_user"} (:role data))
[:div.field
[:p.help "Clients"]
[:div.control

View File

@@ -331,7 +331,9 @@
locations @(re-frame/subscribe [::subs/locations-for-client (:id (:client data))])
{:keys [form-inline form field raw-field error-notification submit-button ]} transaction-form
is-admin? @(re-frame/subscribe [::subs/is-admin?])
should-disable-for-client? (and (not is-admin?)
is-power-user? @(re-frame/subscribe [::subs/is-power-user?])
should-disable-for-client? (and (not (or is-admin? is-power-user?))
(not= :requires-feedback (:original-status data)))
is-already-matched? (:payment data)]
(form-inline {:title "Transaction"}
@@ -368,7 +370,7 @@
(when (and (:payment data)
is-admin?)
(or is-admin? is-power-user?))
[:p.notification.is-info.is-light>div.level>div.level-left
[:div.level-item "This transaction is linked to a payment "]
[:div.level-item [:button.button.is-warning {:on-click (dispatch-event [::unlink])} "Unlink"]]])
@@ -383,21 +385,21 @@
(when
(and (seq (:potential-autopay-invoices-matches data))
#_(not is-already-matched?)
is-admin?)
(or is-admin? is-power-user?))
[tab {:title "Autopay Invoices" :key :autopay-invoices}
[potential-autopay-invoices-matches-box {:potential-autopay-invoices-matches (:potential-autopay-invoices-matches data)}]])
(when
(and (seq (:potential-unpaid-invoices-matches data))
(not is-already-matched?)
is-admin?)
(or is-admin? is-power-user?))
[tab {:title "Unpaid Invoices" :key :unpaid-invoices}
[potential-unpaid-invoices-matches-box {:potential-unpaid-invoices-matches (:potential-unpaid-invoices-matches data)}]])
(when
(and (seq (:potential-payment-matches data))
(not is-already-matched?)
)
(or is-admin? is-power-user?))
[tab {:title "Payment" :key :payment}
[potential-payment-matches-box {:potential-payment-matches (:potential-payment-matches data)}]])