| 33991 |
ranu |
1 |
<link rel="stylesheet"
|
|
|
2 |
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-daterangepicker/3.1.0/daterangepicker.min.css"/>
|
|
|
3 |
|
| 33951 |
ranu |
4 |
<style>
|
|
|
5 |
table th {
|
|
|
6 |
text-align: center;
|
|
|
7 |
}
|
|
|
8 |
|
|
|
9 |
#rbm-arr-table td, #rbm-arr-table th {
|
|
|
10 |
padding: 0.35rem;
|
| 33997 |
ranu |
11 |
font-size: 18px;
|
| 33951 |
ranu |
12 |
}
|
|
|
13 |
|
| 33953 |
ranu |
14 |
.text-bold {
|
|
|
15 |
font-weight: bold !important;
|
|
|
16 |
}
|
|
|
17 |
|
|
|
18 |
.text-bold span {
|
|
|
19 |
font-weight: bold;
|
|
|
20 |
}
|
|
|
21 |
|
| 33951 |
ranu |
22 |
.rb-name {
|
| 33997 |
ranu |
23 |
font-size: 16px;
|
| 33951 |
ranu |
24 |
font-weight: bold;
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
#rbm-arr-table td {
|
|
|
28 |
text-align: center;
|
|
|
29 |
background-size: 100% 100%;
|
|
|
30 |
background-repeat: no-repeat;
|
|
|
31 |
color: #000; /* Ensure text remains visible */
|
|
|
32 |
font-weight: 400;
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
</style>
|
|
|
36 |
|
| 33917 |
ranu |
37 |
<section class="wrapper">
|
|
|
38 |
<div class="row">
|
| 33992 |
ranu |
39 |
#if($isGtEqL3)
|
| 33991 |
ranu |
40 |
<div class="col-md-12 text-right">
|
|
|
41 |
<table style="float:right;margin-bottom: 10px;">
|
|
|
42 |
<tr>
|
|
|
43 |
<td>
|
|
|
44 |
<input placeholder="Set Duration" name="rbmArrPeriod"
|
|
|
45 |
id="rbmArrPeriod"
|
|
|
46 |
type="text" value="" class="form-control input-sm" style="height: 34px;">
|
|
|
47 |
</td>
|
|
|
48 |
<td>
|
| 34002 |
ranu |
49 |
<input class="btn btn-primary btn-sm rbm-target-achievement"
|
|
|
50 |
type="button"
|
|
|
51 |
value="View">
|
|
|
52 |
</td>
|
|
|
53 |
<td>
|
| 33991 |
ranu |
54 |
<input class="btn btn-primary btn-sm sold-catalog-report"
|
|
|
55 |
type="button"
|
|
|
56 |
value="Download row data">
|
|
|
57 |
</td>
|
|
|
58 |
</tr>
|
|
|
59 |
</table>
|
|
|
60 |
</div>
|
| 33992 |
ranu |
61 |
#end
|
| 33917 |
ranu |
62 |
<div class="col-lg-12">
|
|
|
63 |
<table id="rbm-arr-table" class="table table-border table-condensed table-bordered" style="width:100%">
|
|
|
64 |
<tr>
|
| 33939 |
ranu |
65 |
<th>RBM</th>
|
|
|
66 |
<th>Total (ACH/TGT)</th>
|
|
|
67 |
<th>%</th>
|
|
|
68 |
<th>HID (ACH/TGT)</th>
|
|
|
69 |
<th>%</th>
|
| 33956 |
ranu |
70 |
<th>FAST (ACH/TGT)</th>
|
|
|
71 |
<th>%</th>
|
| 33939 |
ranu |
72 |
<th>RUN (ACH/TGT)</th>
|
|
|
73 |
<th>%</th>
|
|
|
74 |
<th>EOL (ACH/TGT)</th>
|
|
|
75 |
<th>%</th>
|
|
|
76 |
<th>Other (ACH/TGT)</th>
|
|
|
77 |
<th>%</th>
|
| 33917 |
ranu |
78 |
</tr>
|
| 33939 |
ranu |
79 |
#foreach($target in $rbmArrViewModels)
|
| 33917 |
ranu |
80 |
<tr>
|
| 33933 |
ranu |
81 |
<td>$target.getRbmName()- $target.getWarehouseName()</td>
|
| 33939 |
ranu |
82 |
<td><span class="achieved-cell">$target.getTotalAchievedTarget()</span> / <span
|
|
|
83 |
class="target-cell">$target.getTodayTarget()</span></td>
|
|
|
84 |
<td class="total-percent"></td>
|
|
|
85 |
<td><span class="achieved-cell">$target.getTodayAchievedHidTarget()</span> / <span
|
|
|
86 |
class="target-cell">$target.getTodayHidTarget()</span></td>
|
|
|
87 |
<td class="hid-percent"></td>
|
|
|
88 |
<td><span class="achieved-cell">$target.getTodayAchievedFastMovingTarget()</span> / <span
|
|
|
89 |
class="target-cell">$target.getTodayFastMovingTarget()</span></td>
|
|
|
90 |
<td class="run-percent"></td>
|
|
|
91 |
<td><span class="achieved-cell">$target.getTodayAchievedSlowMovingTarget()</span> / <span
|
|
|
92 |
class="target-cell">$target.getTodaySlowMovingTarget()</span></td>
|
|
|
93 |
<td class="slow-percent"></td>
|
|
|
94 |
<td><span class="achieved-cell">$target.getTodayAchievedEolTarget()</span> / <span
|
|
|
95 |
class="target-cell">$target.getTodayEolTarget()</span></td>
|
|
|
96 |
<td class="eol-percent"></td>
|
|
|
97 |
<td><span class="achieved-cell">$target.getTodayAchievedOtherMovingTarget()</span> / <span
|
|
|
98 |
class="target-cell">$target.getTodayOtherMovingTarget()</span></td>
|
|
|
99 |
<td class="other-percent"></td>
|
| 33917 |
ranu |
100 |
</tr>
|
| 33939 |
ranu |
101 |
#end
|
| 33946 |
ranu |
102 |
<!-- Add a row for totals -->
|
| 33942 |
ranu |
103 |
<tr>
|
|
|
104 |
<td><strong>Total</strong></td>
|
| 33953 |
ranu |
105 |
<td class="text-bold"><span class="achieved-cell">$totalAchieved </span> / <span
|
|
|
106 |
class="target-cell">$totalTargetSum</span></td>
|
|
|
107 |
<td class="total-percent text-bold"></td>
|
| 33951 |
ranu |
108 |
|
| 33953 |
ranu |
109 |
<td class="text-bold"><span class="achieved-cell">$totalHidAchievedSum</span> / <span
|
|
|
110 |
class="target-cell">$totalHidSum</span></td>
|
|
|
111 |
<td class="hid-percent text-bold"></td>
|
| 33951 |
ranu |
112 |
|
| 33953 |
ranu |
113 |
<td class="text-bold"><span class="achieved-cell">$totalFastAchievedSum</span> / <span
|
|
|
114 |
class="target-cell">$totalFastSum</span></td>
|
|
|
115 |
<td class="run-percent text-bold"></td>
|
| 33951 |
ranu |
116 |
|
| 33953 |
ranu |
117 |
<td class="text-bold"><span class="achieved-cell">$totalSlowAchievedSum</span> / <span
|
|
|
118 |
class="target-cell">$totalSlowSum</span></td>
|
|
|
119 |
<td class="slow-percent text-bold"></td>
|
| 33951 |
ranu |
120 |
|
| 33953 |
ranu |
121 |
<td class="text-bold"><span class="achieved-cell">$totalEolAchievedSum</span> / <span
|
|
|
122 |
class="target-cell">$totalEolSum</span></td>
|
|
|
123 |
<td class="eol-percent text-bold"></td>
|
| 33951 |
ranu |
124 |
|
| 33953 |
ranu |
125 |
<td class="text-bold"><span class="achieved-cell">$totalOtherAchievedSum</span> / <span
|
|
|
126 |
class="target-cell">$totalOtherSum</span></td>
|
|
|
127 |
<td class="other-percent text-bold"></td>
|
| 33942 |
ranu |
128 |
</tr>
|
| 33951 |
ranu |
129 |
|
| 33917 |
ranu |
130 |
</table>
|
|
|
131 |
</div>
|
|
|
132 |
</div>
|
| 33930 |
ranu |
133 |
</section>
|
| 33945 |
ranu |
134 |
|
| 33930 |
ranu |
135 |
<script>
|
| 33933 |
ranu |
136 |
function formatValueInLakh(value) {
|
| 33939 |
ranu |
137 |
return (value / 100000).toFixed(1) + 'L';
|
| 33930 |
ranu |
138 |
}
|
|
|
139 |
|
|
|
140 |
function formatTargets() {
|
|
|
141 |
const rows = document.querySelectorAll('#rbm-arr-table tbody tr');
|
| 33942 |
ranu |
142 |
let totalAchieved = 0, totalTarget = 0;
|
|
|
143 |
let totalAchievedHid = 0, totalTargetHid = 0;
|
|
|
144 |
let totalAchievedRun = 0, totalTargetRun = 0;
|
|
|
145 |
let totalAchievedSlow = 0, totalTargetSlow = 0;
|
|
|
146 |
let totalAchievedEol = 0, totalTargetEol = 0;
|
|
|
147 |
let totalAchievedOther = 0, totalTargetOther = 0;
|
| 33930 |
ranu |
148 |
|
|
|
149 |
rows.forEach(row => {
|
| 33931 |
ranu |
150 |
const cells = row.querySelectorAll('td');
|
| 33946 |
ranu |
151 |
cells.forEach((cell, index) => {
|
|
|
152 |
const achievedSpan = cell.querySelector('.achieved-cell');
|
|
|
153 |
const targetSpan = cell.querySelector('.target-cell');
|
|
|
154 |
if (achievedSpan && targetSpan) {
|
|
|
155 |
const achievedValue = parseFloat(achievedSpan.textContent.replace(/[^\d.-]/g, ''));
|
|
|
156 |
const targetValue = parseFloat(targetSpan.textContent.replace(/[^\d.-]/g, ''));
|
| 33944 |
ranu |
157 |
|
| 33946 |
ranu |
158 |
// Add to totals
|
|
|
159 |
if (index === 1) {
|
|
|
160 |
totalAchieved += achievedValue || 0;
|
|
|
161 |
totalTarget += targetValue || 0;
|
|
|
162 |
} else if (index === 3) {
|
|
|
163 |
totalAchievedHid += achievedValue || 0;
|
|
|
164 |
totalTargetHid += targetValue || 0;
|
|
|
165 |
} else if (index === 5) {
|
|
|
166 |
totalAchievedRun += achievedValue || 0;
|
|
|
167 |
totalTargetRun += targetValue || 0;
|
|
|
168 |
} else if (index === 7) {
|
|
|
169 |
totalAchievedSlow += achievedValue || 0;
|
|
|
170 |
totalTargetSlow += targetValue || 0;
|
|
|
171 |
} else if (index === 9) {
|
|
|
172 |
totalAchievedEol += achievedValue || 0;
|
|
|
173 |
totalTargetEol += targetValue || 0;
|
|
|
174 |
} else if (index === 11) {
|
|
|
175 |
totalAchievedOther += achievedValue || 0;
|
|
|
176 |
totalTargetOther += targetValue || 0;
|
|
|
177 |
}
|
| 33930 |
ranu |
178 |
|
| 33946 |
ranu |
179 |
// Format values in lakh
|
|
|
180 |
if (!isNaN(achievedValue)) achievedSpan.textContent = formatValueInLakh(achievedValue);
|
|
|
181 |
if (!isNaN(targetValue)) targetSpan.textContent = formatValueInLakh(targetValue);
|
| 33942 |
ranu |
182 |
|
| 33946 |
ranu |
183 |
const percentCell = cell.nextElementSibling;
|
|
|
184 |
if (percentCell && targetValue > 0) {
|
|
|
185 |
const percentage = ((achievedValue / targetValue) * 100).toFixed(1);
|
|
|
186 |
percentCell.textContent = percentage + '%';
|
| 33931 |
ranu |
187 |
|
| 33946 |
ranu |
188 |
// Determine background color based on percentage
|
|
|
189 |
let color;
|
| 33962 |
ranu |
190 |
if (percentage <= 1) {
|
|
|
191 |
percentCell.style.color = `red`
|
|
|
192 |
}
|
| 33946 |
ranu |
193 |
if (percentage <= 40) {
|
|
|
194 |
color = '#F56983FF'; // Orange for <= 40%
|
|
|
195 |
} else if (percentage > 40 && percentage <= 75) {
|
|
|
196 |
color = '#f2c947e8'; // Yellow for 41% - 75%
|
|
|
197 |
} else {
|
|
|
198 |
color = '#82ef8299'; // Green for > 75%
|
|
|
199 |
}
|
| 33945 |
ranu |
200 |
|
| 33946 |
ranu |
201 |
// Apply gradient background with the color
|
|
|
202 |
percentCell.style.background = `linear-gradient(to right, ${color} ${percentage}%, transparent ${percentage}%)`;
|
|
|
203 |
} else if (percentCell) {
|
| 33953 |
ranu |
204 |
percentCell.textContent = "-";
|
| 33946 |
ranu |
205 |
percentCell.style.background = 'none';
|
| 33931 |
ranu |
206 |
}
|
| 33946 |
ranu |
207 |
}
|
| 33930 |
ranu |
208 |
});
|
| 33946 |
ranu |
209 |
});
|
| 33942 |
ranu |
210 |
|
| 33946 |
ranu |
211 |
}
|
| 33944 |
ranu |
212 |
|
| 33958 |
ranu |
213 |
function groupRowsByRbm() {
|
|
|
214 |
const rows = document.querySelectorAll('#rbm-arr-table tbody tr');
|
|
|
215 |
let currentRbm = null;
|
|
|
216 |
let rbmGroup = [];
|
|
|
217 |
|
|
|
218 |
rows.forEach((row, index) => {
|
|
|
219 |
const rbmCell = row.cells[0];
|
|
|
220 |
if (!rbmCell) return;
|
|
|
221 |
|
|
|
222 |
const rbmName = rbmCell.textContent.split('-')[0].trim(); // Extract RBM name
|
|
|
223 |
|
|
|
224 |
if (rbmName !== currentRbm) {
|
|
|
225 |
// Apply border to the previous group
|
|
|
226 |
if (rbmGroup.length > 0) {
|
|
|
227 |
applyBorderToGroup(rbmGroup);
|
|
|
228 |
}
|
|
|
229 |
|
|
|
230 |
// Reset for new RBM
|
|
|
231 |
currentRbm = rbmName;
|
|
|
232 |
rbmGroup = [];
|
|
|
233 |
}
|
|
|
234 |
|
|
|
235 |
// Add the row to the current group
|
|
|
236 |
rbmGroup.push(row);
|
|
|
237 |
|
|
|
238 |
// Apply border to the last group
|
|
|
239 |
if (index === rows.length - 1 && rbmGroup.length > 0) {
|
|
|
240 |
applyBorderToGroup(rbmGroup);
|
|
|
241 |
}
|
|
|
242 |
});
|
|
|
243 |
}
|
|
|
244 |
|
|
|
245 |
function applyBorderToGroup(group) {
|
|
|
246 |
if (group.length === 0) return;
|
|
|
247 |
|
|
|
248 |
// Add border styles to the first and last rows in the group
|
|
|
249 |
//group[0].style.borderTop = '2px solid #000'; // Black border for start
|
|
|
250 |
group[group.length - 1].style.borderBottom = '2px solid #000'; // Black border for end
|
|
|
251 |
}
|
|
|
252 |
|
|
|
253 |
window.onload = function () {
|
|
|
254 |
formatTargets(); // Format targets first
|
|
|
255 |
groupRowsByRbm(); // Group rows by RBM
|
|
|
256 |
};
|
|
|
257 |
|
|
|
258 |
|
| 33945 |
ranu |
259 |
</script>
|