| 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 | crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}" |
| 24 | ng-model="abtest.mailings.a.msg_template_id" |
| 25 | ng-change="loadTemplate(abtest.mailings.a, abtest.mailings.a.msg_template_id)" |
| 26 | > |
| 27 | <option value=""></option> |
| 28 | <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option> |
| 29 | </select> |
| 30 | <a crm-icon="disk" ng-click="saveTemplate(abtest.mailings.a)" class="crm-hover-button" title="{{ts('Save As')}}"></a> |
| 31 | </div> |
| 32 | </div> |
| 33 | <div crm-ui-field="{name: 'subform.msg_template_idA', title: ts('Template (A)')}" ng-if="fields.msg_template_idA"> |
| 34 | <div ng-controller="MsgTemplateCtrl"> |
| 35 | <select |
| 36 | crm-ui-id="subform.msg_template_idA" |
| 37 | name="msg_template_idA" |
| 38 | crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}" |
| 39 | ng-model="abtest.mailings.a.msg_template_id" |
| 40 | ng-change="loadTemplate(abtest.mailings.a, abtest.mailings.a.msg_template_id)" |
| 41 | > |
| 42 | <option value=""></option> |
| 43 | <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option> |
| 44 | </select> |
| 45 | <a crm-icon="disk" ng-click="saveTemplate(abtest.mailings.a)" class="crm-hover-button" title="{{ts('Save As')}}"></a> |
| 46 | </div> |
| 47 | </div> |
| 48 | <div crm-ui-field="{name: 'subform.msg_template_idB', title: ts('Template (B)')}" ng-if="fields.msg_template_idB"> |
| 49 | <div ng-controller="MsgTemplateCtrl"> |
| 50 | <select |
| 51 | crm-ui-id="subform.msg_template_idB" |
| 52 | name="msg_template_idB" |
| 53 | crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}" |
| 54 | ng-model="abtest.mailings.b.msg_template_id" |
| 55 | ng-change="loadTemplate(abtest.mailings.b, abtest.mailings.b.msg_template_id)" |
| 56 | > |
| 57 | <option value=""></option> |
| 58 | <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option> |
| 59 | </select> |
| 60 | <a crm-icon="disk" ng-click="saveTemplate(abtest.mailings.b)" class="crm-hover-button" title="{{ts('Save As')}}"></a> |
| 61 | </div> |
| 62 | </div> |
| 63 | |
| 64 | |
| 65 | <div crm-ui-field="{name: 'subform.fromAddress', title: ts('From'), help: hs('from_email')}" ng-if="fields.fromAddress"> |
| 66 | <span ng-controller="EmailAddrCtrl" crm-mailing-from-address="fromPlaceholder" crm-mailing="abtest.mailings.a"> |
| 67 | <select |
| 68 | crm-ui-id="subform.fromAddress" |
| 69 | crm-ui-select="{dropdownAutoWidth : true, allowClear: false, placeholder: ts('Email address')}" |
| 70 | name="fromAddress" |
| 71 | ng-model="fromPlaceholder.label" |
| 72 | required> |
| 73 | <option value=""></option> |
| 74 | <option ng-repeat="frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'" value="{{frm.label}}">{{frm.label}}</option> |
| 75 | </select> |
| 76 | </span> |
| 77 | </div> |
| 78 | <div crm-ui-field="{name: 'subform.fromAddressA', title: ts('From (A)'), help: hs('from_email')}" ng-if="fields.fromAddressA"> |
| 79 | <span ng-controller="EmailAddrCtrl" crm-mailing-from-address="fromPlaceholder" crm-mailing="abtest.mailings.a"> |
| 80 | <select |
| 81 | crm-ui-id="subform.fromAddressA" |
| 82 | crm-ui-select="{dropdownAutoWidth : true, allowClear: false, placeholder: ts('Email address')}" |
| 83 | name="fromAddressA" |
| 84 | ng-model="fromPlaceholder.label" |
| 85 | required> |
| 86 | <option value=""></option> |
| 87 | <option ng-repeat="frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'" value="{{frm.label}}">{{frm.label}}</option> |
| 88 | </select> |
| 89 | </span> |
| 90 | </div> |
| 91 | <div crm-ui-field="{name: 'subform.fromAddressB', title: ts('From (B)'), help: hs('from_email')}" ng-if="fields.fromAddressB"> |
| 92 | <span ng-controller="EmailAddrCtrl" crm-mailing-from-address="fromPlaceholder" crm-mailing="abtest.mailings.b"> |
| 93 | <select |
| 94 | crm-ui-id="subform.fromAddressB" |
| 95 | crm-ui-select="{dropdownAutoWidth : true, allowClear: false, placeholder: ts('Email address')}" |
| 96 | name="fromAddressB" |
| 97 | ng-model="fromPlaceholder.label" |
| 98 | required> |
| 99 | <option value=""></option> |
| 100 | <option ng-repeat="frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'" value="{{frm.label}}">{{frm.label}}</option> |
| 101 | </select> |
| 102 | </span> |
| 103 | </div> |
| 104 | |
| 105 | |
| 106 | <div crm-ui-field="{name: 'subform.replyTo', title: ts('Reply-To')}" ng-show="crmMailingConst.enableReplyTo" ng-if="fields.replyTo"> |
| 107 | <span ng-controller="EmailAddrCtrl"> |
| 108 | <select |
| 109 | crm-ui-id="subform.replyTo" |
| 110 | crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Email address')}" |
| 111 | name="replyTo" |
| 112 | ng-change="checkReplyToChange(abtest.mailings.a)" |
| 113 | ng-model="abtest.mailings.a.replyto_email" |
| 114 | > |
| 115 | <option value=""></option> |
| 116 | <option ng-repeat="frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'" value="{{frm.label}}">{{frm.label}}</option> |
| 117 | </select> |
| 118 | </span> |
| 119 | </div> |
| 120 | <div crm-ui-field="{name: 'subform.replyToA', title: ts('Reply-To (A)')}" ng-show="crmMailingConst.enableReplyTo" ng-if="fields.replyToA"> |
| 121 | <span ng-controller="EmailAddrCtrl"> |
| 122 | <select |
| 123 | crm-ui-id="subform.replyToA" |
| 124 | crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Email address')}" |
| 125 | name="replyToA" |
| 126 | ng-change="checkReplyToChange(abtest.mailings.a)" |
| 127 | ng-model="abtest.mailings.a.replyto_email" |
| 128 | > |
| 129 | <option value=""></option> |
| 130 | <option ng-repeat="frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'" value="{{frm.label}}">{{frm.label}}</option> |
| 131 | </select> |
| 132 | </span> |
| 133 | </div> |
| 134 | <div crm-ui-field="{name: 'subform.replyToB', title: ts('Reply-To (B)')}" ng-show="crmMailingConst.enableReplyTo" ng-if="fields.replyToB"> |
| 135 | <span ng-controller="EmailAddrCtrl"> |
| 136 | <select |
| 137 | crm-ui-id="subform.replyToB" |
| 138 | crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Email address')}" |
| 139 | name="replyToB" |
| 140 | ng-change="checkReplyToChange(abtest.mailings.b)" |
| 141 | ng-model="abtest.mailings.b.replyto_email" |
| 142 | > |
| 143 | <option value=""></option> |
| 144 | <option ng-repeat="frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'" value="{{frm.label}}">{{frm.label}}</option> |
| 145 | </select> |
| 146 | </span> |
| 147 | </div> |
| 148 | |
| 149 | |
| 150 | <div crm-ui-field="{name: 'subform.subject', title: ts('Subject')}" ng-if="fields.subject"> |
| 151 | <div style="float: right;"> |
| 152 | <input crm-mailing-token on-select="$broadcast('insert:subject', token.name)" tabindex="-1"/> |
| 153 | </div> |
| 154 | <input |
| 155 | crm-ui-id="subform.subject" |
| 156 | crm-ui-insert-rx="insert:subject" |
| 157 | type="text" |
| 158 | class="crm-form-text" |
| 159 | ng-model="abtest.mailings.a.subject" |
| 160 | required |
| 161 | placeholder="Subject" |
| 162 | name="subject" /> |
| 163 | </div> |
| 164 | <div crm-ui-field="{name: 'subform.subjectA', title: ts('Subject (A)')}" ng-if="fields.subjectA"> |
| 165 | <div style="float: right;"> |
| 166 | <input crm-mailing-token on-select="$broadcast('insert:subjectA', token.name)" tabindex="-1"/> |
| 167 | </div> |
| 168 | <input |
| 169 | crm-ui-id="subform.subjectA" |
| 170 | crm-ui-insert-rx="insert:subjectA" |
| 171 | type="text" |
| 172 | class="crm-form-text" |
| 173 | ng-model="abtest.mailings.a.subject" |
| 174 | required |
| 175 | placeholder="Subject" |
| 176 | name="subjectA" /> |
| 177 | </div> |
| 178 | <div crm-ui-field="{name: 'subform.subjectB', title: ts('Subject (B)')}" ng-if="fields.subjectB"> |
| 179 | <div style="float: right;"> |
| 180 | <input crm-mailing-token on-select="$broadcast('insert:subjectB', token.name)" tabindex="-1"/> |
| 181 | </div> |
| 182 | <input |
| 183 | crm-ui-id="subform.subjectB" |
| 184 | crm-ui-insert-rx="insert:subjectB" |
| 185 | type="text" |
| 186 | class="crm-form-text" |
| 187 | ng-model="abtest.mailings.b.subject" |
| 188 | required |
| 189 | placeholder="Subject" |
| 190 | name="subjectB" /> |
| 191 | </div> |
| 192 | </div> |
| 193 | </div> |