dashboard.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * Author: Abdullah A Almsaeed
  3. * Date: 4 Jan 2014
  4. * Description:
  5. * This is a demo file used only for the main dashboard (index.html)
  6. **/
  7. $(function() {
  8. "use strict";
  9. //Make the dashboard widgets sortable Using jquery UI
  10. $(".connectedSortable").sortable({
  11. placeholder: "sort-highlight",
  12. connectWith: ".connectedSortable",
  13. handle: ".box-header, .nav-tabs",
  14. forcePlaceholderSize: true,
  15. zIndex: 999999
  16. }).disableSelection();
  17. $(".connectedSortable .box-header, .connectedSortable .nav-tabs-custom").css("cursor", "move");
  18. //jQuery UI sortable for the todo list
  19. $(".task-list").sortable({
  20. placeholder: "sort-highlight",
  21. handle: ".handle",
  22. forcePlaceholderSize: true,
  23. zIndex: 999999
  24. }).disableSelection();
  25. ;
  26. //bootstrap WYSIHTML5 - text editor
  27. // $(".textarea").wysihtml5();
  28. $('.daterange').daterangepicker(
  29. {
  30. ranges: {
  31. 'Today': [moment(), moment()],
  32. 'Yesterday': [moment().subtract('days', 1), moment().subtract('days', 1)],
  33. 'Last 7 Days': [moment().subtract('days', 6), moment()],
  34. 'Last 30 Days': [moment().subtract('days', 29), moment()],
  35. 'This Month': [moment().startOf('month'), moment().endOf('month')],
  36. 'Last Month': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
  37. },
  38. startDate: moment().subtract('days', 29),
  39. endDate: moment()
  40. },
  41. function(start, end) {
  42. alert("You chose: " + start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
  43. });
  44. //jvectormap data
  45. var visitorsData = {
  46. "US": 398, //USA
  47. "SA": 400, //Saudi Arabia
  48. "CA": 1000, //Canada
  49. "DE": 500, //Germany
  50. "FR": 760, //France
  51. "CN": 300, //China
  52. "AU": 700, //Australia
  53. "BR": 600, //Brazil
  54. "IN": 800, //India
  55. "GB": 320, //Great Britain
  56. "RU": 3000 //Russia
  57. };
  58. //World map by jvectormap
  59. //Fix for charts under tabs
  60. $('.box ul.nav a').on('shown.bs.tab', function(e) {
  61. area.redraw();
  62. donut.redraw();
  63. });
  64. /* BOX REFRESH PLUGIN EXAMPLE (usage with morris charts) */
  65. $("#loading-example").boxRefresh({
  66. source: "ajax/dashboard-boxrefresh-demo.php",
  67. onLoadDone: function(box) {
  68. bar = new Morris.Bar({
  69. element: 'bar-chart',
  70. resize: true,
  71. data: [
  72. {y: '2006', a: 100, b: 90},
  73. {y: '2007', a: 75, b: 65},
  74. {y: '2008', a: 50, b: 40},
  75. {y: '2009', a: 75, b: 65},
  76. {y: '2010', a: 50, b: 40},
  77. {y: '2011', a: 75, b: 65},
  78. {y: '2012', a: 100, b: 90}
  79. ],
  80. barColors: ['#00a65a', '#f56954'],
  81. xkey: 'y',
  82. ykeys: ['a', 'b'],
  83. labels: ['CPU', 'DISK'],
  84. hideHover: 'auto'
  85. });
  86. }
  87. });
  88. /* The todo list plugin */
  89. $(".todo-list").todolist({
  90. onCheck: function(ele) {
  91. console.log("The element has been checked")
  92. },
  93. onUncheck: function(ele) {
  94. //console.log("The element has been unchecked")
  95. }
  96. });
  97. });