Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
29966 amit.gupta 1
<html lang="en">
2
<head>
29983 amit.gupta 3
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
29988 amit.gupta 4
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
5
          integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
29966 amit.gupta 6
    <style>
7
        html, body {
29983 amit.gupta 8
            margin-top: 10px;
29966 amit.gupta 9
            padding: 0;
10
        }
11
 
12
 
13
        td, th {
29981 amit.gupta 14
            font-size: 20px;
29966 amit.gupta 15
        }
16
 
29988 amit.gupta 17
 
18
        .table td, .table th {
19
            padding: 0.25rem;
20
        }
21
 
30786 amit.gupta 22
        tr:first-child.green td {
29981 amit.gupta 23
            font-weight: bold;
29982 amit.gupta 24
            background-color: #00d6b2;
29981 amit.gupta 25
        }
29982 amit.gupta 26
 
27
        td {
29983 amit.gupta 28
            font-size: 24px;
29982 amit.gupta 29
        }
29966 amit.gupta 30
    </style>
31
    <link href="../resources/css/brand-logo.css" rel="stylesheet"/>
32
</head>
33
<body>
33991 ranu 34
 
35
    #if($isGtEqL2)
34055 ranu 36
 
37
        #parse("rbm-today-arr.vm")
35201 ranu 38
    <br>
35147 ranu 39
    <div class="container-fluid mb-3">
35202 ranu 40
        <select id="categoryDropdown" class="form-control mb-3"
41
                style="width:200px; display:inline-block;margin-right: 10px;">
35201 ranu 42
            <option value="RBM">All RBMs</option>
43
            <option value="BM">All BMs</option>
44
            <option value="ASM">All ASMs</option>
35147 ranu 45
        </select>
35174 ranu 46
        <button class="partnerwise-billed-po btn btn-info btn-sm">Today PO and Billed (Partner
35172 ranu 47
            wise)
48
        </button>
35147 ranu 49
 
35201 ranu 50
        <div class="purchaseMilestoneContainer">
51
            <!-- Initial table load -->
52
            #parse("today_po_table_fragment.vm")
53
        </div>
29966 amit.gupta 54
 
35201 ranu 55
    </div>
35199 ranu 56
    <div class="container-fluid ">
33700 amit.gupta 57
    <h3>Total Collection(Overall Collection/Limit Utilization))</h3>
29994 amit.gupta 58
    <div class="row">
59
        #foreach($warehouseEntry in $warehouseMap.entrySet())
31345 amit.gupta 60
            <div class="col-lg-2" style="font-size: 20px">
29994 amit.gupta 61
                $warehouseEntry.getValue() -
62
                #if($warehouseCollectionMap.get($warehouseEntry.getKey()))
31250 amit.gupta 63
                    <span class="currency">$warehouseCollectionMap.get($warehouseEntry.getKey())</span>
29994 amit.gupta 64
                #else
65
 
66
                #end
31242 amit.gupta 67
                /
31250 amit.gupta 68
                #if($warehousePgCollectionMap.get($warehouseEntry.getKey()))
31251 amit.gupta 69
                    <span class="currency">$warehousePgCollectionMap.get($warehouseEntry.getKey())</span>
31242 amit.gupta 70
                #else
71
 
72
                #end
73
 
29994 amit.gupta 74
            </div>
75
        #end
76
    </div>
30784 amit.gupta 77
</div>
35631 ranu 78
        ##    #parse("today_target.vm")
36307 ranu 79
 
36315 ranu 80
        ## ============ RBM Performance Dashboard ============
81
        #if($performanceDashboard && !$performanceDashboard.isEmpty())
36307 ranu 82
        <style>
83
            #performance-dashboard-table th {
84
                font-size: 13px;
85
                text-align: center;
86
                padding: 0.4rem;
87
                vertical-align: middle;
88
            }
89
 
90
            #performance-dashboard-table td {
91
                font-size: 13px;
92
                text-align: center;
93
                padding: 0.2rem;
94
                vertical-align: middle;
95
            }
96
        </style>
97
        <div class="container-fluid mb-3">
98
            <h3 class="mb-2">RBM Performance Dashboard (MTD)</h3>
99
            <div class="table-responsive">
100
                <table class="table table-bordered table-striped" id="performance-dashboard-table"
101
                       style="font-size: 13px;">
102
                    <thead>
103
                    <tr style="background-color: rgb(52,58,64); color: white; text-align: center;">
104
                        <th style="width: 40px;">Rank</th>
105
                        <th>RBM Name</th>
106
                        <th style="width: 80px;">Partners</th>
36907 ranu 107
                        <th style="background-color: rgb(40,167,69); color: white;">Talk Time<br><small>(10%)</small>
36307 ranu 108
                        </th>
36907 ranu 109
                        <th style="background-color: rgb(23,162,184); color: white;">DRR Achv<br><small>(55%)</small>
36307 ranu 110
                        </th>
111
                        <th style="background-color: rgb(253,126,20); color: white;">15 Days
36908 ranu 112
                            Ageing<br><small>(2%)</small></th>
36307 ranu 113
                        <th style="background-color: rgb(111,66,193); color: white;">&gt;1L
36908 ranu 114
                            Partners<br><small>(29%)</small></th>
36334 ranu 115
                        <th style="background-color: rgb(255,193,7); color: black;">Avg
36908 ranu 116
                            Rating<br><small>(2%)</small></th>
36334 ranu 117
                        <th style="background-color: rgb(230,126,34); color: white;">Partners
36908 ranu 118
                            Rated<br><small>(2%)</small></th>
36307 ranu 119
                        <th style="background-color: rgb(220,53,69); color: white; width: 80px;">Score</th>
120
                    </tr>
121
                    </thead>
122
                    <tbody>
123
                        #foreach($dm in $performanceDashboard)
124
                            #if($dm.getRank() == 1)
125
                                #set($rowStyle = "text-align:center; background-color: rgb(255,248,225);")
126
                                #set($scoreColor = "color: rgb(40,167,69);")
127
                            #elseif($dm.getRank() == 2)
128
                                #set($rowStyle = "text-align:center; background-color: rgb(245,245,245);")
129
                                #set($scoreColor = "color: rgb(23,162,184);")
130
                            #elseif($dm.getRank() == 3)
131
                                #set($rowStyle = "text-align:center; background-color: rgb(255,243,224);")
132
                                #set($scoreColor = "color: rgb(23,162,184);")
133
                            #else
134
                                #set($rowStyle = "text-align:center;")
135
                                #set($scoreColor = "color: rgb(51,51,51);")
136
                            #end
137
                        <tr style="$rowStyle">
138
                            <td>
139
                                #if($dm.getRank() == 1)
140
                                    <img src="../../../resources/images/king.png" style="width: 28px;" title="Rank 1">
141
                                #elseif($dm.getRank() == 2)
142
                                    <img src="../../../resources/images/trophy-cup.png" style="width: 24px;"
143
                                         title="Rank 2">
144
                                #elseif($dm.getRank() == 3)
145
                                    <img src="../../../resources/images/bronze-medal.png" style="width: 24px;"
146
                                         title="Rank 3">
147
                                #else
148
                                    $dm.getRank()
149
                                #end
150
                            </td>
151
                            <td style="text-align: left;">$dm.getRbmName()</td>
152
                            <td>$dm.getPartnerCount()</td>
153
                            <td>$dm.getTalkTimeDisplay()</td>
154
                            <td>$dm.getDrrAchvDisplay()</td>
36334 ranu 155
                            <td>$dm.getAgingDisplay()</td>
156
                            <td>$dm.getAbove1LDisplay()</td>
157
                            <td>$dm.getAvgRatingDisplay()</td>
158
                            <td>$dm.getPartnersRatedDisplay()</td>
36307 ranu 159
                            <td style="font-size: 14px; $scoreColor">
160
                                $dm.getScoreDisplay()
161
                            </td>
162
                        </tr>
163
                        #end
164
                    </tbody>
165
                </table>
166
            </div>
167
        </div>
168
        #end
169
        ## ============ End RBM Performance Dashboard ============
170
 
36234 ranu 171
    <div id="rbm-call-target-container">
35631 ranu 172
        #parse("rbm_call_target.vm")
36234 ranu 173
    </div>
32938 amit.gupta 174
#end
35631 ranu 175
 
176
<!-- Modal for Out of Sequence Details -->
177
<div class="modal fade" id="oosModal" tabindex="-1" role="dialog" aria-labelledby="oosModalLabel" aria-hidden="true">
178
    <div class="modal-dialog modal-lg" role="document">
179
        <div class="modal-content">
180
            <div class="modal-header">
181
                <h5 class="modal-title" id="oosModalLabel">Out of Sequence Calls</h5>
182
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
183
                    <span aria-hidden="true">&times;</span>
184
                </button>
185
            </div>
186
            <div class="modal-body">
187
                <div id="oosDetailsContent">
188
                    <p>Loading...</p>
189
                </div>
190
            </div>
191
            <div class="modal-footer">
192
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
193
            </div>
194
        </div>
195
    </div>
196
</div>
35670 ranu 197
 
198
<!-- Modal for Called Partner Details -->
199
<div class="modal fade" id="calledModal" tabindex="-1" role="dialog" aria-labelledby="calledModalLabel"
200
     aria-hidden="true">
35709 ranu 201
    <div class="modal-dialog modal-lg" role="document" style="max-width:max-content;">
202
        <div class="modal-content">
35670 ranu 203
            <div class="modal-header">
204
                <h5 class="modal-title" id="calledModalLabel">Called Partners</h5>
205
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
206
                    <span aria-hidden="true">&times;</span>
207
                </button>
208
            </div>
209
            <div class="modal-body">
210
                <div id="calledDetailsContent">
211
                    <p>Loading...</p>
212
                </div>
213
            </div>
214
            <div class="modal-footer">
215
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
216
            </div>
217
        </div>
218
    </div>
219
</div>
35631 ranu 220
<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
29983 amit.gupta 221
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
222
        integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
223
        crossorigin="anonymous"></script>
224
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
225
        integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
226
        crossorigin="anonymous"></script>
30036 amit.gupta 227
<script type="text/javascript">
228
    function numberToComma(x) {
29966 amit.gupta 229
 
30036 amit.gupta 230
        x = x.toString();
231
        x = x.split('.');
232
        var x1 = x[0];
233
        var x2 = x.length > 1 && x[1] != '0' ? '.' + x[1] : '';
234
        var lastThree = x1.substring(x1.length - 3);
235
        var otherNumbers = x1.substring(0, x1.length - 3);
236
        if (x1.charAt(x1.length - 4) == ',' || x1.charAt(x1.length - 4) == '-') {
237
            console.log(lastThree)
238
        } else {
239
            if (otherNumbers != '')
240
                lastThree = ',' + lastThree;
241
        }
242
        return otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + (lastThree)
243
                + x2;
244
 
245
    }
246
 
247
    $(document).ready(function () {
248
        $('.currency').each(function (index, ele) {
249
            if (!isNaN(parseInt($(ele).html()))) {
250
                $(ele).html(numberToComma($(ele).html()));
251
            }
252
        });
253
    })
254
</script>
33991 ranu 255
 
256
 
257
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
258
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
259
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/>
260
 
261
<script>
262
    // Initialize the date range picker
263
    $('input[name="rbmArrPeriod"]').daterangepicker({
264
        autoUpdateInput: false, // Prevent auto-filling the input with dates
265
        locale: {
266
            cancelLabel: 'Clear'
267
        }
268
    });
269
 
270
    // Update the input field when dates are selected
271
    $('input[name="rbmArrPeriod"]').on('apply.daterangepicker', function (ev, picker) {
272
        $(this).val(picker.startDate.format('YYYY-MM-DD') + ' - ' + picker.endDate.format('YYYY-MM-DD'));
273
    });
274
 
275
    // Clear the input field when the user cancels
276
    $('input[name="rbmArrPeriod"]').on('cancel.daterangepicker', function (ev, picker) {
277
        $(this).val('');
278
    });
279
 
280
    // Function to get the dates from the picker
281
    function getDatesFromPicker(selector) {
282
        const pickerElement = $(selector).data('daterangepicker');
283
        if (!pickerElement) {
284
            console.error('Date Range Picker is not initialized.');
285
            return {startDate: null, endDate: null};
286
        }
287
        return {
288
            startDate: pickerElement.startDate.format('YYYY-MM-DD'),
289
            endDate: pickerElement.endDate.format('YYYY-MM-DD')
290
        };
291
    }
292
 
293
    // Button click event
294
    $(document).on('click', '.sold-catalog-report', function () {
295
        const dates = getDatesFromPicker('input[name="rbmArrPeriod"]');
296
        const startDate = dates.startDate;
297
        const endDate = dates.endDate;
298
 
299
        if (!startDate || !endDate) {
300
            alert("Start date and end date cannot be empty!!");
301
            return;
302
        }
303
 
304
        let endPoint = `/downloadSoldCatalogReport?startDate=${startDate}&endDate=${endDate}`;
305
        window.open(endPoint, '_blank');
306
        ;
307
    });
33997 ranu 308
 
35172 ranu 309
 
33997 ranu 310
    // Button click event
35172 ranu 311
    $(document).on('click', '.partnerwise-billed-po', function () {
312
        let endPoint = `/downloadModelBrandWisePo`;
313
        window.open(endPoint, '_blank');
314
        ;
315
    });
316
 
317
    // Button click event
33997 ranu 318
    $(document).on('click', '.rbm-target-achievement', function () {
319
        const dates = getDatesFromPicker('input[name="rbmArrPeriod"]');
320
        const startDate = dates.startDate;
321
        const endDate = dates.endDate;
322
 
323
        if (!startDate || !endDate) {
324
            alert("Start date and end date cannot be empty!!");
325
            return;
326
        }
327
 
328
        let endPoint = `/getDateWiseRabmTargetAndAchievements?startDate=${startDate}&endDate=${endDate}`;
329
        window.open(endPoint, '_blank');
330
        ;
331
    });
33991 ranu 332
</script>
35147 ranu 333
 
334
<script>
35201 ranu 335
    function refreshTodayPOTable() {
336
        var selectedCategory = $('#categoryDropdown').val();
35147 ranu 337
 
35201 ranu 338
        $.ajax({
339
            url: "/indent/today_po_table_fragment",
340
            type: "GET",
341
            data: {categoryType: selectedCategory},
342
            success: function (response) {
343
                $('.purchaseMilestoneContainer').fadeOut(200, function () {
344
                    $(this).html(response).fadeIn(200);
345
                });
346
            },
347
            error: function (xhr, status, error) {
348
                console.error("Error loading table: " + error);
349
                alert("Failed to load table data. Please try again.");
350
            }
351
        });
352
    }
353
 
354
    // Refresh table when dropdown changes
355
    $('#categoryDropdown').on('change', refreshTodayPOTable);
356
 
357
    // Optional: load default table on page load
35147 ranu 358
    $(document).ready(function () {
35201 ranu 359
        refreshTodayPOTable();
35147 ranu 360
    });
35201 ranu 361
 
362
 
35147 ranu 363
</script>
364
 
35757 ranu 365
<script>
366
    // Smart page refresh - pauses when modal is open or audio is playing
367
    (function () {
368
        var REFRESH_INTERVAL = 360000; // 360 seconds = 6 minutes
369
 
370
        function isAnyModalOpen() {
371
            // Check if any Bootstrap modal is currently shown
372
            return $('.modal.show').length > 0 || $('.modal.in').length > 0;
373
        }
374
 
375
        function isAnyAudioPlaying() {
376
            // Check if any audio element is currently playing
377
            var audioElements = document.querySelectorAll('audio');
378
            for (var i = 0; i < audioElements.length; i++) {
379
                if (!audioElements[i].paused) {
380
                    return true;
381
                }
382
            }
383
            return false;
384
        }
385
 
386
        function canRefresh() {
387
            return !isAnyModalOpen() && !isAnyAudioPlaying();
388
        }
389
 
390
        function smartRefresh() {
391
            if (canRefresh()) {
392
                location.reload();
393
            }
394
            // If can't refresh now, check again in 10 seconds
395
            // This ensures refresh happens soon after modal closes or audio stops
396
        }
397
 
398
        // Set up the refresh interval
399
        setInterval(function () {
400
            if (canRefresh()) {
401
                location.reload();
402
            }
403
        }, REFRESH_INTERVAL);
404
    })();
405
</script>
406
 
29966 amit.gupta 407
</body>
408
</html>