Browse Source

모바일 수거관리 스크립트 생성

juney 2 years ago
parent
commit
535f2a9529

+ 296 - 0
src/main/webapp/mobile/js/app/mcollmng/ITP_MCOLLMNG01010.js

@@ -0,0 +1,296 @@
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/po/spply-po-grid-list';	// 목록
10
+const API_MOBILE_INFO 				= '/api/pomng/po/info-spply-pchOdr';	// 상세
11
+const API_POP_SEARCH_LIST			= '/api/whs/mng/pop-whs-search';
12
+
13
+const PAGE_MODE_LIST				= "LIST";
14
+const PAGE_MODE_VIEW				= "VIEW";
15
+
16
+let mobPageObj = {
17
+	viewMode: PAGE_MODE_LIST,
18
+	init: function () {
19
+		this.ui.init();
20
+		this.event.init();
21
+		this.ready();
22
+	},
23
+	ui: {
24
+		init: function () {
25
+			this.view();
26
+			this.info();
27
+		},
28
+		view: function() {
29
+			// 공통코드 표시
30
+			$('select').each(function() {
31
+				if($(this).data('select-code')) {
32
+					fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
33
+				}
34
+			});
35
+
36
+			// 조회일자 지정
37
+			$('#ITP_FORM_MORDMNG01010_LIST_SEARCH_FROM_DT').val(itp_fn_date_add('M', -1));
38
+			$('#ITP_FORM_MORDMNG01010_LIST_SEARCH_TO_DT').val(itp_fn_date_add('M', 0));
39
+		},
40
+		info: function() {
41
+			$('input:hidden[id$="_BRAND_ID"]').val(fn_make_user_info.get('brandId'));
42
+			$('input:hidden[id$="_STORE_ID"]').val(fn_make_user_info.get('storeId'));
43
+			$('input:hidden[id$="_SPPLY_ID"]').val(fn_make_user_info.get('userId'));
44
+		}
45
+	},
46
+	event: {
47
+		init: function() {
48
+			this.button();
49
+		},
50
+		button: function() {
51
+			$('button[id^="ITP_BTN_MORDMNG01010_LIST"]').on('click', function() {
52
+				var id = $(this).attr('id');
53
+				switch (id) {
54
+					case 'ITP_BTN_MORDMNG01010_LIST_SEARCH_WHS_NM'	: mobPopObj.popWhsNm.init(); 	break;
55
+					case 'ITP_BTN_MORDMNG01010_LIST_DELETE_WHS_NM'	: mobPopObj.popWhsNm.delete(); 	break;
56
+					case 'ITP_BTN_MORDMNG01010_LIST_SEARCH'			: mobContentObj.list.search();	break;
57
+				}
58
+				return false;
59
+			});
60
+
61
+			$('button[id^="ITP_BTN_MORDMNG01010_VIEW"]').on('click', function() {
62
+				var id = $(this).attr('id');
63
+				switch (id) {
64
+					case 'ITP_BTN_MORDMNG01010_VIEW_CANCEL_LIST'		: mobContentObj.view.cancel();	break;
65
+				}
66
+				return false;
67
+			});
68
+
69
+			$(document).on('click', '#ITP_LIST_MORDMNG01010_LIST_ITEM_ROWS li', function() {
70
+				var item = mobContentObj.list.rows[$(this).index()];
71
+				mobContentObj.view.init(item);
72
+			});
73
+
74
+			$(document).on('click', '#ITP_LIST_MORDMNG01010_POP_WHS_ROWS li button', function() {
75
+				mobPopObj.popWhsNm.choice($(this));
76
+			});
77
+		}
78
+	},
79
+	switchScreen: function(mode) {
80
+		$('#ITP_MOBILE_MORDMNG01010').find('div[id$="_CONTAINER"]').each(function(i) {
81
+			$(this).hide();
82
+		});
83
+		if(mode === PAGE_MODE_LIST) {
84
+			$('#ITP_AJAX_MORDMNG01010_LIST_CONTAINER').show();
85
+			this.moreView(true);
86
+		} else if(mode === PAGE_MODE_VIEW) {
87
+			$('#ITP_AJAX_MORDMNG01010_VIEW_CONTAINER').show();
88
+			this.moreView(false);
89
+		}
90
+		this.viewMode = mode;
91
+	},
92
+	moreView: function(isScroll) {
93
+		var _this = this;
94
+		if(isScroll) {
95
+			$('#ITP_LIST_MORDMNG01010_LIST_ITEM_AREA').on('scroll', function () {
96
+				if($(this).scrollTop() + $(this).innerHeight() + 1 >= $(this)[0].scrollHeight) {
97
+					if(mobContentObj.list.totPage > mobContentObj.list.listPage) {
98
+						if(!mobContentObj.list.isSearch) {
99
+							mobContentObj.list.load();
100
+						}
101
+					}
102
+				}
103
+			});
104
+		} else {
105
+			$('#ITP_LIST_MORDMNG01010_LIST_AREA').off('scroll');
106
+		}
107
+	},
108
+	ready: function() {
109
+		mobContentObj.list.init();
110
+	}
111
+};
112
+
113
+let mobContentObj = {
114
+	list: {
115
+		listSize: 10,
116
+		listPage: 0,
117
+		totPage: 0,
118
+		isSearch: false,
119
+		rows: [],
120
+		init: function() {
121
+			mobPageObj.switchScreen(PAGE_MODE_LIST);
122
+			this.search();
123
+		},
124
+		search: function() {
125
+			this.listPage = 0;
126
+			this.totPage = 0;
127
+			this.rows.length = 0;
128
+			$('#ITP_LIST_MORDMNG01010_LIST_ITEM_ROWS').empty();
129
+			this.load();
130
+		},
131
+		load: function() {
132
+			var _this = this;
133
+			this.isSearch = true;
134
+			var callbackFn = function(result) {
135
+				console.log(result);
136
+				_this.isSearch = false;
137
+				_this.totPage = result.gridTotal;
138
+				$.each(result.gridRows, function (i, item) {
139
+					$('#ITP_LIST_MORDMNG01010_LIST_ITEM_AREA .panel-group').append($('#ITP_LIST_MORDMNG01010_LIST_ITEM_ROWCOPY').html());
140
+					var $li = $('#ITP_LIST_MORDMNG01010_LIST_ITEM_AREA .panel-group > .list-row:last');
141
+					$li.find('.fnBrandNm').text(item.brandNm);
142
+					$li.find('.fnPchPodrUnqNo').text(item.pchPodrUnqNo);
143
+					$li.find('.fnPchOdrStNm').text(item.pchOdrStNm);
144
+					$li.find('.fnPodrDt').text(item.podrDt);
145
+					$li.find('.fnDlvReqDt').text(item.dlvReqDt);
146
+					$li.find('.fnWhsNm').text(item.whsNm);
147
+					$li.find('.fnPodrTotalAmt').text(CommonObj.comma.set(item.podrTotalAmt));
148
+					$li.find('.fnPodrItemQty').text(CommonObj.currency.add(item.podrItemQty, '개'));
149
+					_this.rows.push(item);
150
+				});
151
+			};
152
+			var errFn = function() { _this.isSearch = false;};
153
+			const param = $('#ITP_FORM_MORDMNG01010_LIST_SEARCH').serializeObject();
154
+			param.gridPage = ++this.listPage;
155
+			param.gridSize = this.listSize;
156
+			param.fromDt = param.fromDt.replace(/-/g, ".");
157
+			param.toDt = param.toDt.replace(/-/g, ".");
158
+			console.log(JSON.stringify(param));
159
+			fn_ajax_call(API_MOBILE_GRID_LIST, JSON.stringify(param), callbackFn, 'POST', errFn);
160
+		}
161
+	},
162
+	view: {
163
+		init: function(item) {
164
+			mobPageObj.switchScreen(PAGE_MODE_VIEW);
165
+			this.search(item);
166
+		},
167
+		search: function(item) {
168
+			var _this = this;
169
+			var callbackFn = function(result) {
170
+				console.log(result);
171
+				_this.view(result);
172
+			};
173
+			const param = {
174
+				'brandId': fn_make_user_info.get('brandId'),
175
+				'spplyId': fn_make_user_info.get('userId'),
176
+				'pchPodrUnqNo': item.pchPodrUnqNo
177
+			};
178
+			fn_ajax_call(API_MOBILE_INFO, param, callbackFn, 'GET');
179
+		},
180
+		view: function(result) {
181
+			var _this = this;
182
+			var id = '#ITP_AJAX_MORDMNG01010_VIEW_CONTAINER';
183
+			$(id).find('.fnBrandNm').text(result.brandNm);
184
+			$(id).find('.fnPchPodrUnqNo').text(result.pchPodrUnqNo);
185
+			$(id).find('.fnPodrDt').text(result.podrDt);
186
+			$(id).find('.fnPchOdrStNm').text(result.pchOdrStNm);
187
+			$(id).find('.fnWhsNm').text(result.whsNm);
188
+			$(id).find('.fnPodrTotalAmt').text(CommonObj.currency.add(result.podrItemQty));
189
+			$(id).find('.fnPodrMgrNm').text(result.podrMgrNm);
190
+			$.each(result.pchOdrDtlList, function (i, item) {
191
+				$('#ITP_LIST_MORDMNG01010_VIEW_ITEM_AREA .panel-group').append($('#ITP_LIST_MORDMNG01010_VIEW_ITEM_ROWCOPY').html());
192
+				var $li = $('#ITP_LIST_MORDMNG01010_VIEW_ITEM_AREA .panel-group > .list-row:last');
193
+				$li.find('.fnItemid').text(item.itemId);
194
+				$li.find('.fnItemNm').text(item.itemNm);
195
+				$li.find('.fnUPodrQty').text(item.podrQty);
196
+				$li.find('.fnUnitAmt').text(CommonObj.currency.add(item.unitAmt));
197
+				$li.find('.fnUnit').text(item.unit);
198
+				$li.find('.fnPodrQty').text(CommonObj.comma.set(item.podrQty));
199
+				$li.find('.fnPodrAmt').text(CommonObj.currency.add(item.podrAmt));
200
+				$li.find('.fnDlvReqDt').text(item.dlvReqDt);
201
+			});
202
+		},
203
+		cancel: function () {
204
+			var id = '#ITP_AJAX_MORDMNG01010_VIEW_CONTAINER';
205
+			$(id).find('.fnItemid').text('');
206
+			$(id).find('.fnItemNm').text('');
207
+			$(id).find('.fnUPodrQty').text('');
208
+			$(id).find('.fnUnitAmt').text('');
209
+			$(id).find('.fnUnit').text('');
210
+			$(id).find('.fnPodrQty').text('');
211
+			$(id).find('.fnPodrAmt').text('');
212
+			$(id).find('.fnDlvReqDt').text('');
213
+			$('#ITP_LIST_MORDMNG01010_VIEW_ITEM_AREA .panel-group').empty();
214
+			mobPageObj.switchScreen(PAGE_MODE_LIST);
215
+		}
216
+	}
217
+};
218
+
219
+let mobPopObj = {
220
+	popWhsNm: {
221
+		popId: 'ITP_POP_MORDMNG01010_WHS_AREA',
222
+		rows: [],
223
+		init: function () {
224
+			this.rows.length = 0;
225
+			mobPopObj.show(this.popId);
226
+			this.search();
227
+			this.action();
228
+		},
229
+		search: function () {
230
+			var _this = this;
231
+			$('#ITP_LIST_MORDMNG01010_POP_WHS_AREA .panel-group').empty();
232
+			var callbackFn = function(result) {
233
+				console.log(result);
234
+				_this.view(result.gridRows);
235
+			};
236
+			const param = $('#ITP_FORM_MORDMNG01010_POP_WHS').serializeObject();
237
+			fn_ajax_call(API_POP_SEARCH_LIST, JSON.stringify(param), callbackFn, 'POST');
238
+		},
239
+		view: function(gridRows) {
240
+			this.rows = gridRows;
241
+			$.each(gridRows, function (i, item) {
242
+				$('#ITP_LIST_MORDMNG01010_POP_WHS_AREA .panel-group').append($('#ITP_LIST_MORDMNG01010_POP_WHS_ROWCOPY').html());
243
+				var $li = $('#ITP_LIST_MORDMNG01010_POP_WHS_AREA .panel-group > .list-row:last');
244
+				$li.find('.fnWhsNm').text(item.whsNm);
245
+				$li.find('.fnLocationNm').text(item.locationNm);
246
+				$li.find('.fnWhsId').data('whs-id', item.whsId);
247
+			});
248
+		},
249
+		choice: function(elem) {
250
+			var _this = this;
251
+			var whsId = $(elem).data('whs-id');
252
+			$.each(this.rows, function (i, item) {
253
+				if(whsId === item.whsId) {
254
+					$('#ITP_FORM_MORDMNG01010_LIST_SEARCH #ITP_FORM_MORDMNG01010_LIST_SEARCH_WHS_ID').val(item.whsId);
255
+					$('#ITP_FORM_MORDMNG01010_LIST_SEARCH #ITP_FORM_MORDMNG01010_LIST_SEARCH_WHS_NM').val(item.whsNm);
256
+					_this.close();
257
+					return false;
258
+				}
259
+			});
260
+		},
261
+		action: function() {
262
+			var _this = this;
263
+			$('button[id^="ITP_BTN_MORDMNG01010_POP_WHS"]').off('click').on('click', function() {
264
+				var id = $(this).attr('id');
265
+				switch (id) {
266
+					case 'ITP_BTN_MORDMNG01010_POP_WHS_SEARCH'	: _this.search();			break;
267
+					case 'ITP_BTN_MORDMNG01010_POP_WHS_CHOICE'	: _this.choice($(this)); 	break;
268
+					case 'ITP_BTN_MORDMNG01010_POP_WHS_CLOSE'	: _this.close(); 			break;
269
+				}
270
+				return false;
271
+			});
272
+		},
273
+		delete: function() {
274
+			$('#ITP_FORM_MORDMNG01010_LIST_SEARCH #ITP_FORM_MORDMNG01010_LIST_SEARCH_WHS_ID').val('');
275
+			$('#ITP_FORM_MORDMNG01010_LIST_SEARCH #ITP_FORM_MORDMNG01010_LIST_SEARCH_WHS_NM').val('');
276
+		},
277
+		close: function() {
278
+			this.rows.length = 0;
279
+			$('#ITP_POP_MORDMNG01010_LIST_WHS_AREA .panel-group').empty();
280
+			$('#ITP_FORM_MORDMNG01010_POP_WHS #ITP_FORM_MORDMNG01010_POP_WHS_KEYWORD').val('');
281
+			mobPopObj.hide(this.popId);
282
+		}
283
+	},
284
+	show: function(popId) {
285
+		$('button[id$="_CLOSE"]').off('click').on('click', function() {
286
+			console.log($(this).attr('id'));
287
+			if($(this).hasClass('btn-pop-close')) {
288
+				mobPopObj.hide(popId);
289
+			}
290
+		});
291
+		$('#' + popId).show();
292
+	},
293
+	hide: function(popId) {
294
+		$('#' + popId).closest('.mobile-pop-close').hide();
295
+	}
296
+};

+ 366 - 0
src/main/webapp/mobile/js/app/mcollmng/ITP_MCOLLMNG02010.js

@@ -0,0 +1,366 @@
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/inoutmng/spply-target-grid-list';	// 목록
10
+const API_MOBILE_INFO 				= '/api/pomng/inoutmng/init-spply-inv';			// 상세
11
+const API_MOBILE_SAVE 				= '/api/pomng/inoutmng/save-spply-inv';			// 저장
12
+const API_POP_SEARCH_LIST			= '/api/whs/mng/pop-whs-search';
13
+
14
+const PAGE_MODE_LIST				= "LIST";
15
+const PAGE_MODE_VIEW				= "VIEW";
16
+
17
+let mobPageObj = {
18
+	viewMode: PAGE_MODE_LIST,
19
+	init: function () {
20
+		this.ui.init();
21
+		this.event.init();
22
+		this.ready();
23
+	},
24
+	ui: {
25
+		init: function () {
26
+			this.view();
27
+			this.info();
28
+		},
29
+		view: function() {
30
+			// 공통코드 표시
31
+			$('select').each(function() {
32
+				if($(this).data('select-code')) {
33
+					fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
34
+				}
35
+			});
36
+
37
+			// 조회일자 지정
38
+			$('#ITP_FORM_MORDMNG02010_LIST_SEARCH_FROM_DT').val(itp_fn_date_add('M', -1));
39
+			$('#ITP_FORM_MORDMNG02010_LIST_SEARCH_TO_DT').val(itp_fn_date_add('M', 0));
40
+		},
41
+		info: function() {
42
+			$('input:hidden[id$="_BRAND_ID"]').val(fn_make_user_info.get('brandId'));
43
+			$('input:hidden[id$="_STORE_ID"]').val(fn_make_user_info.get('storeId'));
44
+			$('input:hidden[id$="_SPPLY_ID"]').val(fn_make_user_info.get('userId'));
45
+		}
46
+	},
47
+	event: {
48
+		init: function() {
49
+			this.button();
50
+		},
51
+		button: function() {
52
+			$('button[id^="ITP_BTN_MORDMNG02010_LIST"]').on('click', function() {
53
+				var id = $(this).attr('id');
54
+				switch (id) {
55
+					case 'ITP_BTN_MORDMNG02010_LIST_SEARCH_WHS_NM'	: mobPopObj.popWhsNm.init(); 	break;
56
+					case 'ITP_BTN_MORDMNG02010_LIST_DELETE_WHS_NM'	: mobPopObj.popWhsNm.delete(); 	break;
57
+					case 'ITP_BTN_MORDMNG02010_LIST_SEARCH'			: mobContentObj.list.search();	break;
58
+				}
59
+				return false;
60
+			});
61
+
62
+			$('button[id^="ITP_BTN_MORDMNG02010_VIEW"]').on('click', function() {
63
+				var id = $(this).attr('id');
64
+				switch (id) {
65
+					case 'ITP_BTN_MORDMNG02010_VIEW_ADD'			: mobContentObj.view.add();	break;
66
+					case 'ITP_BTN_MORDMNG02010_VIEW_CANCEL_LIST'	: mobContentObj.view.cancel();	break;
67
+				}
68
+				return false;
69
+			});
70
+
71
+			$(document).on('click', '#ITP_LIST_MORDMNG02010_LIST_ITEM_ROWS li', function() {
72
+				var item = mobContentObj.list.rows[$(this).index()];
73
+				mobContentObj.view.init(item);
74
+			});
75
+
76
+			$(document).on('click', '#ITP_LIST_MORDMNG02010_POP_WHS_ROWS li button', function() {
77
+				mobPopObj.popWhsNm.choice($(this));
78
+			});
79
+		}
80
+	},
81
+	switchScreen: function(mode) {
82
+		$('#ITP_MOBILE_MORDMNG02010').find('div[id$="_CONTAINER"]').each(function(i) {
83
+			$(this).hide();
84
+		});
85
+		if(mode === PAGE_MODE_LIST) {
86
+			$('#ITP_AJAX_MORDMNG02010_LIST_CONTAINER').show();
87
+			this.moreView(true);
88
+		} else if(mode === PAGE_MODE_VIEW) {
89
+			$('#ITP_AJAX_MORDMNG02010_VIEW_CONTAINER').show();
90
+			this.moreView(false);
91
+		}
92
+		this.viewMode = mode;
93
+	},
94
+	moreView: function(isScroll) {
95
+		var _this = this;
96
+		if(isScroll) {
97
+			$('#ITP_LIST_MORDMNG02010_LIST_ITEM_AREA').on('scroll', function () {
98
+				if($(this).scrollTop() + $(this).innerHeight() + 1 >= $(this)[0].scrollHeight) {
99
+					if(mobContentObj.list.totPage > mobContentObj.list.listPage) {
100
+						if(!mobContentObj.list.isSearch) {
101
+							mobContentObj.list.load();
102
+						}
103
+					}
104
+				}
105
+			});
106
+		} else {
107
+			$('#ITP_LIST_MORDMNG02010_LIST_AREA').off('scroll');
108
+		}
109
+	},
110
+	ready: function() {
111
+		mobContentObj.list.init();
112
+	}
113
+};
114
+
115
+let mobContentObj = {
116
+	list: {
117
+		listSize: 10,
118
+		listPage: 0,
119
+		totPage: 0,
120
+		isSearch: false,
121
+		rows: [],
122
+		init: function() {
123
+			mobPageObj.switchScreen(PAGE_MODE_LIST);
124
+			this.search();
125
+		},
126
+		search: function() {
127
+			this.listPage = 0;
128
+			this.totPage = 0;
129
+			this.rows.length = 0;
130
+			$('#ITP_LIST_MORDMNG02010_LIST_ITEM_ROWS').empty();
131
+			this.load();
132
+		},
133
+		load: function() {
134
+			var _this = this;
135
+			this.isSearch = true;
136
+			var callbackFn = function(result) {
137
+				console.log(result);
138
+				_this.isSearch = false;
139
+				_this.totPage = result.gridTotal;
140
+				$.each(result.gridRows, function (i, item) {
141
+					$('#ITP_LIST_MORDMNG02010_LIST_ITEM_AREA .panel-group').append($('#ITP_LIST_MORDMNG02010_LIST_ITEM_ROWCOPY').html());
142
+					var $li = $('#ITP_LIST_MORDMNG02010_LIST_ITEM_AREA .panel-group > .list-row:last');
143
+					$li.find('.fnBrandNm').text(item.brandNm);
144
+					$li.find('.fnPchPodrUnqNo').text(item.pchPodrUnqNo);
145
+					$li.find('.fnPchPodrDtlNo').text(item.pchPodrDtlNo);
146
+					$li.find('.fnDlvReqDt').text(item.dlvReqDt);
147
+					$li.find('.fnWhsNm').text(item.whsNm);
148
+					$li.find('.fnPodrDt').text(item.podrDt);
149
+					$li.find('.fnItemId').text(item.itemId);
150
+					$li.find('.fnItemNm').text(item.itemNm);
151
+					$li.find('.fnPodrQty').text(CommonObj.currency.add(item.podrQty, '개'));
152
+					$li.find('.fnUnitAmt').text(CommonObj.comma.set(item.unitAmt));
153
+					$li.find('.fnPodrAmt').text(CommonObj.comma.set(item.podrAmt));
154
+					_this.rows.push(item);
155
+				});
156
+			};
157
+			var errFn = function() { _this.isSearch = false;};
158
+			const param = $('#ITP_FORM_MORDMNG02010_LIST_SEARCH').serializeObject();
159
+			param.gridPage = ++this.listPage;
160
+			param.gridSize = this.listSize;
161
+			param.fromDt = param.fromDt.replace(/-/g, ".");
162
+			param.toDt = param.toDt.replace(/-/g, ".");
163
+			fn_ajax_call(API_MOBILE_GRID_LIST, JSON.stringify(param), callbackFn, 'POST', errFn);
164
+		}
165
+	},
166
+	view: {
167
+		rows: [],
168
+		init: function(item) {
169
+			mobPageObj.switchScreen(PAGE_MODE_VIEW);
170
+			this.search(item);
171
+		},
172
+		search: function(item) {
173
+			var _this = this;
174
+			var callbackFn = function(result) {
175
+				console.log(result);
176
+				_this.view(result);
177
+			};
178
+			const param = {
179
+				'brandId': fn_make_user_info.get('brandId'),
180
+				'spplyId': fn_make_user_info.get('userId'),
181
+				'pchPodrUnqNo': item.pchPodrUnqNo
182
+			};
183
+			fn_ajax_call(API_MOBILE_INFO, param, callbackFn, 'GET');
184
+		},
185
+		view: function(result) {
186
+			var _this = this;
187
+			var id = '#ITP_AJAX_MORDMNG02010_VIEW_CONTAINER';
188
+			$(id).find('.fnBrandNm').text(result.brandNm);
189
+			$(id).find('.fnPchPodrUnqNo').text(result.pchPodrUnqNo);
190
+			$(id).find('.fnDlvRegDt').text(result.dlvReqDt);
191
+			$(id).find('.fnPodrTotalAmt').text(CommonObj.currency.add(result.podrTotalAmt));
192
+			$(id).find('.fnWhsNm').text(result.whsNm);
193
+			$(id).find('.fnDeliTelNo').text(result.deliTelNo);
194
+			$.each(result.invPoInfoList, function (i, item) {
195
+				$('#ITP_LIST_MORDMNG02010_VIEW_ITEM_AREA .panel-group').append($('#ITP_LIST_MORDMNG02010_VIEW_ITEM_ROWCOPY').html());
196
+				var $li = $('#ITP_LIST_MORDMNG02010_VIEW_ITEM_AREA .panel-group > .list-row:last');
197
+				$li.find('.fnPchPodrDtlNo').text(item.pchPodrDtlNo);
198
+				$li.find('.fnItemId').text(item.itemId);
199
+				$li.find('.fnItemNm').text(item.itemNm);
200
+				$li.find('.fnPodrQty').text(CommonObj.comma.set(item.podrQty));
201
+				$li.find('.fnUnitAmt').text(CommonObj.currency.add(item.unitAmt));
202
+				$li.find('.fnUnit').text(item.unit);
203
+				$li.find('.fnPodrAmt').text(CommonObj.currency.add(item.podrAmt));
204
+				$li.find('.fnDlvReqDt').text(item.dlvReqDt);
205
+				_this.rows.push(item);
206
+			});
207
+		},
208
+		add: function() {
209
+			var _this = this;
210
+			var param = {};
211
+			var dlvSchDt = $('#ITP_AJAX_MORDMNG02010_VIEW_CONTAINER #ITP_FORM_MORDMNG02010_VIEW_DLV_SCH_DT').val();
212
+			var dlvMgrNm = $('#ITP_AJAX_MORDMNG02010_VIEW_CONTAINER #ITP_FORM_MORDMNG02010_VIEW_DLV_MGR_NM').val();
213
+			var dlvMgrTelNo = $('#ITP_AJAX_MORDMNG02010_VIEW_CONTAINER #ITP_FORM_MORDMNG02010_VIEW_DLV_MGR_TEL_NO').val();
214
+			if(dlvSchDt.length < 1) {
215
+				alert('납품일자를 입력해 주세요.');
216
+				return false;
217
+			}
218
+			if(dlvMgrNm.length < 1) {
219
+				alert('발주담당자를 입력해 주세요.');
220
+				return false;
221
+			}
222
+			if(dlvMgrTelNo.length < 1) {
223
+				alert('발주담당자 연락처를 입력해 주세요.');
224
+				return false;
225
+			}
226
+			var gridInsertData = [];
227
+			var isValid = false;
228
+			$('#ITP_LIST_MORDMNG02010_VIEW_ITEM_AREA .panel-group > .list-row').each(function(index) {
229
+				var row = _this.rows[index];
230
+				var item = {
231
+					'pchPodrDtlNo': row.pchPodrDtlNo,
232
+					'pchPodrUnqNo': row.pchPodrUnqNo,
233
+					'shmtQty': $(this).find('#ITP_FORM_MORDMNG02010_VIEW_SHMT_QTY').val(),
234
+					'expryDate': $(this).find('#ITP_FORM_MORDMNG02010_VIEW_EXPRY_DATE').val(),
235
+					'deliDesc': $(this).find('#ITP_FORM_MORDMNG02010_VIEW_DELI_DESC').val()
236
+				};
237
+				if(row.expryYn === 'Y' && item.expryDate.length < 1) {
238
+					alert('유통기한을 입력해 주세요.');
239
+					return false;
240
+				}
241
+				if(item.shmtQty.length < 1) {
242
+					alert('납품수량을 입력해 주세요.');
243
+					return false;
244
+				}
245
+				if(row.podrQty < item.shmtQty) {
246
+					alert('납품수량은 발주수량을 초과할 수 없습니다.');
247
+					return false;
248
+				}
249
+				item.expryDate = item.expryDate.replace(/-/g, ".");
250
+				gridInsertData.push(item);
251
+				isValid = true;
252
+			});
253
+			if(isValid) {
254
+				param['viewCd'] = 'C';
255
+				param['brandId'] = fn_make_user_info.get('brandId');
256
+				param['spplyId'] = fn_make_user_info.get('userId');
257
+				param['dlvSchDt'] = dlvSchDt.replace(/-/g, ".");
258
+				param['dlvMgrNm'] = dlvMgrNm;
259
+				param['dlvMgrTelNo'] = dlvMgrTelNo;
260
+				param['gridInsertData'] = gridInsertData;
261
+				console.log(JSON.stringify(param));
262
+				var callbackFn = function(result) {
263
+					console.log(result);
264
+					_this.cancel();
265
+				};
266
+				fn_ajax_call(API_MOBILE_SAVE, JSON.stringify(param), callbackFn, 'POST');
267
+			}
268
+		},
269
+		cancel: function () {
270
+			var id = '#ITP_AJAX_MORDMNG02010_VIEW_CONTAINER';
271
+			$(id + ' #ITP_FORM_MORDMNG02010_VIEW_DLV_SCH_DT').val('');
272
+			$(id + ' #ITP_FORM_MORDMNG02010_VIEW_DLV_MGR_NM').val('');
273
+			$(id + ' #ITP_FORM_MORDMNG02010_VIEW_DLV_MGR_TEL_NO').val('');
274
+			$(id).find('.fnPchPodrDtlNo').text('');
275
+			$(id).find('.fnItemid').text('');
276
+			$(id).find('.fnItemNm').text('');
277
+			$(id).find('.fnUPodrQty').text('');
278
+			$(id).find('.fnUnitAmt').text('');
279
+			$(id).find('.fnUnit').text('');
280
+			$(id).find('.fnPodrQty').text('');
281
+			$(id).find('.fnPodrAmt').text('');
282
+			$(id).find('.fnDlvReqDt').text('');
283
+			$('#ITP_LIST_MORDMNG02010_VIEW_ITEM_AREA .panel-group').empty();
284
+			mobPageObj.switchScreen(PAGE_MODE_LIST);
285
+		}
286
+	}
287
+};
288
+
289
+let mobPopObj = {
290
+	popWhsNm: {
291
+		popId: 'ITP_POP_MORDMNG02010_WHS_AREA',
292
+		rows: [],
293
+		init: function () {
294
+			this.rows.length = 0;
295
+			mobPopObj.show(this.popId);
296
+			this.search();
297
+			this.action();
298
+		},
299
+		search: function () {
300
+			var _this = this;
301
+			$('#ITP_LIST_MORDMNG02010_POP_WHS_AREA .panel-group').empty();
302
+			var callbackFn = function(result) {
303
+				console.log(result);
304
+				_this.view(result.gridRows);
305
+			};
306
+			const param = $('#ITP_FORM_MORDMNG02010_POP_WHS').serializeObject();
307
+			fn_ajax_call(API_POP_SEARCH_LIST, JSON.stringify(param), callbackFn, 'POST');
308
+		},
309
+		view: function(gridRows) {
310
+			this.rows = gridRows;
311
+			$.each(gridRows, function (i, item) {
312
+				$('#ITP_LIST_MORDMNG02010_POP_WHS_AREA .panel-group').append($('#ITP_LIST_MORDMNG02010_POP_WHS_ROWCOPY').html());
313
+				var $li = $('#ITP_LIST_MORDMNG02010_POP_WHS_AREA .panel-group > .list-row:last');
314
+				$li.find('.fnWhsNm').text(item.whsNm);
315
+				$li.find('.fnLocationNm').text(item.locationNm);
316
+				$li.find('.fnWhsId').data('whs-id', item.whsId);
317
+			});
318
+		},
319
+		choice: function(elem) {
320
+			var _this = this;
321
+			var whsId = $(elem).data('whs-id');
322
+			$.each(this.rows, function (i, item) {
323
+				if(whsId === item.whsId) {
324
+					$('#ITP_FORM_MORDMNG02010_LIST_SEARCH #ITP_FORM_MORDMNG02010_LIST_SEARCH_WHS_ID').val(item.whsId);
325
+					$('#ITP_FORM_MORDMNG02010_LIST_SEARCH #ITP_FORM_MORDMNG02010_LIST_SEARCH_WHS_NM').val(item.whsNm);
326
+					_this.close();
327
+					return false;
328
+				}
329
+			});
330
+		},
331
+		action: function() {
332
+			var _this = this;
333
+			$('button[id^="ITP_BTN_MORDMNG02010_POP_WHS"]').off('click').on('click', function() {
334
+				var id = $(this).attr('id');
335
+				switch (id) {
336
+					case 'ITP_BTN_MORDMNG02010_POP_WHS_SEARCH'	: _this.search();			break;
337
+					case 'ITP_BTN_MORDMNG02010_POP_WHS_CHOICE'	: _this.choice($(this)); 	break;
338
+					case 'ITP_BTN_MORDMNG02010_POP_WHS_CLOSE'	: _this.close(); 			break;
339
+				}
340
+				return false;
341
+			});
342
+		},
343
+		delete: function() {
344
+			$('#ITP_FORM_MORDMNG02010_LIST_SEARCH #ITP_FORM_MORDMNG02010_LIST_SEARCH_WHS_ID').val('');
345
+			$('#ITP_FORM_MORDMNG02010_LIST_SEARCH #ITP_FORM_MORDMNG02010_LIST_SEARCH_WHS_NM').val('');
346
+		},
347
+		close: function() {
348
+			this.rows.length = 0;
349
+			$('#ITP_POP_MORDMNG02010_LIST_WHS_AREA .panel-group').empty();
350
+			$('#ITP_FORM_MORDMNG02010_POP_WHS #ITP_FORM_MORDMNG02010_POP_WHS_KEYWORD').val('');
351
+			mobPopObj.hide(this.popId);
352
+		}
353
+	},
354
+	show: function(popId) {
355
+		$('button[id$="_CLOSE"]').off('click').on('click', function() {
356
+			console.log($(this).attr('id'));
357
+			if($(this).hasClass('btn-pop-close')) {
358
+				mobPopObj.hide(popId);
359
+			}
360
+		});
361
+		$('#' + popId).show();
362
+	},
363
+	hide: function(popId) {
364
+		$('#' + popId).closest('.mobile-pop-close').hide();
365
+	}
366
+};

+ 365 - 0
src/main/webapp/mobile/js/app/mcollmng/ITP_MCOLLMNG03010.js

@@ -0,0 +1,365 @@
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/inoutmng/spply-deli-grid-list';	// 목록
10
+const API_MOBILE_INFO 				= '/api/pomng/inoutmng/info-inv';				// 상세
11
+const API_POP_SEARCH_LIST			= '/api/whs/mng/pop-whs-search';
12
+
13
+const PAGE_MODE_LIST				= "LIST";
14
+const PAGE_MODE_VIEW				= "VIEW";
15
+
16
+let mobPageObj = {
17
+	viewMode: PAGE_MODE_LIST,
18
+	init: function () {
19
+		this.ui.init();
20
+		this.event.init();
21
+		this.ready();
22
+	},
23
+	ui: {
24
+		init: function () {
25
+			this.view();
26
+			this.info();
27
+		},
28
+		view: function() {
29
+			// 공통코드 표시
30
+			$('select').each(function() {
31
+				if($(this).data('select-code')) {
32
+					fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
33
+				}
34
+			});
35
+
36
+			// 조회일자 지정
37
+			$('#ITP_FORM_MORDMNG03010_LIST_SEARCH_FROM_DT').val(itp_fn_date_add('M', -1));
38
+			$('#ITP_FORM_MORDMNG03010_LIST_SEARCH_TO_DT').val(itp_fn_date_add('M', 0));
39
+		},
40
+		info: function() {
41
+			$('input:hidden[id$="_BRAND_ID"]').val(fn_make_user_info.get('brandId'));
42
+			$('input:hidden[id$="_STORE_ID"]').val(fn_make_user_info.get('storeId'));
43
+			$('input:hidden[id$="_SPPLY_ID"]').val(fn_make_user_info.get('userId'));
44
+		}
45
+	},
46
+	event: {
47
+		init: function() {
48
+			this.button();
49
+		},
50
+		button: function() {
51
+			$('button[id^="ITP_BTN_MORDMNG03010_LIST"]').on('click', function() {
52
+				var id = $(this).attr('id');
53
+				switch (id) {
54
+					case 'ITP_BTN_MORDMNG03010_LIST_SEARCH_WHS_NM'	: mobPopObj.popWhsNm.init(); 	break;
55
+					case 'ITP_BTN_MORDMNG03010_LIST_DELETE_WHS_NM'	: mobPopObj.popWhsNm.delete(); 	break;
56
+					case 'ITP_BTN_MORDMNG03010_LIST_SEARCH'			: mobContentObj.list.search();	break;
57
+				}
58
+				return false;
59
+			});
60
+
61
+			$('button[id^="ITP_BTN_MORDMNG03010_VIEW"]').on('click', function() {
62
+				var id = $(this).attr('id');
63
+				switch (id) {
64
+					case 'ITP_BTN_MORDMNG03010_VIEW_ADD'			: mobContentObj.view.add();	break;
65
+					case 'ITP_BTN_MORDMNG03010_VIEW_CANCEL_LIST'	: mobContentObj.view.cancel();	break;
66
+				}
67
+				return false;
68
+			});
69
+
70
+			$(document).on('click', '#ITP_LIST_MORDMNG03010_LIST_ITEM_ROWS li', function() {
71
+				var item = mobContentObj.list.rows[$(this).index()];
72
+				mobContentObj.view.init(item);
73
+			});
74
+
75
+			$(document).on('click', '#ITP_LIST_MORDMNG03010_POP_WHS_ROWS li button', function() {
76
+				mobPopObj.popWhsNm.choice($(this));
77
+			});
78
+		}
79
+	},
80
+	switchScreen: function(mode) {
81
+		$('#ITP_MOBILE_MORDMNG03010').find('div[id$="_CONTAINER"]').each(function(i) {
82
+			$(this).hide();
83
+		});
84
+		if(mode === PAGE_MODE_LIST) {
85
+			$('#ITP_AJAX_MORDMNG03010_LIST_CONTAINER').show();
86
+			this.moreView(true);
87
+		} else if(mode === PAGE_MODE_VIEW) {
88
+			$('#ITP_AJAX_MORDMNG03010_VIEW_CONTAINER').show();
89
+			this.moreView(false);
90
+		}
91
+		this.viewMode = mode;
92
+	},
93
+	moreView: function(isScroll) {
94
+		var _this = this;
95
+		if(isScroll) {
96
+			$('#ITP_LIST_MORDMNG03010_LIST_ITEM_AREA').on('scroll', function () {
97
+				if($(this).scrollTop() + $(this).innerHeight() + 1 >= $(this)[0].scrollHeight) {
98
+					if(mobContentObj.list.totPage > mobContentObj.list.listPage) {
99
+						if(!mobContentObj.list.isSearch) {
100
+							mobContentObj.list.load();
101
+						}
102
+					}
103
+				}
104
+			});
105
+		} else {
106
+			$('#ITP_LIST_MORDMNG03010_LIST_AREA').off('scroll');
107
+		}
108
+	},
109
+	ready: function() {
110
+		mobContentObj.list.init();
111
+	}
112
+};
113
+
114
+let mobContentObj = {
115
+	list: {
116
+		listSize: 10,
117
+		listPage: 0,
118
+		totPage: 0,
119
+		isSearch: false,
120
+		rows: [],
121
+		init: function() {
122
+			mobPageObj.switchScreen(PAGE_MODE_LIST);
123
+			this.search();
124
+		},
125
+		search: function() {
126
+			this.listPage = 0;
127
+			this.totPage = 0;
128
+			this.rows.length = 0;
129
+			$('#ITP_LIST_MORDMNG03010_LIST_ITEM_ROWS').empty();
130
+			this.load();
131
+		},
132
+		load: function() {
133
+			var _this = this;
134
+			this.isSearch = true;
135
+			var callbackFn = function(result) {
136
+				console.log(result);
137
+				_this.isSearch = false;
138
+				_this.totPage = result.gridTotal;
139
+				$.each(result.gridRows, function (i, item) {
140
+					$('#ITP_LIST_MORDMNG03010_LIST_ITEM_AREA .panel-group').append($('#ITP_LIST_MORDMNG03010_LIST_ITEM_ROWCOPY').html());
141
+					var $li = $('#ITP_LIST_MORDMNG03010_LIST_ITEM_AREA .panel-group > .list-row:last');
142
+					$li.find('.fnBrandNm').text(item.brandNm);
143
+					$li.find('.fnPchPodrUnqNo').text(item.pchPodrUnqNo);
144
+					$li.find('.fnPchPodrDtlNo').text(item.pchPodrDtlNo);
145
+					$li.find('.fnDlvReqDt').text(item.dlvReqDt);
146
+					$li.find('.fnWhsNm').text(item.whsNm);
147
+					$li.find('.fnPodrDt').text(item.podrDt);
148
+					$li.find('.fnItemId').text(item.itemId);
149
+					$li.find('.fnItemNm').text(item.itemNm);
150
+					$li.find('.fnPodrQty').text(CommonObj.currency.add(item.podrQty, '개'));
151
+					$li.find('.fnUnitAmt').text(CommonObj.comma.set(item.unitAmt));
152
+					$li.find('.fnPodrAmt').text(CommonObj.comma.set(item.podrAmt));
153
+					_this.rows.push(item);
154
+				});
155
+			};
156
+			var errFn = function() { _this.isSearch = false;};
157
+			const param = $('#ITP_FORM_MORDMNG03010_LIST_SEARCH').serializeObject();
158
+			param.gridPage = ++this.listPage;
159
+			param.gridSize = this.listSize;
160
+			param.fromDt = param.fromDt.replace(/-/g, ".");
161
+			param.toDt = param.toDt.replace(/-/g, ".");
162
+			fn_ajax_call(API_MOBILE_GRID_LIST, JSON.stringify(param), callbackFn, 'POST', errFn);
163
+		}
164
+	},
165
+	view: {
166
+		rows: [],
167
+		init: function(item) {
168
+			mobPageObj.switchScreen(PAGE_MODE_VIEW);
169
+			this.search(item);
170
+		},
171
+		search: function(item) {
172
+			var _this = this;
173
+			var callbackFn = function(result) {
174
+				console.log(result);
175
+				_this.view(result);
176
+			};
177
+			const param = {
178
+				'brandId': fn_make_user_info.get('brandId'),
179
+				'spplyId': fn_make_user_info.get('userId'),
180
+				'pchPodrUnqNo': item.pchPodrUnqNo
181
+			};
182
+			fn_ajax_call(API_MOBILE_INFO, param, callbackFn, 'GET');
183
+		},
184
+		view: function(result) {
185
+			var _this = this;
186
+			var id = '#ITP_AJAX_MORDMNG03010_VIEW_CONTAINER';
187
+			$(id).find('.fnBrandNm').text(result.brandNm);
188
+			$(id).find('.fnPchPodrUnqNo').text(result.pchPodrUnqNo);
189
+			$(id).find('.fnDlvRegDt').text(result.dlvReqDt);
190
+			$(id).find('.fnPodrTotalAmt').text(CommonObj.currency.add(result.podrTotalAmt));
191
+			$(id).find('.fnWhsNm').text(result.whsNm);
192
+			$(id).find('.fnDeliTelNo').text(result.deliTelNo);
193
+			$.each(result.invPoInfoList, function (i, item) {
194
+				$('#ITP_LIST_MORDMNG03010_VIEW_ITEM_AREA .panel-group').append($('#ITP_LIST_MORDMNG03010_VIEW_ITEM_ROWCOPY').html());
195
+				var $li = $('#ITP_LIST_MORDMNG03010_VIEW_ITEM_AREA .panel-group > .list-row:last');
196
+				$li.find('.fnPchPodrDtlNo').text(item.pchPodrDtlNo);
197
+				$li.find('.fnItemId').text(item.itemId);
198
+				$li.find('.fnItemNm').text(item.itemNm);
199
+				$li.find('.fnPodrQty').text(CommonObj.comma.set(item.podrQty));
200
+				$li.find('.fnUnitAmt').text(CommonObj.currency.add(item.unitAmt));
201
+				$li.find('.fnUnit').text(item.unit);
202
+				$li.find('.fnPodrAmt').text(CommonObj.currency.add(item.podrAmt));
203
+				$li.find('.fnDlvReqDt').text(item.dlvReqDt);
204
+				_this.rows.push(item);
205
+			});
206
+		},
207
+		add: function() {
208
+			var _this = this;
209
+			var param = {};
210
+			var dlvSchDt = $('#ITP_AJAX_MORDMNG03010_VIEW_CONTAINER #ITP_FORM_MORDMNG03010_VIEW_DLV_SCH_DT').val();
211
+			var dlvMgrNm = $('#ITP_AJAX_MORDMNG03010_VIEW_CONTAINER #ITP_FORM_MORDMNG03010_VIEW_DLV_MGR_NM').val();
212
+			var dlvMgrTelNo = $('#ITP_AJAX_MORDMNG03010_VIEW_CONTAINER #ITP_FORM_MORDMNG03010_VIEW_DLV_MGR_TEL_NO').val();
213
+			if(dlvSchDt.length < 1) {
214
+				alert('납품일자를 입력해 주세요.');
215
+				return false;
216
+			}
217
+			if(dlvMgrNm.length < 1) {
218
+				alert('발주담당자를 입력해 주세요.');
219
+				return false;
220
+			}
221
+			if(dlvMgrTelNo.length < 1) {
222
+				alert('발주담당자 연락처를 입력해 주세요.');
223
+				return false;
224
+			}
225
+			var gridInsertData = [];
226
+			var isValid = false;
227
+			$('#ITP_LIST_MORDMNG03010_VIEW_ITEM_AREA .panel-group > .list-row').each(function(index) {
228
+				var row = _this.rows[index];
229
+				var item = {
230
+					'pchPodrDtlNo': row.pchPodrDtlNo,
231
+					'pchPodrUnqNo': row.pchPodrUnqNo,
232
+					'shmtQty': $(this).find('#ITP_FORM_MORDMNG03010_VIEW_SHMT_QTY').val(),
233
+					'expryDate': $(this).find('#ITP_FORM_MORDMNG03010_VIEW_EXPRY_DATE').val(),
234
+					'deliDesc': $(this).find('#ITP_FORM_MORDMNG03010_VIEW_DELI_DESC').val()
235
+				};
236
+				if(row.expryYn === 'Y' && item.expryDate.length < 1) {
237
+					alert('유통기한을 입력해 주세요.');
238
+					return false;
239
+				}
240
+				if(item.shmtQty.length < 1) {
241
+					alert('납품수량을 입력해 주세요.');
242
+					return false;
243
+				}
244
+				if(row.podrQty < item.shmtQty) {
245
+					alert('납품수량은 발주수량을 초과할 수 없습니다.');
246
+					return false;
247
+				}
248
+				item.expryDate = item.expryDate.replace(/-/g, ".");
249
+				gridInsertData.push(item);
250
+				isValid = true;
251
+			});
252
+			if(isValid) {
253
+				param['viewCd'] = 'C';
254
+				param['brandId'] = fn_make_user_info.get('brandId');
255
+				param['spplyId'] = fn_make_user_info.get('userId');
256
+				param['dlvSchDt'] = dlvSchDt.replace(/-/g, ".");
257
+				param['dlvMgrNm'] = dlvMgrNm;
258
+				param['dlvMgrTelNo'] = dlvMgrTelNo;
259
+				param['gridInsertData'] = gridInsertData;
260
+				console.log(JSON.stringify(param));
261
+				var callbackFn = function(result) {
262
+					console.log(result);
263
+					_this.cancel();
264
+				};
265
+				fn_ajax_call(API_MOBILE_SAVE, JSON.stringify(param), callbackFn, 'POST');
266
+			}
267
+		},
268
+		cancel: function () {
269
+			var id = '#ITP_AJAX_MORDMNG03010_VIEW_CONTAINER';
270
+			$(id + ' #ITP_FORM_MORDMNG03010_VIEW_DLV_SCH_DT').val('');
271
+			$(id + ' #ITP_FORM_MORDMNG03010_VIEW_DLV_MGR_NM').val('');
272
+			$(id + ' #ITP_FORM_MORDMNG03010_VIEW_DLV_MGR_TEL_NO').val('');
273
+			$(id).find('.fnPchPodrDtlNo').text('');
274
+			$(id).find('.fnItemid').text('');
275
+			$(id).find('.fnItemNm').text('');
276
+			$(id).find('.fnUPodrQty').text('');
277
+			$(id).find('.fnUnitAmt').text('');
278
+			$(id).find('.fnUnit').text('');
279
+			$(id).find('.fnPodrQty').text('');
280
+			$(id).find('.fnPodrAmt').text('');
281
+			$(id).find('.fnDlvReqDt').text('');
282
+			$('#ITP_LIST_MORDMNG03010_VIEW_ITEM_AREA .panel-group').empty();
283
+			mobPageObj.switchScreen(PAGE_MODE_LIST);
284
+		}
285
+	}
286
+};
287
+
288
+let mobPopObj = {
289
+	popWhsNm: {
290
+		popId: 'ITP_POP_MORDMNG03010_WHS_AREA',
291
+		rows: [],
292
+		init: function () {
293
+			this.rows.length = 0;
294
+			mobPopObj.show(this.popId);
295
+			this.search();
296
+			this.action();
297
+		},
298
+		search: function () {
299
+			var _this = this;
300
+			$('#ITP_LIST_MORDMNG03010_POP_WHS_AREA .panel-group').empty();
301
+			var callbackFn = function(result) {
302
+				console.log(result);
303
+				_this.view(result.gridRows);
304
+			};
305
+			const param = $('#ITP_FORM_MORDMNG03010_POP_WHS').serializeObject();
306
+			fn_ajax_call(API_POP_SEARCH_LIST, JSON.stringify(param), callbackFn, 'POST');
307
+		},
308
+		view: function(gridRows) {
309
+			this.rows = gridRows;
310
+			$.each(gridRows, function (i, item) {
311
+				$('#ITP_LIST_MORDMNG03010_POP_WHS_AREA .panel-group').append($('#ITP_LIST_MORDMNG03010_POP_WHS_ROWCOPY').html());
312
+				var $li = $('#ITP_LIST_MORDMNG03010_POP_WHS_AREA .panel-group > .list-row:last');
313
+				$li.find('.fnWhsNm').text(item.whsNm);
314
+				$li.find('.fnLocationNm').text(item.locationNm);
315
+				$li.find('.fnWhsId').data('whs-id', item.whsId);
316
+			});
317
+		},
318
+		choice: function(elem) {
319
+			var _this = this;
320
+			var whsId = $(elem).data('whs-id');
321
+			$.each(this.rows, function (i, item) {
322
+				if(whsId === item.whsId) {
323
+					$('#ITP_FORM_MORDMNG03010_LIST_SEARCH #ITP_FORM_MORDMNG03010_LIST_SEARCH_WHS_ID').val(item.whsId);
324
+					$('#ITP_FORM_MORDMNG03010_LIST_SEARCH #ITP_FORM_MORDMNG03010_LIST_SEARCH_WHS_NM').val(item.whsNm);
325
+					_this.close();
326
+					return false;
327
+				}
328
+			});
329
+		},
330
+		action: function() {
331
+			var _this = this;
332
+			$('button[id^="ITP_BTN_MORDMNG03010_POP_WHS"]').off('click').on('click', function() {
333
+				var id = $(this).attr('id');
334
+				switch (id) {
335
+					case 'ITP_BTN_MORDMNG03010_POP_WHS_SEARCH'	: _this.search();			break;
336
+					case 'ITP_BTN_MORDMNG03010_POP_WHS_CHOICE'	: _this.choice($(this)); 	break;
337
+					case 'ITP_BTN_MORDMNG03010_POP_WHS_CLOSE'	: _this.close(); 			break;
338
+				}
339
+				return false;
340
+			});
341
+		},
342
+		delete: function() {
343
+			$('#ITP_FORM_MORDMNG03010_LIST_SEARCH #ITP_FORM_MORDMNG03010_LIST_SEARCH_WHS_ID').val('');
344
+			$('#ITP_FORM_MORDMNG03010_LIST_SEARCH #ITP_FORM_MORDMNG03010_LIST_SEARCH_WHS_NM').val('');
345
+		},
346
+		close: function() {
347
+			this.rows.length = 0;
348
+			$('#ITP_POP_MORDMNG03010_LIST_WHS_AREA .panel-group').empty();
349
+			$('#ITP_FORM_MORDMNG03010_POP_WHS #ITP_FORM_MORDMNG03010_POP_WHS_KEYWORD').val('');
350
+			mobPopObj.hide(this.popId);
351
+		}
352
+	},
353
+	show: function(popId) {
354
+		$('button[id$="_CLOSE"]').off('click').on('click', function() {
355
+			console.log($(this).attr('id'));
356
+			if($(this).hasClass('btn-pop-close')) {
357
+				mobPopObj.hide(popId);
358
+			}
359
+		});
360
+		$('#' + popId).show();
361
+	},
362
+	hide: function(popId) {
363
+		$('#' + popId).closest('.mobile-pop-close').hide();
364
+	}
365
+};