2 * Author: Abdullah A Almsaeed
5 * This is a demo file used only for the main dashboard (index.html)
11 //Make the dashboard widgets sortable Using jquery UI
12 $(".connectedSortable").sortable({
13 placeholder: "sort-highlight",
14 connectWith: ".connectedSortable",
15 handle: ".box-header, .nav-tabs",
16 forcePlaceholderSize: true,
18 }).disableSelection();
19 $(".box-header, .nav-tabs").css("cursor","move");
20 //jQuery UI sortable for the todo list
21 $(".todo-list").sortable({
22 placeholder: "sort-highlight",
24 forcePlaceholderSize: true,
26 }).disableSelection();;
28 //bootstrap WYSIHTML5 - text editor
29 $(".textarea").wysihtml5();
31 $('.daterange').daterangepicker(
34 'Today': [moment(), moment()],
35 'Yesterday': [moment().subtract('days', 1), moment().subtract('days', 1)],
36 'Last 7 Days': [moment().subtract('days', 6), moment()],
37 'Last 30 Days': [moment().subtract('days', 29), moment()],
38 'This Month': [moment().startOf('month'), moment().endOf('month')],
39 'Last Month': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
41 startDate: moment().subtract('days', 29),
44 function(start, end) {
45 alert("You chose: " + start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
54 "SA": 400, //Saudi Arabia
59 "AU": 700, //Australia
62 "GB": 320, //Great Britain
65 //World map by jvectormap
66 $('#world-map').vectorMap({
68 backgroundColor: "#fff",
81 scale: ["#3c8dbc", "#2D79A6"], //['#3E5E6B', '#A6BAC2'],
82 normalizeFunction: 'polynomial'
85 onRegionLabelShow: function(e, el, code) {
86 if (typeof visitorsData[code] != "undefined")
87 el.html(el.html() + ': ' + visitorsData[code] + ' new visitors');
92 var myvalues = [15, 19, 20, -22, -33, 27, 31, 27, 19, 30, 21];
93 $('#sparkline-1').sparkline(myvalues, {
96 negBarColor: "#f56954",
99 myvalues = [15, 19, 20, 22, -2, -10, -7, 27, 19, 30, 21];
100 $('#sparkline-2').sparkline(myvalues, {
103 negBarColor: "#f56954",
106 myvalues = [15, -19, -20, 22, 33, 27, 31, 27, 19, 30, 21];
107 $('#sparkline-3').sparkline(myvalues, {
110 negBarColor: "#f56954",
113 myvalues = [15, 19, 20, 22, 33, -27, -31, 27, 19, 30, 21];
114 $('#sparkline-4').sparkline(myvalues, {
117 negBarColor: "#f56954",
120 myvalues = [15, 19, 20, 22, 33, 27, 31, -27, -19, 30, 21];
121 $('#sparkline-5').sparkline(myvalues, {
124 negBarColor: "#f56954",
127 myvalues = [15, 19, -20, 22, -13, 27, 31, 27, 19, 30, 21];
128 $('#sparkline-6').sparkline(myvalues, {
131 negBarColor: "#f56954",
135 //Date for the calendar events (dummy data)
136 var date = new Date();
137 var d = date.getDate(),
139 y = date.getFullYear();
142 $('#calendar').fullCalendar({
143 editable: true, //Enable drag and drop
146 title: 'All Day Event',
147 start: new Date(y, m, 1),
148 backgroundColor: "#3c8dbc", //light-blue
149 borderColor: "#3c8dbc" //light-blue
153 start: new Date(y, m, d - 5),
154 end: new Date(y, m, d - 2),
155 backgroundColor: "#f39c12", //yellow
156 borderColor: "#f39c12" //yellow
160 start: new Date(y, m, d, 10, 30),
162 backgroundColor: "#0073b7", //Blue
163 borderColor: "#0073b7" //Blue
167 start: new Date(y, m, d, 12, 0),
168 end: new Date(y, m, d, 14, 0),
170 backgroundColor: "#00c0ef", //Info (aqua)
171 borderColor: "#00c0ef" //Info (aqua)
174 title: 'Birthday Party',
175 start: new Date(y, m, d + 1, 19, 0),
176 end: new Date(y, m, d + 1, 22, 30),
178 backgroundColor: "#00a65a", //Success (green)
179 borderColor: "#00a65a" //Success (green)
182 title: 'Click for Google',
183 start: new Date(y, m, 28),
184 end: new Date(y, m, 29),
185 url: 'http://google.com/',
186 backgroundColor: "#f56954", //red
187 borderColor: "#f56954" //red
190 buttonText: {//This is to add icons to the visible buttons
191 prev: "<span class='fa fa-caret-left'></span>",
192 next: "<span class='fa fa-caret-right'></span>",
205 //SLIMSCROLL FOR CHAT WIDGET
206 $('#chat-box').slimScroll({
210 /* Morris.js Charts */
212 var area = new Morris.Area({
213 element: 'revenue-chart',
216 {y: '2011 Q1', item1: 2666, item2: 2666},
217 {y: '2011 Q2', item1: 2778, item2: 2294},
218 {y: '2011 Q3', item1: 4912, item2: 1969},
219 {y: '2011 Q4', item1: 3767, item2: 3597},
220 {y: '2012 Q1', item1: 6810, item2: 1914},
221 {y: '2012 Q2', item1: 5670, item2: 4293},
222 {y: '2012 Q3', item1: 4820, item2: 3795},
223 {y: '2012 Q4', item1: 15073, item2: 5967},
224 {y: '2013 Q1', item1: 10687, item2: 4460},
225 {y: '2013 Q2', item1: 8432, item2: 5713}
228 ykeys: ['item1', 'item2'],
229 labels: ['Item 1', 'Item 2'],
230 lineColors: ['#a0d0e0', '#3c8dbc'],
234 var donut = new Morris.Donut({
235 element: 'sales-chart',
237 colors: ["#3c8dbc", "#f56954", "#00a65a"],
239 {label: "Download Sales", value: 12},
240 {label: "In-Store Sales", value: 30},
241 {label: "Mail-Order Sales", value: 20}
246 var bar = new Morris.Bar({
247 element: 'bar-chart',
250 {y: '2006', a: 100, b: 90},
251 {y: '2007', a: 75, b: 65},
252 {y: '2008', a: 50, b: 40},
253 {y: '2009', a: 75, b: 65},
254 {y: '2010', a: 50, b: 40},
255 {y: '2011', a: 75, b: 65},
256 {y: '2012', a: 100, b: 90}
258 barColors: ['#00a65a', '#f56954'],
261 labels: ['CPU', 'DISK'],
264 //Fix for charts under tabs
265 $('.box ul.nav a').on('shown.bs.tab', function(e) {
271 /* BOX REFRESH PLUGIN EXAMPLE (usage with morris charts) */
272 $("#loading-example").boxRefresh({
273 source: "ajax/dashboard-boxrefresh-demo.php",
274 onLoadDone: function(box) {
275 bar = new Morris.Bar({
276 element: 'bar-chart',
279 {y: '2006', a: 100, b: 90},
280 {y: '2007', a: 75, b: 65},
281 {y: '2008', a: 50, b: 40},
282 {y: '2009', a: 75, b: 65},
283 {y: '2010', a: 50, b: 40},
284 {y: '2011', a: 75, b: 65},
285 {y: '2012', a: 100, b: 90}
287 barColors: ['#00a65a', '#f56954'],
290 labels: ['CPU', 'DISK'],
296 /* The todo list plugin */
297 $(".todo-list").todolist({
298 onCheck: function(ele) {
299 //console.log("The element has been checked")
301 onUncheck: function(ele) {
302 //console.log("The element has been unchecked")