Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check point #245

Closed
wants to merge 147 commits into from
Closed
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
988c630
add font awesome files
jamshidbek-choriyev Sep 26, 2024
b265429
I updated the license version of syncfusion
jamshidbek-choriyev Sep 26, 2024
a5356b9
some changes in the index
jamshidbek-choriyev Sep 26, 2024
f4c2c24
I updated the syncfusion key
jamshidbek-choriyev Sep 26, 2024
2e301f9
Sidebar changes
Boburm1rzo Sep 27, 2024
5056d34
Sidebar
Boburm1rzo Sep 29, 2024
53c2d19
Merge pull request #184 from DiyorMarket/177-update-sidebar-icons-and…
Mirazyzz Sep 30, 2024
e5d2ac4
I changed OilMark's Create to Pop-up output
jamshidbek-choriyev Oct 1, 2024
dda93c3
changed and added the modal companet
jamshidbek-choriyev Oct 1, 2024
0f40f2c
I made a pop-up when creating
jamshidbek-choriyev Oct 1, 2024
92ddd27
I changed the RenderSection to sync
jamshidbek-choriyev Oct 7, 2024
3c141b2
I have added additions and changes
jamshidbek-choriyev Oct 7, 2024
b40bfcd
I made a pop-up to create a car
jamshidbek-choriyev Oct 7, 2024
ac728d5
I created a pop-up to create a Doctor Review
jamshidbek-choriyev Oct 7, 2024
f01075c
I created a popup to create Mechanic Acceptances
jamshidbek-choriyev Oct 7, 2024
6f94b35
I created a popup to create Mechanic Handover
jamshidbek-choriyev Oct 7, 2024
18d2fe0
I created a popup to create Operator Review
jamshidbek-choriyev Oct 7, 2024
2c644d4
Update Create.cshtml
jamshidbek-choriyev Oct 7, 2024
d58893a
Update Index.cshtml
jamshidbek-choriyev Oct 7, 2024
c18b7ba
Update CreateByButton.cshtml
jamshidbek-choriyev Oct 7, 2024
80eec22
Update Create.cshtml
jamshidbek-choriyev Oct 7, 2024
c23b4b9
Update Create.cshtml
jamshidbek-choriyev Oct 7, 2024
de931b2
Merge branch 'integration' into master
Ramadan1011 Oct 7, 2024
5624c7f
Update PersonalIndex.cshtml
jamshidbek-choriyev Oct 8, 2024
92ab9de
deleted empty line
Boburm1rzo Oct 8, 2024
3bb8529
dashboard controller changes
Boburm1rzo Oct 8, 2024
d1cf035
Dashboard ViewModel changes
Boburm1rzo Oct 8, 2024
8763bac
dahsboard index page
Boburm1rzo Oct 8, 2024
045f55e
added navbar in layout
Boburm1rzo Oct 8, 2024
9a1e9f3
update sidebar
Boburm1rzo Oct 8, 2024
e5138c2
css files
Boburm1rzo Oct 8, 2024
46e59c0
dropdown function in js
Boburm1rzo Oct 8, 2024
d41ecba
update css
Boburm1rzo Oct 8, 2024
6134b6a
errors have been corrected
jamshidbek-choriyev Oct 8, 2024
639c40e
I created a new employee popup
jamshidbek-choriyev Oct 8, 2024
c4cfaa3
renamed from PetrolCount to OilCount
Boburm1rzo Oct 8, 2024
d9e7b37
errors have been corrected
jamshidbek-choriyev Oct 8, 2024
131ce02
changed
jamshidbek-choriyev Oct 8, 2024
87e3429
add and changed
jamshidbek-choriyev Oct 8, 2024
b86ffa2
errors have been corrected
jamshidbek-choriyev Oct 8, 2024
c6271e3
edit page, a pop-up appeared
jamshidbek-choriyev Oct 11, 2024
59673fb
dashboard index
Boburm1rzo Oct 11, 2024
ad0aba2
I placed the LoginViewModel in a separate Login folder
Boburm1rzo Oct 11, 2024
3261ef2
DashboardViewModel moved to Dashboard folder
Boburm1rzo Oct 11, 2024
51eefb5
ViewModels
Boburm1rzo Oct 11, 2024
284d67f
removed unused usings
Boburm1rzo Oct 11, 2024
ae543e7
enums
Boburm1rzo Oct 11, 2024
259b42d
Update "Ishchilar" text size
diyorzz Oct 13, 2024
017286d
Update MechanicAcceptance page in manager.
diyorzz Oct 13, 2024
e4af552
Css file
Boburm1rzo Oct 13, 2024
f2ca5b8
dashboard view page
Boburm1rzo Oct 13, 2024
45ec083
OilCount->OilMarkViewModel
Boburm1rzo Oct 13, 2024
21dd58e
I moved the creation of models to MockStore
Boburm1rzo Oct 13, 2024
7874dac
MockDashboardStore
Boburm1rzo Oct 13, 2024
7ed4a3a
OilMark->Name
Boburm1rzo Oct 13, 2024
8dceb95
add IMockDashboardStore to services
Boburm1rzo Oct 13, 2024
21f28fa
changes in Dashboard Controller
Boburm1rzo Oct 13, 2024
c5aea58
Update background color
diyorzz Oct 15, 2024
d12a48f
delete the unnecessary columns
diyorzz Oct 15, 2024
d81ef4f
delete the unnecessary codes
diyorzz Oct 15, 2024
6c8666a
Update DoctorReview page in manager
diyorzz Oct 15, 2024
4d52afa
Delete text
diyorzz Oct 15, 2024
ade85d2
delete "Mexanik (Qabul qiluvchi) text
diyorzz Oct 15, 2024
7a506f7
Update MechanicHandover in manager.
diyorzz Oct 15, 2024
dd371c9
Update OperatorReview page in manager.
diyorzz Oct 15, 2024
982a144
Udpate DispatcherReview in manager.
diyorzz Oct 15, 2024
6751455
I changed the type of the Amount property in OilMarkViewModel from in…
Boburm1rzo Oct 15, 2024
b686095
Merge pull request #199 from DiyorMarket/178-redesign-dashboard-with-…
Mirazyzz Oct 15, 2024
af0ba5a
Merge pull request #206 from DiyorMarket/Update-DispatcherReview-page…
Mirazyzz Oct 15, 2024
f5f9543
Merge pull request #205 from DiyorMarket/Update-OperatorReviews-page-…
Mirazyzz Oct 15, 2024
87f40a4
Merge pull request #204 from DiyorMarket/Update-MechanicHandover-in-m…
Mirazyzz Oct 15, 2024
5531fd1
Merge pull request #203 from DiyorMarket/Update-DoctorReview-page-in-…
Mirazyzz Oct 15, 2024
4cc06b0
Update "Ishchilar" text size
diyorzz Oct 13, 2024
406a647
Update MechanicAcceptance page in manager.
diyorzz Oct 13, 2024
3162619
changed
jamshidbek-choriyev Oct 16, 2024
1792d4f
changed
jamshidbek-choriyev Oct 16, 2024
1f5941a
add form-select to classes
jamshidbek-choriyev Oct 16, 2024
a69081e
changed
jamshidbek-choriyev Oct 16, 2024
655f089
added form-select to classes
jamshidbek-choriyev Oct 16, 2024
74f2e6b
changed
jamshidbek-choriyev Oct 16, 2024
59268f2
changed
jamshidbek-choriyev Oct 16, 2024
ebef5a5
Update background color
diyorzz Oct 15, 2024
5fdb878
delete the unnecessary columns
diyorzz Oct 15, 2024
25a322f
delete the unnecessary codes
diyorzz Oct 15, 2024
f4febca
delete "Mexanik (Qabul qiluvchi) text
diyorzz Oct 15, 2024
02f8df6
Merge branch 'Update-MechanicAcceptance-page-in-manager-' of https://…
diyorzz Oct 17, 2024
af4a4f8
Update Edit.cshtml
jamshidbek-choriyev Oct 18, 2024
80a0998
Update Index.cshtml
jamshidbek-choriyev Oct 18, 2024
e588f46
Merge branch 'integration' into master
jamshidbek-choriyev Oct 18, 2024
09a562b
site js
Boburm1rzo Oct 19, 2024
8e09b87
error layout for error pages
Boburm1rzo Oct 19, 2024
be3e8e5
update authController
Boburm1rzo Oct 19, 2024
e4a6140
configuration services
Boburm1rzo Oct 19, 2024
f24facc
Update DoctorReviewDataStore
Boburm1rzo Oct 19, 2024
5ac807f
added Menu Service and CurrentUser service
Boburm1rzo Oct 19, 2024
3904c54
DispatcherReviews PersonalIndex and History pages updated
Boburm1rzo Oct 19, 2024
5517da6
DoctorReview PersonalIndex and History pages updated
Boburm1rzo Oct 19, 2024
8de9579
Mechanic Personal Index and History pages updated
Boburm1rzo Oct 19, 2024
c343a96
OperatorReview Personal Index and History pages updated
Boburm1rzo Oct 19, 2024
3916217
Personal Layout changes
Boburm1rzo Oct 19, 2024
f5c9b75
Update SideBar Layout
Boburm1rzo Oct 19, 2024
010d067
An icon was added to change grids and display details
jamshidbek-choriyev Oct 19, 2024
7634149
fixed
Boburm1rzo Oct 19, 2024
4f9aace
Merge pull request #211 from DiyorMarket/An-icon-was-added-to-change-…
Mirazyzz Oct 19, 2024
5cae0cc
Merge pull request #210 from DiyorMarket/The-sidebar-should-be-separa…
Mirazyzz Oct 19, 2024
c1c16f2
Merge branch 'integration' into master
jamshidbek-choriyev Oct 19, 2024
3e2b917
Merge branch 'integration' into Update-MechanicAcceptance-page-in-man…
diyorzz Oct 20, 2024
aeb380e
Update Edit.cshtml
jamshidbek-choriyev Oct 20, 2024
939c028
Merge pull request #202 from DiyorMarket/Update-MechanicAcceptance-pa…
diyorzz Oct 20, 2024
416b6f6
Update Index.cshtml
jamshidbek-choriyev Oct 20, 2024
f9d1e15
Merge pull request #198 from jamshidbek7375/master
Mirazyzz Oct 20, 2024
38e89c7
created popup for account details
Ramadan1011 Oct 26, 2024
ba31cfa
created popup for car details
Ramadan1011 Oct 26, 2024
44ab05a
created popup for dispatcher-reviews details
Ramadan1011 Oct 26, 2024
6f35a56
ccreae popup for doctor-reviews details
Ramadan1011 Oct 26, 2024
f529f4d
ccreae popup for mechanic-acceptances-reviews details
Ramadan1011 Oct 26, 2024
81483f3
ccreae popup for mechanic-handovers-reviews details
Ramadan1011 Oct 26, 2024
5bf8321
deleted unnecessary view page
Ramadan1011 Oct 26, 2024
08945c5
create popup for operator-reviews details
Ramadan1011 Oct 26, 2024
fdb14e2
ccreae popup for mechanic-handover-reviews details
Ramadan1011 Oct 26, 2024
029e468
added some styling for improving popup appearence
Ramadan1011 Oct 26, 2024
ee53e99
changed layout to null all reviews
Ramadan1011 Oct 28, 2024
8a2af53
Merge pull request #212 from DiyorMarket/open-details-pages-in-a-moda…
Ramadan1011 Oct 30, 2024
a986fb4
bugs fixed
jamshidbek-choriyev Nov 1, 2024
7ed4cdc
bugs fixed, and edit and delete popup
jamshidbek-choriyev Nov 1, 2024
93f0708
Update _ModalForLayout.cshtml
jamshidbek-choriyev Nov 1, 2024
17dc481
GETRoles replase GetRolesAsync
jamshidbek-choriyev Nov 2, 2024
4bf34ce
changed and bugs fixed
jamshidbek-choriyev Nov 2, 2024
35b92c5
Update Delete.cshtml
jamshidbek-choriyev Nov 3, 2024
c80f4c4
fixed bugs in sidebar
Boburm1rzo Nov 4, 2024
4b7d3db
Merge branch 'integration' into 213-the-sidebar-element-should-be-cha…
Boburm1rzo Nov 4, 2024
2c99963
Merge pull request #217 from DiyorMarket/213-the-sidebar-element-shou…
Boburm1rzo Nov 5, 2024
7255713
Merge pull request #215 from DiyorMarket/pop-up-output-when-clicking-…
jamshidbek-choriyev Nov 6, 2024
9629005
Debts stores
Boburm1rzo Nov 16, 2024
d019939
css and js
Boburm1rzo Nov 16, 2024
608be63
debts page and grid
Boburm1rzo Nov 16, 2024
b48642f
debts viewModels and mock debts store
Boburm1rzo Nov 16, 2024
8c5e2e6
added debts url in sidebar
Boburm1rzo Nov 16, 2024
f4eb3f6
DI
Boburm1rzo Nov 16, 2024
ebe8617
dashboard controller
Boburm1rzo Nov 16, 2024
4c3af55
js and css files
Boburm1rzo Nov 20, 2024
9376587
debts page changes
Boburm1rzo Nov 20, 2024
5967166
debts grid in dashboard
Boburm1rzo Nov 20, 2024
b0f9aaa
debts viewModel
Boburm1rzo Nov 20, 2024
31f53ed
DebtsStore
Boburm1rzo Nov 20, 2024
101a185
Debts Controller fixed bugs
Boburm1rzo Nov 20, 2024
24c25ee
Merge pull request #226 from DiyorMarket/224-create-debts-page
Boburm1rzo Nov 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions CheckDrive.Web/CheckDrive.Web/CheckDrive.Web.csproj
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
<Compile Include="Controllers\AuthController.cs" />
<Compile Include="Controllers\CarsController.cs" />
<Compile Include="Controllers\DashboardController.cs" />
<Compile Include="Controllers\DebtsController.cs" />
<Compile Include="Controllers\DispatcherReviewsController.cs" />
<Compile Include="Controllers\DoctorReviewsController.cs" />
<Compile Include="Controllers\DoctorsController.cs" />
@@ -31,12 +32,33 @@
<Compile Include="Controllers\OperatorsController.cs" />
<Compile Include="Controllers\TechniciansController.cs" />
<None Include="wwwroot\css\LogOutButtun.css" />
<None Include="wwwroot\font-awesome\js\all.js" />
<None Include="wwwroot\font-awesome\js\all.min.js" />
<None Include="wwwroot\font-awesome\js\brands.js" />
<None Include="wwwroot\font-awesome\js\brands.min.js" />
<None Include="wwwroot\font-awesome\js\conflict-detection.js" />
<None Include="wwwroot\font-awesome\js\conflict-detection.min.js" />
<None Include="wwwroot\font-awesome\js\fontawesome.js" />
<None Include="wwwroot\font-awesome\js\fontawesome.min.js" />
<None Include="wwwroot\font-awesome\js\regular.js" />
<None Include="wwwroot\font-awesome\js\regular.min.js" />
<None Include="wwwroot\font-awesome\js\solid.js" />
<None Include="wwwroot\font-awesome\js\solid.min.js" />
<None Include="wwwroot\font-awesome\js\v4-shims.js" />
<None Include="wwwroot\font-awesome\js\v4-shims.min.js" />
<None Include="wwwroot\font-awesome\sprites\brands.svg" />
<None Include="wwwroot\font-awesome\sprites\regular.svg" />
<None Include="wwwroot\font-awesome\sprites\solid.svg" />
<None Include="wwwroot\font-awesome\webfonts\fa-brands-400.woff2" />
<None Include="wwwroot\font-awesome\webfonts\fa-regular-400.woff2" />
<None Include="wwwroot\font-awesome\webfonts\fa-solid-900.woff2" />
<None Include="wwwroot\font-awesome\webfonts\fa-v4compatibility.woff2" />
<PackageReference Include="CheckDrive.ApiContracts" Version="1.4.9" />
<PackageReference Include="CheckDrive.DTOs" Version="1.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.4" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.3" />
<PackageReference Include="Syncfusion.EJ2.AspNet.Core" Version="25.1.42" />
<PackageReference Include="Syncfusion.Licensing" Version="25.2.3" />
<PackageReference Include="Syncfusion.EJ2.AspNet.Core" Version="27.1.50" />
<PackageReference Include="Syncfusion.Licensing" Version="27.1.50" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.6.0" />
<PackageReference Include="System.Security.Claims" Version="4.3.0" />

2 changes: 1 addition & 1 deletion CheckDrive.Web/CheckDrive.Web/Constants/Configurations.cs
Original file line number Diff line number Diff line change
@@ -3,6 +3,6 @@
public static class Configurations
{
public const string JwtToken = "JwtToken";
public const string SynfusionLicenseKey = "Mgo+DSMBMAY9C3t2UFhhQlJBfV5AQmBIYVp/TGpJfl96cVxMZVVBJAtUQF1hTX5UdERiXX1ZcHNXRGFa";
public const string SynfusionLicenseKey = "Mgo+DSMBPh8sVXJzS0d+WFlPd11dXmJWd1p/THNYflR1fV9DaUwxOX1dQl9nSXdRc0VkW3pfdX1WQ2E=";
}
}
14 changes: 8 additions & 6 deletions CheckDrive.Web/CheckDrive.Web/Controllers/AccountsController.cs
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ public async Task<IActionResult> Index(string? searchString, int? roleId, DateTi
{
var accounts = await _accountDataStore.GetAccountsAsync(searchString, roleId, birthDate, pageNumber);

var roles = await GETRoles();
var roles = await GetRolesAsync();

roles.Insert(0, new RoleDto
{
@@ -88,7 +88,7 @@ public async Task<IActionResult> Details(int id)
}
public async Task<IActionResult> Create()
{
var roles = await GETRoles();
var roles = await GetRolesAsync();
ViewBag.Roles = new SelectList(roles, "Id", "Name");
return View();
}
@@ -102,15 +102,17 @@ public async Task<IActionResult> Create([Bind("Login,Password,PhoneNumber,FirstN
var newAccount = await _accountDataStore.CreateAccountAsync(account);
return RedirectToAction("Details", new {id = newAccount.Id});
}
var roles = await GETRoles();
var roles = await GetRolesAsync();
ViewBag.Roles = new SelectList(roles, "Id", "Name");
return View(account);
}

public async Task<IActionResult> Edit(int id)
{
var account = await _accountDataStore.GetAccountAsync(id);

var roles = await GetRolesAsync();
ViewBag.Roles = new SelectList(roles, "Id", "Name");

return View(account);
}

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

private async Task<List<RoleDto>> GETRoles()
private async Task<List<RoleDto>> GetRolesAsync()
{
var roleResponse = await _roleStore.GetRoles();
var roles = roleResponse.Data.ToList();
23 changes: 11 additions & 12 deletions CheckDrive.Web/CheckDrive.Web/Controllers/AuthController.cs
Original file line number Diff line number Diff line change
@@ -25,24 +25,23 @@
{
if (HttpContext.Request.Cookies.TryGetValue("tasty-cookies", out _))
{
string token = HttpContext.Request.Cookies["tasty-cookies"];
var tokenHandler = new JwtSecurityTokenHandler();
var jwtToken = tokenHandler.ReadToken(token) as JwtSecurityToken;
if (jwtToken == null)
{
return RedirectToAction("Login", "Account");
}
var roleId = jwtToken.Claims.First(claim => claim.Type == ClaimTypes.Role).Value;
var accountId = jwtToken.Claims.First(claim => claim.Type == ClaimTypes.NameIdentifier).Value;
string token = HttpContext.Request.Cookies["tasty-cookies"];

Check warning on line 28 in CheckDrive.Web/CheckDrive.Web/Controllers/AuthController.cs

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.

Check warning on line 28 in CheckDrive.Web/CheckDrive.Web/Controllers/AuthController.cs

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.
var tokenHandler = new JwtSecurityTokenHandler();
var jwtToken = tokenHandler.ReadToken(token) as JwtSecurityToken;
if (jwtToken == null)
{
return RedirectToAction("Login", "Account");
}
var roleId = jwtToken.Claims.First(claim => claim.Type == ClaimTypes.Role).Value;
var accountId = jwtToken.Claims.First(claim => claim.Type == ClaimTypes.NameIdentifier).Value;
int accountIds = Int32.Parse(accountId);

switch (roleId)
{
case "1":

TempData["UserName"] = _accountDataStore.GetAccountAsync(accountIds)
.Result.FirstName;
TempData.Keep("UserName");
TempData.Keep("UserName");
return RedirectToAction("Index", "Dashboard");
case "3":
TempData["AccountId"] = accountId;
4 changes: 2 additions & 2 deletions CheckDrive.Web/CheckDrive.Web/Controllers/CarsController.cs
Original file line number Diff line number Diff line change
@@ -109,7 +109,7 @@ public async Task<IActionResult> Create([Bind("Model,Color,Number,RemainingFuel,
if (ModelState.IsValid)
{
var newCar = await _carDataStore.CreateCarAsync(car);
return RedirectToAction("Details", new { id = newCar.Id });
return RedirectToAction(nameof(Index));
}
return View(car);
}
@@ -131,7 +131,7 @@ public async Task<IActionResult> Edit(int id, [Bind("Id,Model,Color,Number,Remai
if (ModelState.IsValid)
{
var newCar = await _carDataStore.UpdateCarAsync(id, car);
return RedirectToAction("Details", new { id = newCar.Id });
return RedirectToAction(nameof(Index));
}
return View(car);
}
30 changes: 26 additions & 4 deletions CheckDrive.Web/CheckDrive.Web/Controllers/DashboardController.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using CheckDrive.Web.Stores.Accounts;
using CheckDrive.Web.Stores.Dashbord;
using CheckDrive.Web.ViewModels;
using CheckDrive.Web.Stores.Debts;
using CheckDrive.Web.Stores.MockDashboard;
using CheckDrive.Web.ViewModels.Dashboard;
using Microsoft.AspNetCore.Mvc;
using NuGet.Common;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;

@@ -12,47 +13,68 @@ public class DashboardController : Controller
{
private readonly IDashboardStore _store;
private readonly IAccountDataStore _accountDataStore;
public DashboardController(IDashboardStore store, IAccountDataStore accountDataStore)
private readonly IMockDashboardStore _mockDashboardStore;
private readonly IDebtsStore _debtsStore;
public DashboardController(IDashboardStore store,
IAccountDataStore accountDataStore,
IMockDashboardStore mockDashboardStore,
IDebtsStore debtsStore)
{
_store = store;
_accountDataStore = accountDataStore;
_mockDashboardStore = mockDashboardStore;
_debtsStore = debtsStore;
}

public async Task<IActionResult> Index()
{
string token = HttpContext.Request.Cookies["tasty-cookies"];

var tokenHandler = new JwtSecurityTokenHandler();
var jwtToken = tokenHandler.ReadToken(token) as JwtSecurityToken;

if (jwtToken == null)
{
return RedirectToAction("Login", "Account");
}

var accountId = jwtToken.Claims.First(claim => claim.Type == ClaimTypes.NameIdentifier).Value;
int accountIds = Int32.Parse(accountId);

TempData["UserName"] = _accountDataStore.GetAccountAsync(accountIds)
.Result.FirstName;
TempData.Keep("UserName");

var dashboard = await _store.GetDashboard();
var mockDashboard = await _mockDashboardStore.GetDashboard();
var debts = _debtsStore.GetAll("" , "");


dashboard.Debts=debts;
dashboard.OilAmount=mockDashboard.OilAmount;

if (dashboard is null)
{
return BadRequest();
}

SetViewBagProperties(dashboard);

return View();
}

private void SetViewBagProperties(DashboardViewModel dashboard)
{
var summary = dashboard.Summary;

ViewBag.MonthlyFuelConsumption = summary.MonthlyFuelConsumption.ToString("0.00");
ViewBag.CarsCount = summary.CarsCount;
ViewBag.DriversCount = summary.DriversCount;

ViewBag.EmployeesCountByRole = dashboard.EmployeesCountByRoles;
ViewBag.SplineChartData = dashboard.SplineCharts;
ViewBag.OilAmount=dashboard.OilAmount;
ViewBag.Debts = dashboard.Debts;
}
}
}
22 changes: 22 additions & 0 deletions CheckDrive.Web/CheckDrive.Web/Controllers/DebtsController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using CheckDrive.Web.Stores.Debts;
using Microsoft.AspNetCore.Mvc;

namespace CheckDrive.Web.Controllers;

public class DebtsController : Controller
{
private readonly IDebtsStore _store;
public DebtsController(IDebtsStore debtsStore)
{
_store = debtsStore ?? throw new ArgumentNullException(nameof(debtsStore));
}
public ActionResult Index(string? searchText, string? status)
{
var debts = _store.GetAll(searchText,status);

ViewBag.Status = _store.GetEnum();
ViewBag.SearchText = searchText;
ViewBag.SelectedStatus = status;
return View(debts);
}
}
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ public async Task<IActionResult> Index(int? pageNumber, string? searchString, Da
r.DriverName,
r.DoctorName,
r.Date,
IsHealthy = (bool)r.IsHealthy ? "Sog`lom" : "Kasal",
IsHealthy = (bool)r.IsHealthy ? 1 : 0,
r.Comments
}).ToList();

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

var mechanicAcceptances = response.Data.Select(r => new
{
r.Id,
IsAccepted = (bool)r.IsAccepted ? "Qabul qilindi" : "Rad etildi",
r.Comments,
Status = ((StatusForDto)r.Status) switch
{
StatusForDto.Pending => "Kutilmoqda",
StatusForDto.Completed => "Yakunlangan",
StatusForDto.Rejected => "Rad etilgan",
StatusForDto.Unassigned => "Tayinlanmagan",
StatusForDto.RejectedByDriver => "Haydovchi tomonidan rad etilgan",
_ => "No`malum holat"
},
r.Date,
r.Distance,
r.DriverName,
r.MechanicName,
r.RemainingFuel,
r.CarName,
r.CarId
}).ToList();

ViewBag.MechanicAcceptances = mechanicAcceptances;
ViewBag.MechanicAcceptances = response.Data;

return View();
}
Original file line number Diff line number Diff line change
@@ -31,30 +31,7 @@ public async Task<IActionResult> Index(int? pageNumber, string? searchString, Da
ViewBag.HasPreviousPage = response.HasPreviousPage;
ViewBag.HasNextPage = response.HasNextPage;

var mechanicHandovers = response.Data.Select(r => new
{
r.Id,
IsHanded = (bool)r.IsHanded ? "Topshirildi" : "Topshirilmadi",
r.Comments,
Status = ((StatusForDto)r.Status) switch
{
StatusForDto.Pending => "Kutilmoqda",
StatusForDto.Completed => "Yakunlangan",
StatusForDto.Rejected => "Rad etilgan",
StatusForDto.Unassigned => "Tayinlanmagan",
StatusForDto.RejectedByDriver => "Haydovchi tomonidan rad etilgan",
_ => "No`malum holat"
},
r.Date,
r.Distance,
r.DriverName,
r.MechanicName,
r.RemainingFuel,
r.CarName,
r.CarId
}).ToList();

ViewBag.MechanicHandovers = mechanicHandovers;
ViewBag.MechanicHandovers = response.Data;

return View();
}
Original file line number Diff line number Diff line change
@@ -44,38 +44,16 @@
ViewBag.HasPreviousPage = operatorReviews.HasPreviousPage;
ViewBag.HasNextPage = operatorReviews.HasNextPage;

var operatorReviewss = operatorReviews.Data.Select(r => new
{
r.Id,
r.OperatorName,
r.DriverName,
r.OilAmount,
r.OilMarks,
CarModel = $"{r.CarModel} ({r.CarNumber})",
r.Date,
IsGiven = (bool)r.IsGiven ? "Quyildi" : "Quyilmadi",
r.Comments,
Status = ((StatusForDto)r.Status) switch
{
StatusForDto.Pending => "Kutilmoqda",
StatusForDto.Completed => "Yakunlangan",
StatusForDto.Rejected => "Rad etilgan",
StatusForDto.Unassigned => "Tayinlanmagan",
StatusForDto.RejectedByDriver => "Haydovchi tomonidan rad etilgan",
_ => "No`malum holat"
}
}).ToList();
ViewBag.OperatorsReview = operatorReviews.Data;

ViewBag.OperatorsReview = operatorReviewss;
return View();

}

public async Task<IActionResult> HistoryIndexForPersonalPage(int? pageNumber, string? searchString, DateTime? date)
{
var accountIdStr = TempData["AccountId"] as string;
TempData.Keep("AccountId");
int accountId = int.Parse(accountIdStr);

Check warning on line 56 in CheckDrive.Web/CheckDrive.Web/Controllers/OperatorReviewsController.cs

GitHub Actions / build

Possible null reference argument for parameter 's' in 'int int.Parse(string s)'.

var response = await _operatorReviewDataStore.GetOperatorReviews(pageNumber, searchString, date, null, null, accountId);

@@ -129,7 +107,7 @@
if (int.TryParse(accountIdStr, out int accountId))
{
var operatorResponse = await _operatorDataStore.GetOperators(accountId);
operatorr = operatorResponse.Data.First();

Check warning on line 110 in CheckDrive.Web/CheckDrive.Web/Controllers/OperatorReviewsController.cs

GitHub Actions / build

Possible null reference argument for parameter 'source' in 'OperatorDto Enumerable.First<OperatorDto>(IEnumerable<OperatorDto> source)'.
}
ViewBag.OperatorId = operatorr.Id;

@@ -140,7 +118,7 @@
ViewBag.SelectedCarId = carId;
ViewBag.FuelTankCapacity = fuelTankCapacity ?? null;
ViewBag.RemainingFuel = remainingFuel ?? null;
ViewBag.OilMarks = oilMarks.Data.Select(o => new SelectListItem

Check warning on line 121 in CheckDrive.Web/CheckDrive.Web/Controllers/OperatorReviewsController.cs

GitHub Actions / build

Possible null reference argument for parameter 'source' in 'IEnumerable<SelectListItem> Enumerable.Select<OilMarkDto, SelectListItem>(IEnumerable<OilMarkDto> source, Func<OilMarkDto, SelectListItem> selector)'.
{
Value = o.Id.ToString(),
Text = o.OilMark
@@ -148,7 +126,7 @@

var response = await _operatorReviewDataStore.GetOperatorReviews(null, null, null, null, 4, null);

ViewBag.Drivers = response.Data

Check warning on line 129 in CheckDrive.Web/CheckDrive.Web/Controllers/OperatorReviewsController.cs

GitHub Actions / build

Possible null reference argument for parameter 'source' in 'IEnumerable<SelectListItem> Enumerable.Select<OperatorReviewDto, SelectListItem>(IEnumerable<OperatorReviewDto> source, Func<OperatorReviewDto, SelectListItem> selector)'.
.Select(d => new SelectListItem
{
Value = d.DriverId.ToString(),
@@ -176,7 +154,7 @@
public async Task<IActionResult> GetCarByDriverId(int driverId)
{
var response = await _operatorReviewDataStore.GetOperatorReviews(null, null, null, null, 4, null);
var handover = response.Data.FirstOrDefault(m => m.DriverId == driverId);

Check warning on line 157 in CheckDrive.Web/CheckDrive.Web/Controllers/OperatorReviewsController.cs

GitHub Actions / build

Possible null reference argument for parameter 'source' in 'OperatorReviewDto? Enumerable.FirstOrDefault<OperatorReviewDto>(IEnumerable<OperatorReviewDto> source, Func<OperatorReviewDto, bool> predicate)'.

if (handover != null)
{
@@ -229,7 +207,7 @@
var cars = await _carDataStore.GetCarsAsync(1, null);
var oilMarks = await _oilMarkDataStore.GetOilMarksAsync();

ViewBag.DriverSelectList = new SelectList(drivers.Data.Select(driver => new

Check warning on line 210 in CheckDrive.Web/CheckDrive.Web/Controllers/OperatorReviewsController.cs

GitHub Actions / build

Possible null reference argument for parameter 'source' in 'IEnumerable<<anonymous type: int Id, string DisplayText>> Enumerable.Select<DriverDto, <anonymous type: int Id, string DisplayText>>(IEnumerable<DriverDto> source, Func<DriverDto, <anonymous type: int Id, string DisplayText>> selector)'.
{
Id = driver.Id,
DisplayText = $"{driver.FirstName} {driver.LastName}"
Loading
Loading