Browse Source

모바일 구매요청생성 복원

juney 2 years ago
parent
commit
296bcf9dc3

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

@@ -7,13 +7,13 @@
7
       </div>
7
       </div>
8
       <div class="pop_line">
8
       <div class="pop_line">
9
         <label>품목수&nbsp;&nbsp; :</label>
9
         <label>품목수&nbsp;&nbsp; :</label>
10
-        <div class="fnPop">2개</div>
10
+        <div class="fnItemQty">2개</div>
11
       </div>
11
       </div>
12
       <div class="pop_line">
12
       <div class="pop_line">
13
         <label>구매금액 &nbsp;&nbsp;:</label>
13
         <label>구매금액 &nbsp;&nbsp;:</label>
14
-        <div class="fnPop">2022.09.30원</div>
14
+        <div class="fnOrdAmt">2022.09.30원</div>
15
       </div>
15
       </div>
16
-      <label class="pop_label">구매요청 하시겠습니까?</label>
16
+      <label class="pop_label msg_save">구매요청 하시겠습니까?</label>
17
       <div class="popup_btn">
17
       <div class="popup_btn">
18
         <button id="ITP_BTN_MPOMNG01010_POP_REQ_CLOSE" class="cancel btn-gray CLB btn-pop-close">취소</button>
18
         <button id="ITP_BTN_MPOMNG01010_POP_REQ_CLOSE" class="cancel btn-gray CLB btn-pop-close">취소</button>
19
         <button id="ITP_BTN_MPOMNG01010_POP_REQ_CONFIRM" class="ok btn-primary COK">확인</button>
19
         <button id="ITP_BTN_MPOMNG01010_POP_REQ_CONFIRM" class="ok btn-primary COK">확인</button>
@@ -32,23 +32,25 @@
32
       </div>
32
       </div>
33
       <div class="search_bar">
33
       <div class="search_bar">
34
         <form id="ITP_FORM_MPOMNG01010_POP_WHS" class="form-horizontal" onsubmit="return false;">
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
           <button id="ITP_BTN_MPOMNG01010_POP_WHS_SEARCH"><img src="../img/search.png"></button>
38
           <button id="ITP_BTN_MPOMNG01010_POP_WHS_SEARCH"><img src="../img/search.png"></button>
37
         </form>
39
         </form>
38
       </div>
40
       </div>
39
       <div class="search_bar">
41
       <div class="search_bar">
40
         <button id="ITP_BTN_MPOMNG01010_POP_WHS_NM" class="btn_blue">납품장소▼</button>
42
         <button id="ITP_BTN_MPOMNG01010_POP_WHS_NM" class="btn_blue">납품장소▼</button>
41
       </div>
43
       </div>
42
-      <div class="popup_scroll">
44
+        <div id="ITP_LIST_MPOMNG01010_POP_WHS_AREA" class="popup_scroll">
43
         <ul id="ITP_LIST_MPOMNG01010_POP_WHS_ROWS" class="panel-group itp_nav"></ul>
45
         <ul id="ITP_LIST_MPOMNG01010_POP_WHS_ROWS" class="panel-group itp_nav"></ul>
44
         <div id="ITP_LIST_MPOMNG01010_POP_WHS_ROWCOPY" style="display:none;">
46
         <div id="ITP_LIST_MPOMNG01010_POP_WHS_ROWCOPY" style="display:none;">
45
-          <li>
47
+            <li class="row_2">
46
             <div class="scroll_left">
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
             </div>
51
             </div>
50
             <div class="scroll_right">
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
             </div>
54
             </div>
53
           </li>
55
           </li>
54
         </div>
56
         </div>
@@ -79,23 +81,15 @@
79
         <div id="ITP_LIST_MPOMNG01010_POP_ITEM_AREA" class="popup_scroll">
81
         <div id="ITP_LIST_MPOMNG01010_POP_ITEM_AREA" class="popup_scroll">
80
             <ul id="ITP_LIST_MPOMNG01010_POP_ITEM_ROWS" class="panel-group"></ul>
82
             <ul id="ITP_LIST_MPOMNG01010_POP_ITEM_ROWS" class="panel-group"></ul>
81
             <div id="ITP_LIST_MPOMNG01010_POP_ITEM_ROWCOPY" style="display:none;">
83
             <div id="ITP_LIST_MPOMNG01010_POP_ITEM_ROWCOPY" style="display:none;">
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="">
91
-                    <div class="left" style="width:200px;">
84
+                <li class="row_2">
85
+                    <div class="left" style="width:180px;">
92
                         <!--<div class="check_box">
86
                         <!--<div class="check_box">
93
                             <input type="checkbox" id="ITP_FORM_MPOMNG01010_POP_ITEM_CHECKBOX" name="itemId" />
87
                             <input type="checkbox" id="ITP_FORM_MPOMNG01010_POP_ITEM_CHECKBOX" name="itemId" />
94
                         </div>-->
88
                         </div>-->
95
                         <div class="thick">
89
                         <div class="thick">
96
                             <div class="fnItemNm">품목명</div>
90
                             <div class="fnItemNm">품목명</div>
97
                             <div>-</div>
91
                             <div>-</div>
98
-                            <div class="fnOrdUnit">EA</div>
92
+                            <div class="fnUnit">EA</div>
99
                         </div>
93
                         </div>
100
                         <div class="thick" style="font-weight:100;">
94
                         <div class="thick" style="font-weight:100;">
101
                             <div class="space">구매가 :</div>
95
                             <div class="space">구매가 :</div>
@@ -104,7 +98,7 @@
104
                     </div>
98
                     </div>
105
                     <div class="right">
99
                     <div class="right">
106
                         <button id="ITP_BTN_MPOMNG01010_POP_ITEM_MINUS" class="POP_ITEM_MINUS">-</button>
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
                         <button id="ITP_BTN_MPOMNG01010_POP_ITEM_PLUS" class="POP_ITEM_PLUS">+</button>
102
                         <button id="ITP_BTN_MPOMNG01010_POP_ITEM_PLUS" class="POP_ITEM_PLUS">+</button>
109
                     </div>
103
                     </div>
110
                     <div class="add">
104
                     <div class="add">
@@ -124,15 +118,16 @@
124
       <input type="hidden" id="ITP_FORM_MPOMNG01010_DETAIL_LOAN_DVSN" name="loanDvsn" value="">
118
       <input type="hidden" id="ITP_FORM_MPOMNG01010_DETAIL_LOAN_DVSN" name="loanDvsn" value="">
125
       <input type="hidden" id="ITP_FORM_MPOMNG01010_DETAIL_LOAN_MGNT_UNQ_NO" name="loanMgntUnqNo" value="">
119
       <input type="hidden" id="ITP_FORM_MPOMNG01010_DETAIL_LOAN_MGNT_UNQ_NO" name="loanMgntUnqNo" value="">
126
       <input type="hidden" id="ITP_FORM_MPOMNG01010_DETAIL_PCH_REQ_DVSN" name="pchReqDvsn" value="">
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
       <div class="content">
122
       <div class="content">
128
         <div class="line">
123
         <div class="line">
129
           <label>납기요청일</label>
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
         </div>
126
         </div>
132
         <div class="line">
127
         <div class="line">
133
           <label>구매요청금액</label>
128
           <label>구매요청금액</label>
134
           <div class="line_right">
129
           <div class="line_right">
135
-            <div class="fnPchReqAmt">0원</div>
130
+            <div class="fnPchReqAmtTot">0원</div>
136
           </div>
131
           </div>
137
         </div>
132
         </div>
138
         <div class="line">
133
         <div class="line">
@@ -145,7 +140,9 @@
145
           <label>납품장소</label>
140
           <label>납품장소</label>
146
           <div class="search_nm">
141
           <div class="search_nm">
147
             <div class="float_left">
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
             </div>
146
             </div>
150
             <div class="float_left_btn">
147
             <div class="float_left_btn">
151
               <button id="ITP_BTN_MPOMNG01010_DETAIL_SEARCH_WHS_NM" data-call-popup="ITP_POP_MPOMNG01010_WHS_AREA"><img src="../img/search.png" alt=""></button>
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>
@@ -161,13 +158,13 @@
161
           </div>
158
           </div>
162
         </div>
159
         </div>
163
       </div>
160
       </div>
164
-      <div id="ITP_LIST_MPOMNG01010_ITEM_AREA" class="scroll_area row-1">
161
+      <div id="ITP_LIST_MPOMNG01010_ITEM_AREA" class="scroll_area row-1-1">
165
         <ul id="ITP_LIST_MPOMNG01010_DETAIL_ROWS" class="panel-group"></ul>
162
         <ul id="ITP_LIST_MPOMNG01010_DETAIL_ROWS" class="panel-group"></ul>
166
         <div id="ITP_LIST_MPOMNG01010_DETAIL_ROWCOPY" style="display:none;">
163
         <div id="ITP_LIST_MPOMNG01010_DETAIL_ROWCOPY" style="display:none;">
167
           <li class="row_2">
164
           <li class="row_2">
168
             <div class="left_info">
165
             <div class="left_info">
169
-              <div class="thick">
170
-                <div><input type="checkbox" name="itemId" class="fnBrandUnitUnqNo" /></div>
166
+              <div class="check_box"><!-- class 변경 -->
167
+                <div><input type="checkbox" name="brandUnitUnqNo" class="fnBrandUnitUnqNo" /></div>
171
               </div>
168
               </div>
172
               <div class="thick">
169
               <div class="thick">
173
                 <div class="fnItemNm">품목명</div>
170
                 <div class="fnItemNm">품목명</div>
@@ -180,16 +177,16 @@
180
               </div>
177
               </div>
181
             </div>
178
             </div>
182
             <div class="right">
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
             </div>
183
             </div>
187
           </li>
184
           </li>
188
         </div>
185
         </div>
189
       </div>
186
       </div>
190
       <div class="button_bar">
187
       <div class="button_bar">
191
         <button id="ITP_BTN_MPOMNG01010_DETAIL_REQ_ORDER" data-call-popup="ITP_POP_MPOMNG01010_REQ_AREA" class="col_3 btn-primary REQ">구매요청</button>
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
         <button id="ITP_BTN_MPOMNG01010_DETAIL_CANCEL" class="col_3 btn-gray CLB">취소</button>
190
         <button id="ITP_BTN_MPOMNG01010_DETAIL_CANCEL" class="col_3 btn-gray CLB">취소</button>
194
       </div>
191
       </div>
195
     </form>
192
     </form>

+ 197 - 43
src/main/webapp/mobile/js/app/mpomng/ITP_MPOMNG01010.js

@@ -11,6 +11,13 @@ const API_MOBILE_SAVE		= '/api/pomng/save-pchReq';
11
 const API_POP_SEARCH_LIST	= '/api/whs/mng/pop-whs-search';
11
 const API_POP_SEARCH_LIST	= '/api/whs/mng/pop-whs-search';
12
 const API_POP_ITEM_LIST 	= '/api/item/pop-grid-list';
12
 const API_POP_ITEM_LIST 	= '/api/item/pop-grid-list';
13
 
13
 
14
+const ID_ITP_POP_MPOMNG01010_REQ_AREA 	= "ITP_POP_MPOMNG01010_REQ_AREA";
15
+const ID_ITP_POP_MPOMNG01010_WHS_AREA 	= "ITP_POP_MPOMNG01010_WHS_AREA";
16
+const ID_ITP_POP_MPOMNG01010_ITEM_AREA 	= "ITP_POP_MPOMNG01010_ITEM_AREA";
17
+
18
+const PCH_REQ_ST_CD_TEMP_SAVE		="PR00";
19
+const PCH_REQ_ST_CD_REQUEST_SAVE	="PR20";
20
+
14
 let mobPageObj = {
21
 let mobPageObj = {
15
 	init: function () {
22
 	init: function () {
16
 		this.ui.init();
23
 		this.ui.init();
@@ -33,15 +40,17 @@ let mobPageObj = {
33
 		button: function() {
40
 		button: function() {
34
 			$('button[id^="ITP_BTN_MPOMNG01010_DETAIL"]').on('click', function() {
41
 			$('button[id^="ITP_BTN_MPOMNG01010_DETAIL"]').on('click', function() {
35
 				if($(this).is('[data-call-popup]')) {
42
 				if($(this).is('[data-call-popup]')) {
36
-					console.log($(this).attr('id'));
37
-					mobPopObj.show($(this).data('call-popup'));
43
+					mobPopObj.show($(this).data('call-popup'), $(this).attr('id'));
38
 				} else {
44
 				} else {
39
 					var id = $(this).attr('id');
45
 					var id = $(this).attr('id');
40
 					switch (id) {
46
 					switch (id) {
41
-						case 'ITP_BTN_MPOMNG01010_DETAIL_DELROW': contPopObj.list.delRow(); break;
42
-						case 'ITP_BTN_MPOMNG01010_DETAIL_DELETE_WHS_NM': break;
43
-						case 'ITP_BTN_MPOMNG01010_DETAIL_TEMP_SAVE': break;
44
-						case 'ITP_BTN_MPOMNG01010_DETAIL_CANCEL':break;
47
+						case 'ITP_BTN_MPOMNG01010_DETAIL_DELROW'		: mobContObj.list.delRow(); 	break;
48
+						case 'ITP_BTN_MPOMNG01010_DETAIL_SEARCH_WHS_NM'	: mobPopObj.popWhsNm.init(); 	break;
49
+						case 'ITP_BTN_MPOMNG01010_DETAIL_DELETE_WHS_NM'	: mobPopObj.popWhsNm.delete();	break;
50
+						case 'ITP_BTN_MPOMNG01010_DETAIL_TEMP_SAVE'		: break;
51
+						case 'ITP_BTN_MPOMNG01010_DETAIL_CANCEL'		: $(location).attr('href', MOBILE_CONTEXTPATH + '/app/main.html'); break;
52
+						case 'ITP_BTN_MPOMNG01010_DETAIL_PLUS'			: mobContObj.list.actPlus($(this));	break;
53
+						case 'ITP_BTN_MPOMNG01010_DETAIL_MINUS'			: break;
45
 					}
54
 					}
46
 				}
55
 				}
47
 				return false;
56
 				return false;
@@ -49,19 +58,30 @@ let mobPageObj = {
49
 		}
58
 		}
50
 	},
59
 	},
51
 	ready: function() {
60
 	ready: function() {
52
-		contPopObj.init();
61
+		mobContObj.init();
53
 	}
62
 	}
54
 };
63
 };
55
 
64
 
56
-let contPopObj = {
65
+let mobContObj = {
57
 	init: function() {
66
 	init: function() {
67
+		this.button();
58
 		this.data.load();
68
 		this.data.load();
59
 	},
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
+	},
60
 	data: {
79
 	data: {
61
 		initPchReq: null,
80
 		initPchReq: null,
62
 		load: function() {
81
 		load: function() {
63
 			var _this = this;
82
 			var _this = this;
64
 			var callbackFn = function(result) {
83
 			var callbackFn = function(result) {
84
+				console.log(result);
65
 				_this.initPchReq = result;
85
 				_this.initPchReq = result;
66
 				$('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_BRAND_ID').val(result.brandId);
86
 				$('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_BRAND_ID').val(result.brandId);
67
 				$('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_STORE_ID').val(result.storeId);
87
 				$('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_STORE_ID').val(result.storeId);
@@ -71,8 +91,8 @@ let contPopObj = {
71
 
91
 
72
 				$('#ITP_FORM_MPOMNG01010_DETAIL .fnOrdUseAmt').text(itp_fn_set_comma(result.ordUseAmt) + '원');
92
 				$('#ITP_FORM_MPOMNG01010_DETAIL .fnOrdUseAmt').text(itp_fn_set_comma(result.ordUseAmt) + '원');
73
 			};
93
 			};
74
-			const key = {brandId:fn_make_user_info.get('brandId'), storeId:fn_make_user_info.get('storeId')};
75
-			fn_ajax_call(API_MOBILE_INIT_INFO, key, callbackFn, 'GET');
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');
76
 		}
96
 		}
77
 	},
97
 	},
78
 	list: {
98
 	list: {
@@ -100,42 +120,74 @@ let contPopObj = {
100
 				var $li = $('#ITP_LIST_MPOMNG01010_ITEM_AREA .panel-group > .row_2:last');
120
 				var $li = $('#ITP_LIST_MPOMNG01010_ITEM_AREA .panel-group > .row_2:last');
101
 				$li.find('.fnBrandUnitUnqNo').val(item.brandUnitUnqNo);
121
 				$li.find('.fnBrandUnitUnqNo').val(item.brandUnitUnqNo);
102
 				$li.find('.fnItemNm').text(item.itemNm);
122
 				$li.find('.fnItemNm').text(item.itemNm);
123
+				$li.find('.fnPchReqQty').text(item.pchReqQty);
103
 				$li.find('.fnUnitAmt').text(itp_fn_set_comma(item.unitAmt));
124
 				$li.find('.fnUnitAmt').text(itp_fn_set_comma(item.unitAmt));
125
+				this.pchReqAmtTot();
104
 			}
126
 			}
105
 		},
127
 		},
106
 		detachRow: function () {
128
 		detachRow: function () {
107
-			$('#ITP_LIST_MPOMNG01010_DETAIL_ROWS li').each(function(index, elem) {
108
-				var isChecked = $(this).find('input[type="checkbox"]').is(':checked');
109
-				console.log(index + " ===> " + isChecked);
129
+			if($('#ITP_LIST_MPOMNG01010_ITEM_AREA input:checkbox[name=brandUnitUnqNo]:checked').length > 0) {
130
+				var _this = this;
131
+				$('#ITP_LIST_MPOMNG01010_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;
110
 			});
164
 			});
165
+			$('#ITP_AJAX_MPOMNG01010_VIEW_CONTAINER').find('.fnPchReqAmtTot').text(itp_fn_set_comma(reqAmt));
111
 		}
166
 		}
112
 	}
167
 	}
113
 };
168
 };
114
 
169
 
115
 let mobPopObj = {
170
 let mobPopObj = {
171
+	init: function(popId, parentId) {
172
+		switch (popId) {
173
+			case 'ITP_POP_MPOMNG01010_REQ_AREA'		: this.popReqConfirm.init(parentId); 	break;
174
+			case 'ITP_POP_MPOMNG01010_WHS_AREA'		: this.popWhsNm.init(); 				break;
175
+			case 'ITP_POP_MPOMNG01010_ITEM_AREA'	: this.popItem.init();					break;
176
+		}
177
+	},
116
 	popItem: {
178
 	popItem: {
117
-		parentFn: null,
118
-		rows: null,
119
-		init: function(fn) {
120
-			console.log(fn);
121
-			this.parentFn = fn;
179
+		// rows: null,
180
+		init: function() {
122
 			this.search();
181
 			this.search();
123
 		},
182
 		},
124
 		search: function() {
183
 		search: function() {
125
 			$('#ITP_LIST_MPOMNG01010_POP_ITEM_AREA .panel-group').empty();
184
 			$('#ITP_LIST_MPOMNG01010_POP_ITEM_AREA .panel-group').empty();
126
 			var callbackFn = function(result) {
185
 			var callbackFn = function(result) {
186
+				console.log(result);
127
 				mobPopObj.popItem.rows = result.gridRows;
187
 				mobPopObj.popItem.rows = result.gridRows;
128
 				$.each(mobPopObj.popItem.rows, function (i, item) {
188
 				$.each(mobPopObj.popItem.rows, function (i, item) {
129
 					$('#ITP_LIST_MPOMNG01010_POP_ITEM_AREA .panel-group').append($('#ITP_LIST_MPOMNG01010_POP_ITEM_ROWCOPY').html());
189
 					$('#ITP_LIST_MPOMNG01010_POP_ITEM_AREA .panel-group').append($('#ITP_LIST_MPOMNG01010_POP_ITEM_ROWCOPY').html());
130
 					var $li = $('#ITP_LIST_MPOMNG01010_POP_ITEM_AREA .panel-group > .row_2:last');
190
 					var $li = $('#ITP_LIST_MPOMNG01010_POP_ITEM_AREA .panel-group > .row_2:last');
131
-					$li.data('brandUnitUnqNo', item.brandUnitUnqNo);
132
-					$li.data('podrPssblDvsn', item.podrPssblDvsn);
133
-					$li.data('spplyId', item.spplyId);
134
-					$li.data('stddQty', item.stddQty);
135
-					$li.data('storeUnitUnqNo', item.storeUnitUnqNo);
136
-					$li.data('unit', item.unit);
137
-					$li.data('unitAmt', item.unitAmt);
138
-					$li.data('unitGubun', item.unitGubun);
139
 					$li.find('#ITP_FORM_MPOMNG01010_POP_ITEM_CHECKBOX').val(item.itemId);
191
 					$li.find('#ITP_FORM_MPOMNG01010_POP_ITEM_CHECKBOX').val(item.itemId);
140
 					$li.find('.fnItemNm').text(item.itemNm);
192
 					$li.find('.fnItemNm').text(item.itemNm);
141
 					$li.find('.fnUnitAmt').text(itp_fn_set_comma(item.unitAmt));
193
 					$li.find('.fnUnitAmt').text(itp_fn_set_comma(item.unitAmt));
@@ -151,27 +203,26 @@ let mobPopObj = {
151
 			},
203
 			},
152
 			button: {
204
 			button: {
153
 				init: function() {
205
 				init: function() {
154
-					console.log('button');
155
 					var _this = this;
206
 					var _this = this;
156
 					$('button[id^="ITP_BTN_MPOMNG01010_POP_ITEM_"]').off('click').on('click', function() {
207
 					$('button[id^="ITP_BTN_MPOMNG01010_POP_ITEM_"]').off('click').on('click', function() {
157
 						var id = $(this).attr('id');
208
 						var id = $(this).attr('id');
158
 						switch (id) {
209
 						switch (id) {
159
-							case 'ITP_BTN_MPOMNG01010_POP_ITEM_PLUS': _this.actPlus($(this)); break;
160
-							case 'ITP_BTN_MPOMNG01010_POP_ITEM_MINUS': _this.actMinus($(this)); break;
161
-							case 'ITP_BTN_MPOMNG01010_POP_ITEM_ADD': _this.actItemAdd($(this)); break;
162
-							case 'ITP_BTN_MPOMNG01010_POP_ITEM_SEARCH': mobPopObj.popItem.search(); break;
163
-							case 'ITP_BTN_MPOMNG01010_POP_ITEM_CLOSE': mobPopObj.hide(id); break;
210
+							case 'ITP_BTN_MPOMNG01010_POP_ITEM_PLUS'	: _this.actPlus($(this)); 		break;
211
+							case 'ITP_BTN_MPOMNG01010_POP_ITEM_MINUS'	: _this.actMinus($(this)); 		break;
212
+							case 'ITP_BTN_MPOMNG01010_POP_ITEM_ADD'		: _this.actItemAdd($(this)); 	break;
213
+							case 'ITP_BTN_MPOMNG01010_POP_ITEM_SEARCH'	: mobPopObj.popItem.search(); 	break;
214
+							case 'ITP_BTN_MPOMNG01010_POP_ITEM_CLOSE'	: mobPopObj.hide(id); 			break;
164
 						}
215
 						}
165
 						return false;
216
 						return false;
166
 					});
217
 					});
167
 				},
218
 				},
168
 				actPlus: function(elem) {
219
 				actPlus: function(elem) {
169
-					var $div = $(elem).closest('div').find('.num');
220
+					var $div = $(elem).siblings('div');
170
 					var num = Number($div.text());
221
 					var num = Number($div.text());
171
 					$($div).text((num + 1).toString());
222
 					$($div).text((num + 1).toString());
172
 				},
223
 				},
173
 				actMinus: function(elem) {
224
 				actMinus: function(elem) {
174
-					var $div = $(elem).closest('div').find('.num');
225
+					var $div = $(elem).siblings('div');
175
 					var num = Number($div.text());
226
 					var num = Number($div.text());
176
 					if(num <= 1) {
227
 					if(num <= 1) {
177
 						alert('주문수량을 확인하세요.');
228
 						alert('주문수량을 확인하세요.');
@@ -181,7 +232,9 @@ let mobPopObj = {
181
 				},
232
 				},
182
 				actItemAdd: function(elem) {
233
 				actItemAdd: function(elem) {
183
 					var index = $(elem).closest('li').index();
234
 					var index = $(elem).closest('li').index();
184
-					contPopObj.list.attachRow(mobPopObj.popItem.rows[index]);
235
+					var item = mobPopObj.popItem.rows[index];
236
+					item['pchReqQty'] = $(elem).closest('li').find('.fnPchReqQty').html();
237
+					mobContObj.list.attachRow(item);
185
 				}
238
 				}
186
 			}
239
 			}
187
 		},
240
 		},
@@ -190,23 +243,124 @@ let mobPopObj = {
190
 		}
243
 		}
191
 	},
244
 	},
192
 	popWhsNm: {
245
 	popWhsNm: {
193
-
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_MPOMNG01010_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_MPOMNG01010_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_MPOMNG01010_POP_WHS_AREA .panel-group').append($('#ITP_LIST_MPOMNG01010_POP_WHS_ROWCOPY').html());
266
+				var $li = $('#ITP_LIST_MPOMNG01010_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_MPOMNG01010_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_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_WHS_ID').val(item.whsId);
279
+						$('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_WHS_NM').val(item.whsNm);
280
+						$('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_LOCATION').val(item.location);
281
+						mobPopObj.hide(ID_ITP_POP_MPOMNG01010_WHS_AREA);
282
+						itp_fn_form_clear_validate(null, '#ITP_FORM_MPOMNG01010_DETAIL');
283
+						return false;
284
+					}
285
+				});
286
+			});
287
+			$('#ITP_FORM_MPOMNG01010_POP_WHS button[id="ITP_BTN_MPOMNG01010_POP_WHS_SEARCH"]').off('click').on('click', function() {
288
+				_this.search();
289
+			});
290
+		},
291
+		delete: function() {
292
+			$('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_WHS_ID').val('');
293
+			$('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_WHS_NM').val('');
294
+			$('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_LOCATION').val('');
295
+		}
194
 	},
296
 	},
195
 	popReqConfirm: {
297
 	popReqConfirm: {
298
+		init: function (parentId) {
299
+			this.pchReqStCd = (parentId === 'ITP_BTN_MPOMNG01010_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_MPOMNG01010_REQ_AREA .msg_save').text('구매요청 하시겠습니까?');
306
+			} else {
307
+				$('#ITP_POP_MPOMNG01010_REQ_AREA .msg_save').text('임시저장 하시겠습니까?');
308
+			}
309
+			$('#ITP_POP_MPOMNG01010_REQ_AREA .fnPopDlvReqDt').text($('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_DLV_REQ_DT').val());
310
+			$('#ITP_POP_MPOMNG01010_REQ_AREA .fnItemQty').text(CommonObj.currency.add(mobContObj.list.rows.length, '개'));
311
+			$('#ITP_POP_MPOMNG01010_REQ_AREA .fnOrdAmt').text(CommonObj.currency.add($('#ITP_FORM_MPOMNG01010_DETAIL .fnPchReqAmtTot').text()));
312
+		},
313
+		action: function() {
314
+			var _this = this;
315
+			$('#ITP_POP_MPOMNG01010_REQ_AREA button[id="ITP_BTN_MPOMNG01010_POP_REQ_CONFIRM"]').off('click').on('click', function() {
316
+				$('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_PCH_REQ_ST_CD').val(_this.pchReqStCd);
317
+				_this.save('#ITP_FORM_MPOMNG01010_DETAIL');
318
+			});
319
+		},
320
+		save: function(formId) {
321
+			let param = $(formId).serializeObject();
322
+
323
+			if (param.loanDvsn !== 'LD03' && this.pchReqStCd === PCH_REQ_ST_CD_REQUEST_SAVE ) {
324
+				var pchActAtm = $('#ITP_FORM_POMNG01010_DETAIL .fnPchActAmt').text();
325
+				var pchReqAtm = $('#ITP_FORM_POMNG01010_DETAIL .fnPchReqAmt').text();
326
+
327
+				if (parseInt(pchActAtm) < parseInt(pchReqAtm)) {
328
+					alert(ITP_MSG_LOCALE.message.ajax.lackReqAmt);
329
+					return;
330
+				}
331
+			}
196
 
332
 
333
+			$.each(mobContObj.list.rows, function(index, item) {
334
+				item['viewCd'] = 'C';
335
+			});
336
+			param.gridInsertData = mobContObj.list.rows;
337
+			param['dlvReqDt'] = param.dlvReqDt.replace(/[^0-9]/g, "");
338
+			console.log(JSON.stringify(param));
339
+			var saveFn = function (result) {
340
+				console.log(result);
341
+				mobPopObj.hide('ITP_POP_MPOMNG01010_REQ_AREA');
342
+			};
343
+			fn_ajax_call(API_MOBILE_SAVE, JSON.stringify(param), saveFn, 'POST');
344
+		}
197
 	},
345
 	},
198
-	show: function(id) {
199
-		console.log('show ===> ' + id);
200
-		$('#' + id).show();
346
+	show: function(popId, parentId) {
347
+		var _this = this;
201
 		$('button[id$="CLOSE"]').off('click').on('click', function() {
348
 		$('button[id$="CLOSE"]').off('click').on('click', function() {
202
 			var id = $(this).attr('id');
349
 			var id = $(this).attr('id');
203
-			console.log('CLOSE ===> ' + id);
204
 			if($(this).hasClass('btn-pop-close')) {
350
 			if($(this).hasClass('btn-pop-close')) {
205
-				$('#' + id).closest('.mobile-pop-close').hide();
351
+				_this.hide(id);
206
 			}
352
 			}
207
 		});
353
 		});
208
-		if(id.indexOf('ITEM_AREA') > -1) {
209
-			this.popItem.init();
354
+		if(parentId === 'ITP_BTN_MPOMNG01010_DETAIL_REQ_ORDER' || parentId === 'ITP_BTN_MPOMNG01010_DETAIL_TEMP_SAVE') {
355
+			var formId = '#ITP_FORM_MPOMNG01010_DETAIL';
356
+			itp_fn_form_clear_validate(null, formId);
357
+			if (itp_fn_form_event.isValid(formId)) {
358
+				$('#' + popId).show();
359
+				mobPopObj.init(popId, parentId);
360
+			}
361
+		} else {
362
+			$('#' + popId).show();
363
+			mobPopObj.init(popId, parentId);
210
 		}
364
 		}
211
 	},
365
 	},
212
 	hide: function(id) {
366
 	hide: function(id) {

+ 42 - 16
src/main/webapp/mobile/js/config.js

@@ -61,7 +61,6 @@ require([
61
 
61
 
62
 	// 로그아웃 버튼
62
 	// 로그아웃 버튼
63
 	$('#ITP_MOBILE_BTN_LOGOUT').click(function() {
63
 	$('#ITP_MOBILE_BTN_LOGOUT').click(function() {
64
-		console.log('ITP_BTN_LOGOUT');
65
 		fnLogout();
64
 		fnLogout();
66
 	});
65
 	});
67
 
66
 
@@ -191,7 +190,7 @@ var fn_make_slide_menu = {
191
 			const id = $(this).attr('data-itp-nav-id');
190
 			const id = $(this).attr('data-itp-nav-id');
192
 			const connUrl = $(this).attr('data-conn-url');
191
 			const connUrl = $(this).attr('data-conn-url');
193
 			const openCd = $(this).attr('data-open-cd');
192
 			const openCd = $(this).attr('data-open-cd');
194
-			console.log('connUrl ===> ' + connUrl + '\nopenCd ===> ' + openCd);
193
+			console.log('connUrl ===> ' + connUrl);
195
 
194
 
196
 			if(openCd === 'C') {
195
 			if(openCd === 'C') {
197
 				const href = MOBILE_CONTEXTPATH + connUrl;
196
 				const href = MOBILE_CONTEXTPATH + connUrl;
@@ -219,7 +218,6 @@ var fn_make_slide_menu = {
219
 				$('#ITP_CONTAINER div.itp_mobile_contents').empty().append(html);
218
 				$('#ITP_CONTAINER div.itp_mobile_contents').empty().append(html);
220
 				//JS파일적용
219
 				//JS파일적용
221
 				const js = "<script src=\"../js/app/"+id.substring(0, id.length - 5).toLowerCase()+"/ITP_"+id+".js?version="+js_version+"\"></script>";
220
 				const js = "<script src=\"../js/app/"+id.substring(0, id.length - 5).toLowerCase()+"/ITP_"+id+".js?version="+js_version+"\"></script>";
222
-				console.log(js);
223
 				$('#ITP_CONTAINER #ITP_MOBILE_'+id+' #ITP_MOBILE_JS').append(js);
221
 				$('#ITP_CONTAINER #ITP_MOBILE_'+id+' #ITP_MOBILE_JS').append(js);
224
 				$('#ITP_MENU').toggle();
222
 				$('#ITP_MENU').toggle();
225
 			},
223
 			},
@@ -405,7 +403,6 @@ function fn_ajax_call(href, param, fn, type) {
405
 			$('#ITP_OVERLAY').hide();
403
 			$('#ITP_OVERLAY').hide();
406
 		},
404
 		},
407
 		success: function(result) {
405
 		success: function(result) {
408
-			console.log(result);
409
 			if (result.code !== undefined) { //성공시에도 메세지가 있으면 얼럿 예)저장되었습니다.
406
 			if (result.code !== undefined) { //성공시에도 메세지가 있으면 얼럿 예)저장되었습니다.
410
 				itp_fn_modal_alert_ajax(result.message);
407
 				itp_fn_modal_alert_ajax(result.message);
411
 			}
408
 			}
@@ -499,16 +496,6 @@ function itp_fn_date_format(date, type) {
499
 	}
496
 	}
500
 }
497
 }
501
 
498
 
502
-function itp_fn_set_comma(str) {
503
-	str = String(str);
504
-	return str.replace(/(\d)(?=(?:\d{3})+(?!\d))/g, '$1,');
505
-};
506
-
507
-function itp_fn_set_uncomma(str) {
508
-	str = String(str);
509
-	return str.replace(/[^\d]+/g, '');
510
-};
511
-
512
 let itp_fn_form_validate = function(form, element, arry, msg, type) {
499
 let itp_fn_form_validate = function(form, element, arry, msg, type) {
513
 	var error = function(txt) {
500
 	var error = function(txt) {
514
 		if (type != 'ONLYCHK') {
501
 		if (type != 'ONLYCHK') {
@@ -608,6 +595,18 @@ let itp_fn_form_validate = function(form, element, arry, msg, type) {
608
 	return true;
595
 	return true;
609
 };
596
 };
610
 
597
 
598
+let itp_fn_form_clear_validate = function(modal, form) {
599
+	$(form).find('.itp_ip').removeClass('has-error');
600
+	$(form).find('.help-block').remove();
601
+
602
+	if (modal != null) {
603
+		$(modal).on('hidden.bs.modal', function() {
604
+			$(form).find('.itp_ip').removeClass('has-error');
605
+			$(form).find('.help-block').remove();
606
+		});
607
+	}
608
+};
609
+
611
 let itp_fn_form_event = {
610
 let itp_fn_form_event = {
612
 	onKeyup: function(formId) {
611
 	onKeyup: function(formId) {
613
 		$(formId).find('input[data-key-up]').on('keyup', function() {
612
 		$(formId).find('input[data-key-up]').on('keyup', function() {
@@ -649,7 +648,6 @@ let itp_fn_form_event = {
649
 			if($(this).data('check-required')) {
648
 			if($(this).data('check-required')) {
650
 				var arry = $(this).data('check-required').split(',');
649
 				var arry = $(this).data('check-required').split(',');
651
 				var alertMsg = $(this).data('alert-required');
650
 				var alertMsg = $(this).data('alert-required');
652
-				console.log(alertMsg);
653
 				isValid = itp_fn_form_validate(formId, '#' + $(this).attr('id'), arry, undefined, alertMsg);
651
 				isValid = itp_fn_form_validate(formId, '#' + $(this).attr('id'), arry, undefined, alertMsg);
654
 				if(!isValid) {
652
 				if(!isValid) {
655
 					if(alertMsg && alertMsg.length > 0) {
653
 					if(alertMsg && alertMsg.length > 0) {
@@ -724,5 +722,33 @@ let CommonObj = {
724
 			}
722
 			}
725
 		});
723
 		});
726
 
724
 
725
+	},
726
+	comma: {
727
+		set: function(str) {
728
+			str = String(str);
729
+			return str.replace(/(\d)(?=(?:\d{3})+(?!\d))/g, '$1,');
730
+		},
731
+		remove: function(str) {
732
+			str = String(str);
733
+			return str.replace(/[^\d]+/g, '');
734
+		}
735
+	},
736
+	currency: {
737
+		add: function(val, curr) {
738
+			return CommonObj.comma.set(val).concat((curr === undefined) ? '원' : curr);
739
+		},
740
+		remove: function(val) {
741
+			return val.replace(/[^0-9]/g, "");
742
+		}
727
 	}
743
 	}
728
-};
744
+};
745
+
746
+function itp_fn_set_comma(str) {
747
+	str = String(str);
748
+	return str.replace(/(\d)(?=(?:\d{3})+(?!\d))/g, '$1,');
749
+};
750
+
751
+function itp_fn_set_uncomma(str) {
752
+	str = String(str);
753
+	return str.replace(/[^\d]+/g, '');
754
+};