makes it possible to add new vendors.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -10,6 +10,7 @@
|
||||
[auto-ap.routes.utils
|
||||
:refer [wrap-client-redirect-unauthenticated]]
|
||||
[auto-ap.rule-matching :as rm]
|
||||
[auto-ap.client-routes :as client-routes]
|
||||
[auto-ap.solr :as solr]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.common-handlers :refer [add-new-entity-handler]]
|
||||
@@ -229,6 +230,14 @@
|
||||
:value (fc/field-value)
|
||||
:content-fn (fn [c] (pull-attr (dc/db conn) :vendor/name c))
|
||||
:x-model "vendorId"})]))
|
||||
[:div.mb-4
|
||||
[:span.text-sm.text-gray-500 "Can't find the vendor? "
|
||||
(com/link {:href (bidi.bidi/path-for
|
||||
client-routes/routes
|
||||
:new-vendor)
|
||||
:target "new"}
|
||||
"Add new vendor")
|
||||
" in a new window, then return here."]]
|
||||
|
||||
|
||||
[:div.flex.items-center.gap-2
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"needs-activation" :needs-activation
|
||||
"payments/" :payments
|
||||
"admin/" {"vendors" :admin-vendors}
|
||||
"vendor/" {"new" :new-vendor}
|
||||
"invoices/" {"" :invoices
|
||||
"import" :import-invoices
|
||||
"unpaid" :unpaid-invoices
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
[auto-ap.views.pages.ledger.profit-and-loss-detail :refer [profit-and-loss-detail-page]]
|
||||
[auto-ap.views.pages.login :refer [login-page]]
|
||||
[auto-ap.views.pages.payments :refer [payments-page]]
|
||||
[auto-ap.views.pages.home :refer [home-page]]))
|
||||
[auto-ap.views.pages.home :refer [home-page home-page-with-vendor]]))
|
||||
|
||||
(defmulti page (fn [active-page] active-page))
|
||||
(defmethod page :unpaid-invoices [_]
|
||||
@@ -94,6 +94,10 @@
|
||||
(defmethod page :index [_]
|
||||
(home-page))
|
||||
|
||||
(defmethod page :new-vendor [_]
|
||||
(home-page-with-vendor))
|
||||
|
||||
|
||||
(defmethod page :login [_]
|
||||
[login-page])
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
(:require [auto-ap.routes :as routes]
|
||||
[auto-ap.subs :as subs]
|
||||
[auto-ap.views.components.grid :as grid]
|
||||
[auto-ap.permissions :as p]
|
||||
[auto-ap.views.components.layouts :refer [side-bar-layout]]
|
||||
[auto-ap.views.components.vendor-dialog :as vendor-dialog]
|
||||
[auto-ap.history :refer [history]]
|
||||
[cemerick.url :as url]
|
||||
[auto-ap.views.utils
|
||||
@@ -42,8 +44,7 @@
|
||||
:inner-radius 20}
|
||||
(map (fn [_ y]
|
||||
^{:key y}
|
||||
[cell {:key y :fill (colors y)}]) data (range))
|
||||
]
|
||||
[cell {:key y :fill (colors y)}]) data (range))]
|
||||
[tool-tip]
|
||||
[legend]])
|
||||
|
||||
@@ -58,8 +59,7 @@
|
||||
|
||||
(defn make-cash-flow-chart [{:keys [width height data]}]
|
||||
(let [redirect-fn (fn [x]
|
||||
(pushy/set-token! history (str (bidi/path-for routes/routes :unpaid-invoices) "?" (get (js->clj x) "query-params")))
|
||||
)]
|
||||
(pushy/set-token! history (str (bidi/path-for routes/routes :unpaid-invoices) "?" (get (js->clj x) "query-params"))))]
|
||||
[bar-chart {:width width :height height :data data :fill "#FFFFFF" :stackOffset "sign"}
|
||||
[tool-tip]
|
||||
[bar {:dataKey "effective-balance" :fill (get colors 1) :stackId "a" :name "Effective Balance"
|
||||
@@ -74,8 +74,7 @@
|
||||
:on-click redirect-fn}]
|
||||
[x-axis {:dataKey "name"}]
|
||||
[y-axis]
|
||||
[legend]])
|
||||
)
|
||||
[legend]]))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::received
|
||||
@@ -300,16 +299,14 @@
|
||||
"Due ")
|
||||
type]
|
||||
[grid/cell {} name]
|
||||
[grid/cell {:class "has-text-right"} (->$ amount)]
|
||||
])]]]))
|
||||
[grid/cell {:class "has-text-right"} (->$ amount)]])]]]))
|
||||
|
||||
(defn home-content []
|
||||
(let [client-id (-> @(re-frame/subscribe [::subs/client]) :id)
|
||||
chart-options @(re-frame/subscribe [::chart-options])
|
||||
state @(re-frame/subscribe [::status/single ::page])]
|
||||
^{:key client-id}
|
||||
[side-bar-layout {:side-bar [:div
|
||||
]
|
||||
[side-bar-layout {:side-bar [:div]
|
||||
:main [:div [:h1.title "Home"]
|
||||
(if client-id
|
||||
(if (= :loading (:state state))
|
||||
@@ -360,4 +357,16 @@
|
||||
(defn home-page []
|
||||
(let [client-id (-> @(re-frame/subscribe [::subs/client]) :id)]
|
||||
(re-frame/dispatch [::mounted])
|
||||
^{:key client-id} [home-content]))
|
||||
|
||||
(defn home-page-with-vendor []
|
||||
(let [client-id (-> @(re-frame/subscribe [::subs/client]) :id)
|
||||
user @(re-frame/subscribe [::subs/user])]
|
||||
(re-frame/dispatch [::mounted])
|
||||
(when (p/can? user {:subject :vendor
|
||||
:activity :create})
|
||||
(re-frame/dispatch [::vendor-dialog/started {}]))
|
||||
|
||||
|
||||
|
||||
^{:key client-id} [home-content]))
|
||||
|
||||
Reference in New Issue
Block a user