diff --git a/src/clj/auto_ap/datomic/migrate.clj b/src/clj/auto_ap/datomic/migrate.clj index 7a6e8d4e..22d53e57 100644 --- a/src/clj/auto_ap/datomic/migrate.clj +++ b/src/clj/auto_ap/datomic/migrate.clj @@ -139,7 +139,11 @@ :auto-ap/add-bank-account-locations {:txes add-general-ledger/add-bank-account-locations :requires [:auto-ap/add-transaction-rules]} :auto-ap/convert-transactions {:txes-fn `add-general-ledger/convert-transactions :requires [:auto-ap/add-bank-account-locations]} - :auto-ap/add-exclude-to-invoice {:txes add-general-ledger/add-exclude-to-invoice :requires [:auto-ap/convert-transactions]}}] + :auto-ap/add-exclude-to-invoice {:txes add-general-ledger/add-exclude-to-invoice :requires [:auto-ap/convert-transactions]} + :auto-ap/add-terms {:txes [[{:db/ident :vendor/terms + :db/doc "How many days till you pay" + :db/valueType :db.type/long + :db/cardinality :db.cardinality/one}]]}}] (println "Conforming database...") (c/ensure-conforms conn norms-map) (when (not (seq args)) diff --git a/src/clj/auto_ap/graphql.clj b/src/clj/auto_ap/graphql.clj index 3e2f648d..6ae0b4d4 100644 --- a/src/clj/auto_ap/graphql.clj +++ b/src/clj/auto_ap/graphql.clj @@ -114,6 +114,7 @@ {:fields {:id {:type :id} :name {:type 'String} :code {:type 'String} + :terms {:type 'Int} :hidden {:type 'Boolean} :print_as {:type 'String} @@ -517,6 +518,7 @@ :add_vendor {:fields {:id {:type :id} :name {:type 'String} + :terms {:type 'Int} :code {:type 'String} :hidden {:type 'Boolean} diff --git a/src/clj/auto_ap/graphql/vendors.clj b/src/clj/auto_ap/graphql/vendors.clj index 082ef888..d02fac5f 100644 --- a/src/clj/auto_ap/graphql/vendors.clj +++ b/src/clj/auto_ap/graphql/vendors.clj @@ -8,7 +8,7 @@ [clojure.set :as set])) -(defn upsert-vendor [context {{:keys [id name hidden code print_as primary_contact secondary_contact address default_account_id invoice_reminder_schedule] :as in} :vendor} value] +(defn upsert-vendor [context {{:keys [id name hidden terms code print_as primary_contact secondary_contact address default_account_id invoice_reminder_schedule] :as in} :vendor} value] (let [_ (println default_account_id) transaction [(remove-nils #:vendor {:db/id (if id id @@ -16,6 +16,7 @@ :name name :code code :hidden hidden + :terms terms :print-as print_as :default-account default_account_id :invoice-reminder-schedule (keyword invoice_reminder_schedule) diff --git a/src/cljs/auto_ap/events.cljs b/src/cljs/auto_ap/events.cljs index 0c57cad0..83633b37 100644 --- a/src/cljs/auto_ap/events.cljs +++ b/src/cljs/auto_ap/events.cljs @@ -52,7 +52,7 @@ [:accounts [:numeric-code :location :name :type :account_set :id]]]} :on-success [::received-initial]}})))) (def vendor-query - [:id :name :hidden [:default-account [:name :id :location]] + [:id :name :hidden :terms [:default-account [:name :id :location]] [:primary-contact [:name :phone :email :id]] [:secondary-contact [:id :name :phone :email]] :print-as :invoice-reminder-schedule :code diff --git a/src/cljs/auto_ap/views/components/vendor_dialog.cljs b/src/cljs/auto_ap/views/components/vendor_dialog.cljs index e265fb30..98f33f23 100644 --- a/src/cljs/auto_ap/views/components/vendor_dialog.cljs +++ b/src/cljs/auto_ap/views/components/vendor_dialog.cljs @@ -69,7 +69,7 @@ :on-success [::save-complete] :on-error [::forms/save-error ::vendor-form]}}))) -(defn vendor-dialog [{:keys [save-event] {:keys [name]} :vendor}] +(defn vendor-dialog [{:keys [save-event] }] (let [clients-by-id @(re-frame/subscribe [::subs/clients-by-id]) all-vendors @(re-frame/subscribe [::subs/vendors])