CRM-15578 - body_text, body_html - Allow multiple instances
[civicrm-core.git] / partials / crmMailing2 / mailing.html
index 6f38677e9dcff921581ee6cb8e6539f2c1403282..ed33ec2d11c071ad55dedff7f23306d1ddfb9cff 100644 (file)
@@ -1,65 +1,90 @@
 <!--
 Controller: EditMailingCtrl
 Required vars: mailing, crmMailingConst
-FIXME: Don't hardcode table-based layout!
+Note: Much of this file is duplicated in crmMailing and crmMailingAB with variations on placement/title/binding.
+It could perhaps be thinned by 30-60% by making more directives.
 -->
-<table class="form-layout-compressed">
-  <tbody>
-    <tr>
-      <td class="label">
-        <label crm-ui-label crm-for="fromAddress">{{ts('From')}}</label>
-      </td>
-      <td>
+<div class="crm-block" ng-form="subform" crm-ui-id-scope>
+  <div class="crm-group">
+    <div crm-ui-field="subform.msg_template_id" crm-title="ts('Template')" style="background: #bbf; width:100%; padding: 0.1em;">
+      <div ng-controller="MsgTemplateCtrl">
         <select
+          crm-ui-id="subform.msg_template_id"
+          name="msg_template_id"
+          crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}"
+          ng-model="mailing.msg_template_id"
+          ng-change="loadTemplate(mailing, mailing.msg_template_id)"
+          >
+          <option value=""></option>
+          <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option>
+        </select>
+        <a ng-click="saveTemplate(mailing)" class="crm-hover-button action-item" title="{{ts('Save As')}}"><span class="icon ui-icon-disk"></span></a>
+      </div>
+    </div>
+    <div crm-ui-field="subform.fromAddress" crm-title="ts('From')">
+      <div ng-controller="EmailAddrCtrl" crm-mailing-from-address="fromPlaceholder" crm-mailing="mailing">
+        <select
+          crm-ui-id="subform.fromAddress"
           name="fromAddress"
           ui-jq="select2"
           ui-options="{dropdownAutoWidth : true, allowClear: false, placeholder: ts('Email address')}"
-          ng-model="mailing.from"
-          ng-options="frm.label as frm.label for frm in crmMailingConst.fromAddress"
+          ng-model="fromPlaceholder.label"
+          ng-options="frm.label as frm.label for frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'"
           required>
           <option value=""></option>
         </select>
-      </td>
-    </tr>
-    <tr>
-      <td class="label">
-        <label crm-ui-label crm-for="replyTo">{{ts('Reply-To')}}</label>
-      </td>
-      <td>
+      </div>
+    </div>
+    <div crm-ui-field="subform.replyTo" crm-title="ts('Reply-To')" ng-show="crmMailingConst.enableReplyTo">
+      <div ng-controller="EmailAddrCtrl">
         <select
+          crm-ui-id="subform.replyTo"
           name="replyTo"
           ui-jq="select2"
           ui-options="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Email address')}"
           ng-model="mailing.replyto_email"
-          ng-options="frm.label as frm.label for frm in crmMailingConst.fromAddress"
+          ng-options="frm.label as frm.label for frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'"
           >
           <option value=""></option>
         </select>
-      </td>
-    </tr>
-    <tr>
-      <td class="label">
-        <label crm-ui-label crm-for="recipients">{{ts('Recipients')}}</label>
-      </td>
-      <td ng-include="partialUrl('field/recipients.html')">
-      </td>
-    </tr>
-    <tr>
-      <td class="label">
-        <label crm-ui-label crm-for="subject">{{ts('Subject')}}</label>
-      </td>
-      <td>
+      </div>
+    </div>
+    <div crm-ui-field="subform.recipients" crm-title="ts('Recipients')">
+      <div ng-controller="EditRecipCtrl">
         <div style="float: right;">
-          <input crm-mailing-token crm-for="subject" />
+          <div class='crmMailing2-recip-est'>
+            <a href="" ng-click="previewRecipients()">{{getRecipientsEstimate()}}</a>
+          </div>
+          <div>
+            <input name='dedupe_email' type='checkbox' ng-model='mailing.dedupe_email'  ng-true-value="1" ng-false-value="0" id="recipients-dedupe-email" />
+            <label for="recipients-dedupe-email">
+              {{ts('Dedupe')}}
+            </label>
+          </div>
         </div>
-        <input
-          type="text"
-          class="crm-form-text"
-          ng-model="mailing.subject"
-          required
-          placeholder="Subject"
-          name="subject" />
-      </td>
-    </tr>
-  </tbody>
-</table>
+        <select crm-mailing-recipients
+                crm-mailing="mailing"
+                crm-avail-groups="crmMailingConst.groupNames | filter:{visibility:'Public pages'}"
+                crm-avail-mailings="crmMailingConst.civiMails | filter:{is_completed:1}"
+                name="recipients"
+                crm-ui-id="subform.recipients"
+                required
+                multiple>
+        </select>
+      </div>
+    </div>
+    <div crm-ui-field="subform.subject" crm-title="ts('Subject')">
+      <div style="float: right;">
+        <input crm-mailing-token crm-for="subform.subject" />
+      </div>
+      <input
+        crm-ui-id="subform.subject"
+        type="text"
+        class="crm-form-text"
+        ng-model="mailing.subject"
+        required
+        placeholder="Subject"
+        name="subject" />
+    </div>
+  </div>
+</div>