merged.
This commit is contained in:
@@ -45,7 +45,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 :locations] ]
|
||||
[: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 :locations] ]
|
||||
[:address [:street1 :street2 :city :state :zip]]]]
|
||||
[:vendor
|
||||
[: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]]
|
||||
@@ -68,7 +68,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 :locations] ]]]
|
||||
[: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 :locations] ]]]
|
||||
[:vendor
|
||||
[: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]]]}
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
{:venia/queries [[:invoice_page
|
||||
(assoc params
|
||||
:client-id (:id @(re-frame/subscribe [::subs/client])))
|
||||
[[:invoices [:id :total :outstanding-balance :invoice-number :date :status
|
||||
[[:invoices [:id :total :outstanding-balance :invoice-number :date :status :client-identifier
|
||||
[:vendor [:name :id]]
|
||||
[:expense_accounts [:amount :id :location
|
||||
[:account [:id :name :numeric-code :location ]]]]
|
||||
@@ -58,7 +58,7 @@
|
||||
:start
|
||||
:end]]]})
|
||||
|
||||
(defn invoice-table [{:keys [id invoice-page status on-params-change vendors params check-boxes checked on-check-changed on-edit-invoice on-void-invoice on-unvoid-invoice expense-event]}]
|
||||
(defn invoice-table [{:keys [id invoice-page status on-params-change vendors params check-boxes checked on-check-changed on-edit-invoice on-void-invoice on-unvoid-invoice expense-event overrides]}]
|
||||
(let [visible-checks @(re-frame/subscribe [::visible-checks])
|
||||
visible-expense-accounts @(re-frame/subscribe [::visible-expense-accounts])
|
||||
selected-client @(re-frame/subscribe [::subs/client])
|
||||
@@ -156,7 +156,9 @@
|
||||
|
||||
(on-check-changed id i)))} ]])
|
||||
(when-not selected-client
|
||||
[:td (:name client)])
|
||||
[:td (if-let [client-override (:client overrides)]
|
||||
(client-override i)
|
||||
(:name client))])
|
||||
[:td (:name vendor)]
|
||||
[:td invoice-number]
|
||||
[:td (date->str date) ]
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
::edit-client-clicked
|
||||
(fn [{:keys [db]} [_ client-id]]
|
||||
{:db (-> db
|
||||
(forms/stop-form ::new-client)
|
||||
(forms/start-form ::new-client (get (:clients db) client-id)))}))
|
||||
|
||||
(re-frame/reg-sub
|
||||
@@ -42,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 +89,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 :locations]]]]}]}
|
||||
[: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 :locations]]]]}]}
|
||||
:on-success [::save-complete]
|
||||
:on-error [::forms/save-error ::new-client]}}
|
||||
{:db new-client-form}))))
|
||||
@@ -118,6 +120,23 @@
|
||||
(update-in [:bank-accounts which-account :locations] #(conj (or % #{}) (get-in client [:bank-accounts which-account :location-select])))
|
||||
(update-in [:bank-accounts which-account] dissoc :location-select))))
|
||||
|
||||
(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])]
|
||||
@@ -126,6 +145,18 @@
|
||||
(update :location-matches conj (:location-match client))
|
||||
(dissoc :location-match))))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::remove-location-match
|
||||
[(forms/in-form ::new-client) (re-frame/path [:data])]
|
||||
(fn [client [_ i]]
|
||||
(-> client
|
||||
(update :location-matches (fn [lm]
|
||||
(->> lm
|
||||
(map vector (range))
|
||||
(filter (fn [[index item]]
|
||||
(not= index i)))
|
||||
(map second)))))))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::add-new-bank-account
|
||||
[(forms/in-form ::new-client) (re-frame/path [:data])]
|
||||
@@ -433,6 +464,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"]
|
||||
@@ -470,9 +517,11 @@
|
||||
:event change-event
|
||||
:subscription new-client}]]]
|
||||
[:p.control [:button.button.is-primary {:on-click (dispatch-event [::add-new-location-match])} "Add"]]]
|
||||
|
||||
[:ul
|
||||
(for [{:keys [location match]} (:location-matches new-client)]
|
||||
^{:key location} [:li match "->" location ])]]]
|
||||
(for [[index {:keys [location match]}] (map vector (range) (:location-matches new-client))]
|
||||
^{:key index} [:li match "->" location [:a {:on-click (dispatch-event [::remove-location-match index])} [:span.icon
|
||||
[:span.fa.fa-times]]]])]]]
|
||||
|
||||
[:div {:style {:padding-bottom "0.75em" :padding-top "0.75em"}}
|
||||
[:h2.subtitle "Address"]
|
||||
|
||||
@@ -171,6 +171,11 @@
|
||||
(if (seq (:invoices @invoice-page))
|
||||
[invoice-table {:id :approved
|
||||
:invoice-page invoice-page
|
||||
:overrides {:client (fn [row]
|
||||
[:p (:name (:client row))
|
||||
[:p [:i.is-size-7 (:client-identifier row)]]]
|
||||
|
||||
)}
|
||||
:check-boxes true
|
||||
:checked (:checked @invoice-page)
|
||||
:on-check-changed (fn [which invoice]
|
||||
|
||||
Reference in New Issue
Block a user