|
@@ -0,0 +1,331 @@
|
|
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-streamline-grid-list'; // 목록
|
|
10
|
+const API_MOBILE_INFO = '/api/pomng/po/info-pchOdr'; // 상세
|
|
11
|
+const API_MOBILE_CANCEL_PCHPO = '/api/pomng/po/cancel-pchPo';
|
|
12
|
+const API_POP_SEARCH_LIST = '/api/whs/mng/pop-whs-search';
|
|
13
|
+const API_POP_ITEM_LIST = '/api/item/pop-grid-list';
|
|
14
|
+const API_POP_SPPLY_LIST = '/api/spply/pop-grid-list';
|
|
15
|
+
|
|
16
|
+const PAGE_MODE_LIST = "LIST";
|
|
17
|
+const PAGE_MODE_VIEW = "VIEW";
|
|
18
|
+
|
|
19
|
+let mobPageObj = {
|
|
20
|
+ viewMode: PAGE_MODE_LIST,
|
|
21
|
+ init: function () {
|
|
22
|
+ this.ui.init();
|
|
23
|
+ this.event.init();
|
|
24
|
+ this.ready();
|
|
25
|
+ },
|
|
26
|
+ ui: {
|
|
27
|
+ init: function () {
|
|
28
|
+ this.view();
|
|
29
|
+ },
|
|
30
|
+ view: function() {
|
|
31
|
+ // 공통코드 표시
|
|
32
|
+ $('select').each(function() {
|
|
33
|
+ if($(this).data('select-code')) {
|
|
34
|
+ fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
|
|
35
|
+ }
|
|
36
|
+ });
|
|
37
|
+
|
|
38
|
+ // 조회일자 지정
|
|
39
|
+ $('#ITP_MOBILE_MPOMNG04011 .itp_input.date').datepicker(ITP_DATE_LANGUAGE);
|
|
40
|
+ $('#ITP_FORM_MPOMNG04011_LIST_SEARCH_FROM_DT').datepicker('setDate', itp_fn_date_add('D', -7));
|
|
41
|
+ $('#ITP_FORM_MPOMNG04011_LIST_SEARCH_TO_DT').datepicker('setDate', itp_fn_date_add('D', 0));
|
|
42
|
+
|
|
43
|
+ $('input:hidden[id$="_BRAND_ID"]').val(fn_make_user_info.get('brandId'));
|
|
44
|
+ $('input:hidden[id$="_STORE_ID"]').val(fn_make_user_info.get('storeId'));
|
|
45
|
+ }
|
|
46
|
+ },
|
|
47
|
+ event: {
|
|
48
|
+ init: function() {
|
|
49
|
+ this.button();
|
|
50
|
+ },
|
|
51
|
+ button: function() {
|
|
52
|
+ $('button[id^="ITP_BTN_MPOMNG04011_LIST"]').on('click', function() {
|
|
53
|
+ var id = $(this).attr('id');
|
|
54
|
+ switch (id) {
|
|
55
|
+ case 'ITP_BTN_MPOMNG04011_LIST_SEARCH_WHS_NM' : mobPopObj.popWhsNm.init(); break;
|
|
56
|
+ case 'ITP_BTN_MPOMNG04011_LIST_DELETE_WHS_NM' : mobPopObj.popWhsNm.delete(); break;
|
|
57
|
+ case 'ITP_BTN_MPOMNG04011_LIST_SEARCH_SPPLY_NM' : mobPopObj.popSpply.init(); break;
|
|
58
|
+ case 'ITP_BTN_MPOMNG04011_LIST_DELETE_SPPLY_NM' : mobPopObj.popSpply.delete(); break;
|
|
59
|
+ case 'ITP_BTN_MPOMNG04011_LIST_SEARCH' : mobContObj.list.search(); break;
|
|
60
|
+ }
|
|
61
|
+ return false;
|
|
62
|
+ });
|
|
63
|
+
|
|
64
|
+ $('button[id^="ITP_BTN_MPOMNG04011_VIEW"]').on('click', function() {
|
|
65
|
+ var id = $(this).attr('id');
|
|
66
|
+ switch (id) {
|
|
67
|
+ case 'ITP_BTN_MPOMNG04011_VIEW_CANCEL_LIST' : mobContObj.view.cancel(); break;
|
|
68
|
+ }
|
|
69
|
+ return false;
|
|
70
|
+ });
|
|
71
|
+
|
|
72
|
+ $(document).off('click', '#ITP_LIST_MPOMNG04011_LIST_ITEM_ROWS li');
|
|
73
|
+ $(document).on('click', '#ITP_LIST_MPOMNG04011_LIST_ITEM_ROWS li', function() {
|
|
74
|
+ var item = mobContObj.list.rows[$(this).index()];
|
|
75
|
+ mobContObj.view.init(item);
|
|
76
|
+ });
|
|
77
|
+
|
|
78
|
+ }
|
|
79
|
+ },
|
|
80
|
+ switchScreen: function(mode) {
|
|
81
|
+ $('#ITP_MOBILE_MPOMNG04011').find('div[id$="_CONTAINER"]').each(function(i) {
|
|
82
|
+ $(this).hide();
|
|
83
|
+ });
|
|
84
|
+ if(mode === PAGE_MODE_LIST) {
|
|
85
|
+ $('#ITP_AJAX_MPOMNG04011_LIST_CONTAINER').show();
|
|
86
|
+ } else if(mode === PAGE_MODE_VIEW) {
|
|
87
|
+ $('#ITP_AJAX_MPOMNG04011_VIEW_CONTAINER').show();
|
|
88
|
+ CommonObj.moreView('#ITP_LIST_MPOMNG04011_LIST_ITEM_AREA', false);
|
|
89
|
+ }
|
|
90
|
+ this.viewMode = mode;
|
|
91
|
+ },
|
|
92
|
+ ready: function() {
|
|
93
|
+ mobContObj.list.init();
|
|
94
|
+ }
|
|
95
|
+};
|
|
96
|
+
|
|
97
|
+let mobContObj = {
|
|
98
|
+ list: {
|
|
99
|
+ listPage: 1,
|
|
100
|
+ rows: [],
|
|
101
|
+ init: function() {
|
|
102
|
+ // mobPageObj.switchScreen(PAGE_MODE_LIST);
|
|
103
|
+ // this.search();
|
|
104
|
+ },
|
|
105
|
+ search: function() {
|
|
106
|
+ this.listPage = 1;
|
|
107
|
+ this.rows.length = 0;
|
|
108
|
+ $('#ITP_LIST_MPOMNG04011_LIST_ITEM_ROWS').empty();
|
|
109
|
+ setTimeout(function() {
|
|
110
|
+ mobContObj.list.load();
|
|
111
|
+ }, 100);
|
|
112
|
+ },
|
|
113
|
+ pager: function(totPage) {
|
|
114
|
+ (this.listPage < totPage) ?
|
|
115
|
+ CommonObj.moreView('#ITP_LIST_MPOMNG04011_LIST_ITEM_AREA', true, mobContObj.list.load) :
|
|
116
|
+ CommonObj.moreView('#ITP_LIST_MPOMNG04011_LIST_ITEM_AREA', false);
|
|
117
|
+ this.listPage += 1;
|
|
118
|
+ },
|
|
119
|
+ load: function() {
|
|
120
|
+ var _this = this;
|
|
121
|
+ var callbackFn = function(result) {
|
|
122
|
+ console.log(result);
|
|
123
|
+ mobContObj.list.pager(result.gridTotal);
|
|
124
|
+ $.each(result.gridRows, function (i, item) {
|
|
125
|
+ $('#ITP_LIST_MPOMNG04011_LIST_ITEM_AREA .panel-group').append($('#ITP_LIST_MPOMNG04011_LIST_ITEM_ROWCOPY').html());
|
|
126
|
+ var $li = $('#ITP_LIST_MPOMNG04011_LIST_ITEM_AREA .panel-group > .item-row:last');
|
|
127
|
+ $li.find('.fnPodrDt').text(item.podrDt);
|
|
128
|
+ $li.find('.fnPodrMgrNm').text($li.find('.fnPodrMgrNm').text().replace('$', item.podrMgrNm));
|
|
129
|
+ $li.find('.fnPchodrStCd').text(item.pchOdrStNm);
|
|
130
|
+ $li.find('.fnLocationNm').text(item.whsNm);
|
|
131
|
+ // $li.find('.fnLocationNm').text(item.whsNm + ' - ' + item.locationNm);
|
|
132
|
+ $li.find('.fnPodrItemQty').text(CommonObj.comma.set(item.podrItemQty));
|
|
133
|
+ $li.find('.fnPodrTotalAmt').text(CommonObj.currency.add(item.podrTotalAmt));
|
|
134
|
+ $li.find('.fnSpplyNm').text(item.spplyNm);
|
|
135
|
+ $li.find('.fnDlvDvsnNm').text(item.dlvDvsnNm);
|
|
136
|
+ mobContObj.list.rows.push(item);
|
|
137
|
+ });
|
|
138
|
+ };
|
|
139
|
+ const param = $('#ITP_FORM_MPOMNG04011_DETAIL').serializeObject();
|
|
140
|
+ param.pagingYn = false;
|
|
141
|
+ fn_ajax_call(API_MOBILE_GRID_LIST, JSON.stringify(param), callbackFn, 'POST');
|
|
142
|
+ }
|
|
143
|
+ },
|
|
144
|
+ view: {
|
|
145
|
+ init: function(item) {
|
|
146
|
+ mobPageObj.switchScreen(PAGE_MODE_VIEW);
|
|
147
|
+ this.search(item);
|
|
148
|
+ },
|
|
149
|
+ search: function(item) {
|
|
150
|
+ var _this = this;
|
|
151
|
+ var callbackFn = function(result) {
|
|
152
|
+ console.log(result);
|
|
153
|
+ _this.view(result);
|
|
154
|
+ };
|
|
155
|
+ const param = {'pchPodrUnqNo': item.pchPodrUnqNo};
|
|
156
|
+ fn_ajax_call(API_MOBILE_INFO, param, callbackFn, 'GET');
|
|
157
|
+ },
|
|
158
|
+ view: function(result) {
|
|
159
|
+ var _this = this;
|
|
160
|
+ var id = '#ITP_AJAX_MPOMNG04011_VIEW_CONTAINER';
|
|
161
|
+ $(id).find('.fnPodrDt').text(result.podrDt);
|
|
162
|
+ $(id).find('.fnPodrTotalAmt').text(CommonObj.currency.add(result.podrTotalAmt));
|
|
163
|
+ $(id).find('.fnDlvReqDt').text(result.dlvReqDt);
|
|
164
|
+ $(id).find('.fnWhsNm').text(result.whsNm);
|
|
165
|
+ $(id).find('.fnSpplyNm').text(result.spplyNm);
|
|
166
|
+ $.each(result.pchOdrDtlList, function (i, item) {
|
|
167
|
+ $('#ITP_LIST_MPOMNG04011_VIEW_ITEM_AREA .panel-group').append($('#ITP_LIST_MPOMNG04011_VIEW_ITEM_ROWCOPY').html());
|
|
168
|
+ var $li = $('#ITP_LIST_MPOMNG04011_VIEW_ITEM_AREA .panel-group > .item-row:last');
|
|
169
|
+ $li.find('.fnItemNm').text(item.itemNm);
|
|
170
|
+ $li.find('.fnUnit').text(item.unit);
|
|
171
|
+ $li.find('.fnPodrQty').text(CommonObj.comma.set(item.podrQty + ' ' + item.unit));
|
|
172
|
+ $li.find('.fnUnitAmt').text(CommonObj.currency.add(item.unitAmt));
|
|
173
|
+ $li.find('.fnPodrAmt').text(CommonObj.currency.add(item.podrAmt));
|
|
174
|
+ });
|
|
175
|
+ },
|
|
176
|
+ cancel: function () {
|
|
177
|
+ var id = '#ITP_AJAX_MPOMNG04011_VIEW_CONTAINER';
|
|
178
|
+ $(id).find('.fnPodrDt').text('');
|
|
179
|
+ $(id).find('.fnPodrTotalAmt').text('');
|
|
180
|
+ $(id).find('.fnDlvReqDt').text('');
|
|
181
|
+ $(id).find('.fnWhsNm').text('');
|
|
182
|
+ $(id).find('.fnSpplyNm').text('');
|
|
183
|
+ $('#ITP_LIST_MPOMNG04011_VIEW_ITEM_AREA .panel-group').empty();
|
|
184
|
+ mobPageObj.switchScreen(PAGE_MODE_LIST);
|
|
185
|
+ }
|
|
186
|
+ }
|
|
187
|
+};
|
|
188
|
+
|
|
189
|
+let mobPopObj = {
|
|
190
|
+ popSpply: {
|
|
191
|
+ popId: 'ITP_POP_MPOMNG04011_SPPLY_AREA',
|
|
192
|
+ rows: [],
|
|
193
|
+ init: function() {
|
|
194
|
+ this.rows.length = 0;
|
|
195
|
+ mobPopObj.show(this.popId);
|
|
196
|
+ this.search();
|
|
197
|
+ this.action();
|
|
198
|
+ },
|
|
199
|
+ search: function() {
|
|
200
|
+ var _this = this;
|
|
201
|
+ $('#ITP_POP_MPOMNG04011_SPPLY_AREA .panel-group').empty();
|
|
202
|
+ var callbackFn = function(result) {
|
|
203
|
+ console.log(result);
|
|
204
|
+ _this.view(result.gridRows);
|
|
205
|
+ };
|
|
206
|
+ let param = $('#ITP_FORM_MPOMNG04011_POP_SPPLY_SEARCH').serializeObject();
|
|
207
|
+ fn_ajax_call(API_POP_SPPLY_LIST, JSON.stringify(param), callbackFn, 'POST');
|
|
208
|
+ },
|
|
209
|
+ view: function(gridRows) {
|
|
210
|
+ this.rows = gridRows;
|
|
211
|
+ $.each(gridRows, function (i, item) {
|
|
212
|
+ $('#ITP_POP_MPOMNG04011_SPPLY_AREA .panel-group').append($('#ITP_POP_MPOMNG04011_SPPLY_LIST_ROWCOPY').html());
|
|
213
|
+ var $li = $('#ITP_POP_MPOMNG04011_SPPLY_AREA .panel-group > .row_2:last');
|
|
214
|
+ $li.find('.fnSpplyNm').text(item.spplyNm);
|
|
215
|
+ $li.find('.fnStNm').text($li.find('.fnStNm').text().replace('$', item.stNm));
|
|
216
|
+ $li.find('.fnSpplyId').data('item-key', item.spplyId);
|
|
217
|
+ });
|
|
218
|
+ },
|
|
219
|
+ choice: function(elem) {
|
|
220
|
+ var _this = this;
|
|
221
|
+ var spplyId = $(elem).data('item-key');
|
|
222
|
+ $.each(this.rows, function (i, item) {
|
|
223
|
+ if(spplyId === item.spplyId) {
|
|
224
|
+ $('#ITP_FORM_MPOMNG04011_LIST_SEARCH #ITP_FORM_MPOMNG04011_LIST_SEARCH_SPPLY_ID').val(item.spplyId);
|
|
225
|
+ $('#ITP_FORM_MPOMNG04011_LIST_SEARCH #ITP_FORM_MPOMNG04011_LIST_SEARCH_SPPLY_NM').val(item.spplyNm);
|
|
226
|
+ _this.close();
|
|
227
|
+ return false;
|
|
228
|
+ }
|
|
229
|
+ });
|
|
230
|
+ },
|
|
231
|
+ action: function() {
|
|
232
|
+ var _this = this;
|
|
233
|
+ $('button[id^="ITP_BTN_MPOMNG04011_POP_SPPLY"]').off('click').on('click', function() {
|
|
234
|
+ var id = $(this).attr('id');
|
|
235
|
+ switch (id) {
|
|
236
|
+ case 'ITP_BTN_MPOMNG04011_POP_SPPLY_SEARCH' : _this.search(); break;
|
|
237
|
+ case 'ITP_BTN_MPOMNG04011_POP_SPPLY_CHOICE' : _this.choice($(this)); break;
|
|
238
|
+ case 'ITP_BTN_MPOMNG04011_POP_SPPLY_CLOSE' : _this.close(); break;
|
|
239
|
+ }
|
|
240
|
+ return false;
|
|
241
|
+ });
|
|
242
|
+ },
|
|
243
|
+ delete: function() {
|
|
244
|
+ $('#ITP_FORM_MPOMNG04011_LIST_SEARCH #ITP_FORM_MPOMNG04011_LIST_SEARCH_SPPLY_ID').val('');
|
|
245
|
+ $('#ITP_FORM_MPOMNG04011_LIST_SEARCH #ITP_FORM_MPOMNG04011_LIST_SEARCH_SPPLY_NM').val('');
|
|
246
|
+ },
|
|
247
|
+ close: function() {
|
|
248
|
+ this.rows.length = 0;
|
|
249
|
+ $('#ITP_POP_MPOMNG04011_LIST_SPPLY_AREA .panel-group').empty();
|
|
250
|
+ $('#ITP_FORM_MPOMNG04011_POP_SPPLY_SEARCH #ITP_FORM_MPOMNG04011_POP_SPPLY_KEYWORD').val('');
|
|
251
|
+ mobPopObj.hide(this.popId);
|
|
252
|
+ }
|
|
253
|
+ },
|
|
254
|
+ popWhsNm: {
|
|
255
|
+ popId: 'ITP_POP_MPOMNG04011_WHS_AREA',
|
|
256
|
+ rows: [],
|
|
257
|
+ init: function () {
|
|
258
|
+ this.rows.length = 0;
|
|
259
|
+ mobPopObj.show(this.popId);
|
|
260
|
+ this.search();
|
|
261
|
+ this.action();
|
|
262
|
+ },
|
|
263
|
+ search: function () {
|
|
264
|
+ var _this = this;
|
|
265
|
+ $('#ITP_LIST_MPOMNG04011_POP_WHS_AREA .panel-group').empty();
|
|
266
|
+ var callbackFn = function(result) {
|
|
267
|
+ console.log(result);
|
|
268
|
+ _this.view(result.gridRows);
|
|
269
|
+ };
|
|
270
|
+ const param = $('#ITP_FORM_MPOMNG04011_POP_WHS').serializeObject();
|
|
271
|
+ (fn_make_user_info.get('authTpCd') === '50') ? param.swhsDvsn = 'W02' : param.swhsDvsn = '';
|
|
272
|
+ fn_ajax_call(API_POP_SEARCH_LIST, JSON.stringify(param), callbackFn, 'POST');
|
|
273
|
+ },
|
|
274
|
+ view: function(gridRows) {
|
|
275
|
+ this.rows = gridRows;
|
|
276
|
+ $.each(gridRows, function (i, item) {
|
|
277
|
+ $('#ITP_LIST_MPOMNG04011_POP_WHS_AREA .panel-group').append($('#ITP_LIST_MPOMNG04011_POP_WHS_ROWCOPY').html());
|
|
278
|
+ var $li = $('#ITP_LIST_MPOMNG04011_POP_WHS_AREA .panel-group > .row_2:last');
|
|
279
|
+ $li.find('.fnWhsNm').text(item.whsNm);
|
|
280
|
+ $li.find('.fnLocationNm').text(item.locationNm);
|
|
281
|
+ $li.find('.fnWhsId').data('whs-id', item.whsId);
|
|
282
|
+ });
|
|
283
|
+ },
|
|
284
|
+ choice: function(elem) {
|
|
285
|
+ var _this = this;
|
|
286
|
+ var whsId = $(elem).data('whs-id');
|
|
287
|
+ $.each(this.rows, function (i, item) {
|
|
288
|
+ if(whsId === item.whsId) {
|
|
289
|
+ $('#ITP_FORM_MPOMNG04011_LIST_SEARCH #ITP_FORM_MPOMNG04011_LIST_SEARCH_WHS_ID').val(item.whsId);
|
|
290
|
+ $('#ITP_FORM_MPOMNG04011_LIST_SEARCH #ITP_FORM_MPOMNG04011_LIST_SEARCH_WHS_NM').val(item.whsNm);
|
|
291
|
+ _this.close();
|
|
292
|
+ return false;
|
|
293
|
+ }
|
|
294
|
+ });
|
|
295
|
+ },
|
|
296
|
+ action: function() {
|
|
297
|
+ var _this = this;
|
|
298
|
+ $('button[id^="ITP_BTN_MPOMNG04011_POP_WHS"]').off('click').on('click', function() {
|
|
299
|
+ var id = $(this).attr('id');
|
|
300
|
+ switch (id) {
|
|
301
|
+ case 'ITP_BTN_MPOMNG04011_POP_WHS_SEARCH' : _this.search(); break;
|
|
302
|
+ case 'ITP_BTN_MPOMNG04011_POP_WHS_CHOICE' : _this.choice($(this)); break;
|
|
303
|
+ case 'ITP_BTN_MPOMNG04011_POP_WHS_CLOSE' : _this.close(); break;
|
|
304
|
+ }
|
|
305
|
+ return false;
|
|
306
|
+ });
|
|
307
|
+ },
|
|
308
|
+ delete: function() {
|
|
309
|
+ $('#ITP_FORM_MPOMNG04011_LIST_SEARCH #ITP_FORM_MPOMNG04011_LIST_SEARCH_WHS_ID').val('');
|
|
310
|
+ $('#ITP_FORM_MPOMNG04011_LIST_SEARCH #ITP_FORM_MPOMNG04011_LIST_SEARCH_WHS_NM').val('');
|
|
311
|
+ },
|
|
312
|
+ close: function() {
|
|
313
|
+ this.rows.length = 0;
|
|
314
|
+ $('#ITP_POP_MPOMNG04011_LIST_WHS_AREA .panel-group').empty();
|
|
315
|
+ $('#ITP_FORM_MPOMNG04011_POP_WHS #ITP_FORM_MPOMNG04011_POP_WHS_KEYWORD').val('');
|
|
316
|
+ mobPopObj.hide(this.popId);
|
|
317
|
+ }
|
|
318
|
+ },
|
|
319
|
+ show: function(popId) {
|
|
320
|
+ $('button[id$="_CLOSE"]').off('click').on('click', function() {
|
|
321
|
+ console.log($(this).attr('id'));
|
|
322
|
+ if($(this).hasClass('btn-pop-close')) {
|
|
323
|
+ mobPopObj.hide(popId);
|
|
324
|
+ }
|
|
325
|
+ });
|
|
326
|
+ $('#' + popId).show();
|
|
327
|
+ },
|
|
328
|
+ hide: function(popId) {
|
|
329
|
+ $('#' + popId).closest('.mobile-pop-close').hide();
|
|
330
|
+ }
|
|
331
|
+};
|