added suggestions
This commit is contained in:
@@ -18,8 +18,7 @@
|
||||
[auto-ap.views.utils
|
||||
:refer [dispatch-event str->int with-is-admin? with-user]]
|
||||
[malli.core :as m]
|
||||
[re-frame.core :as re-frame]
|
||||
[reagent.core :as r]))
|
||||
[re-frame.core :as re-frame]))
|
||||
|
||||
;; Remaining cleanup todos:
|
||||
;; test minification
|
||||
@@ -131,11 +130,6 @@
|
||||
{:dispatch-n [[::forms/attempted-submit ::vendor-form]
|
||||
[::status/error ::vendor-form [{:message "Please fix the errors and try again."}]]]})))
|
||||
|
||||
(defn pull-left []
|
||||
(into [:div {:style {:position "relative"
|
||||
:left "-40px"}}]
|
||||
(r/children (r/current-component))))
|
||||
|
||||
(defn contact-field [{:keys [name field]}]
|
||||
[form-builder/with-scope {:scope field}
|
||||
[form-builder/vertical-control
|
||||
|
||||
@@ -22,11 +22,6 @@
|
||||
(fn [db]
|
||||
(::users db)))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::params-change
|
||||
(fn [_ [_ params]]
|
||||
{:set-uri-params params}))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::page
|
||||
:<- [::params]
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
(ns auto-ap.views.pages.admin.vendors.table
|
||||
(:require
|
||||
[auto-ap.subs :as subs]
|
||||
[auto-ap.views.components.buttons :as buttons]
|
||||
[auto-ap.views.components.grid :as grid]
|
||||
[auto-ap.views.components.vendor-dialog :as vendor-dialog]
|
||||
@@ -9,10 +8,7 @@
|
||||
[re-frame.core :as re-frame]))
|
||||
|
||||
(defn vendors-table [{:keys [data-page]}]
|
||||
(let [{:keys [data]} @(re-frame/subscribe [::data-page/page data-page])
|
||||
accounts @(re-frame/subscribe [::subs/all-accounts-by-id])]
|
||||
(println "DATA COUNT" (keys data))
|
||||
|
||||
(let [{:keys [data]} @(re-frame/subscribe [::data-page/page data-page])]
|
||||
[grid/grid {:data-page data-page
|
||||
:column-count 4}
|
||||
[grid/controls data]
|
||||
@@ -33,7 +29,7 @@
|
||||
[:div.mx-2.tag.is-info.is-light total-usage " usages, " (count (:usage v)) " clients" ]
|
||||
[:div.mx-2.tag.is-warning.is-light "Unused"]))]
|
||||
[grid/cell {} (:email (:primary-contact v))]
|
||||
[grid/cell {} (-> v :default-account :id accounts :name)]
|
||||
[grid/cell {} (-> v :default-account :name)]
|
||||
[grid/cell {}
|
||||
[buttons/fa-icon {:event [::vendor-dialog/started v]
|
||||
:icon "fa-pencil"}]]])]]]))
|
||||
|
||||
@@ -30,12 +30,6 @@
|
||||
(fn [table-params]
|
||||
table-params))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::plaid-items
|
||||
(fn [db]
|
||||
(::plaid-items db)))
|
||||
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::data-requested
|
||||
(fn [{:keys [db]} [_ params]]
|
||||
@@ -119,11 +113,6 @@
|
||||
(-> db
|
||||
(assoc-in [::link-token] (:token (:plaid-link-token link-token))))))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::received
|
||||
(fn [db [_ d]]
|
||||
(assoc-in db [::plaid-items] (:plaid-item-page d))))
|
||||
|
||||
|
||||
(defn plaid-item-table []
|
||||
[table/table {:data-page ::page
|
||||
|
||||
@@ -127,9 +127,6 @@
|
||||
:filters filters
|
||||
:table-params table-params}))
|
||||
|
||||
(defn in-page-entities [which]
|
||||
(re-frame/path [::data which :data ] ))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::table-params-changed
|
||||
(fn [{:keys [db]} [_ which params]]
|
||||
|
||||
@@ -151,16 +151,6 @@
|
||||
[]]]}
|
||||
:on-success [::invalidated]}}))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::approve-invoices
|
||||
(fn [cofx [_ on-success]]
|
||||
{:http {:method :post
|
||||
:token (-> cofx :db :user)
|
||||
:uri (str "/api/invoices/approve"
|
||||
(when-let [client-id (:id @(re-frame/subscribe [::subs/client]))]
|
||||
(str "?client=" client-id)))
|
||||
:on-success on-success}}))
|
||||
|
||||
(defn approve-reject-button [checked]
|
||||
[:div.buttons
|
||||
[:button.button.is-primary {:on-click (dispatch-event [::approve-invoices-clicked checked])
|
||||
|
||||
@@ -18,16 +18,8 @@
|
||||
[auto-ap.events :as events]
|
||||
[vimsical.re-frame.cofx.inject :as inject]
|
||||
[auto-ap.forms.builder :as form-builder]
|
||||
[malli.core :as m]
|
||||
[auto-ap.schema :as schema]
|
||||
[auto-ap.views.components :as com]))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::can-submit
|
||||
:<- [::forms/form ::form]
|
||||
(fn [{ {:keys []} :data}]
|
||||
true))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::coded
|
||||
(fn [_ [_ _ _]]
|
||||
@@ -107,15 +99,10 @@
|
||||
{::track/dispose {:id ::vendor-change}}))
|
||||
|
||||
|
||||
(def bulk-update-schema
|
||||
(m/schema
|
||||
[:map
|
||||
[:vendor schema/reference]]))
|
||||
(defn form-content [_]
|
||||
(let [{:keys [data]} @(re-frame/subscribe [::forms/form ::form])]
|
||||
[form-builder/builder {:submit-event [::code-selected]
|
||||
:change-event [::changed]
|
||||
:can-submit [::can-submit]
|
||||
:id ::form}
|
||||
|
||||
|
||||
|
||||
@@ -10,12 +10,6 @@
|
||||
[malli.core :as m]
|
||||
[re-frame.core :as re-frame]))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::can-submit
|
||||
:<- [::forms/form ::form]
|
||||
(fn [{ {:keys [data]} :data}]
|
||||
(not-empty data)))
|
||||
|
||||
(def schema
|
||||
(m/schema [:map [:data schema/not-empty-string]]))
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
|
||||
(def date-regex #"[2]{1}[0-9]{3}-[0-9]{1,2}-[0-9]{1,2}")
|
||||
(def money-regex #"\-?[0-9]+(\.[0-9]{2})?$")
|
||||
|
||||
(def nff
|
||||
(NumberFormat. Format/CURRENCY))
|
||||
@@ -54,9 +53,6 @@
|
||||
|
||||
))
|
||||
|
||||
(defn active-when= [active-page candidate]
|
||||
(when (= active-page candidate) " is-active"))
|
||||
|
||||
(defn active-when [active-page f & rest]
|
||||
|
||||
(when (apply f (into [active-page] rest)) " is-active"))
|
||||
@@ -72,12 +68,6 @@
|
||||
(re-frame/dispatch (conj event (.. e -target -value)))))
|
||||
|
||||
|
||||
(defn delayed-dispatch [e]
|
||||
(fn [_]
|
||||
(js/setTimeout #(re-frame/dispatch e) 151)
|
||||
false))
|
||||
|
||||
|
||||
(defn dispatch-event [event]
|
||||
(fn [e]
|
||||
(when (.-stopPropagation e)
|
||||
@@ -286,9 +276,6 @@
|
||||
(js/document.execCommand "copy")
|
||||
(.removeChild js/document.body el)))
|
||||
|
||||
(defn account->match-text [x]
|
||||
(str (:numeric-code x) " - " (:name x)))
|
||||
|
||||
(defn str->int [x]
|
||||
(cond
|
||||
(nil? x)
|
||||
|
||||
Reference in New Issue
Block a user