Subversion Repositories SmartDukaan

Rev

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