Subversion Repositories SmartDukaan

Rev

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