| 1 | <legend>{{ $ctrl.label || ts('%1 group', {1: $ctrl.conjunctions[$ctrl.op]}) }}</legend> |
| 2 | <div class="btn-group btn-group-xs" ng-if=":: $ctrl.hasParent"> |
| 3 | <button type="button" class="btn btn-danger-outline" ng-click="$ctrl.deleteGroup()" title="{{:: ts('Remove group') }}"> |
| 4 | <i class="crm-i fa-trash" aria-hidden="true"></i> |
| 5 | </button> |
| 6 | </div> |
| 7 | <div class="api4-clause-group-sortable" ng-model="$ctrl.clauses" ui-sortable="$ctrl.sortOptions"> |
| 8 | <div class="api4-input form-inline clearfix" ng-repeat="(index, clause) in $ctrl.clauses" ng-class="{hiddenElement: index < ($ctrl.skip || 0)}"> |
| 9 | <div ng-if="index >= ($ctrl.skip || 0)"> |
| 10 | <div class="api4-clause-badge" title="{{:: ts('Drag to reposition') }}"> |
| 11 | <span class="badge badge-info"> |
| 12 | <span ng-if="index === ($ctrl.skip || 0) && !$ctrl.hasParent">{{ $ctrl.label }}</span> |
| 13 | <span ng-if="index > ($ctrl.skip || 0) || $ctrl.hasParent">{{ $ctrl.conjunctions[$ctrl.op] }}</span> |
| 14 | <i class="crm-i fa-arrows" aria-hidden="true"></i> |
| 15 | </span> |
| 16 | </div> |
| 17 | <div ng-if="!$ctrl.conjunctions[clause[0]]" class="api4-input-group"> |
| 18 | <input class="form-control" ng-model="clause[0]" crm-ui-select="{data: $ctrl.fields, allowClear: true, placeholder: 'Field'}" ng-change="$ctrl.changeClauseField(clause, index)" /> |
| 19 | <select class="form-control api4-operator" ng-model="clause[1]" ng-options="o.key as o.value for o in $ctrl.operators" ng-change="$ctrl.changeClauseOperator(clause)" ></select> |
| 20 | <crm-search-input ng-if="$ctrl.operatorTakesInput(clause[1])" ng-model="clause[2]" field="$ctrl.getField(clause[0])" option-key="$ctrl.getOptionKey(clause[0])" op="clause[1]" format="$ctrl.format" class="form-group"></crm-search-input> |
| 21 | </div> |
| 22 | <fieldset class="clearfix" ng-if="$ctrl.conjunctions[clause[0]]"> |
| 23 | <crm-search-clause clauses="clause[1]" format="{{ $ctrl.format }}" op="{{ clause[0] }}" fields="$ctrl.fields" delete-group="$ctrl.deleteRow(index)" ></crm-search-clause> |
| 24 | </fieldset> |
| 25 | </div> |
| 26 | </div> |
| 27 | </div> |
| 28 | <div class="api4-input form-inline"> |
| 29 | <div class="api4-clause-badge"> |
| 30 | <div class="btn-group btn-group-xs" title="{{ $ctrl.hasParent ? ts('Add a subgroup of clauses') : ts('Add a group of clauses') }}"> |
| 31 | <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
| 32 | {{ $ctrl.conjunctions[$ctrl.op] }} <span class="caret"></span> |
| 33 | </button> |
| 34 | <ul class="dropdown-menu api4-add-where-group-menu"> |
| 35 | <li ng-repeat="(con, label) in $ctrl.conjunctions" ng-show="$ctrl.op !== con"> |
| 36 | <a href ng-click="$ctrl.addGroup(con)">{{ label }}</a> |
| 37 | </li> |
| 38 | </ul> |
| 39 | </div> |
| 40 | </div> |
| 41 | <input class="form-control" ng-model="$ctrl.newClause" ng-change="$ctrl.addClause()" crm-ui-select="{data: $ctrl.fields, placeholder: ts('Select field')}" /> |
| 42 | </div> |