fixing vendors
This commit is contained in:
@@ -45,11 +45,11 @@
|
||||
[:id :name :code :email :locations [: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-account [:name :id :location]] [:primary-contact [:name :phone :email :id]] [:secondary-contact [:id :name :phone :email]] :print-as :invoice-reminder-schedule :code]]
|
||||
[:id :name :hidden [:default-account [:name :id :location]] [:primary-contact [:name :phone :email :id]] [:secondary-contact [:id :name :phone :email]] :print-as :invoice-reminder-schedule :code]]
|
||||
[:accounts [:numeric-code :location :name :type :account_set :id]]]}
|
||||
:on-success [::received-initial]}}))))
|
||||
(def vendor-query
|
||||
[:id :name [:default-account [:name :id :location]]
|
||||
[:id :name :hidden [:default-account [:name :id :location]]
|
||||
[:primary-contact [:name :phone :email :id]]
|
||||
[:secondary-contact [:id :name :phone :email]]
|
||||
:print-as :invoice-reminder-schedule :code
|
||||
@@ -67,7 +67,7 @@
|
||||
:query-obj {:venia/queries [[:client
|
||||
[:id :name :code [: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-account [:name :id :location]] [:primary-contact [:name :phone :email :id]] [:secondary-contact [:id :name :phone :email]] :print-as :invoice-reminder-schedule :code]]
|
||||
[:id :name :hidden [:default-account [:name :id :location]] [:primary-contact [:name :phone :email :id]] [:secondary-contact [:id :name :phone :email]] :print-as :invoice-reminder-schedule :code]]
|
||||
[:accounts [:numeric-code :name :location :type :account_set :id]]]}
|
||||
|
||||
:on-success [::received-initial]}
|
||||
@@ -221,6 +221,14 @@
|
||||
vendor-query]}]}
|
||||
:on-success [::save-complete]
|
||||
:on-error [::save-error]}))))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::save-error
|
||||
(fn [db [_ vendor]]
|
||||
(-> db
|
||||
(assoc-in [:modal-state :auto-ap.views.main/user-editing-vendor :error] true)
|
||||
(assoc-in [:modal-state :auto-ap.views.main/user-editing-vendor :saving?] false))))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::save-complete
|
||||
(fn [{:keys [db]} [_ vendor]]
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
(re-frame/reg-event-db
|
||||
::save-error
|
||||
(fn [db [_ vendor]]
|
||||
(println "ERROR?")
|
||||
(-> db
|
||||
(assoc-in [:admin :vendor :error] true)
|
||||
(assoc-in [:admin :vendor :saving?] false))))
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
(re-frame/reg-sub
|
||||
::vendors
|
||||
(fn [db]
|
||||
(vals (:vendors db))))
|
||||
(filter #(not (:hidden %)) (vals (:vendors db)))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::vendors-by-id
|
||||
@@ -128,7 +128,11 @@
|
||||
(re-frame/reg-sub
|
||||
::user-editing-vendor
|
||||
(fn [db]
|
||||
(-> db :user-editing-vendor)))
|
||||
(update (-> db :user-editing-vendor)
|
||||
:hidden
|
||||
#(if (nil? %)
|
||||
false
|
||||
%))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::user
|
||||
|
||||
@@ -45,6 +45,17 @@
|
||||
:spec ::entity/print-as
|
||||
:event change-event
|
||||
:subscription vendor}]]]]
|
||||
|
||||
[horizontal-field
|
||||
[:label.label "Hidden"]
|
||||
[:div.control
|
||||
[bind-field
|
||||
[:input {:type "checkbox"
|
||||
:field :hidden
|
||||
:spec ::entity/hidden
|
||||
:event change-event
|
||||
:subscription vendor}]]]]
|
||||
|
||||
[:h2.subtitle "Expense Accounts"]
|
||||
[horizontal-field
|
||||
[:label.label "Default"]
|
||||
|
||||
Reference in New Issue
Block a user