Rev 36751 | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function() {$(document).on('click', ".manage-flagship", function() {loadFlagship("main-content");});$(document).on('click', ".add-flagship-model", function() {var selectedCatalogId = $('.flagship-item-search').data('catalogId');var startDate = $('#flagship-start-date').val();var endDate = $('#flagship-end-date').val();if (!selectedCatalogId) {alert("Please select a catalog item");return false;}if (!startDate) {alert("Start date is required");return false;}if (confirm("Add this model as Flagship?") == true) {doPostAjaxRequestHandler(context + "/addFlagship?catalogItemId=" + selectedCatalogId+ "&startDate=" + startDate+ "&endDate=" + (endDate || ""),function(response) {if (response == 'true') {alert("Flagship model added successfully");loadFlagship("main-content");}});}});$(document).on('click', ".remove-flagship", function() {var id = $(this).data('requestid');if (confirm("Are you sure you want to remove this flagship model?") == true) {doPostAjaxRequestHandler(context + "/flagship/remove?id=" + id,function(response) {if (response == 'true') {alert("Flagship model removed successfully");loadFlagship("main-content");}});}});});function loadFlagship(domId) {doGetAjaxRequestHandler(context + "/manageFlagship", function(response) {$('#' + domId).html(response);getCatalogAheadOptions($('#' + domId).find('.flagship-item-search'), 40000, function(selectedItem) {$('#' + domId).find('.flagship-item-search').data('catalogId', selectedItem.catalogId);});});}