ITP_MRTNMNG01010.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. require(['config'], function() {
  2. require([
  3. ], function($) {
  4. mobPageObj.init();
  5. });
  6. });
  7. /*API URL*/
  8. const API_MOBILE_INIT_INFO = '/api/rtnmng/init-rtnReq';
  9. const API_MOBILE_SAVE = '/api/rtnmng/save-rtnReq';
  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_MRTNMNG01010_REQ_AREA = "ITP_POP_MRTNMNG01010_REQ_AREA";
  13. const ID_ITP_POP_MRTNMNG01010_WHS_AREA = "ITP_POP_MRTNMNG01010_WHS_AREA";
  14. const ID_ITP_POP_MRTNMNG01010_ITEM_AREA = "ITP_POP_MRTNMNG01010_ITEM_AREA";
  15. const RTN_REQ_ST_CD_TEMP_SAVE ="RR00";
  16. const RTN_REQ_ST_CD_REQUEST_SAVE ="RR20";
  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. this.view();
  29. },
  30. info: function() {
  31. $('input:hidden[id$="_BRAND_ID"]').val(fn_make_user_info.get('brandId'));
  32. $('input:hidden[id$="_STORE_ID"]').val(fn_make_user_info.get('storeId'));
  33. },
  34. view: function() {
  35. // 조회일자 지정
  36. $('#ITP_MOBILE_MRTNMNG01010 .itp_input.date').datepicker(ITP_DATE_LANGUAGE);
  37. $('#ITP_FORM_MRTNMNG01010_DETAIL_DLV_REQ_DT').datepicker('setDate', itp_fn_date_add('M', 1));
  38. // if(fn_make_user_info.get('authTpCd') === '50') {
  39. // $('#ITP_FORM_MRTNMNG01010_DETAIL #ITP_BTN_MRTNMNG01010_DETAIL_SEARCH_WHS_NM').hide();
  40. // $('#ITP_FORM_MRTNMNG01010_DETAIL #ITP_BTN_MRTNMNG01010_DETAIL_DELETE_WHS_NM').hide();
  41. // }
  42. }
  43. },
  44. event: {
  45. init: function() {
  46. this.button();
  47. },
  48. button: function() {
  49. $('button[id^="ITP_BTN_MRTNMNG01010_DETAIL"]').on('click', function() {
  50. if($(this).is('[data-call-popup]')) {
  51. mobPopObj.show($(this).data('call-popup'), $(this).attr('id'));
  52. } else {
  53. var id = $(this).attr('id');
  54. switch (id) {
  55. case 'ITP_BTN_MRTNMNG01010_DETAIL_DELROW' : mobContObj.list.delRow(); break;
  56. case 'ITP_BTN_MRTNMNG01010_DETAIL_SEARCH_WHS_NM' : mobPopObj.popWhsNm.init(); break;
  57. case 'ITP_BTN_MRTNMNG01010_DETAIL_DELETE_WHS_NM' : mobPopObj.popWhsNm.delete(); break;
  58. case 'ITP_BTN_MRTNMNG01010_DETAIL_CANCEL' : mobContObj.cancel(); break;
  59. }
  60. }
  61. return false;
  62. });
  63. $(document).off('click', '#ITP_LIST_MRTNMNG01010_POP_WHS_ROWS li button');
  64. $(document).on('click', '#ITP_LIST_MRTNMNG01010_POP_WHS_ROWS li button', function() {
  65. mobPopObj.popWhsNm.choice($(this));
  66. });
  67. }
  68. },
  69. ready: function() {
  70. mobContObj.init();
  71. }
  72. };
  73. let mobContObj = {
  74. init: function() {
  75. this.data.load();
  76. },
  77. data: {
  78. initPchReq: null,
  79. load: function() {
  80. var _this = this;
  81. var callbackFn = function(result) {
  82. console.log(result);
  83. _this.initPchReq = result;
  84. $('#ITP_FORM_MRTNMNG01010_DETAIL #ITP_FORM_MRTNMNG01010_DETAIL_BRAND_ID').val(result.brandId);
  85. $('#ITP_FORM_MRTNMNG01010_DETAIL #ITP_FORM_MRTNMNG01010_DETAIL_STORE_ID').val(result.storeId);
  86. $('#ITP_FORM_MRTNMNG01010_DETAIL #ITP_FORM_MRTNMNG01010_DETAIL_WHS_ID').val(result.rtnWhsId);
  87. $('#ITP_FORM_MRTNMNG01010_DETAIL #ITP_FORM_MRTNMNG01010_DETAIL_WHS_NM').val(result.rtnWhsNm);
  88. $('#ITP_FORM_MRTNMNG01010_DETAIL #ITP_FORM_MRTNMNG01010_DETAIL_LOCATION').val(result.rtnLocation);
  89. $('#ITP_FORM_MRTNMNG01010_DETAIL #ITP_FORM_MRTNMNG01010_DETAIL_LOCATION_NM').val(result.rtnLocationNm);
  90. $('#ITP_FORM_MRTNMNG01010_DETAIL #ITP_FORM_MRTNMNG01010_DETAIL_WHS_DVSN').val(result.whsDvsn);
  91. };
  92. const param = {brandId:fn_make_user_info.get('brandId'), storeId:fn_make_user_info.get('storeId')};
  93. fn_ajax_call(API_MOBILE_INIT_INFO, param, callbackFn, 'GET');
  94. }
  95. },
  96. list: {
  97. rows: [],
  98. addRow: function() {
  99. },
  100. delRow: function() {
  101. this.detachRow();
  102. },
  103. attachRow: function (items) {
  104. var _this = this;
  105. var fnIsExist = function(rows, item) {
  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. $.each(items, function(i, item) {
  116. if(!fnIsExist(_this.rows, item)) {
  117. _this.rows.push(item);
  118. $('#ITP_LIST_MRTNMNG01010_ITEM_AREA .panel-group').append($('#ITP_LIST_MRTNMNG01010_DETAIL_ROWCOPY').html());
  119. var $li = $('#ITP_LIST_MRTNMNG01010_ITEM_AREA .panel-group > .list-row:last');
  120. $li.find('.fnBrandUnitUnqNo').val(item.brandUnitUnqNo);
  121. $li.find('.fnItemNm').text(item.itemNm);
  122. $li.find('.fnPchReqQty').text(item.pchReqQty);
  123. $li.find('.fnUnitAmt').text(CommonObj.currency.add(item.unitAmt));
  124. $li.find('.fnOrdAmt').text(CommonObj.currency.add(Number(item.unitAmt) * Number(item.pchReqQty)));
  125. $('.list-row #ITP_BTN_MRTNMNG01010_DETAIL_PLUS')[$li.index()].addEventListener('click', function() { _this.actPlus(this); });
  126. $('.list-row #ITP_BTN_MRTNMNG01010_DETAIL_MINUS')[$li.index()].addEventListener('click', function() { _this.actMinus(this); });
  127. _this.pchReqAmtTot();
  128. }
  129. });
  130. },
  131. detachRow: function () {
  132. if($('#ITP_LIST_MRTNMNG01010_ITEM_AREA input:checkbox[name=brandUnitUnqNo]:checked').length > 0) {
  133. var _this = this;
  134. $('#ITP_LIST_MRTNMNG01010_DETAIL_ROWS li').each(function(index, elem) {
  135. var __this = this;
  136. var isChecked = $(this).find('input[type="checkbox"]').is(':checked');
  137. if(isChecked) {
  138. $(this).remove();
  139. $.each(_this.rows, function(i, row){
  140. if(row.brandUnitUnqNo === $(__this).find('input[type="checkbox"]').val()) {
  141. _this.rows.splice(i, 1);
  142. return false;
  143. }
  144. });
  145. }
  146. });
  147. this.pchReqAmtTot();
  148. }
  149. },
  150. actPlus: function(elem) {
  151. var $li = $(elem).closest('li');
  152. var num = Number($li.find('.fnPchReqQty').text());
  153. var calcNum = num + 1;
  154. $($li).find('.fnPchReqQty').text(calcNum.toString());
  155. this.rows[$li.index()]['pchReqQty'] = calcNum;
  156. this.pchReqAmtUnit(elem, calcNum);
  157. this.pchReqAmtTot();
  158. // var $div = $(elem).siblings('div');
  159. // var num = Number($div.text());
  160. // $($div).text((num + 1).toString());
  161. // this.rows[$div.parents('li').index()]['pchReqQty'] = $($div).text();
  162. // this.pchReqAmtTot();
  163. },
  164. actMinus: function(elem) {
  165. var $div = $(elem).siblings('div');
  166. var num = Number($div.text());
  167. if(num <= 1) {
  168. itp_fn_modal_alert('수량을 확인하세요.');
  169. } else {
  170. $($div).text((num - 1).toString());
  171. this.rows[$div.parents('li').index()]['pchReqQty'] = $($div).text();
  172. this.pchReqAmtUnit(elem, $($div).text());
  173. this.pchReqAmtTot();
  174. }
  175. // var $div = $(elem).siblings('div');
  176. // var num = Number($div.text());
  177. // if(num <= 1) {
  178. // itp_fn_modal_alert('수량을 확인하세요.');
  179. // } else {
  180. // $($div).text((num - 1).toString());
  181. // this.rows[$div.parents('li').index()]['pchReqQty'] = $($div).text();
  182. // this.pchReqAmtTot();
  183. // }
  184. },
  185. pchReqAmtUnit: function(elem, qty) {
  186. var $div = $(elem).parent().prev();
  187. var unitAmt = CommonObj.onlyNumber($div.find('.fnUnitAmt').text());
  188. $div.find('.fnOrdAmt').text(CommonObj.currency.add(Number(unitAmt ? unitAmt : 0) * Number(qty)));
  189. },
  190. pchReqAmtTot: function() {
  191. var reqAmt = 0;
  192. $.each(this.rows, function(index, item) {
  193. var qty = item.pchReqQty;
  194. var amt = item.unitAmt;
  195. reqAmt += Number(qty) * amt;
  196. });
  197. $('#ITP_AJAX_MRTNMNG01010_DETAIL_CONTAINER').find('.fnRtnReqAmt').text(CommonObj.currency.add(reqAmt));
  198. }
  199. },
  200. cancel: function () {
  201. $(location).attr('href', MOBILE_CONTEXTPATH + '/app/main.html');
  202. }
  203. };
  204. let mobPopObj = {
  205. init: function(popId, parentId) {
  206. switch (popId) {
  207. case 'ITP_POP_MRTNMNG01010_RTN_AREA' : this.popReqConfirm.init(parentId); break;
  208. case 'ITP_POP_MRTNMNG01010_WHS_AREA' : this.popWhsNm.init(); break;
  209. case 'ITP_POP_MRTNMNG01010_ITEM_AREA' : this.popItem.init(); break;
  210. }
  211. $('#' + popId).show();
  212. },
  213. popItem: {
  214. // rows: null,
  215. init: function() {
  216. $('#ITP_POP_MRTNMNG01010_ITEM_AREA #ITP_FORM_MRTNMNG01010_POP_ITEM_KEYWORD').val('');
  217. this.search();
  218. },
  219. search: function() {
  220. $('#ITP_LIST_MRTNMNG01010_POP_ITEM_AREA .panel-group').empty();
  221. var callbackFn = function(result) {
  222. console.log(result);
  223. mobPopObj.popItem.rows = result.gridRows;
  224. $.each(mobPopObj.popItem.rows, function (i, item) {
  225. $('#ITP_LIST_MRTNMNG01010_POP_ITEM_AREA .panel-group').append($('#ITP_LIST_MRTNMNG01010_POP_ITEM_ROWCOPY').html());
  226. var $li = $('#ITP_LIST_MRTNMNG01010_POP_ITEM_AREA .panel-group > .row_2:last');
  227. $li.find('#ITP_FORM_MRTNMNG01010_POP_ITEM_CHECKBOX').val(item.itemId);
  228. $li.find('.fnItemNm').text(item.itemNm);
  229. $li.find('.fnUnitAmt').text(CommonObj.currency.add(item.unitAmt));
  230. $li.find('.fnOrdAmt').text(CommonObj.currency.add(item.unitAmt));
  231. });
  232. mobPopObj.popItem.addRow.init();
  233. };
  234. let param = $('#ITP_FORM_MRTNMNG01010_POPUP_ITEM').serializeObject();
  235. fn_ajax_call(API_POP_ITEM_LIST, JSON.stringify(param), callbackFn, 'POST');
  236. },
  237. addRow: {
  238. init: function() {
  239. this.button.init();
  240. },
  241. button: {
  242. init: function() {
  243. var _this = this;
  244. $('button[id^="ITP_BTN_MRTNMNG01010_POP_ITEM_"]').off('click').on('click', function() {
  245. var id = $(this).attr('id');
  246. switch (id) {
  247. case 'ITP_BTN_MRTNMNG01010_POP_ITEM_PLUS' : _this.actPlus($(this)); break;
  248. case 'ITP_BTN_MRTNMNG01010_POP_ITEM_MINUS' : _this.actMinus($(this)); break;
  249. case 'ITP_BTN_MRTNMNG01010_POP_ITEM_ADD' : _this.addItems(); break;
  250. // case 'ITP_BTN_MRTNMNG01010_POP_ITEM_ADD' : _this.actItemAdd($(this)); break;
  251. case 'ITP_BTN_MRTNMNG01010_POP_ITEM_SEARCH' : mobPopObj.popItem.search(); break;
  252. case 'ITP_BTN_MRTNMNG01010_POP_ITEM_CLOSE' : mobPopObj.hide(id); break;
  253. }
  254. return false;
  255. });
  256. },
  257. actPlus: function(elem) {
  258. var $div = $(elem).siblings('div');
  259. var num = Number($div.text());
  260. $($div).text((num + 1).toString());
  261. this.reqAmtUnit(elem, $($div).text());
  262. },
  263. actMinus: function(elem) {
  264. var $div = $(elem).siblings('div');
  265. var num = Number($div.text());
  266. if(num <= 1) {
  267. itp_fn_modal_alert('수량을 확인하세요.');
  268. } else {
  269. $($div).text((num - 1).toString());
  270. this.reqAmtUnit(elem, $($div).text());
  271. }
  272. },
  273. reqAmtUnit: function(elem, qty) {
  274. var $li = $(elem).closest('li');
  275. var unitAmt = CommonObj.onlyNumber($li.find('.fnUnitAmt').text());
  276. $li.find('.fnOrdAmt').text(CommonObj.currency.add(Number(unitAmt ? unitAmt : 0) * Number(qty)));
  277. },
  278. actItemAdd: function(elem) {
  279. var $li = $(elem).closest('li');
  280. var item = mobPopObj.popItem.rows[$li.index()];
  281. item['pchReqQty'] = $li.find('.fnPchReqQty').html();
  282. // var index = $(elem).closest('li').index();
  283. // var item = mobPopObj.popItem.rows[index];
  284. // item['pchReqQty'] = $(elem).closest('li').find('.fnPchReqQty').html();
  285. mobContObj.list.attachRow(item);
  286. },
  287. addItems: function() {
  288. var items = [];
  289. $('#ITP_LIST_MRTNMNG01010_POP_ITEM_ROWS').find('input:checkbox').each(function() {
  290. if($(this).is(':checked')) {
  291. var index = $(this).closest('li').index();
  292. var item = mobPopObj.popItem.rows[index];
  293. item['pchReqQty'] = $(this).closest('li').find('.fnPchReqQty').html();
  294. items.push(item);
  295. }
  296. });
  297. if(items.length > 0) {
  298. mobContObj.list.attachRow(items);
  299. mobPopObj.popItem.close();
  300. } else {
  301. itp_fn_modal_alert('품목을 선택하세요.');
  302. }
  303. }
  304. }
  305. },
  306. delRow: function() {
  307. },
  308. close: function() {
  309. this.rows.length = 0;
  310. $('#ITP_LIST_MRTNMNG01010_POP_ITEM_ROWS').children().remove();
  311. mobPopObj.hide('ITP_POP_MRTNMNG01010_ITEM_AREA');
  312. }
  313. },
  314. popWhsNm: {
  315. init: function () {
  316. this.rows.length = 0;
  317. this.search();
  318. this.action();
  319. },
  320. rows: [],
  321. search: function () {
  322. var _this = this;
  323. $('#ITP_LIST_MRTNMNG01010_POP_WHS_AREA .panel-group').empty();
  324. var callbackFn = function(result) {
  325. console.log(result);
  326. _this.view(result.gridRows);
  327. };
  328. const param = $('#ITP_FORM_MRTNMNG01010_POP_WHS').serializeObject();
  329. (fn_make_user_info.get('authTpCd') === '50') ? param.swhsDvsn = 'W02' : param.swhsDvsn = 'W01';
  330. fn_ajax_call(API_POP_SEARCH_LIST, JSON.stringify(param), callbackFn, 'POST');
  331. },
  332. view: function(gridRows) {
  333. this.rows = gridRows;
  334. $.each(gridRows, function (i, item) {
  335. $('#ITP_LIST_MRTNMNG01010_POP_WHS_AREA .panel-group').append($('#ITP_LIST_MRTNMNG01010_POP_WHS_ROWCOPY').html());
  336. var $li = $('#ITP_LIST_MRTNMNG01010_POP_WHS_AREA .panel-group > .row_2:last');
  337. $li.find('.fnWhsNm').text(item.whsNm);
  338. $li.find('.fnLocationNm').text(item.locationNm);
  339. $li.find('.fnWhsId').data('whs-id', item.whsId);
  340. });
  341. },
  342. action: function() {
  343. var _this = this;
  344. $('button[id^="ITP_BTN_MRTNMNG01010_POP_WHS"]').off('click').on('click', function() {
  345. var id = $(this).attr('id');
  346. switch (id) {
  347. case 'ITP_BTN_MRTNMNG01010_POP_WHS_SEARCH' : _this.search(); break;
  348. case 'ITP_BTN_MRTNMNG01010_POP_WHS_CHOICE' : _this.choice($(this)); break;
  349. case 'ITP_BTN_MRTNMNG01010_POP_WHS_CLOSE' : _this.close(); break;
  350. }
  351. return false;
  352. });
  353. },
  354. choice: function(elem) {
  355. var _this = this;
  356. var whsId = $(elem).data('whs-id');
  357. $.each(this.rows, function (i, item) {
  358. if(whsId === item.whsId) {
  359. console.log(item);
  360. $('#ITP_FORM_MRTNMNG01010_DETAIL #ITP_FORM_MRTNMNG01010_DETAIL_WHS_ID').val(item.whsId);
  361. $('#ITP_FORM_MRTNMNG01010_DETAIL #ITP_FORM_MRTNMNG01010_DETAIL_WHS_NM').val(item.whsNm);
  362. $('#ITP_FORM_MRTNMNG01010_DETAIL #ITP_FORM_MRTNMNG01010_DETAIL_LOCATION').val(item.location);
  363. mobPopObj.hide(ID_ITP_POP_MRTNMNG01010_WHS_AREA);
  364. itp_fn_form_clear_validate(null, '#ITP_FORM_MRTNMNG01010_DETAIL');
  365. return false;
  366. }
  367. });
  368. },
  369. delete: function() {
  370. $('#ITP_FORM_MRTNMNG01010_DETAIL #ITP_FORM_MRTNMNG01010_DETAIL_WHS_ID').val('');
  371. $('#ITP_FORM_MRTNMNG01010_DETAIL #ITP_FORM_MRTNMNG01010_DETAIL_WHS_NM').val('');
  372. $('#ITP_FORM_MRTNMNG01010_DETAIL #ITP_FORM_MRTNMNG01010_DETAIL_LOCATION').val('');
  373. },
  374. close: function() {
  375. this.rows.length = 0;
  376. $('#ITP_LIST_MRTNMNG01010_POP_WHS_AREA .panel-group').empty();
  377. $('#ITP_POP_MRTNMNG01010_WHS_AREA #ITP_FORM_MRTNMNG01010_POP_WHS_KEYWORD').val('');
  378. mobPopObj.hide(this.popId);
  379. }
  380. },
  381. popReqConfirm: {
  382. init: function (parentId) {
  383. this.rtnReqStCd = (parentId === 'ITP_BTN_MRTNMNG01010_DETAIL_RTN_ORDER') ? RTN_REQ_ST_CD_REQUEST_SAVE : RTN_REQ_ST_CD_TEMP_SAVE;
  384. this.view();
  385. this.action();
  386. },
  387. view: function() {
  388. if(this.rtnReqStCd === RTN_REQ_ST_CD_REQUEST_SAVE) {
  389. $('#ITP_POP_MRTNMNG01010_RTN_AREA .msg_save').text('빈품요청 하시겠습니까?');
  390. } else {
  391. $('#ITP_POP_MRTNMNG01010_RTN_AREA .msg_save').text('임시저장 하시겠습니까?');
  392. }
  393. $('#ITP_POP_MRTNMNG01010_RTN_AREA .fnRtnReqDt').text($('#ITP_FORM_MRTNMNG01010_DETAIL #ITP_FORM_MRTNMNG01010_DETAIL_DLV_REQ_DT').val());
  394. $('#ITP_POP_MRTNMNG01010_RTN_AREA .fnItemQty').text(CommonObj.currency.add(mobContObj.list.rows.length, '개'));
  395. $('#ITP_POP_MRTNMNG01010_RTN_AREA .fnRtnAmt').text($('#ITP_FORM_MRTNMNG01010_DETAIL .fnRtnReqAmt').text());
  396. $('#ITP_FORM_MRTNMNG01010_DETAIL #ITP_FORM_MRTNMNG01010_DETAIL_RTN_REQ_ST_CD').val(this.rtnReqStCd);
  397. },
  398. action: function() {
  399. var _this = this;
  400. $('#ITP_POP_MRTNMNG01010_RTN_AREA button[id="ITP_BTN_MRTNMNG01010_POP_RTN_CONFIRM"]').off('click').on('click', function() {
  401. _this.save('#ITP_FORM_MRTNMNG01010_DETAIL');
  402. });
  403. },
  404. save: function(formId) {
  405. let param = $(formId).serializeObject();
  406. var gridInsertData = [];
  407. $.each(mobContObj.list.rows, function(index, row) {
  408. row['viewCd'] = 'C';
  409. row['rtnQty'] = row.pchReqQty;
  410. row['rtnAmt'] = parseInt(row.unitAmt) * parseInt(row.pchReqQty);
  411. gridInsertData.push(row);
  412. });
  413. param.gridInsertData = gridInsertData;
  414. param['colReqDt'] = param.colReqDt.replace(/[^0-9]/g, "");
  415. // console.log(JSON.stringify(param));
  416. var saveFn = function (result) {
  417. console.log(result);
  418. mobPopObj.hide('ITP_POP_MRTNMNG01010_RTN_AREA');
  419. $('#ITP_LIST_MRTNMNG01010_DETAIL_ROWS').empty();
  420. mobContObj.list.rows.length = 0;
  421. $('#ITP_AJAX_MRTNMNG01010_DETAIL_CONTAINER').find('.fnRtnReqAmt').text('');
  422. };
  423. fn_ajax_call(API_MOBILE_SAVE, JSON.stringify(param), saveFn, 'POST');
  424. }
  425. },
  426. show: function(popId, parentId) {
  427. var _this = this;
  428. $('button[id$="CLOSE"]').off('click').on('click', function() {
  429. var id = $(this).attr('id');
  430. if($(this).hasClass('btn-pop-close')) {
  431. _this.hide(id);
  432. }
  433. });
  434. if(parentId === 'ITP_BTN_MRTNMNG01010_DETAIL_RTN_ORDER' || parentId === 'ITP_BTN_MRTNMNG01010_DETAIL_TEMP_SAVE') {
  435. var formId = '#ITP_FORM_MRTNMNG01010_DETAIL';
  436. itp_fn_form_clear_validate(null, formId);
  437. if (itp_fn_form_event.isValid(formId)) {
  438. if($('#ITP_LIST_MRTNMNG01010_DETAIL_ROWS li').length < 1) {
  439. itp_fn_modal_alert('품목추가 버튼을 이용하여 품목을 추가해 주세요.');
  440. } else {
  441. mobPopObj.init(popId, parentId);
  442. }
  443. }
  444. } else {
  445. mobPopObj.init(popId, parentId);
  446. }
  447. },
  448. hide: function(id) {
  449. $('#' + id).closest('.mobile-pop-close').hide();
  450. }
  451. };