Commit f6b063c8 authored by David Surville's avatar David Surville
Browse files

[Tac] Mise en évidence des comptes déjà existants

parent 25254413
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -288,7 +288,33 @@ $canCreerLocal = $canAjouter;

                    return false;
                },
            })
            .autocomplete("instance")._renderItem = function (ul, item) {
                var template = '<span id=\"{id}\">{label} <span class=\"extra\">{extra}</span></span>';
                var markup = template
                    .replace('{id}', item.id ? item.id : '')
                    .replace('{label}', item.label ? item.label : '')
                    .replace('{extra}', item.extra ? item.extra : '');
                markup = '<a id="autocomplete-item-' + item.id + '">' + markup + "</a>";
                var li = $("<li></li>");
                if(item.id) {
                    const t = item.id.split("||");
                    if (t[0] == 'app') {
                        li.addClass('bg-success');
                    }
                }
                li = li.data("item.autocomplete", item).append(markup).appendTo(ul);
                // mise en évidence du motif dans chaque résultat de recherche
                highlight($('#utilisateur').val(), li, 'sas-highlight');
                // si l'item ne possède pas d'id, on fait en sorte qu'il ne soit pas sélectionnable
                if (!item.id) {
                    li.click(function () {
                        return false;
                    });
                }

                return li;
            };

        $('form').on('submit', function() {
            var btn = $(this).find('button[type="submit"]:first');