- 약관 종류 관리 서비스 추가 (사용/노출 설정 로직 구현)
- 약관 종류 관리 화면 및 저장 처리 로직 추가 - 약관 조회/등록 시 사용 여부 검증 로직 반영
This commit is contained in:
@@ -14,6 +14,12 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<jsp:include page="/jsp/common/include/css.jsp"/>
|
||||
<jsp:include page="/jsp/common/include/script.jsp"/>
|
||||
<style type="text/css">
|
||||
/* '약관 종류 관리' 버튼 - 신규 버튼과 구분되도록 색상을 달리한다 */
|
||||
.cssbtn.btn_terms_type { margin-right:14px; border-color:rgba(65,125,200,0.6); color:rgb(65,125,200);
|
||||
background-color:rgba(65,125,200,0.06); box-shadow:0px 2px 3px rgba(65,125,200,0.15); }
|
||||
.cssbtn.btn_terms_type:hover { color:rgb(65,125,200); background-color:rgba(65,125,200,0.2); }
|
||||
</style>
|
||||
<script language="javascript" >
|
||||
var url = '<c:url value="/onl/apim/portalterms/portalTermsMan.json" />';
|
||||
var url_view = '<c:url value="/onl/apim/portalterms/portalTermsMan.view" />';
|
||||
@@ -44,6 +50,21 @@
|
||||
});
|
||||
}
|
||||
|
||||
/** 약관 종류 관리 팝업 (사용 여부 / 약관 페이지 노출 순서) */
|
||||
function openTermsTypeManPopup() {
|
||||
var popupUrl = url_view + '?cmd=TYPE_CONFIG_POPUP';
|
||||
var args = {
|
||||
title: '약관 종류 관리',
|
||||
callback: function(saved) {
|
||||
if (!saved) return;
|
||||
// '(사용안함)' 표기가 바뀌므로 검색 콤보와 목록을 다시 읽는다
|
||||
init();
|
||||
$("#grid").trigger("reloadGrid");
|
||||
}
|
||||
};
|
||||
showModal(popupUrl, args, 980, 640);
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
init();
|
||||
$('#grid').jqGrid({
|
||||
@@ -141,6 +162,10 @@
|
||||
}
|
||||
});
|
||||
|
||||
$("#btn_terms_type").click(function(){
|
||||
openTermsTypeManPopup();
|
||||
});
|
||||
|
||||
buttonControl();
|
||||
});
|
||||
</script>
|
||||
@@ -154,6 +179,7 @@
|
||||
</div><!-- end content_top -->
|
||||
<div class="content_middle" id="content_middle">
|
||||
<div class="search_wrap">
|
||||
<button type="button" class="cssbtn btn_terms_type" id="btn_terms_type" level="W"><i class="material-icons">tune</i> 약관 종류 관리</button>
|
||||
<button type="button" class="cssbtn" id="btn_new" level="W"><i class="material-icons">add</i> <%= localeMessage.getString("button.new") %></button>
|
||||
<%-- <button type="button" class="cssbtn" id="btn_search" level="R"><i class="material-icons">search</i> <%= localeMessage.getString("button.search") %></button>--%>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,210 @@
|
||||
<%-- portalTermsTypeManPopup.jsp : 약관 종류 관리(사용 여부 / 약관 페이지 노출 순서) --%>
|
||||
<%@ page language="java" contentType="text/html; charset=utf-8"%>
|
||||
<%@ page import="java.io.*"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<%@ include file="/jsp/common/include/localemessage.jsp" %>
|
||||
<%
|
||||
response.setHeader("Pragma", "No-cache");
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setHeader("Expires", "0");
|
||||
%>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<jsp:include page="/jsp/common/include/css.jsp"/>
|
||||
<jsp:include page="/jsp/common/include/script.jsp"/>
|
||||
<style type="text/css">
|
||||
/* 약관 종류 관리 영역 */
|
||||
.terms-toggle-list { list-style:none; margin:0; padding:0; display:flex; flex-wrap:wrap; }
|
||||
.terms-toggle-list li { display:flex; align-items:center; justify-content:space-between;
|
||||
width:280px; margin:0 20px 8px 0; padding:6px 10px; border:1px solid #e0e0e0; border-radius:3px; }
|
||||
.terms-switch { position:relative; display:inline-block; width:40px; height:20px; flex:none; margin:0; }
|
||||
.terms-switch input { opacity:0; width:0; height:0; }
|
||||
.terms-switch .slider { position:absolute; top:0; left:0; right:0; bottom:0; cursor:pointer;
|
||||
background-color:#c4c4c4; border-radius:20px; transition:background-color .2s; }
|
||||
.terms-switch .slider:before { content:""; position:absolute; width:16px; height:16px; left:2px; top:2px;
|
||||
background-color:#fff; border-radius:50%; transition:transform .2s; }
|
||||
.terms-switch input:checked + .slider { background-color:#4BD763; }
|
||||
.terms-switch input:checked + .slider:before { transform:translateX(20px); }
|
||||
.terms-dnd-wrap { display:flex; gap:20px; }
|
||||
.terms-dnd-col { flex:1; min-width:220px; }
|
||||
.terms-dnd-head { font-weight:bold; padding:6px 0; }
|
||||
.terms-dnd-sub { font-weight:normal; color:#888; font-size:12px; }
|
||||
.terms-dnd-list { list-style:none; margin:0; padding:6px; min-height:140px;
|
||||
border:1px solid #e0e0e0; border-radius:3px; background-color:#fafafa; }
|
||||
.terms-dnd-list li { display:flex; align-items:center; margin-bottom:6px; padding:7px 10px; cursor:move;
|
||||
background-color:#fff; border:1px solid #d5d5d5; border-radius:3px; }
|
||||
.terms-dnd-list li .material-icons { font-size:16px; color:#999; margin-right:6px; }
|
||||
.terms-dnd-list li.terms-dnd-placeholder { height:32px; background-color:#eef4ff; border:1px dashed #9db8e8; }
|
||||
.terms-help { color:#666; font-size:12px; margin-top:8px; line-height:1.6; }
|
||||
.terms-help code { font-family:Consolas,Menlo,monospace; color:#444; background-color:#f2f2f2;
|
||||
padding:1px 4px; border-radius:3px; }
|
||||
</style>
|
||||
<script language="javascript">
|
||||
var url = '<c:url value="/onl/apim/portalterms/portalTermsMan.json" />';
|
||||
|
||||
// 서버에서 내려준 약관 종류 행 (code / name / enabled / displayed / displayOrder)
|
||||
var termsTypeRows = [];
|
||||
|
||||
function loadTermsTypeConfig() {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: {cmd: 'TYPE_CONFIG'},
|
||||
success: function(json) {
|
||||
termsTypeRows = json.typeRows || [];
|
||||
renderTermsTypeConfig();
|
||||
},
|
||||
error: function(e) {
|
||||
alert(e.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function termsTypeItem(row) {
|
||||
var $li = $('<li></li>').attr('data-code', row.code);
|
||||
$li.append($('<i class="material-icons">drag_indicator</i>'));
|
||||
$li.append($('<span></span>').text(row.name));
|
||||
return $li;
|
||||
}
|
||||
|
||||
function renderTermsTypeConfig() {
|
||||
var $toggleList = $("#termsEnabledList").empty();
|
||||
var $displayed = $("#termsDisplayedList").empty();
|
||||
var $undisplayed = $("#termsUndisplayedList").empty();
|
||||
|
||||
// 사용 여부 토글 (약관 종류 선언 순서)
|
||||
termsTypeRows.forEach(function(row) {
|
||||
var $li = $('<li></li>').attr('data-code', row.code);
|
||||
$li.append($('<span></span>').text(row.name));
|
||||
var $label = $('<label class="terms-switch"></label>');
|
||||
var $input = $('<input type="checkbox">').attr('data-code', row.code).prop('checked', row.enabled);
|
||||
$label.append($input).append($('<span class="slider"></span>'));
|
||||
$li.append($label);
|
||||
$toggleList.append($li);
|
||||
});
|
||||
|
||||
// 노출 배치 (배치 목록은 노출 순서대로, 사용 OFF 인 종류는 배치 대상에서 제외)
|
||||
termsTypeRows.filter(function(row) { return row.enabled && row.displayed; })
|
||||
.sort(function(a, b) { return a.displayOrder - b.displayOrder; })
|
||||
.forEach(function(row) { $displayed.append(termsTypeItem(row)); });
|
||||
|
||||
termsTypeRows.filter(function(row) { return row.enabled && !row.displayed; })
|
||||
.forEach(function(row) { $undisplayed.append(termsTypeItem(row)); });
|
||||
|
||||
$("#termsDisplayedList, #termsUndisplayedList").sortable({
|
||||
connectWith: '.terms-dnd-list',
|
||||
placeholder: 'terms-dnd-placeholder',
|
||||
forcePlaceholderSize: true,
|
||||
cursor: 'move',
|
||||
tolerance: 'pointer'
|
||||
}).disableSelection();
|
||||
}
|
||||
|
||||
// 사용 토글 변경 시 배치 영역도 즉시 맞춘다 (OFF 면 제거, ON 이면 미배치에 추가)
|
||||
function bindTermsTypeToggle() {
|
||||
$("#termsEnabledList").on('change', 'input[type=checkbox]', function() {
|
||||
var code = $(this).data('code');
|
||||
var row = termsTypeRows.filter(function(r) { return r.code === code; })[0];
|
||||
if (!row) return;
|
||||
|
||||
if ($(this).is(':checked')) {
|
||||
if ($(".terms-dnd-list li[data-code='" + code + "']").length === 0) {
|
||||
$("#termsUndisplayedList").append(termsTypeItem(row));
|
||||
}
|
||||
} else {
|
||||
$(".terms-dnd-list li[data-code='" + code + "']").remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function saveTermsTypeConfig() {
|
||||
var enabledTypes = [];
|
||||
$("#termsEnabledList input[type=checkbox]:checked").each(function() {
|
||||
enabledTypes.push($(this).data('code'));
|
||||
});
|
||||
|
||||
var displayTypes = [];
|
||||
$("#termsDisplayedList li").each(function() {
|
||||
displayTypes.push($(this).data('code'));
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: {cmd: 'TYPE_CONFIG_SAVE', enabledTypes: enabledTypes.join(','), displayTypes: displayTypes.join(',')},
|
||||
success: function() {
|
||||
alert("저장되었습니다.");
|
||||
// 목록 화면의 '(사용안함)' 표기가 바뀌므로 부모 화면을 다시 읽도록 알린다
|
||||
if (window.dialogArguments && window.dialogArguments.callback) {
|
||||
window.dialogArguments.callback(true);
|
||||
}
|
||||
window.close();
|
||||
},
|
||||
error: function(e) {
|
||||
alert(e.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
loadTermsTypeConfig();
|
||||
bindTermsTypeToggle();
|
||||
|
||||
$("#btn_save").click(function() {
|
||||
saveTermsTypeConfig();
|
||||
});
|
||||
|
||||
$("#btn_close").click(function() {
|
||||
window.close();
|
||||
});
|
||||
|
||||
buttonControl();
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="popup_box">
|
||||
<div class="search_wrap">
|
||||
<button type="button" class="cssbtn" id="btn_save" level="W">
|
||||
<i class="material-icons">save</i> <%= localeMessage.getString("button.modify") %>
|
||||
</button>
|
||||
<button type="button" class="cssbtn" id="btn_close" level="R">
|
||||
<i class="material-icons">cancel</i> <%= localeMessage.getString("button.close") %>
|
||||
</button>
|
||||
</div>
|
||||
<div class="title">약관 종류 관리</div>
|
||||
<table class="table_row" cellspacing="0">
|
||||
<tr>
|
||||
<th style="width:180px;">시스템 사용 약관 종류</th>
|
||||
<td>
|
||||
<ul id="termsEnabledList" class="terms-toggle-list"></ul>
|
||||
<div class="terms-help">
|
||||
사용하지 않는 약관 종류는 신규 등록 시 선택할 수 없으며, 목록/검색에 '(사용안함)'으로 표시됩니다.<br>
|
||||
약관 종류 목록은 <code>com.eactive.apim.portal.agreements.entity.AgreementType</code>(elink-portal-common)에 정의되어 있으며,
|
||||
종류 자체를 추가/삭제하려면 해당 enum을 수정한 뒤 재배포해야 합니다.
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>약관 페이지 노출</th>
|
||||
<td>
|
||||
<div class="terms-dnd-wrap">
|
||||
<div class="terms-dnd-col">
|
||||
<div class="terms-dnd-head">배치 <span class="terms-dnd-sub">(위에서부터 노출 순서)</span></div>
|
||||
<ul id="termsDisplayedList" class="terms-dnd-list"></ul>
|
||||
</div>
|
||||
<div class="terms-dnd-col">
|
||||
<div class="terms-dnd-head">미배치</div>
|
||||
<ul id="termsUndisplayedList" class="terms-dnd-list"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="terms-help">드래그하여 배치/미배치로 옮기고, 배치 영역 안에서의 순서가 포털 약관 페이지의 노출 순서가 됩니다.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user