| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- @model Admin.ViewModels.Forum.Board.Manager.IndexViewModel
- @using Library.Extensions
- @{
- ViewData["Title"] = "게시판 관리 - 관리자";
- ViewData["BoardID"] = Model.BoardID;
- ViewData["BoardList"] = Model.BoardList;
- ViewData["QueryString"] = Model.QueryString;
- }
- <div class="container">
- <partial name="~/Views/Forum/Board/_Header.cshtml" />
- <partial name="_StatusMessage" />
- <partial name="~/Views/Forum/Board/_Navbar.cshtml" />
- <form id="fAdminWrite" asp-action="Create" method="post" accept-charset="utf-8" autocomplete="off">
- <input type="hidden" name="boardID" value="@Model.BoardID" />
- <div class="row g-2">
- <label class="col-lg-1 col-form-label">관리자</label>
- <div class="col-12 col-sm-auto">
- @if (Model.AdminList != null)
- {
- <select name="UserId" class="form-select" required>
- <option value="">선택하세요.</option>
- @if (Model.AdminList != null)
- {
- @foreach (var row in Model.AdminList)
- {
- <option value="@row.Id">
- @row.Email - @row.FullName
- </option>
- }
- }
- </select>
- }
- </div>
- <div class="col-auto col-sm-auto col-form-label">
- <div class="form-check form-check-inline">
- <input type="checkbox" name="CanEdit" id="CanEdit" class="form-check-input" checked value="true" />
- <label for="CanEdit" class="form-check-label">수정</label>
- </div>
- </div>
- <div class="col-auto col-sm-auto col-form-label">
- <div class="form-check form-check-inline">
- <input type="checkbox" name="CanDelete" id="CanDelete" class="form-check-input" checked value="true" />
- <label for="CanDelete" class="form-check-label">삭제</label>
- </div>
- </div>
- <div class="col-12 col-sm-auto text-center">
- <button type="submit" class="btn btn-primary w-100">등록</button>
- </div>
- </div>
- </form>
-
- <hr/>
- <div class="row g-2 align-items-end">
- <div class="col">
- Total : @Model.Total.ToString("N0")
- </div>
- <div class="col text-end">
- <button type="button" id="btnListDelete" class="btn btn-sm btn-danger" form="fAdminList" data-action="/Forum/Board/Manager/@Model.BoardID/Delete" disabled>삭제</button>
- <button type="submit" id="btnListSave" class="btn btn-sm btn-success" form="fAdminList" @(Model.Total <= 0 ? "disabled" : "")> 저장</button>
- </div>
- </div>
- <div class="table-responsive">
- <form id="fAdminList" asp-action="Update" method="post" accept-charset="utf-8" autocomplete="off">
- <input type="hidden" name="BoardID" value="@Model.BoardID" />
- <table class="table table-striped table-bordered table-hover mt-3">
- <caption>
- 게시판을 운영할 수 있는 관리자를 등록합니다.
- </caption>
- <colgroup>
- <col width="10%"/>
- <col width="*"/>
- <col width="12%"/>
- <col width="12%"/>
- <col width="15%"/>
- <col width="15%"/>
- </colgroup>
- <thead>
- <tr>
- <th>
- <div class="form-check form-check-inline">
- <input type="checkbox" id="checkedAll" class="form-check-input" value="1" />
- <label for="checkedAll" class="form-check-label">ID</label>
- </div>
- </th>
- <th>관리자</th>
- <th>수정 권한</th>
- <th>삭제 권한</th>
- <th>등록일시</th>
- <th>수정일시</th>
- </tr>
- </thead>
- <tbody>
- @if (Model.Data == null || !Model.Data.Any())
- {
- <tr>
- <td colspan="6">No Data.</td>
- </tr>
- }
- else
- {
- @foreach (var row in Model.Data)
- {
- var index = Model.Data.IndexOf(row);
- <tr>
- <td>
- <div class="form-check form-check-inline">
- <input type="checkbox" name="CheckList[]" id="CheckList_@index" class="form-check-input list-check-box" value="@row.ID" />
- <label for="CheckList_@index" class="form-check-label">@row.ID</label>
- </div>
- <input type="hidden" name="Items[@index].ID" value="@row.ID" />
- <input type="hidden" name="Items[@index].UserId" value="@row.UserId" />
- </td>
- <td>@row.User.Email</td>
- <td>
- <div class="form-check form-check-inline">
- <input type="checkbox" name="Items[@index].CanEdit" id="Items_@(index)_CanEdit" class="form-check-input" checked="@row.CanEdit" value="true" />
- <label for="Items_@(index)_CanEdit" class="form-check-label">수정</label>
- </div>
- </td>
- <td>
- <div class="form-check form-check-inline">
- <input type="checkbox" name="Items[@index].CanDelete" id="Items_@(index)_CanDelete" class="form-check-input" checked="@row.CanDelete" value="true" />
- <label for="Items_@(index)_CanDelete" class="form-check-label">삭제</label>
- </div>
- </td>
- <td>@row.CreatedAt.GetDateAt()</td>
- <td>@(row.UpdatedAt.GetDateAt() ?? "-")</td>
- </tr>
- }
- }
- </tbody>
- </table>
- </form>
- </div>
- </div>
- @section Scripts {
- <script>
- // 저장
- $(document).on("click", "#btnListSave", function() {
- if (confirm("저장 하시겠습니까?")) {
- let form = document.getElementById("fAdminList");
- if (form.checkValidity()) { // HTML5 폼 검증 수행
- form.submit();
- } else {
- form.reportValidity();
- }
- }
- return false;
- });
- </script>
- }
|