Rev 23557 | Rev 23715 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function() {$(".create-scheme").live('click', function() {loadScheme("main-content");});$('#tag-listing-brands li a').live('click', function(){$('#tag-listing-brand-value').text($(this).text());loadTagListingItemsDescriptionByBrand("tag-listing-items-description-container", $(this).text());console.log($(this).text());});$("#schemes-paginated .next").live('click', function() {loadPaginatedNextItems('/getPaginatedSchemes', null, 'schemes-paginated', 'schemes-table', 'scheme-details-container');$(this).blur();});$("#schemes-paginated .previous").live('click', function() {loadPaginatedPreviousItems('/getPaginatedSchemes', null, 'schemes-paginated', 'schemes-table', 'scheme-details-container');$(this).blur();});$(".scheme-details").live('click',function(){var schemeId = $(this).attr('data');console.log("schemeId = "+schemeId);loadSchemeDetails(schemeId, "scheme-details-container");});$(".active-scheme").live('click',function(){var schemeId = $(this).attr('data');console.log("active-scheme id : "+schemeId);var start = $( "#schemes-paginated .start" ).text();//var end = $( "#schemes-paginated .end" ).text();var offset = start - 1;if(confirm("Are you sure you want to Active Scheme!") == true){activeScheme(schemeId, offset, "schemes-table");}});$(".expire-scheme").live('click',function(){var schemeId = $(this).attr('data');console.log("expire-scheme id : "+schemeId);var start = $( "#schemes-paginated .start" ).text();//var end = $( "#schemes-paginated .end" ).text();var offset = start - 1;if(confirm("Are you sure you want to Expire Scheme!") == true){expireScheme(schemeId, offset, "schemes-table");}});$(".schemes").live('click', function() {console.log("Active Schemes Button Clicked...")schemes("main-content");});$(".schemes-download-page").live('click', function() {console.log("Schemes Download Clicked...")loadSchemesDownloadPage("main-content");});$(".schemes-update").live('click', function() {loadSchemeUpdatePage("main-content");});$(".add-schemes").live('click', function() {schemeIds = $("#schemeids").val();itemIds = $("#itemids").val();if(itemIds.trim().length === 0 || schemeIds.trim().length === 0) {alert("fields shouldn't be blank");}updateSchemes(schemeIds, itemIds);});});function configureTagListingItemsDescriptionDropDown(){$(document).ready(function() {$('#tagListingItemsDescription').multiselect({includeSelectAllOption: true,maxHeight: 200,buttonWidth: '180px',numberDisplayed: 1,nonSelectedText: 'Items',nSelectedText: ' - Items Selected',allSelectedText: 'All Items Selected',enableFiltering: true});});}function schemesDownload(){console.log("downloadItemLedgerReport Button clicked")var startDateTime = $('input[name="startDateTime"]').val();console.log("startDateTime : "+startDateTime);var endDateTime = $('input[name="endDateTime"]').val();console.log("endDateTime : "+endDateTime);doAjaxGetDownload(context+"/schemes/download?startDateTime="+startDateTime+"&endDateTime="+endDateTime,"SchemesReport.xlsx");}function loadSchemeDetails(schemeId, domId){doGetAjaxRequestHandler(context+"/getSchemeById?schemeId="+schemeId, function(response){$('#' + domId).html(response);window.dispatchEvent(new Event('resize'));});}function activeScheme(schemeId, offset, domId){doPutAjaxRequestHandler(context+"/activeSchemeById?schemeId="+schemeId+"&offset="+offset, function(response){$('#' + domId).html(response);$('#scheme-details-container').html('');});}function expireScheme(schemeId, offset, domId){doPutAjaxRequestHandler(context+"/expireSchemeById?schemeId="+schemeId+"&offset="+offset, function(response){$('#' + domId).html(response);$('#scheme-details-container').html('');});}function loadScheme(domId){doGetAjaxRequestHandler(context+"/createScheme", function(response){$('#' + domId).html(response);});}function loadTagListingItemsDescriptionByBrand(domId, brand){doGetAjaxRequestHandler(context+"/getTagListingItemsByBrand?brand="+brand, function(response){$('#' + domId).html(response);configureTagListingItemsDescriptionDropDown();});}function schemes(domId){doGetAjaxRequestHandler(context+"/getSchemes", function(response){$('#' + domId).html(response);});}function loadSchemesDownloadPage(domId){doGetAjaxRequestHandler(context+"/schemes/downloadPage", function(response){$('#' + domId).html(response);});}function loadSchemeUpdatePage(domId){doGetAjaxRequestHandler(context+"/schemes/update-schemes-page", function(response){$('#' + domId).html(response);});}function updateSchemes(shcemeIds, itemIds){doPostAjaxRequestWithJsonHandler(context + '/schemes/update', JSON.stringify({"itemIds":itemIds.split(",").map(Number), "schemeIds":schemeIds.split(",").map(Number)}), function(response){if(response=='true') {alert("Schemes Added successfully");}});}