Skip to content

Commit ca6b4ac

Browse files
authored
Merge pull request #231 from DiyorMarket/Update-employee-page
Update employee page
2 parents cc69ea0 + 9ba141f commit ca6b4ac

File tree

2 files changed

+86
-70
lines changed

2 files changed

+86
-70
lines changed

CheckDrive.Web/CheckDrive.Web/Views/Accounts/Index.cshtml

+86-67
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55
Layout = "~/Views/Shared/_Layout.cshtml";
66
}
77

8-
<h2>Ishchilar</h2>
9-
108
<form asp-controller="Accounts" asp-action="Index">
11-
<div class="row">
9+
<div class="row mt-4">
1210
<div class="d-flex justify-content-between">
1311
<!-- Filter -->
14-
<div class="col-md-2 mb-4" >
12+
<div class="col-md-2 mb-4 filter-bar" >
1513
<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()">
1715
@foreach (var role in ViewBag.Roles)
1816
{
1917
<option value="@role.Id" selected="@(role.Id == ViewBag.RoleId)">
@@ -25,17 +23,17 @@
2523
</div>
2624
<!-- Search -->
2725
<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>
3634
</div>
3735
<!-- 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">
3937
<button id="openModalButton" class="btn btn-success" asp-action="create" type="button">
4038
<i class="fa fa-plus"></i> Yaratish
4139
</button>
@@ -48,54 +46,34 @@
4846
<div class="col-12">
4947
<ejs-grid id="accounts-list"
5048
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>
5354
<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>
5960
<e-grid-column width="180" type="text" textAlign="Center" template="#actionTemplate"></e-grid-column>
6061
</e-grid-columns>
6162
</ejs-grid>
6263
</div>
6364
</div>
6465

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">&laquo;</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">&raquo;</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&#39;chirish" onclick="onDeleteClick(${Id})">
74+
<i class="fa-solid fa-trash-can fa-lg text-danger" ></i>
75+
</button>
76+
</script>
9977

10078
<div class="modal fade" id="createModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
10179
<div class="modal-dialog modal-lg">
@@ -112,18 +90,6 @@
11290
</div>
11391
</div>
11492

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&#39;chirish" onclick="onDeleteClick(${Id})">
123-
<i class="fa-solid fa-trash-can fa-lg text-danger"></i>
124-
</button>
125-
</script>
126-
12793
<script>
12894
$(document).ready(function () {
12995
$('#openModalButton').on('click', function () {
@@ -272,3 +238,56 @@
272238
$(this).off('hidden.bs.modal');
273239
}
274240
</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>

CheckDrive.Web/CheckDrive.Web/Views/Dashboard/Index.cshtml

-3
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@
107107
<div class="row">
108108
<div class="col">
109109
<div class="widget">
110-
<div class="p-4">
111-
<h5 class="fw-bold">Qarzlar</h5>
112-
</div>
113110
<div class="px-4 pb-4">
114111
<ejs-grid id="resent-debts" allowPaging="true"
115112
dataSource="@ViewBag.Debts" gridLines="None" rowHeight="38">

0 commit comments

Comments
 (0)