demo.js 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175
  1. demo = {
  2. initPickColor: function() {
  3. $('.pick-class-label').click(function() {
  4. var new_class = $(this).attr('new-class');
  5. var old_class = $('#display-buttons').attr('data-class');
  6. var display_div = $('#display-buttons');
  7. if (display_div.length) {
  8. var display_buttons = display_div.find('.btn');
  9. display_buttons.removeClass(old_class);
  10. display_buttons.addClass(new_class);
  11. display_div.attr('data-class', new_class);
  12. }
  13. });
  14. },
  15. checkFullPageBackgroundImage: function() {
  16. $page = $('.full-page');
  17. image_src = $page.data('image');
  18. if (image_src !== undefined) {
  19. image_container = '<div class="full-page-background" style="background-image: url(' + image_src + ') "/>'
  20. $page.append(image_container);
  21. }
  22. },
  23. initFormExtendedDatetimepickers: function() {
  24. $('.datetimepicker').datetimepicker({
  25. icons: {
  26. time: "fa fa-clock-o",
  27. date: "fa fa-calendar",
  28. up: "fa fa-chevron-up",
  29. down: "fa fa-chevron-down",
  30. previous: 'fa fa-chevron-left',
  31. next: 'fa fa-chevron-right',
  32. today: 'fa fa-screenshot',
  33. clear: 'fa fa-trash',
  34. close: 'fa fa-remove'
  35. }
  36. });
  37. $('.datepicker').datetimepicker({
  38. format: 'MM/DD/YYYY',
  39. icons: {
  40. time: "fa fa-clock-o",
  41. date: "fa fa-calendar",
  42. up: "fa fa-chevron-up",
  43. down: "fa fa-chevron-down",
  44. previous: 'fa fa-chevron-left',
  45. next: 'fa fa-chevron-right',
  46. today: 'fa fa-screenshot',
  47. clear: 'fa fa-trash',
  48. close: 'fa fa-remove'
  49. }
  50. });
  51. $('.timepicker').datetimepicker({
  52. // format: 'H:mm', // use this format if you want the 24hours timepicker
  53. format: 'h:mm A', //use this format if you want the 12hours timpiecker with AM/PM toggle
  54. icons: {
  55. time: "fa fa-clock-o",
  56. date: "fa fa-calendar",
  57. up: "fa fa-chevron-up",
  58. down: "fa fa-chevron-down",
  59. previous: 'fa fa-chevron-left',
  60. next: 'fa fa-chevron-right',
  61. today: 'fa fa-screenshot',
  62. clear: 'fa fa-trash',
  63. close: 'fa fa-remove'
  64. }
  65. });
  66. },
  67. initMaterialWizard: function() {
  68. // Code for the Validator
  69. var $validator = $('.wizard-card form').validate({
  70. rules: {
  71. firstname: {
  72. required: true,
  73. minlength: 3
  74. },
  75. lastname: {
  76. required: true,
  77. minlength: 3
  78. },
  79. email: {
  80. required: true,
  81. minlength: 3,
  82. }
  83. },
  84. errorPlacement: function(error, element) {
  85. $(element).parent('div').addClass('has-error');
  86. }
  87. });
  88. // Wizard Initialization
  89. $('.wizard-card').bootstrapWizard({
  90. 'tabClass': 'nav nav-pills',
  91. 'nextSelector': '.btn-next',
  92. 'previousSelector': '.btn-previous',
  93. onNext: function(tab, navigation, index) {
  94. var $valid = $('.wizard-card form').valid();
  95. if (!$valid) {
  96. $validator.focusInvalid();
  97. return false;
  98. }
  99. },
  100. onInit: function(tab, navigation, index) {
  101. //check number of tabs and fill the entire row
  102. var $total = navigation.find('li').length;
  103. var $wizard = navigation.closest('.wizard-card');
  104. $first_li = navigation.find('li:first-child a').html();
  105. $moving_div = $('<div class="moving-tab">' + $first_li + '</div>');
  106. $('.wizard-card .wizard-navigation').append($moving_div);
  107. refreshAnimation($wizard, index);
  108. $('.moving-tab').css('transition', 'transform 0s');
  109. },
  110. onTabClick: function(tab, navigation, index) {
  111. var $valid = $('.wizard-card form').valid();
  112. if (!$valid) {
  113. return false;
  114. } else {
  115. return true;
  116. }
  117. },
  118. onTabShow: function(tab, navigation, index) {
  119. var $total = navigation.find('li').length;
  120. var $current = index + 1;
  121. var $wizard = navigation.closest('.wizard-card');
  122. // If it's the last tab then hide the last button and show the finish instead
  123. if ($current >= $total) {
  124. $($wizard).find('.btn-next').hide();
  125. $($wizard).find('.btn-finish').show();
  126. } else {
  127. $($wizard).find('.btn-next').show();
  128. $($wizard).find('.btn-finish').hide();
  129. }
  130. button_text = navigation.find('li:nth-child(' + $current + ') a').html();
  131. setTimeout(function() {
  132. $('.moving-tab').text(button_text);
  133. }, 150);
  134. var checkbox = $('.footer-checkbox');
  135. if (!index == 0) {
  136. $(checkbox).css({
  137. 'opacity': '0',
  138. 'visibility': 'hidden',
  139. 'position': 'absolute'
  140. });
  141. } else {
  142. $(checkbox).css({
  143. 'opacity': '1',
  144. 'visibility': 'visible'
  145. });
  146. }
  147. refreshAnimation($wizard, index);
  148. }
  149. });
  150. // Prepare the preview for profile picture
  151. $("#wizard-picture").change(function() {
  152. readURL(this);
  153. });
  154. $('[data-toggle="wizard-radio"]').click(function() {
  155. wizard = $(this).closest('.wizard-card');
  156. wizard.find('[data-toggle="wizard-radio"]').removeClass('active');
  157. $(this).addClass('active');
  158. $(wizard).find('[type="radio"]').removeAttr('checked');
  159. $(this).find('[type="radio"]').attr('checked', 'true');
  160. });
  161. $('[data-toggle="wizard-checkbox"]').click(function() {
  162. if ($(this).hasClass('active')) {
  163. $(this).removeClass('active');
  164. $(this).find('[type="checkbox"]').removeAttr('checked');
  165. } else {
  166. $(this).addClass('active');
  167. $(this).find('[type="checkbox"]').attr('checked', 'true');
  168. }
  169. });
  170. $('.set-full-height').css('height', 'auto');
  171. //Function to show image before upload
  172. function readURL(input) {
  173. if (input.files && input.files[0]) {
  174. var reader = new FileReader();
  175. reader.onload = function(e) {
  176. $('#wizardPicturePreview').attr('src', e.target.result).fadeIn('slow');
  177. }
  178. reader.readAsDataURL(input.files[0]);
  179. }
  180. }
  181. $(window).resize(function() {
  182. $('.wizard-card').each(function() {
  183. $wizard = $(this);
  184. index = $wizard.bootstrapWizard('currentIndex');
  185. refreshAnimation($wizard, index);
  186. $('.moving-tab').css({
  187. 'transition': 'transform 0s'
  188. });
  189. });
  190. });
  191. function refreshAnimation($wizard, index) {
  192. $total = $wizard.find('.nav li').length;
  193. $li_width = 100 / $total;
  194. total_steps = $wizard.find('.nav li').length;
  195. move_distance = $wizard.width() / total_steps;
  196. index_temp = index;
  197. vertical_level = 0;
  198. mobile_device = $(document).width() < 600 && $total > 3;
  199. if (mobile_device) {
  200. move_distance = $wizard.width() / 2;
  201. index_temp = index % 2;
  202. $li_width = 50;
  203. }
  204. $wizard.find('.nav li').css('width', $li_width + '%');
  205. step_width = move_distance;
  206. move_distance = move_distance * index_temp;
  207. $current = index + 1;
  208. if ($current == 1 || (mobile_device == true && (index % 2 == 0))) {
  209. move_distance -= 8;
  210. } else if ($current == total_steps || (mobile_device == true && (index % 2 == 1))) {
  211. move_distance += 8;
  212. }
  213. if (mobile_device) {
  214. vertical_level = parseInt(index / 2);
  215. vertical_level = vertical_level * 38;
  216. }
  217. $wizard.find('.moving-tab').css('width', step_width);
  218. $('.moving-tab').css({
  219. 'transform': 'translate3d(' + move_distance + 'px, ' + vertical_level + 'px, 0)',
  220. 'transition': 'all 0.5s cubic-bezier(0.29, 1.42, 0.79, 1)'
  221. });
  222. }
  223. },
  224. initDocumentationCharts: function() {
  225. /* ----------========== Daily Sales Chart initialization For Documentation ==========---------- */
  226. dataDailySalesChart = {
  227. labels: ['M', 'T', 'W', 'T', 'F', 'S', 'S'],
  228. series: [
  229. [12, 17, 7, 17, 23, 18, 38]
  230. ]
  231. };
  232. optionsDailySalesChart = {
  233. lineSmooth: Chartist.Interpolation.cardinal({
  234. tension: 0
  235. }),
  236. low: 0,
  237. high: 50, // creative tim: we recommend you to set the high sa the biggest value + something for a better look
  238. chartPadding: {
  239. top: 0,
  240. right: 0,
  241. bottom: 0,
  242. left: 0
  243. },
  244. }
  245. var dailySalesChart = new Chartist.Line('#dailySalesChart', dataDailySalesChart, optionsDailySalesChart);
  246. var animationHeaderChart = new Chartist.Line('#websiteViewsChart', dataDailySalesChart, optionsDailySalesChart);
  247. },
  248. initCharts: function() {
  249. /* ----------========== Rounded Line Chart initialization ==========---------- */
  250. dataRoundedLineChart = {
  251. labels: ['M', 'T', 'W', 'T', 'F', 'S', 'S'],
  252. series: [
  253. [12, 17, 7, 17, 23, 18, 38]
  254. ]
  255. };
  256. optionsRoundedLineChart = {
  257. lineSmooth: Chartist.Interpolation.cardinal({
  258. tension: 10
  259. }),
  260. axisX: {
  261. showGrid: false,
  262. },
  263. low: 0,
  264. high: 50, // creative tim: we recommend you to set the high sa the biggest value + something for a better look
  265. chartPadding: {
  266. top: 0,
  267. right: 0,
  268. bottom: 0,
  269. left: 0
  270. },
  271. showPoint: false
  272. }
  273. var RoundedLineChart = new Chartist.Line('#roundedLineChart', dataRoundedLineChart, optionsRoundedLineChart);
  274. md.startAnimationForLineChart(RoundedLineChart);
  275. /* **************** Straight Lines Chart - single line with points ******************** */
  276. dataStraightLinesChart = {
  277. labels: ['\'07', '\'08', '\'09', '\'10', '\'11', '\'12', '\'13', '\'14', '\'15'],
  278. series: [
  279. [10, 16, 8, 13, 20, 15, 20, 34, 30]
  280. ]
  281. };
  282. optionsStraightLinesChart = {
  283. lineSmooth: Chartist.Interpolation.cardinal({
  284. tension: 0
  285. }),
  286. low: 0,
  287. high: 50, // creative tim: we recommend you to set the high sa the biggest value + something for a better look
  288. chartPadding: {
  289. top: 0,
  290. right: 0,
  291. bottom: 0,
  292. left: 0
  293. },
  294. classNames: {
  295. point: 'ct-point ct-white',
  296. line: 'ct-line ct-white'
  297. }
  298. }
  299. var straightLinesChart = new Chartist.Line('#straightLinesChart', dataStraightLinesChart, optionsStraightLinesChart);
  300. md.startAnimationForLineChart(straightLinesChart);
  301. /* **************** Coloured Rounded Line Chart - Line Chart ******************** */
  302. dataColouredRoundedLineChart = {
  303. labels: ['\'06', '\'07', '\'08', '\'09', '\'10', '\'11', '\'12', '\'13', '\'14', '\'15'],
  304. series: [
  305. [287, 480, 290, 554, 690, 690, 500, 752, 650, 900, 944]
  306. ]
  307. };
  308. optionsColouredRoundedLineChart = {
  309. lineSmooth: Chartist.Interpolation.cardinal({
  310. tension: 10
  311. }),
  312. axisY: {
  313. showGrid: true,
  314. offset: 40
  315. },
  316. axisX: {
  317. showGrid: false,
  318. },
  319. low: 0,
  320. high: 1000,
  321. showPoint: true,
  322. height: '300px'
  323. };
  324. var colouredRoundedLineChart = new Chartist.Line('#colouredRoundedLineChart', dataColouredRoundedLineChart, optionsColouredRoundedLineChart);
  325. md.startAnimationForLineChart(colouredRoundedLineChart);
  326. /* **************** Coloured Rounded Line Chart - Line Chart ******************** */
  327. dataColouredBarsChart = {
  328. labels: ['\'06', '\'07', '\'08', '\'09', '\'10', '\'11', '\'12', '\'13', '\'14', '\'15'],
  329. series: [
  330. [287, 385, 490, 554, 586, 698, 695, 752, 788, 846, 944],
  331. [67, 152, 143, 287, 335, 435, 437, 539, 542, 544, 647],
  332. [23, 113, 67, 190, 239, 307, 308, 439, 410, 410, 509]
  333. ]
  334. };
  335. optionsColouredBarsChart = {
  336. lineSmooth: Chartist.Interpolation.cardinal({
  337. tension: 10
  338. }),
  339. axisY: {
  340. showGrid: true,
  341. offset: 40
  342. },
  343. axisX: {
  344. showGrid: false,
  345. },
  346. low: 0,
  347. high: 1000,
  348. showPoint: true,
  349. height: '300px'
  350. };
  351. var colouredBarsChart = new Chartist.Line('#colouredBarsChart', dataColouredBarsChart, optionsColouredBarsChart);
  352. md.startAnimationForLineChart(colouredBarsChart);
  353. /* **************** Public Preferences - Pie Chart ******************** */
  354. var dataPreferences = {
  355. labels: ['62%', '32%', '6%'],
  356. series: [62, 32, 6]
  357. };
  358. var optionsPreferences = {
  359. height: '230px'
  360. };
  361. Chartist.Pie('#chartPreferences', dataPreferences, optionsPreferences);
  362. /* **************** Simple Bar Chart - barchart ******************** */
  363. var dataSimpleBarChart = {
  364. labels: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  365. series: [
  366. [542, 443, 320, 780, 553, 453, 326, 434, 568, 610, 756, 895]
  367. ]
  368. };
  369. var optionsSimpleBarChart = {
  370. seriesBarDistance: 10,
  371. axisX: {
  372. showGrid: false
  373. }
  374. };
  375. var responsiveOptionsSimpleBarChart = [
  376. ['screen and (max-width: 640px)', {
  377. seriesBarDistance: 5,
  378. axisX: {
  379. labelInterpolationFnc: function(value) {
  380. return value[0];
  381. }
  382. }
  383. }]
  384. ];
  385. var simpleBarChart = Chartist.Bar('#simpleBarChart', dataSimpleBarChart, optionsSimpleBarChart, responsiveOptionsSimpleBarChart);
  386. //start animation for the Emails Subscription Chart
  387. md.startAnimationForBarChart(simpleBarChart);
  388. var dataMultipleBarsChart = {
  389. labels: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  390. series: [
  391. [542, 443, 320, 780, 553, 453, 326, 434, 568, 610, 756, 895],
  392. [412, 243, 280, 580, 453, 353, 300, 364, 368, 410, 636, 695]
  393. ]
  394. };
  395. var optionsMultipleBarsChart = {
  396. seriesBarDistance: 10,
  397. axisX: {
  398. showGrid: false
  399. },
  400. height: '300px'
  401. };
  402. var responsiveOptionsMultipleBarsChart = [
  403. ['screen and (max-width: 640px)', {
  404. seriesBarDistance: 5,
  405. axisX: {
  406. labelInterpolationFnc: function(value) {
  407. return value[0];
  408. }
  409. }
  410. }]
  411. ];
  412. var multipleBarsChart = Chartist.Bar('#multipleBarsChart', dataMultipleBarsChart, optionsMultipleBarsChart, responsiveOptionsMultipleBarsChart);
  413. //start animation for the Emails Subscription Chart
  414. md.startAnimationForBarChart(multipleBarsChart);
  415. },
  416. initDashboardPageCharts: function() {
  417. /* ----------========== Daily Sales Chart initialization ==========---------- */
  418. dataDailySalesChart = {
  419. labels: ['M', 'T', 'W', 'T', 'F', 'S', 'S'],
  420. series: [
  421. [12, 17, 7, 17, 23, 18, 38]
  422. ]
  423. };
  424. optionsDailySalesChart = {
  425. lineSmooth: Chartist.Interpolation.cardinal({
  426. tension: 0
  427. }),
  428. low: 0,
  429. high: 50, // creative tim: we recommend you to set the high sa the biggest value + something for a better look
  430. chartPadding: {
  431. top: 0,
  432. right: 0,
  433. bottom: 0,
  434. left: 0
  435. },
  436. }
  437. var dailySalesChart = new Chartist.Line('#dailySalesChart', dataDailySalesChart, optionsDailySalesChart);
  438. md.startAnimationForLineChart(dailySalesChart);
  439. /* ----------========== Completed Tasks Chart initialization ==========---------- */
  440. dataCompletedTasksChart = {
  441. labels: ['12p', '3p', '6p', '9p', '12p', '3a', '6a', '9a'],
  442. series: [
  443. [230, 750, 450, 300, 280, 240, 200, 190]
  444. ]
  445. };
  446. optionsCompletedTasksChart = {
  447. lineSmooth: Chartist.Interpolation.cardinal({
  448. tension: 0
  449. }),
  450. low: 0,
  451. high: 1000, // creative tim: we recommend you to set the high sa the biggest value + something for a better look
  452. chartPadding: {
  453. top: 0,
  454. right: 0,
  455. bottom: 0,
  456. left: 0
  457. }
  458. }
  459. var completedTasksChart = new Chartist.Line('#completedTasksChart', dataCompletedTasksChart, optionsCompletedTasksChart);
  460. // start animation for the Completed Tasks Chart - Line Chart
  461. md.startAnimationForLineChart(completedTasksChart);
  462. /* ----------========== Emails Subscription Chart initialization ==========---------- */
  463. var dataWebsiteViewsChart = {
  464. labels: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
  465. series: [
  466. [542, 443, 320, 780, 553, 453, 326, 434, 568, 610, 756, 895]
  467. ]
  468. };
  469. var optionsWebsiteViewsChart = {
  470. axisX: {
  471. showGrid: false
  472. },
  473. low: 0,
  474. high: 1000,
  475. chartPadding: {
  476. top: 0,
  477. right: 5,
  478. bottom: 0,
  479. left: 0
  480. }
  481. };
  482. var responsiveOptions = [
  483. ['screen and (max-width: 640px)', {
  484. seriesBarDistance: 5,
  485. axisX: {
  486. labelInterpolationFnc: function(value) {
  487. return value[0];
  488. }
  489. }
  490. }]
  491. ];
  492. var websiteViewsChart = Chartist.Bar('#websiteViewsChart', dataWebsiteViewsChart, optionsWebsiteViewsChart, responsiveOptions);
  493. //start animation for the Emails Subscription Chart
  494. md.startAnimationForBarChart(websiteViewsChart);
  495. },
  496. showSwal: function(type) {
  497. if (type == 'basic') {
  498. swal({
  499. title: "Here's a message!",
  500. buttonsStyling: false,
  501. confirmButtonClass: "btn btn-success"
  502. });
  503. } else if (type == 'title-and-text') {
  504. swal({
  505. title: "Here's a message!",
  506. text: "It's pretty, isn't it?",
  507. buttonsStyling: false,
  508. confirmButtonClass: "btn btn-info"
  509. });
  510. } else if (type == 'success-message') {
  511. swal({
  512. title: "Good job!",
  513. text: "You clicked the button!",
  514. buttonsStyling: false,
  515. confirmButtonClass: "btn btn-success",
  516. type: "success"
  517. });
  518. } else if (type == 'warning-message-and-confirmation') {
  519. swal({
  520. title: 'Are you sure?',
  521. text: "You won't be able to revert this!",
  522. type: 'warning',
  523. showCancelButton: true,
  524. confirmButtonClass: 'btn btn-success',
  525. cancelButtonClass: 'btn btn-danger',
  526. confirmButtonText: 'Yes, delete it!',
  527. buttonsStyling: false
  528. }).then(function() {
  529. swal({
  530. title: 'Deleted!',
  531. text: 'Your file has been deleted.',
  532. type: 'success',
  533. confirmButtonClass: "btn btn-success",
  534. buttonsStyling: false
  535. })
  536. });
  537. } else if (type == 'warning-message-and-cancel') {
  538. swal({
  539. title: 'Are you sure?',
  540. text: 'You will not be able to recover this imaginary file!',
  541. type: 'warning',
  542. showCancelButton: true,
  543. confirmButtonText: 'Yes, delete it!',
  544. cancelButtonText: 'No, keep it',
  545. confirmButtonClass: "btn btn-success",
  546. cancelButtonClass: "btn btn-danger",
  547. buttonsStyling: false
  548. }).then(function() {
  549. swal({
  550. title: 'Deleted!',
  551. text: 'Your imaginary file has been deleted.',
  552. type: 'success',
  553. confirmButtonClass: "btn btn-success",
  554. buttonsStyling: false
  555. })
  556. }, function(dismiss) {
  557. // dismiss can be 'overlay', 'cancel', 'close', 'esc', 'timer'
  558. if (dismiss === 'cancel') {
  559. swal({
  560. title: 'Cancelled',
  561. text: 'Your imaginary file is safe :)',
  562. type: 'error',
  563. confirmButtonClass: "btn btn-info",
  564. buttonsStyling: false
  565. })
  566. }
  567. })
  568. } else if (type == 'custom-html') {
  569. swal({
  570. title: 'HTML example',
  571. buttonsStyling: false,
  572. confirmButtonClass: "btn btn-success",
  573. html: 'You can use <b>bold text</b>, ' +
  574. '<a href="http://github.com">links</a> ' +
  575. 'and other HTML tags'
  576. });
  577. } else if (type == 'auto-close') {
  578. swal({
  579. title: "Auto close alert!",
  580. text: "I will close in 2 seconds.",
  581. timer: 2000,
  582. showConfirmButton: false
  583. });
  584. } else if (type == 'input-field') {
  585. swal({
  586. title: 'Input something',
  587. html: '<div class="form-group">' +
  588. '<input id="input-field" type="text" class="form-control" />' +
  589. '</div>',
  590. showCancelButton: true,
  591. confirmButtonClass: 'btn btn-success',
  592. cancelButtonClass: 'btn btn-danger',
  593. buttonsStyling: false
  594. }).then(function(result) {
  595. swal({
  596. type: 'success',
  597. html: 'You entered: <strong>' +
  598. $('#input-field').val() +
  599. '</strong>',
  600. confirmButtonClass: 'btn btn-success',
  601. buttonsStyling: false
  602. })
  603. }).catch(swal.noop)
  604. }
  605. },
  606. initVectorMap: function() {
  607. var mapData = {
  608. "AU": 760,
  609. "BR": 550,
  610. "CA": 120,
  611. "DE": 1300,
  612. "FR": 540,
  613. "GB": 690,
  614. "GE": 200,
  615. "IN": 200,
  616. "RO": 600,
  617. "RU": 300,
  618. "US": 2920,
  619. };
  620. $('#worldMap').vectorMap({
  621. map: 'world_mill_en',
  622. backgroundColor: "transparent",
  623. zoomOnScroll: false,
  624. regionStyle: {
  625. initial: {
  626. fill: '#e4e4e4',
  627. "fill-opacity": 0.9,
  628. stroke: 'none',
  629. "stroke-width": 0,
  630. "stroke-opacity": 0
  631. }
  632. },
  633. series: {
  634. regions: [{
  635. values: mapData,
  636. scale: ["#AAAAAA", "#444444"],
  637. normalizeFunction: 'polynomial'
  638. }]
  639. },
  640. });
  641. },
  642. initGoogleMaps: function() {
  643. var myLatlng = new google.maps.LatLng(40.748817, -73.985428);
  644. var mapOptions = {
  645. zoom: 13,
  646. center: myLatlng,
  647. scrollwheel: false, //we disable de scroll over the map, it is a really annoing when you scroll through page
  648. styles: [{
  649. "featureType": "water",
  650. "stylers": [{
  651. "saturation": 43
  652. }, {
  653. "lightness": -11
  654. }, {
  655. "hue": "#0088ff"
  656. }]
  657. }, {
  658. "featureType": "road",
  659. "elementType": "geometry.fill",
  660. "stylers": [{
  661. "hue": "#ff0000"
  662. }, {
  663. "saturation": -100
  664. }, {
  665. "lightness": 99
  666. }]
  667. }, {
  668. "featureType": "road",
  669. "elementType": "geometry.stroke",
  670. "stylers": [{
  671. "color": "#808080"
  672. }, {
  673. "lightness": 54
  674. }]
  675. }, {
  676. "featureType": "landscape.man_made",
  677. "elementType": "geometry.fill",
  678. "stylers": [{
  679. "color": "#ece2d9"
  680. }]
  681. }, {
  682. "featureType": "poi.park",
  683. "elementType": "geometry.fill",
  684. "stylers": [{
  685. "color": "#ccdca1"
  686. }]
  687. }, {
  688. "featureType": "road",
  689. "elementType": "labels.text.fill",
  690. "stylers": [{
  691. "color": "#767676"
  692. }]
  693. }, {
  694. "featureType": "road",
  695. "elementType": "labels.text.stroke",
  696. "stylers": [{
  697. "color": "#ffffff"
  698. }]
  699. }, {
  700. "featureType": "poi",
  701. "stylers": [{
  702. "visibility": "off"
  703. }]
  704. }, {
  705. "featureType": "landscape.natural",
  706. "elementType": "geometry.fill",
  707. "stylers": [{
  708. "visibility": "on"
  709. }, {
  710. "color": "#b8cb93"
  711. }]
  712. }, {
  713. "featureType": "poi.park",
  714. "stylers": [{
  715. "visibility": "on"
  716. }]
  717. }, {
  718. "featureType": "poi.sports_complex",
  719. "stylers": [{
  720. "visibility": "on"
  721. }]
  722. }, {
  723. "featureType": "poi.medical",
  724. "stylers": [{
  725. "visibility": "on"
  726. }]
  727. }, {
  728. "featureType": "poi.business",
  729. "stylers": [{
  730. "visibility": "simplified"
  731. }]
  732. }]
  733. }
  734. var map = new google.maps.Map(document.getElementById("map"), mapOptions);
  735. var marker = new google.maps.Marker({
  736. position: myLatlng,
  737. title: "Hello World!"
  738. });
  739. // To add the marker to the map, call setMap();
  740. marker.setMap(map);
  741. },
  742. initSmallGoogleMaps: function() {
  743. // Regular Map
  744. var myLatlng = new google.maps.LatLng(40.748817, -73.985428);
  745. var mapOptions = {
  746. zoom: 8,
  747. center: myLatlng,
  748. scrollwheel: false, //we disable de scroll over the map, it is a really annoing when you scroll through page
  749. }
  750. var map = new google.maps.Map(document.getElementById("regularMap"), mapOptions);
  751. var marker = new google.maps.Marker({
  752. position: myLatlng,
  753. title: "Regular Map!"
  754. });
  755. marker.setMap(map);
  756. // Custom Skin & Settings Map
  757. var myLatlng = new google.maps.LatLng(40.748817, -73.985428);
  758. var mapOptions = {
  759. zoom: 13,
  760. center: myLatlng,
  761. scrollwheel: false, //we disable de scroll over the map, it is a really annoing when you scroll through page
  762. disableDefaultUI: true, // a way to quickly hide all controls
  763. zoomControl: true,
  764. styles: [{
  765. "featureType": "water",
  766. "stylers": [{
  767. "saturation": 43
  768. }, {
  769. "lightness": -11
  770. }, {
  771. "hue": "#0088ff"
  772. }]
  773. }, {
  774. "featureType": "road",
  775. "elementType": "geometry.fill",
  776. "stylers": [{
  777. "hue": "#ff0000"
  778. }, {
  779. "saturation": -100
  780. }, {
  781. "lightness": 99
  782. }]
  783. }, {
  784. "featureType": "road",
  785. "elementType": "geometry.stroke",
  786. "stylers": [{
  787. "color": "#808080"
  788. }, {
  789. "lightness": 54
  790. }]
  791. }, {
  792. "featureType": "landscape.man_made",
  793. "elementType": "geometry.fill",
  794. "stylers": [{
  795. "color": "#ece2d9"
  796. }]
  797. }, {
  798. "featureType": "poi.park",
  799. "elementType": "geometry.fill",
  800. "stylers": [{
  801. "color": "#ccdca1"
  802. }]
  803. }, {
  804. "featureType": "road",
  805. "elementType": "labels.text.fill",
  806. "stylers": [{
  807. "color": "#767676"
  808. }]
  809. }, {
  810. "featureType": "road",
  811. "elementType": "labels.text.stroke",
  812. "stylers": [{
  813. "color": "#ffffff"
  814. }]
  815. }, {
  816. "featureType": "poi",
  817. "stylers": [{
  818. "visibility": "off"
  819. }]
  820. }, {
  821. "featureType": "landscape.natural",
  822. "elementType": "geometry.fill",
  823. "stylers": [{
  824. "visibility": "on"
  825. }, {
  826. "color": "#b8cb93"
  827. }]
  828. }, {
  829. "featureType": "poi.park",
  830. "stylers": [{
  831. "visibility": "on"
  832. }]
  833. }, {
  834. "featureType": "poi.sports_complex",
  835. "stylers": [{
  836. "visibility": "on"
  837. }]
  838. }, {
  839. "featureType": "poi.medical",
  840. "stylers": [{
  841. "visibility": "on"
  842. }]
  843. }, {
  844. "featureType": "poi.business",
  845. "stylers": [{
  846. "visibility": "simplified"
  847. }]
  848. }]
  849. }
  850. var map = new google.maps.Map(document.getElementById("customSkinMap"), mapOptions);
  851. var marker = new google.maps.Marker({
  852. position: myLatlng,
  853. title: "Custom Skin & Settings Map!"
  854. });
  855. marker.setMap(map);
  856. // Satellite Map
  857. var myLatlng = new google.maps.LatLng(40.748817, -73.985428);
  858. var mapOptions = {
  859. zoom: 3,
  860. scrollwheel: false, //we disable de scroll over the map, it is a really annoing when you scroll through page
  861. center: myLatlng,
  862. mapTypeId: google.maps.MapTypeId.SATELLITE
  863. }
  864. var map = new google.maps.Map(document.getElementById("satelliteMap"), mapOptions);
  865. var marker = new google.maps.Marker({
  866. position: myLatlng,
  867. title: "Satellite Map!"
  868. });
  869. marker.setMap(map);
  870. },
  871. initFullCalendar: function() {
  872. $calendar = $('#fullCalendar');
  873. today = new Date();
  874. y = today.getFullYear();
  875. m = today.getMonth();
  876. d = today.getDate();
  877. $calendar.fullCalendar({
  878. viewRender: function(view, element) {
  879. // We make sure that we activate the perfect scrollbar when the view isn't on Month
  880. if (view.name != 'month') {
  881. $(element).find('.fc-scroller').perfectScrollbar();
  882. }
  883. },
  884. header: {
  885. left: 'title',
  886. center: 'month,agendaWeek,agendaDay',
  887. right: 'prev,next,today'
  888. },
  889. defaultDate: today,
  890. selectable: true,
  891. selectHelper: true,
  892. views: {
  893. month: { // name of view
  894. titleFormat: 'MMMM YYYY'
  895. // other view-specific options here
  896. },
  897. week: {
  898. titleFormat: " MMMM D YYYY"
  899. },
  900. day: {
  901. titleFormat: 'D MMM, YYYY'
  902. }
  903. },
  904. select: function(start, end) {
  905. // on select we show the Sweet Alert modal with an input
  906. swal({
  907. title: 'Create an Event',
  908. html: '<div class="form-group">' +
  909. '<input class="form-control" placeholder="Event Title" id="input-field">' +
  910. '</div>',
  911. showCancelButton: true,
  912. confirmButtonClass: 'btn btn-success',
  913. cancelButtonClass: 'btn btn-danger',
  914. buttonsStyling: false
  915. }).then(function(result) {
  916. var eventData;
  917. event_title = $('#input-field').val();
  918. if (event_title) {
  919. eventData = {
  920. title: event_title,
  921. start: start,
  922. end: end
  923. };
  924. $calendar.fullCalendar('renderEvent', eventData, true); // stick? = true
  925. }
  926. $calendar.fullCalendar('unselect');
  927. });
  928. },
  929. editable: true,
  930. eventLimit: true, // allow "more" link when too many events
  931. // color classes: [ event-blue | event-azure | event-green | event-orange | event-red ]
  932. events: [{
  933. title: 'All Day Event',
  934. start: new Date(y, m, 1),
  935. className: 'event-default'
  936. },
  937. {
  938. id: 999,
  939. title: 'Repeating Event',
  940. start: new Date(y, m, d - 4, 6, 0),
  941. allDay: false,
  942. className: 'event-rose'
  943. },
  944. {
  945. id: 999,
  946. title: 'Repeating Event',
  947. start: new Date(y, m, d + 3, 6, 0),
  948. allDay: false,
  949. className: 'event-rose'
  950. },
  951. {
  952. title: 'Meeting',
  953. start: new Date(y, m, d - 1, 10, 30),
  954. allDay: false,
  955. className: 'event-green'
  956. },
  957. {
  958. title: 'Lunch',
  959. start: new Date(y, m, d + 7, 12, 0),
  960. end: new Date(y, m, d + 7, 14, 0),
  961. allDay: false,
  962. className: 'event-red'
  963. },
  964. {
  965. title: 'Md-pro Launch',
  966. start: new Date(y, m, d - 2, 12, 0),
  967. allDay: true,
  968. className: 'event-azure'
  969. },
  970. {
  971. title: 'Birthday Party',
  972. start: new Date(y, m, d + 1, 19, 0),
  973. end: new Date(y, m, d + 1, 22, 30),
  974. allDay: false,
  975. className: 'event-azure'
  976. },
  977. {
  978. title: 'Click for Creative Tim',
  979. start: new Date(y, m, 21),
  980. end: new Date(y, m, 22),
  981. url: 'http://www.creative-tim.com/',
  982. className: 'event-orange'
  983. },
  984. {
  985. title: 'Click for Google',
  986. start: new Date(y, m, 21),
  987. end: new Date(y, m, 22),
  988. url: 'http://www.creative-tim.com/',
  989. className: 'event-orange'
  990. }
  991. ]
  992. });
  993. },
  994. showNotification: function(from, align) {
  995. type = ['', 'info', 'success', 'warning', 'danger', 'rose', 'primary'];
  996. color = Math.floor((Math.random() * 6) + 1);
  997. $.notify({
  998. icon: "notifications",
  999. message: "Welcome to <b>Material Dashboard</b> - a beautiful freebie for every web developer."
  1000. }, {
  1001. type: type[color],
  1002. timer: 3000,
  1003. placement: {
  1004. from: from,
  1005. align: align
  1006. }
  1007. });
  1008. }
  1009. }