team.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. (function (global, factory) {
  2. if (typeof define === "function" && define.amd) {
  3. define("/dashboard/team", ["jquery", "Site"], factory);
  4. } else if (typeof exports !== "undefined") {
  5. factory(require("jquery"), require("Site"));
  6. } else {
  7. var mod = {
  8. exports: {}
  9. };
  10. factory(global.jQuery, global.Site);
  11. global.dashboardTeam = mod.exports;
  12. }
  13. })(this, function (_jquery, _Site) {
  14. "use strict";
  15. _jquery = babelHelpers.interopRequireDefault(_jquery);
  16. (0, _jquery.default)(document).ready(function ($$$1) {
  17. (0, _Site.run)();
  18. }); // Top Line Chart With Tooltips
  19. // ----------------------------
  20. (function () {
  21. var options = {
  22. showArea: true,
  23. low: 0,
  24. high: 1000,
  25. height: 453,
  26. fullWidth: true,
  27. axisX: {
  28. offset: 30
  29. },
  30. axisY: {
  31. offset: 30,
  32. labelInterpolationFnc: function labelInterpolationFnc(value) {
  33. if (value === 0) {
  34. return null;
  35. }
  36. return value;
  37. },
  38. scaleMinSpace: 50
  39. },
  40. chartPadding: {
  41. bottom: 12,
  42. left: 10
  43. },
  44. plugins: [Chartist.plugins.tooltip()]
  45. }; // team total completed data
  46. var labelList = ['Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan', 'Feb'];
  47. var series1List = {
  48. name: 'series-1',
  49. data: [0, 180, 600, 980, 850, 600, 300, 350, 600, 200, 630]
  50. };
  51. var series2List = {
  52. name: 'series-2',
  53. data: [0, 100, 520, 810, 620, 500, 630, 400, 380, 405, 210]
  54. };
  55. var newScoreLineChart = function newScoreLineChart(chartId, labelList, series1List, series2List, options) {
  56. var lineChart = new Chartist.Line(chartId, {
  57. labels: labelList,
  58. series: [series1List, series2List]
  59. }, options); //start create
  60. lineChart.on('draw', function (data) {
  61. var elem, parent;
  62. if (data.type === 'point') {
  63. elem = data.element;
  64. parent = new Chartist.Svg(elem._node.parentNode);
  65. parent.elem('line', {
  66. x1: data.x,
  67. y1: data.y,
  68. x2: data.x + 0.01,
  69. y2: data.y,
  70. "class": 'ct-point-content'
  71. });
  72. }
  73. });
  74. };
  75. newScoreLineChart("#teamCompletedWidget .ct-chart", labelList, series1List, series2List, options);
  76. })(); // item dialog
  77. // -----------
  78. (function () {
  79. //handleSelective
  80. var handleSelective = function handleSelective(handleSelectiveItem) {
  81. var member = [{
  82. id: 'uid_1',
  83. name: 'Herman Beck',
  84. avatar: '../../../global/portraits/1.jpg'
  85. }, {
  86. id: 'uid_2',
  87. name: 'Mary Adams',
  88. avatar: '../../../global/portraits/2.jpg'
  89. }, {
  90. id: 'uid_3',
  91. name: 'Caleb Richards',
  92. avatar: '../../../global/portraits/3.jpg'
  93. }, {
  94. id: 'uid_4',
  95. name: 'June Lane',
  96. avatar: '../../../global/portraits/4.jpg'
  97. }];
  98. var items = handleSelectiveItem;
  99. (0, _jquery.default)('.plugin-selective').selective({
  100. namespace: 'addMember',
  101. local: member,
  102. selected: items,
  103. buildFromHtml: false,
  104. tpl: {
  105. optionValue: function optionValue(data) {
  106. return data.id;
  107. },
  108. frame: function frame() {
  109. return '<div class="' + this.namespace + '">' + this.options.tpl.items.call(this) + '<div class="' + this.namespace + '-trigger">' + this.options.tpl.triggerButton.call(this) + '<div class="' + this.namespace + '-trigger-dropdown">' + this.options.tpl.list.call(this) + '</div>' + '</div>' + '</div>';
  110. },
  111. triggerButton: function triggerButton() {
  112. return '<div class="' + this.namespace + '-trigger-button"><i class="wb-plus"></i></div>';
  113. },
  114. listItem: function listItem(data) {
  115. return '<li class="' + this.namespace + '-list-item"><img class="avatar" src="' + data.avatar + '">' + data.name + '</li>';
  116. },
  117. item: function item(data) {
  118. return '<li class="' + this.namespace + '-item"><img class="avatar" src="' + data.avatar + '" title="' + data.name + '">' + this.options.tpl.itemRemove.call(this) + '</li>';
  119. },
  120. itemRemove: function itemRemove() {
  121. return '<span class="' + this.namespace + '-remove"><i class="wb-minus-circle"></i></span>';
  122. },
  123. option: function option(data) {
  124. return '<option value="' + this.options.tpl.optionValue.call(this, data) + '">' + data.name + '</option>';
  125. }
  126. }
  127. });
  128. }; // add Item Dialog
  129. (0, _jquery.default)('#addNewItemBtn').on('click', function () {
  130. //default handleSelectiveItem for add dialog
  131. var handleSelectiveItem = [{
  132. id: 'uid_1',
  133. name: 'Herman Beck',
  134. avatar: '../../../global/portraits/1.jpg'
  135. }, {
  136. id: 'uid_2',
  137. name: 'Caleb Richards',
  138. avatar: '../../../global/portraits/2.jpg'
  139. }];
  140. handleSelective(handleSelectiveItem);
  141. (0, _jquery.default)('#addtodoItemForm').modal('show');
  142. }); // edit Item Dialog
  143. (0, _jquery.default)("#toDoListWidget .list-group-item input").on('click', function (e) {
  144. e.stopPropagation();
  145. });
  146. (0, _jquery.default)('#toDoListWidget .list-group-item').on('click', function () {
  147. var oldTitle = (0, _jquery.default)(this).find(".item-title").text();
  148. var dueDate = (0, _jquery.default)(this).find(".item-due-date > span").text();
  149. if (dueDate === "No due date") {
  150. dueDate = null;
  151. } else {
  152. dueDate = "8/25/2015";
  153. }
  154. (0, _jquery.default)("#editTitle").val(oldTitle);
  155. (0, _jquery.default)("#editDueDate").val(dueDate);
  156. var handleSelectiveItem = [];
  157. handleSelective(handleSelectiveItem);
  158. (0, _jquery.default)('#edittodoItemForm').modal('show');
  159. });
  160. })();
  161. });