Skip to content

Commit d442792

Browse files
authored
Merge pull request #207 from DiyorMarket/integration
Integration
2 parents e579ca5 + a59c926 commit d442792

File tree

141 files changed

+43746
-2793
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+43746
-2793
lines changed

CheckDrive.Web/CheckDrive.Web/CheckDrive.Web.csproj

+25-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
<Compile Include="Controllers\AccountsController.cs" />
1717
<Compile Include="Controllers\AuthController.cs" />
1818
<Compile Include="Controllers\CarsController.cs" />
19+
<Compile Include="Controllers\CheckPointController.cs" />
1920
<Compile Include="Controllers\DashboardController.cs" />
21+
<Compile Include="Controllers\DebtsController.cs" />
2022
<Compile Include="Controllers\DispatcherReviewsController.cs" />
2123
<Compile Include="Controllers\DoctorReviewsController.cs" />
2224
<Compile Include="Controllers\DoctorsController.cs" />
@@ -31,12 +33,33 @@
3133
<Compile Include="Controllers\OperatorsController.cs" />
3234
<Compile Include="Controllers\TechniciansController.cs" />
3335
<None Include="wwwroot\css\LogOutButtun.css" />
36+
<None Include="wwwroot\font-awesome\js\all.js" />
37+
<None Include="wwwroot\font-awesome\js\all.min.js" />
38+
<None Include="wwwroot\font-awesome\js\brands.js" />
39+
<None Include="wwwroot\font-awesome\js\brands.min.js" />
40+
<None Include="wwwroot\font-awesome\js\conflict-detection.js" />
41+
<None Include="wwwroot\font-awesome\js\conflict-detection.min.js" />
42+
<None Include="wwwroot\font-awesome\js\fontawesome.js" />
43+
<None Include="wwwroot\font-awesome\js\fontawesome.min.js" />
44+
<None Include="wwwroot\font-awesome\js\regular.js" />
45+
<None Include="wwwroot\font-awesome\js\regular.min.js" />
46+
<None Include="wwwroot\font-awesome\js\solid.js" />
47+
<None Include="wwwroot\font-awesome\js\solid.min.js" />
48+
<None Include="wwwroot\font-awesome\js\v4-shims.js" />
49+
<None Include="wwwroot\font-awesome\js\v4-shims.min.js" />
50+
<None Include="wwwroot\font-awesome\sprites\brands.svg" />
51+
<None Include="wwwroot\font-awesome\sprites\regular.svg" />
52+
<None Include="wwwroot\font-awesome\sprites\solid.svg" />
53+
<None Include="wwwroot\font-awesome\webfonts\fa-brands-400.woff2" />
54+
<None Include="wwwroot\font-awesome\webfonts\fa-regular-400.woff2" />
55+
<None Include="wwwroot\font-awesome\webfonts\fa-solid-900.woff2" />
56+
<None Include="wwwroot\font-awesome\webfonts\fa-v4compatibility.woff2" />
3457
<PackageReference Include="CheckDrive.ApiContracts" Version="1.4.9" />
3558
<PackageReference Include="CheckDrive.DTOs" Version="1.0.0" />
3659
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.4" />
3760
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.3" />
38-
<PackageReference Include="Syncfusion.EJ2.AspNet.Core" Version="25.1.42" />
39-
<PackageReference Include="Syncfusion.Licensing" Version="25.2.3" />
61+
<PackageReference Include="Syncfusion.EJ2.AspNet.Core" Version="27.1.50" />
62+
<PackageReference Include="Syncfusion.Licensing" Version="27.1.50" />
4063
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.6.0" />
4164
<PackageReference Include="System.Security.Claims" Version="4.3.0" />
4265

CheckDrive.Web/CheckDrive.Web/Constants/Configurations.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
public static class Configurations
44
{
55
public const string JwtToken = "JwtToken";
6-
public const string SynfusionLicenseKey = "Mgo+DSMBMAY9C3t2UFhhQlJBfV5AQmBIYVp/TGpJfl96cVxMZVVBJAtUQF1hTX5UdERiXX1ZcHNXRGFa";
6+
public const string SynfusionLicenseKey = "Mgo+DSMBPh8sVXJzS0d+WFlPd11dXmJWd1p/THNYflR1fV9DaUwxOX1dQl9nSXdRc0VkW3pfdX1WQ2E=";
77
}
88
}

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

+8-6
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public async Task<IActionResult> Index(string? searchString, int? roleId, DateTi
2727
{
2828
var accounts = await _accountDataStore.GetAccountsAsync(searchString, roleId, birthDate, pageNumber);
2929

30-
var roles = await GETRoles();
30+
var roles = await GetRolesAsync();
3131

3232
roles.Insert(0, new RoleDto
3333
{
@@ -88,7 +88,7 @@ public async Task<IActionResult> Details(int id)
8888
}
8989
public async Task<IActionResult> Create()
9090
{
91-
var roles = await GETRoles();
91+
var roles = await GetRolesAsync();
9292
ViewBag.Roles = new SelectList(roles, "Id", "Name");
9393
return View();
9494
}
@@ -102,15 +102,17 @@ public async Task<IActionResult> Create([Bind("Login,Password,PhoneNumber,FirstN
102102
var newAccount = await _accountDataStore.CreateAccountAsync(account);
103103
return RedirectToAction("Details", new {id = newAccount.Id});
104104
}
105-
var roles = await GETRoles();
105+
var roles = await GetRolesAsync();
106106
ViewBag.Roles = new SelectList(roles, "Id", "Name");
107107
return View(account);
108108
}
109109

110110
public async Task<IActionResult> Edit(int id)
111111
{
112112
var account = await _accountDataStore.GetAccountAsync(id);
113-
113+
var roles = await GetRolesAsync();
114+
ViewBag.Roles = new SelectList(roles, "Id", "Name");
115+
114116
return View(account);
115117
}
116118

@@ -122,7 +124,7 @@ public async Task<IActionResult> Edit(int id, [Bind("Id,Login,Password,PhoneNumb
122124
if (ModelState.IsValid)
123125
{
124126
var newAccount = await _accountDataStore.UpdateAccountAsync(id, account);
125-
return RedirectToAction("Details", new { id = newAccount.Id });
127+
return RedirectToAction(nameof(Index));
126128
}
127129
return View(account);
128130
}
@@ -145,7 +147,7 @@ public async Task<IActionResult> DeleteConfirmed(int id)
145147
return RedirectToAction(nameof(Index));
146148
}
147149

148-
private async Task<List<RoleDto>> GETRoles()
150+
private async Task<List<RoleDto>> GetRolesAsync()
149151
{
150152
var roleResponse = await _roleStore.GetRoles();
151153
var roles = roleResponse.Data.ToList();

CheckDrive.Web/CheckDrive.Web/Controllers/AuthController.cs

+11-12
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,23 @@ public IActionResult Index()
2525
{
2626
if (HttpContext.Request.Cookies.TryGetValue("tasty-cookies", out _))
2727
{
28-
string token = HttpContext.Request.Cookies["tasty-cookies"];
29-
var tokenHandler = new JwtSecurityTokenHandler();
30-
var jwtToken = tokenHandler.ReadToken(token) as JwtSecurityToken;
31-
if (jwtToken == null)
32-
{
33-
return RedirectToAction("Login", "Account");
34-
}
35-
var roleId = jwtToken.Claims.First(claim => claim.Type == ClaimTypes.Role).Value;
36-
var accountId = jwtToken.Claims.First(claim => claim.Type == ClaimTypes.NameIdentifier).Value;
28+
string token = HttpContext.Request.Cookies["tasty-cookies"];
29+
var tokenHandler = new JwtSecurityTokenHandler();
30+
var jwtToken = tokenHandler.ReadToken(token) as JwtSecurityToken;
31+
if (jwtToken == null)
32+
{
33+
return RedirectToAction("Login", "Account");
34+
}
35+
var roleId = jwtToken.Claims.First(claim => claim.Type == ClaimTypes.Role).Value;
36+
var accountId = jwtToken.Claims.First(claim => claim.Type == ClaimTypes.NameIdentifier).Value;
3737
int accountIds = Int32.Parse(accountId);
38-
38+
3939
switch (roleId)
4040
{
4141
case "1":
42-
4342
TempData["UserName"] = _accountDataStore.GetAccountAsync(accountIds)
4443
.Result.FirstName;
45-
TempData.Keep("UserName");
44+
TempData.Keep("UserName");
4645
return RedirectToAction("Index", "Dashboard");
4746
case "3":
4847
TempData["AccountId"] = accountId;

CheckDrive.Web/CheckDrive.Web/Controllers/CarsController.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public async Task<IActionResult> Create([Bind("Model,Color,Number,RemainingFuel,
109109
if (ModelState.IsValid)
110110
{
111111
var newCar = await _carDataStore.CreateCarAsync(car);
112-
return RedirectToAction("Details", new { id = newCar.Id });
112+
return RedirectToAction(nameof(Index));
113113
}
114114
return View(car);
115115
}
@@ -131,7 +131,7 @@ public async Task<IActionResult> Edit(int id, [Bind("Id,Model,Color,Number,Remai
131131
if (ModelState.IsValid)
132132
{
133133
var newCar = await _carDataStore.UpdateCarAsync(id, car);
134-
return RedirectToAction("Details", new { id = newCar.Id });
134+
return RedirectToAction(nameof(Index));
135135
}
136136
return View(car);
137137
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using CheckDrive.Web.Stores.SplineCharts;
2+
using Microsoft.AspNetCore.Mvc;
3+
4+
namespace CheckDrive.Web.Controllers
5+
{
6+
public class CheckPointController : Controller
7+
{
8+
private readonly ICheckPointStore _checkPointStore;
9+
public CheckPointController(ICheckPointStore checkPointStore)
10+
{
11+
_checkPointStore = checkPointStore ?? throw new ArgumentNullException(nameof(checkPointStore));
12+
}
13+
public ActionResult Index(int id)
14+
{
15+
var checkPoint = _checkPointStore.GetCheckPointById(id);
16+
17+
return View(checkPoint);
18+
}
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
using CheckDrive.Web.Stores.Accounts;
22
using CheckDrive.Web.Stores.Dashbord;
3-
using CheckDrive.Web.ViewModels;
3+
using CheckDrive.Web.Stores.Debts;
4+
using CheckDrive.Web.Stores.MockDashboard;
5+
using CheckDrive.Web.Stores.SplineCharts;
6+
using CheckDrive.Web.ViewModels.Dashboard;
47
using Microsoft.AspNetCore.Mvc;
5-
using NuGet.Common;
68
using System.IdentityModel.Tokens.Jwt;
79
using System.Security.Claims;
810

@@ -12,47 +14,68 @@ public class DashboardController : Controller
1214
{
1315
private readonly IDashboardStore _store;
1416
private readonly IAccountDataStore _accountDataStore;
15-
public DashboardController(IDashboardStore store, IAccountDataStore accountDataStore)
17+
private readonly IMockDashboardStore _mockDashboardStore;
18+
private readonly ICheckPointStore _checkPointStore;
19+
public DashboardController(IDashboardStore store,
20+
IAccountDataStore accountDataStore,
21+
IMockDashboardStore mockDashboardStore,
22+
ICheckPointStore checkPointStore)
1623
{
1724
_store = store;
1825
_accountDataStore = accountDataStore;
26+
_mockDashboardStore = mockDashboardStore;
27+
_checkPointStore = checkPointStore;
1928
}
2029

2130
public async Task<IActionResult> Index()
2231
{
2332
string token = HttpContext.Request.Cookies["tasty-cookies"];
33+
2434
var tokenHandler = new JwtSecurityTokenHandler();
2535
var jwtToken = tokenHandler.ReadToken(token) as JwtSecurityToken;
36+
2637
if (jwtToken == null)
2738
{
2839
return RedirectToAction("Login", "Account");
2940
}
41+
3042
var accountId = jwtToken.Claims.First(claim => claim.Type == ClaimTypes.NameIdentifier).Value;
3143
int accountIds = Int32.Parse(accountId);
3244

3345
TempData["UserName"] = _accountDataStore.GetAccountAsync(accountIds)
3446
.Result.FirstName;
3547
TempData.Keep("UserName");
48+
3649
var dashboard = await _store.GetDashboard();
50+
var mockDashboard = await _mockDashboardStore.GetDashboard();
51+
var checkPoints = _checkPointStore.GetAll("");
52+
53+
54+
dashboard.CheckPoints = checkPoints;
55+
dashboard.OilAmount=mockDashboard.OilAmount;
3756

3857
if (dashboard is null)
3958
{
4059
return BadRequest();
4160
}
61+
4262
SetViewBagProperties(dashboard);
4363

4464
return View();
4565
}
66+
4667
private void SetViewBagProperties(DashboardViewModel dashboard)
4768
{
4869
var summary = dashboard.Summary;
49-
70+
5071
ViewBag.MonthlyFuelConsumption = summary.MonthlyFuelConsumption.ToString("0.00");
5172
ViewBag.CarsCount = summary.CarsCount;
5273
ViewBag.DriversCount = summary.DriversCount;
5374

5475
ViewBag.EmployeesCountByRole = dashboard.EmployeesCountByRoles;
5576
ViewBag.SplineChartData = dashboard.SplineCharts;
77+
ViewBag.OilAmount=dashboard.OilAmount;
78+
ViewBag.CheckPoint = dashboard.CheckPoints;
5679
}
5780
}
5881
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using CheckDrive.Web.Stores.Debts;
2+
using Microsoft.AspNetCore.Mvc;
3+
4+
namespace CheckDrive.Web.Controllers;
5+
6+
public class DebtsController : Controller
7+
{
8+
private readonly IDebtsStore _store;
9+
public DebtsController(IDebtsStore debtsStore)
10+
{
11+
_store = debtsStore ?? throw new ArgumentNullException(nameof(debtsStore));
12+
}
13+
public ActionResult Index(string? searchText, string? status)
14+
{
15+
var debts = _store.GetAll(searchText,status);
16+
17+
ViewBag.Status = _store.GetEnum();
18+
ViewBag.SearchText = searchText;
19+
ViewBag.SelectedStatus = status;
20+
return View(debts);
21+
}
22+
}

CheckDrive.Web/CheckDrive.Web/Controllers/DoctorReviewsController.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public async Task<IActionResult> Index(int? pageNumber, string? searchString, Da
4242
r.DriverName,
4343
r.DoctorName,
4444
r.Date,
45-
IsHealthy = (bool)r.IsHealthy ? "Sog`lom" : "Kasal",
45+
IsHealthy = (bool)r.IsHealthy ? 1 : 0,
4646
r.Comments
4747
}).ToList();
4848

CheckDrive.Web/CheckDrive.Web/Controllers/MechanicAcceptancesController.cs

+1-24
Original file line numberDiff line numberDiff line change
@@ -36,30 +36,7 @@ public async Task<IActionResult> Index(int? pageNumber, string? searchString, Da
3636
ViewBag.HasPreviousPage = response.HasPreviousPage;
3737
ViewBag.HasNextPage = response.HasNextPage;
3838

39-
var mechanicAcceptances = response.Data.Select(r => new
40-
{
41-
r.Id,
42-
IsAccepted = (bool)r.IsAccepted ? "Qabul qilindi" : "Rad etildi",
43-
r.Comments,
44-
Status = ((StatusForDto)r.Status) switch
45-
{
46-
StatusForDto.Pending => "Kutilmoqda",
47-
StatusForDto.Completed => "Yakunlangan",
48-
StatusForDto.Rejected => "Rad etilgan",
49-
StatusForDto.Unassigned => "Tayinlanmagan",
50-
StatusForDto.RejectedByDriver => "Haydovchi tomonidan rad etilgan",
51-
_ => "No`malum holat"
52-
},
53-
r.Date,
54-
r.Distance,
55-
r.DriverName,
56-
r.MechanicName,
57-
r.RemainingFuel,
58-
r.CarName,
59-
r.CarId
60-
}).ToList();
61-
62-
ViewBag.MechanicAcceptances = mechanicAcceptances;
39+
ViewBag.MechanicAcceptances = response.Data;
6340

6441
return View();
6542
}

CheckDrive.Web/CheckDrive.Web/Controllers/MechanicHandoversController.cs

+1-24
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,7 @@ public async Task<IActionResult> Index(int? pageNumber, string? searchString, Da
3131
ViewBag.HasPreviousPage = response.HasPreviousPage;
3232
ViewBag.HasNextPage = response.HasNextPage;
3333

34-
var mechanicHandovers = response.Data.Select(r => new
35-
{
36-
r.Id,
37-
IsHanded = (bool)r.IsHanded ? "Topshirildi" : "Topshirilmadi",
38-
r.Comments,
39-
Status = ((StatusForDto)r.Status) switch
40-
{
41-
StatusForDto.Pending => "Kutilmoqda",
42-
StatusForDto.Completed => "Yakunlangan",
43-
StatusForDto.Rejected => "Rad etilgan",
44-
StatusForDto.Unassigned => "Tayinlanmagan",
45-
StatusForDto.RejectedByDriver => "Haydovchi tomonidan rad etilgan",
46-
_ => "No`malum holat"
47-
},
48-
r.Date,
49-
r.Distance,
50-
r.DriverName,
51-
r.MechanicName,
52-
r.RemainingFuel,
53-
r.CarName,
54-
r.CarId
55-
}).ToList();
56-
57-
ViewBag.MechanicHandovers = mechanicHandovers;
34+
ViewBag.MechanicHandovers = response.Data;
5835

5936
return View();
6037
}

CheckDrive.Web/CheckDrive.Web/Controllers/OperatorReviewsController.cs

+1-23
Original file line numberDiff line numberDiff line change
@@ -44,31 +44,9 @@ public async Task<IActionResult> Index(int? pageNumber, string? searchString, Da
4444
ViewBag.HasPreviousPage = operatorReviews.HasPreviousPage;
4545
ViewBag.HasNextPage = operatorReviews.HasNextPage;
4646

47-
var operatorReviewss = operatorReviews.Data.Select(r => new
48-
{
49-
r.Id,
50-
r.OperatorName,
51-
r.DriverName,
52-
r.OilAmount,
53-
r.OilMarks,
54-
CarModel = $"{r.CarModel} ({r.CarNumber})",
55-
r.Date,
56-
IsGiven = (bool)r.IsGiven ? "Quyildi" : "Quyilmadi",
57-
r.Comments,
58-
Status = ((StatusForDto)r.Status) switch
59-
{
60-
StatusForDto.Pending => "Kutilmoqda",
61-
StatusForDto.Completed => "Yakunlangan",
62-
StatusForDto.Rejected => "Rad etilgan",
63-
StatusForDto.Unassigned => "Tayinlanmagan",
64-
StatusForDto.RejectedByDriver => "Haydovchi tomonidan rad etilgan",
65-
_ => "No`malum holat"
66-
}
67-
}).ToList();
47+
ViewBag.OperatorsReview = operatorReviews.Data;
6848

69-
ViewBag.OperatorsReview = operatorReviewss;
7049
return View();
71-
7250
}
7351

7452
public async Task<IActionResult> HistoryIndexForPersonalPage(int? pageNumber, string? searchString, DateTime? date)

0 commit comments

Comments
 (0)