From 7981812499e335991a862cf4f73c4e569e2411d6 Mon Sep 17 00:00:00 2001 From: shola Date: Fri, 5 Dec 2025 19:22:24 +0700 Subject: [PATCH] feat: slicing cms slider --- Controllers/SliderUtamaController.cs | 75 ++++ Views/Shared/Layouts/App/_Sidebar.cshtml | 9 +- Views/Shared/Layouts/Landing/_Footer.cshtml | 10 +- Views/SliderUtama/Index.cshtml | 407 ++++++++++++++++++++ 4 files changed, 495 insertions(+), 6 deletions(-) create mode 100644 Controllers/SliderUtamaController.cs create mode 100644 Views/SliderUtama/Index.cshtml diff --git a/Controllers/SliderUtamaController.cs b/Controllers/SliderUtamaController.cs new file mode 100644 index 0000000..8abdc48 --- /dev/null +++ b/Controllers/SliderUtamaController.cs @@ -0,0 +1,75 @@ +using Microsoft.AspNetCore.Mvc; + +namespace BpsRwApp.Controllers +{ + [Route("[controller]/[action]")] + public class SliderUtamaController : AppControllerBase + { + public IActionResult Index() + { + return View(); + } + + [HttpGet] + public IActionResult Table() + { + var data = Enumerable.Range(1, 3) + .Select(index => + { + var isPublished = index % 3 != 0; + var publishToggle = isPublished + ? $"" + : $""; + + return new + { + no = index, + judul = "Pengelolaan Sampah Lingkup Rukun Warga", + deskripsi = "Program dari Dinas Lingkungan Hidup Provinsi Jakarta yang bertujuan untuk mengoptimalkan pengelolaan sampah di tingkat RW", + gambar = "/images/hero-bg.png", + publish = publishToggle, + aksi = "
" + + $"" + + $"" + + "
", + }; + }) + .ToArray(); + + var response = new + { + data = data + }; + + return Json(response); + } + + [HttpPost] + public IActionResult Create() + { + // create data + return Json(new { success = true, message = "Slider berhasil ditambahkan" }); + } + + [HttpPost] + public IActionResult Update() + { + // update data + return Json(new { success = true, message = "Slider berhasil diupdate" }); + } + + [HttpPost] + public IActionResult Delete(int id) + { + // delete data + return Json(new { success = true, message = "Slider berhasil dihapus" }); + } + + [HttpPost] + public IActionResult TogglePublish(int id, bool isPublished) + { + // publish status + return Json(new { success = true, message = $"Status publish berhasil diubah menjadi {(isPublished ? "Published" : "Unpublished")}" }); + } + } +} diff --git a/Views/Shared/Layouts/App/_Sidebar.cshtml b/Views/Shared/Layouts/App/_Sidebar.cshtml index aacd07f..f07ba91 100644 --- a/Views/Shared/Layouts/App/_Sidebar.cshtml +++ b/Views/Shared/Layouts/App/_Sidebar.cshtml @@ -266,9 +266,16 @@
  • -
    +
    CMS
      +
    • + + text_fields + Slider Utama + +
    • diff --git a/Views/Shared/Layouts/Landing/_Footer.cshtml b/Views/Shared/Layouts/Landing/_Footer.cshtml index 0de098d..763de7c 100644 --- a/Views/Shared/Layouts/Landing/_Footer.cshtml +++ b/Views/Shared/Layouts/Landing/_Footer.cshtml @@ -25,19 +25,19 @@ diff --git a/Views/SliderUtama/Index.cshtml b/Views/SliderUtama/Index.cshtml new file mode 100644 index 0000000..ac115bd --- /dev/null +++ b/Views/SliderUtama/Index.cshtml @@ -0,0 +1,407 @@ +@{ + ViewData["Title"] = "Slider Utama"; +} + + + + + + + +
      +

      Slider Utama

      +
      + + +
      +
      + + +
      +
      + + + + + + + + + + + + +
      NoJudulDeskripsiGambarPublishAksi
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file