내정보 공지사항 : 검색 제외
This commit is contained in:
@@ -23,7 +23,7 @@ class GetNoticeDao implements GetNoticePortOut {
|
||||
@Override
|
||||
@Transactional
|
||||
public Optional<GetNotice> operate(GetNoticeCmd command) {
|
||||
GetNotice secArticle = mapper.getNotice(command.getId());
|
||||
GetNotice secArticle = mapper.getNotice(command);
|
||||
|
||||
List<GetNoticeUploadFile> setArticleUploadFile =
|
||||
mapper.getUploadFiles(command.getId());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package app.module.core.usecase.notice.getNotice.adapters.persistence;
|
||||
|
||||
import app.module.core.usecase.notice.getNotice.ports.application.domain.GetNotice;
|
||||
import app.module.core.usecase.notice.getNotice.ports.application.domain.GetNoticeCmd;
|
||||
import app.module.core.usecase.notice.getNotice.ports.application.domain.GetNoticeUploadFile;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@@ -8,6 +9,8 @@ import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface GetNoticeMapper {
|
||||
GetNotice getNotice(Long id);
|
||||
|
||||
GetNotice getNotice(GetNoticeCmd command);
|
||||
|
||||
List<GetNoticeUploadFile> getUploadFiles(Long id);
|
||||
}
|
||||
|
||||
@@ -24,4 +24,8 @@ public class GetNotice {
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
private List<GetNoticeUploadFile> uploadFiles;
|
||||
public boolean getNewDate() {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
return now.toLocalDate().isEqual(createdAt.toLocalDate());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,6 @@ import lombok.Setter;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetNoticeCmd {
|
||||
|
||||
private Long id;
|
||||
private String searchOpen;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class GetNoticesDao implements GetNoticesPortOut {
|
||||
mapper.getUploadFiles(
|
||||
contents.stream().map(GetNoticesDto::getId)
|
||||
.collect(Collectors.toList()),
|
||||
FileUploadType.EXAMPLE_REP));
|
||||
FileUploadType.NOTICE));
|
||||
|
||||
return new PageImpl<>(
|
||||
contents.stream()
|
||||
@@ -49,6 +49,8 @@ class GetNoticesDao implements GetNoticesPortOut {
|
||||
article.getId(),
|
||||
article.getUpdatedBy(),
|
||||
article.getUpdatedAt(),
|
||||
article.getCreatedBy(),
|
||||
article.getCreatedAt(),
|
||||
article.getTitle(),
|
||||
article.getContent(),
|
||||
article.getVisible(),
|
||||
|
||||
@@ -13,6 +13,8 @@ public class GetNoticesDto {
|
||||
private Long id;
|
||||
private String updatedBy;
|
||||
private LocalDateTime updatedAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime createdAt;
|
||||
private String title;
|
||||
private String content;
|
||||
private Boolean visible;
|
||||
|
||||
@@ -15,10 +15,17 @@ public class GetNotices {
|
||||
private Long id;
|
||||
private String updatedBy;
|
||||
private LocalDateTime updatedAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime createdAt;
|
||||
private String title;
|
||||
private String content;
|
||||
private Boolean visible;
|
||||
private LocalDateTime startDate;
|
||||
private LocalDateTime endDate;
|
||||
private GetNoticeFiles uploadFile;
|
||||
|
||||
public boolean getNewDate() {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
return now.toLocalDate().isEqual(createdAt.toLocalDate());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,17 @@
|
||||
FROM notice a
|
||||
WHERE a.id = #{id}
|
||||
AND a.is_deleted = false
|
||||
|
||||
<if test="searchOpen != null and searchOpen != ''">
|
||||
<choose>
|
||||
<when test="searchOpen eq 'true'">
|
||||
AND a.visible = true
|
||||
</when>
|
||||
<when test="searchOpen eq 'false'">
|
||||
AND a.visible = false
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
a.id,
|
||||
a.updated_by,
|
||||
a.updated_at,
|
||||
a.created_by,
|
||||
a.created_at,
|
||||
a.title,
|
||||
a.content,
|
||||
a.visible,
|
||||
@@ -52,6 +54,9 @@
|
||||
<when test="order.property eq 'endDate'">a.end_date</when>
|
||||
<when test="order.property eq 'updatedBy'">a.updated_by</when>
|
||||
<when test="order.property eq 'updatedAt'">a.updated_at</when>
|
||||
<when test="order.property eq 'createdBy'">a.created_by</when>
|
||||
<when test="order.property eq 'createdAt'">a.created_at</when>
|
||||
<otherwise>a.id</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="order.direction.toString() eq 'DESC'">DESC</when>
|
||||
|
||||
@@ -3,7 +3,14 @@ package app.module.front.usecase.info;
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import app.module.core.usecase.household.getHousehold.ports.GetHouseholdPortIn;
|
||||
import app.module.core.usecase.household.getHousehold.ports.application.domain.GetHouseholdCmd;
|
||||
import app.module.core.usecase.notice.getNotices.ports.GetNoticesPortIn;
|
||||
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNotices;
|
||||
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNoticesCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -14,8 +21,24 @@ class GetInfoUIController {
|
||||
|
||||
private final GetHouseholdPortIn getHouseholdPortIn;
|
||||
|
||||
private final GetNoticesPortIn getNoticesPortIn;
|
||||
|
||||
|
||||
@GetMapping(path = "/info")
|
||||
String operate(Model model) {
|
||||
String operate(Model model
|
||||
,@PageableDefault(sort = "createdAt", direction = Sort.Direction.DESC, page = 0, size = 5) Pageable pageable) {
|
||||
|
||||
|
||||
//공지사항
|
||||
Page<GetNotices> notices =
|
||||
getNoticesPortIn.operate(
|
||||
pageable,
|
||||
new GetNoticesCmd(null, null, "true"));
|
||||
model.addAttribute("notice", notices.hasContent()
|
||||
? notices.getContent().get(0)
|
||||
: null);
|
||||
|
||||
|
||||
|
||||
//TODO 일계부를 등록하지 않은 날짜 처리 필요
|
||||
boolean isUnregisteredDate = false;
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package app.module.front.usecase.info.notice.getNoticeUI.adapters.web;
|
||||
|
||||
import app.module.core.usecase.notice.getNotice.ports.GetNoticePortIn;
|
||||
import app.module.core.usecase.notice.getNotice.ports.application.domain.GetNoticeCmd;
|
||||
import app.module.core.usecase.notice.getNotices.ports.GetNoticesPortIn;
|
||||
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNotices;
|
||||
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNoticesCmd;
|
||||
import app.module.front.usecase.article.getArticles.adapters.web.model.GetArticlesReqVO;
|
||||
import app.module.front.usecase.info.notice.getNoticeUI.adapters.web.model.GetNoticeUIReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class GetNoticeUIController {
|
||||
|
||||
private final GetNoticePortIn getNoticePortIn;
|
||||
|
||||
@GetMapping(path = "/info/notice/{id}")
|
||||
String operate(@PathVariable Long id, Model model, GetNoticeUIReqVO reqVO) {
|
||||
|
||||
reqVO.setId(id);
|
||||
|
||||
model.addAttribute("notice", getNoticePortIn.operate(
|
||||
new GetNoticeCmd(
|
||||
reqVO.getId(),"true")).orElse(null));
|
||||
return "info/notice/{id}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.module.front.usecase.info.notice.getNoticeUI.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetNoticeUIReqVO {
|
||||
private long id;
|
||||
}
|
||||
@@ -1,9 +1,20 @@
|
||||
package app.module.front.usecase.info.notice.getNoticesUI.adapters.web;
|
||||
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import app.module.core.usecase.article.getArticles.ports.application.domain.GetArticles;
|
||||
import app.module.core.usecase.article.getArticles.ports.application.domain.GetArticlesCmd;
|
||||
import app.module.core.usecase.household.getHousehold.ports.GetHouseholdPortIn;
|
||||
import app.module.core.usecase.household.getHousehold.ports.application.domain.GetHouseholdCmd;
|
||||
import app.module.core.usecase.notice.getNotices.ports.GetNoticesPortIn;
|
||||
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNotices;
|
||||
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNoticesCmd;
|
||||
import app.module.front.usecase.article.getArticles.adapters.web.model.GetArticlesReqVO;
|
||||
import app.module.front.usecase.info.notice.getNoticesUI.adapters.web.model.GetNoticesReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -12,13 +23,21 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
@RequiredArgsConstructor
|
||||
class GetNoticesUIController {
|
||||
|
||||
private final GetHouseholdPortIn getHouseholdPortIn;
|
||||
private final GetNoticesPortIn getNoticesPortIn;
|
||||
|
||||
@GetMapping(path = "/info/notice")
|
||||
String operate(Model model) {
|
||||
String operate(Model model, @PageableDefault(sort = "createdAt", direction = Sort.Direction.DESC, page = 0, size = 5) Pageable pageable, GetNoticesReqVO reqVO) {
|
||||
reqVO.setSearchOpen("true");
|
||||
|
||||
Page<GetNotices> notices =
|
||||
getNoticesPortIn.operate(
|
||||
pageable,
|
||||
new GetNoticesCmd(
|
||||
reqVO.getSearchField(), reqVO.getSearchValue(), reqVO.getSearchOpen()));
|
||||
|
||||
model.addAttribute("notices", notices);
|
||||
|
||||
|
||||
model.addAttribute("userInfo",
|
||||
getHouseholdPortIn.operate(new GetHouseholdCmd(CommonUtil.getLoginUsername())).orElseThrow());
|
||||
|
||||
return "info/notice/notices";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package app.module.front.usecase.info.notice.getNoticesUI.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetNoticesReqVO {
|
||||
|
||||
private String searchField;
|
||||
private String searchValue;
|
||||
private String searchOpen;
|
||||
}
|
||||
@@ -18,6 +18,7 @@ uri.front.info.user=\uAC1C\uC778\uC815\uBCF4
|
||||
uri.front.info.user.path=/info/user
|
||||
uri.front.info.user.password=\uBE44\uBC00\uBC88\uD638 \uD655\uC778
|
||||
uri.front.info.notice=\uACF5\uC9C0\uC0AC\uD56D
|
||||
uri.front.info.notice.{{pathVar}}=\uACF5\uC9C0\uC0AC\uD56D
|
||||
uri.front.info.notice.path=/info/notice
|
||||
uri.front.info.monthly=\uC6D4\uBCC4 \uC784\uC0B0\uBB3C \uD604\uD669
|
||||
uri.front.info.monthly.path=/info/monthly
|
||||
|
||||
@@ -35,6 +35,29 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div th:fragment="paginationCommon(items)">
|
||||
<nav class="component-pagination" aria-label="페이지네이션">
|
||||
|
||||
<a th:href="|javascript:goPageable(0, ${items.pageable.pageSize}, '${items.pageable.sort}')|" class="pagination-item first"><span class="hide-txt">첫 페이지로 이동</span></a>
|
||||
<a th:href="|javascript:goPageable(${items.pageable.pageNumber - 1}, ${items.pageable.pageSize}, '${items.pageable.sort}')|" class="pagination-item prev"><span class="hide-txt">이전 페이지로 이동</span></a>
|
||||
|
||||
|
||||
<th:block th:each="idx : ${#numbers.sequence(0, items.totalPages == 0 ? 0 : items.totalPages - 1)}">
|
||||
<th:block th:if="${idx == items.pageable.pageNumber}">
|
||||
<span class="pagination-item" aria-current="page" th:text="${idx+1}"></span>
|
||||
</th:block>
|
||||
<th:block th:if="${idx != items.pageable.pageNumber}">
|
||||
<a th:href="|javascript:goPageable(${idx}, ${items.pageable.pageSize}, '${items.pageable.sort}')|" class="pagination-item" th:text="${idx+1}"></a>
|
||||
</th:block>
|
||||
</th:block>
|
||||
|
||||
<a th:href="|javascript:goPageable(${items.pageable.pageNumber + 1}, ${items.pageable.pageSize}, '${items.pageable.sort}')|" class="pagination-item next"><span class="hide-txt">다음 페이지로 이동</span></a>
|
||||
<a th:href="|javascript:goPageable(${items.pageable.pageNumber-1}, ${items.pageable.pageSize}, '${items.pageable.sort}')|" class="pagination-item last"><span class="hide-txt">마지막 페이지로 이동</span></a>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -26,11 +26,13 @@
|
||||
<dd class="location" th:text="${userInfo?.address}"></dd><!-- TODO 임가 주소 위치 임시로 . 처리함. -->
|
||||
<dd class="date" th:if="${latestRegisteredDate != null or !#strings.isEmpty(latestRegisteredDate)}" th:text="${'최근등록: '+latestRegisteredDate}"></dd>
|
||||
</dl>
|
||||
<th:block th:if="${notice != null}">
|
||||
<a th:href="@{'/info/notice/' + ${notice.id}}" class="notice-box">
|
||||
<p class="tit">공지사항</p>
|
||||
<p class="txt" th:text="${notice.title}"></p>
|
||||
</a>
|
||||
</th:block>
|
||||
|
||||
<a href="/info/notice/1" class="notice-box"><!-- TODO 공지사항 작성후 처리 필요 -->
|
||||
<p class="tit">공지사항</p>
|
||||
<p class="txt">2025 임가경제조사 실시 안내</p>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -2,127 +2,88 @@
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<div layout:fragment="content">
|
||||
<main id="content" role="main">
|
||||
<div layout:fragment="content" th:classappend="'mypage-wrap'">
|
||||
<main id="content" role="main">
|
||||
<div class="inner">
|
||||
<section class="search-area">
|
||||
<div id="select3" class="component-select bottom-sheet" data-props-default="제목 + 내용" data-props-type="bottomSheet">
|
||||
<button type="button" class="select-box">
|
||||
<span class="select-txt">제목 + 내용</span>
|
||||
</button>
|
||||
<div class="select-options">
|
||||
<div class="select-header">
|
||||
<p>검색 분류 선택</p>
|
||||
<button type="button" class="select-close">
|
||||
<span class="hide-txt">닫기</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="select-scroll">
|
||||
<ul class="">
|
||||
<li class="option current" data-value="option1">제목 + 내용</li>
|
||||
<li class="option" data-value="option2">제목</li>
|
||||
<li class="option" data-value="option3">내용</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="temp_input_ico_id_0001" placeholder="검색어를 입력해 주세요">
|
||||
<i class="input-field-ico ico-search" aria-hidden="true"></i>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<hr>
|
||||
|
||||
<style>
|
||||
label {
|
||||
display: inline-block;
|
||||
width: 150px;
|
||||
}
|
||||
<section class="list-area" th:unless="${notices.content.size() > 0}">
|
||||
<div class="no-data">
|
||||
<i class="ico-nodata ico-large" aria-hidden="true"></i>
|
||||
<p>조회 가능한 목록이 없습니다.</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
div {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
<section class="list-area" th:if="${notices.content.size() > 0}">
|
||||
<p class="total-num">
|
||||
총 <strong th:text="${notices.totalElements}"></strong>건
|
||||
</p>
|
||||
<ul>
|
||||
|
||||
.invalid-feedback {
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
}
|
||||
<li th:each="item : ${notices.content}">
|
||||
<a th:href="@{'/info/notice/' + ${item.id}}">
|
||||
<p class="list-tit" th:text="${item.title}"></p>
|
||||
<p class="list-info">
|
||||
<span class="date" th:text="${#temporals.format(item.createdAt, 'yyyy.MM.dd')}">2025.05.28</span>
|
||||
<span class="badge" th:if="${item.newDate}">NEW</span>
|
||||
</p>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
.is-invalid + .invalid-feedback {
|
||||
display: block;
|
||||
}
|
||||
</ul>
|
||||
|
||||
input[readonly] {
|
||||
background-color: #e9ecef;
|
||||
color: #6c757d;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div>
|
||||
<form
|
||||
method="get"
|
||||
name="reqForm"
|
||||
th:action="@{/user/info}" th:object="${userInfo}">
|
||||
|
||||
<input type="hidden" name="id" th:value="*{seq}">
|
||||
<div th:replace="common/list-components :: paginationCommon(${notices})"></div>
|
||||
|
||||
<div>
|
||||
<label for="householdNum">임가번호</label>
|
||||
<input id="householdNum" name="householdNum" placeholder="아이디" readonly="readonly" th:field="*{householdNum}"
|
||||
type="text">
|
||||
<div class="invalid-feedback field-id"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="ownerName">경영주</label>
|
||||
<input id="ownerName" name="ownerName" placeholder="경영주 이름" th:field="*{ownerName}" type="text">
|
||||
<div class="invalid-feedback field-id"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="ownerAge">만나이</label>
|
||||
<input id="ownerAge" name="ownerAge" placeholder="나이" th:field="*{ownerAge}" type="text">
|
||||
<div class="invalid-feedback field-id"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="tel">가구연락처</label>
|
||||
<input id="tel" name="tel" placeholder="가구연락처" th:field="*{tel}" type="text">
|
||||
<div class="invalid-feedback field-id"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="phone">핸드폰번호</label>
|
||||
<input id="phone" name="phone" placeholder="핸드폰번호" th:field="*{phone}" type="text">
|
||||
<div class="invalid-feedback field-id"></div>
|
||||
</div>
|
||||
<!-- <div>-->
|
||||
<!-- <label for="region">시.도</label>-->
|
||||
<!-- <input id="region" name="region" placeholder="시.도" th:field="*{region}" type="text">-->
|
||||
<!-- <div class="invalid-feedback field-id"></div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div>-->
|
||||
<!-- <label for="city">시.군.도</label>-->
|
||||
<!-- <input id="city" name="city" placeholder="시.군.도" th:field="*{city}" type="text">-->
|
||||
<!-- <div class="invalid-feedback field-id"></div>-->
|
||||
<!-- </div>-->
|
||||
<div>
|
||||
<label for="addressDetail">전체 주소</label>
|
||||
<input id="addressDetail" name="addressDetail" placeholder="세부 주소" th:field="*{address}" type="text">
|
||||
<div class="invalid-feedback field-id"></div>
|
||||
</div>
|
||||
</form>
|
||||
<button onclick="updateUser();">수정하기</button>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script>
|
||||
const updateUser = () => {
|
||||
const f = document.reqForm;
|
||||
const obj = $(f).serializeObject();
|
||||
|
||||
// 기존 에러 메세지 초기화
|
||||
$('.is-invalid').removeClass('is-invalid');
|
||||
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
url: '/api/front/household/update',
|
||||
data: obj,
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success(res) {
|
||||
if (confirm(`'${res.ownerName} 님의' 정보가 수정되었습니다.`)) {
|
||||
location.reload();
|
||||
}
|
||||
},
|
||||
statusCode: {
|
||||
'422': (res) => {
|
||||
const fieldErrors = res.responseJSON.fieldErrors;
|
||||
$(fieldErrors).each(function (idx, error) {
|
||||
let target = $(f).find('[name=' + error.field + ']');
|
||||
target.addClass('is-invalid');
|
||||
|
||||
target.parent().find('.invalid-feedback').text(error.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
<script th:inline="javascript">
|
||||
let ENV = {
|
||||
httpUrl: {
|
||||
root: /*[[#{uri.front.info.notice.path}]]*/'detailUrl',
|
||||
notice: /*[[#{uri.front.info.notice.path}]]*/'noticeUrl'
|
||||
},
|
||||
module:{
|
||||
confirmPopup : null
|
||||
},
|
||||
submitted: false,
|
||||
};
|
||||
</script>
|
||||
|
||||
</section>
|
||||
|
||||
72
front/src/main/resources/templates/info/notice/{id}.html
Normal file
72
front/src/main/resources/templates/info/notice/{id}.html
Normal file
@@ -0,0 +1,72 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<div layout:fragment="content" th:classappend="'mypage-wrap'">
|
||||
<main id="content" role="main">
|
||||
<div class="detail-wrap">
|
||||
<div class="inner">
|
||||
<dl class="detail-tit-group">
|
||||
<dt th:text="${notice.title}"></dt>
|
||||
<dd>[[${#temporals.format(notice.createdAt, 'yyyy.MM.dd')}]] <span class="badge" th:if="${notice.newDate}">new</span></dd>
|
||||
</dl>
|
||||
<div class="detail-content">
|
||||
<p th:utext="${notice.content}"></p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="download-file" th:if="${!#lists.isEmpty(notice.uploadFiles)}">
|
||||
<p class="tit">첨부파일</p>
|
||||
<ul>
|
||||
<li th:each="item : ${notice.uploadFiles}"><a th:href="${item.attachmentURL}" download th:text="${item.originName}"></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-list btn-full" onclick="formControl.goList()">
|
||||
<span class="btn-txt">목록</span>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
root: /*[[|#{uri.front.info.user.path}/password|]]*/'rootUrl',
|
||||
<section layout:fragment="script">
|
||||
<script th:inline="javascript">
|
||||
let ENV = {
|
||||
httpUrl: {
|
||||
root: /*[[#{uri.front.info.notice.path}]]*/'detailUrl',
|
||||
notice: /*[[#{uri.front.info.notice.path}]]*/'noticeUrl'
|
||||
},
|
||||
module:{
|
||||
confirmPopup : null
|
||||
},
|
||||
submitted: false,
|
||||
};
|
||||
let formControl = {
|
||||
init() {
|
||||
|
||||
},
|
||||
goList(){
|
||||
/**
|
||||
* TODO 외부 유입에 따라 history.back과 location.href 가 적절하게 사용되어야함...
|
||||
* 전체적인 수정 필요.(이전 페이지
|
||||
*/
|
||||
const previousUrl = document.referrer;
|
||||
|
||||
if (previousUrl.includes('/info/notice')) {
|
||||
history.back();
|
||||
} else {
|
||||
location.href = '/info/notice';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
</section>
|
||||
|
||||
</html>
|
||||
@@ -47,6 +47,10 @@
|
||||
user: /*[[#{uri.front.info.user.path}]]*/'userUrl',
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
submitted: false,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user