|
@@ -6,19 +6,144 @@ require(['config'], function() {
|
6
|
6
|
});
|
7
|
7
|
});
|
8
|
8
|
|
9
|
|
-// #ITP_FORM_BIZPOP_WISH_LIST_ITEM_LIST 위시리스트 마스터 선택
|
|
9
|
+let API_POP_WISH_LIST = '/api/item/select-pop-wishlist-item';
|
|
10
|
+let API_WISH_LIST = '/api/pomng/select-wishlist';
|
|
11
|
+
|
10
|
12
|
|
11
|
13
|
function itp_fn_BIZPOP_WISH_LIST_ITEM(parentPopFn, args, returnType) {
|
|
14
|
+ console.log(args);
|
|
15
|
+ let itp_BIZPOP_WISH_LIST_ITEM_param = {};
|
|
16
|
+ let itp_BIZPOP_WISH_LIST_ITEM_search = false;
|
|
17
|
+ let firstWishId;
|
|
18
|
+
|
|
19
|
+ const THIS_FORM_ID = '#ITP_FORM_BIZPOP_WISH_LIST_ITEM';
|
12
|
20
|
const THIS_GIRD_ID = '#ITP_BIZPOP_WISH_LIST_ITEM_jqGrid';
|
13
|
21
|
const THIS_GIRD_PAGER = '#ITP_BIZPOP_WISH_LIST_ITEM_jqGridPager';
|
14
|
|
- // 그리드 조회
|
15
|
|
- const grid=$(THIS_GIRD_ID);
|
16
|
|
- grid.jqGrid({
|
17
|
|
- colModel: [
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+ $('#ITP_FORM_BIZPOP_WISH_LIST_ITEM_BRAND_ID').val(fn_make_user_info.get('brandId'));
|
|
25
|
+ $('#ITP_FORM_BIZPOP_WISH_LIST_ITEM_STORE_ID').val(fn_make_user_info.get('storeId'));
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+ $('#ITP_BIZPOP_WISH_LIST_ITEM').one('shown.bs.modal', function(e) {
|
|
29
|
+ itp_fn_jqgrid_resize(THIS_GIRD_ID, '#ITP_BIZPOP_WISH_LIST_ITEM_jqGrid_list', '');
|
|
30
|
+ itp_fn_fire_window_resize();
|
|
31
|
+ }).one('hidden.bs.modal', function(e) {
|
|
32
|
+ $('#ITP_BIZPOP_WISH_LIST_ITEM').remove();
|
|
33
|
+ }).modal('show');
|
|
34
|
+
|
|
35
|
+ $('#ITP_BIZPOP_SAFE_STCK_ITEM_BTN_SEARCH').on('click', function() {
|
|
36
|
+ itp_BIZPOP_WISH_LIST_ITEM_search = true;
|
|
37
|
+ let param = $(THIS_FORM_ID).serializeObject();
|
|
38
|
+ //param.gridSize = 10;
|
|
39
|
+ //param.gridPage = $.jgrid.defaults.page;
|
|
40
|
+ //console.log(param);
|
|
41
|
+ $(THIS_GIRD_ID).setGridParam({ 'postData': JSON.stringify(param) }).trigger('reloadGrid');
|
|
42
|
+ });
|
|
43
|
+
|
|
44
|
+ $('#ITP_BIZPOP_WISH_LIST_ITEM_BTN_SELECT').on('click', function() {
|
|
45
|
+
|
|
46
|
+ const rowKey = $(THIS_GIRD_ID).getGridParam('selrow');
|
|
47
|
+ if (!rowKey) {
|
|
48
|
+ return;
|
|
49
|
+ }
|
|
50
|
+
|
|
51
|
+ var list = [];
|
|
52
|
+ var selectedIds = $(THIS_GIRD_ID).getGridParam('selarrrow');
|
|
53
|
+
|
|
54
|
+ //if (selectedIds.length > 1) { // 1개만 선택
|
|
55
|
+ // itp_fn_modal_alert('1명을 선택해주세요.');
|
|
56
|
+ // return;
|
|
57
|
+ //}
|
|
58
|
+
|
|
59
|
+ for (var i=selectedIds.length-1; i>=0; i--) {
|
|
60
|
+ list.push($(THIS_GIRD_ID).jqGrid('getRowData', selectedIds[i]));
|
|
61
|
+ }
|
|
62
|
+
|
|
63
|
+ parentPopFn(list);
|
|
64
|
+ $('#ITP_BIZPOP_WISH_LIST_ITEM').modal('hide'); // 팝업닫기
|
|
65
|
+ });
|
|
66
|
+
|
|
67
|
+ $('#ITP_BIZPOP_WISH_LIST_ITEM_jqGridEmpty').on('click', function() {
|
|
68
|
+ itp_fn_BIZPOP_WISH_LIST_ITEM_empty.back();
|
|
69
|
+ //itp_BIZPOP_WISH_LIST_ITEM_param.gridSize = 10;
|
|
70
|
+ $(THIS_GIRD_ID).setGridParam({ 'postData': JSON.stringify(itp_BIZPOP_WISH_LIST_ITEM_param) }).trigger('reloadGrid');
|
|
71
|
+ });
|
|
72
|
+
|
|
73
|
+ var itp_fn_BIZPOP_WISH_LIST_ITEM_empty = {
|
|
74
|
+ push: function() {
|
|
75
|
+ let param = $(THIS_FORM_ID).serializeObject();
|
|
76
|
+ itp_BIZPOP_WISH_LIST_ITEM_param = param;
|
|
77
|
+ },
|
|
78
|
+ back: function() {
|
|
79
|
+ $(THIS_FORM_ID + '_BRAND_ID').val(itp_BIZPOP_WISH_LIST_ITEM_param.brandId);
|
|
80
|
+ $(THIS_FORM_ID + '_STROE_ID').val(itp_BIZPOP_WISH_LIST_ITEM_param.storeId);
|
|
81
|
+ }
|
|
82
|
+ };
|
|
83
|
+
|
|
84
|
+ let fnWishList = function(fnCall) {
|
|
85
|
+
|
|
86
|
+ const brandIdVal = fn_make_user_info.get('brandId');
|
|
87
|
+ const storeIdVal = fn_make_user_info.get('storeId');
|
|
88
|
+
|
|
89
|
+ const param = { brandId: brandIdVal, storeId: storeIdVal };
|
|
90
|
+
|
|
91
|
+ fn_ajax_call(API_WISH_LIST, param, function(result) {
|
|
92
|
+
|
|
93
|
+ console.log(JSON.stringify(result));
|
|
94
|
+
|
|
95
|
+ firstWishId = result.selectRows[0].wishListMgntNo;
|
|
96
|
+ fn_make_select_wish(result.selectRows, 'ITP_FORM_BIZPOP_WISH_LIST_ITEM_LIST');
|
|
97
|
+
|
|
98
|
+ if (fnCall !== undefined || typeof fnCall !== 'undefined') fnCall();
|
|
99
|
+ }, 'GET');
|
|
100
|
+ }
|
|
101
|
+ fnWishList();
|
|
102
|
+
|
|
103
|
+ itp_fn_BIZPOP_WISH_LIST_ITEM_empty.push();
|
|
104
|
+
|
|
105
|
+ const brandIdVal = fn_make_user_info.get('brandId');
|
|
106
|
+ const storeIdVal = fn_make_user_info.get('storeId');
|
|
107
|
+
|
|
108
|
+ let param = { brandId: fn_make_user_info.get('brandId'), storeId: fn_make_user_info.get('storeId'), wishListMgntNo: firstWishId };
|
|
109
|
+
|
|
110
|
+ $(THIS_GIRD_ID).jqGrid({
|
|
111
|
+ colModel: [
|
|
112
|
+ {
|
|
113
|
+ index: 'ITEM_ID', name: 'itemId',
|
|
114
|
+ label: '품목ID', //
|
|
115
|
+ width: '13', fixed: false, align: 'center',
|
|
116
|
+ sortable: false, hidden: false
|
|
117
|
+ },
|
|
118
|
+ {
|
|
119
|
+ index: 'ITEM_NM', name: 'itemNm',
|
|
120
|
+ label: '품목명', //
|
|
121
|
+ width: '8', fixed: false, align: 'left',
|
|
122
|
+ sortable: false, hidden: false, classes: 'ui-ellipsis'
|
|
123
|
+ },
|
18
|
124
|
{
|
19
|
|
- index: 'BRAND_ID', name: 'brandId',
|
20
|
|
- label: ITP_MSG_LOCALE.label.brandId,
|
21
|
|
- width: 0, fixed: false, align: 'center',
|
|
125
|
+ index: 'UNIT', name: 'unit',
|
|
126
|
+ label: '단위', //
|
|
127
|
+ width: '4', fixed: false, align: 'center',
|
|
128
|
+ sortable: false, hidden: false
|
|
129
|
+ },
|
|
130
|
+ {
|
|
131
|
+ index: 'UNIT_AMT', name: 'unitAmt',
|
|
132
|
+ label: '단가', //
|
|
133
|
+ width: '10', fixed: false, align: 'right',
|
|
134
|
+ sortable: false, hidden: false,
|
|
135
|
+ formatter: 'integer', formatoptions: { thousandsSeparator: ',' }
|
|
136
|
+ },
|
|
137
|
+ {
|
|
138
|
+ index: 'PODR_PSSBL_DVSN_NM', name: 'podrPssblDvsnNm',
|
|
139
|
+ label: '발주여부', //
|
|
140
|
+ width: '6', fixed: false, align: 'center',
|
|
141
|
+ sortable: false, hidden: false
|
|
142
|
+ },
|
|
143
|
+ {
|
|
144
|
+ index: 'PODR_PSSBL_DVSN', name: 'podrPssblDvsn',
|
|
145
|
+ label: '발주가능여부', //
|
|
146
|
+ width: '6', fixed: false, align: 'center',
|
22
|
147
|
sortable: false, hidden: true
|
23
|
148
|
},
|
24
|
149
|
{
|
|
@@ -38,116 +163,26 @@ function itp_fn_BIZPOP_WISH_LIST_ITEM(parentPopFn, args, returnType) {
|
38
|
163
|
label: '매장단가고유번호', //
|
39
|
164
|
width: '10', fixed: false, align: 'center',
|
40
|
165
|
sortable: false, hidden: true
|
41
|
|
- },
|
42
|
|
- {
|
43
|
|
- index: 'ITEM_NO', name: 'itemId',
|
44
|
|
- label: '품목번호',
|
45
|
|
- width: 120, fixed: false, align: 'center',
|
46
|
|
- sortable: false, hidden: false
|
47
|
|
- },
|
48
|
|
- {
|
49
|
|
- index: 'ITEM_CLASS_NM', name: 'itemNm',
|
50
|
|
- label: '품목명',
|
51
|
|
- width: 200, fixed: false, align: 'left',
|
52
|
|
- sortable: false, hidden: false, classes: 'ui-ellipsis'
|
53
|
|
- },
|
54
|
|
- {
|
55
|
|
- index: 'UNIT', name: 'unit',
|
56
|
|
- label: '단위',
|
57
|
|
- width: 80, fixed: false, align: 'center'
|
58
|
|
- },
|
59
|
|
- {
|
60
|
|
- index: 'UNIT', name: 'unitAmt',
|
61
|
|
- label: '단가',
|
62
|
|
- width: 120, fixed: false, align: 'right',
|
63
|
|
- sortable: false, hidden: false,
|
64
|
|
- formatter: 'integer', formatoptions: {thousandsSeparator: ','}
|
65
|
166
|
}
|
66
|
167
|
],
|
|
168
|
+ loadBeforeSend: function(jqXHR) {
|
|
169
|
+ jqXHR.setRequestHeader('X-AUTH-TOKEN', CONN_KEY);
|
|
170
|
+ },
|
|
171
|
+ postData: JSON.stringify(param),
|
|
172
|
+ url: DOMAIN + API_POP_WISH_LIST,
|
|
173
|
+ pager: THIS_GIRD_PAGER,
|
67
|
174
|
multiselect: true,
|
68
|
|
- rownumbers: false,
|
69
|
|
- }).navGrid(THIS_GIRD_PAGER, ITP_GRID_NAV_DEFAULTS.navGrid);
|
70
|
|
-
|
71
|
|
-
|
72
|
|
- const search=function() {
|
73
|
|
- if(!wishListMgntNo) return itp_fn_modal_alert_ajax("조회할 위시리스트를 선택하세요");
|
74
|
|
- ajaxCall('/api/pomng/select-wishlist-item', {brandId, storeId, wishListMgntNo}, function(result) {
|
75
|
|
- grid.jqGrid('clearGridData');
|
76
|
|
- for(var cur of result.selectRows ) {
|
77
|
|
- grid.jqGrid('addRowData', cur.itemId, cur, 'last');
|
78
|
|
- }
|
79
|
|
- gridStatus(THIS_GIRD_ID, 'BIZPOP_WISH_LIST_ITEM', '위시리스트를 선택하세요');
|
80
|
|
- });
|
81
|
|
- };
|
82
|
|
-
|
83
|
|
- var wishListMgntArr=[], currentNode=null;
|
84
|
|
- var wishListMgntNo=null;
|
85
|
|
- const combo=$('#ITP_FORM_BIZPOP_WISH_LIST_ITEM_LIST');
|
86
|
|
- const brandId=fn_make_user_info.get('brandId'), storeId=fn_make_user_info.get('storeId');
|
87
|
|
- const wishListFind= function() {
|
88
|
|
- console.log("find ", wishListMgntArr, wishListMgntNo )
|
89
|
|
- for(var cur of wishListMgntArr) if(cur.wishListMgntNo==wishListMgntNo) return cur;
|
90
|
|
- return null;
|
91
|
|
- };
|
92
|
|
- const wishListMgntCall= function() {
|
93
|
|
- /* 위시리스트 추가/수정 API 처리 */
|
94
|
|
- ajaxCall('/api/pomng/select-wishlist', {brandId, storeId}, function(result) {
|
95
|
|
- combo.data('changeCheck', true);
|
96
|
|
- combo.children('option:not(:first)').remove();
|
97
|
|
- wishListMgntArr=result.selectRows;
|
98
|
|
- var def='';
|
99
|
|
- for(var cur of wishListMgntArr ) {
|
100
|
|
- if(!def) def=cur.wishListMgntNo;
|
101
|
|
- $('<option/>', { 'value': cur.wishListMgntNo, 'text': cur.wishListNm }).appendTo(combo);
|
102
|
|
- }
|
103
|
|
- combo.data('changeCheck', false);
|
104
|
|
- if(def) combo.val(def);
|
105
|
|
- combo.trigger('change');
|
106
|
|
-
|
107
|
|
- }, 'GET');
|
108
|
|
- };
|
109
|
|
- // 위시리스트 콤보 변경처리
|
110
|
|
- combo.on('change', function() {
|
111
|
|
- if(combo.data('changeCheck')) return;
|
112
|
|
- wishListMgntNo=combo.val();
|
113
|
|
- currentNode=wishListFind();
|
114
|
|
- if(wishListMgntNo) search();
|
115
|
|
- });
|
116
|
|
- // 위시리스트 콤보 조회
|
117
|
|
- wishListMgntCall();
|
118
|
|
- /*
|
119
|
|
- $('#ITP_FORM_BIZPOP_WISH_LIST_ITEM_BRAND_ID').val(fn_make_user_info.get('brandId'));
|
120
|
|
- $('#ITP_FORM_BIZPOP_WISH_LIST_ITEM_STORE_ID').val(fn_make_user_info.get('storeId'));
|
121
|
|
- $('#ITP_FORM_BIZPOP_WISH_LIST_ITEM_WHS_DVSN').val(args.whsDvsn);
|
122
|
|
- */
|
123
|
|
-
|
124
|
|
- $('#ITP_BIZPOP_WISH_LIST_ITEM').one('shown.bs.modal', function(e) {
|
125
|
|
- grid.setGridWidth(642, true);
|
126
|
|
- const cols =grid.getGridParam('colModel'), last=cols.length-1, col=cols[last];
|
127
|
|
- $(THIS_GIRD_ID+'_list table').find('td:eq('+last+')').each(function(){$(this).css('width',col.width-2);});
|
128
|
|
-
|
129
|
|
- }).one('hidden.bs.modal', function(e) {
|
130
|
|
- $('#ITP_BIZPOP_WISH_LIST_ITEM').remove();
|
131
|
|
- }).modal('show');
|
132
|
|
-
|
133
|
|
- $('#ITP_BIZPOP_WISH_LIST_ITEM_BTN_SEARCH').on('click', function() {
|
134
|
|
- search();
|
135
|
|
- });
|
136
|
|
-
|
137
|
|
- $('#ITP_BIZPOP_WISH_LIST_ITEM_BTN_SELECT').on('click', function() {
|
138
|
|
- const rowKey = grid.getGridParam('selrow');
|
139
|
|
- if (!rowKey) {
|
140
|
|
- return;
|
141
|
|
- }
|
142
|
|
- const selectedIds = grid.getGridParam('selarrrow'), result=[];
|
143
|
|
- if(Array.isArray(selectedIds) ) {
|
144
|
|
- for (var i=selectedIds.length-1; i>=0; i--) {
|
145
|
|
- const cur=grid.jqGrid('getRowData', selectedIds[i]);
|
146
|
|
- result.push(cur );
|
147
|
|
- }
|
148
|
|
- parentPopFn(result);
|
149
|
|
- $('#ITP_BIZPOP_WISH_LIST_ITEM').modal('hide'); // 팝업닫기
|
|
175
|
+ multiboxonly: true,
|
|
176
|
+ rownumbers: false,
|
|
177
|
+ loadComplete: function(data) {
|
|
178
|
+ console.log(JSON.stringify(data));
|
|
179
|
+ itp_fn_grid_load_complete(data, THIS_GIRD_ID, true, undefined, 'BIZPOP_WISH_LIST_ITEM', itp_BIZPOP_WISH_LIST_ITEM_search, itp_fn_BIZPOP_WISH_LIST_ITEM_empty, true, data.gridRecords, false);
|
|
180
|
+ },
|
|
181
|
+ loadError: function(jqXHR, textStatus, errorThrown) {
|
|
182
|
+ itp_fn_grid_load_error(jqXHR, textStatus, errorThrown);
|
|
183
|
+ },
|
|
184
|
+ onPaging: function(action) {
|
|
185
|
+ itp_fn_grid_paging(THIS_GIRD_ID, action, param);
|
150
|
186
|
}
|
151
|
|
- });
|
152
|
|
-
|
|
187
|
+ }).navGrid(THIS_GIRD_PAGER, ITP_GRID_NAV_DEFAULTS.navGrid);
|
153
|
188
|
};
|