Subversion Repositories SmartDukaan

Rev

Rev 35505 | Rev 35775 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35505 Rev 35771
Line 143... Line 143...
143
 
143
 
144
 
144
 
145
$(document).on('click', '.fofo-stock-info', function () {
145
$(document).on('click', '.fofo-stock-info', function () {
146
 
146
 
147
	$(".today-fofo-offer-view").hide();
147
	$(".today-fofo-offer-view").hide();
-
 
148
    $(".scheme-imei-history-view").hide();
148
	$(".fofo-summry-view").show();
149
	$(".fofo-summry-view").show();
149
});
150
});
150
 
151
 
151
 
152
 
-
 
153
// IMEI Margin (Scheme IMEI History) handlers
-
 
154
$(document).on('click', '.scheme-imei-history-btn', function () {
-
 
155
    let fofoId = $(this).data("fofoid");
-
 
156
 
-
 
157
    // Load the scheme-imei-history view (empty initially, user will search)
-
 
158
    doGetAjaxRequestHandler(`${context}/getSchemesByImei?searchImei=&modal=true`, function (response) {
-
 
159
        $(".today-fofo-offer-view").hide();
-
 
160
        $(".fofo-summry-view").hide();
-
 
161
        $(".scheme-imei-history-view").show();
-
 
162
        $('.scheme-imei-history-view').html(response);
-
 
163
 
-
 
164
        // Initialize IMEI autocomplete if available
-
 
165
        if (typeof getAllImeiAheadOptions === 'function') {
-
 
166
            getAllImeiAheadOptions($("#scheme-imei-wise-search-text"), function (inventoryItem) {
-
 
167
                // Trigger search when item selected from autocomplete
-
 
168
            });
-
 
169
        }
-
 
170
    });
-
 
171
});
-
 
172
 
-
 
173
// Search IMEI margin on button click within modal
-
 
174
$(document).on('click', '#scheme-imei-wise-search-button', function () {
-
 
175
    let imei = $("#scheme-imei-wise-search-text").val().trim();
-
 
176
    if (imei) {
-
 
177
        searchImeiMarginInModal(imei);
-
 
178
    } else {
-
 
179
        alert("Please enter IMEI number");
-
 
180
    }
-
 
181
});
-
 
182
 
-
 
183
// Function to search and load IMEI margin details in modal
-
 
184
function searchImeiMarginInModal(imei) {
-
 
185
    const loaderHtml = `
-
 
186
        <center><div class="loader-wrapper" style="padding: 50px;">
-
 
187
            <i class="fa fa-spinner fa-spin fa-3x"></i>
-
 
188
            <p style="margin-top: 15px;">Loading margin details for ${imei}...</p>
-
 
189
        </div></center>`;
-
 
190
 
-
 
191
    $('.scheme-imei-history-view').html(loaderHtml);
-
 
192
 
-
 
193
    doGetAjaxRequestHandler(`${context}/getSchemesByImei?searchImei=${imei}&modal=true`, function (response) {
-
 
194
        $('.scheme-imei-history-view').html(response);
-
 
195
 
-
 
196
        // Re-initialize IMEI autocomplete after content reload
-
 
197
        if (typeof getAllImeiAheadOptions === 'function') {
-
 
198
            getAllImeiAheadOptions($("#scheme-imei-wise-search-text"), function (inventoryItem) {
-
 
199
                // Trigger search when item selected from autocomplete
-
 
200
            });
-
 
201
        }
-
 
202
    });
-
 
203
}
-
 
204
 
-
 
205
 
152
$(document).on('click', ".fofo-brand-tab", function () {
206
$(document).on('click', ".fofo-brand-tab", function () {
153
    let fofoId = $(this).data('fofoid');
207
    let fofoId = $(this).data('fofoid');
154
    let brand = $(this).data("brand");
208
    let brand = $(this).data("brand");
155
    loadFofoBrandOffers(brand, fofoId);
209
    loadFofoBrandOffers(brand, fofoId);
156
});
210
});