|
@@ -33,11 +33,11 @@ let mobPageObj = {
|
33
|
33
|
button: function() {
|
34
|
34
|
$('button[id^="ITP_BTN_MPOMNG01010_DETAIL"]').on('click', function() {
|
35
|
35
|
if($(this).is('[data-call-popup]')) {
|
|
36
|
+ console.log($(this).attr('id'));
|
36
|
37
|
mobPopObj.show($(this).data('call-popup'));
|
37
|
38
|
} else {
|
38
|
39
|
var id = $(this).attr('id');
|
39
|
40
|
switch (id) {
|
40
|
|
- case 'ITP_BTN_MPOMNG01010_DETAIL_ADDROW': contPopObj.list.addRow(); break;
|
41
|
41
|
case 'ITP_BTN_MPOMNG01010_DETAIL_DELROW': contPopObj.list.delRow(); break;
|
42
|
42
|
case 'ITP_BTN_MPOMNG01010_DETAIL_DELETE_WHS_NM': break;
|
43
|
43
|
case 'ITP_BTN_MPOMNG01010_DETAIL_TEMP_SAVE': break;
|
|
@@ -76,73 +76,138 @@ let contPopObj = {
|
76
|
76
|
}
|
77
|
77
|
},
|
78
|
78
|
list: {
|
|
79
|
+ rows: [],
|
79
|
80
|
addRow: function() {
|
80
|
|
- var _this = this;
|
81
|
|
- $('#ITP_LIST_MPOMNG01010_POP_ITEM_ROWS').empty();
|
82
|
|
- var callbackFn = function(result) {
|
83
|
|
- mobPopObj.addRow.init(result);
|
84
|
|
- };
|
85
|
|
- let param = $('#ITP_FORM_MPOMNG01010_POPUP_ITEM').serializeObject();
|
86
|
|
- param.gridSize = 10;
|
87
|
|
- fn_ajax_call(API_POP_ITEM_LIST, JSON.stringify(param), callbackFn, 'POST');
|
88
|
81
|
},
|
89
|
82
|
delRow: function() {
|
90
|
|
-
|
|
83
|
+ this.detachRow();
|
|
84
|
+ },
|
|
85
|
+ attachRow: function (item) {
|
|
86
|
+ console.log(item);
|
|
87
|
+ var fnIsExist = function(rows) {
|
|
88
|
+ var isExist = false;
|
|
89
|
+ $.each(rows, function(i, row) {
|
|
90
|
+ if(row.brandUnitUnqNo === item.brandUnitUnqNo) {
|
|
91
|
+ isExist = true;
|
|
92
|
+ return false;
|
|
93
|
+ }
|
|
94
|
+ });
|
|
95
|
+ return isExist;
|
|
96
|
+ };
|
|
97
|
+ if(!fnIsExist(this.rows)) {
|
|
98
|
+ this.rows.push(item);
|
|
99
|
+ $('#ITP_LIST_MPOMNG01010_ITEM_AREA .panel-group').append($('#ITP_LIST_MPOMNG01010_DETAIL_ROWCOPY').html());
|
|
100
|
+ var $li = $('#ITP_LIST_MPOMNG01010_ITEM_AREA .panel-group > .row_2:last');
|
|
101
|
+ $li.find('.fnBrandUnitUnqNo').val(item.brandUnitUnqNo);
|
|
102
|
+ $li.find('.fnItemNm').text(item.itemNm);
|
|
103
|
+ $li.find('.fnUnitAmt').text(itp_fn_set_comma(item.unitAmt));
|
|
104
|
+ }
|
|
105
|
+ },
|
|
106
|
+ detachRow: function () {
|
|
107
|
+ $('#ITP_LIST_MPOMNG01010_DETAIL_ROWS li').each(function(index, elem) {
|
|
108
|
+ var isChecked = $(this).find('input[type="checkbox"]').is(':checked');
|
|
109
|
+ console.log(index + " ===> " + isChecked);
|
|
110
|
+ });
|
91
|
111
|
}
|
92
|
112
|
}
|
93
|
113
|
};
|
94
|
114
|
|
95
|
115
|
let mobPopObj = {
|
96
|
|
- addRow: {
|
97
|
|
- rows: [],
|
98
|
|
- init: function(rows) {
|
99
|
|
- this.rows = rows.gridRows;
|
100
|
|
- mobPopObj.show('ITP_POP_MPOMNG01010_ITEM_NM');
|
101
|
|
- this.view();
|
102
|
|
- },
|
103
|
|
- view: function() {
|
104
|
|
- $.each(this.rows, function (i, item) {
|
105
|
|
- $('#ITP_LIST_MPOMNG01010_POP_ITEM_AREA .panel-group').append($('#ITP_LIST_MPOMNG01010_POP_ITEM_ROWCOPY').html());
|
106
|
|
- var $li = $('#ITP_LIST_MPOMNG01010_POP_ITEM_AREA .panel-group > .row_2:last');
|
107
|
|
- $li.data('brandUnitUnqNo', item.brandUnitUnqNo);
|
108
|
|
- $li.data('podrPssblDvsn', item.podrPssblDvsn);
|
109
|
|
- $li.data('spplyId', item.spplyId);
|
110
|
|
- $li.data('stddQty', item.stddQty);
|
111
|
|
- $li.data('storeUnitUnqNo', item.storeUnitUnqNo);
|
112
|
|
- $li.data('unit', item.unit);
|
113
|
|
- $li.data('unitAmt', item.unitAmt);
|
114
|
|
- $li.data('unitGubun', item.unitGubun);
|
115
|
|
- $li.find('#ITP_FORM_MPOMNG01010_POP_ITEM_CHECKBOX').val(item.itemId);
|
116
|
|
- $li.find('.fnItemNm').text(item.itemNm);
|
117
|
|
- $li.find('.fnItemNm').text(item.unitAmt);
|
118
|
|
- });
|
|
116
|
+ popItem: {
|
|
117
|
+ parentFn: null,
|
|
118
|
+ rows: null,
|
|
119
|
+ init: function(fn) {
|
|
120
|
+ console.log(fn);
|
|
121
|
+ this.parentFn = fn;
|
|
122
|
+ this.search();
|
119
|
123
|
},
|
120
|
124
|
search: function() {
|
121
|
|
-
|
|
125
|
+ $('#ITP_LIST_MPOMNG01010_POP_ITEM_AREA .panel-group').empty();
|
|
126
|
+ var callbackFn = function(result) {
|
|
127
|
+ mobPopObj.popItem.rows = result.gridRows;
|
|
128
|
+ $.each(mobPopObj.popItem.rows, function (i, item) {
|
|
129
|
+ $('#ITP_LIST_MPOMNG01010_POP_ITEM_AREA .panel-group').append($('#ITP_LIST_MPOMNG01010_POP_ITEM_ROWCOPY').html());
|
|
130
|
+ var $li = $('#ITP_LIST_MPOMNG01010_POP_ITEM_AREA .panel-group > .row_2:last');
|
|
131
|
+ $li.data('brandUnitUnqNo', item.brandUnitUnqNo);
|
|
132
|
+ $li.data('podrPssblDvsn', item.podrPssblDvsn);
|
|
133
|
+ $li.data('spplyId', item.spplyId);
|
|
134
|
+ $li.data('stddQty', item.stddQty);
|
|
135
|
+ $li.data('storeUnitUnqNo', item.storeUnitUnqNo);
|
|
136
|
+ $li.data('unit', item.unit);
|
|
137
|
+ $li.data('unitAmt', item.unitAmt);
|
|
138
|
+ $li.data('unitGubun', item.unitGubun);
|
|
139
|
+ $li.find('#ITP_FORM_MPOMNG01010_POP_ITEM_CHECKBOX').val(item.itemId);
|
|
140
|
+ $li.find('.fnItemNm').text(item.itemNm);
|
|
141
|
+ $li.find('.fnUnitAmt').text(itp_fn_set_comma(item.unitAmt));
|
|
142
|
+ });
|
|
143
|
+ mobPopObj.popItem.addRow.init();
|
|
144
|
+ };
|
|
145
|
+ let param = $('#ITP_FORM_MPOMNG01010_POPUP_ITEM').serializeObject();
|
|
146
|
+ fn_ajax_call(API_POP_ITEM_LIST, JSON.stringify(param), callbackFn, 'POST');
|
|
147
|
+ },
|
|
148
|
+ addRow: {
|
|
149
|
+ init: function() {
|
|
150
|
+ this.button.init();
|
|
151
|
+ },
|
|
152
|
+ button: {
|
|
153
|
+ init: function() {
|
|
154
|
+ console.log('button');
|
|
155
|
+ var _this = this;
|
|
156
|
+ $('button[id^="ITP_BTN_MPOMNG01010_POP_ITEM_"]').off('click').on('click', function() {
|
|
157
|
+ var id = $(this).attr('id');
|
|
158
|
+ switch (id) {
|
|
159
|
+ case 'ITP_BTN_MPOMNG01010_POP_ITEM_PLUS': _this.actPlus($(this)); break;
|
|
160
|
+ case 'ITP_BTN_MPOMNG01010_POP_ITEM_MINUS': _this.actMinus($(this)); break;
|
|
161
|
+ case 'ITP_BTN_MPOMNG01010_POP_ITEM_ADD': _this.actItemAdd($(this)); break;
|
|
162
|
+ case 'ITP_BTN_MPOMNG01010_POP_ITEM_SEARCH': mobPopObj.popItem.search(); break;
|
|
163
|
+ case 'ITP_BTN_MPOMNG01010_POP_ITEM_CLOSE': mobPopObj.hide(id); break;
|
|
164
|
+ }
|
|
165
|
+ return false;
|
|
166
|
+ });
|
|
167
|
+ },
|
|
168
|
+ actPlus: function(elem) {
|
|
169
|
+ var $div = $(elem).closest('div').find('.num');
|
|
170
|
+ var num = Number($div.text());
|
|
171
|
+ $($div).text((num + 1).toString());
|
|
172
|
+ },
|
|
173
|
+ actMinus: function(elem) {
|
|
174
|
+ var $div = $(elem).closest('div').find('.num');
|
|
175
|
+ var num = Number($div.text());
|
|
176
|
+ if(num <= 1) {
|
|
177
|
+ alert('주문수량을 확인하세요.');
|
|
178
|
+ } else {
|
|
179
|
+ $($div).text((num - 1).toString());
|
|
180
|
+ }
|
|
181
|
+ },
|
|
182
|
+ actItemAdd: function(elem) {
|
|
183
|
+ var index = $(elem).closest('li').index();
|
|
184
|
+ contPopObj.list.attachRow(mobPopObj.popItem.rows[index]);
|
|
185
|
+ }
|
|
186
|
+ }
|
122
|
187
|
},
|
123
|
|
- choice: function() {
|
|
188
|
+ delRow: function() {
|
124
|
189
|
|
125
|
190
|
}
|
126
|
191
|
},
|
127
|
|
- show: function(id, args, fn) {
|
128
|
|
- this.button();
|
129
|
|
- $('#' + id).show();
|
|
192
|
+ popWhsNm: {
|
|
193
|
+
|
|
194
|
+ },
|
|
195
|
+ popReqConfirm: {
|
|
196
|
+
|
130
|
197
|
},
|
131
|
|
- button: function() {
|
132
|
|
- var _this = this;
|
133
|
|
- $('button[id^="ITP_BTN_MPOMNG01010_POP"]').off('click').on('click', function() {
|
|
198
|
+ show: function(id) {
|
|
199
|
+ console.log('show ===> ' + id);
|
|
200
|
+ $('#' + id).show();
|
|
201
|
+ $('button[id$="CLOSE"]').off('click').on('click', function() {
|
134
|
202
|
var id = $(this).attr('id');
|
|
203
|
+ console.log('CLOSE ===> ' + id);
|
135
|
204
|
if($(this).hasClass('btn-pop-close')) {
|
136
|
|
- _this.hide(id);
|
137
|
|
- return;
|
|
205
|
+ $('#' + id).closest('.mobile-pop-close').hide();
|
138
|
206
|
}
|
139
|
|
- switch (id) {
|
140
|
|
- case 'ITP_BTN_MPOMNG01010_POP_CONFIRM': break;
|
141
|
|
- case 'ITP_BTN_MPOMNG01010_POP_SEARCH':
|
142
|
|
- break;
|
143
|
|
- }
|
144
|
|
- return false;
|
145
|
207
|
});
|
|
208
|
+ if(id.indexOf('ITEM_AREA') > -1) {
|
|
209
|
+ this.popItem.init();
|
|
210
|
+ }
|
146
|
211
|
},
|
147
|
212
|
hide: function(id) {
|
148
|
213
|
$('#' + id).closest('.mobile-pop-close').hide();
|