Subversion Repositories SmartDukaan

Rev

Rev 35502 | Rev 35771 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35502 Rev 35765
Line 65... Line 65...
65
 
65
 
66
	li.brandFocusedStockDetail a {
66
	li.brandFocusedStockDetail a {
67
		padding: 8px 10px !important;
67
		padding: 8px 10px !important;
68
	}
68
	}
69
 
69
 
-
 
70
	.out-of-stock-row a {
-
 
71
		text-decoration: none;
-
 
72
	}
-
 
73
 
-
 
74
	.out-of-stock-row a:hover {
-
 
75
		text-decoration: underline;
-
 
76
	}
-
 
77
 
-
 
78
	.oos-toggle-icon {
-
 
79
		display: inline-block;
-
 
80
		width: 16px;
-
 
81
		font-weight: bold;
-
 
82
	}
-
 
83
 
-
 
84
	.oos-content table {
-
 
85
		background-color: #fff;
-
 
86
	}
-
 
87
 
-
 
88
	.our-stock-detail-row td {
-
 
89
		border-top: none !important;
-
 
90
	}
-
 
91
 
-
 
92
	.our-stock-detail-row table {
-
 
93
		margin: 0;
-
 
94
		background-color: #fff;
-
 
95
	}
-
 
96
 
70
</style>
97
</style>
71
 
98
 
72
 
99
 
73
 
100
 
74
 
101
 
Line 255... Line 282...
255
								#set($statusModelMap = $brandStatusWiseStockListMap.get($bnd))
282
								#set($statusModelMap = $brandStatusWiseStockListMap.get($bnd))
256
								<h4>$bnd</h4>
283
								<h4>$bnd</h4>
257
								<table class="table table-striped table-advance table-hover" style="width:100%">
284
								<table class="table table-striped table-advance table-hover" style="width:100%">
258
									<thead>
285
									<thead>
259
									<tr>
286
									<tr>
260
										<th style="width: 2%;">Item</th>
287
										<th style="width: 30%;">Item</th>
261
										<th style="width: 8%;">Status</th>
288
										<th>Status</th>
262
										<th style="width:6% ">DP</th>
289
										<th>DP</th>
263
										<th style="width: 10%;">Our Stock</th>
290
										<th>Our Stock</th>
264
										<th style="width: 8%;"> In-Transit</th>
291
										<th> In-Transit</th>
265
										<th style="width: 12%;">P-Fullfilled</th>
292
										<th>P-Fullfilled</th>
266
										<th style="width: 15%;">P-Shortage</th>
293
										<th>P-Shortage</th>
267
										<th style="width: 12%;">P-CurrentQty</th>
294
										<th>P-CurrentQty</th>
268
										<th style="width: 6%;">Indent</th>
295
										<th>Indent</th>
269
										<th style="width: 8%;">Aging</th>
296
										<th>Aging</th>
270
										<th>Action</th>
297
										<th>Action</th>
271
									</tr>
298
									</tr>
272
									</thead>
299
									</thead>
273
									<tbody>
300
									<tbody>
274
										#foreach($statusKey in $statusModelMap.keySet())
301
										#foreach($statusKey in $statusModelMap.keySet())
Line 279... Line 306...
279
												#else
306
												#else
280
													<td>$stocklist.getModelNumber()</td>
307
													<td>$stocklist.getModelNumber()</td>
281
												#end
308
												#end
282
												<td>$stocklist.getStatus()</td>
309
												<td>$stocklist.getStatus()</td>
283
												<td>$tagListingsMap.get($stocklist.getCatalogId()).getSellingPrice()</td>
310
												<td>$tagListingsMap.get($stocklist.getCatalogId()).getSellingPrice()</td>
-
 
311
												<td style="color: blue; text-decoration: underline; cursor: pointer;"
-
 
312
													onclick="toggleOurStockRow($stocklist.getCatalogId(), $warehouseId, '$stocklist.getModelNumber()')">
284
												<td>$stocklist.getNetAvailability()</td>
313
													$stocklist.getNetAvailability()
-
 
314
												</td>
285
												#if($catalogWiseQtyMap.get($stocklist.getCatalogId()))
315
												#if($catalogWiseQtyMap.get($stocklist.getCatalogId()))
286
													<td>$catalogWiseQtyMap.get($stocklist.getCatalogId())</td>
316
													<td>$catalogWiseQtyMap.get($stocklist.getCatalogId())</td>
287
												#else
317
												#else
288
													<td>-</td>
318
													<td>-</td>
289
												#end
319
												#end
Line 308... Line 338...
308
															data-price="$tagListingsMap.get($stocklist.getCatalogId()).getSellingPrice()">
338
															data-price="$tagListingsMap.get($stocklist.getCatalogId()).getSellingPrice()">
309
														Add to PO
339
														Add to PO
310
													</button>
340
													</button>
311
												</td>
341
												</td>
312
											</tr>
342
											</tr>
-
 
343
											<tr id="our-stock-row-$stocklist.getCatalogId()"
-
 
344
												class="our-stock-detail-row"
-
 
345
												style="display: none; background-color: #e8f4fd;">
-
 
346
												<td colspan="11" style="padding: 10px 20px;">
-
 
347
													<div id="our-stock-content-$stocklist.getCatalogId()">
-
 
348
														<p>Loading...</p>
-
 
349
													</div>
-
 
350
												</td>
-
 
351
											</tr>
313
											#end
352
											#end
314
										#end
353
										#end
-
 
354
									<tr class="out-of-stock-row" style="background-color: #f8d7da;">
-
 
355
										<td colspan="11">
-
 
356
											<a href="#" style="color: #c0392b; font-weight: bold;"
-
 
357
											   onclick="toggleOutOfStock('$bnd', $warehouseId, this); return false;">
-
 
358
												<span class="oos-toggle-icon">+</span> Out of Stock Items
-
 
359
												(HID/FastMoving/Running)
-
 
360
											</a>
-
 
361
											<div id="oos-content-$bnd" class="oos-content"
-
 
362
												 style="display: none; margin-top: 10px;">
-
 
363
												<p>Loading...</p>
-
 
364
											</div>
-
 
365
										</td>
-
 
366
									</tr>
315
									</tbody>
367
									</tbody>
316
								</table>
368
								</table>
317
							#end
369
							#end
318
						</div>
370
						</div>
319
					</div>
371
					</div>
Line 340... Line 392...
340
<div class="modal-footer">
392
<div class="modal-footer">
341
	<button type="button" data-dismiss="modal" class="btn btn-default view-close">Close</button>
393
	<button type="button" data-dismiss="modal" class="btn btn-default view-close">Close</button>
342
 
394
 
343
</div>
395
</div>
344
 
396
 
-
 
397
<script>
-
 
398
	var ourStockDataLoaded = {};
-
 
399
	var oosDataLoaded = {};
-
 
400
 
-
 
401
	function toggleOurStockRow(catalogId, warehouseId, modelNumber) {
-
 
402
		var row = document.getElementById('our-stock-row-' + catalogId);
-
 
403
		var contentDiv = document.getElementById('our-stock-content-' + catalogId);
-
 
404
 
-
 
405
		if (row.style.display === 'none') {
-
 
406
			row.style.display = 'table-row';
-
 
407
 
-
 
408
			// Load data only if not already loaded
-
 
409
			if (!ourStockDataLoaded[catalogId]) {
-
 
410
				contentDiv.innerHTML = '<p>Loading...</p>';
-
 
411
 
-
 
412
				$.ajax({
-
 
413
					url: '${rc.contextPath}/indent/getOurStockDetails',
-
 
414
					type: 'GET',
-
 
415
					data: {catalogId: catalogId, warehouseId: warehouseId},
-
 
416
					success: function (response) {
-
 
417
 
-
 
418
 
-
 
419
						ourStockDataLoaded[catalogId] = true;
-
 
420
 
-
 
421
						var list = response.response;   // 🔥 correct key
-
 
422
 
-
 
423
						if (list && list.length > 0) {
-
 
424
							var html = '<strong>' + modelNumber + '</strong><br>';
-
 
425
							html += '<small style="color:#666;">' + list[0].itemDescription + '</small>';
-
 
426
 
-
 
427
							html += '<table class="table table-bordered table-sm" style="margin-top:5px">';
-
 
428
							html += '<thead><tr><th>Color</th><th>Qty</th></tr></thead><tbody>';
-
 
429
 
-
 
430
							for (var i = 0; i < list.length; i++) {
-
 
431
								html += '<tr>';
-
 
432
								html += '<td>' + (list[i].color || '-') + '</td>';
-
 
433
								html += '<td>' + list[i].qty + '</td>';
-
 
434
								html += '</tr>';
-
 
435
							}
-
 
436
 
-
 
437
							html += '</tbody></table>';
-
 
438
							contentDiv.innerHTML = html;
-
 
439
						} else {
-
 
440
							contentDiv.innerHTML = '<p>No color-wise stock details available</p>';
-
 
441
						}
-
 
442
					},
-
 
443
					error: function () {
-
 
444
						contentDiv.innerHTML = '<p style="color: red; margin: 0;">Error loading stock details</p>';
-
 
445
					}
-
 
446
				});
-
 
447
			}
-
 
448
		} else {
-
 
449
			row.style.display = 'none';
-
 
450
		}
-
 
451
	}
-
 
452
 
-
 
453
	function toggleOutOfStock(brand, warehouseId, linkElement) {
-
 
454
		var contentDiv = document.getElementById('oos-content-' + brand);
-
 
455
		var icon = linkElement.querySelector('.oos-toggle-icon');
-
 
456
 
-
 
457
		if (contentDiv.style.display === 'none') {
-
 
458
			contentDiv.style.display = 'block';
-
 
459
			icon.textContent = '-';
-
 
460
 
-
 
461
			// Load data only if not already loaded
-
 
462
			if (!oosDataLoaded[brand]) {
-
 
463
				contentDiv.innerHTML = '<p>Loading...</p>';
-
 
464
 
-
 
465
				$.ajax({
-
 
466
					url: '${rc.contextPath}/indent/getOutOfStockDetails',
-
 
467
					type: 'GET',
-
 
468
					data: {brand: brand, warehouseId: warehouseId},
-
 
469
					success: function (response) {
-
 
470
						console.log("RESPONSE:", response);
-
 
471
						oosDataLoaded[brand] = true;
-
 
472
 
-
 
473
						var list = response.response;   // 🔥 correct
-
 
474
 
-
 
475
						if (list && list.length > 0) {
-
 
476
							var html = '<table class="table table-bordered table-sm" style="margin-bottom: 0;">';
-
 
477
							html += '<thead><tr><th>Model Number</th><th>Status</th><th>Stock Qty</th></tr></thead><tbody>';
-
 
478
 
-
 
479
							for (var i = 0; i < list.length; i++) {
-
 
480
								html += '<tr style="background-color: #f8d7da;">';
-
 
481
								html += '<td>' + list[i].modelNumber + '</td>';
-
 
482
								html += '<td>' + list[i].status + '</td>';
-
 
483
								html += '<td>' + list[i].qty + '</td>';
-
 
484
								html += '</tr>';
-
 
485
							}
-
 
486
 
-
 
487
							html += '</tbody></table>';
-
 
488
							contentDiv.innerHTML = html;
-
 
489
						} else {
-
 
490
							contentDiv.innerHTML = '<p style="color: green; margin: 0;">No out of stock items for HID/FastMoving/Running categories.</p>';
-
 
491
						}
-
 
492
					},
-
 
493
					error: function () {
-
 
494
						contentDiv.innerHTML = '<p style="color: red; margin: 0;">Error loading out of stock details</p>';
-
 
495
					}
-
 
496
				});
-
 
497
			}
-
 
498
		} else {
-
 
499
			contentDiv.style.display = 'none';
-
 
500
			icon.textContent = '+';
-
 
501
		}
-
 
502
	}
-
 
503
</script>
-
 
504