Subversion Repositories SmartDukaan

Rev

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

Rev 33956 Rev 33958
Line 179... Line 179...
179
            });
179
            });
180
        });
180
        });
181
 
181
 
182
    }
182
    }
183
 
183
 
-
 
184
    function groupRowsByRbm() {
-
 
185
        const rows = document.querySelectorAll('#rbm-arr-table tbody tr');
-
 
186
        let currentRbm = null;
-
 
187
        let rbmGroup = [];
-
 
188
 
-
 
189
        rows.forEach((row, index) => {
-
 
190
            const rbmCell = row.cells[0];
-
 
191
            if (!rbmCell) return;
-
 
192
 
-
 
193
            const rbmName = rbmCell.textContent.split('-')[0].trim(); // Extract RBM name
-
 
194
 
-
 
195
            if (rbmName !== currentRbm) {
-
 
196
                // Apply border to the previous group
-
 
197
                if (rbmGroup.length > 0) {
-
 
198
                    applyBorderToGroup(rbmGroup);
-
 
199
                }
-
 
200
 
-
 
201
                // Reset for new RBM
-
 
202
                currentRbm = rbmName;
-
 
203
                rbmGroup = [];
-
 
204
            }
-
 
205
 
-
 
206
            // Add the row to the current group
-
 
207
            rbmGroup.push(row);
-
 
208
 
-
 
209
            // Apply border to the last group
-
 
210
            if (index === rows.length - 1 && rbmGroup.length > 0) {
-
 
211
                applyBorderToGroup(rbmGroup);
-
 
212
            }
-
 
213
        });
-
 
214
    }
-
 
215
 
-
 
216
    function applyBorderToGroup(group) {
-
 
217
        if (group.length === 0) return;
-
 
218
 
-
 
219
        // Add border styles to the first and last rows in the group
-
 
220
        //group[0].style.borderTop = '2px solid #000'; // Black border for start
-
 
221
        group[group.length - 1].style.borderBottom = '2px solid #000'; // Black border for end
-
 
222
    }
-
 
223
 
184
    window.onload = formatTargets;
224
    window.onload = function () {
-
 
225
        formatTargets(); // Format targets first
-
 
226
        groupRowsByRbm(); // Group rows by RBM
-
 
227
    };
-
 
228
 
-
 
229
 
185
</script>
230
</script>