Преглед на файлове

구매요청임시저장

dwkim преди 2 години
родител
ревизия
938a8645e8

+ 7 - 2
bin/src/main/webapp/app/pomng/POMNG01010.html

@@ -14,6 +14,11 @@
14 14
 						<div class="col-xs-12">
15 15
 							<form id="ITP_FORM_POMNG01010_DETAIL" class="form-horizontal">
16 16
 								<input type="hidden" id="ITP_FORM_POMNG01010_DETAIL_VIEW_CD" name="viewCd" value="C">
17
+								<input type="hidden" id="ITP_FORM_POMNG01010_DETAIL_BRAND_ID" name="brandId" value="">
18
+								<input type="hidden" id="ITP_FORM_POMNG01010_DETAIL_STORE_ID" name="storeId" value="">
19
+								<input type="hidden" id="ITP_FORM_POMNG01010_DETAIL_LOAN_DVSN" name="loanDvsn" value="">
20
+								<input type="hidden" id="ITP_FORM_POMNG01010_DETAIL_LOAN_MGNT_UNQ_NO" name="loanMgntUnqNo" value="">
21
+								<input type="hidden" id="ITP_FORM_POMNG01010_DETAIL_pchReqDvsn" name="pchReqDvsn" value="">
17 22
 					
18 23
 								<section class="itp_form_sec">
19 24
 									<h4 class="itp_form_tit">구매요청정보</h4>
@@ -81,8 +86,8 @@
81 86
 											<label class="col-xs-2 itp_lb">정산타입</label>
82 87
 												<div class="col-xs-4 itp_ip">
83 88
 													<div class="col-xs-12 itp_in">
84
-														<div class="input-group fnSttlType" style="padding:5px;"></div>
85
-													</div>
89
+														<div class="input-group fnLoanDvsnNm" style="padding:5px;"></div>
90
+													</div>  
86 91
 												</div>
87 92
 											<label class="col-xs-2 itp_lb">구매가능금액</label>
88 93
 											<div class="col-xs-4 itp_ip fnPchActAmt"></div>

+ 41 - 0
bin/src/main/webapp/app/popup/biz/BIZPOP_ITEM.html

@@ -0,0 +1,41 @@
1
+<div id="ITP_BIZPOP_ITEM" class="modal itp_modal">
2
+	<div class="modal-dialog">
3
+		<div class="modal-content">
4
+			<form id="ITP_FORM_BIZPOP_ITEM">
5
+				<input type="hidden" id="ITP_FORM_BIZPOP_ITEM_BRAND_ID" name="sbrandId" value="">
6
+				<input type="hidden" id="ITP_FORM_BIZPOP_ITEM_STORE_ID" name="sstoreId" value="">
7
+				<div class="modal-header">
8
+					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
9
+					<h5 class="modal-title">품목 검색</h5>
10
+				</div>
11
+				<div class="modal-body">
12
+					<div class="itp_form fix">
13
+						<div class="col-xs-12 itp_form_inline">
14
+							<div class="form-horizontal fix">
15
+								<div class="col-xs-4 itp_ip itp_pr">
16
+									<input type="text" name="sitemNm" id="ITP_FORM_BIZPOP_ITEM_NM" class="form-control itp_input" placeholder="품목코드,품목명">
17
+								</div>
18
+								<div class="col-xs-4 itp_ip itp_noMar">
19
+									<select id="ITP_FORM_BIZPOP_STORE_PODR_PSSBL_DVSN" data-select-code="PODR_PSSBL_DVSN" class="form-control itp_input" name="spodrPssblDvsn">
20
+									</select>
21
+								</div>
22
+								<div class="pull-right itp_cicon">
23
+									<button type="button" class="btn btn-success btn-sm" id="ITP_BIZPOP_ITEM_BTN_SEARCH" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i> 조회</button>
24
+									<button type="button" class="btn btn-primary btn-sm" id="ITP_BIZPOP_ITEM_BTN_SELECT"><i class="glyphicon glyphicon-ok"></i> 선택</button>
25
+								</div>
26
+							</div>
27
+						</div>
28
+					</div>
29
+					<div id="ITP_BIZPOP_ITEM_jqGrid_list" class="itp_tb_list" data-total-cnt="">
30
+						<div id="ITP_BIZPOP_ITEM_jqGridView" class="itp_views fix"></div>
31
+						<table id="ITP_BIZPOP_ITEM_jqGrid"></table>
32
+						<div id="ITP_BIZPOP_ITEM_jqGridPager"></div>
33
+						<div id="ITP_BIZPOP_ITEM_jqGridEmpty" class="itp_no_data"></div>
34
+					</div>
35
+				</div>
36
+			</form>
37
+		</div>
38
+	</div>
39
+
40
+	<div id="ITP_POPUP_JS"></div>
41
+</div>

+ 5 - 1
bin/src/main/webapp/js/app/locales/locale-ko.js

@@ -144,6 +144,7 @@ const ITP_MSG_LOCALE = (function() {
144 144
 			"itemNm": "품목명",
145 145
 			"itemTypeNm": "품목유형",
146 146
 			"itemClassNm": "품목분류",
147
+			"itemClassMgntNo": "품목분류관리번호",
147 148
 			"podrPssblDvsnNm": "발주여부",
148 149
 			"unit": "기본단위",
149 150
 			"pchItemYn": "구매품목여부",
@@ -166,7 +167,10 @@ const ITP_MSG_LOCALE = (function() {
166 167
 			"itemClassLevel3": "품목분류Level 3",
167 168
 			"itemClassLevel4": "품목분류Level 4",
168 169
 			"prnSeq": "출력순번",
169
-			"writeYn": "쓰기여부"
170
+			"writeYn": "쓰기여부",
171
+			"pchReqQty": "요청수량",
172
+			"pchReqAmt": "요청금액",
173
+			"unitGubun": "단가구분"
170 174
 		},
171 175
 		"table": {
172 176
 			"brandId": "브랜드ID",

+ 334 - 0
bin/src/main/webapp/js/app/pomng/ITP_POMNG01010.js

@@ -0,0 +1,334 @@
1
+require(['config'], function() {
2
+	require([
3
+	], function($) {
4
+		pageObj.init();
5
+	});
6
+});
7
+
8
+/********************************************************
9
+ --------------------------------------------------------
10
+ - Object 목록								            -
11
+ --------------------------------------------------------
12
+ * const gridColModel = {}	: 화면 Grid Object			*
13
+ * let pageObj = {}			: 화면공통 Object			*
14
+ * let listObj = {}			: 목록화면 Object			*
15
+ * let viewObj = {}			: 상세화면 Object			*
16
+ * let modifyObj = {}		: 수정화면 Object			*
17
+ * let createObj = {}		: 신규화면 Object			*
18
+ *******************************************************/
19
+
20
+/*화면 변수*/
21
+/*
22
+const POMNG01010_GRID_ID = '#ITP_POMNG01010_jqGrid';
23
+const POMNG01010_GRID_LIST = '#ITP_POMNG01010_jqGrid_list';
24
+const POMNG01010_GRID_PAGER = '#ITP_POMNG01010_jqGridPager';
25
+const POMNG01010_GRID_EMPTY = '#ITP_POMNG01010_jqGridEmpty';
26
+
27
+const POMNG01010_VIEW_GRID_ID = '#ITP_POMNG01010_VIEW_jqGrid';
28
+const POMNG01010_VIEW_GRID_LIST = '#ITP_POMNG01010_VIEW_jqGrid_list';
29
+const POMNG01010_VIEW_GRID_PAGER = '#ITP_POMNG01010_VIEW_jqGridPager';
30
+const POMNG01010_VIEW_GRID_EMPTY = '#ITP_POMNG01010_VIEW_jqGridEmpty';
31
+*/
32
+const POMNG01010_DETAIL_GRID_ID = '#ITP_POMNG01010_DETAIL_jqGrid';
33
+const POMNG01010_DETAIL_GRID_LIST = '#ITP_POMNG01010_DETAIL_jqGrid_list';
34
+const POMNG01010_DETAIL_GRID_PAGER = '#ITP_POMNG01010_DETAIL_jqGridPager';
35
+const POMNG01010_DETAIL_GRID_EMPTY = '#ITP_POMNG01010_DETAIL_jqGridEmpty';  // ==>dwkim html확인필요
36
+
37
+/*
38
+let ITP_FORM_POMNG01010_DETAIL_IS_DUPLICATE = false;
39
+let ITP_FORM_POMNG01010_DETAIL_IS_WRITING = false;
40
+*/
41
+
42
+/*API URL*/
43
+let API_DETAIL_INIT_INFO = '/api/pomng/init-pchReq'
44
+//let API_DETAIL_GRID_LIST = '/api/affl/detail-grid-list';
45
+//let API_DETAIL_INFO = '/api/affl/info-affl';
46
+//let COMPANY_INFO_COMPANY = '/api/affl/info-affl';
47
+let API_DETAIL_SAVE = '/api/pomng/save-pchReq';
48
+//let API_CHECK_DUPLICATE = '/api/affl/check-duplicate';
49
+//let API_INTI_USERPW = '/api/user/inti-userpw';
50
+
51
+/*화면 Grid ColModel   ==>선택박스 항목 추가 부분  */
52
+const gridColModel = {
53
+	detail: [
54
+		{
55
+			index: 'VIEW_CD', name: 'viewCd',
56
+			label: ITP_MSG_LOCALE.label.viewCd,
57
+			width: '10', fixed: false, align: 'center',
58
+			sortable: false, hidden: true
59
+		},
60
+		{
61
+			index: 'ITEM_ID', name: 'itemId',
62
+			label: ITP_MSG_LOCALE.label.itemId,
63
+			width: '20', fixed: false, align: 'center',
64
+			sortable: false, editable: false, edittype: 'text',
65
+			editrules: { required: true }
66
+		},
67
+		{
68
+			index: 'ITEM_NM', name: 'itemNm',
69
+			label: ITP_MSG_LOCALE.label.itemNm,
70
+			width: '30', fixed: false, align: 'center',
71
+			sortable: true, editable: false, edittype: 'text',
72
+			editrules: { required: true }
73
+		},
74
+		{
75
+			index: 'UNIT', name: 'unit',
76
+			label: ITP_MSG_LOCALE.label.unit,
77
+			width: '10', fixed: false, align: 'center',
78
+			sortable: false, editable: false, edittype: 'text'
79
+		},
80
+		{
81
+			index: 'UNIT_AMT', name: 'unitAmt',
82
+			label: ITP_MSG_LOCALE.label.unitAmt,
83
+			width: '10', fixed: false, align: 'center',
84
+			sortable: false, editable: false, edittype: 'text', hidden: false
85
+		},
86
+		{
87
+			index: 'PCH_REQ_QTY', name: 'pchReqQty',
88
+			label: ITP_MSG_LOCALE.label.pchReqQty, //단가
89
+			width: '10', fixed: false, align: 'center',
90
+			sortable: true, editable: true, edittype: 'text',
91
+			editrules: { number:true}
92
+		},
93
+		{
94
+			index: 'PCH_REQ_AMT', name: 'pchReqAmt',
95
+			label: ITP_MSG_LOCALE.label.pchReqAmt,
96
+			width: '10', fixed: false, align: 'center',
97
+			sortable: false, editable: false, edittype: 'text', hidden: false
98
+		},
99
+
100
+		{
101
+			index: 'BRAND_UNIT_UNQ_NO', name: 'brandUnitUnqNo',
102
+			label: ITP_MSG_LOCALE.label.brandUnitUnqNo,
103
+			width: '10', fixed: false, align: 'center',
104
+			sortable: false, editable: false, edittype: 'text', hidden: true
105
+		},
106
+		{
107
+			index: 'STORE_UNIT_UNQ_NO', name: 'storeUnitUnqNo',
108
+			label: ITP_MSG_LOCALE.label.storeUnitUnqNo,
109
+			width: '10', fixed: false, align: 'center',
110
+			sortable: false, editable: false, edittype: 'text', hidden: true
111
+		},
112
+		{
113
+			index: 'UNIT_GUBUN', name: 'unitGubun',
114
+			label: ITP_MSG_LOCALE.label.unitGubun,
115
+			width: '10', fixed: false, align: 'center',
116
+			sortable: false, editable: false, edittype: 'text', hidden: true
117
+		}
118
+	]
119
+};
120
+
121
+/*화면공통 Object*/
122
+let pageObj = {
123
+	init: function() {
124
+		this.ui.init();
125
+		this.event.init();
126
+	},
127
+	itp_POMNG01010_param: {},  // ==>dwkim 
128
+	itp_POMNG01010_search: false,  // ==>dwkim 
129
+	ui: {
130
+		init: function() {
131
+			this.view();
132
+			this.grid();
133
+			this.ready();
134
+		},
135
+		view: function() {
136
+			// 버튼 권한설정
137
+			fn_proc_btn_auth('POMNG01010');
138
+
139
+			// 공통코드 표시
140
+			$('select').each(function() {
141
+				if ($(this).data('select-code')) {
142
+					fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
143
+				}
144
+			});
145
+
146
+			// 조회일자 지정
147
+			var now = new Date();
148
+			$('#ITP_FORM_POMNG01010_DETAIL_DLV_REQ_DT').datepicker('dlvReqDt', new Date(now.setDate(now.getDate() + 5)));
149
+
150
+
151
+			// form alert message 주입
152
+			/*
153
+			$('input[data-alert-required="ONLYCHK"]').each(function() {
154
+				if($(this).data('alert-msg') === 'address') {
155
+					$(this).data('alert-msg', ITP_MSG_LOCALE.message.form.emptyAddr);
156
+				}
157
+			});
158
+			*/
159
+		},
160
+		grid: function() {
161
+			itp_fn_jqgrid_resize(POMNG01010_DETAIL_GRID_ID, POMNG01010_DETAIL_GRID_LIST, 'lg');
162
+			//listObj.empty.init();
163
+			itp_fn_fire_window_resize();
164
+		},
165
+		ready: function() {
166
+			createObj.init();
167
+		}
168
+	},
169
+	event: {
170
+		init: function() {
171
+			this.button();
172
+		},
173
+		button: function() {
174
+			// 버튼 클릭 이벤트
175
+			$('button').each(function() {
176
+				var id = $(this).attr('id');
177
+				$(this).on('click', function() {
178
+					switch (id) {
179
+						case 'ITP_BTN_POMNG01010_SRH': modifyObj.button.save(); break;	// 구매요청
180
+						case 'ITP_BTN_POMNG01010_NEWREG': modifyObj.button.newReg(); break;	// 임시저장
181
+						case 'ITP_BTN_POMNG01010_DETAIL_ADDROW': pageObj.grid.button.addRow(); break;	// 품목추가
182
+						case 'ITP_BTN_POMNG01010_DETAIL_DELROW': pageObj.grid.button.delRow(); break;	// 품목삭제
183
+					}
184
+				});
185
+			});
186
+
187
+			$('body').on('click', function(e) {
188
+				// afflUserObj.grid.resetGrid(e);
189
+			});
190
+
191
+		}
192
+	},
193
+	grid: {
194
+		init: function(mode, gridData) {
195
+			this.mode = mode;
196
+			this.gridId = POMNG01010_DETAIL_GRID_ID;
197
+			this.unload();  // ==>dwkim 
198
+			this.load(gridData);
199
+		},
200
+		mode: 'DETAIL',
201
+		gridId: '',
202
+		button: {
203
+			addRow: function() {
204
+				// 팝업
205
+				var popFn = function(rowDataPop) {
206
+					console.log(rowDataPop);
207
+					// 기존등록 데이터
208
+					var exists = '';
209
+					const rowData = $(POMNG01010_DETAIL_GRID_ID).getRowData();
210
+					$.each(rowData, function(key, value) {
211
+						exists = exists + value.itemId + ';';
212
+					});
213
+
214
+					$.each(rowDataPop, function(key, value) {
215
+						if (exists.indexOf(value.itemId) < 0 && value.podrPssblDvsn == 'PO01') {
216
+							value['viewCd'] = "C";
217
+							$(POMNG01010_DETAIL_GRID_ID).jqGrid('addRowData', value.itemId, value, 'last');
218
+						}
219
+					});
220
+					$(POMNG01010_DETAIL_GRID_EMPTY).hide();
221
+				};
222
+				//const key = {brandId:fn_make_user_info.get('brandId'), brandUnitUnqNo: selectVal, viewCd: 'R'};
223
+				fn_call_popup('biz', 'BIZPOP_ITEM', '#ITP_ASIDE', popFn, null, 'S');  // ==>dwkim 추후 작업 진행  파라메타 설명필요
224
+			},
225
+			delRow: function() {
226
+				itp_fn_grid_del_row(POMNG01010_DETAIL_GRID_ID);
227
+			}
228
+		},
229
+		load: function(gridData) {  // ==>dwkim  오픈시 데이타 가져오는 부분 넣으면 되는건지 여부 gird가 아님
230
+			var _this = this;
231
+			var option = {
232
+				gridId: this.gridId,
233
+				colModel: gridColModel.detail,
234
+				data: gridData,
235
+				multiselect: true,
236
+				loadComplete: function(data) {
237
+					_this.clearData();
238
+				}
239
+			};
240
+			itp_fn_grid_make_local(option);
241
+		},
242
+		clearData: function() {
243
+			console.log(this.gridId);
244
+			$(POMNG01010_DETAIL_GRID_ID).jqGrid('clearGridData', true);
245
+			$(POMNG01010_DETAIL_GRID_LIST).find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
246
+			$(POMNG01010_DETAIL_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
247
+			$(POMNG01010_DETAIL_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
248
+			$(POMNG01010_DETAIL_GRID_EMPTY).show();
249
+		},
250
+		unload: function() {
251
+			$.jgrid.gridUnload(this.gridId);
252
+		}
253
+	}
254
+};
255
+
256
+/*신규화면 Object*/
257
+let createObj = {
258
+	init: function() {
259
+		$('#ITP_FORM_POMNG01010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
260
+		$('#ITP_FORM_POMNG01010_DETAIL_STORE_ID').val(fn_make_user_info.get('storeId'));
261
+		//let param = 'brandId=' + LOGIN_USER_INFO.brandId + "&spplyId=" + LOGIN_USER_INFO.spplyId;
262
+		this.load();
263
+	},
264
+	button: {
265
+		save: function() {
266
+			const formId = '#ITP_FORM_POMNG01010_DETAIL';
267
+			itp_fn_form_clear_validate(null, formId);
268
+
269
+			// if (vali_cmpyCd && vali_cmpyStatCd && vali_cmpyTypeCd && vali_cmpyNm && vali_bossNm && vali_mainTel && vali_mainEmail) {
270
+			if (itp_fn_form_event.isValid(formId)) {
271
+
272
+				// if($('#ITP_FORM_POMNG01010_DETAIL_CMPY_ZIPNO').val() === '' || $('#ITP_FORM_POMNG01010_DETAIL_CMPY_ADRES').val() === '') {
273
+				// 	itp_fn_modal_alert('주소 검색을 통해 회사 주소를 입력하세요.');
274
+				// 	return;
275
+				// }
276
+
277
+				if (ITP_FORM_POMNG01010_DETAIL_IS_DUPLICATE) {
278
+					itp_fn_modal_duplicate('회사코드 중복체크를 해주세요.', formId + '_AFFL_SHOP_ID');
279
+				} else {
280
+					let gridInsertData = [];
281
+					let gridUpdateData = [];
282
+					let gridDeleteData = [];
283
+					const rowData = $(POMNG01010_DETAIL_GRID_ID).getRowData();
284
+					const keyValue = $(formId + '_AFFL_SHOP_ID').val();
285
+					$.each(rowData, function(key, value) {
286
+						if (value.viewCd !== 'R') {
287
+							value.afflShopId = keyValue;
288
+							if (value.viewCd === 'C') {
289
+								gridInsertData.push(value);
290
+							} else if (value.viewCd === 'U') {
291
+								gridUpdateData.push(value);
292
+							} else if (value.viewCd === 'D') {
293
+								gridDeleteData.push(value);
294
+							}
295
+						}
296
+					});
297
+
298
+					let param = $(formId).serializeObject();
299
+					param.gridInsertData = gridInsertData;
300
+					param.gridUpdateData = gridUpdateData;
301
+					param.gridDeleteData = gridDeleteData;
302
+					console.log(JSON.stringify(param));
303
+					var searhFn = function() {
304
+						ITP_FORM_POMNG01010_DETAIL_IS_WRITING = false;
305
+						viewObj.init();
306
+					};
307
+					fn_ajax_call(API_DETAIL_SAVE, JSON.stringify(param), searhFn, 'POST');
308
+				}
309
+			}
310
+		}
311
+	},
312
+	load: function() {
313
+		fn_ajax_call(API_DETAIL_INIT_INFO, '', this.callback, 'GET');
314
+	},
315
+	callback: function(result) {
316
+		console.log(result);
317
+
318
+		$('#ITP_FORM_POMNG01010_DETAIL #ITP_FORM_POMNG01010_DETAIL_VIEW_CD').val('C');
319
+
320
+		$('#ITP_FORM_POMNG01010_DETAIL #ITP_FORM_POMNG01010_DETAIL_BRAND_ID').val(result.brandId);
321
+		$('#ITP_FORM_POMNG01010_DETAIL #ITP_FORM_POMNG01010_DETAIL_STORE_ID').val(result.storeId);
322
+		$('#ITP_FORM_POMNG01010_DETAIL #ITP_FORM_POMNG01010_DETAIL_LOAN_DVSN').val(result.loanDvsn);
323
+		$('#ITP_FORM_POMNG01010_DETAIL #ITP_FORM_POMNG01010_DETAIL_LOAN_MGNT_UNQ_NO').val(result.loanMgntUnqNo);
324
+		$('#ITP_FORM_POMNG01010_DETAIL #ITP_FORM_POMNG01010_DETAIL_PCH_REQ_DVSN').val(result.pchReqDvsn);
325
+		$('#ITP_FORM_POMNG01010_DETAIL .fnBrandNm').text(result.brandNm);
326
+		$('#ITP_FORM_POMNG01010_DETAIL .fnPchReqDept').text(result.reqDept);
327
+		$('#ITP_FORM_POMNG01010_DETAIL .fnPchReqMgrNm').text(result.userNm);
328
+		$('#ITP_FORM_POMNG01010_DETAIL .fnPchReqAmt').text("0");
329
+		$('#ITP_FORM_POMNG01010_DETAIL .fnLoanDvsnNm').text(result.loanDvsnNm);
330
+		$('#ITP_FORM_POMNG01010_DETAIL .fnPchActAmt').text(result.ordUseAmt);
331
+
332
+		pageObj.grid.init();
333
+	}
334
+};

+ 171 - 0
bin/src/main/webapp/js/app/popup/biz/ITP_BIZPOP_ITEM.js

@@ -0,0 +1,171 @@
1
+require(['config'], function() {
2
+	require([
3
+		'jquery'
4
+	], function($) {
5
+
6
+	});
7
+});
8
+
9
+let API_POP_GRID_LIST = '/api/item/pop-grid-list';
10
+
11
+function itp_fn_BIZPOP_ITEM(parentPopFn, args, returnType) {
12
+	console.log(args);
13
+	let itp_BIZPOP_ITEM_param = {};
14
+	let itp_BIZPOP_ITEM_search = false;
15
+
16
+	const THIS_FORM_ID = '#ITP_FORM_BIZPOP_ITEM';
17
+	const THIS_GIRD_ID = '#ITP_BIZPOP_ITEM_jqGrid';
18
+	const THIS_GIRD_PAGER = '#ITP_BIZPOP_ITEM_jqGridPager';
19
+
20
+	$('#ITP_FORM_BIZPOP_ITEM_BRAND_ID').val(fn_make_user_info.get('brandId'));
21
+	$('#ITP_FORM_BIZPOP_ITEM_STORE_ID').val(fn_make_user_info.get('storeId'));
22
+
23
+	// 공통코드 표시
24
+	$('select').each(function() {
25
+		if($(this).data('select-code')) {
26
+			fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
27
+		}
28
+	});
29
+
30
+	$('#ITP_BIZPOP_ITEM').one('shown.bs.modal', function(e) {
31
+		itp_fn_jqgrid_resize(THIS_GIRD_ID, '#ITP_BIZPOP_ITEM_jqGrid_list', '');
32
+		itp_fn_fire_window_resize();
33
+	}).one('hidden.bs.modal', function(e) {
34
+		$('#ITP_BIZPOP_ITEM').remove();
35
+	}).modal('show');
36
+
37
+	$('#ITP_BIZPOP_ITEM_BTN_SEARCH').on('click', function() {
38
+		itp_BIZPOP_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_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('1명을 선택해주세요.');
57
+			// return;
58
+		}
59
+		
60
+	    for (var i=selectedIds.length-1; i>=0; i--) {
61
+			list.push($(THIS_GIRD_ID).jqGrid('getRowData', selectedIds[i]));	
62
+		}
63
+		parentPopFn(list);
64
+		$('#ITP_BIZPOP_ITEM').modal('hide'); // 팝업닫기
65
+	});
66
+
67
+	$('#ITP_BIZPOP_ITEM_jqGridEmpty').on('click', function() {
68
+		itp_fn_BIZPOP_ITEM_empty.back();
69
+		itp_BIZPOP_ITEM_param.gridSize = 10;
70
+		$(THIS_GIRD_ID).setGridParam({'postData': JSON.stringify(itp_BIZPOP_ITEM_param)}).trigger('reloadGrid');
71
+	});
72
+
73
+	var itp_fn_BIZPOP_ITEM_empty = {
74
+		push: function() {
75
+			let param = $(THIS_FORM_ID).serializeObject();
76
+			itp_BIZPOP_ITEM_param = param;
77
+		},
78
+		back: function() {
79
+			$(THIS_FORM_ID + '_BRAND_ID').val(itp_BIZPOP_ITEM_param.sbrandId);
80
+			$(THIS_FORM_ID + '_STROE_ID').val(itp_BIZPOP_ITEM_param.sstoreId);
81
+		}
82
+	};
83
+
84
+	itp_fn_BIZPOP_ITEM_empty.push();
85
+	let param = $('#ITP_FORM_BIZPOP_ITEM').serializeObject();
86
+	param.gridSize = 10;
87
+	console.log(JSON.stringify(param));
88
+
89
+	$(THIS_GIRD_ID).jqGrid({
90
+		colModel: [
91
+			{
92
+				index: 'ITEM_ID', name: 'itemId',
93
+				label: '품목ID', //
94
+				width: '10', fixed: false, align: 'center',
95
+				sortable: false, hidden: false
96
+			},
97
+			{
98
+				index: 'ITEM_NM', name: 'itemNm',
99
+				label: '품목명', //
100
+				width: '12', fixed: false, align: 'left',
101
+				sortable: false, hidden: false
102
+			},
103
+			{
104
+				index: 'UNIT', name: 'unit',
105
+				label: '단위', //
106
+				width: '6', fixed: false, align: 'center',
107
+				sortable: false, hidden: false
108
+			},
109
+			{
110
+				index: 'UNIT_AMT', name: 'unitAmt',
111
+				label: '단가', //
112
+				width: '6', fixed: false, align: 'right',
113
+				sortable: false, hidden: false
114
+			},
115
+			{
116
+				index: 'PODR_PSSBL_DVSN_NM', name: 'podrPssblDvsnNm',
117
+				label: '발주가능여부명', //
118
+				width: '6', fixed: false, align: 'center',
119
+				sortable: false, hidden: false
120
+			},
121
+			{
122
+				index: 'PODR_PSSBL_DVSN', name: 'podrPssblDvsn',
123
+				label: '발주가능여부', //
124
+				width: '6', fixed: false, align: 'center',
125
+				sortable: false, hidden: true
126
+			},
127
+			{
128
+				index: 'BRAND_UNIT_UNQ_NO', name: 'brandUnitUnqNo',
129
+				label: '브랜드단가고유번호', //
130
+				width: '10', fixed: false, align: 'center',
131
+				sortable: false, hidden: true
132
+			},
133
+			{
134
+				index: 'UNIT_GUBUN', name: 'unitGubun',
135
+				label: '단가구분', //
136
+				width: '10', fixed: false, align: 'center',
137
+				sortable: false, hidden: true
138
+			},
139
+			{
140
+				index: 'STORE_UNIT_UNQ_NO', name: 'storeUnitUnqNo',
141
+				label: '매장단가고유번호', //
142
+				width: '10', fixed: false, align: 'center',
143
+				sortable: false, hidden: true
144
+			},
145
+			{
146
+				index: 'WHS_PASS_QTY', name: 'whsPassQty',
147
+				label: '출고가능수량', //
148
+				width: '10', fixed: false, align: 'center',
149
+				sortable: false, hidden: true
150
+			}
151
+		],
152
+		loadBeforeSend: function(jqXHR) {
153
+		    jqXHR.setRequestHeader('X-AUTH-TOKEN', CONN_KEY);
154
+		},
155
+		postData: JSON.stringify(param),
156
+		url: DOMAIN + API_POP_GRID_LIST,
157
+		pager: THIS_GIRD_PAGER,
158
+		multiselect: true,
159
+		rownumbers: false,
160
+		loadComplete: function(data) {
161
+			console.log(data);
162
+			itp_fn_grid_load_complete(data, THIS_GIRD_ID, true, undefined, 'BIZPOP_ITEM', itp_BIZPOP_ITEM_search, itp_fn_BIZPOP_ITEM_empty, true, data.gridRecords, false);
163
+	    },
164
+	    loadError: function(jqXHR, textStatus, errorThrown) {
165
+	    	itp_fn_grid_load_error(jqXHR, textStatus, errorThrown);
166
+	    },
167
+	    onPaging: function(action) {
168
+	    	itp_fn_grid_paging(THIS_GIRD_ID, action, param);
169
+	    }
170
+	}).navGrid(THIS_GIRD_PAGER, ITP_GRID_NAV_DEFAULTS.navGrid);
171
+};

+ 7 - 2
src/main/webapp/app/pomng/POMNG01010.html

@@ -14,6 +14,11 @@
14 14
 						<div class="col-xs-12">
15 15
 							<form id="ITP_FORM_POMNG01010_DETAIL" class="form-horizontal">
16 16
 								<input type="hidden" id="ITP_FORM_POMNG01010_DETAIL_VIEW_CD" name="viewCd" value="C">
17
+								<input type="hidden" id="ITP_FORM_POMNG01010_DETAIL_BRAND_ID" name="brandId" value="">
18
+								<input type="hidden" id="ITP_FORM_POMNG01010_DETAIL_STORE_ID" name="storeId" value="">
19
+								<input type="hidden" id="ITP_FORM_POMNG01010_DETAIL_LOAN_DVSN" name="loanDvsn" value="">
20
+								<input type="hidden" id="ITP_FORM_POMNG01010_DETAIL_LOAN_MGNT_UNQ_NO" name="loanMgntUnqNo" value="">
21
+								<input type="hidden" id="ITP_FORM_POMNG01010_DETAIL_pchReqDvsn" name="pchReqDvsn" value="">
17 22
 					
18 23
 								<section class="itp_form_sec">
19 24
 									<h4 class="itp_form_tit">구매요청정보</h4>
@@ -81,8 +86,8 @@
81 86
 											<label class="col-xs-2 itp_lb">정산타입</label>
82 87
 												<div class="col-xs-4 itp_ip">
83 88
 													<div class="col-xs-12 itp_in">
84
-														<div class="input-group fnSttlType" style="padding:5px;"></div>
85
-													</div>
89
+														<div class="input-group fnLoanDvsnNm" style="padding:5px;"></div>
90
+													</div>  
86 91
 												</div>
87 92
 											<label class="col-xs-2 itp_lb">구매가능금액</label>
88 93
 											<div class="col-xs-4 itp_ip fnPchActAmt"></div>

+ 41 - 0
src/main/webapp/app/popup/biz/BIZPOP_ITEM.html

@@ -0,0 +1,41 @@
1
+<div id="ITP_BIZPOP_ITEM" class="modal itp_modal">
2
+	<div class="modal-dialog">
3
+		<div class="modal-content">
4
+			<form id="ITP_FORM_BIZPOP_ITEM">
5
+				<input type="hidden" id="ITP_FORM_BIZPOP_ITEM_BRAND_ID" name="sbrandId" value="">
6
+				<input type="hidden" id="ITP_FORM_BIZPOP_ITEM_STORE_ID" name="sstoreId" value="">
7
+				<div class="modal-header">
8
+					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
9
+					<h5 class="modal-title">품목 검색</h5>
10
+				</div>
11
+				<div class="modal-body">
12
+					<div class="itp_form fix">
13
+						<div class="col-xs-12 itp_form_inline">
14
+							<div class="form-horizontal fix">
15
+								<div class="col-xs-4 itp_ip itp_pr">
16
+									<input type="text" name="sitemNm" id="ITP_FORM_BIZPOP_ITEM_NM" class="form-control itp_input" placeholder="품목코드,품목명">
17
+								</div>
18
+								<div class="col-xs-4 itp_ip itp_noMar">
19
+									<select id="ITP_FORM_BIZPOP_STORE_PODR_PSSBL_DVSN" data-select-code="PODR_PSSBL_DVSN" class="form-control itp_input" name="spodrPssblDvsn">
20
+									</select>
21
+								</div>
22
+								<div class="pull-right itp_cicon">
23
+									<button type="button" class="btn btn-success btn-sm" id="ITP_BIZPOP_ITEM_BTN_SEARCH" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i> 조회</button>
24
+									<button type="button" class="btn btn-primary btn-sm" id="ITP_BIZPOP_ITEM_BTN_SELECT"><i class="glyphicon glyphicon-ok"></i> 선택</button>
25
+								</div>
26
+							</div>
27
+						</div>
28
+					</div>
29
+					<div id="ITP_BIZPOP_ITEM_jqGrid_list" class="itp_tb_list" data-total-cnt="">
30
+						<div id="ITP_BIZPOP_ITEM_jqGridView" class="itp_views fix"></div>
31
+						<table id="ITP_BIZPOP_ITEM_jqGrid"></table>
32
+						<div id="ITP_BIZPOP_ITEM_jqGridPager"></div>
33
+						<div id="ITP_BIZPOP_ITEM_jqGridEmpty" class="itp_no_data"></div>
34
+					</div>
35
+				</div>
36
+			</form>
37
+		</div>
38
+	</div>
39
+
40
+	<div id="ITP_POPUP_JS"></div>
41
+</div>

+ 4 - 1
src/main/webapp/js/app/locales/locale-ko.js

@@ -167,7 +167,10 @@ const ITP_MSG_LOCALE = (function() {
167 167
 			"itemClassLevel3": "품목분류Level 3",
168 168
 			"itemClassLevel4": "품목분류Level 4",
169 169
 			"prnSeq": "출력순번",
170
-			"writeYn": "쓰기여부"
170
+			"writeYn": "쓰기여부",
171
+			"pchReqQty": "요청수량",
172
+			"pchReqAmt": "요청금액",
173
+			"unitGubun": "단가구분"
171 174
 		},
172 175
 		"table": {
173 176
 			"brandId": "브랜드ID",

+ 334 - 0
src/main/webapp/js/app/pomng/ITP_POMNG01010.js

@@ -0,0 +1,334 @@
1
+require(['config'], function() {
2
+	require([
3
+	], function($) {
4
+		pageObj.init();
5
+	});
6
+});
7
+
8
+/********************************************************
9
+ --------------------------------------------------------
10
+ - Object 목록								            -
11
+ --------------------------------------------------------
12
+ * const gridColModel = {}	: 화면 Grid Object			*
13
+ * let pageObj = {}			: 화면공통 Object			*
14
+ * let listObj = {}			: 목록화면 Object			*
15
+ * let viewObj = {}			: 상세화면 Object			*
16
+ * let modifyObj = {}		: 수정화면 Object			*
17
+ * let createObj = {}		: 신규화면 Object			*
18
+ *******************************************************/
19
+
20
+/*화면 변수*/
21
+/*
22
+const POMNG01010_GRID_ID = '#ITP_POMNG01010_jqGrid';
23
+const POMNG01010_GRID_LIST = '#ITP_POMNG01010_jqGrid_list';
24
+const POMNG01010_GRID_PAGER = '#ITP_POMNG01010_jqGridPager';
25
+const POMNG01010_GRID_EMPTY = '#ITP_POMNG01010_jqGridEmpty';
26
+
27
+const POMNG01010_VIEW_GRID_ID = '#ITP_POMNG01010_VIEW_jqGrid';
28
+const POMNG01010_VIEW_GRID_LIST = '#ITP_POMNG01010_VIEW_jqGrid_list';
29
+const POMNG01010_VIEW_GRID_PAGER = '#ITP_POMNG01010_VIEW_jqGridPager';
30
+const POMNG01010_VIEW_GRID_EMPTY = '#ITP_POMNG01010_VIEW_jqGridEmpty';
31
+*/
32
+const POMNG01010_DETAIL_GRID_ID = '#ITP_POMNG01010_DETAIL_jqGrid';
33
+const POMNG01010_DETAIL_GRID_LIST = '#ITP_POMNG01010_DETAIL_jqGrid_list';
34
+const POMNG01010_DETAIL_GRID_PAGER = '#ITP_POMNG01010_DETAIL_jqGridPager';
35
+const POMNG01010_DETAIL_GRID_EMPTY = '#ITP_POMNG01010_DETAIL_jqGridEmpty';  // ==>dwkim html확인필요
36
+
37
+/*
38
+let ITP_FORM_POMNG01010_DETAIL_IS_DUPLICATE = false;
39
+let ITP_FORM_POMNG01010_DETAIL_IS_WRITING = false;
40
+*/
41
+
42
+/*API URL*/
43
+let API_DETAIL_INIT_INFO = '/api/pomng/init-pchReq'
44
+//let API_DETAIL_GRID_LIST = '/api/affl/detail-grid-list';
45
+//let API_DETAIL_INFO = '/api/affl/info-affl';
46
+//let COMPANY_INFO_COMPANY = '/api/affl/info-affl';
47
+let API_DETAIL_SAVE = '/api/pomng/save-pchReq';
48
+//let API_CHECK_DUPLICATE = '/api/affl/check-duplicate';
49
+//let API_INTI_USERPW = '/api/user/inti-userpw';
50
+
51
+/*화면 Grid ColModel   ==>선택박스 항목 추가 부분  */
52
+const gridColModel = {
53
+	detail: [
54
+		{
55
+			index: 'VIEW_CD', name: 'viewCd',
56
+			label: ITP_MSG_LOCALE.label.viewCd,
57
+			width: '10', fixed: false, align: 'center',
58
+			sortable: false, hidden: true
59
+		},
60
+		{
61
+			index: 'ITEM_ID', name: 'itemId',
62
+			label: ITP_MSG_LOCALE.label.itemId,
63
+			width: '20', fixed: false, align: 'center',
64
+			sortable: false, editable: false, edittype: 'text',
65
+			editrules: { required: true }
66
+		},
67
+		{
68
+			index: 'ITEM_NM', name: 'itemNm',
69
+			label: ITP_MSG_LOCALE.label.itemNm,
70
+			width: '30', fixed: false, align: 'center',
71
+			sortable: true, editable: false, edittype: 'text',
72
+			editrules: { required: true }
73
+		},
74
+		{
75
+			index: 'UNIT', name: 'unit',
76
+			label: ITP_MSG_LOCALE.label.unit,
77
+			width: '10', fixed: false, align: 'center',
78
+			sortable: false, editable: false, edittype: 'text'
79
+		},
80
+		{
81
+			index: 'UNIT_AMT', name: 'unitAmt',
82
+			label: ITP_MSG_LOCALE.label.unitAmt,
83
+			width: '10', fixed: false, align: 'center',
84
+			sortable: false, editable: false, edittype: 'text', hidden: false
85
+		},
86
+		{
87
+			index: 'PCH_REQ_QTY', name: 'pchReqQty',
88
+			label: ITP_MSG_LOCALE.label.pchReqQty, //단가
89
+			width: '10', fixed: false, align: 'center',
90
+			sortable: true, editable: true, edittype: 'text',
91
+			editrules: { number:true}
92
+		},
93
+		{
94
+			index: 'PCH_REQ_AMT', name: 'pchReqAmt',
95
+			label: ITP_MSG_LOCALE.label.pchReqAmt,
96
+			width: '10', fixed: false, align: 'center',
97
+			sortable: false, editable: false, edittype: 'text', hidden: false
98
+		},
99
+
100
+		{
101
+			index: 'BRAND_UNIT_UNQ_NO', name: 'brandUnitUnqNo',
102
+			label: ITP_MSG_LOCALE.label.brandUnitUnqNo,
103
+			width: '10', fixed: false, align: 'center',
104
+			sortable: false, editable: false, edittype: 'text', hidden: true
105
+		},
106
+		{
107
+			index: 'STORE_UNIT_UNQ_NO', name: 'storeUnitUnqNo',
108
+			label: ITP_MSG_LOCALE.label.storeUnitUnqNo,
109
+			width: '10', fixed: false, align: 'center',
110
+			sortable: false, editable: false, edittype: 'text', hidden: true
111
+		},
112
+		{
113
+			index: 'UNIT_GUBUN', name: 'unitGubun',
114
+			label: ITP_MSG_LOCALE.label.unitGubun,
115
+			width: '10', fixed: false, align: 'center',
116
+			sortable: false, editable: false, edittype: 'text', hidden: true
117
+		}
118
+	]
119
+};
120
+
121
+/*화면공통 Object*/
122
+let pageObj = {
123
+	init: function() {
124
+		this.ui.init();
125
+		this.event.init();
126
+	},
127
+	itp_POMNG01010_param: {},  // ==>dwkim 
128
+	itp_POMNG01010_search: false,  // ==>dwkim 
129
+	ui: {
130
+		init: function() {
131
+			this.view();
132
+			this.grid();
133
+			this.ready();
134
+		},
135
+		view: function() {
136
+			// 버튼 권한설정
137
+			fn_proc_btn_auth('POMNG01010');
138
+
139
+			// 공통코드 표시
140
+			$('select').each(function() {
141
+				if ($(this).data('select-code')) {
142
+					fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
143
+				}
144
+			});
145
+
146
+			// 조회일자 지정
147
+			var now = new Date();
148
+			$('#ITP_FORM_POMNG01010_DETAIL_DLV_REQ_DT').datepicker('dlvReqDt', new Date(now.setDate(now.getDate() + 5)));
149
+
150
+
151
+			// form alert message 주입
152
+			/*
153
+			$('input[data-alert-required="ONLYCHK"]').each(function() {
154
+				if($(this).data('alert-msg') === 'address') {
155
+					$(this).data('alert-msg', ITP_MSG_LOCALE.message.form.emptyAddr);
156
+				}
157
+			});
158
+			*/
159
+		},
160
+		grid: function() {
161
+			itp_fn_jqgrid_resize(POMNG01010_DETAIL_GRID_ID, POMNG01010_DETAIL_GRID_LIST, 'lg');
162
+			//listObj.empty.init();
163
+			itp_fn_fire_window_resize();
164
+		},
165
+		ready: function() {
166
+			createObj.init();
167
+		}
168
+	},
169
+	event: {
170
+		init: function() {
171
+			this.button();
172
+		},
173
+		button: function() {
174
+			// 버튼 클릭 이벤트
175
+			$('button').each(function() {
176
+				var id = $(this).attr('id');
177
+				$(this).on('click', function() {
178
+					switch (id) {
179
+						case 'ITP_BTN_POMNG01010_SRH': modifyObj.button.save(); break;	// 구매요청
180
+						case 'ITP_BTN_POMNG01010_NEWREG': modifyObj.button.newReg(); break;	// 임시저장
181
+						case 'ITP_BTN_POMNG01010_DETAIL_ADDROW': pageObj.grid.button.addRow(); break;	// 품목추가
182
+						case 'ITP_BTN_POMNG01010_DETAIL_DELROW': pageObj.grid.button.delRow(); break;	// 품목삭제
183
+					}
184
+				});
185
+			});
186
+
187
+			$('body').on('click', function(e) {
188
+				// afflUserObj.grid.resetGrid(e);
189
+			});
190
+
191
+		}
192
+	},
193
+	grid: {
194
+		init: function(mode, gridData) {
195
+			this.mode = mode;
196
+			this.gridId = POMNG01010_DETAIL_GRID_ID;
197
+			this.unload();  // ==>dwkim 
198
+			this.load(gridData);
199
+		},
200
+		mode: 'DETAIL',
201
+		gridId: '',
202
+		button: {
203
+			addRow: function() {
204
+				// 팝업
205
+				var popFn = function(rowDataPop) {
206
+					console.log(rowDataPop);
207
+					// 기존등록 데이터
208
+					var exists = '';
209
+					const rowData = $(POMNG01010_DETAIL_GRID_ID).getRowData();
210
+					$.each(rowData, function(key, value) {
211
+						exists = exists + value.itemId + ';';
212
+					});
213
+
214
+					$.each(rowDataPop, function(key, value) {
215
+						if (exists.indexOf(value.itemId) < 0 && value.podrPssblDvsn == 'PO01') {
216
+							value['viewCd'] = "C";
217
+							$(POMNG01010_DETAIL_GRID_ID).jqGrid('addRowData', value.itemId, value, 'last');
218
+						}
219
+					});
220
+					$(POMNG01010_DETAIL_GRID_EMPTY).hide();
221
+				};
222
+				//const key = {brandId:fn_make_user_info.get('brandId'), brandUnitUnqNo: selectVal, viewCd: 'R'};
223
+				fn_call_popup('biz', 'BIZPOP_ITEM', '#ITP_ASIDE', popFn, null, 'S');  // ==>dwkim 추후 작업 진행  파라메타 설명필요
224
+			},
225
+			delRow: function() {
226
+				itp_fn_grid_del_row(POMNG01010_DETAIL_GRID_ID);
227
+			}
228
+		},
229
+		load: function(gridData) {  // ==>dwkim  오픈시 데이타 가져오는 부분 넣으면 되는건지 여부 gird가 아님
230
+			var _this = this;
231
+			var option = {
232
+				gridId: this.gridId,
233
+				colModel: gridColModel.detail,
234
+				data: gridData,
235
+				multiselect: true,
236
+				loadComplete: function(data) {
237
+					_this.clearData();
238
+				}
239
+			};
240
+			itp_fn_grid_make_local(option);
241
+		},
242
+		clearData: function() {
243
+			console.log(this.gridId);
244
+			$(POMNG01010_DETAIL_GRID_ID).jqGrid('clearGridData', true);
245
+			$(POMNG01010_DETAIL_GRID_LIST).find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
246
+			$(POMNG01010_DETAIL_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
247
+			$(POMNG01010_DETAIL_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
248
+			$(POMNG01010_DETAIL_GRID_EMPTY).show();
249
+		},
250
+		unload: function() {
251
+			$.jgrid.gridUnload(this.gridId);
252
+		}
253
+	}
254
+};
255
+
256
+/*신규화면 Object*/
257
+let createObj = {
258
+	init: function() {
259
+		$('#ITP_FORM_POMNG01010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
260
+		$('#ITP_FORM_POMNG01010_DETAIL_STORE_ID').val(fn_make_user_info.get('storeId'));
261
+		//let param = 'brandId=' + LOGIN_USER_INFO.brandId + "&spplyId=" + LOGIN_USER_INFO.spplyId;
262
+		this.load();
263
+	},
264
+	button: {
265
+		save: function() {
266
+			const formId = '#ITP_FORM_POMNG01010_DETAIL';
267
+			itp_fn_form_clear_validate(null, formId);
268
+
269
+			// if (vali_cmpyCd && vali_cmpyStatCd && vali_cmpyTypeCd && vali_cmpyNm && vali_bossNm && vali_mainTel && vali_mainEmail) {
270
+			if (itp_fn_form_event.isValid(formId)) {
271
+
272
+				// if($('#ITP_FORM_POMNG01010_DETAIL_CMPY_ZIPNO').val() === '' || $('#ITP_FORM_POMNG01010_DETAIL_CMPY_ADRES').val() === '') {
273
+				// 	itp_fn_modal_alert('주소 검색을 통해 회사 주소를 입력하세요.');
274
+				// 	return;
275
+				// }
276
+
277
+				if (ITP_FORM_POMNG01010_DETAIL_IS_DUPLICATE) {
278
+					itp_fn_modal_duplicate('회사코드 중복체크를 해주세요.', formId + '_AFFL_SHOP_ID');
279
+				} else {
280
+					let gridInsertData = [];
281
+					let gridUpdateData = [];
282
+					let gridDeleteData = [];
283
+					const rowData = $(POMNG01010_DETAIL_GRID_ID).getRowData();
284
+					const keyValue = $(formId + '_AFFL_SHOP_ID').val();
285
+					$.each(rowData, function(key, value) {
286
+						if (value.viewCd !== 'R') {
287
+							value.afflShopId = keyValue;
288
+							if (value.viewCd === 'C') {
289
+								gridInsertData.push(value);
290
+							} else if (value.viewCd === 'U') {
291
+								gridUpdateData.push(value);
292
+							} else if (value.viewCd === 'D') {
293
+								gridDeleteData.push(value);
294
+							}
295
+						}
296
+					});
297
+
298
+					let param = $(formId).serializeObject();
299
+					param.gridInsertData = gridInsertData;
300
+					param.gridUpdateData = gridUpdateData;
301
+					param.gridDeleteData = gridDeleteData;
302
+					console.log(JSON.stringify(param));
303
+					var searhFn = function() {
304
+						ITP_FORM_POMNG01010_DETAIL_IS_WRITING = false;
305
+						viewObj.init();
306
+					};
307
+					fn_ajax_call(API_DETAIL_SAVE, JSON.stringify(param), searhFn, 'POST');
308
+				}
309
+			}
310
+		}
311
+	},
312
+	load: function() {
313
+		fn_ajax_call(API_DETAIL_INIT_INFO, '', this.callback, 'GET');
314
+	},
315
+	callback: function(result) {
316
+		console.log(result);
317
+
318
+		$('#ITP_FORM_POMNG01010_DETAIL #ITP_FORM_POMNG01010_DETAIL_VIEW_CD').val('C');
319
+
320
+		$('#ITP_FORM_POMNG01010_DETAIL #ITP_FORM_POMNG01010_DETAIL_BRAND_ID').val(result.brandId);
321
+		$('#ITP_FORM_POMNG01010_DETAIL #ITP_FORM_POMNG01010_DETAIL_STORE_ID').val(result.storeId);
322
+		$('#ITP_FORM_POMNG01010_DETAIL #ITP_FORM_POMNG01010_DETAIL_LOAN_DVSN').val(result.loanDvsn);
323
+		$('#ITP_FORM_POMNG01010_DETAIL #ITP_FORM_POMNG01010_DETAIL_LOAN_MGNT_UNQ_NO').val(result.loanMgntUnqNo);
324
+		$('#ITP_FORM_POMNG01010_DETAIL #ITP_FORM_POMNG01010_DETAIL_PCH_REQ_DVSN').val(result.pchReqDvsn);
325
+		$('#ITP_FORM_POMNG01010_DETAIL .fnBrandNm').text(result.brandNm);
326
+		$('#ITP_FORM_POMNG01010_DETAIL .fnPchReqDept').text(result.reqDept);
327
+		$('#ITP_FORM_POMNG01010_DETAIL .fnPchReqMgrNm').text(result.userNm);
328
+		$('#ITP_FORM_POMNG01010_DETAIL .fnPchReqAmt').text("0");
329
+		$('#ITP_FORM_POMNG01010_DETAIL .fnLoanDvsnNm').text(result.loanDvsnNm);
330
+		$('#ITP_FORM_POMNG01010_DETAIL .fnPchActAmt').text(result.ordUseAmt);
331
+
332
+		pageObj.grid.init();
333
+	}
334
+};

+ 171 - 0
src/main/webapp/js/app/popup/biz/ITP_BIZPOP_ITEM.js

@@ -0,0 +1,171 @@
1
+require(['config'], function() {
2
+	require([
3
+		'jquery'
4
+	], function($) {
5
+
6
+	});
7
+});
8
+
9
+let API_POP_GRID_LIST = '/api/item/pop-grid-list';
10
+
11
+function itp_fn_BIZPOP_ITEM(parentPopFn, args, returnType) {
12
+	console.log(args);
13
+	let itp_BIZPOP_ITEM_param = {};
14
+	let itp_BIZPOP_ITEM_search = false;
15
+
16
+	const THIS_FORM_ID = '#ITP_FORM_BIZPOP_ITEM';
17
+	const THIS_GIRD_ID = '#ITP_BIZPOP_ITEM_jqGrid';
18
+	const THIS_GIRD_PAGER = '#ITP_BIZPOP_ITEM_jqGridPager';
19
+
20
+	$('#ITP_FORM_BIZPOP_ITEM_BRAND_ID').val(fn_make_user_info.get('brandId'));
21
+	$('#ITP_FORM_BIZPOP_ITEM_STORE_ID').val(fn_make_user_info.get('storeId'));
22
+
23
+	// 공통코드 표시
24
+	$('select').each(function() {
25
+		if($(this).data('select-code')) {
26
+			fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
27
+		}
28
+	});
29
+
30
+	$('#ITP_BIZPOP_ITEM').one('shown.bs.modal', function(e) {
31
+		itp_fn_jqgrid_resize(THIS_GIRD_ID, '#ITP_BIZPOP_ITEM_jqGrid_list', '');
32
+		itp_fn_fire_window_resize();
33
+	}).one('hidden.bs.modal', function(e) {
34
+		$('#ITP_BIZPOP_ITEM').remove();
35
+	}).modal('show');
36
+
37
+	$('#ITP_BIZPOP_ITEM_BTN_SEARCH').on('click', function() {
38
+		itp_BIZPOP_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_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('1명을 선택해주세요.');
57
+			// return;
58
+		}
59
+		
60
+	    for (var i=selectedIds.length-1; i>=0; i--) {
61
+			list.push($(THIS_GIRD_ID).jqGrid('getRowData', selectedIds[i]));	
62
+		}
63
+		parentPopFn(list);
64
+		$('#ITP_BIZPOP_ITEM').modal('hide'); // 팝업닫기
65
+	});
66
+
67
+	$('#ITP_BIZPOP_ITEM_jqGridEmpty').on('click', function() {
68
+		itp_fn_BIZPOP_ITEM_empty.back();
69
+		itp_BIZPOP_ITEM_param.gridSize = 10;
70
+		$(THIS_GIRD_ID).setGridParam({'postData': JSON.stringify(itp_BIZPOP_ITEM_param)}).trigger('reloadGrid');
71
+	});
72
+
73
+	var itp_fn_BIZPOP_ITEM_empty = {
74
+		push: function() {
75
+			let param = $(THIS_FORM_ID).serializeObject();
76
+			itp_BIZPOP_ITEM_param = param;
77
+		},
78
+		back: function() {
79
+			$(THIS_FORM_ID + '_BRAND_ID').val(itp_BIZPOP_ITEM_param.sbrandId);
80
+			$(THIS_FORM_ID + '_STROE_ID').val(itp_BIZPOP_ITEM_param.sstoreId);
81
+		}
82
+	};
83
+
84
+	itp_fn_BIZPOP_ITEM_empty.push();
85
+	let param = $('#ITP_FORM_BIZPOP_ITEM').serializeObject();
86
+	param.gridSize = 10;
87
+	console.log(JSON.stringify(param));
88
+
89
+	$(THIS_GIRD_ID).jqGrid({
90
+		colModel: [
91
+			{
92
+				index: 'ITEM_ID', name: 'itemId',
93
+				label: '품목ID', //
94
+				width: '10', fixed: false, align: 'center',
95
+				sortable: false, hidden: false
96
+			},
97
+			{
98
+				index: 'ITEM_NM', name: 'itemNm',
99
+				label: '품목명', //
100
+				width: '12', fixed: false, align: 'left',
101
+				sortable: false, hidden: false
102
+			},
103
+			{
104
+				index: 'UNIT', name: 'unit',
105
+				label: '단위', //
106
+				width: '6', fixed: false, align: 'center',
107
+				sortable: false, hidden: false
108
+			},
109
+			{
110
+				index: 'UNIT_AMT', name: 'unitAmt',
111
+				label: '단가', //
112
+				width: '6', fixed: false, align: 'right',
113
+				sortable: false, hidden: false
114
+			},
115
+			{
116
+				index: 'PODR_PSSBL_DVSN_NM', name: 'podrPssblDvsnNm',
117
+				label: '발주가능여부명', //
118
+				width: '6', fixed: false, align: 'center',
119
+				sortable: false, hidden: false
120
+			},
121
+			{
122
+				index: 'PODR_PSSBL_DVSN', name: 'podrPssblDvsn',
123
+				label: '발주가능여부', //
124
+				width: '6', fixed: false, align: 'center',
125
+				sortable: false, hidden: true
126
+			},
127
+			{
128
+				index: 'BRAND_UNIT_UNQ_NO', name: 'brandUnitUnqNo',
129
+				label: '브랜드단가고유번호', //
130
+				width: '10', fixed: false, align: 'center',
131
+				sortable: false, hidden: true
132
+			},
133
+			{
134
+				index: 'UNIT_GUBUN', name: 'unitGubun',
135
+				label: '단가구분', //
136
+				width: '10', fixed: false, align: 'center',
137
+				sortable: false, hidden: true
138
+			},
139
+			{
140
+				index: 'STORE_UNIT_UNQ_NO', name: 'storeUnitUnqNo',
141
+				label: '매장단가고유번호', //
142
+				width: '10', fixed: false, align: 'center',
143
+				sortable: false, hidden: true
144
+			},
145
+			{
146
+				index: 'WHS_PASS_QTY', name: 'whsPassQty',
147
+				label: '출고가능수량', //
148
+				width: '10', fixed: false, align: 'center',
149
+				sortable: false, hidden: true
150
+			}
151
+		],
152
+		loadBeforeSend: function(jqXHR) {
153
+		    jqXHR.setRequestHeader('X-AUTH-TOKEN', CONN_KEY);
154
+		},
155
+		postData: JSON.stringify(param),
156
+		url: DOMAIN + API_POP_GRID_LIST,
157
+		pager: THIS_GIRD_PAGER,
158
+		multiselect: true,
159
+		rownumbers: false,
160
+		loadComplete: function(data) {
161
+			console.log(data);
162
+			itp_fn_grid_load_complete(data, THIS_GIRD_ID, true, undefined, 'BIZPOP_ITEM', itp_BIZPOP_ITEM_search, itp_fn_BIZPOP_ITEM_empty, true, data.gridRecords, false);
163
+	    },
164
+	    loadError: function(jqXHR, textStatus, errorThrown) {
165
+	    	itp_fn_grid_load_error(jqXHR, textStatus, errorThrown);
166
+	    },
167
+	    onPaging: function(action) {
168
+	    	itp_fn_grid_paging(THIS_GIRD_ID, action, param);
169
+	    }
170
+	}).navGrid(THIS_GIRD_PAGER, ITP_GRID_NAV_DEFAULTS.navGrid);
171
+};