GoodsReserveSellPopupForm.html 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <!DOCTYPE html>
  2. <html lang="ko"
  3. xmlns:th="http://www.thymeleaf.org">
  4. <!--
  5. *******************************************************************************
  6. * @source : GoodsReserveSellPopupForm.html
  7. * @desc : 상품예약판매 등록 화면
  8. *============================================================================
  9. * STYLE24
  10. * Copyright(C) 2020 TSIT, All rights reserved.
  11. *============================================================================
  12. * VER DATE AUTHOR DESCRIPTION
  13. * === =========== ========== =============================================
  14. * 1.0 2020.11.12 eskim 최초 작성
  15. *******************************************************************************
  16. -->
  17. <div class="modalPopup" data-width="700" >
  18. <div class="panelStyle">
  19. <div class="panelTitle">
  20. <h2>예약판매등록</h2>
  21. <button type="button" class="close" onclick="uifnPopupClose('popupGoodsRsvtList')"><i class="fa fa-times"></i></button>
  22. </div>
  23. <form id="goodsResSellRegisterForm" name="goodsResSellRegisterForm" >
  24. <div class="panelContent">
  25. <table class="frmStyle">
  26. <colgroup>
  27. <col style="width:10%;"/>
  28. <col/>
  29. </colgroup>
  30. <tr>
  31. <th>출고예정일<em class="required" title="필수"></em></th>
  32. <td>
  33. <input name="delvResDt" id="delvResDt" type="text" class="w80 schDate" maxlength="10" required="required" data-valid-name="출고예정일" />
  34. </td>
  35. </tr>
  36. </table>
  37. </div>
  38. <ul class="panelBar">
  39. <li class="left">
  40. <button type="button" class="btn btn-danger btn-lg" id="btnDeleteGoodsResSell">상품삭제</button>
  41. </li>
  42. <li class="right">
  43. <button type="button" class="btn btn-base btn-lg" id="btnSearchExcel">엑셀조회</button>
  44. <button type="button" class="btn btn-info btn-lg" id="btnSearchGoods">상품조회</button>
  45. </li>
  46. </ul>
  47. <div id="gridGoodsResSellRegisterList" style="width: 100%; height: 500px;" class="ag-theme-balham"></div>
  48. <ul class="panelBar">
  49. <li class="right">
  50. <button type="button" class="btnRight btn btn-base btn-lg" id=btnSaveGoodsResSell>저장</button>
  51. </li>
  52. </ul>
  53. </form>
  54. </div>
  55. </div>
  56. <script th:inline="javascript">
  57. /*<![CDATA[*/
  58. var goodsResSellRegisterColumnDefs = [
  59. {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
  60. {headerName: 'No', width: 60, cellClass: 'text-center',valueGetter: function(params) { return params.node.rowIndex+1}},
  61. {headerName: "브랜드명", field: "brandEnm", width: 140, cellClass: 'text-center'},
  62. {headerName: "상품코드", field: "goodsCd", width: 140, cellClass: 'text-center'},
  63. {headerName: "상품명", field: "goodsNm", width: 250, cellClass: 'text-left'}
  64. ];
  65. // Get GridOptions
  66. var goodsResSellRegisterGridOptions = gagaAgGrid.getGridOptions(goodsResSellRegisterColumnDefs);
  67. // 중복 선택 가능
  68. goodsResSellRegisterGridOptions.rowSelection = 'multiple';
  69. goodsResSellRegisterGridOptions.suppressRowClickSelection = true;
  70. // 상품 조회 클릭 시
  71. $('#btnSearchGoods').on('click', function() {
  72. cfnOpenGoodsPopup('fnSearchGoods');
  73. });
  74. // 상품 조회 콜백함수
  75. var fnSearchGoods = function(result) {
  76. if (result.length < 1) return;
  77. var oldData = gagaAgGrid.getAllRowData(goodsResSellRegisterGridOptions);
  78. $.each(result, function(idx, item) {
  79. if(item.goodsType != 'G056_N'){
  80. return true;
  81. }
  82. var isInvalid = false;
  83. if (oldData != null && oldData.length != 0){
  84. oldData.forEach(function(oneData){
  85. if(oneData.goodsCd == item.goodsCd){
  86. isInvalid = true;
  87. return true;
  88. }
  89. });
  90. if(isInvalid){
  91. return isInvalid;
  92. }
  93. }
  94. gagaAgGrid.addRowData(goodsResSellRegisterGridOptions, {"goodsCd" : item.goodsCd, "goodsNm" : item.goodsNm, "brandEnm" : item.brandEnm});
  95. });
  96. //uifnPopupClose('popupGoods');
  97. return;
  98. };
  99. // 저장 클릭 시
  100. $('#btnSaveGoodsResSell').on('click', function() {
  101. var delvResDt = $('#goodsResSellRegisterForm input[name=delvResDt]').val();
  102. if (gagajf.isNull(delvResDt)) {
  103. mcxDialog.alertC("출고예정일을 입력하세요.", {
  104. sureBtnText: "확인",
  105. sureBtnClick: function() {
  106. $('#goodsResSellRegisterForm input[name=delvResDt]').focus();
  107. }
  108. });
  109. return false;
  110. }
  111. delvResDt = $('#goodsResSellRegisterForm input[name=delvResDt]').val().replaceAll("-","");
  112. var toDateStr = new Date().format("YYYYMMDD");
  113. if (toDateStr >= delvResDt){
  114. mcxDialog.alertC("출고예정일은 현재일시 보다 작거나 같을 수 없습니다.", {
  115. sureBtnText: "확인",
  116. sureBtnClick: function() {
  117. $('#goodsResSellRegisterForm input[name=delvResDt]').focus();
  118. }
  119. });
  120. return false;
  121. }
  122. mcxDialog.confirm('저장하시겠습니까?', {
  123. cancelBtnText: "취소",
  124. sureBtnText: "확인",
  125. sureBtnClick: function(){
  126. var arrGoodsCd = [];
  127. var allRowData = gagaAgGrid.getAllRowData(goodsResSellRegisterGridOptions);
  128. allRowData.forEach(function(item, index) {
  129. arrGoodsCd.push(item.goodsCd);
  130. });
  131. var data = {delvResDt : delvResDt
  132. , arrGoodsCd : arrGoodsCd
  133. };
  134. var jsonData = JSON.stringify(data);
  135. gagajf.ajaxJsonSubmit('/goods/reserve/sell/regist/save', jsonData, fnGoodsResSellRegisterFormClose);
  136. }
  137. });
  138. });
  139. //엑셀 상품 조회
  140. $('#btnSearchExcel').on('click', function() {
  141. cfnExcelUploadPopup('goodsResSellRegistExcelUpload', 'goodsResSellRegistExcelUpload');
  142. });
  143. var goodsResSellRegistExcelUpload = function(result){
  144. var data = {procJob : result.procJob
  145. ,excelFileNm : result.excelFileNm
  146. };
  147. var jsonData = JSON.stringify(data);
  148. gagajf.ajaxJsonSubmit('/goods/search/excelupload/save', jsonData, fnGoodsResSellExcelUploadCallBack);
  149. }
  150. var fnGoodsResSellExcelUploadCallBack = function(result){
  151. gagajf.ajaxJsonSubmit('/goods/excel/upload/goods/list', '', fnExcelSearchCallBack);
  152. }
  153. var fnExcelSearchCallBack = function(result){
  154. if (result.goodsExcelList.length < 1) return;
  155. var oldData = gagaAgGrid.getAllRowData(goodsResSellRegisterGridOptions);
  156. $.each(result.goodsExcelList, function(idx, item) {
  157. if(item.goodsType != 'G056_N'){
  158. return true;
  159. }
  160. var isInvalid = false;
  161. if (oldData != null && oldData.length != 0){
  162. oldData.forEach(function(oneData){
  163. if(oneData.goodsCd == item.goodsCd){
  164. isInvalid = true;
  165. return true;
  166. }
  167. });
  168. if(isInvalid){
  169. return isInvalid;
  170. }
  171. }
  172. gagaAgGrid.addRowData(goodsResSellRegisterGridOptions, {"goodsCd" : item.goodsCd, "goodsNm" : item.goodsNm, "brandEnm" : item.brandEnm});
  173. });
  174. return;
  175. }
  176. // 조회상품 삭제
  177. $('#btnDeleteGoodsResSell').on('click', function() {
  178. var selectedData = goodsResSellRegisterGridOptions.api.getSelectedRows();
  179. if (selectedData.length == 0) {
  180. mcxDialog.alert('선택된 행이 없습니다.');
  181. return;
  182. }
  183. //화면에서 삭제
  184. var removedData = gagaAgGrid.removeRowData(goodsResSellRegisterGridOptions, false);
  185. });
  186. //창종료
  187. var fnGoodsResSellRegisterFormClose = function(){
  188. uifnPopupClose('popupGoodsRsvtList');
  189. fnGoodsResSellDeleteCallBack();
  190. }
  191. $(document).ready(function() {
  192. // Create a agGrid
  193. gagaAgGrid.createGrid('gridGoodsResSellRegisterList', goodsResSellRegisterGridOptions);
  194. });
  195. /*]]>*/
  196. </script>
  197. </html>