Skip to content

Commit 8bf8f79

Browse files
Merge pull request #36 from DiyorMarket/Update-SideBar-And-Create-Accounts-Index
Update side bar and create accounts index
2 parents 40db7b2 + 3a7fd25 commit 8bf8f79

File tree

7 files changed

+59
-20
lines changed

7 files changed

+59
-20
lines changed

CheckDrive.Web/CheckDrive.Web/Controllers/AccountsController.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ public AccountsController(IAccountDataStore accountDataStore)
1515

1616
public async Task<IActionResult> Index()
1717
{
18-
var accounts = await _accountDataStore.GetAccounts(2);
19-
return View(accounts);
18+
var accounts = await _accountDataStore.GetAccounts();
19+
ViewBag.Accounts = accounts.Data;
20+
return View();
2021
}
2122

2223
public async Task<IActionResult> Details(int id)

CheckDrive.Web/CheckDrive.Web/Controllers/DriversController.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public DriversController(IDriverDataStore driverDataStore, IAccountDataStore acc
2121

2222
public async Task<IActionResult> Index()
2323
{
24-
var accounts = await _accountDataStore.GetAccounts(2);
24+
var accounts = await _accountDataStore.GetAccounts();
2525
var roles = await _roleDataStore.GetRoles();
2626
var drivers = new List<Account>();
2727

CheckDrive.Web/CheckDrive.Web/Service/ApiClient.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace CheckDrive.Web.Service
55
{
66
public class ApiClient
77
{
8-
private const string baseUrl = "https://rtd6g5vp-7111.asse.devtunnels.ms/api";
8+
private const string baseUrl = "https://j066xkvj-7111.euw.devtunnels.ms/api";
99

1010
private readonly HttpClient _client = new();
1111
private readonly IHttpContextAccessor _contextAccessor;

CheckDrive.Web/CheckDrive.Web/Stores/Accounts/AccountDataStore.cs

+2-8
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,10 @@ public AccountDataStore(ApiClient apiClient)
1515
_api = apiClient;
1616
}
1717

18-
public async Task<GetAccountResponse> GetAccounts(int roleId)
18+
public async Task<GetAccountResponse> GetAccounts()
1919
{
20-
StringBuilder query = new("");
2120

22-
if (roleId != null)
23-
{
24-
query.Append($"roleId={roleId}&");
25-
}
26-
27-
var response = _api.Get("accounts?" + query.ToString());
21+
var response = _api.Get("accounts");
2822

2923
if (!response.IsSuccessStatusCode)
3024
{

CheckDrive.Web/CheckDrive.Web/Stores/Accounts/IAccountDataStore.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace CheckDrive.Web.Stores.Accounts
55
{
66
public interface IAccountDataStore
77
{
8-
Task<GetAccountResponse> GetAccounts(int roleId);
8+
Task<GetAccountResponse> GetAccounts();
99
Task<Account> GetAccount(int id);
1010
Task<Account> CreateAccount(Account account);
1111
Task<Account> UpdateAccount(int id, Account account);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@model CheckDrive.Web.Models.Account
2+
3+
@{
4+
ViewData["Title"] = "Index";
5+
Layout = "~/Views/Shared/_Layout.cshtml";
6+
}
7+
<h2>Ishchilar</h2>
8+
9+
<div class="row">
10+
<div class="col-12">
11+
<ejs-grid id="accounts-list"
12+
dataSource="@ViewBag.Accounts"
13+
gridLines="Vertical"
14+
allowSorting="true">
15+
<e-grid-columns>
16+
<e-grid-column headerText="Id" field="Id" field="Id" typeof="Text"></e-grid-column>
17+
<e-grid-column headerText="Email" field="Login" typeof="Text"></e-grid-column>
18+
<e-grid-column headerText="Parol" field="Password" typeof="text"></e-grid-column>
19+
<e-grid-column headerText="Telefon raqam" field="PhoneNumber" typeof="text"></e-grid-column>
20+
<e-grid-column headerText="Ism" field="FirstName" typeof="text"></e-grid-column>
21+
<e-grid-column headerText="Familiya" field="LastName" typeof="text"></e-grid-column>
22+
<e-grid-column headerText="Tugilgan yil" field="Bithdate" typeof="text"></e-grid-column>
23+
<e-grid-column headerText="RoleId" field="RoleId" typeof="text"></e-grid-column>
24+
</e-grid-columns>
25+
</ejs-grid>
26+
</div>
27+
</div>

CheckDrive.Web/CheckDrive.Web/Views/Shared/_SideBar.cshtml

+24-7
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,55 @@
1313

1414
menuItems.Add(new
1515
{
16-
text = "Ishchilar",
16+
text = "Ishchilar va avtomobillar",
1717
separator = true,
1818
});
1919

2020
menuItems.Add(new
2121
{
22-
text = "Haydovchilar",
22+
text = "Ishchilar",
23+
url = "/accounts",
24+
iconCss = "fa-solid fa-user-group"
25+
});
26+
menuItems.Add(new
27+
{
28+
text = "Avtomobillar",
2329
iconCss = "fas fa-car",
2430
url = "/drivers"
2531
});
2632

2733
menuItems.Add(new
2834
{
29-
text = "Operatorlar",
35+
text = "Xizmat ko'rsatish",
36+
separator = true,
37+
});
38+
menuItems.Add(new
39+
{
40+
text = "Doctor Ko'riklari",
41+
iconCss = "fas fa-user-doctor",
42+
url = "/drivers"
43+
});
44+
menuItems.Add(new
45+
{
46+
text = "Mechanik (topshirishlari)",
3047
iconCss = "fa-solid fa-phone-volume",
31-
url = "/operators"
48+
url = "/operator"
3249
});
3350
menuItems.Add(new
3451
{
35-
text = "Shifokorlar",
52+
text = "Operator xizmatilari",
3653
iconCss = "fa-solid fa-user-doctor",
3754
url = "/doctors"
3855
});
3956
menuItems.Add(new
4057
{
41-
text = "Mexaniklar",
58+
text = "Despicherlar Xizmati",
4259
iconCss = "fa-solid fa-user-gear",
4360
url = "/mechanics"
4461
});
4562
menuItems.Add(new
4663
{
47-
text = "Dispetcherlar",
64+
text = "Mechanik (qabul qilishlari)",
4865
iconCss = "fa-solid fa-person-chalkboard",
4966
url = "/dispatchers"
5067
});

0 commit comments

Comments
 (0)