Subversion Repositories SmartDukaan

Rev

Rev 23783 | Rev 24094 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
22245 ashik.ali 1
<style>
23638 amit.gupta 2
	.pointer {
3
		cursor:pointer;
4
	}
22860 ashik.ali 5
	.modal-content{
22245 ashik.ali 6
		background : white;
7
	}
8
	.modelHeaderCustom{
9
		font-size:14px;
10
		font-weight:bold;
11
	}
12
	.border-highlight{
13
		border : 3px solid red;
14
	}
15
	hr{
16
		background-color:#dddddd;
17
		border:none;
18
		height:1px;
19
		background:#dddddd;
20
	}
21
	.control-label {
22
		margin-top: 0;
23
    	margin-bottom: 0;
24
    	padding-top: 7px;
25
    	font-weight:bold;
26
    	font-size:14px;
27
	}
28
	.right{
29
		float:right;
30
	}
31
	.form-control{
32
		color:black;
23783 ashik.ali 33
		text-transform:uppercase;
22245 ashik.ali 34
	}
35
	.bold-details {
36
		text-transform:capitalize;
37
		font-weight:600;
38
		color:#212121;
39
	}
40
	.normal-details{
41
		font-weight:400;
42
		text-transform:capitalize;
43
		color:#797979;
44
	}
22860 ashik.ali 45
 
22245 ashik.ali 46
}
47
</style>
48
#set($options="{ weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute:'numeric' }")
49
<section class="wrapper">
50
<div class="row" style="background:white;font-size:14px;">
51
	<div class="col-lg-4" style="border-left:1px solid #f0f0f0;">
52
		<h4>ORDER DETAILS</h4>
53
		<div class="row">
54
			<div class="col-lg-4">
55
				<p class="bold-details">Order ID</p>
56
			</div>
57
			<div class="col-lg-6">
23654 amit.gupta 58
				<p class="normal-details">#$fofoOrder.getId() ($fofoOrderItems.size() item)</p>
22245 ashik.ali 59
			</div>
60
		</div>
61
		<div class="row">
62
			<div class="col-lg-4">
63
				<p class="bold-details">Order Date</p>
64
			</div>
65
			<div class="col-lg-6">
66
				<script>document.getElementById('createTimestamp').appendChild(document.createTextNode(new Date('$fofoOrder.getCreateTimestamp()').toLocaleString("en-US",$options)))</script>
67
				<p class="normal-details" id="createTimestamp"></p>
68
			</div>
69
		</div>
70
		<div class="row">
71
			<div class="col-lg-4">
72
				<p class="bold-details">Amount Paid</p>
73
			</div>
74
			<div class="col-lg-6">
75
				<p class="normal-details"><span class="normal-details">&#8377; </span>$fofoOrder.getTotalAmount()</p>
76
			</div>
77
		</div>
78
	</div>
79
 
80
	<div class="col-lg-4" style="border-left:1px solid #f0f0f0;">
81
		<h4>BILLING DETAILS</h4>
82
		<p class="bold-details">$customerBillingAddressObj.getName()</p>
83
		<p class="normal-details">$customerBillingAddress</p>
23378 ashik.ali 84
		#if($fofoOrder.getCustomerGstNumber() && $fofoOrder.getCustomerGstNumber() != "")
85
			<p class="bold-details">GST Number <span class="normal-details extra-margin">$fofoOrder.getCustomerGstNumber()</span></p>
86
		#end
22245 ashik.ali 87
		<p class="bold-details">Phone <span class="normal-details extra-margin">$customerBillingAddressObj.getPhoneNumber()</span></p>
88
	</div>
89
 
90
	<div class="col-lg-4" style="border-left:1px solid #f0f0f0;">
91
		<h4>INVOICE DETAILS</h4>
92
		<p class="bold-details">Invoice Number <span class="normal-details extra-margin">$fofoOrder.getInvoiceNumber()</span></p>
23783 ashik.ali 93
		<p class="invoice_download_option"><i class="fa fa-print" aria-hidden="true"></i><a target="_blank" href="generateInvoice?orderId=$fofoOrder.getId()" class="extra-margin" style="font-size:18px">Print Invoice</a	></i></p>
22245 ashik.ali 94
	</div>
95
 
96
</div>
97
 
98
<div class="row" style="font-size:14px;color:#688a7e;">
99
	<div class="col-lg-12">
100
		<table class="table table-striped table-advance table-hover">
101
			<tbody>
102
				<tr>
103
					<th>Item Code</th>
104
					<th>Description</th>
105
					<th>Unit Price</th>
106
					<th>Quantity</th>
107
					<th>Total Price</th>
23419 ashik.ali 108
					<th>Prebooking Quantity</th>
109
					<th>Prebooking Amount</th>
22245 ashik.ali 110
				</tr>
23638 amit.gupta 111
				 <script type="text/javascript">
23654 amit.gupta 112
				 	fofoLineItemsMap = $fofoOrderItemIdLineItemsMap;
113
				 	foiIdCustomerReturnInventoryItemsMap = $foiIdCustomerReturnInventoryItemsMap;
114
				 	inventoryItemBilledQtyMap = $inventoryItemBilledQtyMap;
23638 amit.gupta 115
				 </script>
23654 amit.gupta 116
				 #foreach( $fofoOrderItem in $fofoOrderItems )
117
				 #set ($total = $fofoOrderItem.getSellingPrice() * $fofoOrderItem.getQuantity())
22245 ashik.ali 118
				 	<tr>
23654 amit.gupta 119
				 		<td>$fofoOrderItem.getItemId()</td>
22245 ashik.ali 120
				 		<td>
23654 amit.gupta 121
				 			$fofoOrderItem.getBrand() $fofoOrderItem.getModelName() $fofoOrderItem.getModelNumber() $fofoOrderItem.getColor()
22245 ashik.ali 122
				 		</td>
23654 amit.gupta 123
				 		<td>$fofoOrderItem.getSellingPrice()</td>
124
				 		<td>$fofoOrderItem.getQuantity()</td>
22245 ashik.ali 125
				 		<td>$total</td>
23654 amit.gupta 126
				 		#if($itemIdPrebookingOrderItemMap.get($fofoOrderItem.getItemId()))
127
							<td>$itemIdPrebookingOrderItemMap.get($fofoOrderItem.getItemId()).getQuantity()</td>
128
							<td>$itemIdPrebookingOrderItemMap.get($fofoOrderItem.getItemId()).getAdvanceAmount()</td>
23419 ashik.ali 129
						#else
130
							<td>0</td>
131
							<td>0</td>
132
						#end
23654 amit.gupta 133
						#if($itemsMap.get($fofoOrderItem.getItemId()).getCategoryId()==10006)
23638 amit.gupta 134
							#if($markDoa)
23654 amit.gupta 135
								<td><a class="pointer" data-foi="$fofoOrderItem.getId()" 
136
								data-itemdesc="$itemsMap.get($fofoOrderItem.getItemId()).getItemDescription()" data-target=".bs-example-modal-sm" data-toggle="modal">Mark DOA</a></td>
23638 amit.gupta 137
							#else
138
								<td></td>
139
							#end
140
						#else
141
							#if($markDefective)
23654 amit.gupta 142
								<td><a class="pointer" data-foi="$fofoOrderItem.getId()" 
143
								data-itemdesc="$itemsMap.get($fofoOrderItem.getItemId()).getItemDescription()" data-target=".bs-example-modal-sm" data-toggle="modal">Mark Defective</a></td>
23638 amit.gupta 144
							#else
145
								<td></td>
146
							#end
147
						#end
148
						<td></td>
22245 ashik.ali 149
				 	</tr>
150
				 #end
151
			</tbody>
152
		</table>
153
	</div>
23638 amit.gupta 154
	<!-- Small modal -->
155
	<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" id="exampleModal">
156
	  <div class="modal-dialog modal-md" role="document">
157
	    <div class="modal-content">
158
	    <div class="modal-header">
159
	    	<p class="modal-title"></p>
160
	    </div>
161
	    <div class="modal-body">
162
 
163
	    </div>
164
	    <div class="modal-footer">
165
	    	<button type="button" class="return-submit btn btn-primary">Submit</button>
166
	    </div>
167
	    </div>
168
	  </div>
169
	</div>
22245 ashik.ali 170
</div>
171
 
172
<div class="row">
173
	#if(!$insurancePolicies.isEmpty())
174
		<div class="col-lg-8">
175
			<h4>INSURANCE DETAILS</h4>
176
    		<table class="table table-striped table-advance">
177
    			<tbody>
178
    				<tr>
179
    					<th>Description</th>
180
    					<th>Serial Number</th>
181
    					<th>Provider Name</th>
182
    					<th>Amount</th>
183
    				</tr>
184
    				#if(!$insurancePolicies.isEmpty())
185
		    			#foreach( $insurancePolicy in $insurancePolicies )
186
		    				<tr>
187
		    					<td>$insurancePolicy.getBrand() $insurancePolicy.getModelName()</td>
188
		    					<td>$insurancePolicy.getSerialNumber()</td>
189
		    					<td>$insurancePolicy.getInsuranceProvider().getName()</td>
190
		    					<td>$insurancePolicy.getSaleAmount()</td>
191
		    				</tr>
192
		    			#end
193
	    			#end
194
    			</tbody>
195
    		</table>
196
    	</div>
197
	#end
198
 
199
	<div class="col-lg-4 right" style="border-left:1px solid #f0f0f0;background:white;font-size:14px;">
200
		<h4>PAYMENT DETAILS</h4>
23547 ashik.ali 201
		 #foreach( $paymentOptionTransaction in $paymentOptionTransactions )
202
		 	#set($paymentOption = $paymentOptionIdPaymentOptionMap.get($paymentOptionTransaction.getPaymentOptionId()))
22245 ashik.ali 203
		 	<div class="row">
204
		 		<div class="col-lg-3">
23367 ashik.ali 205
		 			<p class="bold-details">$paymentOption.getName()</p>
22245 ashik.ali 206
		 		</div>
207
		 		<div class="col-lg-3">
23547 ashik.ali 208
		 			<p class="nomal-details">&#8377; $paymentOptionTransaction.getAmount()</p>
22245 ashik.ali 209
		 		</div>
210
		 	</div>
211
		 #end
212
		 <hr/>
213
		 <div class="row">
214
		 	<div class="col-lg-3">
215
		 		<p class="bold-details">TOTAL</p>
216
		 	</div>
217
		 	<div class="col-lg-3">
218
		 		<p class="nomal-details">&#8377;$fofoOrder.getTotalAmount() </p>
219
		 	</div>
220
		 </div>
221
	</div>
222
</div>
223
 
224
</section>
23638 amit.gupta 225
 
226
<script type="text/javascript">
227
	$('#exampleModal').on('show.bs.modal', function (event) {
228
		var link = $(event.relatedTarget); // Button that triggered the modal
229
  		var itemDesc = link.data('itemdesc'); // Extract info from data-* attributes
23654 amit.gupta 230
  		var foitem = link.data('foi'); // Extract info from data-* attributes
23638 amit.gupta 231
  		li = fofoLineItemsMap[foitem]
23654 amit.gupta 232
  		returnedItems = foiIdCustomerReturnInventoryItemsMap[foitem];
23638 amit.gupta 233
  		var modal = $(this);
234
  		modal.find(".modal-title").html(link.html() + "-" + itemDesc);
235
  		htmlArr = [];
236
  		htmlArr.push('<div> <ul data-foi="' + foitem + '">');
237
  		var i;
23654 amit.gupta 238
		for( i=0;i<li.length;i++) {
239
			var counter = 0;
240
			while(inventoryItemBilledQtyMap[li[i].inventoryItemId] > counter) {
241
		  		if(link.html()=="Mark Defective"){
242
	  				htmlArr.push('<li class="row">');
243
	  				htmlArr.push('<div class="col-sm-6 checkbox"><label><input type="checkbox" value="' + li[i].inventoryItemId +'">Defective</label></div>');
244
	  				htmlArr.push('<div class="col-sm-6 form-group"><label for="comment">Remarks</label><textarea class="form-control" rows="2" id="comment"></textarea></div>');
245
	  				htmlArr.push('</li>');
246
				} else {
247
	  				htmlArr.push('<li class="row">');
248
	  				htmlArr.push('<div class="checkbox col-sm-6"><label><input type="checkbox" value="' + li[i].inventoryItemId +'">DOA Certificate Valid for IMEI - ' + li[i].serialNumber + '</label></div>');
249
	  				htmlArr.push('<div class="form-group col-sm-6"><label for="comment">Remarks</label><textarea class="form-control" rows="2" id="comment"></textarea></div>');
250
	  				htmlArr.push('</li>');
251
  				}
252
				counter = counter + 1;
253
 
254
			}
255
			var counter = 0;	 
256
			while(li[i].quantity - inventoryItemBilledQtyMap[li[i].inventoryItemId] > counter) {
257
		  		if(link.html()=="Mark Defective"){
258
	  				htmlArr.push('<li class="row">');
259
	  				htmlArr.push('<div class="checkbox col-sm-6"><label><input type="checkbox" checked disabled value="' + li[i].inventoryItemId +'">Defective</label></div>');
260
	  				htmlArr.push('<div class="form-group col-sm-6"><label for="comment">Remarks</label><textarea disabled class="form-control" rows="2" id="comment">' + returnedItems[counter].remarks + '</textarea></div>');
261
	  				htmlArr.push('</li>');
262
				} else {
263
	  				htmlArr.push('<li class="row">');
264
	  				htmlArr.push('<div class="checkbox col-sm-6"><label><input type="checkbox" checked disabled value="' + li[i].inventoryItemId +'">DOA Certificate Valid for IMEI - ' + li[i].serialNumber + '</label></div>');
265
	  				htmlArr.push('<div class="form-group col-sm-6"><label for="comment">Remarks</label><textarea disabled class="form-control" rows="2" id="comment">' + returnedItems[counter].remarks + '</textarea></div>');
266
	  				htmlArr.push('</li>');
267
  				}
268
				counter = counter + 1;
269
			}
270
		}	
23638 amit.gupta 271
  		modal.find(".modal-body").html(htmlArr.join(""));
272
	});
273
 
274
  	$(".return-submit").on('click', function(){
275
  		var showAlert = false;
23654 amit.gupta 276
  		var checkedInventory = $('.modal-body').find('input:checked:enabled');
23638 amit.gupta 277
  		if(checkedInventory.length==0){
278
  			alert("Check the defective and provide remarks");
279
  			return;
280
  		}
281
  		checkedInventory.each(function(i,v){
282
  			if($(v).closest('li').find('textarea').val()==''){
283
  				showAlert = true;
284
  			}
285
  		});
286
  		if(showAlert) {
287
  			alert('Please add remarks');
288
  			return;
289
  		} else {
290
	  		var foi = $(checkedInventory).closest('ul').data('foi');
291
	  		var markedBadArr = [];
292
	  		checkedInventory.each(function(i,v){
293
	  			markedBadArr.push({"remarks" : $(v).closest('li').find('textarea').val(), 
294
	  								"inventoryItemId":$(v).val()});
295
	  		});
296
	  		var json = {"fofoOrderItemId":foi, "markedBadArr":markedBadArr};
297
  			doPostAjaxRequestWithJsonHandler('${rc.contextPath}/order/bad_return', JSON.stringify(json), function(data){
23654 amit.gupta 298
  				alert('Credit Note generated');
299
  				window.open('${rc.contextPath}/credit-note/' + data.response, '_blank');
300
  				loadSaleDetails(orderId,"sale-details-container");
301
  				$('#exampleModal').modal('hide');
302
 
23638 amit.gupta 303
  			});
304
  		}
305
  	});	
23896 amit.gupta 306
</script>