Adds ability for users to configure basic ezcater integration.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
(cond-> [:id :name :signature-file :code :email :matches :week-a-debits :week-a-credits :week-b-debits :week-b-credits :locations :locked-until :square-auth-token
|
||||
[:square-integration-status [:last-updated :last-attempt :message :state :id]]
|
||||
[:square-locations [:square-id :id :name :client-location]]
|
||||
[:ezcater-locations [:id [:caterer [:name :id]] :location]]
|
||||
[:emails [:id :email :description]]
|
||||
[:location-matches [:id :location :match]]
|
||||
[:bank-accounts [:id :start-date :numeric-code :code :number :bank-name :bank-code :check-number :name :routing :type :sort-order :visible :yodlee-account-id
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
[auto-ap.events :as events]
|
||||
[auto-ap.views.components.address :refer [address-field]]
|
||||
[auto-ap.views.components.typeahead :refer [typeahead-v3]]
|
||||
[auto-ap.views.components.typeahead.vendor
|
||||
:refer [search-backed-typeahead]]
|
||||
[auto-ap.views.components.layouts :refer [side-bar]]
|
||||
[auto-ap.views.utils
|
||||
:refer
|
||||
@@ -41,7 +43,7 @@
|
||||
)
|
||||
:ref (fn [i] (reset! button i))} ]])})))
|
||||
|
||||
(defn signature [{:keys [signature-file signature-data on-change]}]
|
||||
(defn signature [_]
|
||||
(let [canvas (atom nil)
|
||||
edit-mode? (r/atom false)
|
||||
w (* 1.5 464)
|
||||
@@ -94,7 +96,7 @@
|
||||
(re-frame/reg-sub
|
||||
::can-submit
|
||||
:<- [::new-client-request]
|
||||
(fn [r _]
|
||||
(fn [_ _]
|
||||
true
|
||||
|
||||
#_(s/valid? ::entity/client r)))
|
||||
@@ -115,6 +117,13 @@
|
||||
:client-location (:client-location x)})
|
||||
(:square-locations new-client-data))
|
||||
|
||||
:ezcater-locations (map
|
||||
(fn [x]
|
||||
{:id (:id x)
|
||||
:caterer (:id (:caterer x))
|
||||
:location (:location x)})
|
||||
(:ezcater-locations new-client-data))
|
||||
|
||||
:locked-until (cond (not (:locked-until new-client-data))
|
||||
nil
|
||||
|
||||
@@ -198,13 +207,12 @@
|
||||
(re-frame/reg-event-fx
|
||||
::save-new-client
|
||||
[(forms/in-form ::form)]
|
||||
(fn [{{new-client-data :data :as new-client-form} :db} _]
|
||||
(fn [_ _]
|
||||
|
||||
(let [new-client-req @(re-frame/subscribe [::new-client-request])
|
||||
user @(re-frame/subscribe [::subs/token])]
|
||||
|
||||
{:db (-> new-client-form)
|
||||
:graphql
|
||||
{:graphql
|
||||
{:token user
|
||||
:owns-state {:single ::form}
|
||||
:query-obj {:venia/operation {:operation/type :mutation
|
||||
@@ -304,8 +312,8 @@
|
||||
[])))
|
||||
|
||||
|
||||
(defn bank-account-card [new-client {:keys [active? new? type visible code name number check-number id sort-order] :as bank-account} first? last?]
|
||||
(let [{:keys [form field raw-field error-notification submit-button ]} client-form]
|
||||
(defn bank-account-card [new-client {:keys [active? new? type visible code name sort-order]} first? last?]
|
||||
(let [{:keys [field raw-field]} client-form]
|
||||
[:div.card {:style {:margin-bottom "1em"}}
|
||||
[:header.card-header
|
||||
[:div.card-header-title {:style {:text-overflow "ellipsis"}}
|
||||
@@ -692,5 +700,27 @@
|
||||
:step "0.01"}]]
|
||||
:disable-remove? true
|
||||
:disable-new? true}])]]
|
||||
|
||||
[:div.field
|
||||
[:label.label "EZCater Locations"]
|
||||
[:div.control
|
||||
(raw-field
|
||||
[multi-field {:type "multi-field"
|
||||
:field :ezcater-locations
|
||||
:template [
|
||||
[search-backed-typeahead {:search-query (fn [i]
|
||||
[:search_ezcater_caterer
|
||||
{:query i}
|
||||
[:name :id]])
|
||||
:entity->text :name
|
||||
:type "typeahead-v3"
|
||||
:field [:caterer]
|
||||
:style {:width "20em"}}]
|
||||
[:input.input {:type "text"
|
||||
:style {:width "4em"}
|
||||
:field [:location]
|
||||
:step "0.01"}]]
|
||||
:disable-remove? true}])]]
|
||||
|
||||
(error-notification)
|
||||
(submit-button "Save")])]]))
|
||||
|
||||
Reference in New Issue
Block a user