Moved to biweekly

This commit is contained in:
Bryce Covert
2020-07-16 07:44:07 -07:00
parent 08f12b8107
commit e0b636c2fa
6 changed files with 84 additions and 26 deletions

View File

@@ -44,7 +44,7 @@
:graphql {:token token
:query-obj {:venia/queries [[:client
[:id :name :code :email :matches :weekly-debits :weekly-credits :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 :include-in-reports] ]
[:id :name :code :email :matches :week-a-debits :week-a-credits :week-b-debits :week-b-credits :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 :include-in-reports] ]
[:address [:street1 :street2 :city :state :zip]]
[:forecasted-transactions [:id :amount :identifier :day-of-month]]]]
[:vendor
@@ -72,7 +72,7 @@
(fn [{:keys [db]} [_ token user]]
{:graphql {:token token
:query-obj {:venia/queries [[:client
[:id :name :code :matches :locations :weekly-debits :weekly-credits [:location-matches [:location :match]]
[:id :name :code :matches :locations :week-a-debits :week-a-credits :week-b-debits :week-b-credits [: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 :include-in-reports] ]
[:forecasted-transactions [:id :amount :identifier :day-of-month]]]]

View File

@@ -6,6 +6,8 @@
[reagent.core :as reagent]
[clojure.spec.alpha :as s]
[clojure.string :as str]
[cljs-time.core :as t]
[cljs-time.coerce :as coerce]
[auto-ap.subs :as subs]
[auto-ap.forms :as forms]
[auto-ap.events :as events]
@@ -51,8 +53,11 @@
:email (:email new-client-data)
:locations (:locations new-client-data)
:matches (vec (:matches new-client-data))
:location-matches (:location-matches new-client-data) :weekly-credits (:weekly-credits new-client-data)
:weekly-debits (:weekly-debits new-client-data)
:location-matches (:location-matches new-client-data)
:week-a-credits (:week-a-credits new-client-data)
:week-a-debits (:week-a-debits new-client-data)
:week-b-credits (:week-b-credits new-client-data)
:week-b-debits (:week-b-debits new-client-data)
:address {:street1 (:street1 (:address new-client-data))
:street2 (:street2 (:address new-client-data)),
:city (:city (:address new-client-data))
@@ -104,7 +109,7 @@
:operation/name "EditClient"}
:venia/queries [{:query/data [:edit-client
{:edit-client new-client-req}
[:id :name :code :email :locations :matches :weekly-debits :weekly-credits
[:id :name :code :email :locations :matches :week-a-debits :week-a-credits :week-b-debits :week-b-credits
[:location-matches [:location :match]]
[:address [:street1 :street2 :city :state :zip]]
[:forecasted-transactions [:id :amount :identifier :day-of-month]]
@@ -434,10 +439,20 @@
)
(def first-week-a (coerce/to-date-time #inst "1999-12-27T00:00:00.000-07:00"))
(defn is-week-a? [d]
(= 0 (mod (t/in-weeks (t/interval first-week-a d)) 2)))
(defn new-client-form []
(let [{new-client :data } @(re-frame/subscribe [::forms/form ::form])
{:keys [form field raw-field error-notification submit-button ]} client-form]
{:keys [form field raw-field error-notification submit-button ]} client-form
next-week-a (if (is-week-a? (t/now))
"This week"
"Next week")
next-week-b (if (is-week-a? (t/now))
"Next week"
"This week")]
[side-bar {:on-close (dispatch-event [::forms/form-closing ::form ])}
[form {:title "Add client"}
@@ -536,15 +551,27 @@
[:a.button.is-primary.is-outlined.is-fullwidth {:on-click (dispatch-event [::add-new-bank-account :cash])} "Add Cash Account"]]]
[:h2.subtitle "Cash flow"]
[field "Weekly credits"
[:label.label (str "Week A (" next-week-a ")")]
[field "Regular Credits"
[:input.input {:type "number"
:placeholder "250.00"
:field [:weekly-credits]
:placeholder "500.00"
:field [:week-a-credits]
:step "0.01"}]]
[field "Weekly debits"
[field "Regular Debits"
[:input.input {:type "number"
:placeholder "150.00"
:field [:week-a-debits]
:step "0.01"}]]
[:label.label (str "Week B (" next-week-b ")")]
[field "Regular Credits"
[:input.input {:type "number"
:placeholder "1000.00"
:field [:week-b-credits]
:step "0.01"}]]
[field "Regular Debits"
[:input.input {:type "number"
:placeholder "250.00"
:field [:weekly-debits]
:field [:week-b-debits]
:step "0.01"}]]
[:div.field
[:label.label "Forecasted transactions"]