Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 17328 | Rev 17330 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 17328 Rev 17329
Línea 406... Línea 406...
406
            e.preventDefault();
406
            e.preventDefault();
Línea 407... Línea 407...
407
 
407
 
408
            $('#form-invite #user_uuid').autoComplete('clear');
408
            $('#form-invite #user_uuid').autoComplete('clear');
409
            $('#form-invite #user_uuid_selected').val('');
409
            $('#form-invite #user_uuid_selected').val('');
-
 
410
            $('#modalInvite').modal('show');
-
 
411
            
-
 
412
            // Re-inicializar autoComplete cuando el modal se muestre
-
 
413
            $('#modalInvite').on('shown.bs.modal', function() {
-
 
414
                console.log('Modal shown, checking autoComplete...'); // Debug
-
 
415
                if (typeof $.fn.autoComplete !== 'undefined' && !$('#form-invite #user_uuid').data('autoComplete')) {
-
 
416
                    console.log('Re-initializing autoComplete in modal...'); // Debug
-
 
417
                    $('#form-invite #user_uuid').autoComplete({
-
 
418
                        resolver: 'custom',
-
 
419
                        minLength: 3,
-
 
420
                        noResultsText: 'LABEL_AUTOCOMPLETE_USERS_NOT_FOUND',
-
 
421
                        events: {
-
 
422
                            search: function (qry, callback) {
-
 
423
                                console.log('Searching for:', qry); // Debug
-
 
424
                                NProgress.start();
-
 
425
                                $.ajax({
-
 
426
                                    'url' : '$routeInvite',
-
 
427
                                    'method': 'get',
-
 
428
                                    'data': { 'search': qry },
-
 
429
                                    'dataType': 'json'
-
 
430
                                }).done(function (response) {
-
 
431
                                    console.log('Response:', response); // Debug
-
 
432
                                    if(response.success) {
-
 
433
                                        callback(response.data);
-
 
434
                                    } else {
-
 
435
                                        console.error('Search error:', response.data); // Debug
-
 
436
                                        $.fn.showError(response.data);
-
 
437
                                        callback([]);
-
 
438
                                    }
-
 
439
                                }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
440
                                    console.error('AJAX error:', textStatus, errorThrown); // Debug
-
 
441
                                    $.fn.showError(textStatus);
-
 
442
                                    callback([]);
-
 
443
                                }).always(function() {
-
 
444
                                    NProgress.done();
-
 
445
                                });
-
 
446
                            }
-
 
447
                        }
-
 
448
                    });
-
 
449
                }
410
            $('#modalInvite').modal('show');
450
            });
Línea 411... Línea 451...
411
        });
451
        });
412
 
452
 
413
        $('body').on('click', 'button.btn-accept', function(e) {
453
        $('body').on('click', 'button.btn-accept', function(e) {
Línea 431... Línea 471...
431
            }).always(function() {
471
            }).always(function() {
432
                NProgress.done();
472
                NProgress.done();
433
            });
473
            });
434
        });
474
        });
Línea -... Línea 475...
-
 
475
 
-
 
476
        // Verificar que la librería autoComplete esté disponible
-
 
477
        setTimeout(function() {
-
 
478
            if (typeof $.fn.autoComplete !== 'undefined') {
435
 
479
                console.log('Initializing autoComplete...'); // Debug
436
        $('#form-invite #user_uuid').autoComplete({
480
                $('#form-invite #user_uuid').autoComplete({
-
 
481
                    resolver: 'custom',
-
 
482
                    minLength: 3,
437
            resolver: 'custom',
483
                    noResultsText: 'LABEL_AUTOCOMPLETE_USERS_NOT_FOUND',
438
            events: {
-
 
439
                
484
                    events: {
-
 
485
                        search: function (qry, callback) {
440
                search: function (qry, callback) {
486
                            console.log('Searching for:', qry); // Debug
441
                    NProgress.start();
487
                            NProgress.start();
442
                    $.ajax({
488
                            $.ajax({
443
                        'url' : '$routeInvite',
489
                                'url' : '$routeInvite',
444
                        'method': 'get',
490
                                'method': 'get',
-
 
491
                                'data': { 'search': qry },
445
				        'data': { 'search': qry }
492
                                'dataType': 'json'
-
 
493
                            }).done(function (response) {
446
				    }).done(function (response) {
494
                                console.log('Response:', response); // Debug
447
                        if(response['success']) {
495
                                if(response.success) {
448
                            callback(response['data'])
496
                                    callback(response.data);
-
 
497
                                } else {
449
                        } else {
498
                                    console.error('Search error:', response.data); // Debug
-
 
499
                                    $.fn.showError(response.data);
-
 
500
                                    callback([]);
-
 
501
                                }
-
 
502
                            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
503
                                console.error('AJAX error:', textStatus, errorThrown); // Debug
-
 
504
                                $.fn.showError(textStatus);
-
 
505
                                callback([]);
-
 
506
                            }).always(function() {
-
 
507
                                NProgress.done();
450
                            $.fn.showError(response['data']);
508
                            });
451
                        }
-
 
452
					}).fail(function( jqXHR, textStatus, errorThrown) {
509
                        }
453
                        $.fn.showError(textStatus);
510
                    }
454
                    }).always(function() {
511
                });
455
                        NProgress.done();
512
                console.log('autoComplete initialized successfully'); // Debug
456
                    });
513
            } else {
457
                }
514
                console.error('autoComplete library not loaded!');
458
            }
515
            }
Línea 459... Línea 516...
459
        });
516
        }, 100);
460
 
517
 
461
	    $('#form-invite #user_uuid').on('autocomplete.select', function (evt, item) {
518
	    $('#form-invite #user_uuid').on('autocomplete.select', function (evt, item) {