Subversion Repositories SmartDukaan

Rev

Rev 35757 | Rev 36307 | 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")
36234 ranu 79
    <div id="rbm-call-target-container">
35631 ranu 80
        #parse("rbm_call_target.vm")
36234 ranu 81
    </div>
32938 amit.gupta 82
#end
35631 ranu 83
 
84
<!-- Modal for Out of Sequence Details -->
85
<div class="modal fade" id="oosModal" tabindex="-1" role="dialog" aria-labelledby="oosModalLabel" aria-hidden="true">
86
    <div class="modal-dialog modal-lg" role="document">
87
        <div class="modal-content">
88
            <div class="modal-header">
89
                <h5 class="modal-title" id="oosModalLabel">Out of Sequence Calls</h5>
90
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
91
                    <span aria-hidden="true">&times;</span>
92
                </button>
93
            </div>
94
            <div class="modal-body">
95
                <div id="oosDetailsContent">
96
                    <p>Loading...</p>
97
                </div>
98
            </div>
99
            <div class="modal-footer">
100
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
101
            </div>
102
        </div>
103
    </div>
104
</div>
35670 ranu 105
 
106
<!-- Modal for Called Partner Details -->
107
<div class="modal fade" id="calledModal" tabindex="-1" role="dialog" aria-labelledby="calledModalLabel"
108
     aria-hidden="true">
35709 ranu 109
    <div class="modal-dialog modal-lg" role="document" style="max-width:max-content;">
110
        <div class="modal-content">
35670 ranu 111
            <div class="modal-header">
112
                <h5 class="modal-title" id="calledModalLabel">Called Partners</h5>
113
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
114
                    <span aria-hidden="true">&times;</span>
115
                </button>
116
            </div>
117
            <div class="modal-body">
118
                <div id="calledDetailsContent">
119
                    <p>Loading...</p>
120
                </div>
121
            </div>
122
            <div class="modal-footer">
123
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
124
            </div>
125
        </div>
126
    </div>
127
</div>
35631 ranu 128
<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
29983 amit.gupta 129
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
130
        integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
131
        crossorigin="anonymous"></script>
132
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
133
        integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
134
        crossorigin="anonymous"></script>
30036 amit.gupta 135
<script type="text/javascript">
136
    function numberToComma(x) {
29966 amit.gupta 137
 
30036 amit.gupta 138
        x = x.toString();
139
        x = x.split('.');
140
        var x1 = x[0];
141
        var x2 = x.length > 1 && x[1] != '0' ? '.' + x[1] : '';
142
        var lastThree = x1.substring(x1.length - 3);
143
        var otherNumbers = x1.substring(0, x1.length - 3);
144
        if (x1.charAt(x1.length - 4) == ',' || x1.charAt(x1.length - 4) == '-') {
145
            console.log(lastThree)
146
        } else {
147
            if (otherNumbers != '')
148
                lastThree = ',' + lastThree;
149
        }
150
        return otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + (lastThree)
151
                + x2;
152
 
153
    }
154
 
155
    $(document).ready(function () {
156
        $('.currency').each(function (index, ele) {
157
            if (!isNaN(parseInt($(ele).html()))) {
158
                $(ele).html(numberToComma($(ele).html()));
159
            }
160
        });
161
    })
162
</script>
33991 ranu 163
 
164
 
165
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
166
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
167
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/>
168
 
169
<script>
170
    // Initialize the date range picker
171
    $('input[name="rbmArrPeriod"]').daterangepicker({
172
        autoUpdateInput: false, // Prevent auto-filling the input with dates
173
        locale: {
174
            cancelLabel: 'Clear'
175
        }
176
    });
177
 
178
    // Update the input field when dates are selected
179
    $('input[name="rbmArrPeriod"]').on('apply.daterangepicker', function (ev, picker) {
180
        $(this).val(picker.startDate.format('YYYY-MM-DD') + ' - ' + picker.endDate.format('YYYY-MM-DD'));
181
    });
182
 
183
    // Clear the input field when the user cancels
184
    $('input[name="rbmArrPeriod"]').on('cancel.daterangepicker', function (ev, picker) {
185
        $(this).val('');
186
    });
187
 
188
    // Function to get the dates from the picker
189
    function getDatesFromPicker(selector) {
190
        const pickerElement = $(selector).data('daterangepicker');
191
        if (!pickerElement) {
192
            console.error('Date Range Picker is not initialized.');
193
            return {startDate: null, endDate: null};
194
        }
195
        return {
196
            startDate: pickerElement.startDate.format('YYYY-MM-DD'),
197
            endDate: pickerElement.endDate.format('YYYY-MM-DD')
198
        };
199
    }
200
 
201
    // Button click event
202
    $(document).on('click', '.sold-catalog-report', function () {
203
        const dates = getDatesFromPicker('input[name="rbmArrPeriod"]');
204
        const startDate = dates.startDate;
205
        const endDate = dates.endDate;
206
 
207
        if (!startDate || !endDate) {
208
            alert("Start date and end date cannot be empty!!");
209
            return;
210
        }
211
 
212
        let endPoint = `/downloadSoldCatalogReport?startDate=${startDate}&endDate=${endDate}`;
213
        window.open(endPoint, '_blank');
214
        ;
215
    });
33997 ranu 216
 
35172 ranu 217
 
33997 ranu 218
    // Button click event
35172 ranu 219
    $(document).on('click', '.partnerwise-billed-po', function () {
220
        let endPoint = `/downloadModelBrandWisePo`;
221
        window.open(endPoint, '_blank');
222
        ;
223
    });
224
 
225
    // Button click event
33997 ranu 226
    $(document).on('click', '.rbm-target-achievement', function () {
227
        const dates = getDatesFromPicker('input[name="rbmArrPeriod"]');
228
        const startDate = dates.startDate;
229
        const endDate = dates.endDate;
230
 
231
        if (!startDate || !endDate) {
232
            alert("Start date and end date cannot be empty!!");
233
            return;
234
        }
235
 
236
        let endPoint = `/getDateWiseRabmTargetAndAchievements?startDate=${startDate}&endDate=${endDate}`;
237
        window.open(endPoint, '_blank');
238
        ;
239
    });
33991 ranu 240
</script>
35147 ranu 241
 
242
<script>
35201 ranu 243
    function refreshTodayPOTable() {
244
        var selectedCategory = $('#categoryDropdown').val();
35147 ranu 245
 
35201 ranu 246
        $.ajax({
247
            url: "/indent/today_po_table_fragment",
248
            type: "GET",
249
            data: {categoryType: selectedCategory},
250
            success: function (response) {
251
                $('.purchaseMilestoneContainer').fadeOut(200, function () {
252
                    $(this).html(response).fadeIn(200);
253
                });
254
            },
255
            error: function (xhr, status, error) {
256
                console.error("Error loading table: " + error);
257
                alert("Failed to load table data. Please try again.");
258
            }
259
        });
260
    }
261
 
262
    // Refresh table when dropdown changes
263
    $('#categoryDropdown').on('change', refreshTodayPOTable);
264
 
265
    // Optional: load default table on page load
35147 ranu 266
    $(document).ready(function () {
35201 ranu 267
        refreshTodayPOTable();
35147 ranu 268
    });
35201 ranu 269
 
270
 
35147 ranu 271
</script>
272
 
35757 ranu 273
<script>
274
    // Smart page refresh - pauses when modal is open or audio is playing
275
    (function () {
276
        var REFRESH_INTERVAL = 360000; // 360 seconds = 6 minutes
277
 
278
        function isAnyModalOpen() {
279
            // Check if any Bootstrap modal is currently shown
280
            return $('.modal.show').length > 0 || $('.modal.in').length > 0;
281
        }
282
 
283
        function isAnyAudioPlaying() {
284
            // Check if any audio element is currently playing
285
            var audioElements = document.querySelectorAll('audio');
286
            for (var i = 0; i < audioElements.length; i++) {
287
                if (!audioElements[i].paused) {
288
                    return true;
289
                }
290
            }
291
            return false;
292
        }
293
 
294
        function canRefresh() {
295
            return !isAnyModalOpen() && !isAnyAudioPlaying();
296
        }
297
 
298
        function smartRefresh() {
299
            if (canRefresh()) {
300
                location.reload();
301
            }
302
            // If can't refresh now, check again in 10 seconds
303
            // This ensures refresh happens soon after modal closes or audio stops
304
        }
305
 
306
        // Set up the refresh interval
307
        setInterval(function () {
308
            if (canRefresh()) {
309
                location.reload();
310
            }
311
        }, REFRESH_INTERVAL);
312
    })();
313
</script>
314
 
29966 amit.gupta 315
</body>
316
</html>