rafandoo / HelpDeskRplus

Detected the use of alert, confirm and prompt JS-0052
Anti-pattern
Minor
a year ago2 years old
 9    if (table.find('td:contains('+user_name+')').length !== 0) {
10        alert('Usuario já adicionado');
11    } else if (sector_id === 0) {
12        alert('Antes de adicionar um usuario, salve o setor');13    } else { 
14        let tr = $('<tr class=align-middle></tr>');
15        tr.append('<td id="user_id" value="'+user_id+'">'+user_id+'</td>');''
47                _token: csrf
48            },
49            success: function(data) {
50                alert('Usuario removido com sucesso');51            }
52        });
53    }
34/* A jQuery function that is used to bind an event handler to the "click" JavaScript event, or trigger
35that event on an element. */
36$(document).on('click', '#removeBtn', function(){
37    _confirm = confirm('Tem certeza que deseja remover o usuário?');38    if (_confirm) {
39        $(this).closest('tr').remove();
40        let csrf = $('input[name="_token"]').val();
 7    let table = $('#users');
 8
 9    if (table.find('td:contains('+user_name+')').length !== 0) {
10        alert('Usuario já adicionado');11    } else if (sector_id === 0) {
12        alert('Antes de adicionar um usuario, salve o setor');
13    } else {