Index.cshtml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. @using bitforum.Helpers;
  2. @{
  3. ViewData["Title"] = "FAQ 관리";
  4. var faqCategories = ViewBag.FaqCategories as List<bitforum.Models.Page.Faq.FaqCategory>;
  5. var faqItems = ViewBag.FaqItems as List<bitforum.Models.Page.Faq.FaqItem>;
  6. var total = (ViewBag.Total ?? 0).ToString("N0");
  7. var pagination = ViewBag.Pagination as bitforum.Models.Pagination;
  8. }
  9. <partial name="~/Views/Page/Faq/_Navbar.cshtml" />
  10. <div class="container-fluid">
  11. <h3>@ViewData["Title"]</h3>
  12. <hr />
  13. <partial name="_StatusMessage" />
  14. <div class="row g-2 mb-2">
  15. <div class="col">
  16. <select name="category_id" id="categoryID" class="form-select w-auto">
  17. <option value="">선택하세요.</option>
  18. @foreach (var row in faqCategories)
  19. {
  20. <option value="@row.ID" selected="@(row.ID == ViewBag.CategoryID ? "selected" : null)">@row.Subject (@row.FaqItem.Count)</option>
  21. }
  22. </select>
  23. </div>
  24. </div>
  25. <div class="row g-2 align-items-end">
  26. <div class="col">
  27. Total : @total
  28. </div>
  29. <div class="col text-end">
  30. <button type="button" id="btnListDelete" class="btn btn-sm btn-danger" form="fAdminList" data-action="/Page/Faq/Item/Delete">삭제</button>
  31. <a href="/Page/Faq/Item/Write" class="btn btn-sm btn-success">추가</a>
  32. </div>
  33. </div>
  34. <form name="f_admin_list" id="fAdminList" method="post" accept-charset="utf-8" autocomplete="off"></form>
  35. <div class="table-responsive">
  36. <table class="table table-striped table-bordered table-hover mt-3">
  37. <colgroup>
  38. <col width="2%" />
  39. <col width="5%" />
  40. <col width="30%" />
  41. <col width="*" />
  42. <col width="*" />
  43. <col width="*" />
  44. <col width="*" />
  45. <col width="*" />
  46. <col width="*" />
  47. </colgroup>
  48. <thead>
  49. <tr>
  50. <th><input type="checkbox" id="checkedAll" class="form-check-input" value="1" form="fAdminList" /></th>
  51. <th>ID</th>
  52. <th>질문</th>
  53. <th>순서</th>
  54. <th>사용</th>
  55. <th>조회 수</th>
  56. <th>등록일시</th>
  57. <th>수정일시</th>
  58. <th>비고</th>
  59. </tr>
  60. </thead>
  61. <tbody>
  62. @if (faqItems == null || !faqItems.Any())
  63. {
  64. <tr>
  65. <td colspan="9">No Data.</td>
  66. </tr>
  67. }
  68. else
  69. {
  70. @foreach (var row in faqItems)
  71. {
  72. <tr>
  73. <td>
  74. <input type="checkbox" name="ids[]" class="form-check-input list-check-box" value="@row.ID" form="fAdminList" />
  75. </td>
  76. <td>@row.ID</td>
  77. <td>
  78. <span class="badge text-bg-secondary">[@row.FaqCategory.Subject]</span> @row.Question
  79. </td>
  80. <td>@row.Order</td>
  81. <td>@(row.IsActive ? "Y" : "N")</td>
  82. <td>@row.Views</td>
  83. <td>@row.CreatedAt.GetDateAt()</td>
  84. <td>@row.UpdatedAt.GetDateAt()</td>
  85. <td>
  86. <div class="d-grid gap-2 d-md-block">
  87. <a href="/Page/Faq/Item/@row.ID/Edit" class=" btn btn-sm btn-outline-info">수정</a>
  88. <a href="/Page/Faq/Item/@row.ID/Delete" class="btn btn-sm btn-outline-danger btn-row-delete">삭제</a>
  89. </div>
  90. </td>
  91. </tr>
  92. }
  93. }
  94. </tbody>
  95. </table>
  96. <partial name="_Pagination" model="pagination" />
  97. </div>
  98. </div>
  99. <script type="module">
  100. $(document).on("change", "#categoryID", function () {
  101. location.href = ("/Page/Faq/Item/" + $(this).val());
  102. });
  103. </script>