you can now create cash payments.

This commit is contained in:
Bryce Covert
2018-07-27 16:39:44 -07:00
parent 4a0f7d7f77
commit 4069f731e9
10 changed files with 75 additions and 32 deletions

View File

@@ -37,7 +37,7 @@
:graphql {:token token
:query-obj {:venia/queries [[:company
[:id :name :locations [:bank-accounts [:id :number :check-number :name] ]]]
[:id :name :locations [:bank-accounts [:id :number :check-number :name :type] ]]]
[:vendor
[:id :name :default-expense-account :primary-contact :primary-email :primary-phone :secondary-contact :secondary-email :secondary-phone :print-as :invoice-reminder-schedule :code]]]}
@@ -53,7 +53,7 @@
(fn [{:keys [db]} [_ token user]]
{:graphql {:token token
:query-obj {:venia/queries [[:company
[:id :name [:bank-accounts [:id :number :check-number :name]]]]
[:id :name [:bank-accounts [:id :number :check-number :name :type]]]]
[:vendor
[:id :name :default-expense-account]]]}

View File

@@ -36,7 +36,7 @@
:graphql {:token (-> cofx :db :user)
:query-obj {:venia/queries [[:check_page
(assoc params :company-id (:id @(re-frame/subscribe [::subs/company])))
[[:checks [:id :status :amount :check_number :s3_url :date [:vendor [:name :id]] [:company [:name :id]]]]
[[:checks [:id :status :amount :type :check_number :s3_url :date [:vendor [:name :id]] [:company [:name :id]]]]
:total
:start
:end]]]}
@@ -107,6 +107,7 @@
:sort-by sort-by
:asc asc}
"Company"])
[sorted-column {:on-sort opc
:style {:width percentage-size :cursor "pointer"}
:sort-key "vendor"
@@ -146,14 +147,16 @@
[:tr
[:td {:col-span 5}
[:i.fa.fa-spin.fa-spinner]]]
(for [{:keys [company s3-url checks check-number date amount id vendor status] :as i} (:checks @check-page)]
(for [{:keys [company s3-url checks type check-number date amount id vendor status] :as i} (:checks @check-page)]
^{:key id}
[:tr {:class (:class i)}
(when-not selected-company
[:td (:name company)])
[:td (:name vendor)]
[:td check-number]
[:td (if (= "cash" type)
"Cash"
check-number)]
[:td (date->str date) ]
[:td (gstring/format "$%.2f" amount )]
[:td status]

View File

@@ -230,7 +230,8 @@
(fn [{:keys [db]} _]
{:dispatch [::events/modal-status ::new-invoice {:visible? true}]
:db (assoc-in db [::new-invoice] {:company-id (:id @(re-frame/subscribe [::subs/company]))
:date (date->str (c/now) standard)})}))
:date (date->str (c/now) standard)
:location (first (:locations @(re-frame/subscribe [::subs/company])))})}))
(re-frame/reg-event-fx
::edit-invoice
@@ -778,8 +779,11 @@
[:div.dropdown-menu {:role "menu"}
[:div.dropdown-content
(list
(for [{:keys [id number name]} (:bank-accounts current-company)]
^{:key id} [:a.dropdown-item {:on-click (dispatch-event [::print-checks id])} "Print checks from " name])
(for [{:keys [id number name type]} (:bank-accounts current-company)]
(do (println type)
(if (= "cash" type)
^{:key id} [:a.dropdown-item {:on-click (dispatch-event [::print-checks id])} "With cash"]
^{:key id} [:a.dropdown-item {:on-click (dispatch-event [::print-checks id])} "Print checks from " name])))
^{:key "advanced-divider"} [:hr.dropdown-divider]
(when (= 1 (count checked))
@@ -808,11 +812,18 @@
[handwrite-checks-modal]
[change-expense-accounts-modal]
(when check-results-shown?
[modal
{:title "Your checks are ready!"
:hide-event [::close-check-results]}
[:div "Click " [:a {:href pdf-url :target "_new"} "here"] " to print them."]
[:div [:em "Remember to turn off all scaling and margins."]]
])
(if pdf-url
[modal
{:title "Your checks are ready!"
:hide-event [::close-check-results]}
[:div "Click " [:a {:href pdf-url :target "_new"} "here"] " to print them."]
[:div [:em "Remember to turn off all scaling and margins."]]
]
[modal
{:title "Payment created!"
:hide-event [::close-check-results]}
[:div [:em "Your payment was created."]]
]))
]))
{:component-will-mount #(re-frame/dispatch-sync [::params-change {}]) }))