/* * Author: Abdullah A Almsaeed * Date: 4 Jan 2014 * Description: * This is a demo file used only for the main dashboard (index.html) **/ "use strict"; $(function () { //Make the dashboard widgets sortable Using jquery UI $(".connectedSortable").sortable({ placeholder: "sort-highlight", connectWith: ".connectedSortable", handle: ".box-header, .nav-tabs", forcePlaceholderSize: true, zIndex: 999999 }); $(".connectedSortable .box-header, .connectedSortable .nav-tabs-custom").css("cursor", "move"); //jQuery UI sortable for the todo list $(".todo-list").sortable({ placeholder: "sort-highlight", handle: ".handle", forcePlaceholderSize: true, zIndex: 999999 }); //jvectormap data var visitorsData = { "US": 398, //USA "SA": 400, //Saudi Arabia "CA": 1000, //Canada "DE": 500, //Germany "FR": 760, //France "CN": 300, //China "AU": 700, //Australia "BR": 600, //Brazil "IN": 800, //India "GB": 320, //Great Britain "RU": 3000 //Russia }; //Sparkline charts var myvalues = [1000, 1200, 920, 927, 931, 1027, 819, 930, 1021]; $('#sparkline-1').sparkline(myvalues, { type: 'line', lineColor: '#92c1dc', fillColor: "#ebf4f9", height: '50', width: '80' }); myvalues = [515, 519, 520, 522, 652, 810, 370, 627, 319, 630, 921]; $('#sparkline-2').sparkline(myvalues, { type: 'line', lineColor: '#92c1dc', fillColor: "#ebf4f9", height: '50', width: '80' }); myvalues = [15, 19, 20, 22, 33, 27, 31, 27, 19, 30, 21]; $('#sparkline-3').sparkline(myvalues, { type: 'line', lineColor: '#92c1dc', fillColor: "#ebf4f9", height: '50', width: '80' }); //The Calender $("#calendar").datepicker(); //SLIMSCROLL FOR CHAT WIDGET $('#chat-box').slimScroll({ height: '250px' }); /* Morris.js Charts */ // Sales chart //Fix for charts under tabs $('.box ul.nav a').on('shown.bs.tab', function (e) { area.redraw(); donut.redraw(); }); /* BOX REFRESH PLUGIN EXAMPLE (usage with morris charts) */ $("#loading-example").boxRefresh({ source: "ajax/dashboard-boxrefresh-demo.php", onLoadDone: function (box) { var bar = new Morris.Bar({ element: 'bar-chart', resize: true, data: [ {y: '2006', a: 100, b: 90}, {y: '2007', a: 75, b: 65}, {y: '2008', a: 50, b: 40}, {y: '2009', a: 75, b: 65}, {y: '2010', a: 50, b: 40}, {y: '2011', a: 75, b: 65}, {y: '2012', a: 100, b: 90} ], barColors: ['#00a65a', '#f56954'], xkey: 'y', ykeys: ['a', 'b'], labels: ['CPU', 'DISK'], hideHover: 'auto' }); } }); /* The todo list plugin */ $(".todo-list").todolist({ onCheck: function (ele) { console.log("The element has been checked") }, onUncheck: function (ele) { console.log("The element has been unchecked") } }); });