Accounts don't need to be loaded

This commit is contained in:
2022-04-19 13:27:47 -07:00
parent f73b406abd
commit f51f3450d6
22 changed files with 398 additions and 420 deletions

View File

@@ -12,8 +12,7 @@
[auto-ap.views.components.typeahead :refer [typeahead-v3]]
[auto-ap.views.pages.admin.vendors.common :as common]
[auto-ap.views.utils
:refer [account->match-text
bind-field
:refer [bind-field
dispatch-event
horizontal-field
with-is-admin?
@@ -87,8 +86,7 @@
:print-as print-as
:terms terms
:default-account-id (:id default-account)
:address address
:primary-contact primary-contact
:address address :primary-contact primary-contact
:secondary-contact secondary-contact
:invoice-reminder-schedule invoice-reminder-schedule}
is-admin? (assoc :hidden hidden
@@ -288,12 +286,15 @@
:default-key :default-account
:override-key :account-overrides}
(fn [field client]
[typeahead-v3 {:entities @(re-frame/subscribe [::subs/accounts client])
:entity->text account->match-text
:field field
:type "typeahead-v3"
:event change-event
:subscription data}])]
[search-backed-typeahead {:search-query (fn [i]
[:search_account
{:query i
:client-id (:id client)}
[:name :id]])
:type "typeahead-v3"
:field field
:event change-event
:subscription data}])]
[:h2.subtitle "Address"]
[address-field {:field [:address]
@@ -525,10 +526,7 @@
(update :automatically-paid-when-due #(mapv identity %))
(update :hidden #(if (nil? %)
false
%))
(update :default-account
(fn [da]
@(re-frame/subscribe [::subs/account nil (:id da)]))))))
%)))))
:dispatch [::modal/modal-requested
{:title "Vendor"
:class "is-wide"