Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | espaco | 1 | var Dashboard = function() { |
| 2 | |||
| 3 | return { |
||
| 4 | |||
| 5 | initJQVMAP: function() { |
||
| 6 | if (!jQuery().vectorMap) { |
||
| 7 | return; |
||
| 8 | } |
||
| 9 | |||
| 10 | var showMap = function(name) { |
||
| 11 | jQuery('.vmaps').hide(); |
||
| 12 | jQuery('#vmap_' + name).show(); |
||
| 13 | } |
||
| 14 | |||
| 15 | var setMap = function(name) { |
||
| 16 | var map = jQuery('#vmap_' + name); |
||
| 17 | |||
| 18 | if (map.size() !== 1) { |
||
| 19 | return; |
||
| 20 | } |
||
| 21 | |||
| 22 | var data = { |
||
| 23 | map: 'world_en', |
||
| 24 | backgroundColor: null, |
||
| 25 | borderColor: '#333333', |
||
| 26 | borderOpacity: 0.5, |
||
| 27 | borderWidth: 1, |
||
| 28 | color: '#c6c6c6', |
||
| 29 | enableZoom: true, |
||
| 30 | hoverColor: '#c9dfaf', |
||
| 31 | hoverOpacity: null, |
||
| 32 | values: sample_data, |
||
| 33 | normalizeFunction: 'linear', |
||
| 34 | scaleColors: ['#b6da93', '#909cae'], |
||
| 35 | selectedColor: '#c9dfaf', |
||
| 36 | selectedRegion: null, |
||
| 37 | showTooltip: true, |
||
| 38 | onLabelShow: function(event, label, code) { |
||
| 39 | |||
| 40 | }, |
||
| 41 | onRegionOver: function(event, code) { |
||
| 42 | if (code == 'ca') { |
||
| 43 | event.preventDefault(); |
||
| 44 | } |
||
| 45 | }, |
||
| 46 | onRegionClick: function(element, code, region) { |
||
| 47 | var message = 'You clicked "' + region + '" which has the code: ' + code.toUpperCase(); |
||
| 48 | alert(message); |
||
| 49 | } |
||
| 50 | }; |
||
| 51 | |||
| 52 | data.map = name + '_en'; |
||
| 53 | |||
| 54 | map.width(map.parent().parent().width()); |
||
| 55 | map.show(); |
||
| 56 | map.vectorMap(data); |
||
| 57 | map.hide(); |
||
| 58 | } |
||
| 59 | |||
| 60 | setMap("world"); |
||
| 61 | setMap("usa"); |
||
| 62 | setMap("europe"); |
||
| 63 | setMap("russia"); |
||
| 64 | setMap("germany"); |
||
| 65 | showMap("world"); |
||
| 66 | |||
| 67 | jQuery('#regional_stat_world').click(function() { |
||
| 68 | showMap("world"); |
||
| 69 | }); |
||
| 70 | |||
| 71 | jQuery('#regional_stat_usa').click(function() { |
||
| 72 | showMap("usa"); |
||
| 73 | }); |
||
| 74 | |||
| 75 | jQuery('#regional_stat_europe').click(function() { |
||
| 76 | showMap("europe"); |
||
| 77 | }); |
||
| 78 | jQuery('#regional_stat_russia').click(function() { |
||
| 79 | showMap("russia"); |
||
| 80 | }); |
||
| 81 | jQuery('#regional_stat_germany').click(function() { |
||
| 82 | showMap("germany"); |
||
| 83 | }); |
||
| 84 | |||
| 85 | $('#region_statistics_loading').hide(); |
||
| 86 | $('#region_statistics_content').show(); |
||
| 87 | |||
| 88 | App.addResizeHandler(function() { |
||
| 89 | jQuery('.vmaps').each(function() { |
||
| 90 | var map = jQuery(this); |
||
| 91 | map.width(map.parent().width()); |
||
| 92 | }); |
||
| 93 | }); |
||
| 94 | }, |
||
| 95 | |||
| 96 | initCalendar: function() { |
||
| 97 | if (!jQuery().fullCalendar) { |
||
| 98 | return; |
||
| 99 | } |
||
| 100 | |||
| 101 | var date = new Date(); |
||
| 102 | var d = date.getDate(); |
||
| 103 | var m = date.getMonth(); |
||
| 104 | var y = date.getFullYear(); |
||
| 105 | |||
| 106 | var h = {}; |
||
| 107 | |||
| 108 | if ($('#calendar').width() <= 400) { |
||
| 109 | $('#calendar').addClass("mobile"); |
||
| 110 | h = { |
||
| 111 | left: 'title, prev, next', |
||
| 112 | center: '', |
||
| 113 | right: 'today,month,agendaWeek,agendaDay' |
||
| 114 | }; |
||
| 115 | } else { |
||
| 116 | $('#calendar').removeClass("mobile"); |
||
| 117 | if (App.isRTL()) { |
||
| 118 | h = { |
||
| 119 | right: 'title', |
||
| 120 | center: '', |
||
| 121 | left: 'prev,next,today,month,agendaWeek,agendaDay' |
||
| 122 | }; |
||
| 123 | } else { |
||
| 124 | h = { |
||
| 125 | left: 'title', |
||
| 126 | center: '', |
||
| 127 | right: 'prev,next,today,month,agendaWeek,agendaDay' |
||
| 128 | }; |
||
| 129 | } |
||
| 130 | } |
||
| 131 | |||
| 132 | |||
| 133 | |||
| 134 | $('#calendar').fullCalendar('destroy'); // destroy the calendar |
||
| 135 | $('#calendar').fullCalendar({ //re-initialize the calendar |
||
| 136 | disableDragging: false, |
||
| 137 | header: h, |
||
| 138 | editable: true, |
||
| 139 | events: [{ |
||
| 140 | title: 'All Day', |
||
| 141 | start: new Date(y, m, 1), |
||
| 142 | backgroundColor: App.getBrandColor('yellow') |
||
| 143 | }, { |
||
| 144 | title: 'Long Event', |
||
| 145 | start: new Date(y, m, d - 5), |
||
| 146 | end: new Date(y, m, d - 2), |
||
| 147 | backgroundColor: App.getBrandColor('blue') |
||
| 148 | }, { |
||
| 149 | title: 'Repeating Event', |
||
| 150 | start: new Date(y, m, d - 3, 16, 0), |
||
| 151 | allDay: false, |
||
| 152 | backgroundColor: App.getBrandColor('red') |
||
| 153 | }, { |
||
| 154 | title: 'Repeating Event', |
||
| 155 | start: new Date(y, m, d + 6, 16, 0), |
||
| 156 | allDay: false, |
||
| 157 | backgroundColor: App.getBrandColor('green') |
||
| 158 | }, { |
||
| 159 | title: 'Meeting', |
||
| 160 | start: new Date(y, m, d + 9, 10, 30), |
||
| 161 | allDay: false |
||
| 162 | }, { |
||
| 163 | title: 'Lunch', |
||
| 164 | start: new Date(y, m, d, 14, 0), |
||
| 165 | end: new Date(y, m, d, 14, 0), |
||
| 166 | backgroundColor: App.getBrandColor('grey'), |
||
| 167 | allDay: false |
||
| 168 | }, { |
||
| 169 | title: 'Birthday', |
||
| 170 | start: new Date(y, m, d + 1, 19, 0), |
||
| 171 | end: new Date(y, m, d + 1, 22, 30), |
||
| 172 | backgroundColor: App.getBrandColor('purple'), |
||
| 173 | allDay: false |
||
| 174 | }, { |
||
| 175 | title: 'Click for Google', |
||
| 176 | start: new Date(y, m, 28), |
||
| 177 | end: new Date(y, m, 29), |
||
| 178 | backgroundColor: App.getBrandColor('yellow'), |
||
| 179 | url: 'http://google.com/' |
||
| 180 | }] |
||
| 181 | }); |
||
| 182 | }, |
||
| 183 | |||
| 184 | initCharts: function() { |
||
| 185 | if (!jQuery.plot) { |
||
| 186 | return; |
||
| 187 | } |
||
| 188 | |||
| 189 | function showChartTooltip(x, y, xValue, yValue) { |
||
| 190 | $('<div id="tooltip" class="chart-tooltip">' + yValue + '<\/div>').css({ |
||
| 191 | position: 'absolute', |
||
| 192 | display: 'none', |
||
| 193 | top: y - 40, |
||
| 194 | left: x - 40, |
||
| 195 | border: '0px solid #ccc', |
||
| 196 | padding: '2px 6px', |
||
| 197 | 'background-color': '#fff' |
||
| 198 | }).appendTo("body").fadeIn(200); |
||
| 199 | } |
||
| 200 | |||
| 201 | var data = []; |
||
| 202 | var totalPoints = 250; |
||
| 203 | |||
| 204 | // random data generator for plot charts |
||
| 205 | |||
| 206 | function getRandomData() { |
||
| 207 | if (data.length > 0) data = data.slice(1); |
||
| 208 | // do a random walk |
||
| 209 | while (data.length < totalPoints) { |
||
| 210 | var prev = data.length > 0 ? data[data.length - 1] : 50; |
||
| 211 | var y = prev + Math.random() * 10 - 5; |
||
| 212 | if (y < 0) y = 0; |
||
| 213 | if (y > 100) y = 100; |
||
| 214 | data.push(y); |
||
| 215 | } |
||
| 216 | // zip the generated y values with the x values |
||
| 217 | var res = []; |
||
| 218 | for (var i = 0; i < data.length; ++i) res.push([i, data[i]]) |
||
| 219 | return res; |
||
| 220 | } |
||
| 221 | |||
| 222 | function randValue() { |
||
| 223 | return (Math.floor(Math.random() * (1 + 50 - 20))) + 10; |
||
| 224 | } |
||
| 225 | |||
| 226 | var visitors = [ |
||
| 227 | ['02/2013', 1500], |
||
| 228 | ['03/2013', 2500], |
||
| 229 | ['04/2013', 1700], |
||
| 230 | ['05/2013', 800], |
||
| 231 | ['06/2013', 1500], |
||
| 232 | ['07/2013', 2350], |
||
| 233 | ['08/2013', 1500], |
||
| 234 | ['09/2013', 1300], |
||
| 235 | ['10/2013', 4600] |
||
| 236 | ]; |
||
| 237 | |||
| 238 | |||
| 239 | if ($('#site_statistics').size() != 0) { |
||
| 240 | |||
| 241 | $('#site_statistics_loading').hide(); |
||
| 242 | $('#site_statistics_content').show(); |
||
| 243 | |||
| 244 | var plot_statistics = $.plot($("#site_statistics"), [{ |
||
| 245 | data: visitors, |
||
| 246 | lines: { |
||
| 247 | fill: 0.6, |
||
| 248 | lineWidth: 0 |
||
| 249 | }, |
||
| 250 | color: ['#f89f9f'] |
||
| 251 | }, { |
||
| 252 | data: visitors, |
||
| 253 | points: { |
||
| 254 | show: true, |
||
| 255 | fill: true, |
||
| 256 | radius: 5, |
||
| 257 | fillColor: "#f89f9f", |
||
| 258 | lineWidth: 3 |
||
| 259 | }, |
||
| 260 | color: '#fff', |
||
| 261 | shadowSize: 0 |
||
| 262 | }], |
||
| 263 | |||
| 264 | { |
||
| 265 | xaxis: { |
||
| 266 | tickLength: 0, |
||
| 267 | tickDecimals: 0, |
||
| 268 | mode: "categories", |
||
| 269 | min: 0, |
||
| 270 | font: { |
||
| 271 | lineHeight: 14, |
||
| 272 | style: "normal", |
||
| 273 | variant: "small-caps", |
||
| 274 | color: "#6F7B8A" |
||
| 275 | } |
||
| 276 | }, |
||
| 277 | yaxis: { |
||
| 278 | ticks: 5, |
||
| 279 | tickDecimals: 0, |
||
| 280 | tickColor: "#eee", |
||
| 281 | font: { |
||
| 282 | lineHeight: 14, |
||
| 283 | style: "normal", |
||
| 284 | variant: "small-caps", |
||
| 285 | color: "#6F7B8A" |
||
| 286 | } |
||
| 287 | }, |
||
| 288 | grid: { |
||
| 289 | hoverable: true, |
||
| 290 | clickable: true, |
||
| 291 | tickColor: "#eee", |
||
| 292 | borderColor: "#eee", |
||
| 293 | borderWidth: 1 |
||
| 294 | } |
||
| 295 | }); |
||
| 296 | |||
| 297 | var previousPoint = null; |
||
| 298 | $("#site_statistics").bind("plothover", function(event, pos, item) { |
||
| 299 | $("#x").text(pos.x.toFixed(2)); |
||
| 300 | $("#y").text(pos.y.toFixed(2)); |
||
| 301 | if (item) { |
||
| 302 | if (previousPoint != item.dataIndex) { |
||
| 303 | previousPoint = item.dataIndex; |
||
| 304 | |||
| 305 | $("#tooltip").remove(); |
||
| 306 | var x = item.datapoint[0].toFixed(2), |
||
| 307 | y = item.datapoint[1].toFixed(2); |
||
| 308 | |||
| 309 | showChartTooltip(item.pageX, item.pageY, item.datapoint[0], item.datapoint[1] + ' visits'); |
||
| 310 | } |
||
| 311 | } else { |
||
| 312 | $("#tooltip").remove(); |
||
| 313 | previousPoint = null; |
||
| 314 | } |
||
| 315 | }); |
||
| 316 | } |
||
| 317 | |||
| 318 | |||
| 319 | if ($('#site_activities').size() != 0) { |
||
| 320 | //site activities |
||
| 321 | var previousPoint2 = null; |
||
| 322 | $('#site_activities_loading').hide(); |
||
| 323 | $('#site_activities_content').show(); |
||
| 324 | |||
| 325 | var data1 = [ |
||
| 326 | ['DEC', 300], |
||
| 327 | ['JAN', 600], |
||
| 328 | ['FEB', 1100], |
||
| 329 | ['MAR', 1200], |
||
| 330 | ['APR', 860], |
||
| 331 | ['MAY', 1200], |
||
| 332 | ['JUN', 1450], |
||
| 333 | ['JUL', 1800], |
||
| 334 | ['AUG', 1200], |
||
| 335 | ['SEP', 600] |
||
| 336 | ]; |
||
| 337 | |||
| 338 | |||
| 339 | var plot_statistics = $.plot($("#site_activities"), |
||
| 340 | |||
| 341 | [{ |
||
| 342 | data: data1, |
||
| 343 | lines: { |
||
| 344 | fill: 0.2, |
||
| 345 | lineWidth: 0, |
||
| 346 | }, |
||
| 347 | color: ['#BAD9F5'] |
||
| 348 | }, { |
||
| 349 | data: data1, |
||
| 350 | points: { |
||
| 351 | show: true, |
||
| 352 | fill: true, |
||
| 353 | radius: 4, |
||
| 354 | fillColor: "#9ACAE6", |
||
| 355 | lineWidth: 2 |
||
| 356 | }, |
||
| 357 | color: '#9ACAE6', |
||
| 358 | shadowSize: 1 |
||
| 359 | }, { |
||
| 360 | data: data1, |
||
| 361 | lines: { |
||
| 362 | show: true, |
||
| 363 | fill: false, |
||
| 364 | lineWidth: 3 |
||
| 365 | }, |
||
| 366 | color: '#9ACAE6', |
||
| 367 | shadowSize: 0 |
||
| 368 | }], |
||
| 369 | |||
| 370 | { |
||
| 371 | |||
| 372 | xaxis: { |
||
| 373 | tickLength: 0, |
||
| 374 | tickDecimals: 0, |
||
| 375 | mode: "categories", |
||
| 376 | min: 0, |
||
| 377 | font: { |
||
| 378 | lineHeight: 18, |
||
| 379 | style: "normal", |
||
| 380 | variant: "small-caps", |
||
| 381 | color: "#6F7B8A" |
||
| 382 | } |
||
| 383 | }, |
||
| 384 | yaxis: { |
||
| 385 | ticks: 5, |
||
| 386 | tickDecimals: 0, |
||
| 387 | tickColor: "#eee", |
||
| 388 | font: { |
||
| 389 | lineHeight: 14, |
||
| 390 | style: "normal", |
||
| 391 | variant: "small-caps", |
||
| 392 | color: "#6F7B8A" |
||
| 393 | } |
||
| 394 | }, |
||
| 395 | grid: { |
||
| 396 | hoverable: true, |
||
| 397 | clickable: true, |
||
| 398 | tickColor: "#eee", |
||
| 399 | borderColor: "#eee", |
||
| 400 | borderWidth: 1 |
||
| 401 | } |
||
| 402 | }); |
||
| 403 | |||
| 404 | $("#site_activities").bind("plothover", function(event, pos, item) { |
||
| 405 | $("#x").text(pos.x.toFixed(2)); |
||
| 406 | $("#y").text(pos.y.toFixed(2)); |
||
| 407 | if (item) { |
||
| 408 | if (previousPoint2 != item.dataIndex) { |
||
| 409 | previousPoint2 = item.dataIndex; |
||
| 410 | $("#tooltip").remove(); |
||
| 411 | var x = item.datapoint[0].toFixed(2), |
||
| 412 | y = item.datapoint[1].toFixed(2); |
||
| 413 | showChartTooltip(item.pageX, item.pageY, item.datapoint[0], item.datapoint[1] + 'M$'); |
||
| 414 | } |
||
| 415 | } |
||
| 416 | }); |
||
| 417 | |||
| 418 | $('#site_activities').bind("mouseleave", function() { |
||
| 419 | $("#tooltip").remove(); |
||
| 420 | }); |
||
| 421 | } |
||
| 422 | }, |
||
| 423 | |||
| 424 | initEasyPieCharts: function() { |
||
| 425 | if (!jQuery().easyPieChart) { |
||
| 426 | return; |
||
| 427 | } |
||
| 428 | |||
| 429 | $('.easy-pie-chart .number.transactions').easyPieChart({ |
||
| 430 | animate: 1000, |
||
| 431 | size: 75, |
||
| 432 | lineWidth: 3, |
||
| 433 | barColor: App.getBrandColor('yellow') |
||
| 434 | }); |
||
| 435 | |||
| 436 | $('.easy-pie-chart .number.visits').easyPieChart({ |
||
| 437 | animate: 1000, |
||
| 438 | size: 75, |
||
| 439 | lineWidth: 3, |
||
| 440 | barColor: App.getBrandColor('green') |
||
| 441 | }); |
||
| 442 | |||
| 443 | $('.easy-pie-chart .number.bounce').easyPieChart({ |
||
| 444 | animate: 1000, |
||
| 445 | size: 75, |
||
| 446 | lineWidth: 3, |
||
| 447 | barColor: App.getBrandColor('red') |
||
| 448 | }); |
||
| 449 | |||
| 450 | $('.easy-pie-chart-reload').click(function() { |
||
| 451 | $('.easy-pie-chart .number').each(function() { |
||
| 452 | var newValue = Math.floor(100 * Math.random()); |
||
| 453 | $(this).data('easyPieChart').update(newValue); |
||
| 454 | $('span', this).text(newValue); |
||
| 455 | }); |
||
| 456 | }); |
||
| 457 | }, |
||
| 458 | |||
| 459 | initSparklineCharts: function() { |
||
| 460 | if (!jQuery().sparkline) { |
||
| 461 | return; |
||
| 462 | } |
||
| 463 | $("#sparkline_bar").sparkline([8, 9, 10, 11, 10, 10, 12, 10, 10, 11, 9, 12, 11, 10, 9, 11, 13, 13, 12], { |
||
| 464 | type: 'bar', |
||
| 465 | width: '100', |
||
| 466 | barWidth: 5, |
||
| 467 | height: '55', |
||
| 468 | barColor: '#f36a5b', |
||
| 469 | negBarColor: '#e02222' |
||
| 470 | }); |
||
| 471 | |||
| 472 | $("#sparkline_bar2").sparkline([9, 11, 12, 13, 12, 13, 10, 14, 13, 11, 11, 12, 11, 11, 10, 12, 11, 10], { |
||
| 473 | type: 'bar', |
||
| 474 | width: '100', |
||
| 475 | barWidth: 5, |
||
| 476 | height: '55', |
||
| 477 | barColor: '#5c9bd1', |
||
| 478 | negBarColor: '#e02222' |
||
| 479 | }); |
||
| 480 | |||
| 481 | $("#sparkline_bar5").sparkline([8, 9, 10, 11, 10, 10, 12, 10, 10, 11, 9, 12, 11, 10, 9, 11, 13, 13, 12], { |
||
| 482 | type: 'bar', |
||
| 483 | width: '100', |
||
| 484 | barWidth: 5, |
||
| 485 | height: '55', |
||
| 486 | barColor: '#35aa47', |
||
| 487 | negBarColor: '#e02222' |
||
| 488 | }); |
||
| 489 | |||
| 490 | $("#sparkline_bar6").sparkline([9, 11, 12, 13, 12, 13, 10, 14, 13, 11, 11, 12, 11, 11, 10, 12, 11, 10], { |
||
| 491 | type: 'bar', |
||
| 492 | width: '100', |
||
| 493 | barWidth: 5, |
||
| 494 | height: '55', |
||
| 495 | barColor: '#ffb848', |
||
| 496 | negBarColor: '#e02222' |
||
| 497 | }); |
||
| 498 | |||
| 499 | $("#sparkline_line").sparkline([9, 10, 9, 10, 10, 11, 12, 10, 10, 11, 11, 12, 11, 10, 12, 11, 10, 12], { |
||
| 500 | type: 'line', |
||
| 501 | width: '100', |
||
| 502 | height: '55', |
||
| 503 | lineColor: '#ffb848' |
||
| 504 | }); |
||
| 505 | }, |
||
| 506 | |||
| 507 | initMorisCharts: function() { |
||
| 508 | if (Morris.EventEmitter && $('#sales_statistics').size() > 0) { |
||
| 509 | // Use Morris.Area instead of Morris.Line |
||
| 510 | dashboardMainChart = Morris.Area({ |
||
| 511 | element: 'sales_statistics', |
||
| 512 | padding: 0, |
||
| 513 | behaveLikeLine: false, |
||
| 514 | gridEnabled: false, |
||
| 515 | gridLineColor: false, |
||
| 516 | axes: false, |
||
| 517 | fillOpacity: 1, |
||
| 518 | data: [{ |
||
| 519 | period: '2011 Q1', |
||
| 520 | sales: 1400, |
||
| 521 | profit: 400 |
||
| 522 | }, { |
||
| 523 | period: '2011 Q2', |
||
| 524 | sales: 1100, |
||
| 525 | profit: 600 |
||
| 526 | }, { |
||
| 527 | period: '2011 Q3', |
||
| 528 | sales: 1600, |
||
| 529 | profit: 500 |
||
| 530 | }, { |
||
| 531 | period: '2011 Q4', |
||
| 532 | sales: 1200, |
||
| 533 | profit: 400 |
||
| 534 | }, { |
||
| 535 | period: '2012 Q1', |
||
| 536 | sales: 1550, |
||
| 537 | profit: 800 |
||
| 538 | }], |
||
| 539 | lineColors: ['#399a8c', '#92e9dc'], |
||
| 540 | xkey: 'period', |
||
| 541 | ykeys: ['sales', 'profit'], |
||
| 542 | labels: ['Sales', 'Profit'], |
||
| 543 | pointSize: 0, |
||
| 544 | lineWidth: 0, |
||
| 545 | hideHover: 'auto', |
||
| 546 | resize: true |
||
| 547 | }); |
||
| 548 | |||
| 549 | } |
||
| 550 | }, |
||
| 551 | |||
| 552 | initChat: function() { |
||
| 553 | var cont = $('#chats'); |
||
| 554 | var list = $('.chats', cont); |
||
| 555 | var form = $('.chat-form', cont); |
||
| 556 | var input = $('input', form); |
||
| 557 | var btn = $('.btn', form); |
||
| 558 | |||
| 559 | var handleClick = function(e) { |
||
| 560 | e.preventDefault(); |
||
| 561 | |||
| 562 | var text = input.val(); |
||
| 563 | if (text.length == 0) { |
||
| 564 | return; |
||
| 565 | } |
||
| 566 | |||
| 567 | var time = new Date(); |
||
| 568 | var time_str = (time.getHours() + ':' + time.getMinutes()); |
||
| 569 | var tpl = ''; |
||
| 570 | tpl += '<li class="out">'; |
||
| 571 | tpl += '<img class="avatar" alt="" src="' + Layout.getLayoutImgPath() + 'avatar1.jpg"/>'; |
||
| 572 | tpl += '<div class="message">'; |
||
| 573 | tpl += '<span class="arrow"></span>'; |
||
| 574 | tpl += '<a href="#" class="name">Bob Nilson</a> '; |
||
| 575 | tpl += '<span class="datetime">at ' + time_str + '</span>'; |
||
| 576 | tpl += '<span class="body">'; |
||
| 577 | tpl += text; |
||
| 578 | tpl += '</span>'; |
||
| 579 | tpl += '</div>'; |
||
| 580 | tpl += '</li>'; |
||
| 581 | |||
| 582 | var msg = list.append(tpl); |
||
| 583 | input.val(""); |
||
| 584 | |||
| 585 | var getLastPostPos = function() { |
||
| 586 | var height = 0; |
||
| 587 | cont.find("li.out, li.in").each(function() { |
||
| 588 | height = height + $(this).outerHeight(); |
||
| 589 | }); |
||
| 590 | |||
| 591 | return height; |
||
| 592 | } |
||
| 593 | |||
| 594 | cont.find('.scroller').slimScroll({ |
||
| 595 | scrollTo: getLastPostPos() |
||
| 596 | }); |
||
| 597 | } |
||
| 598 | |||
| 599 | $('body').on('click', '.message .name', function(e) { |
||
| 600 | e.preventDefault(); // prevent click event |
||
| 601 | |||
| 602 | var name = $(this).text(); // get clicked user's full name |
||
| 603 | input.val('@' + name + ':'); // set it into the input field |
||
| 604 | App.scrollTo(input); // scroll to input if needed |
||
| 605 | }); |
||
| 606 | |||
| 607 | btn.click(handleClick); |
||
| 608 | |||
| 609 | input.keypress(function(e) { |
||
| 610 | if (e.which == 13) { |
||
| 611 | handleClick(e); |
||
| 612 | return false; //<---- Add this line |
||
| 613 | } |
||
| 614 | }); |
||
| 615 | }, |
||
| 616 | |||
| 617 | initDashboardDaterange: function() { |
||
| 618 | if (!jQuery().daterangepicker) { |
||
| 619 | return; |
||
| 620 | } |
||
| 621 | |||
| 622 | $('#dashboard-report-range').daterangepicker({ |
||
| 623 | "ranges": { |
||
| 624 | 'Today': [moment(), moment()], |
||
| 625 | 'Yesterday': [moment().subtract('days', 1), moment().subtract('days', 1)], |
||
| 626 | 'Last 7 Days': [moment().subtract('days', 6), moment()], |
||
| 627 | 'Last 30 Days': [moment().subtract('days', 29), moment()], |
||
| 628 | 'This Month': [moment().startOf('month'), moment().endOf('month')], |
||
| 629 | 'Last Month': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')] |
||
| 630 | }, |
||
| 631 | "locale": { |
||
| 632 | "format": "MM/DD/YYYY", |
||
| 633 | "separator": " - ", |
||
| 634 | "applyLabel": "Apply", |
||
| 635 | "cancelLabel": "Cancel", |
||
| 636 | "fromLabel": "From", |
||
| 637 | "toLabel": "To", |
||
| 638 | "customRangeLabel": "Custom", |
||
| 639 | "daysOfWeek": [ |
||
| 640 | "Su", |
||
| 641 | "Mo", |
||
| 642 | "Tu", |
||
| 643 | "We", |
||
| 644 | "Th", |
||
| 645 | "Fr", |
||
| 646 | "Sa" |
||
| 647 | ], |
||
| 648 | "monthNames": [ |
||
| 649 | "January", |
||
| 650 | "February", |
||
| 651 | "March", |
||
| 652 | "April", |
||
| 653 | "May", |
||
| 654 | "June", |
||
| 655 | "July", |
||
| 656 | "August", |
||
| 657 | "September", |
||
| 658 | "October", |
||
| 659 | "November", |
||
| 660 | "December" |
||
| 661 | ], |
||
| 662 | "firstDay": 1 |
||
| 663 | }, |
||
| 664 | //"startDate": "11/08/2015", |
||
| 665 | //"endDate": "11/14/2015", |
||
| 666 | opens: (App.isRTL() ? 'right' : 'left'), |
||
| 667 | }, function(start, end, label) { |
||
| 668 | if ($('#dashboard-report-range').attr('data-display-range') != '0') { |
||
| 669 | $('#dashboard-report-range span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY')); |
||
| 670 | } |
||
| 671 | }); |
||
| 672 | if ($('#dashboard-report-range').attr('data-display-range') != '0') { |
||
| 673 | $('#dashboard-report-range span').html(moment().subtract('days', 29).format('MMMM D, YYYY') + ' - ' + moment().format('MMMM D, YYYY')); |
||
| 674 | } |
||
| 675 | $('#dashboard-report-range').show(); |
||
| 676 | }, |
||
| 677 | |||
| 678 | initAmChart1: function() { |
||
| 679 | if (typeof(AmCharts) === 'undefined' || $('#dashboard_amchart_1').size() === 0) { |
||
| 680 | return; |
||
| 681 | } |
||
| 682 | |||
| 683 | var chartData = [{ |
||
| 684 | "date": "2012-01-05", |
||
| 685 | "distance": 480, |
||
| 686 | "townName": "Miami", |
||
| 687 | "townName2": "Miami", |
||
| 688 | "townSize": 10, |
||
| 689 | "latitude": 25.83, |
||
| 690 | "duration": 501 |
||
| 691 | }, { |
||
| 692 | "date": "2012-01-06", |
||
| 693 | "distance": 386, |
||
| 694 | "townName": "Tallahassee", |
||
| 695 | "townSize": 7, |
||
| 696 | "latitude": 30.46, |
||
| 697 | "duration": 443 |
||
| 698 | }, { |
||
| 699 | "date": "2012-01-07", |
||
| 700 | "distance": 348, |
||
| 701 | "townName": "New Orleans", |
||
| 702 | "townSize": 10, |
||
| 703 | "latitude": 29.94, |
||
| 704 | "duration": 405 |
||
| 705 | }, { |
||
| 706 | "date": "2012-01-08", |
||
| 707 | "distance": 238, |
||
| 708 | "townName": "Houston", |
||
| 709 | "townName2": "Houston", |
||
| 710 | "townSize": 16, |
||
| 711 | "latitude": 29.76, |
||
| 712 | "duration": 309 |
||
| 713 | }, { |
||
| 714 | "date": "2012-01-09", |
||
| 715 | "distance": 218, |
||
| 716 | "townName": "Dalas", |
||
| 717 | "townSize": 17, |
||
| 718 | "latitude": 32.8, |
||
| 719 | "duration": 287 |
||
| 720 | }, { |
||
| 721 | "date": "2012-01-10", |
||
| 722 | "distance": 349, |
||
| 723 | "townName": "Oklahoma City", |
||
| 724 | "townSize": 11, |
||
| 725 | "latitude": 35.49, |
||
| 726 | "duration": 485 |
||
| 727 | }, { |
||
| 728 | "date": "2012-01-11", |
||
| 729 | "distance": 603, |
||
| 730 | "townName": "Kansas City", |
||
| 731 | "townSize": 10, |
||
| 732 | "latitude": 39.1, |
||
| 733 | "duration": 890 |
||
| 734 | }, { |
||
| 735 | "date": "2012-01-12", |
||
| 736 | "distance": 534, |
||
| 737 | "townName": "Denver", |
||
| 738 | "townName2": "Denver", |
||
| 739 | "townSize": 18, |
||
| 740 | "latitude": 39.74, |
||
| 741 | "duration": 810 |
||
| 742 | }, { |
||
| 743 | "date": "2012-01-13", |
||
| 744 | "townName": "Salt Lake City", |
||
| 745 | "townSize": 12, |
||
| 746 | "distance": 425, |
||
| 747 | "duration": 670, |
||
| 748 | "latitude": 40.75, |
||
| 749 | "alpha": 0.4 |
||
| 750 | }, { |
||
| 751 | "date": "2012-01-14", |
||
| 752 | "latitude": 36.1, |
||
| 753 | "duration": 470, |
||
| 754 | "townName": "Las Vegas", |
||
| 755 | "townName2": "Las Vegas", |
||
| 756 | "bulletClass": "lastBullet" |
||
| 757 | }, { |
||
| 758 | "date": "2012-01-15" |
||
| 759 | }]; |
||
| 760 | var chart = AmCharts.makeChart("dashboard_amchart_1", { |
||
| 761 | type: "serial", |
||
| 762 | fontSize: 12, |
||
| 763 | fontFamily: "Open Sans", |
||
| 764 | dataDateFormat: "YYYY-MM-DD", |
||
| 765 | dataProvider: chartData, |
||
| 766 | |||
| 767 | addClassNames: true, |
||
| 768 | startDuration: 1, |
||
| 769 | color: "#6c7b88", |
||
| 770 | marginLeft: 0, |
||
| 771 | |||
| 772 | categoryField: "date", |
||
| 773 | categoryAxis: { |
||
| 774 | parseDates: true, |
||
| 775 | minPeriod: "DD", |
||
| 776 | autoGridCount: false, |
||
| 777 | gridCount: 50, |
||
| 778 | gridAlpha: 0.1, |
||
| 779 | gridColor: "#FFFFFF", |
||
| 780 | axisColor: "#555555", |
||
| 781 | dateFormats: [{ |
||
| 782 | period: 'DD', |
||
| 783 | format: 'DD' |
||
| 784 | }, { |
||
| 785 | period: 'WW', |
||
| 786 | format: 'MMM DD' |
||
| 787 | }, { |
||
| 788 | period: 'MM', |
||
| 789 | format: 'MMM' |
||
| 790 | }, { |
||
| 791 | period: 'YYYY', |
||
| 792 | format: 'YYYY' |
||
| 793 | }] |
||
| 794 | }, |
||
| 795 | |||
| 796 | valueAxes: [{ |
||
| 797 | id: "a1", |
||
| 798 | title: "distance", |
||
| 799 | gridAlpha: 0, |
||
| 800 | axisAlpha: 0 |
||
| 801 | }, { |
||
| 802 | id: "a2", |
||
| 803 | position: "right", |
||
| 804 | gridAlpha: 0, |
||
| 805 | axisAlpha: 0, |
||
| 806 | labelsEnabled: false |
||
| 807 | }, { |
||
| 808 | id: "a3", |
||
| 809 | title: "duration", |
||
| 810 | position: "right", |
||
| 811 | gridAlpha: 0, |
||
| 812 | axisAlpha: 0, |
||
| 813 | inside: true, |
||
| 814 | duration: "mm", |
||
| 815 | durationUnits: { |
||
| 816 | DD: "d. ", |
||
| 817 | hh: "h ", |
||
| 818 | mm: "min", |
||
| 819 | ss: "" |
||
| 820 | } |
||
| 821 | }], |
||
| 822 | graphs: [{ |
||
| 823 | id: "g1", |
||
| 824 | valueField: "distance", |
||
| 825 | title: "distance", |
||
| 826 | type: "column", |
||
| 827 | fillAlphas: 0.7, |
||
| 828 | valueAxis: "a1", |
||
| 829 | balloonText: "[[value]] miles", |
||
| 830 | legendValueText: "[[value]] mi", |
||
| 831 | legendPeriodValueText: "total: [[value.sum]] mi", |
||
| 832 | lineColor: "#08a3cc", |
||
| 833 | alphaField: "alpha", |
||
| 834 | }, { |
||
| 835 | id: "g2", |
||
| 836 | valueField: "latitude", |
||
| 837 | classNameField: "bulletClass", |
||
| 838 | title: "latitude/city", |
||
| 839 | type: "line", |
||
| 840 | valueAxis: "a2", |
||
| 841 | lineColor: "#786c56", |
||
| 842 | lineThickness: 1, |
||
| 843 | legendValueText: "[[description]]/[[value]]", |
||
| 844 | descriptionField: "townName", |
||
| 845 | bullet: "round", |
||
| 846 | bulletSizeField: "townSize", |
||
| 847 | bulletBorderColor: "#02617a", |
||
| 848 | bulletBorderAlpha: 1, |
||
| 849 | bulletBorderThickness: 2, |
||
| 850 | bulletColor: "#89c4f4", |
||
| 851 | labelText: "[[townName2]]", |
||
| 852 | labelPosition: "right", |
||
| 853 | balloonText: "latitude:[[value]]", |
||
| 854 | showBalloon: true, |
||
| 855 | animationPlayed: true, |
||
| 856 | }, { |
||
| 857 | id: "g3", |
||
| 858 | title: "duration", |
||
| 859 | valueField: "duration", |
||
| 860 | type: "line", |
||
| 861 | valueAxis: "a3", |
||
| 862 | lineAlpha: 0.8, |
||
| 863 | lineColor: "#e26a6a", |
||
| 864 | balloonText: "[[value]]", |
||
| 865 | lineThickness: 1, |
||
| 866 | legendValueText: "[[value]]", |
||
| 867 | bullet: "square", |
||
| 868 | bulletBorderColor: "#e26a6a", |
||
| 869 | bulletBorderThickness: 1, |
||
| 870 | bulletBorderAlpha: 0.8, |
||
| 871 | dashLengthField: "dashLength", |
||
| 872 | animationPlayed: true |
||
| 873 | }], |
||
| 874 | |||
| 875 | chartCursor: { |
||
| 876 | zoomable: false, |
||
| 877 | categoryBalloonDateFormat: "DD", |
||
| 878 | cursorAlpha: 0, |
||
| 879 | categoryBalloonColor: "#e26a6a", |
||
| 880 | categoryBalloonAlpha: 0.8, |
||
| 881 | valueBalloonsEnabled: false |
||
| 882 | }, |
||
| 883 | legend: { |
||
| 884 | bulletType: "round", |
||
| 885 | equalWidths: false, |
||
| 886 | valueWidth: 120, |
||
| 887 | useGraphSettings: true, |
||
| 888 | color: "#6c7b88" |
||
| 889 | } |
||
| 890 | }); |
||
| 891 | }, |
||
| 892 | |||
| 893 | initAmChart2: function() { |
||
| 894 | if (typeof(AmCharts) === 'undefined' || $('#dashboard_amchart_2').size() === 0) { |
||
| 895 | return; |
||
| 896 | } |
||
| 897 | |||
| 898 | // svg path for target icon |
||
| 899 | var targetSVG = "M9,0C4.029,0,0,4.029,0,9s4.029,9,9,9s9-4.029,9-9S13.971,0,9,0z M9,15.93 c-3.83,0-6.93-3.1-6.93-6.93S5.17,2.07,9,2.07s6.93,3.1,6.93,6.93S12.83,15.93,9,15.93 M12.5,9c0,1.933-1.567,3.5-3.5,3.5S5.5,10.933,5.5,9S7.067,5.5,9,5.5 S12.5,7.067,12.5,9z"; |
||
| 900 | // svg path for plane icon |
||
| 901 | var planeSVG = "M19.671,8.11l-2.777,2.777l-3.837-0.861c0.362-0.505,0.916-1.683,0.464-2.135c-0.518-0.517-1.979,0.278-2.305,0.604l-0.913,0.913L7.614,8.804l-2.021,2.021l2.232,1.061l-0.082,0.082l1.701,1.701l0.688-0.687l3.164,1.504L9.571,18.21H6.413l-1.137,1.138l3.6,0.948l1.83,1.83l0.947,3.598l1.137-1.137V21.43l3.725-3.725l1.504,3.164l-0.687,0.687l1.702,1.701l0.081-0.081l1.062,2.231l2.02-2.02l-0.604-2.689l0.912-0.912c0.326-0.326,1.121-1.789,0.604-2.306c-0.452-0.452-1.63,0.101-2.135,0.464l-0.861-3.838l2.777-2.777c0.947-0.947,3.599-4.862,2.62-5.839C24.533,4.512,20.618,7.163,19.671,8.11z"; |
||
| 902 | |||
| 903 | var map = AmCharts.makeChart("dashboard_amchart_2", { |
||
| 904 | type: "map", |
||
| 905 | "theme": "light", |
||
| 906 | pathToImages: "../assets/global/plugins/amcharts/ammap/images/", |
||
| 907 | |||
| 908 | dataProvider: { |
||
| 909 | map: "worldLow", |
||
| 910 | linkToObject: "london", |
||
| 911 | images: [{ |
||
| 912 | id: "london", |
||
| 913 | color: "#009dc7", |
||
| 914 | svgPath: targetSVG, |
||
| 915 | title: "London", |
||
| 916 | latitude: 51.5002, |
||
| 917 | longitude: -0.1262, |
||
| 918 | scale: 1.5, |
||
| 919 | zoomLevel: 2.74, |
||
| 920 | zoomLongitude: -20.1341, |
||
| 921 | zoomLatitude: 49.1712, |
||
| 922 | |||
| 923 | lines: [{ |
||
| 924 | latitudes: [51.5002, 50.4422], |
||
| 925 | longitudes: [-0.1262, 30.5367] |
||
| 926 | }, { |
||
| 927 | latitudes: [51.5002, 46.9480], |
||
| 928 | longitudes: [-0.1262, 7.4481] |
||
| 929 | }, { |
||
| 930 | latitudes: [51.5002, 59.3328], |
||
| 931 | longitudes: [-0.1262, 18.0645] |
||
| 932 | }, { |
||
| 933 | latitudes: [51.5002, 40.4167], |
||
| 934 | longitudes: [-0.1262, -3.7033] |
||
| 935 | }, { |
||
| 936 | latitudes: [51.5002, 46.0514], |
||
| 937 | longitudes: [-0.1262, 14.5060] |
||
| 938 | }, { |
||
| 939 | latitudes: [51.5002, 48.2116], |
||
| 940 | longitudes: [-0.1262, 17.1547] |
||
| 941 | }, { |
||
| 942 | latitudes: [51.5002, 44.8048], |
||
| 943 | longitudes: [-0.1262, 20.4781] |
||
| 944 | }, { |
||
| 945 | latitudes: [51.5002, 55.7558], |
||
| 946 | longitudes: [-0.1262, 37.6176] |
||
| 947 | }, { |
||
| 948 | latitudes: [51.5002, 38.7072], |
||
| 949 | longitudes: [-0.1262, -9.1355] |
||
| 950 | }, { |
||
| 951 | latitudes: [51.5002, 54.6896], |
||
| 952 | longitudes: [-0.1262, 25.2799] |
||
| 953 | }, { |
||
| 954 | latitudes: [51.5002, 64.1353], |
||
| 955 | longitudes: [-0.1262, -21.8952] |
||
| 956 | }, { |
||
| 957 | latitudes: [51.5002, 40.4300], |
||
| 958 | longitudes: [-0.1262, -74.0000] |
||
| 959 | }], |
||
| 960 | |||
| 961 | images: [{ |
||
| 962 | label: "Flights from London", |
||
| 963 | svgPath: planeSVG, |
||
| 964 | left: 100, |
||
| 965 | top: 45, |
||
| 966 | labelShiftY: 5, |
||
| 967 | color: "#d93d5e", |
||
| 968 | labelColor: "#d93d5e", |
||
| 969 | labelRollOverColor: "#d93d5e", |
||
| 970 | labelFontSize: 20 |
||
| 971 | }, { |
||
| 972 | label: "show flights from Vilnius", |
||
| 973 | left: 106, |
||
| 974 | top: 70, |
||
| 975 | labelColor: "#6c7b88", |
||
| 976 | labelRollOverColor: "#d93d5e", |
||
| 977 | labelFontSize: 11, |
||
| 978 | linkToObject: "vilnius" |
||
| 979 | }] |
||
| 980 | }, |
||
| 981 | |||
| 982 | { |
||
| 983 | id: "vilnius", |
||
| 984 | color: "#009dc7", |
||
| 985 | svgPath: targetSVG, |
||
| 986 | title: "Vilnius", |
||
| 987 | latitude: 54.6896, |
||
| 988 | longitude: 25.2799, |
||
| 989 | scale: 1.5, |
||
| 990 | zoomLevel: 4.92, |
||
| 991 | zoomLongitude: 15.4492, |
||
| 992 | zoomLatitude: 50.2631, |
||
| 993 | |||
| 994 | lines: [{ |
||
| 995 | latitudes: [54.6896, 50.8371], |
||
| 996 | longitudes: [25.2799, 4.3676] |
||
| 997 | }, { |
||
| 998 | latitudes: [54.6896, 59.9138], |
||
| 999 | longitudes: [25.2799, 10.7387] |
||
| 1000 | }, { |
||
| 1001 | latitudes: [54.6896, 40.4167], |
||
| 1002 | longitudes: [25.2799, -3.7033] |
||
| 1003 | }, { |
||
| 1004 | latitudes: [54.6896, 50.0878], |
||
| 1005 | longitudes: [25.2799, 14.4205] |
||
| 1006 | }, { |
||
| 1007 | latitudes: [54.6896, 48.2116], |
||
| 1008 | longitudes: [25.2799, 17.1547] |
||
| 1009 | }, { |
||
| 1010 | latitudes: [54.6896, 44.8048], |
||
| 1011 | longitudes: [25.2799, 20.4781] |
||
| 1012 | }, { |
||
| 1013 | latitudes: [54.6896, 55.7558], |
||
| 1014 | longitudes: [25.2799, 37.6176] |
||
| 1015 | }, { |
||
| 1016 | latitudes: [54.6896, 37.9792], |
||
| 1017 | longitudes: [25.2799, 23.7166] |
||
| 1018 | }, { |
||
| 1019 | latitudes: [54.6896, 54.6896], |
||
| 1020 | longitudes: [25.2799, 25.2799] |
||
| 1021 | }, { |
||
| 1022 | latitudes: [54.6896, 51.5002], |
||
| 1023 | longitudes: [25.2799, -0.1262] |
||
| 1024 | }, { |
||
| 1025 | latitudes: [54.6896, 53.3441], |
||
| 1026 | longitudes: [25.2799, -6.2675] |
||
| 1027 | }], |
||
| 1028 | |||
| 1029 | images: [{ |
||
| 1030 | label: "Flights from Vilnius", |
||
| 1031 | svgPath: planeSVG, |
||
| 1032 | left: 100, |
||
| 1033 | top: 45, |
||
| 1034 | labelShiftY: 5, |
||
| 1035 | color: "#d93d5e", |
||
| 1036 | labelColor: "#d93d5e", |
||
| 1037 | labelRollOverColor: "#d93d5e", |
||
| 1038 | labelFontSize: 20 |
||
| 1039 | }, { |
||
| 1040 | label: "show flights from London", |
||
| 1041 | left: 106, |
||
| 1042 | top: 70, |
||
| 1043 | labelColor: "#009dc7", |
||
| 1044 | labelRollOverColor: "#d93d5e", |
||
| 1045 | labelFontSize: 11, |
||
| 1046 | linkToObject: "london" |
||
| 1047 | }] |
||
| 1048 | }, { |
||
| 1049 | svgPath: targetSVG, |
||
| 1050 | title: "Brussels", |
||
| 1051 | latitude: 50.8371, |
||
| 1052 | longitude: 4.3676 |
||
| 1053 | }, { |
||
| 1054 | svgPath: targetSVG, |
||
| 1055 | title: "Prague", |
||
| 1056 | latitude: 50.0878, |
||
| 1057 | longitude: 14.4205 |
||
| 1058 | }, { |
||
| 1059 | svgPath: targetSVG, |
||
| 1060 | title: "Athens", |
||
| 1061 | latitude: 37.9792, |
||
| 1062 | longitude: 23.7166 |
||
| 1063 | }, { |
||
| 1064 | svgPath: targetSVG, |
||
| 1065 | title: "Reykjavik", |
||
| 1066 | latitude: 64.1353, |
||
| 1067 | longitude: -21.8952 |
||
| 1068 | }, { |
||
| 1069 | svgPath: targetSVG, |
||
| 1070 | title: "Dublin", |
||
| 1071 | latitude: 53.3441, |
||
| 1072 | longitude: -6.2675 |
||
| 1073 | }, { |
||
| 1074 | svgPath: targetSVG, |
||
| 1075 | title: "Oslo", |
||
| 1076 | latitude: 59.9138, |
||
| 1077 | longitude: 10.7387 |
||
| 1078 | }, { |
||
| 1079 | svgPath: targetSVG, |
||
| 1080 | title: "Lisbon", |
||
| 1081 | latitude: 38.7072, |
||
| 1082 | longitude: -9.1355 |
||
| 1083 | }, { |
||
| 1084 | svgPath: targetSVG, |
||
| 1085 | title: "Moscow", |
||
| 1086 | latitude: 55.7558, |
||
| 1087 | longitude: 37.6176 |
||
| 1088 | }, { |
||
| 1089 | svgPath: targetSVG, |
||
| 1090 | title: "Belgrade", |
||
| 1091 | latitude: 44.8048, |
||
| 1092 | longitude: 20.4781 |
||
| 1093 | }, { |
||
| 1094 | svgPath: targetSVG, |
||
| 1095 | title: "Bratislava", |
||
| 1096 | latitude: 48.2116, |
||
| 1097 | longitude: 17.1547 |
||
| 1098 | }, { |
||
| 1099 | svgPath: targetSVG, |
||
| 1100 | title: "Ljubljana", |
||
| 1101 | latitude: 46.0514, |
||
| 1102 | longitude: 14.5060 |
||
| 1103 | }, { |
||
| 1104 | svgPath: targetSVG, |
||
| 1105 | title: "Madrid", |
||
| 1106 | latitude: 40.4167, |
||
| 1107 | longitude: -3.7033 |
||
| 1108 | }, { |
||
| 1109 | svgPath: targetSVG, |
||
| 1110 | title: "Stockholm", |
||
| 1111 | latitude: 59.3328, |
||
| 1112 | longitude: 18.0645 |
||
| 1113 | }, { |
||
| 1114 | svgPath: targetSVG, |
||
| 1115 | title: "Bern", |
||
| 1116 | latitude: 46.9480, |
||
| 1117 | longitude: 7.4481 |
||
| 1118 | }, { |
||
| 1119 | svgPath: targetSVG, |
||
| 1120 | title: "Kiev", |
||
| 1121 | latitude: 50.4422, |
||
| 1122 | longitude: 30.5367 |
||
| 1123 | }, { |
||
| 1124 | svgPath: targetSVG, |
||
| 1125 | title: "Paris", |
||
| 1126 | latitude: 48.8567, |
||
| 1127 | longitude: 2.3510 |
||
| 1128 | }, { |
||
| 1129 | svgPath: targetSVG, |
||
| 1130 | title: "New York", |
||
| 1131 | latitude: 40.43, |
||
| 1132 | longitude: -74 |
||
| 1133 | } |
||
| 1134 | ] |
||
| 1135 | }, |
||
| 1136 | |||
| 1137 | zoomControl: { |
||
| 1138 | buttonFillColor: "#dddddd" |
||
| 1139 | }, |
||
| 1140 | |||
| 1141 | areasSettings: { |
||
| 1142 | unlistedAreasColor: "#15A892" |
||
| 1143 | }, |
||
| 1144 | |||
| 1145 | imagesSettings: { |
||
| 1146 | color: "#d93d5e", |
||
| 1147 | rollOverColor: "#d93d5e", |
||
| 1148 | selectedColor: "#009dc7" |
||
| 1149 | }, |
||
| 1150 | |||
| 1151 | linesSettings: { |
||
| 1152 | color: "#d93d5e", |
||
| 1153 | alpha: 0.4 |
||
| 1154 | }, |
||
| 1155 | |||
| 1156 | |||
| 1157 | backgroundZoomsToTop: true, |
||
| 1158 | linesAboveImages: true, |
||
| 1159 | |||
| 1160 | "export": { |
||
| 1161 | "enabled": true, |
||
| 1162 | "libs": { |
||
| 1163 | "path": "http://www.amcharts.com/lib/3/plugins/export/libs/" |
||
| 1164 | } |
||
| 1165 | } |
||
| 1166 | }); |
||
| 1167 | }, |
||
| 1168 | |||
| 1169 | initAmChart3: function() { |
||
| 1170 | if (typeof(AmCharts) === 'undefined' || $('#dashboard_amchart_3').size() === 0) { |
||
| 1171 | return; |
||
| 1172 | } |
||
| 1173 | |||
| 1174 | var chart = AmCharts.makeChart("dashboard_amchart_3", { |
||
| 1175 | "type": "serial", |
||
| 1176 | "addClassNames": true, |
||
| 1177 | "theme": "light", |
||
| 1178 | "path": "../assets/global/plugins/amcharts/ammap/images/", |
||
| 1179 | "autoMargins": false, |
||
| 1180 | "marginLeft": 30, |
||
| 1181 | "marginRight": 8, |
||
| 1182 | "marginTop": 10, |
||
| 1183 | "marginBottom": 26, |
||
| 1184 | "balloon": { |
||
| 1185 | "adjustBorderColor": false, |
||
| 1186 | "horizontalPadding": 10, |
||
| 1187 | "verticalPadding": 8, |
||
| 1188 | "color": "#ffffff" |
||
| 1189 | }, |
||
| 1190 | |||
| 1191 | "dataProvider": [{ |
||
| 1192 | "year": 2009, |
||
| 1193 | "income": 23.5, |
||
| 1194 | "expenses": 21.1 |
||
| 1195 | }, { |
||
| 1196 | "year": 2010, |
||
| 1197 | "income": 26.2, |
||
| 1198 | "expenses": 30.5 |
||
| 1199 | }, { |
||
| 1200 | "year": 2011, |
||
| 1201 | "income": 30.1, |
||
| 1202 | "expenses": 34.9 |
||
| 1203 | }, { |
||
| 1204 | "year": 2012, |
||
| 1205 | "income": 29.5, |
||
| 1206 | "expenses": 31.1 |
||
| 1207 | }, { |
||
| 1208 | "year": 2013, |
||
| 1209 | "income": 30.6, |
||
| 1210 | "expenses": 28.2, |
||
| 1211 | }, { |
||
| 1212 | "year": 2014, |
||
| 1213 | "income": 34.1, |
||
| 1214 | "expenses": 32.9, |
||
| 1215 | "dashLengthColumn": 5, |
||
| 1216 | "alpha": 0.2, |
||
| 1217 | "additional": "(projection)" |
||
| 1218 | }], |
||
| 1219 | "valueAxes": [{ |
||
| 1220 | "axisAlpha": 0, |
||
| 1221 | "position": "left" |
||
| 1222 | }], |
||
| 1223 | "startDuration": 1, |
||
| 1224 | "graphs": [{ |
||
| 1225 | "alphaField": "alpha", |
||
| 1226 | "balloonText": "<span style='font-size:12px;'>[[title]] in [[category]]:<br><span style='font-size:20px;'>[[value]]</span> [[additional]]</span>", |
||
| 1227 | "fillAlphas": 1, |
||
| 1228 | "title": "Income", |
||
| 1229 | "type": "column", |
||
| 1230 | "valueField": "income", |
||
| 1231 | "dashLengthField": "dashLengthColumn" |
||
| 1232 | }, { |
||
| 1233 | "id": "graph2", |
||
| 1234 | "balloonText": "<span style='font-size:12px;'>[[title]] in [[category]]:<br><span style='font-size:20px;'>[[value]]</span> [[additional]]</span>", |
||
| 1235 | "bullet": "round", |
||
| 1236 | "lineThickness": 3, |
||
| 1237 | "bulletSize": 7, |
||
| 1238 | "bulletBorderAlpha": 1, |
||
| 1239 | "bulletColor": "#FFFFFF", |
||
| 1240 | "useLineColorForBulletBorder": true, |
||
| 1241 | "bulletBorderThickness": 3, |
||
| 1242 | "fillAlphas": 0, |
||
| 1243 | "lineAlpha": 1, |
||
| 1244 | "title": "Expenses", |
||
| 1245 | "valueField": "expenses" |
||
| 1246 | }], |
||
| 1247 | "categoryField": "year", |
||
| 1248 | "categoryAxis": { |
||
| 1249 | "gridPosition": "start", |
||
| 1250 | "axisAlpha": 0, |
||
| 1251 | "tickLength": 0 |
||
| 1252 | }, |
||
| 1253 | "export": { |
||
| 1254 | "enabled": true |
||
| 1255 | } |
||
| 1256 | }); |
||
| 1257 | }, |
||
| 1258 | |||
| 1259 | initAmChart4: function() { |
||
| 1260 | if (typeof(AmCharts) === 'undefined' || $('#dashboard_amchart_4').size() === 0) { |
||
| 1261 | return; |
||
| 1262 | } |
||
| 1263 | |||
| 1264 | var chart = AmCharts.makeChart("dashboard_amchart_4", { |
||
| 1265 | "type": "pie", |
||
| 1266 | "theme": "light", |
||
| 1267 | "path": "../assets/global/plugins/amcharts/ammap/images/", |
||
| 1268 | "dataProvider": [{ |
||
| 1269 | "country": "Lithuania", |
||
| 1270 | "value": 260 |
||
| 1271 | }, { |
||
| 1272 | "country": "Ireland", |
||
| 1273 | "value": 201 |
||
| 1274 | }, { |
||
| 1275 | "country": "Germany", |
||
| 1276 | "value": 65 |
||
| 1277 | }, { |
||
| 1278 | "country": "Australia", |
||
| 1279 | "value": 39 |
||
| 1280 | }, { |
||
| 1281 | "country": "UK", |
||
| 1282 | "value": 19 |
||
| 1283 | }, { |
||
| 1284 | "country": "Latvia", |
||
| 1285 | "value": 10 |
||
| 1286 | }], |
||
| 1287 | "valueField": "value", |
||
| 1288 | "titleField": "country", |
||
| 1289 | "outlineAlpha": 0.4, |
||
| 1290 | "depth3D": 15, |
||
| 1291 | "balloonText": "[[title]]<br><span style='font-size:14px'><b>[[value]]</b> ([[percents]]%)</span>", |
||
| 1292 | "angle": 30, |
||
| 1293 | "export": { |
||
| 1294 | "enabled": true |
||
| 1295 | } |
||
| 1296 | }); |
||
| 1297 | jQuery('.chart-input').off().on('input change', function() { |
||
| 1298 | var property = jQuery(this).data('property'); |
||
| 1299 | var target = chart; |
||
| 1300 | var value = Number(this.value); |
||
| 1301 | chart.startDuration = 0; |
||
| 1302 | |||
| 1303 | if (property == 'innerRadius') { |
||
| 1304 | value += "%"; |
||
| 1305 | } |
||
| 1306 | |||
| 1307 | target[property] = value; |
||
| 1308 | chart.validateNow(); |
||
| 1309 | }); |
||
| 1310 | }, |
||
| 1311 | |||
| 1312 | initWorldMapStats: function() { |
||
| 1313 | if ($('#mapplic').size() === 0) { |
||
| 1314 | return; |
||
| 1315 | } |
||
| 1316 | |||
| 1317 | $('#mapplic').mapplic({ |
||
| 1318 | source: '../assets/global/plugins/mapplic/world.json', |
||
| 1319 | height: 265, |
||
| 1320 | animate: false, |
||
| 1321 | sidebar: false, |
||
| 1322 | minimap: false, |
||
| 1323 | locations: true, |
||
| 1324 | deeplinking: true, |
||
| 1325 | fullscreen: false, |
||
| 1326 | hovertip: true, |
||
| 1327 | zoombuttons: false, |
||
| 1328 | clearbutton: false, |
||
| 1329 | developer: false, |
||
| 1330 | maxscale: 2, |
||
| 1331 | skin: 'mapplic-dark', |
||
| 1332 | zoom: true |
||
| 1333 | }); |
||
| 1334 | |||
| 1335 | $("#widget_sparkline_bar").sparkline([8, 7, 9, 8.5, 8, 8.2, 8, 8.5, 9, 8, 9], { |
||
| 1336 | type: 'bar', |
||
| 1337 | width: '100', |
||
| 1338 | barWidth: 5, |
||
| 1339 | height: '30', |
||
| 1340 | barColor: '#4db3a4', |
||
| 1341 | negBarColor: '#e02222' |
||
| 1342 | }); |
||
| 1343 | |||
| 1344 | $("#widget_sparkline_bar2").sparkline([8, 7, 9, 8.5, 8, 8.2, 8, 8.5, 9, 8, 9], { |
||
| 1345 | type: 'bar', |
||
| 1346 | width: '100', |
||
| 1347 | barWidth: 5, |
||
| 1348 | height: '30', |
||
| 1349 | barColor: '#f36a5a', |
||
| 1350 | negBarColor: '#e02222' |
||
| 1351 | }); |
||
| 1352 | |||
| 1353 | $("#widget_sparkline_bar3").sparkline([8, 7, 9, 8.5, 8, 8.2, 8, 8.5, 9, 8, 9], { |
||
| 1354 | type: 'bar', |
||
| 1355 | width: '100', |
||
| 1356 | barWidth: 5, |
||
| 1357 | height: '30', |
||
| 1358 | barColor: '#5b9bd1', |
||
| 1359 | negBarColor: '#e02222' |
||
| 1360 | }); |
||
| 1361 | |||
| 1362 | $("#widget_sparkline_bar4").sparkline([8, 7, 9, 8.5, 8, 8.2, 8, 8.5, 9, 8, 9], { |
||
| 1363 | type: 'bar', |
||
| 1364 | width: '100', |
||
| 1365 | barWidth: 5, |
||
| 1366 | height: '30', |
||
| 1367 | barColor: '#9a7caf', |
||
| 1368 | negBarColor: '#e02222' |
||
| 1369 | }); |
||
| 1370 | }, |
||
| 1371 | |||
| 1372 | init: function() { |
||
| 1373 | |||
| 1374 | this.initJQVMAP(); |
||
| 1375 | this.initCalendar(); |
||
| 1376 | this.initCharts(); |
||
| 1377 | this.initEasyPieCharts(); |
||
| 1378 | this.initSparklineCharts(); |
||
| 1379 | this.initChat(); |
||
| 1380 | this.initDashboardDaterange(); |
||
| 1381 | this.initMorisCharts(); |
||
| 1382 | |||
| 1383 | this.initAmChart1(); |
||
| 1384 | this.initAmChart2(); |
||
| 1385 | this.initAmChart3(); |
||
| 1386 | this.initAmChart4(); |
||
| 1387 | |||
| 1388 | this.initWorldMapStats(); |
||
| 1389 | } |
||
| 1390 | }; |
||
| 1391 | |||
| 1392 | }(); |
||
| 1393 | |||
| 1394 | if (App.isAngularJsApp() === false) { |
||
| 1395 | jQuery(document).ready(function() { |
||
| 1396 | Dashboard.init(); // init metronic core componets |
||
| 1397 | }); |
||
| 1398 | } |