GoodsEpSkipForm.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. <!DOCTYPE html>
  2. <html lang="ko"
  3. xmlns:th="http://www.thymeleaf.org">
  4. <!--
  5. *******************************************************************************
  6. * @source : GoodsEpSkipForm.html
  7. * @desc : 네이버EP제외상품관리
  8. *============================================================================
  9. * STYLE24
  10. * Copyright(C) 2020 TSIT, All rights reserved.
  11. *============================================================================
  12. * VER DATE AUTHOR DESCRIPTION
  13. * === =========== ========== =============================================
  14. * 1.0 2020.11.03 eskim 최초 작성
  15. *******************************************************************************
  16. -->
  17. <div id="main">
  18. <!-- 메인타이틀 영역 -->
  19. <div class="main-title">
  20. </div>
  21. <!-- //메인타이틀 영역 -->
  22. <!-- 메뉴 설명 -->
  23. <div class="infoBox menu-desc">
  24. </div>
  25. <form id="goodsEpSkipListForm" name="goodsEpSkipListForm" action="#" th:action="@{'/goods/ep/skip/list'}">
  26. <input type="hidden" id="searchGb" name="searchGb" />
  27. <input type="hidden" id="arrGoodsCd" name="arrGoodsCd" />
  28. <!-- 패널 영역1 -->
  29. <div class="panelStyle" >
  30. <!-- TITLE -->
  31. <div class="panelTitle">
  32. <h3><i class="fa fa-info-circle"></i>아래 검색조건 중 하나를 꼭 입력해 주세요.</h3>
  33. </div>
  34. <!-- //TITLE -->
  35. <div class="panelContent">
  36. <table class="frmStyle">
  37. <colgroup>
  38. <col width="8%"/>
  39. <col/>
  40. <col width="8%"/>
  41. <col width="25%"/>
  42. <col width="8%"/>
  43. <col width="20%"/>
  44. </colgroup>
  45. <tr>
  46. <th>업체/브랜드</th>
  47. <td>
  48. <select name="supplyCompCd" id="supplyCompCd">
  49. <option value="" th:if="${sessionInfo.roleCd} != 'B000'">[전체]</option>
  50. <option th:if="${supplyCompList}" th:each="oneData, status : ${supplyCompList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
  51. </select>
  52. <select name="brandCd" id="brandCd">
  53. <option value="">[전체]</option>
  54. </select>
  55. </td>
  56. <th>키워드</th>
  57. <td>
  58. <select name="search" id="search">
  59. <option value="searchGoodsCd">상품코드</option>
  60. <option value="searchGoodsNm">상품명</option>
  61. <option value="searchGoodsNum">품번</option>
  62. <option value="searchSupplyGoodsCd">업체상품코드</option>
  63. </select>
  64. <input type="text" class="w50p" name="condition" id="condition" maxlength="50"/>
  65. </td>
  66. <th>시즌/년도</th>
  67. <td>
  68. <select name="styleYear" id="styleYear">
  69. <option value="">[전체]</option>
  70. <option th:if="${styleYearList}" th:each="oneData, status : ${styleYearList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
  71. </select>
  72. <select name="seasonCd" id="seasonCd">
  73. <option value="">[전체]</option>
  74. <option th:if="${seasonList}" th:each="oneData, status : ${seasonList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
  75. </select>
  76. </td>
  77. </tr>
  78. <tr>
  79. <th>비노출예약일</th>
  80. <td colspan="5" id="sellTerms"></td>
  81. </tr>
  82. </table>
  83. <ul class="panelBar">
  84. <li class="center">
  85. <button type="button" class="btn btn-gray btn-lg" id="btnInit" >초기화</button>
  86. <button type="button" class="btn btn-info btn-lg" id="btnSearch" >조회</button>
  87. </li>
  88. </ul>
  89. </div>
  90. <!-- //검색조건 영역 -->
  91. </div>
  92. <!-- 패널 영역1 -->
  93. <div class="panelStyle">
  94. <!-- 검색결과 영역 -->
  95. <!-- 상단버튼 영역 -->
  96. <ul class="panelBar">
  97. <li class="left">
  98. <button type="button" class="btn btn-default btn-lg" onclick="cfnDownloadSampleFile('SF003');">상품엑셀조회 양식 다운로드</button>
  99. <button type="button" class="btn btn-base btn-lg" id="btnGoodsExcelUpLoad">엑셀조회</button>
  100. <button type="button" class="btn btn-success btn-lg" id="btnGoodsEpSkipSave">비노출예약등록</button>
  101. <button type="button" class="btn btn-danger btn-lg" id="btnGoodsEpSkipDelete">비노출예약삭제</button>
  102. </li>
  103. <li class="right">
  104. 검색결과 : <strong><span id="gridRowTotalCount">0</span> 건</strong>&nbsp;
  105. 쪽번호 <span id="pgNo">0</span>/ <strong id="endPgNo">0</strong>&nbsp;&nbsp;
  106. <select id="pageSize" name="pageSize">
  107. <option value="50" selected="selected">50개씩 보기</option>
  108. <option value="100">100개씩 보기</option>
  109. <option value="500">500개씩 보기</option>
  110. <option value="1000">1000개씩 보기</option>
  111. </select>
  112. <input type="hidden" name="pageNo" id="pageNo" value ="1"/>
  113. </li>
  114. </ul>
  115. <!-- //상단버튼 영역 -->
  116. <div id="gridList" style="width: 100%; height: 550px;" class="ag-theme-balham"></div>
  117. <ul class="panelBar">
  118. <li class="center">
  119. <div class="tablePaging" id="goodsListPagination"></div>
  120. </li>
  121. </ul>
  122. <!-- 검색결과 영역 -->
  123. </div>
  124. </form>
  125. <!-- //패널 영역2 -->
  126. </div>
  127. <script type="text/javascript" src="/ux/plugins/gaga/gaga.paging.js?v=2019072202"></script>
  128. <script th:inline="javascript">
  129. /*<![CDATA[*/
  130. var sessRoleCd = [[${sessionInfo.roleCd}]];
  131. var goodsStatList = gagajf.convertToArray([[${goodsStatList}]]);
  132. var formalGbList = gagajf.convertToArray([[${formalGbList}]]);
  133. var columnDefs = [
  134. {width: 40, minWidth: 40, cellClass: 'text-right', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
  135. {headerName: 'No', width: 60, cellClass: 'text-center',
  136. valueGetter: function(params) { return cfnGridNumner('goodsEpSkipListForm',params.node.rowIndex, 'A');}
  137. },
  138. {headerName: "브랜드명", field: "brandEnm", width: 130, cellClass: 'text-center'},
  139. {headerName: "상품코드", field: "goodsCd", width: 140, cellClass: 'text-center'},
  140. {headerName: "상품명", field: "goodsNm", width: 180, cellClass: 'text-left'
  141. ,cellRenderer: function(params) {
  142. return '<a href="javascript:void(0);">' + params.value + '</a>';
  143. }
  144. },
  145. {headerName: "상품상태", field: "goodsStat" , width: 100, cellClass: 'text-center',
  146. cellEditorParams: { values: gagaAgGrid.extractValues(goodsStatList) },
  147. valueFormatter: function (params) { return gagaAgGrid.lookupValue(goodsStatList, params.value); },
  148. valueParser: function (params) { return gagaAgGrid.lookupKey(goodsStatList, params.newValue); }
  149. },
  150. {headerName: "예약시작일", field: "applyStdt", width: 150, cellClass: 'text-center',
  151. cellRenderer: function(params) {
  152. return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD") : '';
  153. }
  154. },
  155. {headerName: "예약종료일", field: "applyEddt", width: 150, cellClass: 'text-center',
  156. cellRenderer: function(params) {
  157. return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD") : '';
  158. }
  159. },
  160. {headerName: "등록일시", field: "regDt", width: 150, cellClass: 'text-center',
  161. cellRenderer: function(params) {
  162. return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") : '';
  163. }
  164. },
  165. {headerName: "등록자", field: "regNm", width: 100, cellClass: 'text-center'},
  166. {headerName: "수정일시", field: "updDt", width: 150, cellClass: 'text-center',
  167. cellRenderer: function(params) {
  168. return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") : '';
  169. }
  170. },
  171. {headerName: "수정자", field: "updNm", width: 100, cellClass: 'text-center'}
  172. ];
  173. // Get GridOptions
  174. var gridOptions = gagaAgGrid.getGridOptions(columnDefs);
  175. // 중복 선택 가능
  176. gridOptions.rowSelection = 'multiple';
  177. gridOptions.suppressRowClickSelection = true;
  178. // Row Click
  179. gridOptions.onCellClicked = function(event) {
  180. var goodsCd = event.data.goodsCd;
  181. if (event.colDef.field == "goodsNm"){
  182. cfnOpenGoodsDetailPopup('U',goodsCd);
  183. }else if (event.colDef.field == "goodsCd"){
  184. }
  185. }
  186. // 초기화 클릭시
  187. $('#btnInit').on('click', function() {
  188. fnInit();
  189. });
  190. var fnInit = function(){
  191. $('#goodsEpSkipListForm')[0].reset();
  192. $("#goodsEpSkipListForm input[type=checkbox]").removeClass("checked");
  193. $("#goodsEpSkipListForm input[type=checkbox]").parent("label").removeClass("checked");
  194. $("#goodsEpSkipListForm input[type=radio][checked]").parent("label").addClass("checked");
  195. }
  196. // 조회클릭시
  197. $('#btnSearch').on('click', function() {
  198. $("#goodsEpSkipListForm input[name=pageNo]").val('1');
  199. fnGoodsEpSkipListSearch('BASIC');
  200. });
  201. // 조회
  202. var fnGoodsEpSkipListSearch = function(gbn) {
  203. if (typeof(gbn) != 'undefined' && gbn == 'EXCEL'){
  204. $("#goodsEpSkipListForm input[name=searchGb]").val("EXCEL");
  205. }else{
  206. $("#goodsEpSkipListForm input[name=searchGb]").val("BASIC");
  207. }
  208. if(!fnConditionCheck()) return;
  209. gagaPaging.init('goodsEpSkipListForm', fnSearchCallBack, 'goodsListPagination', $('#goodsEpSkipListForm').find('#pageSize').val());
  210. gagaPaging.load($("#goodsEpSkipListForm input[name=pageNo]").val());
  211. }
  212. // 조회 (등록 창 닫을 때)
  213. var fnGoodsRsvtEpSkipListSearch = function(gbn) {
  214. if (typeof(gbn) != 'undefined' && gbn == 'EXCEL'){
  215. $("#goodsEpSkipListForm input[name=searchGb]").val("EXCEL");
  216. }else{
  217. $("#goodsEpSkipListForm input[name=searchGb]").val("BASIC");
  218. }
  219. gagaPaging.init('goodsEpSkipListForm', fnSearchCallBack, 'goodsListPagination', $('#goodsEpSkipListForm').find('#pageSize').val());
  220. gagaPaging.load($("#goodsEpSkipListForm input[name=pageNo]").val());
  221. }
  222. //검색 조건 확인
  223. var fnConditionCheck = function(){
  224. var formId = '#goodsEpSkipListForm';
  225. var form = document.goodsEpSkipListForm;
  226. if($("#goodsEpSkipListForm input[name=searchGb]").val() == "EXCEL") return true;
  227. var searchFlag = false;
  228. var cnt = 0;
  229. for (i = 0; i < form.elements.length; i++ ) {
  230. var el = form.elements[i];
  231. if ($(el).prop("type") == "text" || ($(el).prop("type") == "select-one" && el.name != "search" && el.name != "pageSize")) {
  232. if (!(el.value == null || el.value == "")) {
  233. cnt++;
  234. }
  235. }
  236. }
  237. if(cnt > 0) searchFlag = true;
  238. if(searchFlag == false){
  239. mcxDialog.alert("검색조건을 입력하세요.");
  240. return false;
  241. }
  242. var fromDate = $('#goodsEpSkipListForm input[name=stDate]').val();
  243. var toDate = $('#goodsEpSkipListForm input[name=edDate]').val();
  244. if (!gagajf.isNull(fromDate) || !gagajf.isNull(toDate)) {
  245. if (gagajf.isNull(fromDate) || gagajf.isNull(toDate)) {
  246. mcxDialog.alertC("등록일 조회시 시작일자와 종료일자를 입력하세요.", {
  247. sureBtnText: "확인",
  248. sureBtnClick: function(){
  249. $('#goodsEpSkipListForm input[name=stDate]').focus();
  250. }
  251. });
  252. return false;
  253. }
  254. if (fromDate > toDate) {
  255. mcxDialog.alertC("노출기간 시작일자는 종료일자 보다 클 수 없습니다.", {
  256. sureBtnText: "확인",
  257. sureBtnClick: function(){
  258. $('#goodsEpSkipListForm input[name=stDate]').focus();
  259. }
  260. });
  261. return false;
  262. }
  263. }
  264. return true;
  265. }
  266. var fnSearchCallBack = function(result){
  267. $('#goodsEpSkipListForm').find('#gridRowTotalCount').html(result.pageing.pageable.totalCount.addComma());
  268. $('#goodsEpSkipListForm').find('#pageNo').val(result.pageing.pageable.pageNo.addComma());
  269. $('#goodsEpSkipListForm').find('#pgNo').html(result.pageing.pageable.pageNo.addComma());
  270. $('#goodsEpSkipListForm').find('#endPgNo').html(result.pageing.pageable.totalPage.addComma());
  271. gridOptions.api.setRowData(result.goodsEpSkipList);
  272. gagaPaging.createPagination(result.pageing.pageable);
  273. }
  274. //페이징
  275. $('#goodsEpSkipListForm select[name=pageSize]').on('change', function() {
  276. $("#goodsEpSkipListForm input[name=pageNo]").val('1');
  277. fnGoodsEpSkipListSearch($("#goodsEpSkipListForm input[name=searchGb]").val());
  278. });
  279. //업체변경시
  280. $('#goodsEpSkipListForm select[name=supplyCompCd]').on('change', function() {
  281. var actionUrl = '/renderer/supplyCompany/brand/list/' + $(this).val();
  282. if(sessRoleCd == "G001_B000"){
  283. actionUrl = '/renderer/brand/AuthBrandlist';
  284. }
  285. $("#goodsEpSkipListForm select[name=brandCd] option:gt(0)").remove();
  286. cfnCreateCombo(actionUrl, $('#goodsEpSkipListForm select[name=brandCd]'), "[전체]", "");
  287. });
  288. //엑셀 상품 조회
  289. $('#btnGoodsExcelUpLoad').on('click', function() {
  290. cfnExcelUploadPopup('goodsEpSkipExcelUpload', 'goodsEpSkipExcelUpload');
  291. });
  292. var goodsEpSkipExcelUpload = function(result){
  293. var data = {procJob : result.procJob
  294. ,excelFileNm : result.excelFileNm
  295. };
  296. var jsonData = JSON.stringify(data);
  297. gagajf.ajaxJsonSubmit('/goods/search/excelupload/save', jsonData, fngoodsEpSkipExcelUploadCallBack);
  298. }
  299. var fngoodsEpSkipExcelUploadCallBack = function(result){
  300. fnGoodsEpSkipListSearch("EXCEL");
  301. }
  302. //예약등록
  303. $('#btnGoodsEpSkipSave').click(function(e) {
  304. var actionUrl = "/goods/ep/skip/popup/form";
  305. cfnOpenModalPopup(actionUrl, 'popupGoodsEpSkip');
  306. });
  307. //예약삭제
  308. $('#btnGoodsEpSkipDelete').click(function(e) {
  309. //상품선택여부 확인처리 추가
  310. var selectedData = gridOptions.api.getSelectedRows();
  311. if (selectedData.length == 0) {
  312. mcxDialog.alert('선택된 행이 없습니다.');
  313. return false;
  314. }
  315. var arrGoodsCd = [];
  316. var arrGoodsEpSkipSq = [];
  317. var chkFlag = false;
  318. $.each(selectedData, function(idx, item) {
  319. var toDateStr = new Date().format("YYYYMMDDHHmmss");
  320. if (toDateStr > item.applyEddt){
  321. chkFlag = true;
  322. mcxDialog.alertC("종료된 네이버 EP 제외 상품은 삭제할 수 없습니다.", {
  323. sureBtnText: "확인",
  324. sureBtnClick: function(){
  325. $('#goodsRsvtEpSkipForm input[name=applyEdYMD]').focus();
  326. }
  327. });
  328. return false;
  329. }
  330. arrGoodsCd.push(item.goodsCd);
  331. arrGoodsEpSkipSq.push(item.goodsEpSkipSq);
  332. });
  333. if (chkFlag){
  334. return;
  335. }
  336. mcxDialog.confirm('삭제하시겠습니까?', {
  337. cancelBtnText: "취소",
  338. sureBtnText: "확인",
  339. sureBtnClick: function(){
  340. var data = {arrGoodsCd : arrGoodsCd
  341. ,arrGoodsEpSkipSq : arrGoodsEpSkipSq
  342. };
  343. var jsonData = JSON.stringify(data);
  344. gagajf.ajaxJsonSubmit('/goods/rsvt/ep/skip/delete', jsonData, fnGoodsEpSkipResDeleteCallBack);
  345. }
  346. });
  347. });
  348. var fnGoodsEpSkipResDeleteCallBack = function(){
  349. //fnGoodsRsvtEpSkipListSearch($("#goodsEpSkipListForm input[name=searchGb]").val());
  350. }
  351. $(document).ready(function() {
  352. cfnCreateCalendar('#sellTerms', 'applyStdt', 'applyEddt', true, '예약일', 'X');
  353. var chkBeforSkipFlag = '&nbsp;&nbsp;<label class="chkBox"><input type="checkbox" name="beforSkipFlag" value="Y" >이전데이터 제외</label>';
  354. $("#goodsEpSkipListForm").find('#sellTerms').append(chkBeforSkipFlag);
  355. // Create a agGrid
  356. gagaAgGrid.createGrid('gridList', gridOptions);
  357. });
  358. /*]]>*/
  359. </script>
  360. </html>