ITP_MPOMNG01010.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. require(['config'], function() {
  2. require([
  3. ], function($) {
  4. mobPageObj.init();
  5. });
  6. });
  7. /*API URL*/
  8. const API_MOBILE_INIT_INFO = '/api/pomng/init-pchReq';
  9. const API_MOBILE_SAVE = '/api/pomng/save-pchReq';
  10. const API_POP_SEARCH_LIST = '/api/whs/mng/pop-whs-search';
  11. const API_POP_ITEM_LIST = '/api/item/pop-grid-list';
  12. const ID_ITP_POP_MPOMNG01010_REQ_AREA = "ITP_POP_MPOMNG01010_REQ_AREA";
  13. const ID_ITP_POP_MPOMNG01010_WHS_AREA = "ITP_POP_MPOMNG01010_WHS_AREA";
  14. const ID_ITP_POP_MPOMNG01010_ITEM_AREA = "ITP_POP_MPOMNG01010_ITEM_AREA";
  15. const PCH_REQ_ST_CD_TEMP_SAVE ="PR00";
  16. const PCH_REQ_ST_CD_REQUEST_SAVE ="PR20";
  17. let mobPageObj = {
  18. isPrevPage: false,
  19. pageParam: null,
  20. init: function () {
  21. this.ui.init();
  22. this.event.init();
  23. this.ready();
  24. },
  25. ui: {
  26. init: function () {
  27. this.info();
  28. },
  29. info: function() {
  30. $('input:hidden[id$="_BRAND_ID"]').val(fn_make_user_info.get('brandId'));
  31. $('input:hidden[id$="_STORE_ID"]').val(fn_make_user_info.get('storeId'));
  32. $('#ITP_MOBILE_MPOMNG01010 .itp_input.date').datepicker(ITP_DATE_LANGUAGE);
  33. $('#ITP_FORM_MPOMNG01010_DETAIL_DLV_REQ_DT').datepicker('setDate', itp_fn_date_add('M', 0));
  34. if(fn_make_user_info.get('authTpCd') === '50') {
  35. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_WHS_NM').attr('readonly', true);
  36. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_BTN_MPOMNG01010_DETAIL_SEARCH_WHS_NM').attr('disabled', true);
  37. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_BTN_MPOMNG01010_DETAIL_DELETE_WHS_NM').attr('disabled', true);
  38. }
  39. }
  40. },
  41. event: {
  42. init: function() {
  43. this.button();
  44. },
  45. button: function() {
  46. $('button[id^="ITP_BTN_MPOMNG01010_DETAIL"]').on('click', function() {
  47. if($(this).is('[data-call-popup]')) {
  48. mobPopObj.show($(this).data('call-popup'), $(this).attr('id'));
  49. } else {
  50. var id = $(this).attr('id');
  51. switch (id) {
  52. case 'ITP_BTN_MPOMNG01010_DETAIL_DELROW' : mobContObj.list.delRow(); break;
  53. case 'ITP_BTN_MPOMNG01010_DETAIL_SEARCH_WHS_NM' : mobPopObj.popWhsNm.init(); break;
  54. case 'ITP_BTN_MPOMNG01010_DETAIL_DELETE_WHS_NM' : mobPopObj.popWhsNm.delete(); break;
  55. case 'ITP_BTN_MPOMNG01010_DETAIL_CANCEL' : mobContObj.cancel(); break;
  56. }
  57. }
  58. return false;
  59. });
  60. }
  61. },
  62. ready: function() {
  63. mobContObj.init();
  64. }
  65. };
  66. let mobContObj = {
  67. init: function() {
  68. this.data.load();
  69. },
  70. data: {
  71. initPchReq: null,
  72. load: function() {
  73. var _this = this;
  74. var callbackFn = function(result) {
  75. console.log(result);
  76. _this.initPchReq = result;
  77. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_BRAND_ID').val(result.brandId);
  78. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_STORE_ID').val(result.storeId);
  79. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_LOAN_DVSN').val(result.loanDvsn);
  80. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_LOAN_MGNT_UNQ_NO').val(result.loanMgntUnqNo);
  81. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_PCH_REQ_DVSN').val(result.pchReqDvsn);
  82. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_PCH_REQ_UNQ_NO').val(result.pchReqUnqNo);
  83. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_MALL_ID').val(result.mallId);
  84. $('#ITP_FORM_MPOMNG01010_DETAIL .fnOrdUseAmt').text(CommonObj.currency.add(result.ordUseAmt));
  85. if(result.whsId !== '' && result.location !== '') {
  86. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_WHS_ID').val(result.whsId);
  87. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_WHS_NM').val(result.whsNm);
  88. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_LOCATION').val(result.location);
  89. }
  90. };
  91. const param = {brandId:fn_make_user_info.get('brandId'), storeId:fn_make_user_info.get('storeId')};
  92. fn_ajax_call(API_MOBILE_INIT_INFO, param, callbackFn, 'GET');
  93. }
  94. },
  95. list: {
  96. rows: [],
  97. addRow: function() {
  98. },
  99. delRow: function() {
  100. this.detachRow();
  101. },
  102. attachRow: function (item) {
  103. console.log(item);
  104. var _this = this;
  105. var fnIsExist = function(rows) {
  106. var isExist = false;
  107. $.each(rows, function(i, row) {
  108. if(row.brandUnitUnqNo === item.brandUnitUnqNo) {
  109. isExist = true;
  110. return false;
  111. }
  112. });
  113. return isExist;
  114. };
  115. if(!fnIsExist(this.rows)) {
  116. this.rows.push(item);
  117. $('#ITP_LIST_MPOMNG01010_ITEM_AREA .panel-group').append($('#ITP_LIST_MPOMNG01010_DETAIL_ROWCOPY').html());
  118. var $li = $('#ITP_LIST_MPOMNG01010_ITEM_AREA .panel-group > .list-row:last');
  119. $li.find('.fnBrandUnitUnqNo').val(item.brandUnitUnqNo);
  120. $li.find('.fnItemNm').text(item.itemNm);
  121. $li.find('.fnPchReqQty').text(item.pchReqQty);
  122. $li.find('.fnUnitAmt').text(CommonObj.currency.add(item.unitAmt));
  123. this.pchReqAmtTot();
  124. $('.list-row #ITP_BTN_MPOMNG01010_DETAIL_PLUS')[$li.index()].addEventListener('click', function() { _this.actPlus(this); });
  125. $('.list-row #ITP_BTN_MPOMNG01010_DETAIL_MINUS')[$li.index()].addEventListener('click', function() { _this.actMinus(this); });
  126. }
  127. },
  128. detachRow: function () {
  129. if($('#ITP_LIST_MPOMNG01010_ITEM_AREA input:checkbox[name=brandUnitUnqNo]:checked').length > 0) {
  130. var _this = this;
  131. $('#ITP_LIST_MPOMNG01010_DETAIL_ROWS li').each(function(index, elem) {
  132. var isChecked = $(this).find('input[type="checkbox"]').is(':checked');
  133. if(isChecked) {
  134. $(this).remove();_this.rows.splice(index, 1);
  135. }
  136. });
  137. this.pchReqAmtTot();
  138. }
  139. },
  140. actPlus: function(elem) {
  141. var $div = $(elem).siblings('div');
  142. var num = Number($div.text());
  143. console.log('actPlus ===> ' + num);
  144. $($div).text((num + 1).toString());
  145. this.rows[$div.parents('li').index()]['pchReqQty'] = $($div).text();
  146. this.pchReqAmtTot();
  147. },
  148. actMinus: function(elem) {
  149. var $div = $(elem).siblings('div');
  150. var num = Number($div.text());
  151. console.log('actMinus ===> ' + num);
  152. if(num <= 1) {
  153. alert('주문수량을 확인하세요.');
  154. } else {
  155. $($div).text((num - 1).toString());
  156. this.rows[$div.parents('li').index()]['pchReqQty'] = $($div).text();
  157. this.pchReqAmtTot();
  158. }
  159. },
  160. pchReqAmtTot: function() {
  161. var reqAmt = 0;
  162. $.each(this.rows, function(index, item) {
  163. var qty = item.pchReqQty;
  164. var amt = item.unitAmt;
  165. reqAmt += Number(qty) * amt;
  166. });
  167. $('#ITP_AJAX_MPOMNG01010_VIEW_CONTAINER').find('.fnPchReqAmtTot').text(CommonObj.currency.add(reqAmt));
  168. }
  169. },
  170. cancel: function () {
  171. $(location).attr('href', MOBILE_CONTEXTPATH + '/app/main.html');
  172. }
  173. };
  174. let mobPopObj = {
  175. init: function(popId, parentId) {
  176. switch (popId) {
  177. case 'ITP_POP_MPOMNG01010_REQ_AREA' : this.popReqConfirm.init(parentId); break;
  178. case 'ITP_POP_MPOMNG01010_WHS_AREA' : this.popWhsNm.init(); break;
  179. case 'ITP_POP_MPOMNG01010_ITEM_AREA' : this.popItem.init(); break;
  180. }
  181. },
  182. popItem: {
  183. // rows: null,
  184. init: function() {
  185. this.search();
  186. },
  187. search: function() {
  188. $('#ITP_LIST_MPOMNG01010_POP_ITEM_AREA .panel-group').empty();
  189. var callbackFn = function(result) {
  190. console.log(result);
  191. mobPopObj.popItem.rows = result.gridRows;
  192. $.each(mobPopObj.popItem.rows, function (i, item) {
  193. $('#ITP_LIST_MPOMNG01010_POP_ITEM_AREA .panel-group').append($('#ITP_LIST_MPOMNG01010_POP_ITEM_ROWCOPY').html());
  194. var $li = $('#ITP_LIST_MPOMNG01010_POP_ITEM_AREA .panel-group > .row_2:last');
  195. $li.find('#ITP_FORM_MPOMNG01010_POP_ITEM_CHECKBOX').val(item.itemId);
  196. $li.find('.fnItemNm').text(item.itemNm);
  197. $li.find('.fnUnitAmt').text(CommonObj.currency.add(item.unitAmt));
  198. });
  199. mobPopObj.popItem.addRow.init();
  200. };
  201. let param = $('#ITP_FORM_MPOMNG01010_POPUP_ITEM').serializeObject();
  202. fn_ajax_call(API_POP_ITEM_LIST, JSON.stringify(param), callbackFn, 'POST');
  203. },
  204. addRow: {
  205. init: function() {
  206. this.button.init();
  207. },
  208. button: {
  209. init: function() {
  210. var _this = this;
  211. $('button[id^="ITP_BTN_MPOMNG01010_POP_ITEM_"]').off('click').on('click', function() {
  212. var id = $(this).attr('id');
  213. switch (id) {
  214. case 'ITP_BTN_MPOMNG01010_POP_ITEM_PLUS' : _this.actPlus($(this)); break;
  215. case 'ITP_BTN_MPOMNG01010_POP_ITEM_MINUS' : _this.actMinus($(this)); break;
  216. case 'ITP_BTN_MPOMNG01010_POP_ITEM_ADD' : _this.actItemAdd($(this)); break;
  217. case 'ITP_BTN_MPOMNG01010_POP_ITEM_SEARCH' : mobPopObj.popItem.search(); break;
  218. case 'ITP_BTN_MPOMNG01010_POP_ITEM_CLOSE' : mobPopObj.hide(id); break;
  219. }
  220. return false;
  221. });
  222. },
  223. actPlus: function(elem) {
  224. var $div = $(elem).siblings('div');
  225. var num = Number($div.text());
  226. $($div).text((num + 1).toString());
  227. },
  228. actMinus: function(elem) {
  229. var $div = $(elem).siblings('div');
  230. var num = Number($div.text());
  231. if(num <= 1) {
  232. alert('주문수량을 확인하세요.');
  233. } else {
  234. $($div).text((num - 1).toString());
  235. }
  236. },
  237. actItemAdd: function(elem) {
  238. var index = $(elem).closest('li').index();
  239. var item = mobPopObj.popItem.rows[index];
  240. item['pchReqQty'] = $(elem).closest('li').find('.fnPchReqQty').html();
  241. mobContObj.list.attachRow(item);
  242. }
  243. }
  244. },
  245. delRow: function() {
  246. }
  247. },
  248. popWhsNm: {
  249. init: function () {
  250. this.rows.length = 0;
  251. this.search();
  252. this.action();
  253. },
  254. rows: [],
  255. search: function () {
  256. var _this = this;
  257. $('#ITP_LIST_MPOMNG01010_POP_WHS_AREA .panel-group').empty();
  258. var callbackFn = function(result) {
  259. console.log(result);
  260. _this.view(result.gridRows);
  261. };
  262. const param = $('#ITP_FORM_MPOMNG01010_POP_WHS').serializeObject();
  263. fn_ajax_call(API_POP_SEARCH_LIST, JSON.stringify(param), callbackFn, 'POST');
  264. },
  265. view: function(gridRows) {
  266. this.rows = gridRows;
  267. $.each(gridRows, function (i, item) {
  268. $('#ITP_LIST_MPOMNG01010_POP_WHS_AREA .panel-group').append($('#ITP_LIST_MPOMNG01010_POP_WHS_ROWCOPY').html());
  269. var $li = $('#ITP_LIST_MPOMNG01010_POP_WHS_AREA .panel-group > .row_2:last');
  270. $li.find('.fnWhsNm').text(item.whsNm);
  271. $li.find('.fnLocationNm').text(item.locationNm);
  272. $li.find('.fnWhsId').data('whs-id', item.whsId);
  273. });
  274. },
  275. action: function() {
  276. var _this = this;
  277. $('#ITP_LIST_MPOMNG01010_POP_WHS_AREA button[id$="POP_WHS_CHOICE"]').off('click').on('click', function() {
  278. var whsId = $(this).data('whs-id');
  279. $.each(_this.rows, function (i, item) {
  280. if(whsId === item.whsId) {
  281. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_WHS_ID').val(item.whsId);
  282. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_WHS_NM').val(item.whsNm);
  283. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_LOCATION').val(item.location);
  284. mobPopObj.hide(ID_ITP_POP_MPOMNG01010_WHS_AREA);
  285. itp_fn_form_clear_validate(null, '#ITP_FORM_MPOMNG01010_DETAIL');
  286. return false;
  287. }
  288. });
  289. });
  290. $('#ITP_FORM_MPOMNG01010_POP_WHS button[id="ITP_BTN_MPOMNG01010_POP_WHS_SEARCH"]').off('click').on('click', function() {
  291. _this.search();
  292. });
  293. },
  294. delete: function() {
  295. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_WHS_ID').val('');
  296. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_WHS_NM').val('');
  297. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_LOCATION').val('');
  298. }
  299. },
  300. popReqConfirm: {
  301. saveMode: 1, // 1 : 임시저장, 2 : 구매요청, 요청금액이 가능금액보다 클 경우 (3 : PG 정보 없음, 4 : 선불매장, 5 : 후불매장)
  302. init: function (parentId) {
  303. this.formId = '#ITP_FORM_MPOMNG01010_DETAIL';
  304. this.pchReqStCd = (parentId === 'ITP_BTN_MPOMNG01010_DETAIL_REQ_ORDER') ? PCH_REQ_ST_CD_REQUEST_SAVE : PCH_REQ_ST_CD_TEMP_SAVE;
  305. this.view();
  306. this.action();
  307. },
  308. view: function() {
  309. var popMsg = '';
  310. var loanDvsn = $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_LOAN_DVSN').val();
  311. var ordUseAmt = CommonObj.onlyNumber($('#ITP_FORM_MPOMNG01010_DETAIL .fnOrdUseAmt').text());
  312. var pchReqAmtTot = CommonObj.onlyNumber($('#ITP_FORM_MPOMNG01010_DETAIL .fnPchReqAmtTot').text());
  313. if(this.pchReqStCd === PCH_REQ_ST_CD_REQUEST_SAVE) { // 구매요청
  314. if(loanDvsn === 'LD03') { // 무정산
  315. this.saveMode = 2;
  316. popMsg = '구매요청 하시겠습니까?';
  317. $('#ITP_POP_MPOMNG01010_REQ_AREA #ITP_BTN_MPOMNG01010_POP_REQ_CONFIRM').text('확인');
  318. } else {
  319. if (ordUseAmt < pchReqAmtTot) { // 요청금액이 가능금액보다 클 경우
  320. if($('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_MALL_ID').val() === '') { // PG 정보 없음
  321. this.saveMode = 3;
  322. popMsg = '무통장 입금 후 구매요청해 주세요.<br>' +
  323. '임시저장 하시겠습니까?';
  324. $('#ITP_POP_MPOMNG01010_REQ_AREA #ITP_BTN_MPOMNG01010_POP_REQ_CONFIRM').text('확인');
  325. } else {
  326. if(loanDvsn === 'LD01') { // 선불매장
  327. this.saveMode = 4;
  328. popMsg = '선불매장이므로 결재를 하셔야 구매요청이 진행이 됩니다.<br>' +
  329. '결재를 하시겠습니까?';
  330. $('#ITP_POP_MPOMNG01010_REQ_AREA #ITP_BTN_MPOMNG01010_POP_REQ_CONFIRM').text('결제');
  331. } else if(loanDvsn === 'LD02') { // 후불매장
  332. this.saveMode = 5;
  333. popMsg = '구매한도가 부족합니다.<br>' +
  334. '선결재를 하신 후에 구매요청을 하시기 바랍니다.<br>' +
  335. '결재를 하시겠습니까?';
  336. $('#ITP_POP_MPOMNG01010_REQ_AREA #ITP_BTN_MPOMNG01010_POP_REQ_CONFIRM').text('결제');
  337. }
  338. }
  339. } else {
  340. this.saveMode = 2;
  341. popMsg = '구매요청 하시겠습니까?';
  342. $('#ITP_POP_MPOMNG01010_REQ_AREA #ITP_BTN_MPOMNG01010_POP_REQ_CONFIRM').text('확인');
  343. }
  344. }
  345. } else { // 임시저장
  346. this.saveMode = 1;
  347. popMsg = '임시저장 하시겠습니까?';
  348. $('#ITP_POP_MPOMNG01010_REQ_AREA #ITP_BTN_MPOMNG01010_POP_REQ_CONFIRM').text('확인');
  349. }
  350. $('#ITP_POP_MPOMNG01010_REQ_AREA .fnPopDlvReqDt').text($('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_DLV_REQ_DT').val());
  351. $('#ITP_POP_MPOMNG01010_REQ_AREA .fnItemQty').text(CommonObj.currency.add(mobContObj.list.rows.length, '개'));
  352. $('#ITP_POP_MPOMNG01010_REQ_AREA .fnOrdAmt').text(CommonObj.currency.add(pchReqAmtTot));
  353. $('#ITP_POP_MPOMNG01010_REQ_AREA .pop_msg').html(popMsg);
  354. },
  355. action: function() {
  356. var _this = this;
  357. $('#ITP_POP_MPOMNG01010_REQ_AREA button[id="ITP_BTN_MPOMNG01010_POP_REQ_CONFIRM"]').off('click').on('click', function() {
  358. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_PCH_REQ_ST_CD').val(_this.pchReqStCd);
  359. _this.save();
  360. });
  361. },
  362. save: function() {
  363. var procSave = function (rtnFn) {
  364. let param = $('#ITP_FORM_MPOMNG01010_DETAIL').serializeObject();
  365. $.each(mobContObj.list.rows, function(index, item) {
  366. item['viewCd'] = 'C';
  367. });
  368. param.gridInsertData = mobContObj.list.rows;
  369. var saveFn = function (result) {
  370. console.log(result);
  371. mobPopObj.hide('ITP_POP_MPOMNG01010_REQ_AREA');
  372. if(typeof rtnFn === 'function') rtnFn();
  373. };
  374. fn_ajax_call(API_MOBILE_SAVE, JSON.stringify(param), saveFn, 'POST');
  375. };
  376. if (this.saveMode === 1 || this.saveMode === 2 || this.saveMode === 3) {
  377. if(this.saveMode === 3)
  378. $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_PCH_REQ_ST_CD').val(PCH_REQ_ST_CD_TEMP_SAVE);
  379. procSave();
  380. } else if (this.saveMode === 4 || this.saveMode === 5) {
  381. // 결제 팝업 결과
  382. var popFn = function(rowDataPop) {
  383. console.log(JSON.stringify(rowDataPop));
  384. procSave(function(result) { mobContObj.data.load(); });
  385. };
  386. // 결제 팝업
  387. var ordUseAmt = CommonObj.onlyNumber($('#ITP_FORM_MPOMNG01010_DETAIL .fnOrdUseAmt').text());
  388. var pchReqAmtTot = CommonObj.onlyNumber($('#ITP_FORM_MPOMNG01010_DETAIL .fnPchReqAmtTot').text());
  389. var args = {
  390. 'payTpCd' : '40',
  391. 'brandId' : $('#ITP_FORM_MPOMNG01010_DETAIL_BRAND_ID').val(),
  392. 'storeId' : $('#ITP_FORM_MPOMNG01010_DETAIL_STORE_ID').val(),
  393. 'goodsAmt' : Number(pchReqAmtTot - ordUseAmt)
  394. };
  395. fn_call_popup('biz', 'BIZPOP_PO_PAYMENT', '#ITP_ASIDE', popFn, args, 'M');
  396. }
  397. }
  398. },
  399. show: function(popId, parentId) {
  400. var _this = this;
  401. $('button[id$="CLOSE"]').off('click').on('click', function() {
  402. var id = $(this).attr('id');
  403. if($(this).hasClass('btn-pop-close')) {
  404. _this.hide(id);
  405. }
  406. });
  407. if(parentId === 'ITP_BTN_MPOMNG01010_DETAIL_REQ_ORDER' || parentId === 'ITP_BTN_MPOMNG01010_DETAIL_TEMP_SAVE') {
  408. var formId = '#ITP_FORM_MPOMNG01010_DETAIL';
  409. itp_fn_form_clear_validate(null, formId);
  410. if (itp_fn_form_event.isValid(formId)) {
  411. if($('#ITP_LIST_MPOMNG01010_DETAIL_ROWS > li').size() < 1) {
  412. alert('품목추가 버튼을 이용하여 품목을 추가해 주세요.');
  413. return false;
  414. } else {
  415. $('#' + popId).show();
  416. mobPopObj.init(popId, parentId);
  417. }
  418. }
  419. } else {
  420. $('#' + popId).show();
  421. mobPopObj.init(popId, parentId);
  422. }
  423. },
  424. hide: function(id) {
  425. $('#' + id).closest('.mobile-pop-close').hide();
  426. }
  427. };