114 lines
3.4 KiB
JavaScript
114 lines
3.4 KiB
JavaScript
/*
|
|
* Author: Abdullah A Almsaeed
|
|
* Date: 4 Jan 2014
|
|
* Description:
|
|
* This is a demo file used only for the main dashboard (index.html)
|
|
**/
|
|
|
|
$(function() {
|
|
"use strict";
|
|
|
|
//Make the dashboard widgets sortable Using jquery UI
|
|
$(".connectedSortable").sortable({
|
|
placeholder: "sort-highlight",
|
|
connectWith: ".connectedSortable",
|
|
handle: ".box-header, .nav-tabs",
|
|
forcePlaceholderSize: true,
|
|
zIndex: 999999
|
|
}).disableSelection();
|
|
$(".connectedSortable .box-header, .connectedSortable .nav-tabs-custom").css("cursor", "move");
|
|
//jQuery UI sortable for the todo list
|
|
$(".task-list").sortable({
|
|
placeholder: "sort-highlight",
|
|
handle: ".handle",
|
|
forcePlaceholderSize: true,
|
|
zIndex: 999999
|
|
}).disableSelection();
|
|
;
|
|
|
|
//bootstrap WYSIHTML5 - text editor
|
|
// $(".textarea").wysihtml5();
|
|
|
|
$('.daterange').daterangepicker(
|
|
{
|
|
ranges: {
|
|
'Today': [moment(), moment()],
|
|
'Yesterday': [moment().subtract('days', 1), moment().subtract('days', 1)],
|
|
'Last 7 Days': [moment().subtract('days', 6), moment()],
|
|
'Last 30 Days': [moment().subtract('days', 29), moment()],
|
|
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
|
'Last Month': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
|
|
},
|
|
startDate: moment().subtract('days', 29),
|
|
endDate: moment()
|
|
},
|
|
function(start, end) {
|
|
alert("You chose: " + start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
|
|
});
|
|
|
|
|
|
|
|
//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
|
|
};
|
|
//World map by jvectormap
|
|
|
|
|
|
|
|
|
|
//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) {
|
|
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")
|
|
}
|
|
});
|
|
|
|
});
|
|
|