| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- @model Admin.ViewModels.Forum.Board.Meta.IndexViewModel
- @using Library.Constants
- @{
- ViewData["Title"] = "게시판 관리 - 알림";
- var notifyList = Model.NotifyList;
- }
- <div class="container">
- <partial name="~/Views/Forum/Board/Meta/_Header.cshtml" />
- <partial name="_StatusMessage" />
- <partial name="~/Views/Forum/Board/Meta/_Navbar.cshtml" />
- <form name="f_admin_write" id="fAdminWrite" method="post" accept-charset="utf-8" autocomplete="off" action="/Forum/Board/Meta/Update/Notify" enctype="multipart/form-data">
- <input type="hidden" name="BoardMeta.Board.Code" value="@Model.Board.Code" />
- <input type="hidden" asp-for="BoardMeta.ID" />
- <input type="hidden" asp-for="BoardMeta.BoardID" />
- <h5>이메일 알림</h5>
- <p class="text-muted form-text">이메일 알림이 양식에 맞추어 아래 대상자에게 발송됩니다.</p>
- <div class="row mb-3">
- <label class="col-md-2 col-form-label">게시글 작성 시</label>
- <div class="col-md-10 align-self-center">
- @if (notifyList is not null) {
- @foreach (var item in notifyList)
- {
- var notifyValue = (BoardConst.Notify)Enum.Parse(typeof(BoardConst.Notify), item.Value);
- <div class="form-check form-check-inline">
- <input type="checkbox" name="PostWriteNotify[]" value="@item.Value" id="postWriteNotify_@item.Value" class="form-check-input" checked="@Model.BoardMeta.Notify.PostWriteNotifyEnum.HasFlag(notifyValue)" />
- <label for="postWriteNotify_@item.Value" class="form-check-label">@item.Text</label>
- </div>
- }
- }
- </div>
- </div>
- <div class="row mb-3">
- <label class="col-md-2 col-form-label">댓글 작성 시</label>
- <div class="col-md-10 align-self-center">
- @if (notifyList is not null) {
- @foreach (var item in notifyList)
- {
- var notifyValue = (BoardConst.Notify)Enum.Parse(typeof(BoardConst.Notify), item.Value);
- <div class="form-check form-check-inline">
- <input type="checkbox" name="CommentWriteNotify[]" value="@item.Value" id="commentWriteNotify_@item.Value" class="form-check-input" checked="@Model.BoardMeta.Notify.CommentWriteNotifyEnum.HasFlag(notifyValue)" />
- <label for="commentWriteNotify_@item.Value" class="form-check-label">@item.Text</label>
- </div>
- }
- }
- </div>
- </div>
- <div class="row mb-3">
- <label for="Notify_ReplyWriteNotify" class="col-md-2 col-form-label">답글 작성 시</label>
- <div class="col-md-10 align-self-center">
- @if (notifyList is not null) {
- @foreach (var item in notifyList)
- {
- var notifyValue = (BoardConst.Notify)Enum.Parse(typeof(BoardConst.Notify), item.Value);
- <div class="form-check form-check-inline">
- <input type="checkbox" name="ReplyWriteNotify[]" value="@item.Value" id="replyWriteNotify_@item.Value" class="form-check-input" checked="@Model.BoardMeta.Notify.ReplyWriteNotifyEnum.HasFlag(notifyValue)" />
- <label for="replyWriteNotify_@item.Value" class="form-check-label">@item.Text</label>
- </div>
- }
- }
- </div>
- </div>
- <input type="hidden" name="BoardMeta.Notify.PostWriteNotify" id="PostWriteNotifyValue" />
- <input type="hidden" name="BoardMeta.Notify.CommentWriteNotify" id="CommentWriteNotifyValue" />
- <input type="hidden" name="BoardMeta.Notify.ReplyWriteNotify" id="ReplyWriteNotifyValue" />
- <hr/>
- <div class="d-grid gap-2 text-center d-md-block">
- <button type="submit" class="btn btn-sm btn-success">저장</button>
- <a href="/Forum/Board/List?@ViewBag.QueryString" class="btn btn-sm btn-secondary">취소</a>
- </div>
- </form>
- </div>
- @section Scripts {
- <script>
- document.addEventListener("DOMContentLoaded", function () {
- function calculateFlagValue(groupName) {
- let checkboxes = document.querySelectorAll(`input[name="${groupName}[]"]:checked`);
- let flagValue = 0;
- checkboxes.forEach(checkbox => {
- flagValue |= parseInt(checkbox.value, 10);
- });
- document.getElementById(`${groupName}Value`).value = flagValue;
- }
- function updateAllFlags() {
- calculateFlagValue("PostWriteNotify");
- calculateFlagValue("CommentWriteNotify");
- calculateFlagValue("ReplyWriteNotify");
- }
- document.querySelectorAll('input[type="checkbox"]').forEach(checkbox => {
- checkbox.addEventListener("change", updateAllFlags);
- });
- document.getElementById("fAdminWrite").addEventListener("submit", (e) => {
- updateAllFlags();
- });
- });
- </script>
- }
|