Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
require(['core/first', 'jquery', 'jqueryui', 'core/ajax', 'pnotify'], function(core, $, bootstrap, ajax, pnotify) {
2
	$(document).ready(function() {
3
 
4
		$('li.nav-item a.nav-link').click(function(e) {
5
			e.preventDefault();
6
 
7
			$('li.nav-item a.nav-link').removeClass("active");
8
			$(this).addClass('active');
9
 
10
			$('div.tab-pane').removeClass('active');
11
			$('#' + $(this).data('tab')).addClass('active');
12
 
13
		});
14
 
15
		$('#btn-download-last-seven-days').click(function(e) {
16
			e.preventDefault();
17
 
18
			$('#btn-download-last-seven-days').prop('disabled', true);
19
			$('.ccn_preloader_load').show();
20
 
21
			ajax.call([{
22
	      		methodname: 'local_cesa_reportes_excel_last_seven_days',
23
	 			args: {
24
					'fakeparam': 0,
25
				},
26
 
27
 
28
	      	}])[0].done(function(response) {
29
				$('.ccn_preloader_load').hide();
30
				$('#btn-download-last-seven-days').prop('disabled', false);
31
 
32
				var json = JSON.parse(response);
33
 
34
				if(json.success) {
35
					new pnotify({
36
			            title: false,
37
			            text: json.data,
38
			            type: 'success',
39
			            hide: true,
40
						delay: 2000,
41
						addclass: "stack-modal",
42
			        });
43
				} else {
44
					new pnotify({
45
			            title: false,
46
			            text: json.data,
47
			            type: 'error',
48
			            hide: true,
49
						delay: 2000,
50
						addclass: "stack-modal",
51
			        });
52
				}
53
 
54
 
55
 
56
 
57
 
58
 
59
	        	return;
60
	      	}).fail(function(err) {
61
				$('.ccn_preloader_load').hide();
62
				$('#btn-download-last-seven-days').prop('disabled', false);
63
	       		console.log(err);
64
	        	return;
65
	      	});
66
 
67
		});
68
	});
69
});