Subversion Repositories SmartDukaan

Rev

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

Rev 33925 Rev 33930
Line 1... Line 1...
1
<style>
1
<style>
-
 
2
 
2
    #rbm-arr-table th {
3
    table th {
-
 
4
        text-align: center;
-
 
5
    }
-
 
6
 
-
 
7
    #rbm-arr-table td, #rbm-arr-table th {
-
 
8
        padding: 0.35rem;
3
        font-size: 17px;
9
        font-size: 20px;
4
    }
10
    }
5
 
11
 
-
 
12
 
6
    #rbm-arr-table td {
13
    .rb-name {
7
        font-size: 16px;
14
        font-size: 17px;
-
 
15
        font-weight: bold;
8
    }
16
    }
9
</style>
17
</style>
10
 
18
 
11
<section class="wrapper">
19
<section class="wrapper">
12
    ##    <div class="row">
20
    ##    <div class="row">
Line 34... Line 42...
34
        <div class="col-lg-12">
42
        <div class="col-lg-12">
35
            <table id="rbm-arr-table" class="table table-border table-condensed table-bordered" style="width:100%">
43
            <table id="rbm-arr-table" class="table table-border table-condensed table-bordered" style="width:100%">
36
 
44
 
37
                <thead>
45
                <thead>
38
                <tr>
46
                <tr>
39
                    <th rowspan="2" width="16%">RBM</th>
47
                    <th rowspan="2" class="text-left">RBM</th>
40
                    <th colspan="2">HID</th>
48
                    <th colspan="2" class="text-center">HID</th>
41
                    <th colspan="2">RUN</th>
49
                    <th colspan="2">RUN</th>
42
                    <th colspan="2">SLOW</th>
50
                    <th colspan="2">SLOW</th>
43
                    <th colspan="2">EOL</th>
51
                    <th colspan="2">EOL</th>
44
                    <th colspan="2">Other</th>
52
                    <th colspan="2">Other</th>
45
                    <th colspan="2">Total</th>
53
                    <th colspan="2">Total</th>
46
                </tr>
54
                </tr>
47
                <tr>
55
                <tr>
48
                    <th>Target</th>
56
                    <th>TGT</th>
49
                    <th>Achieved</th>
57
                    <th>ACH</th>
50
 
58
 
51
                    <th>Target</th>
59
                    <th>TGT</th>
52
                    <th>Achieved</th>
60
                    <th>ACH</th>
53
 
61
 
54
                    <th>Target</th>
62
                    <th>TGT</th>
55
                    <th>Achieved</th>
63
                    <th>ACH</th>
56
 
64
 
57
                    <th>Target</th>
65
                    <th>TGT</th>
58
                    <th>Achieved</th>
66
                    <th>ACH</th>
59
 
67
 
60
                    <th>Target</th>
68
                    <th>TGT</th>
61
                    <th>Achieved</th>
69
                    <th>ACH</th>
62
 
70
 
63
                    <th>Target</th>
71
                    <th>TGT</th>
64
                    <th>Achieved</th>
72
                    <th>ACH</th>
65
                </tr>
73
                </tr>
66
 
74
 
67
                </thead>
75
                </thead>
68
                #foreach($target in $rbmArrViewModels)
76
                #foreach($target in $rbmArrViewModels)
69
                    <tbody>
77
                    <tbody>
70
                    <tr>
78
                    <tr>
71
                        <td>$target.getRbmName()- $target.getWarehouseName()</td>
79
                        <td class="rb-name">$target.getRbmName()- $target.getWarehouseName()</td>
72
 
80
 
73
                        <td>$target.getTodayHidTarget()</td>
81
                        <td class="target-cell">$target.getTodayHidTarget()</td>
74
                        <td>$target.getTodayAchievedHidTarget()</td>
82
                        <td class="achieved-cell">$target.getTodayAchievedHidTarget()</td>
75
 
83
 
76
                        <td>$target.getTodayFastMovingTarget()</td>
84
                        <td class="target-cell">$target.getTodayFastMovingTarget()</td>
77
                        <td>$target.getTodayAchievedFastMovingTarget()</td>
85
                        <td class="achieved-cell">$target.getTodayAchievedFastMovingTarget()</td>
78
 
86
 
79
                        <td>$target.getTodaySlowMovingTarget()</td>
87
                        <td class="target-cell">$target.getTodaySlowMovingTarget()</td>
80
                        <td>$target.getTodayAchievedSlowMovingTarget()</td>
88
                        <td class="achieved-cell">$target.getTodayAchievedSlowMovingTarget()</td>
81
 
89
 
82
                        <td>$target.getTodayEolTarget()</td>
90
                        <td class="target-cell">$target.getTodayEolTarget()</td>
83
                        <td>$target.getTodayAchievedEolTarget()</td>
91
                        <td class="achieved-cell">$target.getTodayAchievedEolTarget()</td>
84
 
92
 
85
                        <td>$target.getTodayOtherMovingTarget()</td>
93
                        <td class="target-cell">$target.getTodayOtherMovingTarget()</td>
86
                        <td>$target.getTodayAchievedOtherMovingTarget()</td>
94
                        <td class="achieved-cell">$target.getTodayAchievedOtherMovingTarget()</td>
87
 
95
 
88
                        <td>$target.getTodayTarget()</td>
96
                        <td class="target-cell">$target.getTodayTarget()</td>
89
                        <td>$target.getTotalAchievedTarget()</td>
97
                        <td class="achieved-cell">$target.getTotalAchievedTarget()</td>
90
                    </tr>
98
                    </tr>
91
                    </tbody>
99
                    </tbody>
92
                #end
100
                #end
93
 
101
 
94
            </table>
102
            </table>
Line 96... Line 104...
96
 
104
 
97
 
105
 
98
    </div>
106
    </div>
99
 
107
 
100
 
108
 
101
</section>
-
 
102
109
</section>
-
 
110
 
-
 
111
<script>
-
 
112
    // Function to format the numbers with appropriate abbreviations
-
 
113
    function formatValue(value) {
-
 
114
        if (value >= 10000000) {  // 1 Crore and above
-
 
115
            return (value / 10000000).toFixed(1) + 'Cr'; // 1 Cr = 10,000,000
-
 
116
        } else if (value >= 100000) {  // 1 Lakh and above
-
 
117
            return (value / 100000).toFixed(1) + 'L'; // 1 Lakh = 100,000
-
 
118
        } else if (value >= 1000) {  // 1 Thousand and above
-
 
119
            return (value / 1000).toFixed(1) + 'K'; // 1K = 1,000
-
 
120
        } else {
-
 
121
            return value.toFixed(1); // Show decimals for values below 1000
-
 
122
        }
-
 
123
    }
-
 
124
 
-
 
125
    // Function to format all target and achieved values in the table and apply color conditionally
-
 
126
    function formatTargets() {
-
 
127
        // Select all rows to compare target and achieved cells
-
 
128
        const rows = document.querySelectorAll('#rbm-arr-table tbody tr');
-
 
129
 
-
 
130
        rows.forEach(row => {
-
 
131
            // Get all target and achieved cells in the current row
-
 
132
            const targetCells = row.querySelectorAll('.target-cell');
-
 
133
            const achievedCells = row.querySelectorAll('.achieved-cell');
-
 
134
 
-
 
135
            targetCells.forEach((targetCell, index) => {
-
 
136
                // Convert text content to numeric values
-
 
137
                let targetValue = parseFloat(targetCell.textContent.replace(/[^\d.-]/g, ''));
-
 
138
                let achievedValue = parseFloat(achievedCells[index].textContent.replace(/[^\d.-]/g, ''));
-
 
139
 
-
 
140
                // Format both cells with the abbreviated units
-
 
141
                if (!isNaN(targetValue)) targetCell.textContent = formatValue(targetValue);
-
 
142
                if (!isNaN(achievedValue)) achievedCells[index].textContent = formatValue(achievedValue);
-
 
143
 
-
 
144
                // Apply green background if achieved value is greater than or equal to target
-
 
145
                if (!isNaN(targetValue) && !isNaN(achievedValue) && achievedValue >= targetValue) {
-
 
146
                    achievedCells[index].style.backgroundColor = '#abf2abd4';
-
 
147
                }
-
 
148
            });
-
 
149
        });
-
 
150
    }
-
 
151
 
-
 
152
    // Run the function when the page loads or after data is dynamically added to the table
-
 
153
    window.onload = formatTargets;  // Call when the page is loaded
-
 
154
</script>
-
 
155
 
-
 
156
 
-
 
157
 
-
 
158
 
-
 
159
 
-
 
160