| 1 | <!-- |
| 2 | Controller: EditMailingCtrl |
| 3 | Required vars: mailing, crmMailingConst |
| 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 | <div class="crm-block" ng-form="subform" crm-ui-id-scope> |
| 8 | <div class="crm-group"> |
| 9 | <div crm-ui-field="{name: 'subform.msg_template_id', title: ts('Template')}"> |
| 10 | <div ng-controller="MsgTemplateCtrl"> |
| 11 | <select |
| 12 | crm-ui-id="subform.msg_template_id" |
| 13 | name="msg_template_id" |
| 14 | crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}" |
| 15 | ng-model="mailing.msg_template_id" |
| 16 | ng-change="loadTemplate(mailing, mailing.msg_template_id)" |
| 17 | > |
| 18 | <option value=""></option> |
| 19 | <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option> |
| 20 | </select> |
| 21 | <a crm-icon="disk" ng-if="checkPerm('edit message templates')" ng-click="saveTemplate(mailing)" class="crm-hover-button" title="{{ts('Save As')}}"></a> |
| 22 | </div> |
| 23 | </div> |
| 24 | <div crm-ui-field="{name: 'subform.fromAddress', title: ts('From'), help: hs('from_email')}"> |
| 25 | <div ng-controller="EmailAddrCtrl" crm-mailing-from-address="fromPlaceholder" crm-mailing="mailing"> |
| 26 | <select |
| 27 | crm-ui-id="subform.fromAddress" |
| 28 | crm-ui-select="{dropdownAutoWidth : true, allowClear: false, placeholder: ts('Email address')}" |
| 29 | name="fromAddress" |
| 30 | ng-model="fromPlaceholder.label" |
| 31 | required> |
| 32 | <option value=""></option> |
| 33 | <option ng-repeat="frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'" value="{{frm.label}}">{{frm.label}}</option> |
| 34 | </select> |
| 35 | </div> |
| 36 | </div> |
| 37 | <div crm-ui-field="{name: 'subform.replyTo', title: ts('Reply-To')}" ng-show="crmMailingConst.enableReplyTo"> |
| 38 | <div ng-controller="EmailAddrCtrl"> |
| 39 | <select |
| 40 | crm-ui-id="subform.replyTo" |
| 41 | crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Email address')}" |
| 42 | name="replyTo" |
| 43 | ng-change="checkReplyToChange(mailing)" |
| 44 | ng-model="mailing.replyto_email" |
| 45 | > |
| 46 | <option value=""></option> |
| 47 | <option ng-repeat="frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'" value="{{frm.label}}">{{frm.label}}</option> |
| 48 | </select> |
| 49 | </div> |
| 50 | </div> |
| 51 | <div crm-ui-field="{name: 'subform.recipients', title: ts('Recipients')}"> |
| 52 | <div crm-mailing-block-recipients="{name: 'recipients', id: 'subform.recipients'}" crm-mailing="mailing"></div> |
| 53 | </div> |
| 54 | <span ng-controller="EditUnsubGroupCtrl"> |
| 55 | <div crm-ui-field="{name: 'subform.baseGroup', title: ts('Unsubscribe Group')}" ng-if="isUnsubGroupRequired(mailing)"> |
| 56 | <select |
| 57 | crm-ui-id="subform.baseGroup" |
| 58 | crm-ui-select |
| 59 | name="baseGroup" |
| 60 | ng-model="mailing.recipients.groups.base[0]" |
| 61 | ng-required="true" |
| 62 | > |
| 63 | <option ng-repeat="grp in crmMailingConst.groupNames | orderBy:'title'" value="{{grp.id}}">{{grp.title}}</option> |
| 64 | </select> |
| 65 | </div> |
| 66 | </span> |
| 67 | <div crm-ui-field="{name: 'subform.subject', title: ts('Subject')}"> |
| 68 | <div style="float: right;"> |
| 69 | <input crm-mailing-token on-select="$broadcast('insert:subject', token.name)" tabindex="-1"/> |
| 70 | </div> |
| 71 | <input |
| 72 | crm-ui-id="subform.subject" |
| 73 | crm-ui-insert-rx="insert:subject" |
| 74 | type="text" |
| 75 | class="crm-form-text" |
| 76 | ng-model="mailing.subject" |
| 77 | required |
| 78 | placeholder="Subject" |
| 79 | name="subject" /> |
| 80 | </div> |
| 81 | </div> |
| 82 | </div> |