348 lines
18 KiB
Plaintext
348 lines
18 KiB
Plaintext
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
|
|
<%@ page import="java.util.Date" %>
|
|
<%@ 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 : PopupRegistC.jsp
|
|
Description : 팝업 등록
|
|
Modification Information
|
|
|
|
수정일 수정자 수정내용
|
|
------- -------- ---------------------------
|
|
2024-02-07 리브가 최초생성1
|
|
--%>
|
|
<!DOCTYPE html>
|
|
<html lang="ko">
|
|
<head>
|
|
<%-- 공통 include --%>
|
|
<%@include file ="/WEB-INF/views/comm/mngr/Include.jsp" %>
|
|
<script src="<c:url value='/js/fileupload_comm.js'/>"></script>
|
|
</head>
|
|
<script>
|
|
$(document).ready(function () {
|
|
|
|
fn_set_date('datepicker_1', 'datepicker_2', 'datepicker_2');
|
|
|
|
});
|
|
|
|
/* ********************************************************
|
|
* 숫자만 허용
|
|
******************************************************** */
|
|
function fn_num_validateInput(input) {
|
|
var regex = /[^0-9]/g;
|
|
input.value = input.value.replace(regex, '');
|
|
input.value = input.value.toUpperCase();
|
|
}
|
|
|
|
/* ********************************************************
|
|
* 수정폼 이동
|
|
******************************************************** */
|
|
const fn_move_dtl_uptpage = function (Innb) {
|
|
const url = '<c:url value="/mngr/setup/popup/selectPopupUpdtForm"/>';
|
|
|
|
$('#listForm').attr('action', url);
|
|
$('#listForm').attr('method', 'post');
|
|
$('#pageIndex').val(1);
|
|
$('#popupInnb').val(Innb);
|
|
$('#listForm').submit();
|
|
};
|
|
|
|
/* ********************************************************
|
|
* 목록 조회
|
|
******************************************************** */
|
|
const fn_select_list = function () {
|
|
const url = '<c:url value="/mngr/setup/popup/selectPopupList"/>';
|
|
|
|
$('#listForm').attr('action', url);
|
|
$('#listForm').attr('method', 'post');
|
|
$('#listForm').submit();
|
|
};
|
|
|
|
/* ********************************************************
|
|
* 등록 AJAX
|
|
******************************************************** */
|
|
const fn_regist = function () {
|
|
const url = '<c:url value="/mngr/setup/popup/insertPopup"/>'
|
|
const formData = new FormData();
|
|
|
|
$('#listForm').serializeArray().forEach(function (item) {
|
|
formData.append(item.name, item.value);
|
|
});
|
|
|
|
const data = $('#listForm').serializeArray();
|
|
|
|
if($('#datepicker_1').val() != null){
|
|
var combinedValue = $('#datepicker_1').val() + 'T' + $('#popupExpsrBgnTime').val();
|
|
formData.append('popupExpsrBgnDt', combinedValue);
|
|
}
|
|
|
|
if($('#datepicker_2').val() != null) {
|
|
combinedValue = $('#datepicker_2').val() + 'T' + $('#popupExpsrEndTime').val();
|
|
formData.append('popupExpsrEndDt', combinedValue);
|
|
}
|
|
|
|
|
|
// 타이머 노출 여부
|
|
let timerAtVal = $('input[name="tmeSetupAt"]:checked').val();
|
|
|
|
// 타이머 노출이면
|
|
if(timerAtVal === 'Y'){
|
|
// 타이머 날짜 값
|
|
let timerDate = $('#datepicker_3').val();
|
|
|
|
// 타이머 날짜가 빈 값이면
|
|
if(timerDate == '' || timerDate == null) {
|
|
alert('타이머 노출 시 시간 설정은 필수입니다.');
|
|
return;
|
|
}
|
|
|
|
if($('#datepicker_3').val() != null) {
|
|
combinedValue = $('#datepicker_3').val() + 'T' + $('#tmeSetupTime').val();
|
|
formData.append('tmeSetup', combinedValue);
|
|
}
|
|
}
|
|
|
|
//파일데이터 - multiple로 배열저장된 값을 files로 셋팅
|
|
$.each(filesTempArr, function(i, file){
|
|
if(file.upload != 'disable')
|
|
formData.append('files', file);
|
|
});
|
|
|
|
if (confirm('팝업을 <spring:message code="confirm.common.insert"/>')) {
|
|
|
|
$.ajax({
|
|
type: 'post',
|
|
enctype: 'multipart/form-data',
|
|
url: url,
|
|
data: formData,
|
|
dataType: 'json',
|
|
contentType: false,
|
|
processData: false,
|
|
success: function (data) {
|
|
let str = JSON.parse(data.resBody.result);
|
|
if (str.result == 'success') {
|
|
alert('<spring:message code="success.common.insert"/>');
|
|
//등록 후 수정화면으로 이동
|
|
fn_move_dtl_uptpage(data.resBody.result.replace(/[^0-9]/g, ""));
|
|
} else {
|
|
alert('<spring:message code="fail.common.insert"/>');
|
|
}
|
|
}/*,
|
|
error: function(data) {
|
|
|
|
}
|
|
error: function(jqXHR, textStatus, errorThrown) {
|
|
// 에러 응답 처리
|
|
alert('Error status:'+ jqXHR.status); // 상태 코드 (예: 404, 500 등)
|
|
alert('Error details:'+ jqXHR.responseText); // 서버에서 제공한 에러 메시지
|
|
alert('Error text status:'+ textStatus); // 오류 상태 (예: 'error', 'timeout', 'abort', 'parsererror')
|
|
alert('Error thrown:'+ errorThrown); // 오류 메시지
|
|
}*/
|
|
});
|
|
}
|
|
};
|
|
</script>
|
|
<body>
|
|
<%@include file ="/WEB-INF/views/comm/mngr/Header.jsp" %>
|
|
<main class="main">
|
|
<%@include file ="/WEB-INF/views/comm/mngr/Left.jsp" %>
|
|
<div class="content">
|
|
<div class="content__inner">
|
|
<button class="side-nav__fold"><span class="visually-hidden">좌측메뉴 펼치기/닫기</span></button>
|
|
<div class="page-title">
|
|
<h2 class="page-title__title">팝업정보</h2>
|
|
<div class="page-title__btn-container">
|
|
<button onclick="fn_select_list()" onkeypress="this.onclick" class="btn outline"><spring:message code="button.list"/></button>
|
|
<button class="btn primary" onclick="fn_regist();"><spring:message code="button.save"/></button>
|
|
</div>
|
|
</div>
|
|
<section class="content-section">
|
|
<h3 class="content-section__title">팝업정보 등록</h3>
|
|
<form id="listForm" method="post" action="<c:url value="/mngr/setup/popup/insertPopup"/>" enctype="multipart/form-data">
|
|
<spring:eval expression="@environment.getProperty('spring.servlet.multipart.max-file-size')" var="maxFileSize"/>
|
|
<spring:eval expression="@environment.getProperty('mngrfo.common.fileupload.extensions.images')" var="acceptFileExtensions"/>
|
|
<input type="hidden" id="orginlFilNm" name="orginlFilNm" value=""/>
|
|
<input type="hidden" id="sopmalCd" name="sopmalCd" value="${resultMap.BOPopupVO.sopmalCd}"/>
|
|
<div class="table-wrapper">
|
|
<table class="table">
|
|
<colgroup>
|
|
<col style="width: 12%;">
|
|
<col style="width: auto;">
|
|
</colgroup>
|
|
<tbody>
|
|
<tr>
|
|
<th>팝업 제목<span class="red-7">*</span></th>
|
|
<td>
|
|
<div class="td-inner">
|
|
<input class="input-text xl" type="text" name="popupNm" id="popupNm"
|
|
title="팝업 제목" maxlength="30">
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>팝업 기간 설정<span class="red-7">*</span></th>
|
|
<td>
|
|
<div class="td-inner">
|
|
<input type="text" id="datepicker_1" name="datepicker_1" class="datepicker" title="시작 날짜 선택"
|
|
autocomplete="off" required="required">
|
|
<div class="timepicker-container">
|
|
<input type="text" class="bs-timepicker" title="시작 시간 설정"
|
|
id="popupExpsrBgnTime" name="popupExpsrBgnTime" value="00:00">
|
|
</div>
|
|
<span class="tilde">~</span>
|
|
<input type="text" id="datepicker_2" name="datepicker_2" class="datepicker" title="종료 날짜 선택"
|
|
autocomplete="off" required="required">
|
|
<div class="timepicker-container">
|
|
<input type="text" class="bs-timepicker" title="종료 시간 설정"
|
|
id="popupExpsrEndTime" name="popupExpsrEndTime" value="00:00">
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>팝업 내용 등록</th>
|
|
<td>
|
|
<div class="td-inner vertical">
|
|
<div class="manage-btn-container fileInfor" id="divInfor-1">
|
|
<ul class="file-list" id="fileList">
|
|
|
|
</ul>
|
|
</div>
|
|
<div class="manage-btn-container" id="divFile-1">
|
|
<div class="input-file">
|
|
<spring:eval expression="@environment.getProperty('mngrfo.common.fileupload.extensions.images')" var="acceptFileExtensions"/>
|
|
<input type="file" id="fileUpload" name="files" title="아이콘파일" accept="<c:out value="${ acceptFileExtensions }"/>" multiple="multiple" onchange="addFiles(event, 1);">
|
|
<label for="fileUpload">파일선택</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>연결 URL</th>
|
|
<td>
|
|
<div class="td-inner">
|
|
<input class="input-text " type="text" id="cnncUrl" name="cnncUrl" style="max-width:1000px;" value="" title="연결 URL" maxlength="1300">
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>팝업 크기<span class="red-7">*</span></th>
|
|
<td>
|
|
<div class="td-inner">
|
|
<span>width :</span>
|
|
<input class="input-text xsm" type="text" id="popupMgWth" name="popupMgWth"
|
|
oninput="fn_num_validateInput(this)" title="팝업크기 가로" maxlength="3">
|
|
<span class="gray-7">px</span>
|
|
<span class="ml-10">height :</span>
|
|
<input class="input-text xsm" type="text" id="popupMgVtc" name="popupMgVtc"
|
|
oninput="fn_num_validateInput(this)" title="팝업크기 세로" maxlength="3">
|
|
<span class="gray-7">px</span>
|
|
|
|
/
|
|
|
|
<span>m_width :</span>
|
|
<input class="input-text xsm" type="text" id="mblPopupMgWth" name="mblPopupMgWth"
|
|
oninput="fn_num_validateInput(this)" title="모바일 팝업크기 가로" maxlength="3">
|
|
<span class="gray-7">px</span>
|
|
<span class="ml-10">m_height :</span>
|
|
<input class="input-text xsm" type="text" id="mblPopupMgVtc" name="mblPopupMgVtc"
|
|
oninput="fn_num_validateInput(this)" title="모바일 팝업크기 세로" maxlength="3">
|
|
<span class="gray-7">px</span>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>팝업 위치<span class="red-7">*</span></th>
|
|
<td>
|
|
<div class="td-inner">
|
|
<span>가로 :</span>
|
|
<input class="input-text xsm" type="text" id="popupLcX" name="popupLcX"
|
|
oninput="fn_num_validateInput(this)" title="팝업위치 가로" maxlength="3">
|
|
<span class="gray-7">px</span>
|
|
<span class="ml-10">세로 :</span>
|
|
<input class="input-text xsm" type="text" id="popupLcY" name="popupLcY"
|
|
oninput="fn_num_validateInput(this)" title="팝업위치 세로" maxlength="3">
|
|
<span class="gray-7">px</span>
|
|
|
|
/
|
|
|
|
<span>모바일 가로 :</span>
|
|
<input class="input-text xsm" type="text" id="mblPopupLcX" name="mblPopupLcX"
|
|
oninput="fn_num_validateInput(this)" title="모바일 팝업위치 가로" maxlength="3">
|
|
<span class="gray-7">px</span>
|
|
<span class="ml-10">모바일 세로 :</span>
|
|
<input class="input-text xsm" type="text" id="mblPopupLcY" name="mblPopupLcY"
|
|
oninput="fn_num_validateInput(this)" title="모바일 팝업위치 세로" maxlength="3">
|
|
<span class="gray-7">px</span>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>노출 상태<span class="red-7">*</span></th>
|
|
<td>
|
|
<div class="td-inner">
|
|
<div class="custom-radio-container">
|
|
<div class="custom-radio">
|
|
<input type="radio" id="r-6" name="expsrAt" value="Y" checked>
|
|
<label for="r-6">노출</label>
|
|
</div>
|
|
<div class="custom-radio">
|
|
<input type="radio" id="r-7" name="expsrAt" value="N">
|
|
<label for="r-7">미노출</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<th>타이머 노출 여부<span class="red-7">*</span></th>
|
|
<td>
|
|
<div class="td-inner">
|
|
<div class="custom-radio-container">
|
|
<div class="custom-radio">
|
|
<input type="radio" id="r-8" name="tmeSetupAt" value="Y">
|
|
<label for="r-8">노출</label>
|
|
</div>
|
|
<div class="custom-radio">
|
|
<input type="radio" id="r-9" name="tmeSetupAt" value="N" checked>
|
|
<label for="r-9">미노출</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<th>타이머</th>
|
|
<td>
|
|
<div class="td-inner">
|
|
<input type="text" id="datepicker_3" name="datepicker_3" class="datepicker" title="시작 날짜 선택" autocomplete="off">
|
|
<div class="timepicker-container">
|
|
<input type="text" class="bs-timepicker" title="시간 설정" id="tmeSetupTime" name="tmeSetupTime" value="00:00">
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!--검색 조건 , 페이징 조건 -->
|
|
<input type="hidden" id="popupInnb" name="popupInnb" value=""/>
|
|
<input type="hidden" id="pageIndex" name="pageIndex" value="<c:out value="${ resultMap.BOPopupVO.pageIndex }"/>"/>
|
|
<input type="hidden" id="pageUnit" name="pageUnit" value="<c:out value="${ resultMap.BOPopupVO.pageUnit }"/>"/>
|
|
|
|
</form>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</body>
|
|
|
|
</html> |