|
@@ -0,0 +1,178 @@
|
|
1
|
+require(['config'], function() {
|
|
2
|
+ require([
|
|
3
|
+ 'jquery'
|
|
4
|
+ ], function($) {
|
|
5
|
+
|
|
6
|
+ });
|
|
7
|
+});
|
|
8
|
+
|
|
9
|
+//let API_POP_GRID_LIST = '/api/item/pop-new-grid-list';
|
|
10
|
+let API_POP_GRID_LIST = '/api/item/pop-item-list';
|
|
11
|
+
|
|
12
|
+function itp_fn_BIZPOP_NEW_ITEM(parentPopFn, args, returnType) {
|
|
13
|
+ let itp_BIZPOP_NEW_ITEM_param = {};
|
|
14
|
+ let itp_BIZPOP_NEW_ITEM_search = false;
|
|
15
|
+
|
|
16
|
+ const THIS_FORM_ID = '#ITP_FORM_BIZPOP_NEW_ITEM';
|
|
17
|
+ const THIS_GIRD_ID = '#ITP_BIZPOP_NEW_ITEM_jqGrid';
|
|
18
|
+ const THIS_GIRD_PAGER = '#ITP_BIZPOP_NEW_ITEM_jqGridPager';
|
|
19
|
+
|
|
20
|
+ $('#ITP_FORM_BIZPOP_NEW_ITEM_BRAND_ID').val(fn_make_user_info.get('brandId'));
|
|
21
|
+ $('#ITP_FORM_BIZPOP_NEW_ITEM_STORE_ID').val(fn_make_user_info.get('storeId'));
|
|
22
|
+
|
|
23
|
+ // 공통코드 표시
|
|
24
|
+ $('select').each(function() {
|
|
25
|
+ if($('#ITP_FORM_BIZPOP_STORE_PODR_PSSBL_DVSN').data('select-code')) {
|
|
26
|
+ fn_make_select(CODE_LIST, $('#ITP_FORM_BIZPOP_STORE_PODR_PSSBL_DVSN').data('select-code'), $('#ITP_FORM_BIZPOP_STORE_PODR_PSSBL_DVSN').attr('id'));
|
|
27
|
+ }
|
|
28
|
+ });
|
|
29
|
+
|
|
30
|
+ $('#ITP_BIZPOP_NEW_ITEM').one('shown.bs.modal', function(e) {
|
|
31
|
+ itp_fn_jqgrid_resize(THIS_GIRD_ID, '#ITP_BIZPOP_NEW_ITEM_jqGrid_list', '');
|
|
32
|
+ itp_fn_fire_window_resize();
|
|
33
|
+ }).one('hidden.bs.modal', function(e) {
|
|
34
|
+ $('#ITP_BIZPOP_NEW_ITEM').remove();
|
|
35
|
+ }).modal('show');
|
|
36
|
+
|
|
37
|
+ $('#ITP_BIZPOP_NEW_ITEM_BTN_SEARCH').on('click', function() {
|
|
38
|
+ itp_BIZPOP_NEW_ITEM_search = true;
|
|
39
|
+ let param = $(THIS_FORM_ID).serializeObject();
|
|
40
|
+ param.gridSize = 10;
|
|
41
|
+ param.gridPage = $.jgrid.defaults.page;
|
|
42
|
+ $(THIS_GIRD_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
|
|
43
|
+ });
|
|
44
|
+
|
|
45
|
+ $('#ITP_BIZPOP_NEW_ITEM_BTN_SELECT').on('click', function() {
|
|
46
|
+
|
|
47
|
+ const rowKey = $(THIS_GIRD_ID).getGridParam('selrow');
|
|
48
|
+ if (!rowKey) {
|
|
49
|
+ return;
|
|
50
|
+ }
|
|
51
|
+
|
|
52
|
+ var list = [];
|
|
53
|
+ var selectedIds = $(THIS_GIRD_ID).getGridParam('selarrrow');
|
|
54
|
+
|
|
55
|
+ if(selectedIds.length > 1) { // 1개만 선택
|
|
56
|
+ itp_fn_modal_alert('하나의 품목만 선택해주세요.');
|
|
57
|
+ return;
|
|
58
|
+ }
|
|
59
|
+
|
|
60
|
+ const selRow = $(THIS_GIRD_ID).getRowData(rowKey);
|
|
61
|
+ parentPopFn(selRow);
|
|
62
|
+ $('#ITP_BIZPOP_NEW_ITEM').modal('hide'); // 팝업닫기
|
|
63
|
+ /*
|
|
64
|
+ for (var i=selectedIds.length-1; i>=0; i--) {
|
|
65
|
+ list.push($(THIS_GIRD_ID).jqGrid('getRowData', selectedIds[i]));
|
|
66
|
+ }
|
|
67
|
+ parentPopFn(list);
|
|
68
|
+ $('#ITP_BIZPOP_NEW_ITEM').modal('hide'); // 팝업닫기
|
|
69
|
+ */
|
|
70
|
+ });
|
|
71
|
+
|
|
72
|
+ $('#ITP_BIZPOP_NEW_ITEM_jqGridEmpty').on('click', function() {
|
|
73
|
+ itp_fn_BIZPOP_NEW_ITEM_empty.back();
|
|
74
|
+ itp_BIZPOP_NEW_ITEM_param.gridSize = 10;
|
|
75
|
+ $(THIS_GIRD_ID).setGridParam({'postData': JSON.stringify(itp_BIZPOP_NEW_ITEM_param)}).trigger('reloadGrid');
|
|
76
|
+ });
|
|
77
|
+
|
|
78
|
+ var itp_fn_BIZPOP_NEW_ITEM_empty = {
|
|
79
|
+ push: function() {
|
|
80
|
+ let param = $(THIS_FORM_ID).serializeObject();
|
|
81
|
+ itp_BIZPOP_NEW_ITEM_param = param;
|
|
82
|
+ },
|
|
83
|
+ back: function() {
|
|
84
|
+ $(THIS_FORM_ID + '_BRAND_ID').val(itp_BIZPOP_NEW_ITEM_param.sbrandId);
|
|
85
|
+ $(THIS_FORM_ID + '_STROE_ID').val(itp_BIZPOP_NEW_ITEM_param.sstoreId);
|
|
86
|
+ }
|
|
87
|
+ };
|
|
88
|
+
|
|
89
|
+ itp_fn_BIZPOP_NEW_ITEM_empty.push();
|
|
90
|
+ let param = $('#ITP_FORM_BIZPOP_NEW_ITEM').serializeObject();
|
|
91
|
+ param.gridSize = 10;
|
|
92
|
+
|
|
93
|
+ $(THIS_GIRD_ID).jqGrid({
|
|
94
|
+ colModel: [
|
|
95
|
+ {
|
|
96
|
+ index: 'ITEM_ID', name: 'itemId',
|
|
97
|
+ label: '품목ID', //
|
|
98
|
+ width: '10', fixed: false, align: 'center',
|
|
99
|
+ sortable: false, hidden: false
|
|
100
|
+ },
|
|
101
|
+ {
|
|
102
|
+ index: 'ITEM_NM', name: 'itemNm',
|
|
103
|
+ label: '품목명', //
|
|
104
|
+ width: '12', fixed: false, align: 'left',
|
|
105
|
+ sortable: false, hidden: false
|
|
106
|
+ },
|
|
107
|
+ {
|
|
108
|
+ index: 'UNIT', name: 'unit',
|
|
109
|
+ label: '단위', //
|
|
110
|
+ width: '6', fixed: false, align: 'center',
|
|
111
|
+ sortable: false, hidden: false
|
|
112
|
+ },
|
|
113
|
+ {
|
|
114
|
+ index: 'UNIT_AMT', name: 'unitAmt',
|
|
115
|
+ label: '단가', //
|
|
116
|
+ width: '6', fixed: false, align: 'right',
|
|
117
|
+ sortable: false, hidden: false,
|
|
118
|
+ formatter: 'integer', formatoptions: {thousandsSeparator: ','}
|
|
119
|
+ },
|
|
120
|
+ {
|
|
121
|
+ index: 'PODR_PSSBL_DVSN_NM', name: 'podrPssblDvsnNm',
|
|
122
|
+ label: '발주가능여부명', //
|
|
123
|
+ width: '6', fixed: false, align: 'center',
|
|
124
|
+ sortable: false, hidden: false
|
|
125
|
+ },
|
|
126
|
+ {
|
|
127
|
+ index: 'PODR_PSSBL_DVSN', name: 'podrPssblDvsn',
|
|
128
|
+ label: '발주가능여부', //
|
|
129
|
+ width: '6', fixed: false, align: 'center',
|
|
130
|
+ sortable: false, hidden: true
|
|
131
|
+ },
|
|
132
|
+ {
|
|
133
|
+ index: 'BRAND_UNIT_UNQ_NO', name: 'brandUnitUnqNo',
|
|
134
|
+ label: '브랜드단가고유번호', //
|
|
135
|
+ width: '10', fixed: false, align: 'center',
|
|
136
|
+ sortable: false, hidden: true
|
|
137
|
+ },
|
|
138
|
+ {
|
|
139
|
+ index: 'UNIT_GUBUN', name: 'unitGubun',
|
|
140
|
+ label: '단가구분', //
|
|
141
|
+ width: '10', fixed: false, align: 'center',
|
|
142
|
+ sortable: false, hidden: true
|
|
143
|
+ },
|
|
144
|
+ {
|
|
145
|
+ index: 'STORE_UNIT_UNQ_NO', name: 'storeUnitUnqNo',
|
|
146
|
+ label: '매장단가고유번호', //
|
|
147
|
+ width: '10', fixed: false, align: 'center',
|
|
148
|
+ sortable: false, hidden: true
|
|
149
|
+ },
|
|
150
|
+ {
|
|
151
|
+ index: 'WHS_PASS_QTY', name: 'whsPassQty',
|
|
152
|
+ label: '출고가능수량', //
|
|
153
|
+ width: '10', fixed: false, align: 'center',
|
|
154
|
+ sortable: false, hidden: true,
|
|
155
|
+ formatter: 'integer', formatoptions: {thousandsSeparator: ','}
|
|
156
|
+ }
|
|
157
|
+ ],
|
|
158
|
+ loadBeforeSend: function(jqXHR) {
|
|
159
|
+ jqXHR.setRequestHeader('X-AUTH-TOKEN', CONN_KEY);
|
|
160
|
+ },
|
|
161
|
+ postData: JSON.stringify(param),
|
|
162
|
+ url: DOMAIN + API_POP_GRID_LIST,
|
|
163
|
+ pager: THIS_GIRD_PAGER,
|
|
164
|
+ multiselect: true,
|
|
165
|
+ multiboxonly: true,
|
|
166
|
+ rownumbers: false,
|
|
167
|
+ loadComplete: function(data) {
|
|
168
|
+ itp_fn_grid_load_complete(data, THIS_GIRD_ID, true, undefined, 'BIZPOP_NEW_ITEM', itp_BIZPOP_NEW_ITEM_search, itp_fn_BIZPOP_NEW_ITEM_empty, true, data.gridRecords, false);
|
|
169
|
+ $(THIS_GIRD_ID).jqGrid('hideCol', 'cb');
|
|
170
|
+ },
|
|
171
|
+ loadError: function(jqXHR, textStatus, errorThrown) {
|
|
172
|
+ itp_fn_grid_load_error(jqXHR, textStatus, errorThrown);
|
|
173
|
+ },
|
|
174
|
+ onPaging: function(action) {
|
|
175
|
+ itp_fn_grid_paging(THIS_GIRD_ID, action, param);
|
|
176
|
+ }
|
|
177
|
+ }).navGrid(THIS_GIRD_PAGER, ITP_GRID_NAV_DEFAULTS.navGrid);
|
|
178
|
+};
|