|
5 | 5 | Layout = "~/Views/Shared/_Layout.cshtml";
|
6 | 6 | }
|
7 | 7 |
|
8 |
| -<h2>Ishchilar</h2> |
9 |
| - |
10 | 8 | <form asp-controller="Accounts" asp-action="Index">
|
11 |
| - <div class="row"> |
| 9 | + <div class="row mt-4"> |
12 | 10 | <div class="d-flex justify-content-between">
|
13 | 11 | <!-- Filter -->
|
14 |
| - <div class="col-md-2 mb-4" > |
| 12 | + <div class="col-md-2 mb-4 filter-bar" > |
15 | 13 | <div class="input-group">
|
16 |
| - <select class="form-control form-select" name="roleId"> |
| 14 | + <select class="form-control form-select" name="roleId" id="roles" onchange="searchAndFilter()"> |
17 | 15 | @foreach (var role in ViewBag.Roles)
|
18 | 16 | {
|
19 | 17 | <option value="@role.Id" selected="@(role.Id == ViewBag.RoleId)">
|
|
25 | 23 | </div>
|
26 | 24 | <!-- Search -->
|
27 | 25 | <div class="col-md-4 ms-lg-3 mb-4">
|
28 |
| - <div class="input-group"> |
29 |
| - <input type="text" class="form-control rounded-left" placeholder="Ishchini izlash..." name="searchString" value="@ViewBag.SearchString"> |
30 |
| - <div class="input-group-append"> |
31 |
| - <button type="submit" class="btn btn-primary"> |
32 |
| - <i class="fa fa-search"></i> Qidirish |
33 |
| - </button> |
34 |
| - </div> |
35 |
| - </div> |
| 26 | + <ejs-textbox id="search-box" |
| 27 | + name="search" |
| 28 | + class="search-box" |
| 29 | + placeholder="Ishchini izlash..." |
| 30 | + floatLabelType="Never" |
| 31 | + value="@ViewBag.SearchString" |
| 32 | + input="searchAndFilter"> |
| 33 | + </ejs-textbox> |
36 | 34 | </div>
|
37 | 35 | <!-- Create -->
|
38 |
| - <div class="d-flex col-md mb-4 justify-content-end"> |
| 36 | + <div class="d-flex col-md mb-4 justify-content-end create-btn"> |
39 | 37 | <button id="openModalButton" class="btn btn-success" asp-action="create" type="button">
|
40 | 38 | <i class="fa fa-plus"></i> Yaratish
|
41 | 39 | </button>
|
|
48 | 46 | <div class="col-12">
|
49 | 47 | <ejs-grid id="accounts-list"
|
50 | 48 | dataSource="@ViewBag.Accounts"
|
51 |
| - gridLines="Vertical" |
52 |
| - allowSorting="true"> |
| 49 | + gridLines="Both" |
| 50 | + allowSorting="true" |
| 51 | + allowPaging="true" |
| 52 | + allowFiltering="true"> |
| 53 | + <e-grid-pagesettings pageSize="10"></e-grid-pagesettings> |
53 | 54 | <e-grid-columns>
|
54 |
| - <e-grid-column headerText="Ism" field="FirstName" typeof="text"></e-grid-column> |
55 |
| - <e-grid-column headerText="Familiya" field="LastName" typeof="text"></e-grid-column> |
56 |
| - <e-grid-column headerText="Telefon raqam" field="PhoneNumber" typeof="text"></e-grid-column> |
57 |
| - <e-grid-column headerText="Tug'ilgan yil" field="Bithdate" type="date" format="dd-MM-yyyy"></e-grid-column> |
58 |
| - <e-grid-column headerText="Kasb" field="RoleName" typeof="text"></e-grid-column> |
| 55 | + <e-grid-column headerText="Ism" field="FirstName" textAlign="Center" headerTextAlign="Center" typeof="text"></e-grid-column> |
| 56 | + <e-grid-column headerText="Familiya" field="LastName" textAlign="Center" headerTextAlign="Center" typeof="text"></e-grid-column> |
| 57 | + <e-grid-column headerText="Telefon raqam" field="PhoneNumber" textAlign="Center" headerTextAlign="Center" typeof="text"></e-grid-column> |
| 58 | + <e-grid-column headerText="Tug'ilgan yil" field="Bithdate" textAlign="Center" headerTextAlign="Center" type="date" format="dd-MM-yyyy"></e-grid-column> |
| 59 | + <e-grid-column headerText="Kasb" field="RoleName" textAlign="Center" headerTextAlign="Center" typeof="text"></e-grid-column> |
59 | 60 | <e-grid-column width="180" type="text" textAlign="Center" template="#actionTemplate"></e-grid-column>
|
60 | 61 | </e-grid-columns>
|
61 | 62 | </ejs-grid>
|
62 | 63 | </div>
|
63 | 64 | </div>
|
64 | 65 |
|
65 |
| -<div class="d-flex justify-content-between align-items-center my-3"> |
66 |
| - <nav aria-label="Page navigation"> |
67 |
| - <ul class="pagination"> |
68 |
| - @if (ViewBag.HasPreviousPage) |
69 |
| - { |
70 |
| - <li class="page-item"> |
71 |
| - <a class="page-link" href="@Url.Action("Index", new { pageNumber = 1 })" aria-label="First"> |
72 |
| - <span aria-hidden="true">«</span> |
73 |
| - </a> |
74 |
| - </li> |
75 |
| - <li class="page-item"> |
76 |
| - <a class="page-link" href="@Url.Action("Index", new { pageNumber = ViewBag.CurrentPage - 1 })">@(@ViewBag.CurrentPage - 1)</a> |
77 |
| - </li> |
78 |
| - } |
79 |
| - @if (ViewBag.HasNextPage) |
80 |
| - { |
81 |
| - <li class="page-item active"> |
82 |
| - <span class="page-link">@ViewBag.CurrentPage</span> |
83 |
| - </li> |
84 |
| - <li class="page-item"> |
85 |
| - <a class="page-link" href="@Url.Action("Index", new { pageNumber = ViewBag.CurrentPage + 1 })">@(@ViewBag.CurrentPage + 1)</a> |
86 |
| - </li> |
87 |
| - <li class="page-item"> |
88 |
| - <a class="page-link" href="@Url.Action("Index", new { pageNumber = ViewBag.PageCount })" aria-label="Last"> |
89 |
| - <span aria-hidden="true">»</span> |
90 |
| - </a> |
91 |
| - </li> |
92 |
| - } |
93 |
| - </ul> |
94 |
| - </nav> |
95 |
| - <div class="p-2"> |
96 |
| - <p class="h6 mb-0">@ViewBag.PageCount sahifadan @ViewBag.CurrentPage tasi ( umumiy ishchilar soni: @ViewBag.TotalCount)</p> |
97 |
| - </div> |
98 |
| -</div> |
| 66 | +<script type="text/x-template" id="actionTemplate"> |
| 67 | + <button type="button" class="shadow-sm bg-white rounded e-btn e-flat mx-2" title="Tafsilot" onclick="onDetailsClick(${Id})"> |
| 68 | + <i class="bi bi-card-list text-info" style="font-size: 19px;"></i> |
| 69 | + </button> |
| 70 | + <button type="button" class="shadow-sm bg-white rounded e-btn e-flat" title="Tahrirlash" onclick="onEditClick(${Id})"> |
| 71 | + <i class="fa-solid fa-pen fa-lg text-warning" ></i> |
| 72 | + </button> |
| 73 | + <button type="button" class="shadow-sm bg-white rounded e-btn e-flat mx-2" title="O'chirish" onclick="onDeleteClick(${Id})"> |
| 74 | + <i class="fa-solid fa-trash-can fa-lg text-danger" ></i> |
| 75 | + </button> |
| 76 | +</script> |
99 | 77 |
|
100 | 78 | <div class="modal fade" id="createModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
101 | 79 | <div class="modal-dialog modal-lg">
|
|
112 | 90 | </div>
|
113 | 91 | </div>
|
114 | 92 |
|
115 |
| -<script type="text/x-template" id="actionTemplate"> |
116 |
| - <button type="button" class="shadow-sm bg-white rounded e-btn e-flat mx-2" title="Tafsilot" onclick="onDetailsClick(${Id})"> |
117 |
| - <i class="bi bi-card-list text-info" style="font-size: 19px;"></i> |
118 |
| - </button> |
119 |
| - <button type="button" class="shadow-sm bg-white rounded e-btn e-flat" title="Tahrirlash" onclick="onEditClick(${Id})"> |
120 |
| - <i class="fa-solid fa-pen fa-lg text-warning" ></i> |
121 |
| - </button> |
122 |
| - <button type="button" class="shadow-sm bg-white rounded e-btn e-flat mx-2" title="O'chirish" onclick="onDeleteClick(${Id})"> |
123 |
| - <i class="fa-solid fa-trash-can fa-lg text-danger"></i> |
124 |
| - </button> |
125 |
| -</script> |
126 |
| - |
127 | 93 | <script>
|
128 | 94 | $(document).ready(function () {
|
129 | 95 | $('#openModalButton').on('click', function () {
|
|
272 | 238 | $(this).off('hidden.bs.modal');
|
273 | 239 | }
|
274 | 240 | </script>
|
| 241 | + |
| 242 | +<script> |
| 243 | + function searchAndFilter() { |
| 244 | + const searchInput = document.getElementById("search-box").value.trim(); |
| 245 | + const selectedElement = document.getElementById("roles"); |
| 246 | + const filterInput = selectedElement[selectedElement.selectedIndex]?.text || ""; |
| 247 | + const gridElement = document.getElementById("accounts-list"); |
| 248 | + const gridInstance = gridElement?.ej2_instances?.[0]; |
| 249 | +
|
| 250 | + if (!gridInstance) { |
| 251 | + console.error("Grid instance not found."); |
| 252 | + return; |
| 253 | + } |
| 254 | +
|
| 255 | + if (filterInput === 'Barcha ishchilar' || filterInput === "") { |
| 256 | + gridInstance.clearFiltering(); |
| 257 | + } else { |
| 258 | + gridInstance.filterByColumn("RoleName", "equal", filterInput); |
| 259 | + } |
| 260 | +
|
| 261 | + if (searchInput) { |
| 262 | + gridInstance.search(searchInput); |
| 263 | + } else { |
| 264 | + gridInstance.searchSettings.key = ""; |
| 265 | + } |
| 266 | +
|
| 267 | + gridInstance.refresh(); |
| 268 | + } |
| 269 | +</script> |
| 270 | +
|
| 271 | +<style> |
| 272 | + .input-group select { |
| 273 | + height: 37px !important; |
| 274 | + padding-left: 10px; |
| 275 | + padding-top: 4px; |
| 276 | + } |
| 277 | +
|
| 278 | + .e-input-group input { |
| 279 | + height: 35px !important; |
| 280 | + } |
| 281 | +
|
| 282 | + button { |
| 283 | + height: 37px; |
| 284 | + } |
| 285 | +
|
| 286 | + .e-filterbar { |
| 287 | + display: none; |
| 288 | + } |
| 289 | +
|
| 290 | + .e-pager .e-pagerexternalmsg { |
| 291 | + display: none; |
| 292 | + } |
| 293 | +</style> |
0 commit comments