Files
sake/src/main/webapp/WEB-INF/views/sopmal/mpage/act/MyM2mQaR.jsp
2025-12-26 17:57:23 +09:00

361 lines
18 KiB
Plaintext

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="ui" uri="http://www.winbit.kr/ctl/ui"%>
<%@ taglib prefix="f" uri="/WEB-INF/tlds/f.tld"%>
<%--
Class Name : MyM2mQaR.jsp
Description : 마이페이지 1:1문의
Modification Information
수정일 수정자 수정내용
------- -------- ---------------------------
2024-04-11 김혜인 최초 생성
--%>
<!DOCTYPE html>
<html lang="ko">
<head>
<%-- 공통 include --%>
<jsp:include page="/WEB-INF/views/comm/Include.jsp"/>
</head>
<spring:eval expression="@environment.getProperty('sopmalfo.common.fileupload.cdnurl')" var="cdnurl"/>
<script>
$(document).ready(function() {
//아코디언 클릭 시 폼 제출 방지
$(".tr-foldable-trigger").click(function(event) {
if($(this).next().hasClass("active")){
const bbscttInnb = $(this).attr("bbsctt-innb");
const idx = $(this).index();
fn_select_fileInfo(bbscttInnb,idx);
}
event.preventDefault(); // 폼 제출 방지
});
//삭제 모달 버튼
$(document).on('click','.deleteBtn',function(){
const bbscttInnb = $(this).closest('div').find("[name='bbscttInnb']").val();
const goodsInnb = $(this).closest('div').find("[name='goodsInnb']").val();
$('#qna-delete').modal();
$('#alertDelBtn').attr('bbscttInnb', bbscttInnb);
$('#alertDelBtn').attr('goodsInnb', goodsInnb);
});
//삭제 버튼
$(document).on('click','#alertDelBtn',function(){
const bbscttInnb = $(this).attr("bbscttInnb");
const goodsInnb = $(this).attr("goodsInnb");
const bbsId = $("#bbsId").val();
const bbsTyCd = $("#bbsTyCd").val();
fn_delete_bbsctt(bbscttInnb,bbsId,bbsTyCd,goodsInnb);
});
//수정 폼 이동 버튼
$(document).on('click','.updateBtn',function(){
const answAt = $(this).closest('div').find("[name='answAt']").val();
const bbscttInnb = $(this).closest('div').find("[name='bbscttInnb']").val();
const bbsId = $("#bbsId").val();
fn_move_qaUpdt(bbscttInnb,answAt,bbsId);
});
});
//해당 게시물 파일정보 get
const fn_select_fileInfo = (bbscttInnb, idx) => {
$.ajax({
type: "post",
url: "/sopmal/mpage/act/selectFileInfo",
data: {"bbscttInnb": bbscttInnb},
success: function (data) {
const resultData = JSON.parse(data.resBody.result);
const fileInfo = resultData.fileInfo;
let img = '';
fileInfo.forEach(function (file) {
img += `<img src="${cdnurl}\${file.filCours}\${file.sysFilNm}\" alt="\${file.orginlFilNm}\"
onerror="this.src='/pc/images/image_placeholder.png'; this.style.width='150px'; this.style.height='150px';"/>`;
});
$(".tr-foldable").eq(idx).find(".file").html(img);
}
});
}
//게시글 삭제
const fn_delete_bbsctt =(bbscttInnb,bbsId,bbsTyCd,goodsInnb)=>{
$.ajax({
type: "post",
url: "/sopmal/csc/deleteBbscttDel",
data: {
"delBbscttInnbArr": bbscttInnb,
"bbsId": bbsId,
"bbsTyCd": bbsTyCd,
"goodsInnbArr": goodsInnb
},
success: function () {
alert('<spring:message code="success.common.delete"/>');
fn_close_modal('qna-delete');
location.reload();
}
});
}
//페이징 목록 조회
const fn_select_List = (pageIndex) => {
const form = $('<form>', {
'action': '/sopmal/mpage/act/selectM2mQnaInqire',
'method': 'post'
}).append(
$('<input>', {
'type': 'hidden',
'name': 'bbsId',
'value': $("#bbsId").val()
})
).append(
$('<input>', {
'type': 'hidden',
'name': 'pageIndex',
'value': pageIndex
})
);
$('body').append(form);
form.submit();
}
//게시글 수정
const fn_move_qaUpdt =(bbscttInnb,answAt,bbsId)=>{
/* if(answAt == 'Y'){
//1.1 답변이 있는지 확인 있으면 수정 불가 모달 호출
$('#qna-edit').modal();
}else{*/
//1.2답변이 없는 경우 폼을 생성하고 전송
const form = $('<form>', {
'action': '/sopmal/mpage/act/selectM2mQnaDtlUpdtForm',
'method': 'post'
}).append(
$('<input>', {
'type': 'hidden',
'name': 'bbscttInnb',
'value': bbscttInnb
})
).append(
$('<input>', {
'type': 'hidden',
'name': 'bbsId',
'value': bbsId
})
).append(
$('<input>', {
'type': 'hidden',
'name': 'pageIndex',
'value': $("#pageIndex").val()
})
);
$('body').append(form);
form.submit();
}
//주문상세 이동
const fn_move_ordr_dtl =(sopmalCd,ordrInnb)=>{
const form = $('<form>', {
'action': '<c:url value="/sopmal/mpage/ordr/selectMbrOrdrDtlInqire"/>',
'method': 'get',
'target': '_self'
}).append(
$('<input>', {
'type': 'hidden',
'name': 'sopmalCd',
'value': sopmalCd
})
).append(
$('<input>', {
'type': 'hidden',
'name': 'ordrInnb',
'value': ordrInnb
})
);
$('body').append(form);
form.submit();
}
</script>
<body>
<%-- 공통 Header --%>
<jsp:include page="/WEB-INF/views/comm/Header.jsp"/>
<!-- 메인 컨텐츠 영역 -->
<main>
<div class="sub-wrapper">
<div class="sub-content">
<div class="sub-rl">
<%-- 마이페이지 Left 영역 --%>
<jsp:include page="/WEB-INF/views/comm/mpage/MypageLeft.jsp"/>
<div class="sub-right-content">
<%-- 마이페이지 Right 영역 --%>
<jsp:include page="/WEB-INF/views/comm/mpage/MypageRight.jsp"/>
<c:set value="${resultMap.bbsInfo}" var = "bbsInfo"/>
<input type = "hidden" value = "<c:out value="${bbsInfo.bbsId}"/>" id = "bbsId">
<input type = "hidden" value = "<c:out value="${bbsInfo.bbsTyCd}"/>" id = "bbsTyCd">
<input type="hidden" name="slangFlterUseAt" id = "slangFlterUseAt" value = "<c:out value="${bbsInfo.slangFlterUseAt}"/>">
<div class="sub-right-content__section">
<h3 class="sub-right-content__title"><c:out value="${bbsInfo.bbsNm}"/></h3>
<div class="table-wrapper">
<table class="table vertical">
<caption>해당 테이블에 대한 설명</caption>
<!-- 각 열 width 설정 -->
<colgroup>
<col style="width: 10%;">
<col style="width: 18%;">
<col style="width: auto;">
<col style="width: 15%;">
<col style="width: 10%">
</colgroup>
<thead>
<tr>
<th>번호</th>
<th>주문번호</th>
<th>문의내용</th>
<th>작성일</th>
<th>답변유무</th>
</tr>
</thead>
<tbody>
<c:choose>
<c:when test = "${ not empty resultMap.resultList.resultList }">
<c:forEach var="resultList" items="${ resultMap.resultList.resultList}">
<tr class="tr-foldable-trigger" bbsctt-innb = "<c:out value = '${resultList.bbscttInnb}'/>">
<td><span class="board-number"><c:out value="${resultMap.paginationInfo.totalRecordCount - resultList.rnum+1 }" /></span></td>
<td class="text-left">
<div class="board-inner-product">
<div class="board-inner-product__right">
<a class="board-inner-product__name" href="" onclick = "fn_move_ordr_dtl('<c:out value="${bbsInfo.sopmalCd}"/>', '<c:out value="${resultList.ordrInnb}"/>'); return false;">
<c:out value="${resultList.ordrInnb}"/>
</a>
</div>
</div>
</td>
<td class="text-left">
<div class="board-inner-product">
<div class="board-inner-product__right">
<p class="board-inner-product__title">
<span class="category"><c:if test = "${not empty resultList.answCn}">[<c:out value="${resultList.answCn}"/>]</c:if></span>
<c:out value="${resultList.sj}"/>
</p>
</div>
</div>
</td>
<td><span class="board-date"><c:out value="${resultList.sumRegistDt}"/></span></td>
<td>
<c:choose>
<c:when test = "${not empty resultList.answBbscttInnb}">
<span class="text-complete">답변완료</span>
</c:when>
<c:otherwise>
<span class="text-waiting">답변대기</span>
</c:otherwise>
</c:choose>
</td>
</tr>
<tr class="tr-foldable">
<td colspan="5">
<div class="tr-foldable__content">
<div class="tr-foldable__qna">
<i class="icon icon_qna-q"></i>
<div class="tr-foldable__qna-content">
<p class="tr-foldable__qna-title"><c:out value="${resultList.sj}"/></p>
<div class = "cn" style="white-space: pre-wrap;"><c:out value="${resultList.cn}" /></div>
<br>
<div class = "file"></div>
</div>
</div>
<div class="tr-foldable__qna">
<i class="icon icon_qna-a"></i>
<div class="tr-foldable__qna-content">
<p class="tr-foldable__qna-title answSj"><c:out value="${resultList.answSj}"/></p>
<c:choose>
<c:when test = "${not empty resultList.answBbscttInnb}">
<div class = "cn ck-content"><c:out value="${resultList.answBbscttCn}" escapeXml="false"/></div>
</c:when>
<c:otherwise>
답변 등록 중 입니다.
</c:otherwise>
</c:choose>
</div>
</div>
<div class="tr-foldable__btn-container">
<input type = "hidden" name = "answAt"
value = <c:choose>
<c:when test = "${not empty resultList.answBbscttInnb}">
'Y'
</c:when>
<c:otherwise>
'N'
</c:otherwise>
</c:choose>>
<input type = "hidden" name = "bbscttInnb" value = <c:out value="${resultList.bbscttInnb}"/>>
<input type = "hidden" name = "goodsInnb" value = <c:out value="${resultList.goodsInnb}"/>>
<button type = "button" class="btn outline deleteBtn"><spring:message code="button.delete"/></button>
<c:if test = "${empty resultList.answBbscttInnb}">
<button type = "button" class="btn theme outline updateBtn"><spring:message code="button.update"/></button>
</c:if>
</div>
</div>
</td>
</tr>
</c:forEach>
</c:when>
<c:otherwise>
<tr>
<td colspan="4">
<div class="table__no-result">
<img src="/pc/images/icon__no-result.png" alt="조회 내역 없음">
<p class="table__no-result-text">
<spring:message code="common.nodata"/>
</p>
</div>
</td>
</tr>
</c:otherwise>
</c:choose>
</tbody>
</table>
</div>
<input type="hidden" id="pageIndex" name="pageIndex" value="<c:out value = '${resultMap.bbsctt.pageIndex}'/>" />
<div class="pagination__container">
<ui:pagination paginationInfo="${resultMap.paginationInfo}" type="image" jsFunction="fn_select_List" />
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<%-- 공통 Footer --%>
<jsp:include page="/WEB-INF/views/comm/Footer.jsp"/>
<!-- 질문 삭제 모달 -->
<div id="qna-delete" class="modal alert">
<div class="alert-content">
<p class="alert-content__text--sm">
삭제된 게시글은 복구할 수 없습니다.
<br>
정말로 삭제 하시겠습니까?
</p>
</div>
<div class="alert-btn-container">
<a href="#" rel="modal:close" class="alert-btn alert-btn--cancel">취소</a>
<button type="button" class="alert-btn alert-btn--confirm" id = "alertDelBtn">확인</button>
</div>
</div>
<!-- 질문 수정 모달 -->
<%--<div id="qna-edit" class="modal alert">
<div class="alert-content">
<p class="alert-content__text--sm">
답변이 등록된 상태입니다.
<br>
수정하실 수 없습니다.
</p>
</div>
<div class="alert-btn-container">
<a href="#" rel="modal:close" class="alert-btn alert-btn--confirm">확인</a>
</div>
</div>--%>
</body>
</html>