Adds support for more than one email address.
This commit is contained in:
@@ -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