320 lines
16 KiB
Plaintext
320 lines
16 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" %>
|
|
<%--
|
|
Class Name : PrsntC.jsp
|
|
Description : 사은품 등록 화면
|
|
Modification Information
|
|
|
|
수정일 수정자 수정내용
|
|
------- -------- ---------------------------
|
|
since : 2024.04.15 리브가 최초 생성
|
|
--%>
|
|
<!DOCTYPE html>
|
|
<html lang="ko">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>일반 관리자</title>
|
|
<%-- 공통 include --%>
|
|
<%@ include file="/WEB-INF/views/comm/mngr/Include.jsp"%>
|
|
|
|
</head>
|
|
<script>
|
|
$(document).ready(function () {
|
|
|
|
});
|
|
|
|
/* ********************************************************
|
|
* 등록 AJAX
|
|
******************************************************** */
|
|
const fn_regist = function () {
|
|
const url = '<c:url value="/mngr/goods/prsnt/insertPrsnt"/>';
|
|
|
|
if(fn_is_empty($('#goodsNm').val())){
|
|
$('#goodsNm').focus()
|
|
alert('상품명을 입력해 주세요.')
|
|
return;
|
|
}
|
|
|
|
if(fn_is_empty($('input[name="goodsCd"]').val())){
|
|
$('input[name="goodsCd"]').focus()
|
|
alert('상품코드를 입력해 주세요.')
|
|
return;
|
|
}
|
|
|
|
|
|
const invntryPolicyCd = $('input[name="invntryPolicyCd"]:checked').val()
|
|
|
|
if(invntryPolicyCd ==='01' && fn_is_empty($('#invntryQy').val())){
|
|
$('#invntryQy').focus()
|
|
alert('재고수량을 입력해 주세요')
|
|
return;
|
|
|
|
}
|
|
|
|
const formData = new FormData();
|
|
|
|
$('#listForm').serializeArray().forEach(function (item) {
|
|
formData.append(item.name, item.value);
|
|
});
|
|
|
|
formData.append('invntryQy',String(fn_comma_del_str_to_number($('#invntryQy').val())))
|
|
formData.append('cnsmrpric',String(fn_comma_del_str_to_number($('#cnsmrpric').val())))
|
|
|
|
//파일데이터
|
|
var myDropzone = Dropzone.forElement("#my-dropzone");
|
|
let fileAt = 'N';
|
|
myDropzone.files.forEach(function (file) {
|
|
if(!fn_is_empty(file)){
|
|
fileAt='Y'
|
|
}
|
|
formData.append('files', file); // 서버에서 파일을 받을 때 'files'라는 이름으로 전송
|
|
});
|
|
|
|
//등록된 사진이 없거나 이미지삭제가 아닌경우
|
|
if(fn_is_empty($('#sortable div.file-preview__container')) && fileAt==='N'){
|
|
alert('사은품 이미지를 등록해주세요');
|
|
return false;
|
|
}
|
|
|
|
if (confirm('사은품을 <spring:message code="confirm.common.insert"/>')) {
|
|
$.ajax({
|
|
type: 'post',
|
|
enctype: 'multipart/form-data',
|
|
url: url,
|
|
data: formData,
|
|
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"/>');
|
|
}
|
|
}
|
|
});
|
|
}
|
|
};
|
|
|
|
/* ********************************************************
|
|
* 수정폼 이동
|
|
******************************************************** */
|
|
const fn_move_dtl_uptpage = function (Innb) {
|
|
const url = '<c:url value="/mngr/goods/prsnt/selectPrsntDtlForm"/>';
|
|
|
|
$('#listForm').attr('action', url);
|
|
$('#listForm').attr('method', 'get');
|
|
$('#pageIndex').val(1);
|
|
$('#goodsInnb').val(Innb);
|
|
$('#listForm').submit();
|
|
}
|
|
|
|
/* ********************************************************
|
|
* 목록 조회
|
|
******************************************************** */
|
|
const fn_select_list = function () {
|
|
const url = '<c:url value="/mngr/goods/prsnt/selectPrsntListForm"/>';
|
|
|
|
$('#listForm').attr('action', url);
|
|
$('#listForm').attr('method', 'post');
|
|
$('#listForm').submit();
|
|
};
|
|
|
|
//모든 컴마 삭제 및 문자를 숫자로 변환
|
|
const fn_comma_del_str_to_number = function (str) {
|
|
|
|
// null이나 undefined인 경우 0을 반환
|
|
if (str === null || str === undefined || str.trim() === '') {
|
|
return 0;
|
|
}
|
|
|
|
// 쉼표를 제거하고 숫자로 변환
|
|
const numberWithoutCommas = str.replace(/,/g, '');
|
|
const number = parseFloat(numberWithoutCommas);
|
|
|
|
// 변환된 값이 NaN인 경우 0을 반환
|
|
if (isNaN(number)) {
|
|
return 0;
|
|
}
|
|
|
|
return number;
|
|
|
|
}
|
|
</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.insert"/></button>
|
|
</div>
|
|
</div>
|
|
|
|
<form id="listForm" method="post" action="<c:url value="/mngr/goods/prsnt/insertPrsnt"/>" enctype="multipart/form-data">
|
|
<section class="content-section content-scroll-detect content-fold">
|
|
<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"/>
|
|
<div class="content-fold__header">
|
|
<h3 class="content-section__title">기본정보</h3>
|
|
<button class="content-fold__btn"><span class="visually-hidden">접기</span></button>
|
|
</div>
|
|
<div class="content-fold__content">
|
|
<div class="table-wrapper">
|
|
<table class="table">
|
|
<caption>사은품</caption>
|
|
<colgroup>
|
|
<col style="width: 12%;">
|
|
<col style="width: 38%;">
|
|
<col style="width: 12%;">
|
|
<col style="width: 38%;">
|
|
</colgroup>
|
|
<tbody>
|
|
<tr>
|
|
<th>상품 명<span class="red-7">*</span></th>
|
|
<td>
|
|
<div class="td-inner">
|
|
<input class="input-text lg" type="text" id="goodsNm" name="goodsNm" title="상품 명" maxlength="35">
|
|
</div>
|
|
</td>
|
|
<th>판매 상태</th>
|
|
<td colspan="2">
|
|
<div class="td-inner">
|
|
<div class="custom-radio-container">
|
|
<c:forEach items="${resultMap.goodsDftinfoSttusList}"
|
|
var="goodsDftinfoSttus"
|
|
varStatus="status">
|
|
<div class="custom-radio">
|
|
<input type="radio" id="${goodsDftinfoSttus.cd}"
|
|
name="goodsSttusCd"
|
|
value="${goodsDftinfoSttus.cd}" <c:if test="${status.first}">checked</c:if> >
|
|
<label for="${goodsDftinfoSttus.cd}">${goodsDftinfoSttus.cdNm}</label>
|
|
</div>
|
|
</c:forEach>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>재고에 따른 판매</th>
|
|
<td colspan="3">
|
|
<div class="td-inner">
|
|
<div class="custom-radio-container">
|
|
<c:forEach items="${resultMap.goodsDftinfoInvntryPolicyList}"
|
|
var="goodsDftinfoInvntryPolicy" varStatus="status">
|
|
<div class="custom-radio">
|
|
<input type="radio"
|
|
id="goodsDftinfoInvntryPolicy${status.count}"
|
|
name="invntryPolicyCd"
|
|
value="${goodsDftinfoInvntryPolicy.cd}" <c:if test="${status.last}">checked</c:if> >
|
|
<label for="goodsDftinfoInvntryPolicy${status.count}">${goodsDftinfoInvntryPolicy.cdNm}</label>
|
|
</div>
|
|
</c:forEach>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="table-wrapper">
|
|
<table class="table vertical draggable">
|
|
<colgroup>
|
|
<col style="width: auto;">
|
|
<col style="width: 20%;">
|
|
<col style="width: 30%;">
|
|
<col style="width: 30%;">
|
|
</colgroup>
|
|
<thead>
|
|
<tr>
|
|
<th>상품코드<span class="red-7">*</span></th>
|
|
<th>재고</th>
|
|
<th>정가</th>
|
|
<th>판매가</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
<input class="input-text full" type="text" name="goodsCd" title="상품코드" maxlength="35">
|
|
</td>
|
|
<td>
|
|
<input class="input-text number full" type="text" id="invntryQy" title="재고" maxlength="20">
|
|
</td>
|
|
<td>
|
|
<input class="input-text number full" type="text" id="cnsmrpric" title="정가" maxlength="20">
|
|
</td>
|
|
<td>
|
|
<input class="input-text number full" type="text" name="" title="판매가" maxlength="20" disabled>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="content-section content-scroll-detect content-fold">
|
|
<div class="content-fold__header">
|
|
<h3 class="content-section__title">상품 사진</h3>
|
|
<button class="content-fold__btn"><span class="visually-hidden">접기</span></button>
|
|
</div>
|
|
<div class="content-fold__content">
|
|
<div class="table-wrapper">
|
|
<table class="table">
|
|
<caption>해당 테이블에 대한 설명</caption>
|
|
<colgroup>
|
|
<col style="width: 12%;">
|
|
<col>
|
|
</colgroup>
|
|
<tbody>
|
|
<tr>
|
|
<th>사진 등록<span class="red-7">*</span></th>
|
|
<td>
|
|
<div class="td-inner vertical">
|
|
<div class="dropzone-wrapper">
|
|
<spring:eval expression="@environment.getProperty('mngrfo.common.fileupload.extensions.images')" var="acceptFileExtensions"/>
|
|
<div class="dropzone" id="my-dropzone">
|
|
</div>
|
|
<p class="fyi gray-7 mt-15">여러 개의 이미지를 한 번에 등록 가능합니다.</p>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
</section>
|
|
<!--검색 조건 , 페이징 조건 -->
|
|
<input type="hidden" id="goodsInnb" name="goodsInnb" value=""/>
|
|
<input type="hidden" id="sopmalCd" name="sopmalCd" value="${resultMap.BOGoodsVO.sopmalCd}"/>
|
|
<input type="hidden" id="srchType" name="srchType" title="검색타입" value="<c:out value="${ resultMap.BOGoodsVO.srchType }"/>">
|
|
<input type="hidden" id="srchStr" name="srchStr" title="검색어" value="<c:out value="${ resultMap.BOGoodsVO.srchStr }"/>">
|
|
<input type="hidden" id="dateDv" name="dateDv" title="검색날짜" value="<c:out value="${ resultMap.BOGoodsVO.dateDv }"/>">
|
|
<input type="hidden" id="startDate" name="startDate" title="검색날짜" value="<c:out value="${ resultMap.BOGoodsVO.startDate }"/>">
|
|
<input type="hidden" id="endDate" name="endDate" title="검색날짜" value="<c:out value="${ resultMap.BOGoodsVO.endDate }"/>">
|
|
<input type="hidden" id="pageIndex" name="pageIndex" value="<c:out value="${ resultMap.BOGoodsVO.pageIndex }"/>"/>
|
|
<input type="hidden" id="pageUnit" name="pageUnit" value="<c:out value="${ resultMap.BOGoodsVO.pageUnit }"/>"/>
|
|
</form>
|
|
<button class="scroll-to-top"><span class="visually-hidden">위로가기</span></button>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</body>
|
|
|
|
</html> |