diff --git a/Views/Shared/Components/Table/_Control.cshtml b/Areas/Shared/Components/Table/_Control.cshtml similarity index 100% rename from Views/Shared/Components/Table/_Control.cshtml rename to Areas/Shared/Components/Table/_Control.cshtml diff --git a/Views/Shared/Components/Table/_Pagination.cshtml b/Areas/Shared/Components/Table/_Pagination.cshtml similarity index 100% rename from Views/Shared/Components/Table/_Pagination.cshtml rename to Areas/Shared/Components/Table/_Pagination.cshtml diff --git a/Views/Shared/_LayoutApp.cshtml b/Areas/Shared/Layouts/App/_Layout.cshtml similarity index 91% rename from Views/Shared/_LayoutApp.cshtml rename to Areas/Shared/Layouts/App/_Layout.cshtml index 1799852..d872d30 100644 --- a/Views/Shared/_LayoutApp.cshtml +++ b/Areas/Shared/Layouts/App/_Layout.cshtml @@ -41,14 +41,16 @@
- @await Html.PartialAsync("_Navbar") + +
@RenderBody()
- @await Html.PartialAsync("_Sidebar") + +
diff --git a/Views/Shared/_Navbar.cshtml b/Areas/Shared/Layouts/App/_Navbar.cshtml similarity index 100% rename from Views/Shared/_Navbar.cshtml rename to Areas/Shared/Layouts/App/_Navbar.cshtml diff --git a/Views/Shared/_Sidebar.cshtml b/Areas/Shared/Layouts/App/_Sidebar.cshtml similarity index 100% rename from Views/Shared/_Sidebar.cshtml rename to Areas/Shared/Layouts/App/_Sidebar.cshtml diff --git a/Areas/Shared/Layouts/App/_ViewImports.cshtml b/Areas/Shared/Layouts/App/_ViewImports.cshtml new file mode 100644 index 0000000..7c4f6f4 --- /dev/null +++ b/Areas/Shared/Layouts/App/_ViewImports.cshtml @@ -0,0 +1,2 @@ +@using BankSampahApp +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers \ No newline at end of file diff --git a/Areas/Sudin/Controllers/DashboardController.cs b/Areas/Sudin/Controllers/DashboardController.cs new file mode 100644 index 0000000..a8219d0 --- /dev/null +++ b/Areas/Sudin/Controllers/DashboardController.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNetCore.Mvc; + +namespace BankSampahApp.Areas.Sudin.Controllers +{ + [Area("Sudin")] + public class DashboardController : Controller + { + public IActionResult Index() + { + return View(); + } + } +} diff --git a/Controllers/DataBankSampahController.cs b/Areas/Sudin/Controllers/DataBankSampahController.cs similarity index 59% rename from Controllers/DataBankSampahController.cs rename to Areas/Sudin/Controllers/DataBankSampahController.cs index d69a212..28e7c51 100644 --- a/Controllers/DataBankSampahController.cs +++ b/Areas/Sudin/Controllers/DataBankSampahController.cs @@ -1,10 +1,11 @@ using Microsoft.AspNetCore.Mvc; -namespace BankSampahApp.Controllers +namespace BankSampahApp.Areas.Sudin.Controllers { + [Area("Sudin")] public class DataBankSampahController : Controller { - public ActionResult Index() + public IActionResult Index() { return View(); } diff --git a/Controllers/DataOfftakerController.cs b/Areas/Sudin/Controllers/DataOfftakerController.cs similarity index 73% rename from Controllers/DataOfftakerController.cs rename to Areas/Sudin/Controllers/DataOfftakerController.cs index 842c9ac..a0fdd3d 100644 --- a/Controllers/DataOfftakerController.cs +++ b/Areas/Sudin/Controllers/DataOfftakerController.cs @@ -1,7 +1,8 @@ using Microsoft.AspNetCore.Mvc; -namespace BankSampahApp.Controllers +namespace BankSampahApp.Areas.Sudin.Controllers { + [Area("Sudin")] public class DataOfftakerController : Controller { public IActionResult Index() diff --git a/Controllers/TransaksiLaporanController.cs b/Areas/Sudin/Controllers/TransaksiLaporanController.cs similarity index 73% rename from Controllers/TransaksiLaporanController.cs rename to Areas/Sudin/Controllers/TransaksiLaporanController.cs index 9d46e3e..3c1c51a 100644 --- a/Controllers/TransaksiLaporanController.cs +++ b/Areas/Sudin/Controllers/TransaksiLaporanController.cs @@ -1,7 +1,8 @@ using Microsoft.AspNetCore.Mvc; -namespace BankSampahApp.Controllers +namespace BankSampahApp.Areas.Sudin.Controllers { + [Area("Sudin")] public class TransaksiLaporanController : Controller { public IActionResult Index() diff --git a/Views/Dashboard/Index.cshtml b/Areas/Sudin/Views/Dashboard/Index.cshtml similarity index 99% rename from Views/Dashboard/Index.cshtml rename to Areas/Sudin/Views/Dashboard/Index.cshtml index 2e947e4..a5e84b7 100644 --- a/Views/Dashboard/Index.cshtml +++ b/Areas/Sudin/Views/Dashboard/Index.cshtml @@ -1,6 +1,6 @@ @{ - Layout = "_LayoutApp"; ViewData["Title"] = "Dashboard"; + ViewData["Role"] = "sudin"; ViewData["DashboardActive"] = "menu-active"; } diff --git a/Views/DataBankSampah/Index.cshtml b/Areas/Sudin/Views/DataBankSampah/Index.cshtml similarity index 97% rename from Views/DataBankSampah/Index.cshtml rename to Areas/Sudin/Views/DataBankSampah/Index.cshtml index 38253c9..5332a47 100644 --- a/Views/DataBankSampah/Index.cshtml +++ b/Areas/Sudin/Views/DataBankSampah/Index.cshtml @@ -1,5 +1,4 @@ @{ - Layout = "_LayoutApp"; ViewData["Title"] = "Data Bank Sampah"; ViewData["DataBankSampahActive"] = "menu-active"; } @@ -55,7 +54,7 @@
- @await Html.PartialAsync("Components/Table/_Control") +
@@ -190,6 +189,6 @@
- @await Html.PartialAsync("Components/Table/_Pagination") +
\ No newline at end of file diff --git a/Views/DataOfftaker/Index.cshtml b/Areas/Sudin/Views/DataOfftaker/Index.cshtml similarity index 97% rename from Views/DataOfftaker/Index.cshtml rename to Areas/Sudin/Views/DataOfftaker/Index.cshtml index 30d31e0..bf9ba92 100644 --- a/Views/DataOfftaker/Index.cshtml +++ b/Areas/Sudin/Views/DataOfftaker/Index.cshtml @@ -1,5 +1,4 @@ @{ - Layout = "_LayoutApp"; ViewData["Title"] = "Data Offtaker"; ViewData["DataOfftakerActive"] = "menu-active"; } @@ -49,7 +48,7 @@
- @await Html.PartialAsync("Components/Table/_Control") +
@@ -181,6 +180,6 @@
- @await Html.PartialAsync("Components/Table/_Pagination") +
\ No newline at end of file diff --git a/Views/TransaksiLaporan/Index.cshtml b/Areas/Sudin/Views/TransaksiLaporan/Index.cshtml similarity index 97% rename from Views/TransaksiLaporan/Index.cshtml rename to Areas/Sudin/Views/TransaksiLaporan/Index.cshtml index 92302ca..ce04801 100644 --- a/Views/TransaksiLaporan/Index.cshtml +++ b/Areas/Sudin/Views/TransaksiLaporan/Index.cshtml @@ -1,5 +1,4 @@ @{ - Layout = "_LayoutApp"; ViewData["Title"] = "Transaksi Laporan"; ViewData["TransaksiLaporanActive"] = "menu-active"; } diff --git a/Areas/Sudin/Views/_ViewImports.cshtml b/Areas/Sudin/Views/_ViewImports.cshtml new file mode 100644 index 0000000..7c4f6f4 --- /dev/null +++ b/Areas/Sudin/Views/_ViewImports.cshtml @@ -0,0 +1,2 @@ +@using BankSampahApp +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers \ No newline at end of file diff --git a/Areas/Sudin/Views/_ViewStart.cshtml b/Areas/Sudin/Views/_ViewStart.cshtml new file mode 100644 index 0000000..4cf0c1a --- /dev/null +++ b/Areas/Sudin/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "/Areas/Shared/Layouts/App/_Layout.cshtml"; +} diff --git a/BankSampahApp.csproj b/BankSampahApp.csproj index 5c9bafc..0348c12 100644 --- a/BankSampahApp.csproj +++ b/BankSampahApp.csproj @@ -34,4 +34,10 @@ + + + + + + \ No newline at end of file diff --git a/Controllers/DashboardController.cs b/Controllers/DashboardController.cs deleted file mode 100644 index 0a2f456..0000000 --- a/Controllers/DashboardController.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Microsoft.AspNetCore.Mvc; - -namespace BankSampahApp.Controllers -{ - public class DashboardController : Controller - { - // GET: DashboardController - public ActionResult Index() - { - return View(); - } - - } -} diff --git a/Program.cs b/Program.cs index 45efd97..cf5036b 100644 --- a/Program.cs +++ b/Program.cs @@ -116,8 +116,8 @@ app.UseAuthorization(); // Map routes with .NET 9 improvements app.MapControllerRoute( - name: "default", - pattern: "{controller=Home}/{action=Index}/{id?}"); + name: "areas", + pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}"); // Health check endpoint app.MapGet("/health", () => Results.Ok(new {