Subversion Repositories SmartDukaan

Rev

Rev 35706 | Rev 35757 | 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">
35202 ranu 4
    <meta http-equiv="refresh" content="360">
29988 amit.gupta 5
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
6
          integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
29966 amit.gupta 7
    <style>
8
        html, body {
29983 amit.gupta 9
            margin-top: 10px;
29966 amit.gupta 10
            padding: 0;
11
        }
12
 
13
 
14
        td, th {
29981 amit.gupta 15
            font-size: 20px;
29966 amit.gupta 16
        }
17
 
29988 amit.gupta 18
 
19
        .table td, .table th {
20
            padding: 0.25rem;
21
        }
22
 
30786 amit.gupta 23
        tr:first-child.green td {
29981 amit.gupta 24
            font-weight: bold;
29982 amit.gupta 25
            background-color: #00d6b2;
29981 amit.gupta 26
        }
29982 amit.gupta 27
 
28
        td {
29983 amit.gupta 29
            font-size: 24px;
29982 amit.gupta 30
        }
29966 amit.gupta 31
    </style>
32
    <link href="../resources/css/brand-logo.css" rel="stylesheet"/>
33
</head>
34
<body>
33991 ranu 35
 
36
    #if($isGtEqL2)
34055 ranu 37
 
38
        #parse("rbm-today-arr.vm")
35201 ranu 39
    <br>
35147 ranu 40
    <div class="container-fluid mb-3">
35202 ranu 41
        <select id="categoryDropdown" class="form-control mb-3"
42
                style="width:200px; display:inline-block;margin-right: 10px;">
35201 ranu 43
            <option value="RBM">All RBMs</option>
44
            <option value="BM">All BMs</option>
45
            <option value="ASM">All ASMs</option>
35147 ranu 46
        </select>
35174 ranu 47
        <button class="partnerwise-billed-po btn btn-info btn-sm">Today PO and Billed (Partner
35172 ranu 48
            wise)
49
        </button>
35147 ranu 50
 
35201 ranu 51
        <div class="purchaseMilestoneContainer">
52
            <!-- Initial table load -->
53
            #parse("today_po_table_fragment.vm")
54
        </div>
29966 amit.gupta 55
 
35201 ranu 56
    </div>
35199 ranu 57
    <div class="container-fluid ">
33700 amit.gupta 58
    <h3>Total Collection(Overall Collection/Limit Utilization))</h3>
29994 amit.gupta 59
    <div class="row">
60
        #foreach($warehouseEntry in $warehouseMap.entrySet())
31345 amit.gupta 61
            <div class="col-lg-2" style="font-size: 20px">
29994 amit.gupta 62
                $warehouseEntry.getValue() -
63
                #if($warehouseCollectionMap.get($warehouseEntry.getKey()))
31250 amit.gupta 64
                    <span class="currency">$warehouseCollectionMap.get($warehouseEntry.getKey())</span>
29994 amit.gupta 65
                #else
66
 
67
                #end
31242 amit.gupta 68
                /
31250 amit.gupta 69
                #if($warehousePgCollectionMap.get($warehouseEntry.getKey()))
31251 amit.gupta 70
                    <span class="currency">$warehousePgCollectionMap.get($warehouseEntry.getKey())</span>
31242 amit.gupta 71
                #else
72
 
73
                #end
74
 
29994 amit.gupta 75
            </div>
76
        #end
77
    </div>
30784 amit.gupta 78
</div>
35631 ranu 79
        ##    #parse("today_target.vm")
80
        #parse("rbm_call_target.vm")
32938 amit.gupta 81
#end
35631 ranu 82
 
83
<!-- Modal for Out of Sequence Details -->
84
<div class="modal fade" id="oosModal" tabindex="-1" role="dialog" aria-labelledby="oosModalLabel" aria-hidden="true">
85
    <div class="modal-dialog modal-lg" role="document">
86
        <div class="modal-content">
87
            <div class="modal-header">
88
                <h5 class="modal-title" id="oosModalLabel">Out of Sequence Calls</h5>
89
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
90
                    <span aria-hidden="true">&times;</span>
91
                </button>
92
            </div>
93
            <div class="modal-body">
94
                <div id="oosDetailsContent">
95
                    <p>Loading...</p>
96
                </div>
97
            </div>
98
            <div class="modal-footer">
99
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
100
            </div>
101
        </div>
102
    </div>
103
</div>
35670 ranu 104
 
105
<!-- Modal for Called Partner Details -->
106
<div class="modal fade" id="calledModal" tabindex="-1" role="dialog" aria-labelledby="calledModalLabel"
107
     aria-hidden="true">
35709 ranu 108
    <div class="modal-dialog modal-lg" role="document" style="max-width:max-content;">
109
        <div class="modal-content">
35670 ranu 110
            <div class="modal-header">
111
                <h5 class="modal-title" id="calledModalLabel">Called Partners</h5>
112
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
113
                    <span aria-hidden="true">&times;</span>
114
                </button>
115
            </div>
116
            <div class="modal-body">
117
                <div id="calledDetailsContent">
118
                    <p>Loading...</p>
119
                </div>
120
            </div>
121
            <div class="modal-footer">
122
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
123
            </div>
124
        </div>
125
    </div>
126
</div>
35631 ranu 127
<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
29983 amit.gupta 128
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
129
        integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
130
        crossorigin="anonymous"></script>
131
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
132
        integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
133
        crossorigin="anonymous"></script>
30036 amit.gupta 134
<script type="text/javascript">
135
    function numberToComma(x) {
29966 amit.gupta 136
 
30036 amit.gupta 137
        x = x.toString();
138
        x = x.split('.');
139
        var x1 = x[0];
140
        var x2 = x.length > 1 && x[1] != '0' ? '.' + x[1] : '';
141
        var lastThree = x1.substring(x1.length - 3);
142
        var otherNumbers = x1.substring(0, x1.length - 3);
143
        if (x1.charAt(x1.length - 4) == ',' || x1.charAt(x1.length - 4) == '-') {
144
            console.log(lastThree)
145
        } else {
146
            if (otherNumbers != '')
147
                lastThree = ',' + lastThree;
148
        }
149
        return otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + (lastThree)
150
                + x2;
151
 
152
    }
153
 
154
    $(document).ready(function () {
155
        $('.currency').each(function (index, ele) {
156
            if (!isNaN(parseInt($(ele).html()))) {
157
                $(ele).html(numberToComma($(ele).html()));
158
            }
159
        });
160
    })
161
</script>
33991 ranu 162
 
163
 
164
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
165
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
166
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/>
167
 
168
<script>
169
    // Initialize the date range picker
170
    $('input[name="rbmArrPeriod"]').daterangepicker({
171
        autoUpdateInput: false, // Prevent auto-filling the input with dates
172
        locale: {
173
            cancelLabel: 'Clear'
174
        }
175
    });
176
 
177
    // Update the input field when dates are selected
178
    $('input[name="rbmArrPeriod"]').on('apply.daterangepicker', function (ev, picker) {
179
        $(this).val(picker.startDate.format('YYYY-MM-DD') + ' - ' + picker.endDate.format('YYYY-MM-DD'));
180
    });
181
 
182
    // Clear the input field when the user cancels
183
    $('input[name="rbmArrPeriod"]').on('cancel.daterangepicker', function (ev, picker) {
184
        $(this).val('');
185
    });
186
 
187
    // Function to get the dates from the picker
188
    function getDatesFromPicker(selector) {
189
        const pickerElement = $(selector).data('daterangepicker');
190
        if (!pickerElement) {
191
            console.error('Date Range Picker is not initialized.');
192
            return {startDate: null, endDate: null};
193
        }
194
        return {
195
            startDate: pickerElement.startDate.format('YYYY-MM-DD'),
196
            endDate: pickerElement.endDate.format('YYYY-MM-DD')
197
        };
198
    }
199
 
200
    // Button click event
201
    $(document).on('click', '.sold-catalog-report', function () {
202
        const dates = getDatesFromPicker('input[name="rbmArrPeriod"]');
203
        const startDate = dates.startDate;
204
        const endDate = dates.endDate;
205
 
206
        if (!startDate || !endDate) {
207
            alert("Start date and end date cannot be empty!!");
208
            return;
209
        }
210
 
211
        let endPoint = `/downloadSoldCatalogReport?startDate=${startDate}&endDate=${endDate}`;
212
        window.open(endPoint, '_blank');
213
        ;
214
    });
33997 ranu 215
 
35172 ranu 216
 
33997 ranu 217
    // Button click event
35172 ranu 218
    $(document).on('click', '.partnerwise-billed-po', function () {
219
        let endPoint = `/downloadModelBrandWisePo`;
220
        window.open(endPoint, '_blank');
221
        ;
222
    });
223
 
224
    // Button click event
33997 ranu 225
    $(document).on('click', '.rbm-target-achievement', function () {
226
        const dates = getDatesFromPicker('input[name="rbmArrPeriod"]');
227
        const startDate = dates.startDate;
228
        const endDate = dates.endDate;
229
 
230
        if (!startDate || !endDate) {
231
            alert("Start date and end date cannot be empty!!");
232
            return;
233
        }
234
 
235
        let endPoint = `/getDateWiseRabmTargetAndAchievements?startDate=${startDate}&endDate=${endDate}`;
236
        window.open(endPoint, '_blank');
237
        ;
238
    });
33991 ranu 239
</script>
35147 ranu 240
 
241
<script>
35201 ranu 242
    function refreshTodayPOTable() {
243
        var selectedCategory = $('#categoryDropdown').val();
35147 ranu 244
 
35201 ranu 245
        $.ajax({
246
            url: "/indent/today_po_table_fragment",
247
            type: "GET",
248
            data: {categoryType: selectedCategory},
249
            success: function (response) {
250
                $('.purchaseMilestoneContainer').fadeOut(200, function () {
251
                    $(this).html(response).fadeIn(200);
252
                });
253
            },
254
            error: function (xhr, status, error) {
255
                console.error("Error loading table: " + error);
256
                alert("Failed to load table data. Please try again.");
257
            }
258
        });
259
    }
260
 
261
    // Refresh table when dropdown changes
262
    $('#categoryDropdown').on('change', refreshTodayPOTable);
263
 
264
    // Optional: load default table on page load
35147 ranu 265
    $(document).ready(function () {
35201 ranu 266
        refreshTodayPOTable();
35147 ranu 267
    });
35201 ranu 268
 
269
 
35147 ranu 270
</script>
271
 
29966 amit.gupta 272
</body>
273
</html>