Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
23405 amit.gupta 1
<style>
2
	.btn:hover{
3
  		color: grey;
4
  		text-decoration: none;
5
	}
6
	.btn-primary:hover{
7
  		color: grey;
8
  		text-decoration: none;
9
	}
10
	.retailer-details{
11
		cursor:pointer;
12
	}
13
</style>
14
 
15
<section class="wrapper">            
16
	<div class="row">
17
		<div class="col-lg-12">
23796 amit.gupta 18
		#if ($isAdmin)
23786 amit.gupta 19
			<h3 class="page-header"><i class="icon_document_alt"></i>Create/Edit Allocation</h3>
23405 amit.gupta 20
			<ol class="breadcrumb">
21
				<li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Home</a></li>
23786 amit.gupta 22
				#if($retailerName)
23
				<script type="text/javascript">
24
					currentFofoId=${retailerId};
25
				</script>
26
				<li><i class="icon_document_alt"></i><b>Allocation for $retailerName (Counter Size - $counterSize)</b></li>
27
				#else
28
				<li><i class="icon_document_alt"></i><b>Standard Allocation (Counter Size - $counterSize)</b></li>
29
				#end
23405 amit.gupta 30
			</ol>
23796 amit.gupta 31
		#else
32
			<h3 class="page-header"><i class="icon_document_alt"></i>Create Purchase Order</h3>
33
		#end
23405 amit.gupta 34
		</div>
35
	</div>
36
 
37
    <div>
23796 amit.gupta 38
    	#if ($isAdmin)
23786 amit.gupta 39
    	<div class="row">
40
    		<div class="col-lg-3">
41
                <div class="input-group">
42
			    	<input id="partnerId" type="text" class="typeahead form-control form-control-sm" placeholder="Search Partner by Store" data-provide="typeahead" 
43
			    	 #if(${retailerName}) value="${retailerName}" #end
44
			    	 autocomplete="off"/>
45
	               	<div class="input-group-btn">
46
		    			<button class="create_indent btn btn-primary">Get Partner Allocation</button>
24229 amit.gupta 47
		    			<button class="download_indent btn btn-primary">Download</button>
23786 amit.gupta 48
		    		</div>
49
		    	</div>
50
    		</div>
51
		    <div class="col-lg-3">
52
			    <div class="dropdown">
53
			 		<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Change Counter Size
54
					  <span class="caret"></span></button>
55
					  <ul class="dropdown-menu">
56
					  #foreach($counterSiz in $counterSizes)
57
					    <li class="mk_counter_size #if(${counterSiz}==${counterSize}) active#end"><a href="javascript:void(0)">$counterSiz</a></li>
58
					  #end
59
			  		</ul>
60
				</div>
61
	    	</div>
62
    	</div>
23796 amit.gupta 63
    	#end
23405 amit.gupta 64
	         <div class="row">
23786 amit.gupta 65
	    		<div class="col-lg-7" id="indent-container">
23405 amit.gupta 66
	    			<table class="table table-striped table-condensed table-bordered" id="entire-catalog-table">
67
		    			<thead>
68
				            <tr>
69
								<th>Id</th>
23796 amit.gupta 70
	    						<th style="width:40%">Description</th>
24229 amit.gupta 71
	    						<th style="width:12%">DP</th>
23405 amit.gupta 72
	    						<th>MOP</th>
23855 amit.gupta 73
	    						<th style="width:20%">Allocated Quantity</th>
74
	    						<th style="width:9%">In Stock</th>
75
	    						<th style="width:9%">In Transit</th>
76
	    						<th style="width:9%">To be Ordered</th>
23405 amit.gupta 77
				            </tr>
78
				        </thead>
79
	    				<tbody>
24229 amit.gupta 80
	    					#foreach( $modelListing in $catalogTagListings )
23405 amit.gupta 81
	    					<tr>
24229 amit.gupta 82
	    						<td>$modelListing.getCatalogId()</td>
24406 amit.gupta 83
	    						<td>$modelListing.getItemDescription()
84
		    						#if($isAdmin)
85
	    							<button type="button" class="btn btn-link mk_pause_button" 
86
	    							data-id="$modelListing.getCatalogId()"
87
	    							data-description="$modelListing.getItemDescription()"
88
	    							>Change Status</button>
89
		    						#end
90
	    						</td>
24229 amit.gupta 91
	    						<td class="currency">$modelListing.getDp()</td>
92
	    						<td class="currency">$modelListing.getMop()</td>
23796 amit.gupta 93
	    						<td>
94
	    						#if($isAdmin)
24229 amit.gupta 95
	    						<input type="number" min="0" max="20" 
96
	    						data-catalog-id="$modelListing.getCatalogId()"
97
	    						data-selling-price="$modelListing.getDp()"
98
	    						data-description="$modelListing.getItemDescription()" 
99
	    						value="$modelListing.getAllocatedQuantity()"/>
23796 amit.gupta 100
	    						#else
24229 amit.gupta 101
								$modelListing.getAllocatedQuantity()	    						
23796 amit.gupta 102
	    						#end
103
	    						</td>
24229 amit.gupta 104
	    						<td>$modelListing.getStockInHand()</td>
105
	    						<td>$modelListing.getInTransitQuantity()</td>
106
	    						<td>$modelListing.getToBeOrdered()</td>
23405 amit.gupta 107
	    					</tr>
108
	    					#end
109
	    				</tbody>
110
	    			</table>
111
	    		</div>
23786 amit.gupta 112
	    		<div class="col-lg-7" id="indent-container1" style="display:none"></div>
113
	    		<div class="col-lg-4">
23405 amit.gupta 114
	    			<div class="panel panel-default">
23796 amit.gupta 115
	    			#if($isAdmin)
23786 amit.gupta 116
	                  <div class="panel-heading">Allocation Update Summary #if($retailerName) (Counter Size - $counterSize) #end</div>
23405 amit.gupta 117
	                  <div class="panel-content">
23786 amit.gupta 118
	                  	<table class="table table-sm" id="summary-table">
119
	                  		  <thead>
120
							    <tr>
121
							      <th class="col">#</th>
122
							      <th class="col">Items</th>
123
							      <th class="col">Quantity</th>
124
							      <th class="col">Amount</th>
125
							    </tr>
126
							  </thead>
127
							  <tbody>
128
							    <tr>
129
							      <th class="row">Initial</th>
130
							      <td></td>
131
							      <td></td>
23796 amit.gupta 132
							      <td></td>
23786 amit.gupta 133
							    </tr>
134
							    <tr>
135
							      <th class="row">Added</th>
136
							      <td></td>
137
							      <td></td>
23796 amit.gupta 138
							      <td></td>
23786 amit.gupta 139
							    </tr>
140
							    <tr>
141
							      <th class="row">Removed</th>
142
							      <td></td>
143
							      <td></td>
23796 amit.gupta 144
							      <td></td>
23786 amit.gupta 145
							    </tr>
146
							    <tr>
147
							      <th class="row">Final</th>
148
							      <td></td>
149
							      <td></td>
23796 amit.gupta 150
							      <td></td>
23786 amit.gupta 151
							    </tr>
152
							  <tbody>
153
	                  	</table>
154
			          <button class="btn btn-primary mk_submit_indent">Update Allocation</button>
23405 amit.gupta 155
			          <button class="btn btn-primary bk_toedit_indent" style="display:none">Edit</button>
23786 amit.gupta 156
			          <button class="btn btn-primary confirm_indent" style="display:none">Confirm Update</button>
23405 amit.gupta 157
	                  </div>
158
                	</div>
23796 amit.gupta 159
                	#else
160
                	#set($diff=$totalAmount - $walletAmount)
161
	                <div class="panel-heading">PO Summary(Total Amount in Wallet - <span class="currency">$walletAmount</span>)</div>
162
	                  <div class="panel-content">
163
	                  	<table class="table table-sm" id="summary-table">
164
	                  		  <thead>
165
							    <tr>
166
							      <th class="col">#</th>
167
							      <th class="col">Total Pcs</th>
168
							      <th class="col">Amount to Pay</th>
169
							      <th class="col">Action</th>
170
							    </tr>
171
							  </thead>
172
							  <tbody>
173
							  #**
174
							    <tr>
175
							      <th class="row">Partial PO</th>
176
							      <td>$partialPcs</td>
177
							      <td>$partialAmount</td>
178
							      <td><button class="btn btn-sm btn-primary confirm_indent #if(${diff} > 0)disabled#end"
179
							      >Raise Partial PO</button></td>
180
							    </tr>
181
							   **#
182
							    <tr>
183
							      <th class="row">Complete PO</th>
184
							      <td>$totalPcs</td>
185
							      <td class="currency">$totalAmount</td>
186
							      #if($totalPcs)
187
							      <td><button class="btn btn-primary raise_po#if($diff > 0) disabled#end">Raise Complete PO</button></td>
188
							      #else
189
							      <td>Nothing to order!</td>
190
							      #end
191
							    </tr>
192
							  </tbody>	
193
	                  	</table>
194
	                  #if($diff>0)
195
	                  	<div class="alert alert-warning">
196
							<medium>Please add Rs.<span class="currency">$diff</span> to complete this transaction.</meduim>
197
						</div>
198
					  #end
199
	                  </div>
200
                	</div>
201
                	#end
202
                	#if($isAdmin)
23786 amit.gupta 203
                	<div class="panel panel-default">
204
                		<div class="panel-heading">Brandwise Target and Performance</div>
205
                		<div class="panel-content">
206
                		<ul class="nav nav-tabs">
207
						  <li role="presentation" class="active brandLi"><a href="javascript:void(0)">Mobiles</a></li>
208
						  <li role="presentation" class="brandLi"><a href="javascript:void(0)">Accessories</a></li>
209
						</ul>
210
 
211
						<table class="brandPerformance table table-striped table-condensed table-bordered">
212
							<thead>
213
								<tr>
214
									<th rowspan="2">Brand Name</th>
215
									<th rowspan="2" align="center">Target Value</th>
216
									<th colspan="2" align="center">Achieved</th>
217
									<th colspan="2">Brand Share(%)</th>
218
								</tr>
219
								<tr>
220
									<th>Value</th>
221
									<th>Percentage</th>
222
									<th>Target</th>
223
									<th>Achieved</th>
224
								</tr>
225
							</thead>
226
							<tbody>
227
							#foreach($brandPerformance in $brandPerformanceList)
228
								<tr>
229
									<th>$brandPerformance.getBrandName()</th>
230
									<td class="currency">$brandPerformance.getTarget()</td>
231
									<td class="currency">$brandPerformance.getAchieved()</td>
232
									<td>$brandPerformance.getAchievedPercentage()%</td>
233
									<td>$brandPerformance.getBrandTargetShare()</td>
234
									<td>$brandPerformance.getBrandAchievedShare()</td>
235
								</tr>
236
							#end
237
							<tbody>
238
							</tbody>
239
						</table>
240
						<table style="display:none" class="table brandPerformance table-striped table-condensed table-bordered">
241
							<thead>
242
								<tr>
243
									<th rowspan="2">Brand Name</th>
244
									<th rowspan="2" align="center">Target Value</th>
245
									<th colspan="2" align="center">Achieved</th>
246
									<th colspan="2">Brand Share(%)</th>
247
								</tr>
248
								<tr>
249
									<th>Value</th>
250
									<th>Percentage</th>
251
									<th>Target</th>
252
									<th>Achieved</th>
253
								</tr>
254
							</thead>
255
							<tbody>
256
							#foreach($brandPerformance in $accsBrandPerformanceList)
257
								<tr>
258
									<th>$brandPerformance.getBrandName()</th>
259
									<td>$brandPerformance.getTarget()</td>
260
									<td>$brandPerformance.getAchieved()</td>
261
									<td>$brandPerformance.getAchievedPercentage()%</td>
262
									<td>$brandPerformance.getBrandTargetShare()</td>
263
									<td>$brandPerformance.getBrandAchievedShare()</td>
264
								</tr>
265
							#end
266
							<tbody>
267
							</tbody>
268
						</table>
269
                		</div>
270
 
271
                	</div>
23796 amit.gupta 272
                	#end
23405 amit.gupta 273
	    		</div>
274
	    	</div>
275
    	</div>
276
</section>
277
<script type="text/javascript">
23796 amit.gupta 278
totalAmount = $totalAmount;
23405 amit.gupta 279
/* Create an array with the values of all the input boxes in a column */
280
$.fn.dataTable.ext.order['dom-text'] = function  ( settings, col )
281
{
282
    return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
283
        return $('input', td).val();
284
    } );
285
}
286
 
287
/* Create an array with the values of all the input boxes in a column, parsed as numbers */
288
$.fn.dataTable.ext.order['dom-text-numeric'] = function  ( settings, col )
289
{
290
    return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
291
        return $('input', td).val() * 1;
292
    } );
293
}
294
 
295
/* Create an array with the values of all the select options in a column */
296
$.fn.dataTable.ext.order['dom-select'] = function  ( settings, col )
297
{
298
    return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
299
        return $('select', td).val();
300
    } );
301
}
302
 
303
/* Create an array with the values of all the checkboxes in a column */
304
$.fn.dataTable.ext.order['dom-checkbox'] = function  ( settings, col )
305
{
306
    return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
307
        return $('input', td).prop('checked') ? '1' : '0';
308
    } );
309
}
310
 
311
/* Initialise the table with the required column ordering data types */
23786 amit.gupta 312
var customRetailers = ${customRetailers};
23405 amit.gupta 313
$(document).ready(function() {
314
    indentTable = $('#entire-catalog-table').DataTable({
23786 amit.gupta 315
    	"scrollY":"600px",
23405 amit.gupta 316
    	"columns": [
23796 amit.gupta 317
            null, null, null, null,
318
            { "orderDataType": "dom-text-numeric" }, null, null, null
23786 amit.gupta 319
        ],
23796 amit.gupta 320
        "lengthMenu":[[25,50],[25,50]],
321
        "order": []
23405 amit.gupta 322
	});
323
	indentMap = {};
324
	indentTable.rows().data().each(function(arr){
23796 amit.gupta 325
		var $input = $(arr[4]);
23405 amit.gupta 326
		quantity = parseInt($input.val(), 10);
327
		if(quantity > 0){
23786 amit.gupta 328
			indentMap[parseInt(arr[0])] = {"initialQuantity": quantity, "quantity": quantity, "sellingPrice":parseInt(arr[2]), "description": arr[1], "diff":0};
23405 amit.gupta 329
	    }
330
	});
23884 amit.gupta 331
	$("#partnerId").typeahead({
23786 amit.gupta 332
	  source: customRetailers,
333
	  autoSelect: true,
334
	  displayText:function(item){return item.businessName + "-" + item.address.city;},
335
	  afterSelect:	function(currentItem){
336
	  					currentFofoId = currentItem.partnerId;
337
	  				}
338
	});
23796 amit.gupta 339
	if($isAdmin){
340
		populateIndentSummary();
341
	}
23405 amit.gupta 342
});
343
 
344
</script>