Bläddra i källkod

모바일 구매요청현황 작업

juney 2 år sedan
förälder
incheckning
1b02dd8639
1 ändrade filer med 592 tillägg och 0 borttagningar
  1. 592 0
      src/main/webapp/mobile/js/app/mpomng/ITP_MPOMNG03010.js

+ 592 - 0
src/main/webapp/mobile/js/app/mpomng/ITP_MPOMNG03010.js

@@ -0,0 +1,592 @@
1
+require(['config'], function() {
2
+	require([
3
+	], function($) {
4
+		mobPageObj.init();
5
+	});
6
+});
7
+
8
+/*API URL*/
9
+const API_MOBILE_GRID_LIST 			= '/api/pomng/detail-grid-list';	// 목록
10
+const API_MOBILE_INFO 				= '/api/pomng/info-pchReq';			// 상세
11
+const API_MOBILE_SAVE 				= '/api/pomng/save-pchReq';			// 저장
12
+const API_POP_SEARCH_LIST			= '/api/whs/mng/pop-whs-search';
13
+const API_POP_ITEM_LIST 			= '/api/item/pop-grid-list';
14
+
15
+const PCH_REQ_ST_CD_TEMP_SAVE		="PR00";
16
+const PCH_REQ_ST_CD_REQUEST_SAVE	="PR20";
17
+
18
+const VIEW_MODE_LIST				= "LIST";
19
+const VIEW_MODE_DETAIL				= "DETAIL";
20
+const VIEW_MODE_MODIFY				= "MODIFY";
21
+
22
+let mobPageObj = {
23
+	viewMode: VIEW_MODE_LIST,
24
+	init: function () {
25
+		this.ui.init();
26
+		this.event.init();
27
+		this.ready();
28
+	},
29
+	ui: {
30
+		init: function () {
31
+			this.view();
32
+			this.info();
33
+			this.action();
34
+		},
35
+		view: function() {
36
+			// 공통코드 표시
37
+			$('select').each(function() {
38
+				if($(this).data('select-code')) {
39
+					fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
40
+				}
41
+			});
42
+
43
+			// 조회일자 지정
44
+			$('#ITP_FORM_MPOMNG02010_VIEW_SEARCH_FROM_DT').val(itp_fn_date_add('M', -1));
45
+			$('#ITP_FORM_MPOMNG02010_VIEW_SEARCH_TO_DT').val(itp_fn_date_add('M', 0));
46
+		},
47
+		info: function() {
48
+			$('input:hidden[id$="_BRAND_ID"]').val(fn_make_user_info.get('brandId'));
49
+			$('input:hidden[id$="_STORE_ID"]').val(fn_make_user_info.get('storeId'));
50
+		},
51
+		action: function() {
52
+		}
53
+	},
54
+	event: {
55
+		init: function() {
56
+			this.button();
57
+		},
58
+		button: function() {
59
+			$('button[id^="ITP_BTN_MPOMNG02010_VIEW"]').on('click', function() {
60
+				var id = $(this).attr('id');
61
+				switch (id) {
62
+					case 'ITP_BTN_MPOMNG02010_VIEW_SEARCH_WHS_NM'	: mobPopObj.popWhsNm.init(VIEW_MODE_LIST); 		break;
63
+					case 'ITP_BTN_MPOMNG02010_VIEW_DELETE_WHS_NM'	: mobPopObj.popWhsNm.delete(VIEW_MODE_LIST); 	break;
64
+					case 'ITP_BTN_MPOMNG02010_VIEW_SEARCH'			: mobContentObj.list.search();					break;
65
+				}
66
+				return false;
67
+			});
68
+
69
+			$('button[id^="ITP_BTN_MPOMNG02010_DETAIL"]').on('click', function() {
70
+				var id = $(this).attr('id');
71
+				switch (id) {
72
+					case 'ITP_BTN_MPOMNG02010_DETAIL_CANCEL_LIST'		: mobContentObj.detail.cancel();	break;
73
+				}
74
+				return false;
75
+			});
76
+
77
+			$('button[id^="ITP_BTN_MPOMNG02010_MODIFY"]').on('click', function() {
78
+				var id = $(this).attr('id');
79
+				switch (id) {
80
+					case 'ITP_BTN_MPOMNG02010_MODIFY_SEARCH_WHS_NM'		: mobPopObj.popWhsNm.init(VIEW_MODE_MODIFY); 	break;
81
+					case 'ITP_BTN_MPOMNG02010_MODIFY_DELETE_WHS_NM'		: mobPopObj.popWhsNm.delete(VIEW_MODE_MODIFY); 	break;
82
+					case 'ITP_BTN_MPOMNG02010_MODIFY_ADD_ROW'			: mobPopObj.popItem.init();						break;
83
+					case 'ITP_BTN_MPOMNG02010_MODIFY_DEL_ROW'			: mobContentObj.modify.list.detachRow();		break;
84
+					case 'ITP_BTN_MPOMNG02010_MODIFY_CANCEL'			: mobContentObj.modify.cancel();				break;
85
+					case 'ITP_BTN_MPOMNG02010_MODIFY_REQ_ORDER'			: mobPopObj.popReqConfirm.init(PCH_REQ_ST_CD_REQUEST_SAVE);	break;
86
+					case 'ITP_BTN_MPOMNG02010_MODIFY_TEMP_SAVE'			: mobPopObj.popReqConfirm.init(PCH_REQ_ST_CD_TEMP_SAVE);	break;
87
+				}
88
+				return false;
89
+			});
90
+
91
+			$(document).on('click', '#ITP_LIST_MPOMNG02010_MODIFY_ROWS li button', function() {
92
+				if($(this).hasClass('DETAIL_ITEM_PLUS')) {
93
+					mobContentObj.modify.list.actPlus($(this));
94
+				} else if($(this).hasClass('DETAIL_ITEM_MINUS')) {
95
+					mobContentObj.modify.list.actMinus($(this));
96
+				}
97
+			});
98
+		}
99
+	},
100
+	switchScreen: function(mode) {
101
+		$('#ITP_MOBILE_MPOMNG02010').find('div[id$="_CONTAINER"]').each(function(i) {
102
+			$(this).hide();
103
+		});
104
+		if(mode === VIEW_MODE_LIST) {
105
+			$('#ITP_AJAX_MPOMNG02010_VIEW_CONTAINER').show();
106
+			this.moreView(true);
107
+		} else if(mode === VIEW_MODE_DETAIL) {
108
+			$('#ITP_AJAX_MPOMNG02010_DETAIL_CONTAINER').show();
109
+			this.moreView(false);
110
+		} else if(mode === VIEW_MODE_MODIFY) {
111
+			$('#ITP_AJAX_MPOMNG02010_MODIFY_CONTAINER').show();
112
+			this.moreView(false);
113
+		}
114
+		this.viewMode = mode;
115
+	},
116
+	moreView: function(isScroll) {
117
+		var _this = this;
118
+		if(isScroll) {
119
+			$('#ITP_LIST_MPOMNG02010_LIST_AREA').on('scroll', function () {
120
+				if($(this).scrollTop() + $(this).innerHeight() + 1 >= $(this)[0].scrollHeight) {
121
+					if(mobContentObj.list.totPage > mobContentObj.list.listPage) {
122
+						if(!mobContentObj.list.isSearch) {
123
+							mobContentObj.list.load();
124
+						}
125
+					}
126
+				}
127
+			});
128
+		} else {
129
+			$('#ITP_LIST_MPOMNG02010_LIST_AREA').off('scroll');
130
+		}
131
+	},
132
+	ready: function() {
133
+		mobContentObj.list.init();
134
+	}
135
+};
136
+
137
+let mobContentObj = {
138
+	list: {
139
+		listSize: 10,
140
+		listPage: 0,
141
+		totPage: 0,
142
+		isSearch: false,
143
+		rows: [],
144
+		init: function() {
145
+			mobPageObj.switchScreen(VIEW_MODE_LIST);
146
+			this.search();
147
+			this.action();
148
+		},
149
+		search: function() {
150
+			this.listPage = 0;
151
+			this.totPage = 0;
152
+			this.rows.length = 0;
153
+			$('#ITP_LIST_MPOMNG02010_LIST_ROWS').empty();
154
+			this.load();
155
+		},
156
+		load: function() {
157
+			var _this = this;
158
+			this.isSearch = true;
159
+			var callbackFn = function(result) {
160
+				console.log(result);
161
+				_this.isSearch = false;
162
+				_this.totPage = result.gridTotal;
163
+				$.each(result.gridRows, function (i, item) {
164
+					$('#ITP_LIST_MPOMNG02010_LIST_AREA .panel-group').append($('#ITP_LIST_MPOMNG02010_LIST_ROWCOPY').html());
165
+					var $li = $('#ITP_LIST_MPOMNG02010_LIST_AREA .panel-group > .list-row:last');
166
+					$li.find('.fnPchReqDt').text(item.pchReqDt);
167
+					$li.find('.fnPchReqMgrNm').text(item.pchReqMgrNm);
168
+					$li.find('.fnPchReqStNm').text(item.pchReqStNm);
169
+					$li.find('.fnWhsLocationNm').text(item.whsLocationNm);
170
+					$li.find('.fnPchReqItemQty').text(CommonObj.comma.set(item.pchReqItemQty));
171
+					$li.find('.fnPchReqTotalAmt').text(CommonObj.comma.set(item.pchReqTotalAmt));
172
+					$li.find('.fnPchReqRjctNm').text(item.pchReqRjctNm);
173
+					_this.rows.push(item);
174
+				});
175
+			};
176
+			var errFn = function() { _this.isSearch = false;};
177
+			const param = $('#ITP_FORM_MPOMNG02010_VIEW_SEARCH').serializeObject();
178
+			param.gridPage = ++this.listPage;
179
+			param.gridSize = this.listSize;
180
+			param.fromDt = param.fromDt.replace(/-/g, ".");
181
+			param.toDt = param.toDt.replace(/-/g, ".");
182
+			fn_ajax_call(API_MOBILE_GRID_LIST, JSON.stringify(param), callbackFn, 'POST', errFn);
183
+		},
184
+		action: function () {
185
+			var _this = this;
186
+			$(document).on('click', '#ITP_LIST_MPOMNG02010_LIST_ROWS li', function() {
187
+				var index = $(this).index();
188
+				var item = _this.rows[index];
189
+				(item.pchReqStCd === PCH_REQ_ST_CD_TEMP_SAVE) ? mobContentObj.modify.init(item) : mobContentObj.detail.init(item);
190
+			});
191
+		}
192
+	},
193
+	detail: {
194
+		rows: [],
195
+		init: function(item) {
196
+			mobPageObj.switchScreen(VIEW_MODE_DETAIL);
197
+			this.search(item);
198
+		},
199
+		search: function(item) {
200
+			var _this = this;
201
+			var callbackFn = function(result) {
202
+				console.log(result);
203
+				_this.rows = result.pchReqDtlList;
204
+				_this.view(result);
205
+			};
206
+			const param = {'brandId':fn_make_user_info.get('brandId'), 'pchReqUnqNo': item.pchReqUnqNo};
207
+			fn_ajax_call(API_MOBILE_INFO, param, callbackFn, 'GET');
208
+		},
209
+		view: function(result) {
210
+			var _this = this;
211
+			var id = '#ITP_AJAX_MPOMNG02010_DETAIL_CONTAINER';
212
+			$(id).find('.fnDlvReqDt').text(result.dlvReqDt);
213
+			$(id).find('.fnPchReqTotalAmt').text(CommonObj.currency.add(result.pchReqTotalAmt));
214
+			$(id).find('.fnLocationNm').text(result.locationNm);
215
+			$(id).find('.fnPchApprNm').text('(' + result.pchApprNm + ')' + CommonObj.currency.add(result.pchApprAmt));
216
+			$.each(result.pchReqDtlList, function (i, item) {
217
+				$('#ITP_LIST_MPOMNG02010_DETAIL_AREA .panel-group').append($('#ITP_LIST_MPOMNG02010_DETAIL_ROWCOPY').html());
218
+				var $li = $('#ITP_LIST_MPOMNG02010_DETAIL_AREA .panel-group > .list-row:last');
219
+				$li.find('.fnItemNm').text(item.itemNm);
220
+				$li.find('.fnUnit').text(item.pchReqQty + item.unit);
221
+				$li.find('.fnPchReqAmt').text(CommonObj.comma.set(item.pchReqAmt));
222
+				$li.find('.fnPchReqQty').text(CommonObj.currency.add(item.pchReqQty, ''));
223
+				_this.rows.push(item);
224
+			});
225
+		},
226
+		cancel: function () {
227
+			this.rows.length = 0;
228
+			var id = '#ITP_AJAX_MPOMNG02010_DETAIL_CONTAINER';
229
+			$(id).find('.fnDlvReqDt').text('');
230
+			$(id).find('.fnPchReqTotalAmt').text('');
231
+			$(id).find('.fnLocationNm').text('');
232
+			$(id).find('.fnPchApprNm').text('');
233
+			$('#ITP_LIST_MPOMNG02010_DETAIL_AREA .panel-group').empty();
234
+			mobPageObj.switchScreen(VIEW_MODE_LIST);
235
+		}
236
+	},
237
+	modify: {
238
+		init: function(item) {
239
+			mobPageObj.switchScreen(VIEW_MODE_MODIFY);
240
+			this.clear();
241
+			this.search(item);
242
+		},
243
+		search: function(item) {
244
+			var _this = this;
245
+			var callbackFn = function(result) {
246
+				console.log(result);
247
+				_this.view(result);
248
+			};
249
+			const param = {'brandId':fn_make_user_info.get('brandId'), 'pchReqUnqNo': item.pchReqUnqNo};
250
+			fn_ajax_call(API_MOBILE_INFO, param, callbackFn, 'GET');
251
+		},
252
+		view: function(result) {
253
+			var _this = this;
254
+			var id = '#ITP_AJAX_MPOMNG02010_MODIFY_CONTAINER';
255
+			$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_DLV_REQ_DT').val(result.dlvReqDt.replace(/\./g, "-"));
256
+			$(id).find('.fnPchReqTotalAmt').text(CommonObj.currency.add(result.pchReqTotalAmt));
257
+			$(id).find('.fnOrdUseAmt').text(CommonObj.currency.add(result.ordUseAmt));
258
+			$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_LOAN_DVSN').val(result.loanDvsn);
259
+			$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_LOAN_MGNT_UNQ_NO').val(result.loanMgntUnqNo);
260
+			$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_PCH_REQ_UNQ_NO').val(result.pchReqUnqNo);
261
+			$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_PCH_REQ_DVSN').val(result.pchReqDvsn);
262
+			$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_WHS_NM').val(result.whsNm);
263
+			$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_WHS_ID').val(result.whsId);
264
+			$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_LOCATION').val(result.location);
265
+			_this.list.init(result.pchReqDtlList);
266
+		},
267
+		list: {
268
+			rows: [],
269
+			init: function(pchReqDtlList) {
270
+				var _this = this;
271
+				$.each(pchReqDtlList, function (i, item) {
272
+					item['viewCd'] = 'U';
273
+					_this.attachRow(item);
274
+				});
275
+			},
276
+			attachRow: function (item) {
277
+				var _this = this;
278
+				var append = function() {
279
+					$('#ITP_LIST_MPOMNG02010_MODIFY_AREA .panel-group').append($('#ITP_LIST_MPOMNG02010_MODIFY_ROWCOPY').html());
280
+					var $li = $('#ITP_LIST_MPOMNG02010_MODIFY_AREA .panel-group > .list-row:last');
281
+					$li.find('.fnBrandUnitUnqNo').val(item.brandUnitUnqNo);
282
+					$li.find('.fnItemNm').text(item.itemNm);
283
+					$li.find('.fnPchReqQty').text(item.pchReqQty);
284
+					$li.find('.fnUnitAmt').text(CommonObj.currency.add(item.unitAmt));
285
+					_this.pchReqAmtTot();
286
+				};
287
+				var fnChkExist = function() {
288
+					var isExist = false;
289
+					$.each(_this.rows, function(i, row) {
290
+						if(row.brandUnitUnqNo === item.brandUnitUnqNo) {
291
+							if(row.viewCd === 'D') {
292
+								item.viewCd = _this.rows[i].viewCd;
293
+								_this.rows[i] = item;
294
+								append();
295
+							} else {
296
+								alert('이미 존재하는 품목입니다.');
297
+							}
298
+							isExist = true;
299
+							return false;
300
+						}
301
+					});
302
+					if(!isExist) {
303
+						_this.rows.push(item);
304
+						append();
305
+					}
306
+				};
307
+				fnChkExist();
308
+			},
309
+			detachRow: function () {
310
+				if($('#ITP_LIST_MPOMNG02010_MODIFY_AREA input:checkbox[name=brandUnitUnqNo]:checked').length > 0) {
311
+					var _this = this;
312
+					$('#ITP_LIST_MPOMNG02010_MODIFY_ROWS li').each(function(index, elem) {
313
+						var isChecked = $(this).find('input[type="checkbox"]').is(':checked');
314
+						if(isChecked) {
315
+							$(this).remove();
316
+							_this.rows[index].viewCd = 'D';
317
+							// _this.rows.splice(index, 1);
318
+						}
319
+					});
320
+					this.pchReqAmtTot();
321
+				}
322
+			},
323
+			actPlus: function(elem) {
324
+				var $div = $(elem).siblings('div');
325
+				var num = Number($div.text());
326
+				$($div).text((num + 1).toString());
327
+				this.rows[$div.parents('li').index()]['pchReqQty'] = $($div).text();
328
+				this.pchReqAmtTot();
329
+			},
330
+			actMinus: function(elem) {
331
+				var $div = $(elem).siblings('div');
332
+				var num = Number($div.text());
333
+				if(num <= 1) {
334
+					alert('주문수량을 확인하세요.');
335
+				} else {
336
+					$($div).text((num - 1).toString());
337
+					this.rows[$div.parents('li').index()]['pchReqQty'] = $($div).text();
338
+					this.pchReqAmtTot();
339
+				}
340
+			},
341
+			pchReqAmtTot: function() {
342
+				var reqAmt = 0;
343
+				$.each(this.rows, function(index, item) {
344
+					var qty = item.pchReqQty;
345
+					var amt = item.unitAmt;
346
+					reqAmt += Number(qty) * amt;
347
+				});
348
+				$('#ITP_AJAX_MPOMNG02010_VIEW_CONTAINER').find('.fnPchReqAmtTot').text(CommonObj.currency.add(reqAmt));
349
+			}
350
+		},
351
+		cancel: function () {
352
+			mobPageObj.switchScreen(VIEW_MODE_LIST);
353
+		},
354
+		clear: function() {
355
+			this.list.rows.length = 0;
356
+			var id = '#ITP_AJAX_MPOMNG02010_MODIFY_CONTAINER';
357
+			$(id).find('.fnDlvReqDt').val('');
358
+			$(id).find('.fnPchReqTotalAmt').text('');
359
+			$(id).find('.fnOrdUseAmt').text('');
360
+			$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_LOAN_DVSN').val('');
361
+			$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_LOAN_MGNT_UNQ_NO').val('');
362
+			$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_PCH_REQ_UNQ_NO').val('');
363
+			$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_PCH_REQ_DVSN').val('');
364
+			$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_WHS_NM').val('');
365
+			$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_WHS_ID').val('');
366
+			$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_LOCATION').val('');
367
+			$('#ITP_LIST_MPOMNG02010_MODIFY_AREA .panel-group').empty();
368
+		}
369
+	}
370
+};
371
+
372
+let mobPopObj = {
373
+	popItem: {
374
+		popId: 'ITP_POP_MPOMNG02010_ITEM_AREA',
375
+		init: function() {
376
+			mobPopObj.show(this.popId);
377
+			this.search();
378
+		},
379
+		search: function() {
380
+			$('#ITP_LIST_MPOMNG02010_POP_ITEM_AREA .panel-group').empty();
381
+			var callbackFn = function(result) {
382
+				console.log(result);
383
+				mobPopObj.popItem.rows = result.gridRows;
384
+				$.each(mobPopObj.popItem.rows, function (i, item) {
385
+					$('#ITP_LIST_MPOMNG02010_POP_ITEM_AREA .panel-group').append($('#ITP_LIST_MPOMNG02010_POP_ITEM_ROWCOPY').html());
386
+					var $li = $('#ITP_LIST_MPOMNG02010_POP_ITEM_AREA .panel-group > .row_2:last');
387
+					$li.find('#ITP_FORM_MPOMNG02010_POP_ITEM_CHECKBOX').val(item.itemId);
388
+					$li.find('.fnItemNm').text(item.itemNm);
389
+					$li.find('.fnUnitAmt').text(CommonObj.currency.add(item.unitAmt));
390
+				});
391
+				mobPopObj.popItem.addRow.init();
392
+			};
393
+			let param = $('#ITP_FORM_MPOMNG02010_POPUP_ITEM').serializeObject();
394
+			fn_ajax_call(API_POP_ITEM_LIST, JSON.stringify(param), callbackFn, 'POST');
395
+		},
396
+		addRow: {
397
+			init: function() {
398
+				this.button.init();
399
+			},
400
+			button: {
401
+				init: function() {
402
+					var _this = this;
403
+					$('button[id^="ITP_BTN_MPOMNG02010_POP_ITEM_"]').off('click').on('click', function() {
404
+						var id = $(this).attr('id');
405
+						switch (id) {
406
+							case 'ITP_BTN_MPOMNG02010_POP_ITEM_PLUS'	: _this.actPlus($(this)); 		break;
407
+							case 'ITP_BTN_MPOMNG02010_POP_ITEM_MINUS'	: _this.actMinus($(this)); 		break;
408
+							case 'ITP_BTN_MPOMNG02010_POP_ITEM_ADD'		: _this.actItemAdd($(this)); 	break;
409
+							case 'ITP_BTN_MPOMNG02010_POP_ITEM_SEARCH'	: mobPopObj.popItem.search(); 	break;
410
+							case 'ITP_BTN_MPOMNG02010_POP_ITEM_CLOSE'	: mobPopObj.hide(id); 			break;
411
+						}
412
+						return false;
413
+					});
414
+				},
415
+				actPlus: function(elem) {
416
+					var $div = $(elem).siblings('div');
417
+					var num = Number($div.text());
418
+					$($div).text((num + 1).toString());
419
+				},
420
+				actMinus: function(elem) {
421
+					var $div = $(elem).siblings('div');
422
+					var num = Number($div.text());
423
+					if(num <= 1) {
424
+						alert('주문수량을 확인하세요.');
425
+					} else {
426
+						$($div).text((num - 1).toString());
427
+					}
428
+				},
429
+				actItemAdd: function(elem) {
430
+					var index = $(elem).closest('li').index();
431
+					var item = mobPopObj.popItem.rows[index];
432
+					item['pchReqQty'] = $(elem).closest('li').find('.fnPchReqQty').html();
433
+					mobContentObj.modify.list.attachRow(item);
434
+				}
435
+			}
436
+		},
437
+		delRow: function() {
438
+
439
+		}
440
+	},
441
+	popWhsNm: {
442
+		popId: 'ITP_POP_MPOMNG02010_WHS_AREA',
443
+		mode: '',
444
+		rows: [],
445
+		init: function (mode) {
446
+			this.mode = mode;
447
+			this.rows.length = 0;
448
+			mobPopObj.show(this.popId);
449
+			this.search();
450
+			this.action();
451
+		},
452
+		search: function () {
453
+			var _this = this;
454
+			$('#ITP_LIST_MPOMNG02010_POP_WHS_AREA .panel-group').empty();
455
+			var callbackFn = function(result) {
456
+				console.log(result);
457
+				_this.view(result.gridRows);
458
+			};
459
+			const param = $('#ITP_FORM_MPOMNG02010_POP_WHS').serializeObject();
460
+			fn_ajax_call(API_POP_SEARCH_LIST, JSON.stringify(param), callbackFn, 'POST');
461
+		},
462
+		view: function(gridRows) {
463
+			this.rows = gridRows;
464
+			$.each(gridRows, function (i, item) {
465
+				$('#ITP_LIST_MPOMNG02010_POP_WHS_AREA .panel-group').append($('#ITP_LIST_MPOMNG02010_POP_WHS_ROWCOPY').html());
466
+				var $li = $('#ITP_LIST_MPOMNG02010_POP_WHS_AREA .panel-group > .row_2:last');
467
+				$li.find('.fnWhsNm').text(item.whsNm);
468
+				$li.find('.fnLocationNm').text(item.locationNm);
469
+				$li.find('.fnWhsId').data('whs-id', item.whsId);
470
+			});
471
+		},
472
+		choice: function(elem) {
473
+			var _this = this;
474
+			var whsId = $(elem).data('whs-id');
475
+			$.each(this.rows, function (i, item) {
476
+				if(whsId === item.whsId) {
477
+					if(_this.mode === VIEW_MODE_LIST) {
478
+						$('#ITP_FORM_MPOMNG02010_VIEW_SEARCH #ITP_FORM_MPOMNG02010_VIEW_SEARCH_WHS_ID').val(item.whsId);
479
+						$('#ITP_FORM_MPOMNG02010_VIEW_SEARCH #ITP_FORM_MPOMNG02010_VIEW_SEARCH_WHS_NM').val(item.whsNm);
480
+					} else if(_this.mode === VIEW_MODE_MODIFY) {
481
+						$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_WHS_ID').val(item.whsId);
482
+						$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_WHS_NM').val(item.whsNm);
483
+						$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_LOCATION').val(item.location);
484
+					}
485
+					mobPopObj.hide(_this.popId);
486
+					return false;
487
+				}
488
+			});
489
+		},
490
+		action: function() {
491
+			var _this = this;
492
+			$('button[id^="ITP_BTN_MPOMNG02010_POP"]').off('click').on('click', function() {
493
+				var id = $(this).attr('id');
494
+				switch (id) {
495
+					case 'ITP_BTN_MPOMNG02010_POP_WHS_SEARCH'	: _this.search();				break;
496
+					case 'ITP_BTN_MPOMNG02010_POP_WHS_CHOICE'	: _this.choice($(this)); 		break;
497
+					case 'ITP_BTN_MPOMNG02010_POP_WHS_CLOSE'	: mobPopObj.hide(_this.popId);	break;
498
+				}
499
+				return false;
500
+			});
501
+		},
502
+		delete: function(mode) {
503
+			if(mode === VIEW_MODE_LIST) {
504
+				$('#ITP_FORM_MPOMNG02010_VIEW_SEARCH #ITP_FORM_MPOMNG02010_VIEW_SEARCH_WHS_ID').val('');
505
+				$('#ITP_FORM_MPOMNG02010_VIEW_SEARCH #ITP_FORM_MPOMNG02010_VIEW_SEARCH_WHS_NM').val('');
506
+			} else if(mode === VIEW_MODE_MODIFY) {
507
+				$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_WHS_ID').val('');
508
+				$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_WHS_NM').val('');
509
+				$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_LOCATION').val('');
510
+				mobPopObj.hide(ID_ITP_POP_MPOMNG02010_WHS_AREA);
511
+			}
512
+		}
513
+	},
514
+	popReqConfirm: {
515
+		popId: 'ITP_POP_MPOMNG02010_REQ_AREA',
516
+		pchReqStCd: '',
517
+		init: function (pchReqStCd) {
518
+			this.pchReqStCd = pchReqStCd;
519
+			mobPopObj.show(this.popId);
520
+			this.view();
521
+			this.action();
522
+		},
523
+		view: function() {
524
+			if(this.pchReqStCd === PCH_REQ_ST_CD_REQUEST_SAVE) {
525
+				$('#ITP_POP_MPOMNG02010_REQ_AREA .msg_save').text('구매요청 하시겠습니까?');
526
+			} else {
527
+				$('#ITP_POP_MPOMNG02010_REQ_AREA .msg_save').text('임시저장 하시겠습니까?');
528
+			}
529
+			$('#ITP_POP_MPOMNG02010_REQ_AREA .fnPopDlvReqDt').text($('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_DLV_REQ_DT').val());
530
+			$('#ITP_POP_MPOMNG02010_REQ_AREA .fnItemQty').text(CommonObj.currency.add(mobContentObj.modify.list.rows.length, '개'));
531
+			$('#ITP_POP_MPOMNG02010_REQ_AREA .fnOrdAmt').text(CommonObj.currency.add($('#ITP_FORM_MPOMNG02010_MODIFY .fnPchReqTotalAmt').text()));
532
+		},
533
+		action: function() {
534
+			var _this = this;
535
+			$('#ITP_POP_MPOMNG02010_REQ_AREA button[id="ITP_BTN_MPOMNG02010_POP_REQ_CONFIRM"]').off('click').on('click', function() {
536
+				$('#ITP_FORM_MPOMNG02010_MODIFY #ITP_FORM_MPOMNG02010_MODIFY_PCH_REQ_ST_CD').val(_this.pchReqStCd);
537
+				_this.save('#ITP_FORM_MPOMNG02010_MODIFY');
538
+			});
539
+		},
540
+		save: function(formId) {
541
+			var _this = this;
542
+			let param = $(formId).serializeObject();
543
+
544
+			if (param.loanDvsn !== 'LD03' && this.pchReqStCd === PCH_REQ_ST_CD_REQUEST_SAVE ) {
545
+				var ordUseAmt = $('#ITP_FORM_MPOMNG02010_MODIFY .fnOrdUseAmt').text();
546
+				var pchReqTotalAmt = $('#ITP_FORM_MPOMNG02010_DETAIL .fnPchReqTotalAmt').text();
547
+
548
+				if (parseInt(CommonObj.onlyNumber(ordUseAmt)) < parseInt(CommonObj.onlyNumber(pchReqTotalAmt))) {
549
+					alert(ITP_MSG_LOCALE.message.ajax.lackReqAmt);
550
+					return;
551
+				}
552
+			}
553
+
554
+			var gridInsertData = [];
555
+			var gridUpdateData = [];
556
+			var gridDeleteData = [];
557
+			$.each(mobContentObj.modify.list.rows, function(index, item) {
558
+				item['pchReqUnqNo'] = param.pchReqUnqNo;
559
+				if(item.viewCd === 'R' || item.viewCd === 'C' ) {
560
+					item['viewCd'] = 'C';
561
+					gridInsertData.push(item);
562
+				} else if(item.viewCd === 'U') {
563
+					gridUpdateData.push(item);
564
+				} else if(item.viewCd === 'D') {
565
+					gridDeleteData.push(item);
566
+				}
567
+			});
568
+			param['dlvReqDt'] = param.dlvReqDt.replace(/[^0-9]/g, "");
569
+			param.gridInsertData = gridInsertData;
570
+			param.gridUpdateData = gridUpdateData;
571
+			param.gridDeleteData = gridDeleteData;
572
+			console.log(JSON.stringify(param));
573
+			var saveFn = function (result) {
574
+				console.log(result);
575
+				mobPopObj.hide(_this.popId);
576
+				mobContentObj.list.init();
577
+			};
578
+			fn_ajax_call(API_MOBILE_SAVE, JSON.stringify(param), saveFn, 'POST');
579
+		}
580
+	},
581
+	show: function(popId) {
582
+		$('button[id$="_CLOSE"]').off('click').on('click', function() {
583
+			if($(this).hasClass('btn-pop-close')) {
584
+				mobPopObj.hide(popId);
585
+			}
586
+		});
587
+		$('#' + popId).show();
588
+	},
589
+	hide: function(popId) {
590
+		$('#' + popId).closest('.mobile-pop-close').hide();
591
+	}
592
+};