Matteo Scandolo | 710dc15 | 2017-04-11 13:54:23 -0700 | [diff] [blame] | 1 | <div ng-show="vm.data.length > 0 && vm.loader == false"> |
Matteo Scandolo | 9f87f30 | 2016-12-13 18:11:10 -0800 | [diff] [blame] | 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> |
Matteo Scandolo | 5d962a3 | 2017-08-01 18:16:14 -0700 | [diff] [blame] | 15 | <th ng-repeat="col in vm.config.columns"> |
Matteo Scandolo | 9f87f30 | 2016-12-13 18:11:10 -0800 | [diff] [blame] | 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> |
Matteo Scandolo | 5d962a3 | 2017-08-01 18:16:14 -0700 | [diff] [blame] | 31 | <td ng-repeat="col in vm.config.columns"> |
Matteo Scandolo | ee655a1 | 2016-12-19 15:38:43 -0800 | [diff] [blame] | 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> |
Matteo Scandolo | 8b2370c | 2017-02-02 17:19:07 -0800 | [diff] [blame] | 51 | <tr ng-repeat="item in vm.data | filter:vm.query | orderBy:vm.orderBy:vm.reverse | pagination:vm.currentPage * vm.config.pagination.pageSize | limitTo: (vm.config.pagination.pageSize || vm.data.length) track by $index"> |
Matteo Scandolo | 5d962a3 | 2017-08-01 18:16:14 -0700 | [diff] [blame] | 52 | <td ng-repeat="col in vm.config.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'"> |
Matteo Scandolo | 0496423 | 2017-01-07 12:53:46 -0800 | [diff] [blame] | 74 | {{item[col.prop + '-formatted']}} |
| 75 | <i class="ng-hide">{{col.formatter(item)}}</i> |
Matteo Scandolo | 9f87f30 | 2016-12-13 18:11:10 -0800 | [diff] [blame] | 76 | </span> |
| 77 | <span ng-if="col.type === 'icon'"> |
Matteo Scandolo | d58d504 | 2016-12-16 16:59:21 -0800 | [diff] [blame] | 78 | <i class="fa fa-{{col.formatter(item)}}"> |
Matteo Scandolo | 9f87f30 | 2016-12-13 18:11:10 -0800 | [diff] [blame] | 79 | </i> |
Matteo Scandolo | 8b2370c | 2017-02-02 17:19:07 -0800 | [diff] [blame] | 80 | </span> |
| 81 | <div class="xos-table-hover" ng-if="col.hover"> |
| 82 | <div class="alert alert-info"> |
| 83 | {{col.hover(item)}} |
| 84 | </div> |
| 85 | </div> |
Matteo Scandolo | 9f87f30 | 2016-12-13 18:11:10 -0800 | [diff] [blame] | 86 | </td> |
| 87 | <td ng-if="vm.config.actions"> |
| 88 | <a href="" |
| 89 | ng-repeat="action in vm.config.actions" |
| 90 | ng-click="action.cb(item)" |
| 91 | title="{{action.label}}"> |
| 92 | <i |
Matteo Scandolo | d58d504 | 2016-12-16 16:59:21 -0800 | [diff] [blame] | 93 | class="fa fa-{{action.icon}}" |
Matteo Scandolo | 9f87f30 | 2016-12-13 18:11:10 -0800 | [diff] [blame] | 94 | style="color: {{action.color}};"></i> |
| 95 | </a> |
| 96 | </td> |
| 97 | </tr> |
| 98 | </tbody> |
| 99 | </table> |
Matteo Scandolo | 8b2370c | 2017-02-02 17:19:07 -0800 | [diff] [blame] | 100 | <xos-pagination |
| 101 | ng-if="vm.config.pagination" |
| 102 | page-size="vm.config.pagination.pageSize" |
| 103 | total-elements="vm.data.length" |
| 104 | change="vm.goToPage"> |
| 105 | </xos-pagination> |
Matteo Scandolo | d62ea79 | 2016-12-22 14:02:28 -0800 | [diff] [blame] | 106 | </div> |
Matteo Scandolo | 710dc15 | 2017-04-11 13:54:23 -0700 | [diff] [blame] | 107 | </div> |
| 108 | <div ng-show="(vm.data.length == 0 || !vm.data) && vm.loader == false"> |
| 109 | <xos-alert config="{type: 'info'}" show="true"> |
| 110 | No data to show. |
| 111 | </xos-alert> |
| 112 | </div> |
| 113 | <div ng-show="vm.loader == true"> |
| 114 | <div class="loader"></div> |
| 115 | </div> |