Subversion Repositories SmartDukaan

Rev

Rev 35654 | Rev 35670 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
35631 ranu 1
<style>
2
    #rbm-call-target-table td, #rbm-call-target-table th {
3
        font-size: 14px;
4
        text-align: center;
5
        padding: 0.4rem;
6
        vertical-align: middle;
7
    }
8
 
9
    #rbm-call-target-table thead th {
10
        background-color: #343a40;
11
        color: white;
12
        font-weight: 600;
13
    }
14
 
15
    #rbm-call-target-table tbody tr:first-child td {
16
        font-weight: bold;
17
        background-color: #00d6b2;
18
    }
19
 
20
    .highlight-target {
21
        background-color: #fff3cd !important;
22
        font-weight: bold;
23
    }
24
 
25
    .highlight-achieved {
26
        background-color: #d4edda !important;
27
    }
28
 
29
    .highlight-oos {
30
        background-color: #f8d7da !important;
31
    }
32
 
33
    .highlight-plan-today {
34
        background-color: #0f57a4 !important;
35
        color: white !important;
36
    }
37
 
38
    .highlight-carry-forward {
39
        background-color: #ffc107 !important;
40
        color: #000 !important;
41
    }
42
 
43
    .highlight-untouched {
44
        background-color: #dc3545 !important;
45
        color: white !important;
46
    }
47
 
48
    .highlight-future-plan {
49
        background-color: #6c757d !important;
50
        color: #000 !important;
51
    }
52
 
53
    .clickable {
54
        cursor: pointer;
55
        text-decoration: underline;
56
        color: #007bff;
57
    }
58
 
59
    .clickable:hover {
60
        color: #0056b3;
61
    }
62
 
63
    .modal-body table {
64
        width: 100%;
65
    }
66
 
67
    .modal-body table th, .modal-body table td {
68
        padding: 8px;
69
        border: 1px solid #ddd;
70
    }
35654 ranu 71
 
72
    #oosDetailsContent table td, #oosDetailsContent table th {
73
        font-size: 12px;
74
    }
35631 ranu 75
</style>
76
 
77
<div class="container-fluid">
78
    <h3>RBM Call Target Summary</h3>
79
    <table id="rbm-call-target-table" class="table table-bordered table-striped">
80
        <thead>
81
        <tr>
82
            <th>RBM Name</th>
83
            <th>Partner Count</th>
35645 ranu 84
            <th>(Ach/Tgt)</th>
35631 ranu 85
            <th>Calling Target</th>
86
            <th>Called</th>
87
            <th class="highlight-plan-today">Plan Today</th>
88
            <th class="highlight-carry-forward">Carry Forward</th>
89
            <th style="background-color: #1e6e0e; color: white;">Zero Billing</th>
90
            <th class="highlight-untouched">Untouched</th>
91
            <th class="highlight-future-plan">Future Plan</th>
92
            <th>Normal</th>
93
            <th style="background-color: #c0392b;">Out of Sequence</th>
35645 ranu 94
            <th>Download</th>
35631 ranu 95
        </tr>
96
        </thead>
97
        <tbody>
98
            #set($totalPartnerCount = 0)
99
            #set($totalTodayTarget = 0)
100
            #set($totalValueAchieved = 0)
101
            #set($totalMovedToFuture = 0)
102
            #set($totalPlanToday = 0)
103
            #set($totalCarryForward = 0)
104
            #set($totalZeroBilling = 0)
105
            #set($totalUntouched = 0)
106
            #set($totalFuturePlan = 0)
107
            #set($totalNormal = 0)
108
            #set($totalOutOfSequence = 0)
109
            #set($totalL2CallingList = 0)
110
            #set($totalArrAchieved = 0)
111
            #set($totalArrTarget = 0)
112
 
113
            ## Total row first
114
            #foreach($model in $rbmCallTargetModels)
35662 ranu 115
                #if(!$model.isL2Position())
116
                    #set($totalPartnerCount = $totalPartnerCount + $model.getPartnerCount())
117
                #end
35631 ranu 118
                #set($totalTodayTarget = $totalTodayTarget + $model.getTodayTargetOfCall())
119
                #set($totalValueAchieved = $totalValueAchieved + $model.getValueTargetAchieved())
120
                #set($totalMovedToFuture = $totalMovedToFuture + $model.getMovedToFuture())
121
                #set($totalPlanToday = $totalPlanToday + $model.getPlanToday())
122
                #set($totalCarryForward = $totalCarryForward + $model.getCarryForward())
123
                #set($totalZeroBilling = $totalZeroBilling + $model.getZeroBilling())
124
                #set($totalUntouched = $totalUntouched + $model.getUntouched())
125
                #set($totalFuturePlan = $totalFuturePlan + $model.getFuturePlan())
126
                #set($totalNormal = $totalNormal + $model.getNormal())
127
                #set($totalOutOfSequence = $totalOutOfSequence + $model.getOutOfSequenceCount())
128
                #set($totalL2CallingList = $totalL2CallingList + $model.getL2CallingList())
129
                #if($arrAchievedByAuthId && $arrAchievedByAuthId.get($model.getAuthId()))
130
                    #set($totalArrAchieved = $totalArrAchieved + $arrAchievedByAuthId.get($model.getAuthId()))
131
                #end
132
                #if($arrTargetByAuthId && $arrTargetByAuthId.get($model.getAuthId()))
133
                    #set($totalArrTarget = $totalArrTarget + $arrTargetByAuthId.get($model.getAuthId()))
134
                #end
135
            #end
136
 
137
            #set($adjustedTotalTarget = $totalTodayTarget + $totalMovedToFuture)
138
            #set($adjustedTotalAchieved = $totalValueAchieved + $totalMovedToFuture)
139
 
140
        <tr>
141
            <td><strong>TOTAL</strong></td>
142
            <td><strong>$totalPartnerCount</strong></td>
35636 ranu 143
            <td><strong><span class="lakh">$totalArrAchieved</span> / <span class="lakh">$totalArrTarget</span></strong>
35631 ranu 144
            </td>
145
            <td class="highlight-target"><strong>$adjustedTotalTarget</strong></td>
146
            <td class="highlight-achieved currency"><strong>$adjustedTotalAchieved</strong></td>
147
            <td class="highlight-plan-today"><strong>$totalPlanToday</strong></td>
148
            <td class="highlight-carry-forward"><strong>$totalCarryForward</strong></td>
149
            <td><strong>$totalZeroBilling</strong></td>
150
            <td class="highlight-untouched"><strong>$totalUntouched</strong></td>
151
            <td class="highlight-future-plan"><strong>$totalFuturePlan</strong></td>
152
            <td><strong>$totalNormal</strong></td>
153
            <td class="highlight-oos"><strong>$totalOutOfSequence</strong></td>
35645 ranu 154
            <td></td>
35631 ranu 155
        </tr>
156
 
157
            #foreach($model in $rbmCallTargetModels)
158
                #set($rowTarget = $model.getTodayTargetOfCall() + $model.getMovedToFuture())
159
                #set($rowAchieved = $model.getValueTargetAchieved() + $model.getMovedToFuture())
160
            <tr>
161
                <td>$model.getRbmName()</td>
162
                <td>$model.getPartnerCount()</td>
163
                <td>
164
                    #if($arrAchievedByAuthId && $arrAchievedByAuthId.get($model.getAuthId()))
35636 ranu 165
                        <span class="lakh">$arrAchievedByAuthId.get($model.getAuthId())</span>
35631 ranu 166
                    #else
167
 
168
                    #end
169
                    /
170
                    #if($arrTargetByAuthId && $arrTargetByAuthId.get($model.getAuthId()))
35636 ranu 171
                        <span class="lakh">$arrTargetByAuthId.get($model.getAuthId())</span>
35631 ranu 172
                    #else
173
 
174
                    #end
175
                </td>
176
                <td class="highlight-target">$rowTarget</td>
177
                <td class="highlight-achieved currency">$rowAchieved</td>
178
                <td class="highlight-plan-today">$model.getPlanToday()</td>
179
                <td class="highlight-carry-forward">$model.getCarryForward()</td>
180
                <td>$model.getZeroBilling()</td>
181
                <td class="highlight-untouched">$model.getUntouched()</td>
182
                <td class="highlight-future-plan">$model.getFuturePlan()</td>
183
                <td>$model.getNormal()</td>
184
                <td class="highlight-oos" style="color: red;">
185
                    #if($model.getOutOfSequenceCount() > 0)
186
                        <span class="clickable" style="color: #e80404"
187
                              onclick="showOutOfSequenceDetails($model.getAuthId(), '$model.getRbmName()')">$model.getOutOfSequenceCount()</span>
188
                    #else
189
 
190
                    #end
191
                </td>
35645 ranu 192
                <td>
193
                    <a href="/indent/rbm_call_target/download_raw_data?authId=$model.getAuthId()" target="_blank"
194
                       class="btn btn-sm btn-outline-success">CSV</a>
195
                </td>
35631 ranu 196
            </tr>
197
            #end
198
        </tbody>
199
    </table>
200
</div>
201
 
202
<script type="text/javascript">
35638 ranu 203
    document.addEventListener('DOMContentLoaded', function () {
204
        var elems = document.querySelectorAll('.lakh');
205
        for (var i = 0; i < elems.length; i++) {
206
            var val = parseInt(elems[i].textContent.trim());
35636 ranu 207
            if (!isNaN(val)) {
35638 ranu 208
                elems[i].textContent = (val / 100000).toFixed(1) + 'L';
35636 ranu 209
            }
35638 ranu 210
        }
35636 ranu 211
    });
212
 
35631 ranu 213
    function showOutOfSequenceDetails(authId, rbmName) {
214
        document.getElementById('oosModalLabel').textContent = 'Out of Sequence Calls - ' + rbmName;
215
        document.getElementById('oosDetailsContent').innerHTML = '<p>Loading...</p>';
216
        $('#oosModal').modal('show');
217
 
218
        fetch('/indent/rbm_call_target/oos_details?authId=' + authId)
219
                .then(function (response) {
220
                    return response.json();
221
                })
222
                .then(function (data) {
223
                    if (data && data.length > 0) {
224
                        var html = '<table class="table table-bordered table-sm"><thead><tr><th>S.No</th><th>Party Name</th><th>Code</th><th>Time</th></tr></thead><tbody>';
225
                        for (var i = 0; i < data.length; i++) {
226
                            html += '<tr><td>' + (i + 1) + '</td><td>' + data[i].partyName + '</td><td>' + data[i].code + '</td><td>' + data[i].time + '</td></tr>';
227
                        }
228
                        html += '</tbody></table>';
229
                        document.getElementById('oosDetailsContent').innerHTML = html;
230
                    } else {
231
                        document.getElementById('oosDetailsContent').innerHTML = '<p>No out of sequence calls found.</p>';
232
                    }
233
                })
234
                .catch(function () {
235
                    document.getElementById('oosDetailsContent').innerHTML = '<p>Error loading details. Please try again.</p>';
236
                });
237
    }
238
</script>