Browse Source

모바일html 수정중

whakdo963 2 years ago
parent
commit
0db9929244

+ 28 - 31
src/main/webapp/mobile/app/mpomng/MPOMNG01010.html

@@ -7,13 +7,13 @@
7 7
       </div>
8 8
       <div class="pop_line">
9 9
         <label>품목수&nbsp;&nbsp; :</label>
10
-        <div class="fnPop">2개</div>
10
+        <div class="fnItemQty">2개</div>
11 11
       </div>
12 12
       <div class="pop_line">
13 13
         <label>구매금액 &nbsp;&nbsp;:</label>
14
-        <div class="fnPop">2022.09.30원</div>
14
+        <div class="fnOrdAmt">2022.09.30원</div>
15 15
       </div>
16
-      <label class="pop_label">구매요청 하시겠습니까?</label>
16
+      <label class="pop_label msg_save">구매요청 하시겠습니까?</label>
17 17
       <div class="popup_btn">
18 18
         <button id="ITP_BTN_MPOMNG01010_POP_REQ_CLOSE" class="cancel btn-gray CLB btn-pop-close">취소</button>
19 19
         <button id="ITP_BTN_MPOMNG01010_POP_REQ_CONFIRM" class="ok btn-primary COK">확인</button>
@@ -32,30 +32,32 @@
32 32
       </div>
33 33
       <div class="search_bar">
34 34
         <form id="ITP_FORM_MPOMNG01010_POP_WHS" class="form-horizontal" onsubmit="return false;">
35
-          <input id="ITP_FORM_MPOMNG01010_POP_WHS_KEYWORD" type="text" placeholder="납품장소명">
35
+            <input type="hidden" id="ITP_FORM_MPOMNG01010_WHS_ITEM_BRAND_ID" name="sbrandId" value="">
36
+            <input type="hidden" id="ITP_FORM_MPOMNG01010_WHS_ITEM_STORE_ID" name="sstoreId" value="">
37
+            <input id="ITP_FORM_MPOMNG01010_POP_WHS_KEYWORD" type="text" name="swhsNm" placeholder="납품장소명">
36 38
           <button id="ITP_BTN_MPOMNG01010_POP_WHS_SEARCH"><img src="../img/search.png"></button>
37 39
         </form>
38 40
       </div>
39 41
       <div class="search_bar">
40 42
         <button id="ITP_BTN_MPOMNG01010_POP_WHS_NM" class="btn_blue">납품장소▼</button>
41 43
       </div>
42
-      <div class="popup_scroll">
44
+        <div id="ITP_LIST_MPOMNG01010_POP_WHS_AREA" class="popup_scroll">
43 45
         <ul id="ITP_LIST_MPOMNG01010_POP_WHS_ROWS" class="panel-group itp_nav"></ul>
44 46
         <div id="ITP_LIST_MPOMNG01010_POP_WHS_ROWCOPY" style="display:none;">
45
-          <li>
47
+            <li class="row_2">
46 48
             <div class="scroll_left">
47
-              <div class="fn">브랜드 창고 명A</div>
48
-              <div class="fn">(상세위치내용)</div>
49
+                <div class="fnWhsNm">브랜드 창고 명A</div>
50
+                <div class="fnLocationNm">(상세위치내용)</div>
49 51
             </div>
50 52
             <div class="scroll_right">
51
-              <button id="ITP_BTN_MPOMNG01010_POP_WHS_CHOICE">선택</button>
53
+                <button id="ITP_BTN_MPOMNG01010_POP_WHS_CHOICE" class="fnWhsId" data-whs-id="">선택</button>
52 54
             </div>
53 55
           </li>
54 56
         </div>
55 57
       </div>
56 58
     </div>
57 59
   </div>
58
-  <div id="ITP_POP_MPOMNG01010_ITEM_AREA" class="popup2 mobile-pop-close" style="display: block;">
60
+  <div id="ITP_POP_MPOMNG01010_ITEM_AREA" class="popup2 mobile-pop-close" style="display: none;">
59 61
     <div class="pop">
60 62
         <div class="header">
61 63
             <div class="header_left">
@@ -78,16 +80,8 @@
78 80
         </form>
79 81
         <div id="ITP_LIST_MPOMNG01010_POP_ITEM_AREA" class="popup_scroll">
80 82
             <ul id="ITP_LIST_MPOMNG01010_POP_ITEM_ROWS" class="panel-group"></ul>
81
-            <div id="ITP_LIST_MPOMNG01010_POP_ITEM_ROWCOPY" style="display:block;">
82
-                <li class="row_2"
83
-                    data-brandUnitUnqNo=""
84
-                    data-podrPssblDvsn=""
85
-                    data-spplyId=""
86
-                    data-stddQty=""
87
-                    data-storeUnitUnqNo=""
88
-                    data-unit=""
89
-                    data-unitAmt=""
90
-                    data-unitGubun="">
83
+            <div id="ITP_LIST_MPOMNG01010_POP_ITEM_ROWCOPY" style="display:none;">
84
+                <li class="row_2">
91 85
                     <div class="left" style="width:180px;">
92 86
                         <!--<div class="check_box">
93 87
                             <input type="checkbox" id="ITP_FORM_MPOMNG01010_POP_ITEM_CHECKBOX" name="itemId" />
@@ -95,7 +89,7 @@
95 89
                         <div class="thick">
96 90
                             <div class="fnItemNm">품목명</div>
97 91
                             <div>-</div>
98
-                            <div class="fnOrdUnit">EA</div>
92
+                            <div class="fnUnit">EA</div>
99 93
                         </div>
100 94
                         <div class="thick" style="font-weight:100;">
101 95
                             <div class="space">구매가 :</div>
@@ -104,7 +98,7 @@
104 98
                     </div>
105 99
                     <div class="right">
106 100
                         <button id="ITP_BTN_MPOMNG01010_POP_ITEM_MINUS" class="POP_ITEM_MINUS">-</button>
107
-                        <div class="num">1</div>
101
+                        <div class="num fnPchReqQty">1</div>
108 102
                         <button id="ITP_BTN_MPOMNG01010_POP_ITEM_PLUS" class="POP_ITEM_PLUS">+</button>
109 103
                     </div>
110 104
                     <div class="add">
@@ -124,15 +118,16 @@
124 118
       <input type="hidden" id="ITP_FORM_MPOMNG01010_DETAIL_LOAN_DVSN" name="loanDvsn" value="">
125 119
       <input type="hidden" id="ITP_FORM_MPOMNG01010_DETAIL_LOAN_MGNT_UNQ_NO" name="loanMgntUnqNo" value="">
126 120
       <input type="hidden" id="ITP_FORM_MPOMNG01010_DETAIL_PCH_REQ_DVSN" name="pchReqDvsn" value="">
121
+        <input type="hidden" id="ITP_FORM_MPOMNG01010_DETAIL_PCH_REQ_ST_CD" name="pchReqStCd" value="">
127 122
       <div class="content">
128 123
         <div class="line">
129 124
           <label>납기요청일</label>
130
-          <input id="ITP_FORM_MPOMNG01010_DETAIL_DLV_REQ_DT" name="dlvReqDt" class="date" type="date" placeholder="">
125
+          <input id="ITP_FORM_MPOMNG01010_DETAIL_DLV_REQ_DT" name="dlvReqDt" class="date" data-check-required="empty" type="date" placeholder="">
131 126
         </div>
132 127
         <div class="line">
133 128
           <label>구매요청금액</label>
134 129
           <div class="line_right">
135
-            <div class="fnPchReqAmt">0원</div>
130
+            <div class="fnPchReqAmtTot">0원</div>
136 131
           </div>
137 132
         </div>
138 133
         <div class="line">
@@ -145,7 +140,9 @@
145 140
           <label>납품장소</label>
146 141
           <div class="search_nm">
147 142
             <div class="float_left">
148
-              <input type="text" id="ITP_FORM_MPOMNG01010_DETAIL_WHS_NM" class="" name="whsNm" placeholder="매장명" />
143
+              <input type="text" id="ITP_FORM_MPOMNG01010_DETAIL_WHS_NM" class="" name="whsNm" data-check-required="empty" placeholder="매장명" readonly />
144
+                <input type="hidden" id="ITP_FORM_MPOMNG01010_DETAIL_WHS_ID" class="form-control itp_input" name="whsId" value="" />
145
+                <input type="hidden" id="ITP_FORM_MPOMNG01010_DETAIL_LOCATION" class="form-control itp_input" name="location" value="" />
149 146
             </div>
150 147
             <div class="float_left_btn">
151 148
               <button id="ITP_BTN_MPOMNG01010_DETAIL_SEARCH_WHS_NM" data-call-popup="ITP_POP_MPOMNG01010_WHS_AREA"><img src="../img/search.png" alt=""></button>
@@ -163,11 +160,11 @@
163 160
       </div>
164 161
       <div id="ITP_LIST_MPOMNG01010_ITEM_AREA" class="scroll_area row-1-1">
165 162
         <ul id="ITP_LIST_MPOMNG01010_DETAIL_ROWS" class="panel-group"></ul>
166
-        <div id="ITP_LIST_MPOMNG01010_DETAIL_ROWCOPY" style="display:block;">
163
+        <div id="ITP_LIST_MPOMNG01010_DETAIL_ROWCOPY" style="display:none;">
167 164
           <li class="row_2">
168 165
             <div class="left_info">
169 166
               <div class="check_box"><!-- class 변경 -->
170
-                <div><input type="checkbox" name="itemId" class="fnBrandUnitUnqNo" /></div>
167
+                <div><input type="checkbox" name="brandUnitUnqNo" class="fnBrandUnitUnqNo" /></div>
171 168
               </div>
172 169
               <div class="thick">
173 170
                 <div class="fnItemNm">품목명</div>
@@ -180,16 +177,16 @@
180 177
               </div>
181 178
             </div>
182 179
             <div class="right">
183
-              <button id="ITP_BTN_MPOMNG01010_DETAIL_MINUS">-</button>
184
-              <div class="num fnNum">0</div>
185
-              <button id="ITP_BTN_MPOMNG01010_DETAIL_PLUS">+</button>
180
+              <button id="ITP_BTN_MPOMNG01010_DETAIL_MINUS" class="DETAIL_ITEM_MINUS">-</button>
181
+              <div class="num fnPchReqQty">1</div>
182
+              <button id="ITP_BTN_MPOMNG01010_DETAIL_PLUS" class="DETAIL_ITEM_PLUS">+</button>
186 183
             </div>
187 184
           </li>
188 185
         </div>
189 186
       </div>
190 187
       <div class="button_bar">
191 188
         <button id="ITP_BTN_MPOMNG01010_DETAIL_REQ_ORDER" data-call-popup="ITP_POP_MPOMNG01010_REQ_AREA" class="col_3 btn-primary REQ">구매요청</button>
192
-        <button id="ITP_BTN_MPOMNG01010_DETAIL_TEMP_SAVE" class="col_3 btn-gray TSA">임시저장</button>
189
+        <button id="ITP_BTN_MPOMNG01010_DETAIL_TEMP_SAVE" data-call-popup="ITP_POP_MPOMNG01010_REQ_AREA" class="col_3 btn-gray TSA">임시저장</button>
193 190
         <button id="ITP_BTN_MPOMNG01010_DETAIL_CANCEL" class="col_3 btn-gray CLB">취소</button>
194 191
       </div>
195 192
     </form>

+ 6 - 79
src/main/webapp/mobile/app/mpomng/MPOMNG02010.html

@@ -1,5 +1,5 @@
1 1
 <section id="ITP_MOBILE_MPOMNG02010">
2
-  <div id="ITP_AJAX_MPOMNG02010_DETAIL_CONTAINER" style="display: none;">
2
+  <div id="ITP_AJAX_MPOMNG02010_DETAIL_CONTAINER" style="display: block;">
3 3
 	<form id="ITP_FORM_MPOMNG02010_DETAIL" class="form-horizontal" onsubmit="return false;">
4 4
 	<input type="hidden" id="ITP_FORM_MPOMNG02010_DETAIL_VIEW_CD" name="viewCd" value="C">
5 5
     <div class="content">
@@ -41,15 +41,7 @@
41 41
     <div id="ITP_LIST_MPOMNG02010_ITEM_AREA" class="scroll_area row-1-1">
42 42
    		<ul id="ITP_LIST_MPOMNG02010_POP_ITEM_ROWS" class="panel-group"></ul>
43 43
         <div id="ITP_LIST_MPOMNG02010_POP_ITEM_ROWCOPY" style="display:block;">
44
-	      <li class="history_list"
45
-	           data-brandUnitUnqNo=""
46
-               data-podrPssblDvsn=""
47
-               data-spplyId=""
48
-               data-stddQty=""
49
-               data-storeUnitUnqNo=""
50
-               data-unit=""
51
-               data-unitAmt=""
52
-               data-unitGubun="">
44
+	      <li class="history_list">
53 45
 	        <div class="left">
54 46
 	          <div class="nomal">
55 47
 	            <label>구매요청일 </label>
@@ -83,7 +75,7 @@
83 75
 	            <label style="width: 127px;">구매요청 정보</label>
84 76
 	            <span>:</span>
85 77
 	            <div class="history">
86
-	              <div class="fnItem">품목수(3)</div> 
78
+	              <div class="fnItem">품목수(3)</div>
87 79
 	              <i>- </i>
88 80
 	              <div class="fnItemAtm">1,200,000</div> 원
89 81
 	            </div>
@@ -94,7 +86,7 @@
94 86
 	            <label>결재정보 </label>
95 87
 	            <span>:</span>
96 88
 	            <div class="history">
97
-	              <div class="fnInfo">미납</div> 
89
+	              <div class="fnInfo">미납</div>
98 90
 	            </div>
99 91
 	          </div>
100 92
 	        </div>
@@ -111,7 +103,7 @@
111 103
 	        <label>납기요청일</label>
112 104
 	        <div class="line_right">
113 105
 	          <div class="fnDlvReqDt">2022.10.10</div>
114
-	        </div>      
106
+	        </div>
115 107
 	      </div>
116 108
 	      <div class="line">
117 109
 	        <label>구매요청금액</label>
@@ -166,72 +158,7 @@
166 158
 	    </div>
167 159
 	    <div class="button_bar">
168 160
 	      <button id="" class="col_12 btn-gray CLB">취소</button>
169
-	    </div>	
161
+	    </div>
170 162
     </form>
171 163
   </div>
172
-  <div id="ITP_AJAX_MPOMNG02010_NEW_CONTAINER" style="display: none;">
173
-  <form id="ITP_FORM_MPOMNG02010_NEW" class="form-horizontal" onsubmit="return false;"> 
174
-   <input type="hidden" id="ITP_FORM_MPOMNG01010_NEW_VIEW_CD" name="viewCd" value="C">
175
-    <div class="content">
176
-      <div class="line">
177
-        <label>납기요청일</label>
178
-        <input id="ITP_FORM_MPOMNG02010_NEW_DLV_REQ_DT" name="dlvReqDt" class="date" type="date" placeholder="">
179
-      </div>
180
-      <div class="line">
181
-        <label>구매요청금액</label>
182
-        <div class="line_right">
183
-          <div class="fnPchReqAmt">424,000원</div>
184
-        </div>
185
-      </div>
186
-      <div class="line">
187
-        <label>납품장소</label>
188
-        <div class="search_nm">
189
-          <div class="float_left">
190
-            <input id="ITP_FORM_MPOMNG02010_NEW_WHS_NM" name="whsNm" type="text" placeholder="A매장명">
191
-          </div>
192
-          <div class="float_left_btn">
193
-            <button id="ITP_BTN_MPOMNG02010_NEW_SEARCH_WHS_NM" data-call-popup="ITP_POP_MPOMNG02010_WHS_NM"><img src="../img/search.png" alt=""></button>
194
-            <button id="ITP_BTN_MPOMNG02010_NEW_DELETE_WHS_NM"><img src="../img/delete.png" alt=""></button>
195
-          </div>
196
-        </div>
197
-      </div>
198
-      <div class="table_header">
199
-        <h1>> 구매 품목</h1>
200
-   		<button type="button" id="ITP_BTN_MPOMNG02010_NEW_DELROW" class="btn-primary btn-sm ADB">품목삭제</button>
201
-       	<button type="button" id="ITP_BTN_MPOMNG02010_NEW_ADDROW" class="btn-primary btn-sm ADB" data-call-popup="ITP_POP_MPOMNG02010_ITEM_AREA">품목추가</button>	     
202
-      </div>
203
-    </div>
204
-    <div id="ITP_LIST_MPOMNG02010_ITEM_AREA" class="scroll_area row-1">
205
-      <ul id="ITP_LIST_MPOMNG02010_NEW_ROWS"></ul>
206
-	  <div id="ITP_LIST_MPOMNG02010_NEW_ROWCOPY" style="display:block;">	    
207
-	    <li>
208
-          <div class="left_info">
209
-            <div class="check_box">
210
-                <div><input type="checkbox" id="ITP_FORM_MPOMNG01010_NEW_CHECKBOX" name="itemId" /></div>
211
-            </div>
212
-            <div class="thick">
213
-              <div class="fnItemNm">품목명</div>
214
-              <div>-</div>
215
-              <div class="fnUnit">2EA</div>
216
-            </div>
217
-            <div class="thick">
218
-              <label class="space0">구매가 :</label>
219
-              <div class="fnPchActAmt">1,120,000</div>
220
-            </div>
221
-          </div>
222
-          <div class="right">
223
-            <button id="ITP_BTN_MPOMNG02010_NEW_MINUS"><</button>
224
-            <div class="num fnNum">2</div>
225
-            <button id="ITP_BTN_MPOMNG02010_NEW_PLUS">></button>
226
-          </div>
227
-        </li>
228
-      </div>
229
-    </div>
230
-    <div class="button_bar">
231
-        <button id="ITP_BTN_MPOMNG02010_NEW_REQ_ORDER" data-call-popup="ITP_POP_MPOMNG02010_REQ_CONFIRM" class="col_3 btn-primary REQ">구매요청</button>
232
-        <button id="ITP_BTN_MPOMNG02010_NEW_TEMP_SAVE" class="col_3 btn-gray TSA">임시저장</button>
233
-        <button id="ITP_BTN_MPOMNG02010_NEW_CANCEL" class="col_3 btn-gray CLB">취소</button>
234
-    </div>
235
-  </form>
236
-</div>
237 164
 </section>

+ 359 - 0
src/main/webapp/mobile/js/app/mpomng/ITP_MPOMNG02010.js

@@ -0,0 +1,359 @@
1
+require(['config'], function() {
2
+	require([
3
+	], function($) {
4
+		mobPageObj.init();
5
+	});
6
+});
7
+
8
+/*API URL*/
9
+const API_MOBILE_INIT_INFO	= '/api/pomng/init-pchReq';
10
+const API_MOBILE_SAVE		= '/api/pomng/save-pchReq';
11
+const API_POP_SEARCH_LIST	= '/api/whs/mng/pop-whs-search';
12
+const API_POP_ITEM_LIST 	= '/api/item/pop-grid-list';
13
+
14
+const ID_ITP_POP_MPOMNG02010_REQ_AREA 	= "ITP_POP_MPOMNG02010_REQ_AREA";
15
+const ID_ITP_POP_MPOMNG02010_WHS_AREA 	= "ITP_POP_MPOMNG02010_WHS_AREA";
16
+const ID_ITP_POP_MPOMNG02010_ITEM_AREA 	= "ITP_POP_MPOMNG02010_ITEM_AREA";
17
+
18
+const PCH_REQ_ST_CD_TEMP_SAVE		="PR00";
19
+const PCH_REQ_ST_CD_REQUEST_SAVE	="PR20";
20
+
21
+let mobPageObj = {
22
+	init: function () {
23
+		this.ui.init();
24
+		this.event.init();
25
+		this.ready();
26
+	},
27
+	ui: {
28
+		init: function () {
29
+			this.info();
30
+		},
31
+		info: function() {
32
+			$('input:hidden[id$="_BRAND_ID"]').val(fn_make_user_info.get('brandId'));
33
+			$('input:hidden[id$="_STORE_ID"]').val(fn_make_user_info.get('storeId'));
34
+		}
35
+	},
36
+	event: {
37
+		init: function() {
38
+			this.button();
39
+		},
40
+		button: function() {
41
+			$('button[id^="ITP_BTN_MPOMNG02010_DETAIL"]').on('click', function() {
42
+				if($(this).is('[data-call-popup]')) {
43
+					mobPopObj.show($(this).data('call-popup'), $(this).attr('id'));
44
+				} else {
45
+					var id = $(this).attr('id');
46
+					switch (id) {
47
+						case 'ITP_BTN_MPOMNG02010_DETAIL_DELROW'		: mobContObj.list.delRow(); 	break;
48
+						case 'ITP_BTN_MPOMNG02010_DETAIL_SEARCH_WHS_NM'	: mobPopObj.popWhsNm.init(); 	break;
49
+						case 'ITP_BTN_MPOMNG02010_DETAIL_DELETE_WHS_NM'	: mobPopObj.popWhsNm.delete();	break;
50
+						case 'ITP_BTN_MPOMNG02010_DETAIL_TEMP_SAVE'		: break;
51
+						case 'ITP_BTN_MPOMNG02010_DETAIL_CANCEL'		: $(location).attr('href', MOBILE_CONTEXTPATH + '/app/main.html'); break;
52
+						case 'ITP_BTN_MPOMNG02010_DETAIL_PLUS'			: mobContObj.list.actPlus($(this));	break;
53
+						case 'ITP_BTN_MPOMNG02010_DETAIL_MINUS'			: break;
54
+					}
55
+				}
56
+				return false;
57
+			});
58
+		}
59
+	},
60
+	ready: function() {
61
+		mobContObj.init();
62
+	}
63
+};
64
+
65
+let mobContObj = {
66
+	init: function() {
67
+		this.button();
68
+		this.data.load();
69
+	},
70
+	button: function() {
71
+		var _this = this;
72
+		$(document).on('click', '.DETAIL_ITEM_PLUS', function() {
73
+			_this.list.actPlus($(this));
74
+		});
75
+		$(document).on('click', '.DETAIL_ITEM_MINUS', function() {
76
+			_this.list.actMinus($(this));
77
+		});
78
+	},
79
+	data: {
80
+		initPchReq: null,
81
+		load: function() {
82
+			var _this = this;
83
+			var callbackFn = function(result) {
84
+				console.log(result);
85
+				_this.initPchReq = result;
86
+				$('#ITP_FORM_MPOMNG02010_DETAIL #ITP_FORM_MPOMNG02010_DETAIL_BRAND_ID').val(result.brandId);
87
+				$('#ITP_FORM_MPOMNG02010_DETAIL #ITP_FORM_MPOMNG02010_DETAIL_STORE_ID').val(result.storeId);
88
+				$('#ITP_FORM_MPOMNG02010_DETAIL #ITP_FORM_MPOMNG02010_DETAIL_LOAN_DVSN').val(result.loanDvsn);
89
+				$('#ITP_FORM_MPOMNG02010_DETAIL #ITP_FORM_MPOMNG02010_DETAIL_LOAN_MGNT_UNQ_NO').val(result.loanMgntUnqNo);
90
+				$('#ITP_FORM_MPOMNG02010_DETAIL #ITP_FORM_MPOMNG02010_DETAIL_PCH_REQ_DVSN').val(result.pchReqDvsn);
91
+
92
+				$('#ITP_FORM_MPOMNG02010_DETAIL .fnOrdUseAmt').text(itp_fn_set_comma(result.ordUseAmt) + '원');
93
+			};
94
+			const param = {brandId:fn_make_user_info.get('brandId'), storeId:fn_make_user_info.get('storeId')};
95
+			fn_ajax_call(API_MOBILE_INIT_INFO, param, callbackFn, 'GET');
96
+		}
97
+	},
98
+	list: {
99
+		rows: [],
100
+		addRow: function() {
101
+		},
102
+		delRow: function() {
103
+			this.detachRow();
104
+		},
105
+		attachRow: function (item) {
106
+			console.log(item);
107
+			var fnIsExist = function(rows) {
108
+				var isExist = false;
109
+				$.each(rows, function(i, row) {
110
+					if(row.brandUnitUnqNo === item.brandUnitUnqNo) {
111
+						isExist = true;
112
+						return false;
113
+					}
114
+				});
115
+				return isExist;
116
+			};
117
+			if(!fnIsExist(this.rows)) {
118
+				this.rows.push(item);
119
+				$('#ITP_LIST_MPOMNG02010_ITEM_AREA .panel-group').append($('#ITP_LIST_MPOMNG02010_DETAIL_ROWCOPY').html());
120
+				var $li = $('#ITP_LIST_MPOMNG02010_ITEM_AREA .panel-group > .row_2:last');
121
+				$li.find('.fnBrandUnitUnqNo').val(item.brandUnitUnqNo);
122
+				$li.find('.fnItemNm').text(item.itemNm);
123
+				$li.find('.fnPchReqQty').text(item.pchReqQty);
124
+				$li.find('.fnUnitAmt').text(itp_fn_set_comma(item.unitAmt));
125
+				this.pchReqAmtTot();
126
+			}
127
+		},
128
+		detachRow: function () {
129
+			if($('#ITP_LIST_MPOMNG02010_ITEM_AREA input:checkbox[name=brandUnitUnqNo]:checked').length > 0) {
130
+				var _this = this;
131
+				$('#ITP_LIST_MPOMNG02010_DETAIL_ROWS li').each(function(index, elem) {
132
+					var isChecked = $(this).find('input[type="checkbox"]').is(':checked');
133
+					if(isChecked) {
134
+						$(this).remove();_this.rows.splice(index, 1);
135
+					}
136
+				});
137
+				this.pchReqAmtTot();
138
+			}
139
+		},
140
+		actPlus: function(elem) {
141
+			var $div = $(elem).siblings('div');
142
+			var num = Number($div.text());
143
+			$($div).text((num + 1).toString());
144
+			this.rows[$div.parents('li').index()]['pchReqQty'] = $($div).text();
145
+			this.pchReqAmtTot();
146
+		},
147
+		actMinus: function(elem) {
148
+			var $div = $(elem).siblings('div');
149
+			var num = Number($div.text());
150
+			if(num <= 1) {
151
+				alert('주문수량을 확인하세요.');
152
+			} else {
153
+				$($div).text((num - 1).toString());
154
+				this.rows[$div.parents('li').index()]['pchReqQty'] = $($div).text();
155
+				this.pchReqAmtTot();
156
+			}
157
+		},
158
+		pchReqAmtTot: function() {
159
+			var reqAmt = 0;
160
+			$.each(this.rows, function(index, item) {
161
+				var qty = item.pchReqQty;
162
+				var amt = item.unitAmt;
163
+				reqAmt += Number(qty) * amt;
164
+			});
165
+			$('#ITP_AJAX_MPOMNG02010_VIEW_CONTAINER').find('.fnPchReqAmtTot').text(itp_fn_set_comma(reqAmt));
166
+		}
167
+	}
168
+};
169
+
170
+let mobPopObj = {
171
+	init: function(popId, parentId) {
172
+		switch (popId) {
173
+			case 'ITP_POP_MPOMNG02010_REQ_AREA'		: this.popReqConfirm.init(parentId); 	break;
174
+			case 'ITP_POP_MPOMNG02010_WHS_AREA'		: this.popWhsNm.init(); 				break;
175
+			case 'ITP_POP_MPOMNG02010_ITEM_AREA'	: this.popItem.init();					break;
176
+		}
177
+	},
178
+	popItem: {
179
+		// rows: null,
180
+		init: function() {
181
+			this.search();
182
+		},
183
+		search: function() {
184
+			$('#ITP_LIST_MPOMNG02010_POP_ITEM_AREA .panel-group').empty();
185
+			var callbackFn = function(result) {
186
+				console.log(result);
187
+				mobPopObj.popItem.rows = result.gridRows;
188
+				$.each(mobPopObj.popItem.rows, function (i, item) {
189
+					$('#ITP_LIST_MPOMNG02010_POP_ITEM_AREA .panel-group').append($('#ITP_LIST_MPOMNG02010_POP_ITEM_ROWCOPY').html());
190
+					var $li = $('#ITP_LIST_MPOMNG02010_POP_ITEM_AREA .panel-group > .row_2:last');
191
+					$li.find('#ITP_FORM_MPOMNG02010_POP_ITEM_CHECKBOX').val(item.itemId);
192
+					$li.find('.fnItemNm').text(item.itemNm);
193
+					$li.find('.fnUnitAmt').text(itp_fn_set_comma(item.unitAmt));
194
+				});
195
+				mobPopObj.popItem.addRow.init();
196
+			};
197
+			let param = $('#ITP_FORM_MPOMNG02010_POPUP_ITEM').serializeObject();
198
+			fn_ajax_call(API_POP_ITEM_LIST, JSON.stringify(param), callbackFn, 'POST');
199
+		},
200
+		addRow: {
201
+			init: function() {
202
+				this.button.init();
203
+			},
204
+			button: {
205
+				init: function() {
206
+					var _this = this;
207
+					$('button[id^="ITP_BTN_MPOMNG02010_POP_ITEM_"]').off('click').on('click', function() {
208
+						var id = $(this).attr('id');
209
+						switch (id) {
210
+							case 'ITP_BTN_MPOMNG02010_POP_ITEM_PLUS'	: _this.actPlus($(this)); 		break;
211
+							case 'ITP_BTN_MPOMNG02010_POP_ITEM_MINUS'	: _this.actMinus($(this)); 		break;
212
+							case 'ITP_BTN_MPOMNG02010_POP_ITEM_ADD'		: _this.actItemAdd($(this)); 	break;
213
+							case 'ITP_BTN_MPOMNG02010_POP_ITEM_SEARCH'	: mobPopObj.popItem.search(); 	break;
214
+							case 'ITP_BTN_MPOMNG02010_POP_ITEM_CLOSE'	: mobPopObj.hide(id); 			break;
215
+						}
216
+						return false;
217
+					});
218
+				},
219
+				actPlus: function(elem) {
220
+					var $div = $(elem).siblings('div');
221
+					var num = Number($div.text());
222
+					$($div).text((num + 1).toString());
223
+				},
224
+				actMinus: function(elem) {
225
+					var $div = $(elem).siblings('div');
226
+					var num = Number($div.text());
227
+					if(num <= 1) {
228
+						alert('주문수량을 확인하세요.');
229
+					} else {
230
+						$($div).text((num - 1).toString());
231
+					}
232
+				},
233
+				actItemAdd: function(elem) {
234
+					var index = $(elem).closest('li').index();
235
+					var item = mobPopObj.popItem.rows[index];
236
+					item['pchReqQty'] = $(elem).closest('li').find('.fnPchReqQty').html();
237
+					mobContObj.list.attachRow(item);
238
+				}
239
+			}
240
+		},
241
+		delRow: function() {
242
+
243
+		}
244
+	},
245
+	popWhsNm: {
246
+		init: function () {
247
+			this.rows.length = 0;
248
+			this.search();
249
+			this.action();
250
+		},
251
+		rows: [],
252
+		search: function () {
253
+			var _this = this;
254
+			$('#ITP_LIST_MPOMNG02010_POP_WHS_AREA .panel-group').empty();
255
+			var callbackFn = function(result) {
256
+				console.log(result);
257
+				_this.view(result.gridRows);
258
+			};
259
+			const param = $('#ITP_FORM_MPOMNG02010_POP_WHS').serializeObject();
260
+			fn_ajax_call(API_POP_SEARCH_LIST, JSON.stringify(param), callbackFn, 'POST');
261
+		},
262
+		view: function(gridRows) {
263
+			this.rows = gridRows;
264
+			$.each(gridRows, function (i, item) {
265
+				$('#ITP_LIST_MPOMNG02010_POP_WHS_AREA .panel-group').append($('#ITP_LIST_MPOMNG02010_POP_WHS_ROWCOPY').html());
266
+				var $li = $('#ITP_LIST_MPOMNG02010_POP_WHS_AREA .panel-group > .row_2:last');
267
+				$li.find('.fnWhsNm').text(item.whsNm);
268
+				$li.find('.fnLocationNm').text(item.locationNm);
269
+				$li.find('.fnWhsId').data('whs-id', item.whsId);
270
+			});
271
+		},
272
+		action: function() {
273
+			var _this = this;
274
+			$('#ITP_LIST_MPOMNG02010_POP_WHS_AREA button[id$="POP_WHS_CHOICE"]').off('click').on('click', function() {
275
+				var whsId = $(this).data('whs-id');
276
+				$.each(_this.rows, function (i, item) {
277
+					if(whsId === item.whsId) {
278
+						$('#ITP_FORM_MPOMNG02010_DETAIL #ITP_FORM_MPOMNG02010_DETAIL_WHS_ID').val(item.whsId);
279
+						$('#ITP_FORM_MPOMNG02010_DETAIL #ITP_FORM_MPOMNG02010_DETAIL_WHS_NM').val(item.whsNm);
280
+						$('#ITP_FORM_MPOMNG02010_DETAIL #ITP_FORM_MPOMNG02010_DETAIL_LOCATION').val(item.location);
281
+						mobPopObj.hide(ID_ITP_POP_MPOMNG02010_WHS_AREA);
282
+						itp_fn_form_clear_validate(null, '#ITP_FORM_MPOMNG02010_DETAIL');
283
+						return false;
284
+					}
285
+				});
286
+			});
287
+			$('#ITP_FORM_MPOMNG02010_POP_WHS button[id="ITP_BTN_MPOMNG02010_POP_WHS_SEARCH"]').off('click').on('click', function() {
288
+				_this.search();
289
+			});
290
+		},
291
+		delete: function() {
292
+			$('#ITP_FORM_MPOMNG02010_DETAIL #ITP_FORM_MPOMNG02010_DETAIL_WHS_ID').val('');
293
+			$('#ITP_FORM_MPOMNG02010_DETAIL #ITP_FORM_MPOMNG02010_DETAIL_WHS_NM').val('');
294
+			$('#ITP_FORM_MPOMNG02010_DETAIL #ITP_FORM_MPOMNG02010_DETAIL_LOCATION').val('');
295
+		}
296
+	},
297
+	popReqConfirm: {
298
+		init: function (parentId) {
299
+			this.pchReqStCd = (parentId === 'ITP_BTN_MPOMNG02010_DETAIL_REQ_ORDER') ? PCH_REQ_ST_CD_REQUEST_SAVE : PCH_REQ_ST_CD_TEMP_SAVE;
300
+			this.view();
301
+			this.action();
302
+		},
303
+		view: function() {
304
+			if(this.pchReqStCd === PCH_REQ_ST_CD_REQUEST_SAVE) {
305
+				$('#ITP_POP_MPOMNG02010_REQ_AREA .msg_save').text('구매요청 하시겠습니까?');
306
+			} else {
307
+				$('#ITP_POP_MPOMNG02010_REQ_AREA .msg_save').text('임시저장 하시겠습니까?');
308
+			}
309
+			$('#ITP_POP_MPOMNG02010_REQ_AREA .fnPopDlvReqDt').text($('#ITP_FORM_MPOMNG02010_DETAIL #ITP_FORM_MPOMNG02010_DETAIL_DLV_REQ_DT').val());
310
+			$('#ITP_POP_MPOMNG02010_REQ_AREA .fnItemQty').text(CommonObj.currency.add(mobContObj.list.rows.length, '개'));
311
+			$('#ITP_POP_MPOMNG02010_REQ_AREA .fnOrdAmt').text(CommonObj.currency.add($('#ITP_FORM_MPOMNG02010_DETAIL .fnPchReqAmtTot').text()));
312
+		},
313
+		action: function() {
314
+			var _this = this;
315
+			$('#ITP_POP_MPOMNG02010_REQ_AREA button[id="ITP_BTN_MPOMNG02010_POP_REQ_CONFIRM"]').off('click').on('click', function() {
316
+				$('#ITP_FORM_MPOMNG02010_DETAIL #ITP_FORM_MPOMNG02010_DETAIL_PCH_REQ_ST_CD').val(_this.pchReqStCd);
317
+				_this.save('#ITP_FORM_MPOMNG02010_DETAIL');
318
+			});
319
+		},
320
+		save: function(formId) {
321
+			let param = $(formId).serializeObject();
322
+			// let gridInsertData = [];
323
+			$.each(mobContObj.list.rows, function(index, item) {
324
+				item['viewCd'] = 'C';
325
+			});
326
+			param.gridInsertData = mobContObj.list.rows;
327
+			param['dlvReqDt'] = param.dlvReqDt.replace(/[^0-9]/g, "");
328
+			console.log(JSON.stringify(param));
329
+			var saveFn = function (result) {
330
+				console.log(result);
331
+				mobPopObj.hide('ITP_POP_MPOMNG02010_REQ_AREA');
332
+			};
333
+			fn_ajax_call(API_MOBILE_SAVE, JSON.stringify(param), saveFn, 'POST');
334
+		}
335
+	},
336
+	show: function(popId, parentId) {
337
+		var _this = this;
338
+		$('button[id$="CLOSE"]').off('click').on('click', function() {
339
+			var id = $(this).attr('id');
340
+			if($(this).hasClass('btn-pop-close')) {
341
+				_this.hide(id);
342
+			}
343
+		});
344
+		if(parentId === 'ITP_BTN_MPOMNG02010_DETAIL_REQ_ORDER' || parentId === 'ITP_BTN_MPOMNG02010_DETAIL_TEMP_SAVE') {
345
+			var formId = '#ITP_FORM_MPOMNG02010_DETAIL';
346
+			itp_fn_form_clear_validate(null, formId);
347
+			if (itp_fn_form_event.isValid(formId)) {
348
+				$('#' + popId).show();
349
+				mobPopObj.init(popId, parentId);
350
+			}
351
+		} else {
352
+			$('#' + popId).show();
353
+			mobPopObj.init(popId, parentId);
354
+		}
355
+	},
356
+	hide: function(id) {
357
+		$('#' + id).closest('.mobile-pop-close').hide();
358
+	}
359
+};