Rev 23500 | Rev 23557 | 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() {var start = $( "#schemes-paginated .start" ).text();var end = $( "#schemes-paginated .end" ).text();getSchemesNextItems(start, end);$("#schemes-paginated .next").blur();});$("#schemes-paginated .previous").live('click', function() {var start = $( "#schemes-paginated .start" ).text();var end = $( "#schemes-paginated .end" ).text();var size = $("#schemes-paginated .size").text();if(parseInt(end) == parseInt(size)){var mod = parseInt(end) % 10;end = parseInt(end) + (10 - mod);}var pre = end - 20;getSchemesPreviousItems(start, end, pre);$("#schemes-paginated .previous").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");});});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 getSchemesNextItems(start, end){console.log(start);console.log(end);console.log(+end + +10);console.log(+start + +10);doGetAjaxRequestHandler(context+"/getPaginatedSchemes?offset="+end, function(response){var size = $("#schemes-paginated .size").text();if((parseInt(end) + 10) > parseInt(size)){console.log("(end + 10) > size == true");$( "#schemes-paginated .end" ).text(size);}else{console.log("(end + 10) > size == false");$( "#schemes-paginated .end" ).text(+end + +10);}$( "#schemes-paginated .start" ).text(+start + +10);var last = $( "#schemes-paginated .end" ).text();var temp = $( "#schemes-paginated .size" ).text();if (parseInt(last) >= parseInt(temp)){$("#schemes-paginated .next").prop('disabled', true);//$( "#good-inventory-paginated .end" ).text(temp);}$('#schemes-table').html(response);$('#scheme-details-container').html('');$("#schemes-paginated .previous").prop('disabled', false);});}function getSchemesPreviousItems(start, end, pre){doGetAjaxRequestHandler(context+"/getPaginatedSchemes/?offset="+pre, function(response){$( "#schemes-paginated .end" ).text(+end - +10);$( "#schemes-paginated .start" ).text(+start - +10);$('#schemes-table').html(response);$('#scheme-details-container').html('');$("#schemes-paginated .next").prop('disabled', false);if (parseInt(pre)==0){$("#schemes-paginated .previous").prop('disabled', true);}});}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);});}