|
|
@@ -14,8 +14,11 @@
|
|
|
* 1.0 2021.01.28 jsshin 최초 작성
|
|
|
*******************************************************************************
|
|
|
-->
|
|
|
-<div class="modalPopup" data-width="1200" id="popupCouponIssue">
|
|
|
- <div class="panelStyle">
|
|
|
+<style>
|
|
|
+
|
|
|
+</style>
|
|
|
+<div class="modalPopup" data-width="600" id="popupCouponIssue">
|
|
|
+ <div id="panel" class="panelStyle">
|
|
|
<!-- TITLE -->
|
|
|
<div class="panelTitle">
|
|
|
<strong>쿠폰 발급</strong>
|
|
|
@@ -56,7 +59,7 @@
|
|
|
</td>
|
|
|
<th>쿠폰명</th>
|
|
|
<td>
|
|
|
- <input type="text" name="cpnNm" maxlength="50" th:value="${cpnNm}"/>
|
|
|
+ <input type="text" name="cpnNm" maxlength="50"/>
|
|
|
</td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
@@ -73,9 +76,75 @@
|
|
|
|
|
|
<!-- 리스트 영역 -->
|
|
|
<div class="panelContent">
|
|
|
- <div id="gridCouponList" style="width: 100%; height: 470px" class="ag-theme-balham"></div>
|
|
|
+ <div id="gridCouponList" style="width: 100%; height: 250px" class="ag-theme-balham"></div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="panelContent">
|
|
|
+ <form id="couponIssueForm" name="couponIssueForm">
|
|
|
+ <input type="hidden" name="cpnId"/>
|
|
|
+ <input type="hidden" name="pdGb"/>
|
|
|
+ <input type="hidden" name="custNo"/>
|
|
|
+ <table class="frmStyle" aria-describedby="발급내용">
|
|
|
+ <colgroup>
|
|
|
+ <col style="width: 10%"/>
|
|
|
+ <col style="width: 40%"/>
|
|
|
+ <col style="width: 10%"/>
|
|
|
+ <col style="width: 40%"/>
|
|
|
+ </colgroup>
|
|
|
+ <tr id="availTermsTr">
|
|
|
+ <th class="availTerm">유효기간시작일시<em class="required" title="필수"></em></th>
|
|
|
+ <td class="availTerm">
|
|
|
+ <input type="text" name="availStdt" class="schDate w100" data-valid-name="유효기간시작일시"/>
|
|
|
+ <select name="availStHH" class="w80" data-valid-name="유효기간시작(시)"required="required">
|
|
|
+ <th:block th:each="num, index : ${#numbers.sequence(0, 23)}">
|
|
|
+ <option th:value="${#numbers.formatInteger(num, 2)}" th:text="|${#numbers.formatInteger(num, 2)}시|">시간</option>
|
|
|
+ </th:block>
|
|
|
+ </select>
|
|
|
+ <select name="availStMM" class="w80" data-valid-name="유효기간시작(분)" required="required">
|
|
|
+ <th:block th:each="num, index : ${#numbers.sequence(0, 59)}">
|
|
|
+ <option th:value="${#numbers.formatInteger(num, 2)}" th:text="|${#numbers.formatInteger(num, 2)}분|">분</option>
|
|
|
+ </th:block>
|
|
|
+ </select>
|
|
|
+ </td>
|
|
|
+
|
|
|
+ <th class="availTerm">유효기간종료일시<em class="required" title="필수"></em></th>
|
|
|
+ <td class="availTerm">
|
|
|
+ <input type="text" name="availEddt" class="schDate w200" data-valid-name="유효기간종료일시"/>
|
|
|
+ <select name="availEdHH" class="w80" data-valid-name="유효기간종료(시)">
|
|
|
+ <th:block th:each="num, index : ${#numbers.sequence(0, 23)}">
|
|
|
+ <option th:value="${#numbers.formatInteger(num, 2)}" th:text="|${#numbers.formatInteger(num, 2)}시|">시간</option>
|
|
|
+ </th:block>
|
|
|
+ </select>
|
|
|
+ <select name="availEdMM" class="w80" data-valid-name="유효기간종료(분)">
|
|
|
+ <th:block th:each="num: ${#numbers.sequence(0, 59)}">
|
|
|
+ <option th:value="${#numbers.formatInteger(num, 2)}" th:text="|${#numbers.formatInteger(num, 2)}분|">분</option>
|
|
|
+ </th:block>
|
|
|
+ </select>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr id="availDaysTr" style="display:none;">
|
|
|
+ <th>유효기간(일)</th>
|
|
|
+ <td><input type="text" name="availDays" data-valid-type="integer"></td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th>발급사유</th>
|
|
|
+ <td colspan="3">
|
|
|
+ <select name="pubReason" data-valid-name="발급사유" required>
|
|
|
+ <option th:if="${cpnPubReasonList}" th:each="oneData, status : ${cpnPubReasonList}" th:value="${oneData.cd}"
|
|
|
+ th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
|
|
|
+ </select>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th>상세사유</th>
|
|
|
+ <td colspan="3">
|
|
|
+ <textarea name="pubReasonDtl" class="textareaR4" style="resize: none;" data-valid-name="상세사유" required="required"></textarea>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </table>
|
|
|
+ </form>
|
|
|
</div>
|
|
|
- <!-- //리스트 영역 -->
|
|
|
+
|
|
|
|
|
|
<!-- 버튼 배치 영역 -->
|
|
|
<ul class="panelBar">
|
|
|
@@ -128,22 +197,12 @@
|
|
|
headerName: "최고할인값", field: "maxDcAmt", width: 100, cellClass: "text-center",
|
|
|
cellRenderer: function(params) { return (!gagajf.isNull(params.value) ? gagaAgGrid.toAddComma(params.value) : '') + (params.data.dcWay == '10' ? '원' : '%'); }
|
|
|
},
|
|
|
-// {
|
|
|
-// headerName: "기간/일수", field: "pdGb", width: 100, cellClass: "text-center", hide: true,
|
|
|
-// cellRenderer: function(params) { return (params.value == 'P' ? '기간' : '일수'); }
|
|
|
-// },
|
|
|
-// {
|
|
|
-// headerName: "유효시작일시", field: "availStdt", width: 150, cellClass: "text-center", hide: true,
|
|
|
-// cellRenderer: function(params) { return !gagajf.isNull(params.value) ? gagaAgGrid.toDateTimeFormat(params.value) : ''; }
|
|
|
-// },
|
|
|
-// {
|
|
|
-// headerName: "유효종료일시", field: "availEddt", width: 150, cellClass: "text-center", hide: true,
|
|
|
-// cellRenderer: function(params) { return !gagajf.isNull(params.value) ? gagaAgGrid.toDateTimeFormat(params.value) : ''; }
|
|
|
-// },
|
|
|
-// {headerName: "유효일수", field: "availDays", width: 100, cellClass: "text-center", hide: true},
|
|
|
{
|
|
|
headerName: "유효기간", field: "availPeriod", width: 300, cellClass: "text-center",
|
|
|
- cellRenderer: function(params) { return params.data.pdGb == 'P' ? gagaAgGrid.toDateTimeFormat(params.data.availStdt) + '~' + gagaAgGrid.toDateTimeFormat(params.data.availStdt) : gagaAgGrid.toAddComma(params.data.availDays) + '일'; }
|
|
|
+ cellRenderer: function(params) {
|
|
|
+ return params.data.pdGb == 'P' ? gagaAgGrid.toDateTimeFormat(params.data.availStdt)
|
|
|
+ + '~' + gagaAgGrid.toDateTimeFormat(params.data.availStdt) : gagaAgGrid.toAddComma(params.data.availDays) + '일';
|
|
|
+ }
|
|
|
},
|
|
|
{headerName: "발행제한여부", field: "pubLimitYn", width: 100, cellClass: "text-center"},
|
|
|
{
|
|
|
@@ -169,7 +228,11 @@
|
|
|
|
|
|
gridOptionsCouponList.rowSelection = 'single';
|
|
|
gridOptionsCouponList.rowMultiSelectWithClick = true; // 클릭으로 선택 가능
|
|
|
-
|
|
|
+
|
|
|
+ // 셀 클릭 이벤트
|
|
|
+ gridOptionsCouponList.onCellClicked = function (event) {
|
|
|
+ fnBindCouponInfo(event.data);
|
|
|
+ };
|
|
|
|
|
|
// 조회
|
|
|
$('#btnSearchCouponRetrieve').on('click', function() {
|
|
|
@@ -180,19 +243,98 @@
|
|
|
|
|
|
// 발생
|
|
|
$('#btnIssueCoupon').on('click', function() {
|
|
|
- var selectedData = gagaAgGrid.selectedRowData(gridOptionsCouponList);
|
|
|
+ let selectedData = gagaAgGrid.selectedRowData(gridOptionsCouponList);
|
|
|
if (selectedData.length == 0) {
|
|
|
mcxDialog.alert('선택된 쿠폰이 없습니다.');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ if (!gagajf.validation('#couponIssueForm'))
|
|
|
+ return ;
|
|
|
+
|
|
|
+ let availStHH = $("#couponIssueForm select[name=availStHH]").val();
|
|
|
+ let availStMM = $("#couponIssueForm select[name=availStMM]").val();
|
|
|
+ let availEdHH = $("#couponIssueForm select[name=availEdHH]").val();
|
|
|
+ let availEdMM = $("#couponIssueForm select[name=availEdMM]").val();
|
|
|
+
|
|
|
+ let custCouponList = [];
|
|
|
+ let custCoupon = $("#couponIssueForm").serializeObject();
|
|
|
+ if (custCoupon.pdGb === 'P') {
|
|
|
+ if (gagajf.isNull(custCoupon.availStdt) && gagajf.isNull(custCoupon.availEddt)) {
|
|
|
+ mcxDialog.alert("유효 시작일시 / 유효 종료일시를 입력해주세요");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ custCoupon.availStdt = String(custCoupon.availStdt)+String(availStHH)+String(availStMM).replace('-', '');
|
|
|
+ custCoupon.availEddt = String(custCoupon.availEddt)+String(availEdHH)+String(availEdMM).replace('-', '');
|
|
|
+ }
|
|
|
+
|
|
|
+ if (custCoupon.pdGb === 'D') {
|
|
|
+ if (gagajf.isNull(custCoupon.availDays)) {
|
|
|
+ mcxDialog.alert("유효기간(일)을 입력해주세요");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ var action = "/marketing/coupon/issue/save";
|
|
|
+ mcxDialog.confirm("저장하시겠습니까?", {
|
|
|
+ cancelBtnText: "취소",
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function () {
|
|
|
+ gagajf.ajaxJsonSubmit(action, JSON.stringify(custCoupon), fnIssueCouponCallBack);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
+ var fnIssueCouponCallBack = function () {
|
|
|
+ uifnPopupClose('popupCouponIssue');
|
|
|
+ fnSearchCoupon();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // 선택 쿠폰정보 셋팅
|
|
|
+ var fnBindCouponInfo = function(params) {
|
|
|
+ console.log('params', params);
|
|
|
+ $('#couponIssueForm input[name=cpnId]').val(params.cpnId);
|
|
|
+ $('#couponIssueForm input[name=pdGb]').val(params.pdGb);
|
|
|
+ $('#couponIssueForm input[name=availStdt]').val(gagaAgGrid.toDateFormat(params.availStdt));
|
|
|
+ $("#couponIssueForm select[name=availStHH]").val(params.availStdt.substring(8,10));
|
|
|
+ $("#couponIssueForm select[name=availStMM]").val(params.availStdt.substring(10,12));
|
|
|
+ $('#couponIssueForm input[name=availEddt]').val(gagaAgGrid.toDateFormat(params.availEddt));
|
|
|
+ $("#couponIssueForm select[name=availEdHH]").val(params.availEddt.substring(8,10));
|
|
|
+ $("#couponIssueForm select[name=availEdMM]").val(params.availEddt.substring(10,12));
|
|
|
+ $('#couponIssueForm input[name=availDays]').val(params.availDays);
|
|
|
+
|
|
|
+ //유효기간 숨김처리
|
|
|
+ if (params.pdGb === 'P') {
|
|
|
+ $("#availTermsTr").show();
|
|
|
+ $("#availDaysTr").hide();
|
|
|
+ } else if (params.pdGb === 'D') {
|
|
|
+ $("#availTermsTr").hide();
|
|
|
+ $("#availDaysTr").show();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ var fnInitDataSet = function () {
|
|
|
+ let custNo = $(elementCustNo).val();
|
|
|
+ if(!gagajf.isNull(custNo)) {
|
|
|
+ $('#couponIssueForm input[name=custNo]').val(custNo);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
$(document).ready(function() {
|
|
|
// Create a agGrid
|
|
|
gagaAgGrid.createGrid('gridCouponList', gridOptionsCouponList);
|
|
|
-
|
|
|
- $('#btnSearchCouponRetrieve').trigger('click');
|
|
|
+
|
|
|
+ fnInitDataSet();
|
|
|
+
|
|
|
+ //$('#panel').css({ width: 1200, height: 500 });
|
|
|
+
|
|
|
+ //$('#panel').attr('style', 'width: 1200 !important, height: 500 !important');
|
|
|
+
|
|
|
});
|
|
|
/*]]>*/
|
|
|
</script>
|