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() {
                $('#btn-download-excel-all-courses').click(function(e) {
                        e.preventDefault();
                        
                        $('#btn-download-excel-all-courses').prop('disabled', true);
                        $('.ccn_preloader_load').show();
                
                ajax.call([{
                        methodname: 'local_cesa_reportes_excel_all_courses',
                                args: {
                          'fakeparam': 0,
                        },


                }])[0].done(function(response) {
                                $('.ccn_preloader_load').hide();
                                $('#btn-download-excel-all-courses').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-excel-all-courses').prop('disabled', false);
                                
                        console.log(err);
                        return;
                });
                });



        });
});