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.

test.controller.js 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. angular.module('luticate')
  2. .controller('TestController', ['$scope', 'luticateAuthUsers',
  3. function($scope, luticateAuthUsers) {
  4. $scope.luBasicTable = {
  5. columns: [
  6. {
  7. name: "Username",
  8. width: 3,
  9. getValue: function (item) {
  10. return item.Username;
  11. }
  12. }, {
  13. name: "Email",
  14. width: 3,
  15. getValue: function (item) {
  16. return item.Email;
  17. }
  18. }, {
  19. name: "Firstname",
  20. width: 3,
  21. getValue: function (item) {
  22. return item.Firstname;
  23. }
  24. }, {
  25. name: "Lastname",
  26. width: 3,
  27. getValue: function (item) {
  28. return item.Lastname;
  29. }
  30. }
  31. ],
  32. canCheck: function()
  33. {
  34. return true;
  35. },
  36. canClick: function()
  37. {
  38. return false;
  39. },
  40. onItemClicked: function(item)
  41. {
  42. console.log(item);
  43. scope.toggleCheckedItem(item);
  44. },
  45. onItemChecked: function(item, checked)
  46. {
  47. console.log(item, checked);
  48. },
  49. getLoadPagePromise: function (page, perPage, query, promise)
  50. {
  51. return luticateAuthUsers.getAll({page: page, perPage: perPage, query: query}, promise);
  52. }
  53. };
  54. $scope.luEditTable = {
  55. columns: [
  56. {
  57. name: "Username",
  58. width: 3,
  59. getValue: function (item) {
  60. return item.Username;
  61. }
  62. }, {
  63. name: "Email",
  64. width: 3,
  65. getValue: function (item) {
  66. return item.Email;
  67. }
  68. }, {
  69. name: "Firstname",
  70. width: 3,
  71. getValue: function (item) {
  72. return item.Firstname;
  73. }
  74. }, {
  75. name: "Lastname",
  76. width: 3,
  77. getValue: function (item) {
  78. return item.Lastname;
  79. }
  80. }
  81. ],
  82. onItemClicked: function(item)
  83. {
  84. console.log("edit clicked", item);
  85. },
  86. onItemChecked: function(item, checked)
  87. {
  88. console.log("edit checked", item, checked);
  89. },
  90. getLoadPagePromise: function (page, perPage, query, promise)
  91. {
  92. return luticateAuthUsers.getAll({page: page, perPage: perPage, query: query}, promise);
  93. },
  94. getDelPromise: function (id, promise) {
  95. return luticateAuthUsers.del({user_id: id}, promise);
  96. },
  97. getEditController: function () {
  98. return "UserEdit";
  99. },
  100. onItemDeleted: function(item)
  101. {
  102. console.log("edit removed", item);
  103. },
  104. onItemEdited: function(item)
  105. {
  106. console.log("edit edited", item);
  107. },
  108. onItemAdded: function(item)
  109. {
  110. console.log("edit added", item);
  111. },
  112. canDelete: 'LU_USER_DEL',
  113. canEdit: function()
  114. {
  115. return true;
  116. },
  117. canAdd: function()
  118. {
  119. return true;
  120. }
  121. };
  122. $scope.luUserPicker = {
  123. columns: [
  124. {
  125. name: "Username",
  126. width: 3,
  127. getValue: function (item) {
  128. return item.Username;
  129. }
  130. }, {
  131. name: "Email",
  132. width: 3,
  133. getValue: function (item) {
  134. return item.Email;
  135. }
  136. }, {
  137. name: "Firstname",
  138. width: 3,
  139. getValue: function (item) {
  140. return item.Firstname;
  141. }
  142. }, {
  143. name: "Lastname",
  144. width: 3,
  145. getValue: function (item) {
  146. return item.Lastname;
  147. }
  148. }
  149. ],
  150. onItemClicked: function(item)
  151. {
  152. console.log("user clicked", item);
  153. },
  154. onItemChecked: function(item, checked)
  155. {
  156. console.log("user checked", item, checked);
  157. },
  158. getLoadPagePromise: function(page, perPage, query, promise)
  159. {
  160. return luticateAuthUsers.getAll({page: page, perPage: perPage, query: query}, promise);
  161. },
  162. onPageChanged: function()
  163. {
  164. console.log("user page", $scope.luUserPicker.page);
  165. },
  166. getItemText: function(item)
  167. {
  168. return item.Username;
  169. }
  170. };
  171. }]);