Subversion Repositories SmartDukaan

Rev

Rev 35202 | Rev 35670 | 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>
104
<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
29983 amit.gupta 105
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
106
        integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
107
        crossorigin="anonymous"></script>
108
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
109
        integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
110
        crossorigin="anonymous"></script>
30036 amit.gupta 111
<script type="text/javascript">
112
    function numberToComma(x) {
29966 amit.gupta 113
 
30036 amit.gupta 114
        x = x.toString();
115
        x = x.split('.');
116
        var x1 = x[0];
117
        var x2 = x.length > 1 && x[1] != '0' ? '.' + x[1] : '';
118
        var lastThree = x1.substring(x1.length - 3);
119
        var otherNumbers = x1.substring(0, x1.length - 3);
120
        if (x1.charAt(x1.length - 4) == ',' || x1.charAt(x1.length - 4) == '-') {
121
            console.log(lastThree)
122
        } else {
123
            if (otherNumbers != '')
124
                lastThree = ',' + lastThree;
125
        }
126
        return otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + (lastThree)
127
                + x2;
128
 
129
    }
130
 
131
    $(document).ready(function () {
132
        $('.currency').each(function (index, ele) {
133
            if (!isNaN(parseInt($(ele).html()))) {
134
                $(ele).html(numberToComma($(ele).html()));
135
            }
136
        });
137
    })
138
</script>
33991 ranu 139
 
140
 
141
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
142
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
143
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/>
144
 
145
<script>
146
    // Initialize the date range picker
147
    $('input[name="rbmArrPeriod"]').daterangepicker({
148
        autoUpdateInput: false, // Prevent auto-filling the input with dates
149
        locale: {
150
            cancelLabel: 'Clear'
151
        }
152
    });
153
 
154
    // Update the input field when dates are selected
155
    $('input[name="rbmArrPeriod"]').on('apply.daterangepicker', function (ev, picker) {
156
        $(this).val(picker.startDate.format('YYYY-MM-DD') + ' - ' + picker.endDate.format('YYYY-MM-DD'));
157
    });
158
 
159
    // Clear the input field when the user cancels
160
    $('input[name="rbmArrPeriod"]').on('cancel.daterangepicker', function (ev, picker) {
161
        $(this).val('');
162
    });
163
 
164
    // Function to get the dates from the picker
165
    function getDatesFromPicker(selector) {
166
        const pickerElement = $(selector).data('daterangepicker');
167
        if (!pickerElement) {
168
            console.error('Date Range Picker is not initialized.');
169
            return {startDate: null, endDate: null};
170
        }
171
        return {
172
            startDate: pickerElement.startDate.format('YYYY-MM-DD'),
173
            endDate: pickerElement.endDate.format('YYYY-MM-DD')
174
        };
175
    }
176
 
177
    // Button click event
178
    $(document).on('click', '.sold-catalog-report', function () {
179
        const dates = getDatesFromPicker('input[name="rbmArrPeriod"]');
180
        const startDate = dates.startDate;
181
        const endDate = dates.endDate;
182
 
183
        if (!startDate || !endDate) {
184
            alert("Start date and end date cannot be empty!!");
185
            return;
186
        }
187
 
188
        let endPoint = `/downloadSoldCatalogReport?startDate=${startDate}&endDate=${endDate}`;
189
        window.open(endPoint, '_blank');
190
        ;
191
    });
33997 ranu 192
 
35172 ranu 193
 
33997 ranu 194
    // Button click event
35172 ranu 195
    $(document).on('click', '.partnerwise-billed-po', function () {
196
        let endPoint = `/downloadModelBrandWisePo`;
197
        window.open(endPoint, '_blank');
198
        ;
199
    });
200
 
201
    // Button click event
33997 ranu 202
    $(document).on('click', '.rbm-target-achievement', 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 = `/getDateWiseRabmTargetAndAchievements?startDate=${startDate}&endDate=${endDate}`;
213
        window.open(endPoint, '_blank');
214
        ;
215
    });
33991 ranu 216
</script>
35147 ranu 217
 
218
<script>
35201 ranu 219
    function refreshTodayPOTable() {
220
        var selectedCategory = $('#categoryDropdown').val();
35147 ranu 221
 
35201 ranu 222
        $.ajax({
223
            url: "/indent/today_po_table_fragment",
224
            type: "GET",
225
            data: {categoryType: selectedCategory},
226
            success: function (response) {
227
                $('.purchaseMilestoneContainer').fadeOut(200, function () {
228
                    $(this).html(response).fadeIn(200);
229
                });
230
            },
231
            error: function (xhr, status, error) {
232
                console.error("Error loading table: " + error);
233
                alert("Failed to load table data. Please try again.");
234
            }
235
        });
236
    }
237
 
238
    // Refresh table when dropdown changes
239
    $('#categoryDropdown').on('change', refreshTodayPOTable);
240
 
241
    // Optional: load default table on page load
35147 ranu 242
    $(document).ready(function () {
35201 ranu 243
        refreshTodayPOTable();
35147 ranu 244
    });
35201 ranu 245
 
246
 
35147 ranu 247
</script>
248
 
29966 amit.gupta 249
</body>
250
</html>