// Scope members:
// - [input] mailing: object
// - [output] recipients: array of recipient records
- angular.module('crmMailing').controller('EditRecipCtrl', function EditRecipCtrl($scope, dialogService, crmApi, crmMailingMgr) {
+ angular.module('crmMailing').controller('EditRecipCtrl', function EditRecipCtrl($scope, dialogService, crmApi, crmMailingMgr, $q, crmMetadata) {
var ts = $scope.ts = CRM.ts(null);
$scope.recipients = null;
$scope.getRecipientsEstimate = function () {
modal: true,
title: ts('Edit Options')
};
- dialogService.open('previewComponentDialog', '~/crmMailing/dialog/recipientOptions.html', mailing, options);
+ $q.when(crmMetadata.getFields('Mailing')).then(function(fields) {
+ var model = {
+ fields: fields,
+ mailing: mailing
+ };
+ dialogService.open('previewComponentDialog', '~/crmMailing/dialog/recipientOptions.html', model, options);
+ });
};
});
-<div ng-controller="EditRecipOptionsDialogCtrl">
- <div class="crm-block" ng-form="responseForm" crm-ui-id-scope>
+<div ng-controller="EditRecipOptionsDialogCtrl" class="crmMailing">
+ <div class="crm-block" ng-form="editRecipOptionsForm" crm-ui-id-scope>
<div class="crm-group">
+
<!-- FIXME: ts is not working here. -->
<div crm-ui-field crm-title="'Dedupe by email'" crm-layout="checkbox">
<input
type='checkbox'
- ng-model='model.dedupe_email'
+ ng-model='model.mailing.dedupe_email'
ng-true-value="'1'"
ng-false-value="'0'"
/>
<p>{{ts('To send only one message to the shared address, enable this option. Mail-merge tokens will be filled for only one person.')}}</p>
<p>{{ts('To send separate messages for each person, disable this option. Mail-merge tokens will be filled separately for each person.')}}</p>
</div>
+
+ <div crm-ui-field="editRecipOptionsForm.location_type_id" crm-title="ts('Location Type')">
+ <select
+ crm-ui-id="editRecipOptionsForm.location_type_id"
+ crm-ui-select="{dropdownAutoWidth : true}"
+ name="location_type_id"
+ ng-model="model.mailing.location_type_id"
+ required
+ >
+
+ <option value="">{{ts('Automatic')}}</option>
+ <option ng-repeat="(locTypeId,locType) in model.fields.location_type_id.options | orderBy:'locType'"
+ ng-value="locTypeId">{{locType}}</option>
+ </select>
+ </div>
+
+ <div crm-ui-field="editRecipOptionsForm.email_selection_method" crm-title="ts('Selection Method')">
+ <select
+ crm-ui-id="editRecipOptionsForm.email_selection_method"
+ crm-ui-select=""
+ name="email_selection_method"
+ ng-model="model.mailing.email_selection_method"
+ required
+ >
+ <option ng-repeat="(selMetId,selMet) in model.fields.email_selection_method.options | orderBy:'selMet'"
+ ng-value="selMetId">{{selMet}}</option>
+ </select>
+ </div>
+
</div>
</div>
</div>