Subversion Repositories SmartDukaan

Rev

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