you can add overrides.
This commit is contained in:
@@ -147,7 +147,34 @@
|
|||||||
:auto-ap/add-due {:txes [[{:db/ident :invoice/due
|
:auto-ap/add-due {:txes [[{:db/ident :invoice/due
|
||||||
:db/doc "When you gotta pay"
|
:db/doc "When you gotta pay"
|
||||||
:db/valueType :db.type/instant
|
:db/valueType :db.type/instant
|
||||||
:db/cardinality :db.cardinality/one}]]}}]
|
:db/cardinality :db.cardinality/one}]]}
|
||||||
|
:auto-ap/add-vendor-overrides {:txes [[{:db/ident :vendor-account-override/account
|
||||||
|
:db/doc "the account for invoices"
|
||||||
|
:db/valueType :db.type/ref
|
||||||
|
:db/cardinality :db.cardinality/one}
|
||||||
|
{:db/ident :vendor-account-override/client
|
||||||
|
:db/doc "How many days till you pay"
|
||||||
|
:db/valueType :db.type/ref
|
||||||
|
:db/cardinality :db.cardinality/one}
|
||||||
|
{:db/ident :vendor-terms-override/terms
|
||||||
|
:db/doc "How many days till you pay"
|
||||||
|
:db/valueType :db.type/long
|
||||||
|
:db/cardinality :db.cardinality/one}
|
||||||
|
{:db/ident :vendor-terms-override/client
|
||||||
|
:db/doc "How many days till you pay"
|
||||||
|
:db/valueType :db.type/ref
|
||||||
|
:db/cardinality :db.cardinality/one}
|
||||||
|
{:db/ident :vendor/terms-overrides
|
||||||
|
:db/doc "Overrides per-client"
|
||||||
|
:db/isComponent true
|
||||||
|
:db/valueType :db.type/ref
|
||||||
|
:db/cardinality :db.cardinality/many}
|
||||||
|
{:db/ident :vendor/account-overrides
|
||||||
|
:db/isComponent true
|
||||||
|
:db/doc "Overrides per-client"
|
||||||
|
:db/valueType :db.type/ref
|
||||||
|
:db/cardinality :db.cardinality/many}]]}
|
||||||
|
}]
|
||||||
(println "Conforming database...")
|
(println "Conforming database...")
|
||||||
(c/ensure-conforms conn norms-map)
|
(c/ensure-conforms conn norms-map)
|
||||||
(when (not (seq args))
|
(when (not (seq args))
|
||||||
|
|||||||
@@ -3,31 +3,23 @@
|
|||||||
[auto-ap.datomic :refer [uri]]))
|
[auto-ap.datomic :refer [uri]]))
|
||||||
|
|
||||||
(defn get-graphql [args]
|
(defn get-graphql [args]
|
||||||
(prn (->> (d/q '[:find (pull ?e [*])
|
(->> (d/q '[:find (pull ?e [* {:vendor/account-overrides [* {:vendor-account-override/client [:client/name :db/id]
|
||||||
|
:vendor-account-override/account [:account/name :account/numeric-code :db/id]}]
|
||||||
|
:vendor/terms-overrides [* {:vendor-terms-override/client [:client/name :db/id]}]}])
|
||||||
:where [?e :vendor/name]]
|
:where [?e :vendor/name]]
|
||||||
(d/db (d/connect uri)))
|
(d/db (d/connect uri)))
|
||||||
(map first)
|
(map first)))
|
||||||
(take 5)))
|
|
||||||
|
|
||||||
(->> (d/q '[:find (pull ?e [*])
|
|
||||||
:where [?e :vendor/name]]
|
|
||||||
(d/db (d/connect uri)))
|
|
||||||
(map first)
|
|
||||||
|
|
||||||
#_(map (fn [c]
|
|
||||||
(update c :client/bank-accounts
|
|
||||||
(fn [bas]
|
|
||||||
(map (fn [ba]
|
|
||||||
(update ba :bank-account/type :db/ident ))
|
|
||||||
bas)))))))
|
|
||||||
|
|
||||||
(defn get-by-id [id]
|
(defn get-by-id [id]
|
||||||
|
|
||||||
(->> (d/q '[:find (pull ?e [* {:default-account [:account/name :db/id :account/location]}])
|
(->> (d/q '[:find (pull ?e [*
|
||||||
|
{:default-account [:account/name :db/id :account/location]
|
||||||
|
:vendor/account-overrides [* {:vendor-account-override/client [:client/name :db/id]
|
||||||
|
:vendor-account-override/account [:account/name :account/numeric-code :db/id]}]
|
||||||
|
:vendor/terms-overrides [* {:vendor-terms-override/client [:client/name :db/id]}]}])
|
||||||
:in $ ?e
|
:in $ ?e
|
||||||
:where [?e]]
|
:where [?e]]
|
||||||
(d/db (d/connect uri))
|
(d/db (d/connect uri))
|
||||||
id)
|
id)
|
||||||
(map first)
|
(map first)
|
||||||
(first)
|
(first)))
|
||||||
))
|
|
||||||
|
|||||||
@@ -110,12 +110,26 @@
|
|||||||
:city {:type 'String}
|
:city {:type 'String}
|
||||||
:state {:type 'String}
|
:state {:type 'String}
|
||||||
:zip {:type 'String}}}
|
:zip {:type 'String}}}
|
||||||
|
|
||||||
|
:terms_override
|
||||||
|
{:fields {:id {:type :id}
|
||||||
|
:client {:type :client}
|
||||||
|
:terms {:type 'Int}
|
||||||
|
}}
|
||||||
|
|
||||||
|
:account_override
|
||||||
|
{:fields {:id {:type :id}
|
||||||
|
:client {:type :client}
|
||||||
|
:account {:type :account}}}
|
||||||
|
|
||||||
:vendor
|
:vendor
|
||||||
{:fields {:id {:type :id}
|
{:fields {:id {:type :id}
|
||||||
:name {:type 'String}
|
:name {:type 'String}
|
||||||
:code {:type 'String}
|
:code {:type 'String}
|
||||||
:terms {:type 'Int}
|
:terms {:type 'Int}
|
||||||
:hidden {:type 'Boolean}
|
:hidden {:type 'Boolean}
|
||||||
|
:terms_overrides {:type '(list :terms_override)}
|
||||||
|
:account_overrides {:type '(list :account_override)}
|
||||||
|
|
||||||
:print_as {:type 'String}
|
:print_as {:type 'String}
|
||||||
:primary_contact {:type :contact}
|
:primary_contact {:type :contact}
|
||||||
@@ -516,10 +530,22 @@
|
|||||||
:state {:type 'String}
|
:state {:type 'String}
|
||||||
:zip {:type 'String}}}
|
:zip {:type 'String}}}
|
||||||
|
|
||||||
|
:add_terms_override
|
||||||
|
{:fields {:id {:type :id}
|
||||||
|
:client_id {:type :id}
|
||||||
|
:terms {:type 'Int}
|
||||||
|
}}
|
||||||
|
|
||||||
|
:add_account_override
|
||||||
|
{:fields {:id {:type :id}
|
||||||
|
:client_id {:type :id}
|
||||||
|
:account_id {:type :id}}}
|
||||||
|
|
||||||
:add_vendor
|
:add_vendor
|
||||||
{:fields {:id {:type :id}
|
{:fields {:id {:type :id}
|
||||||
:name {:type 'String}
|
:name {:type 'String}
|
||||||
:terms {:type 'Int}
|
:terms {:type 'Int}
|
||||||
|
:terms_overrides {:type '(list :add_terms_override)}
|
||||||
:code {:type 'String}
|
:code {:type 'String}
|
||||||
|
|
||||||
:hidden {:type 'Boolean}
|
:hidden {:type 'Boolean}
|
||||||
@@ -529,6 +555,7 @@
|
|||||||
:address {:type :add_address}
|
:address {:type :add_address}
|
||||||
|
|
||||||
:default_account_id {:type :id}
|
:default_account_id {:type :id}
|
||||||
|
:account_overrides {:type '(list :add_account_override)}
|
||||||
:invoice_reminder_schedule {:type 'String}}}
|
:invoice_reminder_schedule {:type 'String}}}
|
||||||
|
|
||||||
:edit_expense_account
|
:edit_expense_account
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
[clojure.set :as set]))
|
[clojure.set :as set]))
|
||||||
|
|
||||||
|
|
||||||
(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]
|
(defn upsert-vendor [context {{:keys [id name hidden terms code print_as primary_contact secondary_contact address default_account_id invoice_reminder_schedule terms_overrides account_overrides] :as in} :vendor} value]
|
||||||
(let [_ (println default_account_id)
|
(let [_ (println default_account_id)
|
||||||
transaction [(remove-nils #:vendor {:db/id (if id
|
transaction [(remove-nils #:vendor {:db/id (if id
|
||||||
id
|
id
|
||||||
@@ -20,6 +20,20 @@
|
|||||||
:print-as print_as
|
:print-as print_as
|
||||||
:default-account default_account_id
|
:default-account default_account_id
|
||||||
:invoice-reminder-schedule (keyword invoice_reminder_schedule)
|
:invoice-reminder-schedule (keyword invoice_reminder_schedule)
|
||||||
|
:terms-overrides (mapv
|
||||||
|
(fn [to]
|
||||||
|
(cond->
|
||||||
|
#:vendor-terms-override {:client (:client_id to)
|
||||||
|
:terms (:terms to)}
|
||||||
|
(:id to) (assoc :db/id (:id to))))
|
||||||
|
terms_overrides)
|
||||||
|
:account-overrides (mapv
|
||||||
|
(fn [ao]
|
||||||
|
(cond->
|
||||||
|
#:vendor-account-override {:client (:client_id ao)
|
||||||
|
:account (:account_id ao)}
|
||||||
|
(:id ao) (assoc :db/id (:id ao))))
|
||||||
|
account_overrides)
|
||||||
:address (when address
|
:address (when address
|
||||||
(remove-nils #:address {:db/id (if (:id address)
|
(remove-nils #:address {:db/id (if (:id address)
|
||||||
(:id address)
|
(:id address)
|
||||||
|
|||||||
@@ -53,6 +53,8 @@
|
|||||||
:on-success [::received-initial]}}))))
|
:on-success [::received-initial]}}))))
|
||||||
(def vendor-query
|
(def vendor-query
|
||||||
[:id :name :hidden :terms [:default-account [:name :id :location]]
|
[:id :name :hidden :terms [:default-account [:name :id :location]]
|
||||||
|
[:account-overrides [[:client [:id :name]] :id [:account [:id :numeric-code :name]]]]
|
||||||
|
[:terms-overrides [[:client [:id :name]] :id :terms]]
|
||||||
[:primary-contact [:name :phone :email :id]]
|
[:primary-contact [:name :phone :email :id]]
|
||||||
[:secondary-contact [:id :name :phone :email]]
|
[:secondary-contact [:id :name :phone :email]]
|
||||||
:print-as :invoice-reminder-schedule :code
|
:print-as :invoice-reminder-schedule :code
|
||||||
|
|||||||
@@ -33,26 +33,26 @@
|
|||||||
(map first)
|
(map first)
|
||||||
first))))
|
first))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
|
||||||
::selected-override
|
|
||||||
(fn [db]
|
|
||||||
(::selected-override db)))
|
|
||||||
|
|
||||||
(re-frame/reg-event-db
|
|
||||||
::override-selected
|
|
||||||
(fn [db [_ which]]
|
|
||||||
(assoc db ::selected-override which)))
|
|
||||||
|
|
||||||
(re-frame/reg-event-db
|
|
||||||
::override-added
|
|
||||||
(fn [db [_ z]]
|
|
||||||
(println "selected" z)
|
|
||||||
(assoc db ::selected-override "101")))
|
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
::started
|
::started
|
||||||
(fn [{:keys [db]} [_ vendor]]
|
(fn [{:keys [db]} [_ vendor]]
|
||||||
|
(println vendor)
|
||||||
{:db (-> db (forms/start-form ::vendor-form (-> vendor
|
{:db (-> db (forms/start-form ::vendor-form (-> vendor
|
||||||
|
(update :account-overrides #(mapv
|
||||||
|
(fn [ao]
|
||||||
|
{:id (:id ao)
|
||||||
|
:client (:client ao)
|
||||||
|
:override (:account ao)})
|
||||||
|
%))
|
||||||
|
|
||||||
|
(update :terms-overrides #(mapv
|
||||||
|
(fn [to]
|
||||||
|
{:id (:id to)
|
||||||
|
:client (:client to)
|
||||||
|
:override (:terms to)})
|
||||||
|
%))
|
||||||
(update :hidden #(if (nil? %)
|
(update :hidden #(if (nil? %)
|
||||||
false
|
false
|
||||||
%))
|
%))
|
||||||
@@ -72,23 +72,67 @@
|
|||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
::save
|
::save
|
||||||
[with-user (forms/triggers-loading ::vendor-form) (forms/in-form ::vendor-form)]
|
[with-user (forms/triggers-loading ::vendor-form) (forms/in-form ::vendor-form)]
|
||||||
(fn [{:keys [user] {:keys [data]} :db} _]
|
(fn [{:keys [user] {{:keys [name hidden print-as terms invoice-reminder-schedule primary-contact secondary-contact address default-account terms-overrides account-overrides id] :as data} :data} :db} _]
|
||||||
(when (s/valid? ::entity/vendor data)
|
(when (s/valid? ::entity/vendor data)
|
||||||
{ :graphql
|
{ :graphql
|
||||||
{:token user
|
{:token user
|
||||||
:query-obj {:venia/operation {:operation/type :mutation
|
:query-obj {:venia/operation {:operation/type :mutation
|
||||||
:operation/name "UpsertVendor"}
|
:operation/name "UpsertVendor"}
|
||||||
:venia/queries [{:query/data [:upsert-vendor
|
:venia/queries [{:query/data [:upsert-vendor
|
||||||
{:vendor (-> data
|
{:vendor {:id id
|
||||||
(assoc :default-account-id (:id (:default-account data)))
|
:name name
|
||||||
(dissoc :default-account))}
|
:hidden hidden
|
||||||
|
:print-as print-as
|
||||||
|
:terms terms
|
||||||
|
:terms-overrides (mapv
|
||||||
|
(fn [{:keys [client override id]}]
|
||||||
|
{:id id
|
||||||
|
:client-id (:id client)
|
||||||
|
:terms override})
|
||||||
|
terms-overrides)
|
||||||
|
:default-account-id (:id default-account)
|
||||||
|
:account-overrides (mapv
|
||||||
|
(fn [{:keys [client override id]}]
|
||||||
|
{:id id
|
||||||
|
:client-id (:id client)
|
||||||
|
:account-id (:id override)})
|
||||||
|
account-overrides)
|
||||||
|
:address address
|
||||||
|
:primary-contact primary-contact
|
||||||
|
:secondary-contact secondary-contact
|
||||||
|
:invoice-reminder-schedule invoice-reminder-schedule}}
|
||||||
events/vendor-query]}]}
|
events/vendor-query]}]}
|
||||||
:on-success [::save-complete]
|
:on-success [::save-complete]
|
||||||
:on-error [::forms/save-error ::vendor-form]}})))
|
:on-error [::forms/save-error ::vendor-form]}})))
|
||||||
|
|
||||||
(defn form-content [{:keys [data change-event selected-override]}]
|
(defn default-with-overrides [{:keys [override-key override-value-key change-event default-key data]} template]
|
||||||
|
(let [clients @(re-frame/subscribe [::subs/clients])]
|
||||||
|
[:div
|
||||||
|
[horizontal-field
|
||||||
|
[:label.label "Default"]
|
||||||
|
[bind-field
|
||||||
|
(assoc-in template [1 :field ] default-key)]]
|
||||||
|
[horizontal-field
|
||||||
|
[:label.label "Overrides"]
|
||||||
|
(for [[i overrides] (map vector (range) (conj (override-key data) {}))]
|
||||||
|
^{:key i}
|
||||||
|
[:div
|
||||||
|
[:div.columns
|
||||||
|
[:div.column
|
||||||
|
[bind-field
|
||||||
|
[typeahead-entity {:matches clients
|
||||||
|
:match->text :name
|
||||||
|
:type "typeahead-entity"
|
||||||
|
:field [override-key i :client]
|
||||||
|
:event change-event
|
||||||
|
:subscription data}]]]
|
||||||
|
[:div.column
|
||||||
|
[bind-field
|
||||||
|
(assoc-in template [1 :field ] [override-key i :override])]]]])]]))
|
||||||
|
|
||||||
|
(defn form-content [{:keys [data change-event]}]
|
||||||
(let [chooseable-expense-accounts @(re-frame/subscribe [::subs/chooseable-expense-accounts])
|
(let [chooseable-expense-accounts @(re-frame/subscribe [::subs/chooseable-expense-accounts])
|
||||||
root-path (cond-> [] selected-override (into [:overrides selected-override]))]
|
clients @(re-frame/subscribe [::subs/clients])]
|
||||||
[:div
|
[:div
|
||||||
[horizontal-field
|
[horizontal-field
|
||||||
[:label.label "Name"]
|
[:label.label "Name"]
|
||||||
@@ -96,7 +140,7 @@
|
|||||||
[bind-field
|
[bind-field
|
||||||
[:input.input {:type "text"
|
[:input.input {:type "text"
|
||||||
:auto-focus true
|
:auto-focus true
|
||||||
:field (conj root-path :name)
|
:field :name
|
||||||
:spec ::entity/name
|
:spec ::entity/name
|
||||||
:event change-event
|
:event change-event
|
||||||
:subscription data}]]]]
|
:subscription data}]]]]
|
||||||
@@ -106,46 +150,44 @@
|
|||||||
[:div.control
|
[:div.control
|
||||||
[bind-field
|
[bind-field
|
||||||
[:input.input {:type "text"
|
[:input.input {:type "text"
|
||||||
:field (conj root-path :print-as)
|
:field :print-as
|
||||||
:spec ::entity/print-as
|
:spec ::entity/print-as
|
||||||
:event change-event
|
:event change-event
|
||||||
:subscription data}]]]]
|
:subscription data}]]]]
|
||||||
|
|
||||||
[horizontal-field
|
|
||||||
[:label.label "Terms"]
|
|
||||||
[:div.control
|
|
||||||
[bind-field
|
|
||||||
[:input.input {:type "number"
|
|
||||||
:step "1"
|
|
||||||
:field (conj root-path :terms)
|
|
||||||
:spec ::entity/terms
|
|
||||||
:event change-event
|
|
||||||
:subscription data}]]]]
|
|
||||||
|
|
||||||
[horizontal-field
|
[horizontal-field
|
||||||
[:label.label "Hidden"]
|
[:label.label "Hidden"]
|
||||||
[:div.control
|
[:div.control
|
||||||
[bind-field
|
[bind-field
|
||||||
[:input {:type "checkbox"
|
[:input {:type "checkbox"
|
||||||
:field (conj root-path :hidden)
|
:field :hidden
|
||||||
:spec ::entity/hidden
|
:spec ::entity/hidden
|
||||||
:event change-event
|
:event change-event
|
||||||
:subscription data}]]]]
|
:subscription data}]]]]
|
||||||
|
[:h2.subtitle "Terms"]
|
||||||
|
[default-with-overrides {:data data :change-event change-event
|
||||||
|
:default-key :terms
|
||||||
|
:override-key :terms-overrides}
|
||||||
|
[:input.input {:type "number"
|
||||||
|
:step "1"
|
||||||
|
:style {:width "4em"}
|
||||||
|
:size 3
|
||||||
|
:spec ::entity/terms
|
||||||
|
:event change-event
|
||||||
|
:subscription data}]]
|
||||||
|
|
||||||
[:h2.subtitle "Expense Accounts"]
|
[:h2.subtitle "Expense Accounts"]
|
||||||
[horizontal-field
|
[default-with-overrides {:data data :change-event change-event
|
||||||
[:label.label "Default"]
|
:default-key :default-account
|
||||||
|
:override-key :account-overrides}
|
||||||
[bind-field
|
[typeahead-entity {:matches chooseable-expense-accounts
|
||||||
[typeahead-entity {:matches chooseable-expense-accounts
|
:match->text (fn [x ] (str (:numeric-code x) " - " (:name x)))
|
||||||
:match->text (fn [x ] (str (:numeric-code x) " - " (:name x)))
|
:type "typeahead-entity"
|
||||||
:type "typeahead-entity"
|
:event change-event
|
||||||
:field (conj root-path :default-account)
|
:subscription data}]]
|
||||||
:event change-event
|
|
||||||
:subscription data}]]]
|
|
||||||
|
|
||||||
[:h2.subtitle "Address"]
|
[:h2.subtitle "Address"]
|
||||||
[address-field {:field (conj root-path :address)
|
[address-field {:field [:address]
|
||||||
:event change-event
|
:event change-event
|
||||||
:subscription data}]
|
:subscription data}]
|
||||||
[:h2.subtitle "Contact"]
|
[:h2.subtitle "Contact"]
|
||||||
@@ -154,7 +196,7 @@
|
|||||||
[:div.control.has-icons-left
|
[:div.control.has-icons-left
|
||||||
[bind-field
|
[bind-field
|
||||||
[:input.input.is-expanded {:type "text"
|
[:input.input.is-expanded {:type "text"
|
||||||
:field (into root-path [:primary-contact :name])
|
:field [:primary-contact :name]
|
||||||
:spec ::contact/name
|
:spec ::contact/name
|
||||||
:event change-event
|
:event change-event
|
||||||
:subscription data}]]
|
:subscription data}]]
|
||||||
@@ -166,7 +208,7 @@
|
|||||||
[:i.fa.fa-envelope]]
|
[:i.fa.fa-envelope]]
|
||||||
[bind-field
|
[bind-field
|
||||||
[:input.input {:type "email"
|
[:input.input {:type "email"
|
||||||
:field (into root-path [:primary-contact :email])
|
:field [:primary-contact :email]
|
||||||
:spec ::contact/email
|
:spec ::contact/email
|
||||||
:event change-event
|
:event change-event
|
||||||
:subscription data}]]]
|
:subscription data}]]]
|
||||||
@@ -174,7 +216,7 @@
|
|||||||
[:div.control.has-icons-left
|
[:div.control.has-icons-left
|
||||||
[bind-field
|
[bind-field
|
||||||
[:input.input {:type "phone"
|
[:input.input {:type "phone"
|
||||||
:field (into root-path [:primary-contact :phone])
|
:field [:primary-contact :phone]
|
||||||
:spec ::contact/phone
|
:spec ::contact/phone
|
||||||
:event change-event
|
:event change-event
|
||||||
:subscription data}]]
|
:subscription data}]]
|
||||||
@@ -185,7 +227,7 @@
|
|||||||
[:div.control.has-icons-left
|
[:div.control.has-icons-left
|
||||||
[bind-field
|
[bind-field
|
||||||
[:input.input.is-expanded {:type "text"
|
[:input.input.is-expanded {:type "text"
|
||||||
:field (into root-path [:secondary-contact :name])
|
:field [:secondary-contact :name]
|
||||||
:spec ::contact/name
|
:spec ::contact/name
|
||||||
:event change-event
|
:event change-event
|
||||||
:subscription data}]]
|
:subscription data}]]
|
||||||
@@ -196,14 +238,14 @@
|
|||||||
[:i.fa.fa-envelope]]
|
[:i.fa.fa-envelope]]
|
||||||
[bind-field
|
[bind-field
|
||||||
[:input.input {:type "email"
|
[:input.input {:type "email"
|
||||||
:field (into root-path [:secondary-contact :email])
|
:field [:secondary-contact :email]
|
||||||
:spec ::contact/email
|
:spec ::contact/email
|
||||||
:event change-event
|
:event change-event
|
||||||
:subscription data}]]]
|
:subscription data}]]]
|
||||||
[:div.control.has-icons-left
|
[:div.control.has-icons-left
|
||||||
[bind-field
|
[bind-field
|
||||||
[:input.input {:type "phone"
|
[:input.input {:type "phone"
|
||||||
:field (into root-path [:secondary-contact :phone])
|
:field [:secondary-contact :phone]
|
||||||
:spec ::contact/phone
|
:spec ::contact/phone
|
||||||
:event change-event
|
:event change-event
|
||||||
:subscription data}]]
|
:subscription data}]]
|
||||||
@@ -217,7 +259,7 @@
|
|||||||
[:input {:type "radio"
|
[:input {:type "radio"
|
||||||
:name "schedule"
|
:name "schedule"
|
||||||
:value "Weekly"
|
:value "Weekly"
|
||||||
:field (conj root-path :invoice-reminder-schedule)
|
:field :invoice-reminder-schedule
|
||||||
:spec ::entity/invoice-reminder-schedule
|
:spec ::entity/invoice-reminder-schedule
|
||||||
:event change-event
|
:event change-event
|
||||||
:subscription data}]]
|
:subscription data}]]
|
||||||
@@ -228,7 +270,7 @@
|
|||||||
[:input {:type "radio"
|
[:input {:type "radio"
|
||||||
:name "schedule"
|
:name "schedule"
|
||||||
:value "Never"
|
:value "Never"
|
||||||
:field (conj root-path :invoice-reminder-schedule)
|
:field :invoice-reminder-schedule
|
||||||
:spec ::entity/invoice-reminder-schedule
|
:spec ::entity/invoice-reminder-schedule
|
||||||
:event change-event
|
:event change-event
|
||||||
:subscription data}]]
|
:subscription data}]]
|
||||||
@@ -237,7 +279,6 @@
|
|||||||
(defn vendor-dialog [{:keys [save-event] }]
|
(defn vendor-dialog [{:keys [save-event] }]
|
||||||
(let [clients @(re-frame/subscribe [::subs/clients])
|
(let [clients @(re-frame/subscribe [::subs/clients])
|
||||||
all-vendors @(re-frame/subscribe [::subs/vendors])
|
all-vendors @(re-frame/subscribe [::subs/vendors])
|
||||||
selected-override @(re-frame/subscribe [::selected-override])
|
|
||||||
{:keys [data error ] :as f} @(re-frame/subscribe [::forms/form ::vendor-form])
|
{:keys [data error ] :as f} @(re-frame/subscribe [::forms/form ::vendor-form])
|
||||||
change-event [::forms/change ::vendor-form]]
|
change-event [::forms/change ::vendor-form]]
|
||||||
[action-modal {:id ::dialog
|
[action-modal {:id ::dialog
|
||||||
@@ -255,32 +296,5 @@
|
|||||||
:save-event [::save]
|
:save-event [::save]
|
||||||
:can-submit? (s/valid? ::entity/vendor data)}
|
:can-submit? (s/valid? ::entity/vendor data)}
|
||||||
[:div
|
[:div
|
||||||
[:div.level
|
[form-content {:data data :change-event change-event}]]]))
|
||||||
[:div.level-left
|
|
||||||
[:div.tabs
|
|
||||||
[:ul
|
|
||||||
[:li {:class (active-when selected-override = nil)}
|
|
||||||
[:a {:on-click (dispatch-event [::override-selected nil])} "All"]]
|
|
||||||
[:li {:class (active-when selected-override = "123")}
|
|
||||||
[:a {:on-click (dispatch-event [::override-selected "123"])}
|
|
||||||
[:span "Campbell Brewing Company"]]]
|
|
||||||
]]]
|
|
||||||
[:div.level-right
|
|
||||||
[drop-down {:id [::add-new-override]
|
|
||||||
:is-right? true
|
|
||||||
:header [:a.button.badge {:aria-haspopup true
|
|
||||||
:on-click (dispatch-event [::events/toggle-menu [::add-new-override]])}
|
|
||||||
[:span.icon
|
|
||||||
[:span.icon-add]]
|
|
||||||
[:span "Override"]]}
|
|
||||||
[drop-down-contents
|
|
||||||
[:div
|
|
||||||
[:div.field
|
|
||||||
[:label.label "Client"]
|
|
||||||
[typeahead-entity {:matches clients
|
|
||||||
:match->text :name
|
|
||||||
:type "typeahead-entity"
|
|
||||||
:event [:override-added]}]]]]]]]
|
|
||||||
[form-content {:data data :change-event change-event
|
|
||||||
:selected-override selected-override}]]]))
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user