Rev 33932 | Rev 33934 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<style>table th {text-align: center;}#rbm-arr-table td, #rbm-arr-table th {padding: 0.35rem;font-size: 20px;}.rb-name {font-size: 17px;font-weight: bold;}</style><section class="wrapper">## <div class="row">## <div class="col-lg-12">## <h3 class="page-header"><i class="icon_document_alt"></i>RBM ARR</h3>## <ol class="breadcrumb">## <li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Home</a></li>## <li><i class="icon_document_alt"></i>RBM Wise Today's ARR (Basis Product Movement)</li>## </ol>## </div>## </div><div class="row">## <div class="col-lg-4">## <table>## <tr>## <td style="margin-right: 10px;"><input type="date" class="form-control arr-start_date" placeholder="select date"> </td>## <td><button type="button" class="btn btn-info arr-button-mk">Submit</button> </td>## </tr>## </table>## </div>## <div class="col-lg-8"></div><div class="clearfix"></div><br><div class="col-lg-12"><table id="rbm-arr-table" class="table table-border table-condensed table-bordered" style="width:100%"><thead><tr><th class="text-left">RBM</th><th class="text-center">Total (ach/tgt)</th><th class="text-center">HID (ach/tgt)</th><th class="text-center">RUN (ach/tgt)</th><th class="text-center">SLOW (ach/tgt)</th><th class="text-center">EOL (ach/tgt)</th><th class="text-center">Other (ach/tgt)</th></tr></thead>#foreach($target in $rbmArrViewModels)<tbody><tr><td>$target.getRbmName()- $target.getWarehouseName()</td><td class="text-center"><span class="target-cell">$target.getTodayTarget()</span> / <spanclass="achieved-cell">$target.getTotalAchievedTarget()</span></td><td class="text-center"><span class="target-cell">$target.getTodayHidTarget()</span> / <spanclass="achieved-cell">$target.getTodayAchievedHidTarget()</span></td><td class="text-center"><span class="target-cell">$target.getTodayFastMovingTarget()</span> /<span class="achieved-cell">$target.getTodayAchievedFastMovingTarget()</span></td><td class="text-center"><span class="target-cell">$target.getTodaySlowMovingTarget()</span> /<span class="achieved-cell">$target.getTodayAchievedSlowMovingTarget()</span></td><td class="text-center"><span class="target-cell">$target.getTodayEolTarget()</span> / <spanclass="achieved-cell">$target.getTodayAchievedEolTarget()</span></td><td class="text-center"><span class="target-cell">$target.getTodayOtherMovingTarget()</span> /<span class="achieved-cell">$target.getTodayAchievedOtherMovingTarget()</span></td></tr></tbody>#end</table></div></div></section><script>// Function to format the numbers in lakh (L)function formatValueInLakh(value) {return (value / 100000).toFixed(1) + 'L'; // Divide by 100,000 and append 'L'}// Function to format all target and achieved values in the table and apply color conditionallyfunction formatTargets() {// Select all rows to compare target and achieved cellsconst rows = document.querySelectorAll('#rbm-arr-table tbody tr');rows.forEach(row => {// Get all cells in the current row with target and achieved spansconst cells = row.querySelectorAll('td');cells.forEach(cell => {// Find the target and achieved spans in the current cellconst targetSpan = cell.querySelector('.target-cell');const achievedSpan = cell.querySelector('.achieved-cell');if (targetSpan && achievedSpan) {// Convert text content to numeric valueslet targetValue = parseFloat(targetSpan.textContent.replace(/[^\d.-]/g, ''));let achievedValue = parseFloat(achievedSpan.textContent.replace(/[^\d.-]/g, ''));// Format both spans to lakhif (!isNaN(targetValue)) targetSpan.textContent = formatValueInLakh(targetValue);if (!isNaN(achievedValue)) achievedSpan.textContent = formatValueInLakh(achievedValue);// Apply green background to the entire cell if achieved value is greater than or equal to targetif (!isNaN(targetValue) && !isNaN(achievedValue) && achievedValue >= targetValue) {cell.style.backgroundColor = '#abf2abd4'; // Apply green to the <td>}}});});}// Run the function when the page loads or after data is dynamically added to the tablewindow.onload = formatTargets; // Call when the page is loaded</script>