Відмінності між версіями «Шаблони заяв та клопотань»

Перейти до навігації Перейти до пошуку
м
м
Рядок 4: Рядок 4:
</head>
</head>
<body>
<body>
<script>
document.addEventListener('DOMContentLoaded', () => {


    const getSort = ({ target }) => {
        const order = (target.dataset.order = -(target.dataset.order || -1));
        const index = [...target.parentNode.cells].indexOf(target);
        const collator = new Intl.Collator(['en', 'ru'], { numeric: true });
        const comparator = (index, order) => (a, b) => order * collator.compare(
            a.children[index].innerHTML,
            b.children[index].innerHTML
        );
       
        for(const tBody of target.closest('table').tBodies)
            tBody.append(...[...tBody.rows].sort(comparator(index, order)));
        for(const cell of target.parentNode.cells)
            cell.classList.toggle('sorted', cell === target);
    };
   
    document.querySelectorAll('.table_sort thead').forEach(tableTH => tableTH.addEventListener('click', () => getSort(event)));
   
});
</script>
<script>
<script>
function tableSearch() {
function tableSearch() {
Рядок 48: Рядок 26:
}
}
</script>
</script>
<input class="form-control" type="text" placeholder="Фамилия или телефон" id="search-text" onkeyup="tableSearch()">
<input class="form-control" type="text" placeholder="Почніть вводити назву шаблону ..." id="search-text" onkeyup="tableSearch()">
<input type="text" id="name-search" onkeyup="nameSearch()" placeholder="Назва шаблону.." class="table-search-filters">
<table class="table table-striped" id="info-table" width=95% border="1" align="center" style="border-collapse:collapse" cellpadding="3">
  <input type="text" id="age-search" onkeyup="ageSearch()" placeholder="Інстанція.." class="table-search-filters">
  <input type="text" id="city-search" onkeyup="citySearch()" placeholder="Категорія.." class="table-search-filters">
<table class="table_sort" id="custom-table" class="table table-striped" id="info-table" width=95% border="1" align="center" style="border-collapse:collapse" cellpadding="3">
<thead>
<thead>
<tr><th>Id шаблону</th><th id="name-search">Назва шаблону</th><th id="age">Інстанція</th><th id="city">Категорія</th><th>Судочинство</th><th>Підкатегорія</th></thead></tr> <!--ряд с ячейками заголовков-->
<tr><th>Id шаблону</th><th id="name-search">Назва шаблону</th><th id="age">Інстанція</th><th id="city">Категорія</th><th>Судочинство</th><th>Підкатегорія</th></thead></tr> <!--ряд с ячейками заголовков-->