You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

luitempicker.js 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /**
  2. * Created by robin on 11/6/15.
  3. */
  4. angular.module('luticateUtils')
  5. .directive('luItemPicker', ['dialogs', 'luticateDialogErrorHelper',
  6. function(dialogs, luticateDialogErrorHelper) {
  7. return {
  8. restrict: 'E',
  9. scope: {
  10. options: '&',
  11. luModel: '&'
  12. },
  13. templateUrl: "views/itempicker.html",//"/luticate/luitempicker.html",
  14. link: function ($scope, element, attrs) {
  15. $scope.selectedItems = $scope.luModel();
  16. $scope.pickerOptions = $scope.options();
  17. }
  18. };
  19. }
  20. ]);
  21. angular.module('luticateUtils').run(['$templateCache', function($templateCache)
  22. {
  23. $templateCache.put('/luticate/luitempicker.html', '<div lu-busy="itemList">' +
  24. ' <table class="col-sm-12 table table-hover">' +
  25. ' <thead>' +
  26. ' <tr>' +
  27. ' <th lu-show-permission="{{ tableOptions.permissions.del }}">' +
  28. ' <input type="checkbox" ng-click="toggleSelectAll()"' +
  29. ' ng-checked="selectedItems.length == items.Data.length && items.Data.length != 0">' +
  30. ' </th>' +
  31. ' <th class="col-sm-{{ col.width }}" ng-repeat="col in tableOptions.columns">{{ col.name }}</th>' +
  32. '</tr>' +
  33. '</thead>' +
  34. '<tbody>' +
  35. '<tr ng-repeat="item in items.Data" style="cursor: pointer" ng-click="displayItem(item)">' +
  36. ' <td lu-show-permission="{{ tableOptions.permissions.del }}">' +
  37. ' <input name="selectedItems[]" type="checkbox" ng-checked="isItemChecked(item)"' +
  38. ' ng-click="$event.stopPropagation();toggleSelectedItem(item)" >' +
  39. ' </td>' +
  40. ' <td ng-repeat="col in tableOptions.columns">{{ col.getValue(item) }}</td>' +
  41. '</tr>' +
  42. '</tbody>' +
  43. '</table>' +
  44. '<div class="col-sm-12 text-center">' +
  45. ' <a class="{{ p == page ? \'pagination-current\' : \'pagination-not-current\'}}" href="" ng-repeat="p in pages" ng-click="loadPage(p)">{{ p + 1 }}&nbsp;</a>' +
  46. '</div>' +
  47. '<div class="col-sm-12">' +
  48. ' <button class="btn btn-default" type="button" ng-click="removeItems()"' +
  49. 'ng-disabled="selectedItems.length == 0" lu-show-permission="{{ tableOptions.permissions.del }}">' +
  50. ' <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Remove' +
  51. ' </button>' +
  52. ' <button class="btn btn-default" type="button" ng-click="addItem()" lu-show-permission="{{ tableOptions.permissions.add }}">' +
  53. ' <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add' +
  54. ' </button>' +
  55. ' </div>' +
  56. ' </div>');
  57. }]);