Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

require(['core/first', 'jquery', 'jqueryui', 'core/ajax', 'pnotify'], function(core, $, bootstrap, ajax, pnotify) {
        $(document).ready(function() {

                $('li.nav-item a.nav-link').click(function(e) {
                        e.preventDefault();
                                                
                        $('li.nav-item a.nav-link').removeClass("active");
                        $(this).addClass('active');
                        
                        $('div.tab-pane').removeClass('active');
                        $('#' + $(this).data('tab')).addClass('active');
                        
                });
                
                $('#btn-download-last-seven-days').click(function(e) {
                        e.preventDefault();
                        
                        $('#btn-download-last-seven-days').prop('disabled', true);
                        $('.ccn_preloader_load').show();
                        
                        ajax.call([{
                        methodname: 'local_cesa_reportes_excel_last_seven_days',
                                args: {
                                        'fakeparam': 0,
                                },
        
        
                }])[0].done(function(response) {
                                $('.ccn_preloader_load').hide();
                                $('#btn-download-last-seven-days').prop('disabled', false);
                                
                                var json = JSON.parse(response);
        
                                if(json.success) {
                                        new pnotify({
                                    title: false,
                                    text: json.data,
                                    type: 'success',
                                    hide: true,
                                                delay: 2000,
                                                addclass: "stack-modal", 
                                });
                                } else {
                                        new pnotify({
                                    title: false,
                                    text: json.data,
                                    type: 'error',
                                    hide: true,
                                                delay: 2000,
                                                addclass: "stack-modal", 
                                });
                                }
        
                
        

        
        
                        return;
                }).fail(function(err) {
                                $('.ccn_preloader_load').hide();
                                $('#btn-download-last-seven-days').prop('disabled', false);
                        console.log(err);
                        return;
                });
                
                });
        });
});