Index.cshtml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. @page
  2. @model Admin.Pages.Popup.IndexModel
  3. @{
  4. ViewData["Title"] = "팝업 관리";
  5. }
  6. <div class="container-fluid">
  7. <h3>@ViewData["Title"]</h3>
  8. <hr />
  9. <partial name="_StatusMessage" />
  10. <div class="row g-2 align-items-end">
  11. <div class="col">
  12. Total : @Model.Total
  13. </div>
  14. <div class="col-auto">
  15. <select name="perPage" id="perPage" class="form-select w-auto d-inline-block" form="fAdminSearch">
  16. <option value="10" selected="@(Model.Query.PerPage == 10)">10</option>
  17. <option value="20" selected="@(Model.Query.PerPage == 20)">20</option>
  18. <option value="50" selected="@(Model.Query.PerPage == 50)">50</option>
  19. <option value="100" selected="@(Model.Query.PerPage == 100)">100</option>
  20. </select>
  21. </div>
  22. <div class="col-auto">
  23. <button type="button" id="btnListDelete" class="btn btn-danger" form="fAdminList" disabled>삭제</button>
  24. <a class="btn btn-success" asp-page="/Popup/Write">추가</a>
  25. </div>
  26. </div>
  27. <div class="table-responsive">
  28. <table class="table table-striped table-bordered table-hover mt-3">
  29. <colgroup>
  30. <col style="width: 5%;" />
  31. <col style="width: 25%;" />
  32. <col />
  33. <col style="width: 12%;" />
  34. <col style="width: 12%;" />
  35. <col style="width: 6%;" />
  36. <col style="width: 6%;" />
  37. <col style="width: 12%;" />
  38. <col style="width: 10%;" />
  39. </colgroup>
  40. <thead>
  41. <tr>
  42. <th>
  43. <div class="form-check-inline">
  44. <input type="checkbox" id="checkedAll" class="form-check-input" value="1" form="fAdminList" />
  45. <label for="checkedAll">ID</label>
  46. </div>
  47. </th>
  48. <th>제목</th>
  49. <th>주소</th>
  50. <th>시작</th>
  51. <th>종료</th>
  52. <th>순서</th>
  53. <th>사용</th>
  54. <th>등록일시</th>
  55. <th>비고</th>
  56. </tr>
  57. </thead>
  58. <tbody>
  59. @if (Model.List == null || Model.Total <= 0)
  60. {
  61. <tr>
  62. <td colspan="9">No Data.</td>
  63. </tr>
  64. }
  65. else
  66. {
  67. @foreach (var row in Model.List)
  68. {
  69. <tr>
  70. <td>
  71. <div class="form-check-inline">
  72. <input type="checkbox" name="ids[]" id="ids_@row.ID" class="form-check-input list-check-box" value="@row.ID" form="fAdminList" />
  73. <label for="ids_@row.ID">@row.ID</label>
  74. </div>
  75. </td>
  76. <td class="text-start">@row.Subject</td>
  77. <td>
  78. @if (!string.IsNullOrWhiteSpace(row.Link) && row.Link != "-")
  79. {
  80. <a href="@row.Link" target="_blank" rel="external">
  81. <i class="bi bi-box-arrow-up-right"></i> @row.Link
  82. </a>
  83. }
  84. else
  85. {
  86. <text>-</text>
  87. }
  88. </td>
  89. <td>@row.StartAt</td>
  90. <td>@row.EndAt</td>
  91. <td>@row.Order</td>
  92. <td>@(row.IsActive ? "Y" : "N")</td>
  93. <td>@row.CreatedAt</td>
  94. <td>
  95. <div class="d-xl-flex gap-2 justify-content-center d-grid">
  96. <a class="btn btn-sm btn-outline-info" href="@row.EditURL">수정</a>
  97. <button type="button" class="btn btn-sm btn-outline-danger btn-row-delete" data-id="@row.ID" data-subject="@row.Subject">삭제</button>
  98. </div>
  99. </td>
  100. </tr>
  101. }
  102. }
  103. </tbody>
  104. </table>
  105. <partial name="_Pagination" model="@Model.Pagination" />
  106. </div>
  107. </div>
  108. <form id="fAdminSearch" method="get" accept-charset="utf-8">
  109. <input type="hidden" name="pageNum" value="@Model.Query.PageNum" />
  110. </form>
  111. <form id="fAdminList" method="post" accept-charset="utf-8" asp-page-handler="Delete">
  112. @Html.AntiForgeryToken()
  113. <input type="hidden" name="pageNum" value="@Model.Query.PageNum" />
  114. <input type="hidden" name="perPage" value="@Model.Query.PerPage" />
  115. </form>
  116. @section Scripts {
  117. <script>
  118. let searchForm = document.getElementById("fAdminSearch");
  119. $(document).on("change", "#perPage", function () {
  120. searchForm.submit();
  121. });
  122. </script>
  123. }