Adds support for more than one email address.
This commit is contained in:
@@ -29,7 +29,8 @@
|
||||
:bank-account/intuit-bank-account [:intuit-bank-account/name :intuit-bank-account/external-id :db/id]}
|
||||
]}
|
||||
{:yodlee-provider-account/_client [*]}
|
||||
{:plaid-item/_client [*]}])
|
||||
{:plaid-item/_client [*]}
|
||||
{:client/emails [:db/id :email-contact/email :email-contact/description]}])
|
||||
:where [?e :client/name]]
|
||||
(d/db (d/connect uri)))
|
||||
(map first)
|
||||
@@ -42,7 +43,8 @@
|
||||
'[* {:client/bank-accounts [* {:bank-account/type [*]
|
||||
:bank-account/yodlee-account [:yodlee-account/name :yodlee-account/id :yodlee-account/number]
|
||||
:bank-account/intuit-bank-account [:intuit-bank-account/name :intuit-bank-account/external-id :db/id]
|
||||
:bank-account/plaid-account [:plaid-account/name :db/id :plaid-account/number :plaid-account/balance]}]}
|
||||
:bank-account/plaid-account [:plaid-account/name :db/id :plaid-account/number :plaid-account/balance]}]
|
||||
:client/emails [:db/id :email-contact/email :email-contact/description]}
|
||||
{:yodlee-provider-account/_client [*]}
|
||||
{:plaid-item/_client [*]}]
|
||||
id)
|
||||
|
||||
@@ -58,4 +58,18 @@
|
||||
{:txes [[{:db/ident :client/locked-until
|
||||
:db/doc "No new data before this date can be added/changed"
|
||||
:db/valueType :db.type/instant
|
||||
:db/cardinality :db.cardinality/one}]]}})
|
||||
:db/cardinality :db.cardinality/one}]]}
|
||||
::add-email-contacts
|
||||
{:txes [[{:db/ident :email-contact/email
|
||||
:db/doc "Email contact's email"
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one}
|
||||
{:db/ident :email-contact/description
|
||||
:db/doc "Manager, Owner, etc"
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one}
|
||||
{:db/ident :client/emails
|
||||
:db/doc "collection of email contacts"
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/many}]]}
|
||||
})
|
||||
|
||||
@@ -258,7 +258,7 @@
|
||||
:check (str (+ index (:bank-account/check-number bank-account)))
|
||||
:memo memo
|
||||
:date (date->str (local-now))
|
||||
:client (dissoc client :client/bank-accounts :client/locked-until)
|
||||
:client (dissoc client :client/bank-accounts :client/locked-until :client/emails)
|
||||
:bank-account (dissoc bank-account :bank-account/start-date)
|
||||
#_#_:client {:name (:name client)
|
||||
:address (:address client)
|
||||
|
||||
@@ -136,6 +136,12 @@
|
||||
(:bank_accounts edit_client))
|
||||
|
||||
})
|
||||
[:reset id :client/emails (map #(remove-nils
|
||||
{:db/id (or (:id %)
|
||||
(str (UUID/randomUUID)))
|
||||
:email-contact/email (:email %)
|
||||
:email-contact/description (:description %)})
|
||||
(:emails edit_client))]
|
||||
[:reset id :client/forecasted-transactions (map #(remove-nils
|
||||
{:db/id (:id %)
|
||||
:forecasted-transaction/day-of-month (:day_of_month %)
|
||||
@@ -267,6 +273,10 @@
|
||||
:match {:type 'String}
|
||||
:id {:type :id}}}
|
||||
|
||||
:email_contact {:fields {:id {:type :id}
|
||||
:email {:type 'String}
|
||||
:description {:type 'String}}}
|
||||
|
||||
:client
|
||||
{:fields {:id {:type :id}
|
||||
:name {:type 'String}
|
||||
@@ -278,6 +288,7 @@
|
||||
:week_b_debits {:type :money}
|
||||
:week_b_credits {:type :money}
|
||||
:email {:type 'String}
|
||||
:emails {:type '(list :email_contact)}
|
||||
:address {:type :address}
|
||||
:location_matches {:type '(list :location_match)}
|
||||
:locations {:type '(list String)}
|
||||
@@ -335,12 +346,16 @@
|
||||
:id {:type :id}
|
||||
:day_of_month {:type 'Int}
|
||||
:amount {:type :money}}}
|
||||
:edit_email_contact {:fields {:id {:type :id}
|
||||
:email {:type 'String}
|
||||
:description {:type 'String}}}
|
||||
:edit_client {:fields {:id {:type :id}
|
||||
:name {:type 'String}
|
||||
:locked_until {:type :iso_date}
|
||||
:code {:type 'String}
|
||||
:signature_data {:type 'String}
|
||||
:email {:type 'String}
|
||||
:emails {:type '(list :edit_email_contact)}
|
||||
:week_a_credits {:type :money}
|
||||
:week_a_debits {:type :money}
|
||||
:week_b_credits {:type :money}
|
||||
|
||||
@@ -506,4 +506,4 @@
|
||||
:input-stream (io/make-input-stream pdf-data {})
|
||||
:metadata {:content-length (count pdf-data)
|
||||
:content-type "application/pdf"})
|
||||
(str "http://" (:data-bucket env) ".s3-website-us-east-1.amazonaws.com/reports/pnl/" uuid ".pdf")))
|
||||
(str "https://" (:data-bucket env) ".s3-website-us-east-1.amazonaws.com/reports/pnl/" uuid ".pdf")))
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
(let [jwt (jwt/sign {:user (:name profile)
|
||||
:exp (time/plus (time/now) (time/days 30))
|
||||
:user/clients (map (fn [c]
|
||||
(dissoc c :client/bank-accounts :client/location-matches :client/forecasted-transactions :client/matches :client/week-a-debits :client/week-a-credits :client/week-b-debits :client/week-b-credits :client/signature-file :client/address))
|
||||
(dissoc c :client/bank-accounts :client/location-matches :client/forecasted-transactions :client/matches :client/week-a-debits :client/week-a-credits :client/week-b-debits :client/week-b-credits :client/signature-file :client/address :client/emails))
|
||||
(:user/clients user))
|
||||
:user/role (name (:user/role user))
|
||||
:user/name (:name profile)}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
(defn client-query [token]
|
||||
(cond-> [:id :name :signature-file :code :email :matches :week-a-debits :week-a-credits :week-b-debits :week-b-credits :locations :locked-until
|
||||
[:emails [:id :email :description]]
|
||||
[:location-matches [:id :location :match]]
|
||||
[:bank-accounts [:id :start-date :numeric-code :code :number :bank-name :bank-code :check-number :name :routing :type :sort-order :visible :yodlee-account-id
|
||||
[:yodlee-account [:name :id :number]]
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
{:id (:id new-client-data),
|
||||
:name (:name new-client-data)
|
||||
:code (:code new-client-data) ;; TODO add validation can't change
|
||||
:email (:email new-client-data)
|
||||
:emails (:emails new-client-data)
|
||||
|
||||
:locked-until (cond (not (:locked-until new-client-data))
|
||||
nil
|
||||
@@ -537,10 +537,18 @@
|
||||
:field [:locked-until]}])
|
||||
|
||||
|
||||
(field "Email"
|
||||
[:input.input {:type "email"
|
||||
:field :email
|
||||
:spec ::entity/email}])
|
||||
[:h2.subtitle.is-5 "Emails (address/description)"]
|
||||
[:div.control
|
||||
(raw-field
|
||||
[multi-field {:type "multi-field"
|
||||
:field :emails
|
||||
:template [[:input.input {:type "email"
|
||||
:field [:email]
|
||||
:placeholder "tom@myspace.com"
|
||||
:spec ::entity/email}]
|
||||
[:input.input {:type "text"
|
||||
:placeholder "Manager"
|
||||
:field [:description]}]]}])]
|
||||
|
||||
[:div.field
|
||||
[:p.help "Signature"]
|
||||
|
||||
@@ -223,20 +223,22 @@ Please download it by clicking this link: " report-url)))
|
||||
(let [selected-clients (-> db ::forms/forms ::form :data :clients)
|
||||
single-client? (= (count selected-clients)
|
||||
1)
|
||||
client-email (when single-client?
|
||||
client-emails (when single-client?
|
||||
(-> clients-by-id
|
||||
(get (:id (first selected-clients)))
|
||||
:email))]
|
||||
:emails))]
|
||||
|
||||
|
||||
{:dispatch [::modal/modal-requested {:title "Your report is ready"
|
||||
:body [:div
|
||||
[:div "Click "
|
||||
[:a {:href (-> result :profit-and-loss-pdf :report-url) :target "_new"} "here"] " to view it."]
|
||||
(when single-client?
|
||||
(when (and single-client? (seq client-emails))
|
||||
[:div "Once you've confirmed you're happy with it, click "
|
||||
[:a {:href (str "mailto:" (or client-email "client@xyz.com") "?body=" (email-body (-> result :profit-and-loss-pdf :report-url)))}
|
||||
"here"] " to open your email client and to send it to " (str (or client-email "client@xyz.com")) "."])]}]})))
|
||||
[:a {:href (str "mailto:" (str/join ";" (map :email client-emails)) "?body=" (email-body (-> result :profit-and-loss-pdf :report-url)))}
|
||||
"here"] " to open your email client and to send it to " (str/join "," (map (fn [e]
|
||||
(str (:email e) " (" (:description e) ")"))
|
||||
client-emails)) "."])]}]})))
|
||||
(re-frame/reg-event-fx
|
||||
::export-pdf
|
||||
[with-user (forms/in-form ::form)]
|
||||
|
||||
Reference in New Issue
Block a user