resolve: {
mailingABList: function ($route, crmApi) {
return crmApi('MailingAB', 'get', {rowCount: 0});
+ },
+ fields: function(crmMetadata){
+ return crmMetadata.getFields('MailingAB');
}
}
});
}
]);
- angular.module('crmMailingAB').controller('CrmMailingABListCtrl', function ($scope, mailingABList, crmMailingABCriteria, crmMailingABStatus) {
+ angular.module('crmMailingAB').controller('CrmMailingABListCtrl', function($scope, mailingABList, crmMailingABCriteria, crmMailingABStatus, fields) {
var ts = $scope.ts = CRM.ts(null);
- $scope.mailingABList = mailingABList.values;
+ $scope.mailingABList = _.values(mailingABList.values);
$scope.crmMailingABCriteria = crmMailingABCriteria;
$scope.crmMailingABStatus = crmMailingABStatus;
+ $scope.fields = fields;
+ $scope.filter = {};
});
angular.module('crmMailingAB').controller('CrmMailingABNewCtrl', function ($scope, abtest, $location) {
Required vars: mailingABList
-->
+<span crm-ui-order="{var: 'myOrder', defaults: ['-created_date']}"></span>
+
+<div crm-ui-accordion crm-title="ts('Filter')" crm-collapsed="true">
+ <form name="filterForm">
+ <span>
+ <input class="big crm-form-text" ng-model="filter.name" placeholder="{{ts('Name')}}"/>
+ </span>
+ <span>
+ <select crm-ui-select style="width: 10em;" ng-model="filter.status">
+ <option value="">{{ts('- Status -')}}</option>
+ <option ng-repeat="o in fields.status.options" ng-value="o.key">{{o.value}}</option>
+ </select>
+ </span>
+ <span>
+ <select crm-ui-select style="width: 20em;" ng-model="filter.testing_criteria_id">
+ <option value="">{{ts('- Test Type -')}}</option>
+ <option ng-repeat="o in fields.testing_criteria_id.options" ng-value="o.key">{{crmMailingABCriteria.get(o.key).label}}</option>
+ </select>
+ </span>
+ </form>
+</div>
+
<div ng-show="!$.isEmptyObject(mailingABList)">
<table class="display">
<thead>
<tr>
- <th>{{ts('Name')}}</th>
- <th>{{ts('Status')}}</th>
- <th>{{ts('Test Type')}}</th>
+ <th><a crm-ui-order-by="[myOrder, 'name']">{{ts('Name')}}</a></th>
+ <th><a crm-ui-order-by="[myOrder, 'status']">{{ts('Status')}}</a></th>
+ <th><a crm-ui-order-by="[myOrder, 'testing_criteria_id']">{{ts('Test Type')}}</a></th>
+ <th><a crm-ui-order-by="[myOrder, 'created_date']">{{ts('Created')}}</a></th>
<th></th>
</tr>
</thead>
<tbody>
- <tr ng-repeat="mailingAB in mailingABList">
+ <tr ng-repeat="mailingAB in mailingABList | filter:filter | orderBy:myOrder.get()">
<td>{{mailingAB.name}}</td>
<td>{{crmMailingABStatus.getByName(mailingAB.status).label}}</td>
<td>{{crmMailingABCriteria.get(mailingAB.testing_criteria_id).label}}</td>
+ <td>{{mailingAB.created_date}}</td>
<td>
<a class="action-item crm-hover-button" ng-href="#/abtest/{{mailingAB.id}}" ng-show="mailingAB.status == 'Draft'">{{ts('Continue')}}</a>
<a class="action-item crm-hover-button" ng-href="#/abtest/{{mailingAB.id}}/report" ng-show="mailingAB.status != 'Draft'">{{ts('Results')}}</a>