| 1 | <!-- |
| 2 | Required vars: abtest, fields |
| 3 | |
| 4 | Note: Much of this file is duplicated in crmMailing and crmMailingAB with variations on placement/title/binding. |
| 5 | It could perhaps be thinned by 30-60% by making more directives. |
| 6 | |
| 7 | This template follows a basic pattern. For each included field, there are three variants, as in this example: |
| 8 | - fromAddress: The default From: address shared by both mailings (representatively mapped to mailing A) |
| 9 | - fromAddressA: The From: address for mailing A |
| 10 | - fromAddressB: The From: address for mailing B |
| 11 | Each variant is guarded with "ng-if='fields.fieldName'"; if true, the field will be displayed and |
| 12 | processed by Angular; if false, the field will be hidden and completely ignored by Angular. |
| 13 | --> |
| 14 | <div class="crm-block" ng-form="subform" crm-ui-id-scope> |
| 15 | <div class="crm-group"> |
| 16 | |
| 17 | |
| 18 | <div crm-ui-field="{name: 'subform.msg_template_id', title: ts('Template')}" ng-if="fields.msg_template_id"> |
| 19 | <div ng-controller="MsgTemplateCtrl"> |
| 20 | <select |
| 21 | crm-ui-id="subform.msg_template_id" |
| 22 | name="msg_template_id" |
| 23 | class="fa-clipboard" |
| 24 | crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}" |
| 25 | ng-model="abtest.mailings.a.msg_template_id" |
| 26 | ng-change="loadTemplate(abtest.mailings.a, abtest.mailings.a.msg_template_id)" |
| 27 | > |
| 28 | <option value=""></option> |
| 29 | <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option> |
| 30 | </select> |
| 31 | <a crm-icon="fa-floppy-o" ng-click="saveTemplate(abtest.mailings.a)" class="crm-hover-button" title="{{ts('Save As')}}"></a> |
| 32 | </div> |
| 33 | </div> |
| 34 | <div crm-ui-field="{name: 'subform.msg_template_idA', title: ts('Template (A)')}" ng-if="fields.msg_template_idA"> |
| 35 | <div ng-controller="MsgTemplateCtrl"> |
| 36 | <select |
| 37 | crm-ui-id="subform.msg_template_idA" |
| 38 | name="msg_template_idA" |
| 39 | class="fa-clipboard" |
| 40 | crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}" |
| 41 | ng-model="abtest.mailings.a.msg_template_id" |
| 42 | ng-change="loadTemplate(abtest.mailings.a, abtest.mailings.a.msg_template_id)" |
| 43 | > |
| 44 | <option value=""></option> |
| 45 | <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option> |
| 46 | </select> |
| 47 | <a crm-icon="fa-floppy-o" ng-click="saveTemplate(abtest.mailings.a)" class="crm-hover-button" title="{{ts('Save As')}}"></a> |
| 48 | </div> |
| 49 | </div> |
| 50 | <div crm-ui-field="{name: 'subform.msg_template_idB', title: ts('Template (B)')}" ng-if="fields.msg_template_idB"> |
| 51 | <div ng-controller="MsgTemplateCtrl"> |
| 52 | <select |
| 53 | crm-ui-id="subform.msg_template_idB" |
| 54 | name="msg_template_idB" |
| 55 | class="fa-clipboard" |
| 56 | crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}" |
| 57 | ng-model="abtest.mailings.b.msg_template_id" |
| 58 | ng-change="loadTemplate(abtest.mailings.b, abtest.mailings.b.msg_template_id)" |
| 59 | > |
| 60 | <option value=""></option> |
| 61 | <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option> |
| 62 | </select> |
| 63 | <a crm-icon="fa-floppy-o" ng-click="saveTemplate(abtest.mailings.b)" class="crm-hover-button" title="{{ts('Save As')}}"></a> |
| 64 | </div> |
| 65 | </div> |
| 66 | |
| 67 | |
| 68 | <div crm-ui-field="{name: 'subform.fromAddress', title: ts('From'), help: hs('from_email')}" ng-if="fields.fromAddress"> |
| 69 | <span ng-controller="EmailAddrCtrl" crm-mailing-from-address="fromPlaceholder" crm-mailing="abtest.mailings.a"> |
| 70 | <select |
| 71 | crm-ui-id="subform.fromAddress" |
| 72 | crm-ui-select="{dropdownAutoWidth : true, allowClear: false, placeholder: ts('Email address')}" |
| 73 | name="fromAddress" |
| 74 | ng-model="fromPlaceholder.label" |
| 75 | required> |
| 76 | <option value=""></option> |
| 77 | <option ng-repeat="frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'" value="{{frm.label}}">{{frm.label}}</option> |
| 78 | </select> |
| 79 | </span> |
| 80 | </div> |
| 81 | <div crm-ui-field="{name: 'subform.fromAddressA', title: ts('From (A)'), help: hs('from_email')}" ng-if="fields.fromAddressA"> |
| 82 | <span ng-controller="EmailAddrCtrl" crm-mailing-from-address="fromPlaceholder" crm-mailing="abtest.mailings.a"> |
| 83 | <select |
| 84 | crm-ui-id="subform.fromAddressA" |
| 85 | crm-ui-select="{dropdownAutoWidth : true, allowClear: false, placeholder: ts('Email address')}" |
| 86 | name="fromAddressA" |
| 87 | ng-model="fromPlaceholder.label" |
| 88 | required> |
| 89 | <option value=""></option> |
| 90 | <option ng-repeat="frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'" value="{{frm.label}}">{{frm.label}}</option> |
| 91 | </select> |
| 92 | </span> |
| 93 | </div> |
| 94 | <div crm-ui-field="{name: 'subform.fromAddressB', title: ts('From (B)'), help: hs('from_email')}" ng-if="fields.fromAddressB"> |
| 95 | <span ng-controller="EmailAddrCtrl" crm-mailing-from-address="fromPlaceholder" crm-mailing="abtest.mailings.b"> |
| 96 | <select |
| 97 | crm-ui-id="subform.fromAddressB" |
| 98 | crm-ui-select="{dropdownAutoWidth : true, allowClear: false, placeholder: ts('Email address')}" |
| 99 | name="fromAddressB" |
| 100 | ng-model="fromPlaceholder.label" |
| 101 | required> |
| 102 | <option value=""></option> |
| 103 | <option ng-repeat="frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'" value="{{frm.label}}">{{frm.label}}</option> |
| 104 | </select> |
| 105 | </span> |
| 106 | </div> |
| 107 | |
| 108 | |
| 109 | <div crm-ui-field="{name: 'subform.replyTo', title: ts('Reply-To')}" ng-show="crmMailingConst.enableReplyTo" ng-if="fields.replyTo"> |
| 110 | <span ng-controller="EmailAddrCtrl"> |
| 111 | <select |
| 112 | crm-ui-id="subform.replyTo" |
| 113 | crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Email address')}" |
| 114 | name="replyTo" |
| 115 | ng-change="checkReplyToChange(abtest.mailings.a)" |
| 116 | ng-model="abtest.mailings.a.replyto_email" |
| 117 | > |
| 118 | <option value=""></option> |
| 119 | <option ng-repeat="frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'" value="{{frm.label}}">{{frm.label}}</option> |
| 120 | </select> |
| 121 | </span> |
| 122 | </div> |
| 123 | <div crm-ui-field="{name: 'subform.replyToA', title: ts('Reply-To (A)')}" ng-show="crmMailingConst.enableReplyTo" ng-if="fields.replyToA"> |
| 124 | <span ng-controller="EmailAddrCtrl"> |
| 125 | <select |
| 126 | crm-ui-id="subform.replyToA" |
| 127 | crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Email address')}" |
| 128 | name="replyToA" |
| 129 | ng-change="checkReplyToChange(abtest.mailings.a)" |
| 130 | ng-model="abtest.mailings.a.replyto_email" |
| 131 | > |
| 132 | <option value=""></option> |
| 133 | <option ng-repeat="frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'" value="{{frm.label}}">{{frm.label}}</option> |
| 134 | </select> |
| 135 | </span> |
| 136 | </div> |
| 137 | <div crm-ui-field="{name: 'subform.replyToB', title: ts('Reply-To (B)')}" ng-show="crmMailingConst.enableReplyTo" ng-if="fields.replyToB"> |
| 138 | <span ng-controller="EmailAddrCtrl"> |
| 139 | <select |
| 140 | crm-ui-id="subform.replyToB" |
| 141 | crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Email address')}" |
| 142 | name="replyToB" |
| 143 | ng-change="checkReplyToChange(abtest.mailings.b)" |
| 144 | ng-model="abtest.mailings.b.replyto_email" |
| 145 | > |
| 146 | <option value=""></option> |
| 147 | <option ng-repeat="frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'" value="{{frm.label}}">{{frm.label}}</option> |
| 148 | </select> |
| 149 | </span> |
| 150 | </div> |
| 151 | |
| 152 | |
| 153 | <div crm-ui-field="{name: 'subform.subject', title: ts('Subject')}" ng-if="fields.subject"> |
| 154 | <div style="float: right;"> |
| 155 | <input crm-mailing-token on-select="$broadcast('insert:subject', token.name)" tabindex="-1"> |
| 156 | </div> |
| 157 | <input |
| 158 | crm-ui-id="subform.subject" |
| 159 | crm-ui-insert-rx="insert:subject" |
| 160 | type="text" |
| 161 | class="crm-form-text" |
| 162 | ng-model="abtest.mailings.a.subject" |
| 163 | required |
| 164 | placeholder="Subject" |
| 165 | name="subject" > |
| 166 | </div> |
| 167 | <div crm-ui-field="{name: 'subform.subjectA', title: ts('Subject (A)')}" ng-if="fields.subjectA"> |
| 168 | <div style="float: right;"> |
| 169 | <input crm-mailing-token on-select="$broadcast('insert:subjectA', token.name)" tabindex="-1"> |
| 170 | </div> |
| 171 | <input |
| 172 | crm-ui-id="subform.subjectA" |
| 173 | crm-ui-insert-rx="insert:subjectA" |
| 174 | type="text" |
| 175 | class="crm-form-text" |
| 176 | ng-model="abtest.mailings.a.subject" |
| 177 | required |
| 178 | placeholder="Subject" |
| 179 | name="subjectA" > |
| 180 | </div> |
| 181 | <div crm-ui-field="{name: 'subform.subjectB', title: ts('Subject (B)')}" ng-if="fields.subjectB"> |
| 182 | <div style="float: right;"> |
| 183 | <input crm-mailing-token on-select="$broadcast('insert:subjectB', token.name)" tabindex="-1"> |
| 184 | </div> |
| 185 | <input |
| 186 | crm-ui-id="subform.subjectB" |
| 187 | crm-ui-insert-rx="insert:subjectB" |
| 188 | type="text" |
| 189 | class="crm-form-text" |
| 190 | ng-model="abtest.mailings.b.subject" |
| 191 | required |
| 192 | placeholder="Subject" |
| 193 | name="subjectB" > |
| 194 | </div> |
| 195 | </div> |
| 196 | </div> |