le boulanger, others.
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
:graphql {:token token
|
||||
:query-obj {:venia/queries [[:client
|
||||
|
||||
[:id :name :code :email :locations [:location-matches [:location :match]] [:bank-accounts [:id :code :number :bank-name :bank-code :check-number :name :routing :type :sort-order :visible :yodlee-account-id] ]
|
||||
[:id :name :code :email :matches :locations [:location-matches [:location :match]] [:bank-accounts [:id :code :number :bank-name :bank-code :check-number :name :routing :type :sort-order :visible :yodlee-account-id] ]
|
||||
[:address [:street1 :street2 :city :state :zip]]]]
|
||||
[:vendor
|
||||
[:id :name :default-expense-account [:primary-contact [:name :phone :email :id]] [:secondary-contact [:id :name :phone :email]] :print-as :invoice-reminder-schedule :code]]]}
|
||||
@@ -65,7 +65,7 @@
|
||||
(fn [{:keys [db]} [_ token user]]
|
||||
{:graphql {:token token
|
||||
:query-obj {:venia/queries [[:client
|
||||
[:id :name :code [:location-matches [:location :match]] [:address [:street1 :street2 :city :state :zip]] [:bank-accounts [:id :code :number :bank-name :bank-code :check-number :name :routing :type :sort-order :visible :yodlee-account-id] ]]]
|
||||
[:id :name :code :matches :locations [:location-matches [:location :match]] [:address [:street1 :street2 :city :state :zip]] [:bank-accounts [:id :code :number :bank-name :bank-code :check-number :name :routing :type :sort-order :visible :yodlee-account-id] ]]]
|
||||
[:vendor
|
||||
[:id :name :default-expense-account [:primary-contact [:name :phone :email :id]] [:secondary-contact [:id :name :phone :email]] :print-as :invoice-reminder-schedule :code]]]}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
:code (:code new-client-data) ;; TODO add validation can't change
|
||||
:email (:email new-client-data)
|
||||
:locations (:locations new-client-data)
|
||||
:matches (vec (:matches new-client-data))
|
||||
:location-matches (:location-matches new-client-data)
|
||||
:address {:street1 (:street1 (:address new-client-data))
|
||||
:street2 (:street2 (:address new-client-data)),
|
||||
@@ -87,7 +88,7 @@
|
||||
:operation/name "EditClient"}
|
||||
:venia/queries [{:query/data [:edit-client
|
||||
{:edit-client new-client-req}
|
||||
[:id :name :code :email :locations [:location-matches [:location :match]] [:address [:street1 :street2 :city :state :zip]] [:bank-accounts [:id :number :check-number :name :code :bank-code :bank-name :routing :type :visible :yodlee-account-id :sort-order]]]]}]}
|
||||
[:id :name :code :email :locations :matches [:location-matches [:location :match]] [:address [:street1 :street2 :city :state :zip]] [:bank-accounts [:id :number :check-number :name :code :bank-code :bank-name :routing :type :visible :yodlee-account-id :sort-order]]]]}]}
|
||||
:on-success [::save-complete]
|
||||
:on-error [::forms/save-error ::new-client]}}
|
||||
{:db new-client-form}))))
|
||||
@@ -113,6 +114,23 @@
|
||||
(update :locations conj (:location client))
|
||||
(dissoc :location))))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::add-new-match
|
||||
[(forms/in-form ::new-client) (re-frame/path [:data])]
|
||||
(fn [client _]
|
||||
(-> client
|
||||
(update :matches conj (:match client))
|
||||
(update :matches set)
|
||||
(dissoc :match))))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::remove-match
|
||||
[(forms/in-form ::new-client) (re-frame/path [:data])]
|
||||
(fn [client [_ which]]
|
||||
(-> client
|
||||
(update :matches set)
|
||||
(update :matches disj which))))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::add-new-location-match
|
||||
[(forms/in-form ::new-client) (re-frame/path [:data])]
|
||||
@@ -378,6 +396,22 @@
|
||||
:spec ::entity/email
|
||||
:event change-event
|
||||
:subscription new-client}]]]]
|
||||
[:div.field
|
||||
[:p.help "Matches"]
|
||||
[:div.control
|
||||
[:div.field.has-addons
|
||||
[:p.control
|
||||
[bind-field
|
||||
[:input.input {:type "text"
|
||||
:field :match
|
||||
:event change-event
|
||||
:subscription new-client}]]]
|
||||
[:p.control [:button.button.is-primary {:on-click (dispatch-event [::add-new-match])} "Add"]]]]
|
||||
[:ul
|
||||
(for [match (:matches new-client)]
|
||||
^{:key match} [:li match [:a {:on-click (dispatch-event [::remove-match match])} [:span.icon [:span.fa.fa-times]]]])]]
|
||||
|
||||
|
||||
|
||||
[:div.field
|
||||
[:p.help "Locations"]
|
||||
|
||||
Reference in New Issue
Block a user