Matteo Scandolo | 9f87f30 | 2016-12-13 18:11:10 -0800 | [diff] [blame] | 1 | <!--<div ng-show="vm.data.length > 0 && vm.loader == false">--> |
| 2 | <div class="row" ng-if="vm.config.filter == 'fulltext'"> |
| 3 | <div class="col-xs-12"> |
| 4 | <input |
| 5 | class="form-control" |
| 6 | placeholder="Type to search.." |
| 7 | type="text" |
| 8 | ng-model="vm.query"/> |
| 9 | </div> |
| 10 | </div> |
Matteo Scandolo | d62ea79 | 2016-12-22 14:02:28 -0800 | [diff] [blame] | 11 | <div class="table-responsive"> |
| 12 | <table ng-class="vm.classes"> |
Matteo Scandolo | 9f87f30 | 2016-12-13 18:11:10 -0800 | [diff] [blame] | 13 | <thead> |
| 14 | <tr> |
| 15 | <th ng-repeat="col in vm.columns"> |
| 16 | {{col.label}} |
Matteo Scandolo | d62ea79 | 2016-12-22 14:02:28 -0800 | [diff] [blame] | 17 | <div ng-if="vm.config.order"> |
Matteo Scandolo | 9f87f30 | 2016-12-13 18:11:10 -0800 | [diff] [blame] | 18 | <a href="" ng-click="vm.orderBy = col.prop; vm.reverse = false"> |
Matteo Scandolo | d58d504 | 2016-12-16 16:59:21 -0800 | [diff] [blame] | 19 | <i class="fa fa-chevron-up"></i> |
Matteo Scandolo | 9f87f30 | 2016-12-13 18:11:10 -0800 | [diff] [blame] | 20 | </a> |
| 21 | <a href="" ng-click="vm.orderBy = col.prop; vm.reverse = true"> |
Matteo Scandolo | d58d504 | 2016-12-16 16:59:21 -0800 | [diff] [blame] | 22 | <i class="fa fa-chevron-down"></i> |
Matteo Scandolo | 9f87f30 | 2016-12-13 18:11:10 -0800 | [diff] [blame] | 23 | </a> |
Matteo Scandolo | d62ea79 | 2016-12-22 14:02:28 -0800 | [diff] [blame] | 24 | </div> |
Matteo Scandolo | 9f87f30 | 2016-12-13 18:11:10 -0800 | [diff] [blame] | 25 | </th> |
| 26 | <th ng-if="vm.config.actions">Actions:</th> |
| 27 | </tr> |
| 28 | </thead> |
| 29 | <tbody ng-if="vm.config.filter == 'field'"> |
Matteo Scandolo | ee655a1 | 2016-12-19 15:38:43 -0800 | [diff] [blame] | 30 | <tr> |
| 31 | <td ng-repeat="col in vm.columns"> |
| 32 | <input |
| 33 | ng-if="col.type !== 'boolean' && col.type !== 'array' && col.type !== 'object' && col.type !== 'custom'" |
| 34 | class="form-control" |
| 35 | placeholder="Type to search by {{col.label}}" |
| 36 | type="text" |
| 37 | ng-model="vm.query[col.prop]"/> |
| 38 | <select |
| 39 | ng-if="col.type === 'boolean'" |
| 40 | class="form-control" |
| 41 | ng-model="vm.query[col.prop]"> |
| 42 | <option value="">-</option> |
| 43 | <option value="true">True</option> |
| 44 | <option value="false">False</option> |
| 45 | </select> |
| 46 | </td> |
| 47 | <td ng-if="vm.config.actions"></td> |
| 48 | </tr> |
Matteo Scandolo | 9f87f30 | 2016-12-13 18:11:10 -0800 | [diff] [blame] | 49 | </tbody> |
| 50 | <tbody> |
| 51 | <tr ng-repeat="item in vm.data | filter:vm.query | orderBy:vm.orderBy:vm.reverse track by $index"> |
Matteo Scandolo | ee655a1 | 2016-12-19 15:38:43 -0800 | [diff] [blame] | 52 | <td ng-repeat="col in vm.columns" xos-link-wrapper> |
Matteo Scandolo | 9f87f30 | 2016-12-13 18:11:10 -0800 | [diff] [blame] | 53 | <span ng-if="!col.type || col.type === 'text'">{{item[col.prop]}}</span> |
| 54 | <span ng-if="col.type === 'boolean'"> |
Matteo Scandolo | d58d504 | 2016-12-16 16:59:21 -0800 | [diff] [blame] | 55 | <i class="fa" |
| 56 | ng-class="{'fa-ok': item[col.prop], 'fa-remove': !item[col.prop]}"> |
Matteo Scandolo | 9f87f30 | 2016-12-13 18:11:10 -0800 | [diff] [blame] | 57 | </i> |
| 58 | </span> |
| 59 | <span ng-if="col.type === 'date'"> |
| 60 | {{item[col.prop] | date:'H:mm MMM d, yyyy'}} |
| 61 | </span> |
| 62 | <span ng-if="col.type === 'array'"> |
| 63 | {{item[col.prop] | arrayToList}} |
| 64 | </span> |
| 65 | <span ng-if="col.type === 'object'"> |
| 66 | <dl class="dl-horizontal"> |
| 67 | <span ng-repeat="(k,v) in item[col.prop]"> |
| 68 | <dt>{{k}}</dt> |
| 69 | <dd>{{v}}</dd> |
| 70 | </span> |
| 71 | </dl> |
| 72 | </span> |
| 73 | <span ng-if="col.type === 'custom'"> |
| 74 | {{col.formatter(item)}} |
| 75 | </span> |
| 76 | <span ng-if="col.type === 'icon'"> |
Matteo Scandolo | d58d504 | 2016-12-16 16:59:21 -0800 | [diff] [blame] | 77 | <i class="fa fa-{{col.formatter(item)}}"> |
Matteo Scandolo | 9f87f30 | 2016-12-13 18:11:10 -0800 | [diff] [blame] | 78 | </i> |
| 79 | </span> |
| 80 | </td> |
| 81 | <td ng-if="vm.config.actions"> |
| 82 | <a href="" |
| 83 | ng-repeat="action in vm.config.actions" |
| 84 | ng-click="action.cb(item)" |
| 85 | title="{{action.label}}"> |
| 86 | <i |
Matteo Scandolo | d58d504 | 2016-12-16 16:59:21 -0800 | [diff] [blame] | 87 | class="fa fa-{{action.icon}}" |
Matteo Scandolo | 9f87f30 | 2016-12-13 18:11:10 -0800 | [diff] [blame] | 88 | style="color: {{action.color}};"></i> |
| 89 | </a> |
| 90 | </td> |
| 91 | </tr> |
| 92 | </tbody> |
| 93 | </table> |
Matteo Scandolo | d62ea79 | 2016-12-22 14:02:28 -0800 | [diff] [blame] | 94 | </div> |
Matteo Scandolo | 9f87f30 | 2016-12-13 18:11:10 -0800 | [diff] [blame] | 95 | <!--</div>--> |
| 96 | <!--<div ng-show="(vm.data.length == 0 || !vm.data) && vm.loader == false">--> |
| 97 | <!--<xos-alert config="{type: 'info'}">--> |
| 98 | <!--No data to show.--> |
| 99 | <!--</xos-alert>--> |
| 100 | <!--</div>--> |
| 101 | <!--<div ng-show="vm.loader == true">--> |
| 102 | <!--<div class="loader"></div>--> |
| 103 | <!--</div>--> |