From 09a562b9528cb346f1e05de0aa0002a8a62925b1 Mon Sep 17 00:00:00 2001 From: Boburmirzo <137428656+Boburm1rzo@users.noreply.github.com> Date: Sat, 19 Oct 2024 20:08:06 +0500 Subject: [PATCH 01/13] site js --- CheckDrive.Web/CheckDrive.Web/wwwroot/js/site.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CheckDrive.Web/CheckDrive.Web/wwwroot/js/site.js b/CheckDrive.Web/CheckDrive.Web/wwwroot/js/site.js index b7885796..02fd1179 100644 --- a/CheckDrive.Web/CheckDrive.Web/wwwroot/js/site.js +++ b/CheckDrive.Web/CheckDrive.Web/wwwroot/js/site.js @@ -6,8 +6,18 @@ const anchor = item.querySelector('a'); if (anchor && anchor.getAttribute('href') === currentUrl) { item.classList.add('e-selected'); + if (item.id === "handoversItem") { + updateTarixUrl("/mechanichandovers/historyindexforpersonalpage"); + } } }); + function updateTarixUrl(newUrl) { + var tarixMenuItem = document.getElementById("historyItem"); + var historyLink = tarixMenuItem.querySelector("a.e-menu-url"); + if (historyLink) { + historyLink.href = newUrl; + } + } }); function toggleDropdown() { From 8e09b87b59feb8fdccce0556ea745ef4cbd59cbf Mon Sep 17 00:00:00 2001 From: Boburmirzo <137428656+Boburm1rzo@users.noreply.github.com> Date: Sat, 19 Oct 2024 20:08:42 +0500 Subject: [PATCH 02/13] error layout for error pages --- .../Views/Shared/Error409.cshtml | 2 +- .../Views/Shared/Forbidden.cshtml | 2 +- .../Views/Shared/InternalServerError.cshtml | 2 +- .../Views/Shared/NotFound.cshtml | 2 +- .../Views/Shared/Unauthorized.cshtml | 2 +- .../Views/Shared/_ErrorLayout.cshtml | 29 +++++++++++++++++++ 6 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 CheckDrive.Web/CheckDrive.Web/Views/Shared/_ErrorLayout.cshtml diff --git a/CheckDrive.Web/CheckDrive.Web/Views/Shared/Error409.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/Shared/Error409.cshtml index 098b80fa..5eb6686a 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/Shared/Error409.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/Shared/Error409.cshtml @@ -1,6 +1,6 @@ @{ ViewBag.Title = "Unauthorized"; - Layout = "~/Views/Shared/_PersonalLayout.cshtml"; + Layout = "~/Views/Shared/_ErrorLayout.cshtml"; } diff --git a/CheckDrive.Web/CheckDrive.Web/Views/Shared/Forbidden.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/Shared/Forbidden.cshtml index e5aa03d5..82201e95 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/Shared/Forbidden.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/Shared/Forbidden.cshtml @@ -1,6 +1,6 @@ @{ ViewBag.Title = "Forbidden"; - Layout = "~/Views/Shared/_PersonalLayout.cshtml"; + Layout = "~/Views/Shared/_ErrorLayout.cshtml"; } diff --git a/CheckDrive.Web/CheckDrive.Web/Views/Shared/InternalServerError.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/Shared/InternalServerError.cshtml index 16df8ed7..b6b6b856 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/Shared/InternalServerError.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/Shared/InternalServerError.cshtml @@ -1,6 +1,6 @@ @{ ViewBag.Title = "Internal Server Error"; - Layout = "~/Views/Shared/_PersonalLayout.cshtml"; + Layout = "~/Views/Shared/_ErrorLayout.cshtml"; } diff --git a/CheckDrive.Web/CheckDrive.Web/Views/Shared/NotFound.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/Shared/NotFound.cshtml index 570478bb..9f27e299 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/Shared/NotFound.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/Shared/NotFound.cshtml @@ -1,6 +1,6 @@ @{ ViewBag.Title = "Not Found"; - Layout = "~/Views/Shared/_PersonalLayout.cshtml"; + Layout = "~/Views/Shared/_ErrorLayout.cshtml"; } diff --git a/CheckDrive.Web/CheckDrive.Web/Views/Shared/Unauthorized.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/Shared/Unauthorized.cshtml index d9ffde57..9981b658 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/Shared/Unauthorized.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/Shared/Unauthorized.cshtml @@ -1,6 +1,6 @@ @{ ViewBag.Title = "Unauthorized"; - Layout = "~/Views/Shared/_PersonalLayout.cshtml"; + Layout = "~/Views/Shared/_ErrorLayout.cshtml"; } diff --git a/CheckDrive.Web/CheckDrive.Web/Views/Shared/_ErrorLayout.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/Shared/_ErrorLayout.cshtml new file mode 100644 index 00000000..0a913d22 --- /dev/null +++ b/CheckDrive.Web/CheckDrive.Web/Views/Shared/_ErrorLayout.cshtml @@ -0,0 +1,29 @@ + + + + + + @ViewData["Title"] - CheckDrive.Web + + + + + + + + + + + + + @RenderBody() + + + + + + + @await RenderSectionAsync("Scripts", required: false) + + + From be3e8e59dcca8e122c93783cb7b632aefaef2d36 Mon Sep 17 00:00:00 2001 From: Boburmirzo <137428656+Boburm1rzo@users.noreply.github.com> Date: Sat, 19 Oct 2024 20:14:40 +0500 Subject: [PATCH 03/13] update authController --- .../Controllers/AuthController.cs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/CheckDrive.Web/CheckDrive.Web/Controllers/AuthController.cs b/CheckDrive.Web/CheckDrive.Web/Controllers/AuthController.cs index f226870f..105e2f55 100644 --- a/CheckDrive.Web/CheckDrive.Web/Controllers/AuthController.cs +++ b/CheckDrive.Web/CheckDrive.Web/Controllers/AuthController.cs @@ -25,23 +25,23 @@ public IActionResult Index() { 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"]; + 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; From e4a614030b85b44822d5f20abb93eb325e82852f Mon Sep 17 00:00:00 2001 From: Boburmirzo <137428656+Boburm1rzo@users.noreply.github.com> Date: Sat, 19 Oct 2024 20:15:58 +0500 Subject: [PATCH 04/13] configuration services --- .../CheckDrive.Web/Extensions/ConfigureServiceExtensions.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CheckDrive.Web/CheckDrive.Web/Extensions/ConfigureServiceExtensions.cs b/CheckDrive.Web/CheckDrive.Web/Extensions/ConfigureServiceExtensions.cs index 332e625f..3889bca9 100644 --- a/CheckDrive.Web/CheckDrive.Web/Extensions/ConfigureServiceExtensions.cs +++ b/CheckDrive.Web/CheckDrive.Web/Extensions/ConfigureServiceExtensions.cs @@ -10,6 +10,7 @@ using CheckDrive.Web.Stores.MechanicAcceptances; using CheckDrive.Web.Stores.MechanicHandovers; using CheckDrive.Web.Stores.Mechanics; +using CheckDrive.Web.Stores.Menu; using CheckDrive.Web.Stores.MockDashboard; using CheckDrive.Web.Stores.OilMarks; using CheckDrive.Web.Stores.OperatorReviews; @@ -42,7 +43,8 @@ public static IServiceCollection ConfigureDataStores(this IServiceCollection ser services.AddScoped(); services.AddScoped(); services.AddScoped(); - + services.AddScoped(); + services.AddScoped(); return services; } From f24facc4db1884b6c36cc9d5a0d804ade407672c Mon Sep 17 00:00:00 2001 From: Boburmirzo <137428656+Boburm1rzo@users.noreply.github.com> Date: Sat, 19 Oct 2024 20:17:23 +0500 Subject: [PATCH 05/13] Update DoctorReviewDataStore --- .../CheckDrive.Web/Stores/DoctorReviews/DoctorReviewDataStore.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/CheckDrive.Web/CheckDrive.Web/Stores/DoctorReviews/DoctorReviewDataStore.cs b/CheckDrive.Web/CheckDrive.Web/Stores/DoctorReviews/DoctorReviewDataStore.cs index ba057750..7eaa2561 100644 --- a/CheckDrive.Web/CheckDrive.Web/Stores/DoctorReviews/DoctorReviewDataStore.cs +++ b/CheckDrive.Web/CheckDrive.Web/Stores/DoctorReviews/DoctorReviewDataStore.cs @@ -1,6 +1,5 @@ using System.Text; using CheckDrive.ApiContracts.DoctorReview; -using CheckDrive.Web.Models; using CheckDrive.Web.Responses; using CheckDrive.Web.Service; using Newtonsoft.Json; From 5ac807f9df7e9f31a7939bb75ca267924b5e95cb Mon Sep 17 00:00:00 2001 From: Boburmirzo <137428656+Boburm1rzo@users.noreply.github.com> Date: Sat, 19 Oct 2024 20:17:48 +0500 Subject: [PATCH 06/13] added Menu Service and CurrentUser service --- .../Stores/Menu/IMenuService.cs | 6 + .../CheckDrive.Web/Stores/Menu/MenuService.cs | 179 ++++++++++++++++++ .../Stores/User/CurrentUserService.cs | 31 +++ .../Stores/User/ICurrentUserService.cs | 8 + 4 files changed, 224 insertions(+) create mode 100644 CheckDrive.Web/CheckDrive.Web/Stores/Menu/IMenuService.cs create mode 100644 CheckDrive.Web/CheckDrive.Web/Stores/Menu/MenuService.cs create mode 100644 CheckDrive.Web/CheckDrive.Web/Stores/User/CurrentUserService.cs create mode 100644 CheckDrive.Web/CheckDrive.Web/Stores/User/ICurrentUserService.cs diff --git a/CheckDrive.Web/CheckDrive.Web/Stores/Menu/IMenuService.cs b/CheckDrive.Web/CheckDrive.Web/Stores/Menu/IMenuService.cs new file mode 100644 index 00000000..d1123b0a --- /dev/null +++ b/CheckDrive.Web/CheckDrive.Web/Stores/Menu/IMenuService.cs @@ -0,0 +1,6 @@ +namespace CheckDrive.Web.Stores.Menu; + +public interface IMenuService +{ + List GetMenuItems(string role); +} diff --git a/CheckDrive.Web/CheckDrive.Web/Stores/Menu/MenuService.cs b/CheckDrive.Web/CheckDrive.Web/Stores/Menu/MenuService.cs new file mode 100644 index 00000000..33b94cda --- /dev/null +++ b/CheckDrive.Web/CheckDrive.Web/Stores/Menu/MenuService.cs @@ -0,0 +1,179 @@ +namespace CheckDrive.Web.Stores.Menu; + +public class MenuService : IMenuService +{ + public List GetMenuItems(string role) + { + List menuItems = new List(); + + if(role=="1") + { + menuItems.Add(new + { + text = "Dashboard", + iconCss = "fa-solid fa-home", + url = "/dashboard", + }); + + menuItems.Add(new + { + text = "Qarzlar", + iconCss = "fa-solid fa-file-invoice-dollar", + url = "/#", + }); + + menuItems.Add(new + { + text = "Umumiy", + separator = true, + }); + + menuItems.Add(new + { + text = "Ishchilar", + iconCss = "fas fa-users", + url = "/accounts" + }); + + menuItems.Add(new + { + text = "Avtomobillar", + iconCss = "fas fa-car", + url = "/cars" + }); + + menuItems.Add(new + { + text = "Yoqilg'ilar", + iconCss = "fa-solid fa-gas-pump", + url = "/#" + }); + + menuItems.Add(new + { + text = "Tekshiruvlar", + separator = true, + }); + + menuItems.Add(new + { + text = "Shifokor", + iconCss = "fa-solid fa-briefcase-medical", + url = "/doctorreviews" + }); + + menuItems.Add(new + { + text = "Mexanik (Topshirish)", + iconCss = "fa-solid fa-tools", + url = "/mechanichandovers" + }); + + menuItems.Add(new + { + text = "Operator", + iconCss = "fa-solid fa-headset", + url = "/OperatorReviews" + }); + + menuItems.Add(new + { + text = "Mexanik (Qabul qilish)", + iconCss = "fa-solid fa-car-on", + url = "/mechanicacceptances" + }); + + menuItems.Add(new + { + text = "Dispetcher", + iconCss = "fa-solid fa-user-gear", + url = "/DispatcherReviews" + }); + } + else if (role == "3") + { + menuItems.Add(new + { + text = "Asosiy sahifa", + iconCss = "fa-solid fa-house", + url = "/doctorreviews/personalindex" + }); + + menuItems.Add(new + { + text = "Tarixni ko'rish", + iconCss = "fa-solid fa-clock-rotate-left", + url = "/doctorreviews/historyindexforpersonalpage" + }); + } + else if (role == "4") + { + menuItems.Add(new + { + text = "Asosiy sahifa", + iconCss = "fa-solid fa-house", + url = "/operatorreviews/personalindex" + }); + + menuItems.Add(new + { + text = " Hisobot", + iconCss = "fa-regular fa-clipboard", + url = "/operatorreviews/reportindexforpersonalpage" + }); + + menuItems.Add(new + { + text = "Tarixni ko'rish", + iconCss = "fa-solid fa-clock-rotate-left", + url = "/operatorreviews/historyindexforpersonalpage" + }); + } + else if (role == "5") + { + menuItems.Add(new + { + text = "Asosiy sahifa", + iconCss = "fa-solid fa-house", + url = "/dispatcherreviews/personalindex" + }); + + menuItems.Add(new + { + text = "Tarixni ko'rish", + iconCss = "fa-solid fa-clock-rotate-left", + url = "/dispatcherreviews/historyindexforpersonalpage" + }); + } + else if (role == "6") + { + + menuItems.Add(new + { + id = "handoversItem", + text = "Topshirish", + iconCss = "fa-solid fa-tools", + url = "/mechanichandovers/personalindex" + }); + + + menuItems.Add(new + { + id="acceptancesItem", + text = "Qabul qilish", + iconCss = "fa-solid fa-car-on", + url = "/mechanicacceptances/personalindex" + }); + + menuItems.Add(new + { + id="historyItem", + text = "Tarixni ko'rish", + iconCss = "fa-solid fa-clock-rotate-left", + url = "/mechanicacceptances/historyindexforpersonalpage" + }); + } + + return menuItems; + } +} diff --git a/CheckDrive.Web/CheckDrive.Web/Stores/User/CurrentUserService.cs b/CheckDrive.Web/CheckDrive.Web/Stores/User/CurrentUserService.cs new file mode 100644 index 00000000..1c2461b5 --- /dev/null +++ b/CheckDrive.Web/CheckDrive.Web/Stores/User/CurrentUserService.cs @@ -0,0 +1,31 @@ +using System.IdentityModel.Tokens.Jwt; +using System.Security.Claims; + +namespace CheckDrive.Web.Stores.User; + +public class CurrentUserService:ICurrentUserService +{ + private readonly IHttpContextAccessor _httpContextAccessor; + + public CurrentUserService(IHttpContextAccessor httpContextAccessor) + { + _httpContextAccessor = httpContextAccessor; + } + public string GetRole() + { + var httpContext = _httpContextAccessor.HttpContext; + + if (httpContext == null || !httpContext.Request.Cookies.ContainsKey("tasty-cookies")) + { + return null; + } + + string token = httpContext.Request.Cookies["tasty-cookies"]; + var tokenHandler = new JwtSecurityTokenHandler(); + var jwtToken = tokenHandler.ReadToken(token) as JwtSecurityToken; + + var roleId = jwtToken.Claims.First(claim => claim.Type == ClaimTypes.Role).Value; + + return roleId; + } +} diff --git a/CheckDrive.Web/CheckDrive.Web/Stores/User/ICurrentUserService.cs b/CheckDrive.Web/CheckDrive.Web/Stores/User/ICurrentUserService.cs new file mode 100644 index 00000000..d29d80b6 --- /dev/null +++ b/CheckDrive.Web/CheckDrive.Web/Stores/User/ICurrentUserService.cs @@ -0,0 +1,8 @@ +using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal; + +namespace CheckDrive.Web.Stores.User; + +public interface ICurrentUserService +{ + string GetRole(); +} From 3904c5411a1c8faa34a44e756140195ad1cf0660 Mon Sep 17 00:00:00 2001 From: Boburmirzo <137428656+Boburm1rzo@users.noreply.github.com> Date: Sat, 19 Oct 2024 20:19:21 +0500 Subject: [PATCH 07/13] DispatcherReviews PersonalIndex and History pages updated --- .../HistoryIndexForPersonalPage.cshtml | 21 ------------------- .../DispatcherReviews/PersonalIndex.cshtml | 19 ----------------- 2 files changed, 40 deletions(-) diff --git a/CheckDrive.Web/CheckDrive.Web/Views/DispatcherReviews/HistoryIndexForPersonalPage.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/DispatcherReviews/HistoryIndexForPersonalPage.cshtml index ef0bed5b..0a608d23 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/DispatcherReviews/HistoryIndexForPersonalPage.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/DispatcherReviews/HistoryIndexForPersonalPage.cshtml @@ -2,30 +2,9 @@ @{ ViewData["Title"] = "HistoryIndexForPersonalPage"; Layout = "~/Views/Shared/_PersonalLayout.cshtml"; - string activeTab = "HistoryIndexForPersonalPage"; } -
-
- -
-
-
- -
diff --git a/CheckDrive.Web/CheckDrive.Web/Views/DispatcherReviews/PersonalIndex.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/DispatcherReviews/PersonalIndex.cshtml index 329afaa3..bc240a7e 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/DispatcherReviews/PersonalIndex.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/DispatcherReviews/PersonalIndex.cshtml @@ -4,29 +4,10 @@ @{ ViewData["Title"] = "PersonalIndex"; Layout = "~/Views/Shared/_PersonalLayout.cshtml"; - string activeTab = "PersonalIndex"; } -
-
- -
-
-
Moshina tarixi From 5517da6da081b52b3c7154f7da71818b0d5275b6 Mon Sep 17 00:00:00 2001 From: Boburmirzo <137428656+Boburm1rzo@users.noreply.github.com> Date: Sat, 19 Oct 2024 20:20:07 +0500 Subject: [PATCH 08/13] DoctorReview PersonalIndex and History pages updated --- .../HistoryIndexForPersonalPage.cshtml | 22 +---------------- .../Views/DoctorReviews/PersonalIndex.cshtml | 24 +------------------ 2 files changed, 2 insertions(+), 44 deletions(-) diff --git a/CheckDrive.Web/CheckDrive.Web/Views/DoctorReviews/HistoryIndexForPersonalPage.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/DoctorReviews/HistoryIndexForPersonalPage.cshtml index df9c8559..5b47cad6 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/DoctorReviews/HistoryIndexForPersonalPage.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/DoctorReviews/HistoryIndexForPersonalPage.cshtml @@ -4,31 +4,11 @@ @{ ViewData["Title"] = "HistoryIndexForPersonalPage"; Layout = "~/Views/Shared/_PersonalLayout.cshtml"; - string activeTab = "HistoryIndexForPersonalPage"; } -
-
- -
-
-
- -
+
diff --git a/CheckDrive.Web/CheckDrive.Web/Views/DoctorReviews/PersonalIndex.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/DoctorReviews/PersonalIndex.cshtml index 4268df48..b78f22da 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/DoctorReviews/PersonalIndex.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/DoctorReviews/PersonalIndex.cshtml @@ -1,34 +1,12 @@ @model IEnumerable - @{ ViewData["Title"] = "PersonalIndex"; Layout = "~/Views/Shared/_PersonalLayout.cshtml"; - string activeTab = "PersonalIndex"; + } -
-
- -
-
-
-
- -
From 8de95797c1fb95eb29ea4f521ddb7bc2cfef1c0d Mon Sep 17 00:00:00 2001 From: Boburmirzo <137428656+Boburm1rzo@users.noreply.github.com> Date: Sat, 19 Oct 2024 20:20:37 +0500 Subject: [PATCH 09/13] Mechanic Personal Index and History pages updated --- .../HistoryIndexForPersonalPage.cshtml | 20 ----------- .../MechanicAcceptances/PersonalIndex.cshtml | 34 +++---------------- .../HistoryIndexForPersonalPage.cshtml | 21 ------------ .../MechanicHandovers/PersonalIndex.cshtml | 27 +-------------- 4 files changed, 6 insertions(+), 96 deletions(-) diff --git a/CheckDrive.Web/CheckDrive.Web/Views/MechanicAcceptances/HistoryIndexForPersonalPage.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/MechanicAcceptances/HistoryIndexForPersonalPage.cshtml index 4c79dbc4..d502d705 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/MechanicAcceptances/HistoryIndexForPersonalPage.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/MechanicAcceptances/HistoryIndexForPersonalPage.cshtml @@ -6,28 +6,8 @@ string activeTab = "HistoryIndexForPersonalPage"; } -
-
- -
-
-
diff --git a/CheckDrive.Web/CheckDrive.Web/Views/MechanicAcceptances/PersonalIndex.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/MechanicAcceptances/PersonalIndex.cshtml index 62e570e3..3f97d2aa 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/MechanicAcceptances/PersonalIndex.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/MechanicAcceptances/PersonalIndex.cshtml @@ -6,33 +6,8 @@ Layout = "~/Views/Shared/_PersonalLayout.cshtml"; string activeTab = "MechanicAcceptances"; } -
-
- - -
-
- -
- +
@@ -46,6 +21,9 @@
+ + Yaratish +
- - Yaratish - +
diff --git a/CheckDrive.Web/CheckDrive.Web/Views/MechanicHandovers/HistoryIndexForPersonalPage.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/MechanicHandovers/HistoryIndexForPersonalPage.cshtml index 2a196df3..e66f9bf3 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/MechanicHandovers/HistoryIndexForPersonalPage.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/MechanicHandovers/HistoryIndexForPersonalPage.cshtml @@ -3,31 +3,10 @@ @{ ViewData["Title"] = "HistoryIndexForPersonalPage"; Layout = "~/Views/Shared/_PersonalLayout.cshtml"; - string activeTab = "HistoryIndexForPersonalPage"; } -
-
- -
-
-
diff --git a/CheckDrive.Web/CheckDrive.Web/Views/MechanicHandovers/PersonalIndex.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/MechanicHandovers/PersonalIndex.cshtml index 292d0f04..b830b477 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/MechanicHandovers/PersonalIndex.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/MechanicHandovers/PersonalIndex.cshtml @@ -4,35 +4,10 @@ @{ ViewData["Title"] = "Mechanic Handovers (Personal)"; Layout = "~/Views/Shared/_PersonalLayout.cshtml"; - string activeTab = "MechanicHandovers"; } -
-
- -
-
-
-
@@ -45,7 +20,6 @@
- Moshina tarixi
+ Moshina tarixi Yaratish From c343a96a055e799fb2963e65a5c8dc7bf18c845e Mon Sep 17 00:00:00 2001 From: Boburmirzo <137428656+Boburm1rzo@users.noreply.github.com> Date: Sat, 19 Oct 2024 20:21:15 +0500 Subject: [PATCH 10/13] OperatorReview Personal Index and History pages updated --- .../HistoryIndexForPersonalPage.cshtml | 24 --------------- .../OperatorReviews/PersonalIndex.cshtml | 24 --------------- .../ReportIndexForPersonalPage.cshtml | 29 +------------------ 3 files changed, 1 insertion(+), 76 deletions(-) diff --git a/CheckDrive.Web/CheckDrive.Web/Views/OperatorReviews/HistoryIndexForPersonalPage.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/OperatorReviews/HistoryIndexForPersonalPage.cshtml index da72be59..a9a25be3 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/OperatorReviews/HistoryIndexForPersonalPage.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/OperatorReviews/HistoryIndexForPersonalPage.cshtml @@ -4,34 +4,10 @@ @{ ViewData["Title"] = "HistoryIndexForPersonalPage"; Layout = "~/Views/Shared/_PersonalLayout.cshtml"; - string activeTab = "HistoryIndexForPersonalPage"; } -
-
- -
-
-
- -
diff --git a/CheckDrive.Web/CheckDrive.Web/Views/OperatorReviews/PersonalIndex.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/OperatorReviews/PersonalIndex.cshtml index 8bcc0a37..e3567328 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/OperatorReviews/PersonalIndex.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/OperatorReviews/PersonalIndex.cshtml @@ -4,34 +4,10 @@ @{ ViewData["Title"] = "PersonalIndex"; Layout = "~/Views/Shared/_PersonalLayout.cshtml"; - string activeTab = "PersonalIndex"; } -
-
- -
-
-
- -
diff --git a/CheckDrive.Web/CheckDrive.Web/Views/OperatorReviews/ReportIndexForPersonalPage.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/OperatorReviews/ReportIndexForPersonalPage.cshtml index 85237c69..28356f10 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/OperatorReviews/ReportIndexForPersonalPage.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/OperatorReviews/ReportIndexForPersonalPage.cshtml @@ -1,35 +1,8 @@ -@* - For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 -*@ -@{ +@{ ViewData["Title"] = "ReportIndexForPersonalPage"; Layout = "~/Views/Shared/_PersonalLayout.cshtml"; - string activeTab = "ReportIndexForPersonalPage"; } -
-
- -
-
-
- -
From 39162176e5ce5c0dcd1e2a648fca22a76d9e0fc7 Mon Sep 17 00:00:00 2001 From: Boburmirzo <137428656+Boburm1rzo@users.noreply.github.com> Date: Sat, 19 Oct 2024 20:21:37 +0500 Subject: [PATCH 11/13] Personal Layout changes --- .../Views/Shared/_PersonalLayout.cshtml | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/CheckDrive.Web/CheckDrive.Web/Views/Shared/_PersonalLayout.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/Shared/_PersonalLayout.cshtml index 8c780c36..9a3865cf 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/Shared/_PersonalLayout.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/Shared/_PersonalLayout.cshtml @@ -15,8 +15,41 @@ + + + + +
+
+
+
+
@RenderBody() - +
+
+
+
+
From f5c9b75e057afaaa4a425b356a972d580efa43cd Mon Sep 17 00:00:00 2001 From: Boburmirzo <137428656+Boburm1rzo@users.noreply.github.com> Date: Sat, 19 Oct 2024 20:22:44 +0500 Subject: [PATCH 12/13] Update SideBar Layout --- .../Views/Shared/_SideBar.cshtml | 89 ++----------------- 1 file changed, 8 insertions(+), 81 deletions(-) diff --git a/CheckDrive.Web/CheckDrive.Web/Views/Shared/_SideBar.cshtml b/CheckDrive.Web/CheckDrive.Web/Views/Shared/_SideBar.cshtml index b22df026..71947494 100644 --- a/CheckDrive.Web/CheckDrive.Web/Views/Shared/_SideBar.cshtml +++ b/CheckDrive.Web/CheckDrive.Web/Views/Shared/_SideBar.cshtml @@ -1,84 +1,11 @@ -@{ - List menuItems = new List(); - - menuItems.Add(new - { - text = "Dashboard", - iconCss = "fa-solid fa-home", - url = "/dashboard", - }); - - menuItems.Add(new - { - text = "Qarzlar", - iconCss = "fa-solid fa-file-invoice-dollar", - url = "/#", - }); - - menuItems.Add(new - { - text = "Umumiy", - separator = true, - }); - - menuItems.Add(new - { - text = "Ishchilar", - iconCss = "fas fa-users", - url = "/accounts" - }); - - menuItems.Add(new - { - text = "Avtomobillar", - iconCss = "fas fa-car", - url = "/cars" - }); - - menuItems.Add(new - { - text = "Yoqilg'ilar", - iconCss = "fa-solid fa-gas-pump", - url = "/#" - }); - - menuItems.Add(new - { - text = "Tekshiruvlar", - separator = true, - }); - menuItems.Add(new - { - text = "Shifokor", - iconCss = "fa-solid fa-briefcase-medical", - url = "/doctorreviews" - }); - menuItems.Add(new - { - text = "Mexanik (Topshirish)", - iconCss = "fa-solid fa-tools", - url = "/mechanichandovers" - }); - menuItems.Add(new - { - text = "Operator", - iconCss = "fa-solid fa-headset", - url = "/OperatorReviews" - }); - menuItems.Add(new - { - text = "Mexanik (Qabul qilish)", - iconCss = "fa-solid fa-car-on", - url = "/mechanicacceptances" - }); - menuItems.Add(new - { - text = "Dispetcher", - iconCss = "fa-solid fa-user-gear", - url = "/DispatcherReviews" - }); - - TempData.Keep("UserName"); +@using CheckDrive.Web.Stores.Menu; +@using CheckDrive.Web.Stores.User +@inject ICurrentUserService currentUserService; +@inject IMenuService menuService; + +@{ + var role = currentUserService.GetRole(); + var menuItems = menuService.GetMenuItems(role); } Date: Sat, 19 Oct 2024 08:47:10 -0700 Subject: [PATCH 13/13] fixed --- CheckDrive.Web/CheckDrive.Web/Stores/User/CurrentUserService.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/CheckDrive.Web/CheckDrive.Web/Stores/User/CurrentUserService.cs b/CheckDrive.Web/CheckDrive.Web/Stores/User/CurrentUserService.cs index 1c2461b5..50353761 100644 --- a/CheckDrive.Web/CheckDrive.Web/Stores/User/CurrentUserService.cs +++ b/CheckDrive.Web/CheckDrive.Web/Stores/User/CurrentUserService.cs @@ -11,6 +11,7 @@ public CurrentUserService(IHttpContextAccessor httpContextAccessor) { _httpContextAccessor = httpContextAccessor; } + public string GetRole() { var httpContext = _httpContextAccessor.HttpContext;