Rev 27755 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function() {$(document).on('click', ".create-prebooking-listing", function() {console.log("Create Prebooking Listing Button Clicked...")loadCreatePrebookingListing("main-content");});$(document).on('click', ".prebooking-listings", function() {console.log("Prebooking Listings Button Clicked...")loadPrebookingListings("main-content");});$(document).on('click', ".create-prebooking-order", function() {console.log("Create Prebooking Order Button Clicked...")loadCreatePrebookingListings("main-content");});$(document).on('click', ".prebooking-orders", function() {console.log("Prebooking Orders Button Clicked...")loadPrebookingOrders("main-content");});$(document).on('click', "#prebooking-listings-paginated .next",function() {loadPaginatedNextItems('/getPaginatedPrebookingListings', null,'prebooking-listings-paginated','prebooking-listings-table','prebooking-listing-details-container');$(this).blur();});$(document).on('click', "#prebooking-listings-paginated .previous",function() {loadPaginatedPreviousItems('/getPaginatedPrebookingListings',null, 'prebooking-listings-paginated','prebooking-listings-table','prebooking-listing-details-container');$(this).blur();});$(document).on('click', "#prebooking-orders-paginated .next",function() {loadPaginatedNextItems('/getPaginatedPrebookingOrders', null,'prebooking-orders-paginated','prebooking-orders-table','prebooking-order-details-container');$(this).blur();});$(document).on('click', "#prebooking-orders-paginated .previous",function() {loadPaginatedPreviousItems('/getPaginatedPrebookingOrders',null, 'prebooking-orders-paginated','prebooking-orders-table','prebooking-order-details-container');$(this).blur();});/** $(document).on('click', '#brands li a', function(){* $('#brand-value').text($(this).text());* loadItemsDescriptionByBrand("items-description-container",* $(this).text()); console.log($(this).text()); });*/$(document).on('click', ".prebooking-listing-details",function() {var prebookingListingId = $(this).attr('data');console.log("prebookingListingId = " + prebookingListingId);loadPrebookingListingDetails(prebookingListingId,"prebooking-listing-details-container");});$(document).on('click', ".active-prebooking-listing",function() {var prebookingListingId = $(this).attr('data');console.log("active-prebooking-listing id : "+ prebookingListingId);var start = $("#prebooking-listings-paginated .start").text();// var end = $( "#schemes-paginated .end" ).text();var offset = start - 1;if (confirm("Are you sure you want to Active Prebooking Listing!") == true) {activePrebookingListing(prebookingListingId,offset, "prebooking-listings-table");}});$(document).on('click', ".expire-prebooking-listing",function() {var prebookingListingId = $(this).attr('data');console.log("expire-prebooking-listing id : "+ prebookingListingId);var start = $("#prebooking-listings-paginated .start").text();// var end = $( "#schemes-paginated .end" ).text();var offset = start - 1;if (confirm("Are you sure you want to Expire Prebooking Listing!") == true) {expirePrebookingListing(prebookingListingId,offset, "prebooking-listings-table");}});$(document).on('click', ".update-prebooking-duration",function() {var prebookingListingId = $(this).attr('data');console.log("update-prebooking-listing id : "+ prebookingListingId);var start = $("#prebooking-listings-paginated .start").text();// var end = $( "#schemes-paginated .end" ).text();var offset = start - 1;if (confirm("Are you sure you want to Active Prebooking Listing!") == true) {updatePrebookingListing(prebookingListingId,offset, "prebooking-listings-table");}});$(document).on("change paste keyup", "#quantity", function() {var quantity = parseFloat($(this).val());if (quantity <= 0) {alert("Quantity must be greater than zero");$(this).val(1);} else if (quantity > 0) {var totalAmount = parseFloat($('#advanceAmount').val());$('#totalAmount').val(quantity * totalAmount);}});});$(document).ready(function() {$(document).on("blur", "#quantity", function() {console.log("quantity blur called");if ($(this).val() == "") {$(this).val(1);$('#totalAmount').val($('#advanceAmount').val());}});});function configureItemsDescriptionDropDown() {$(document).ready(function() {$('#itemsDescription').multiselect({// includeSelectAllOption: true,maxHeight : 200,buttonWidth : '280px',// numberDisplayed: 1,nonSelectedText : 'Items',nSelectedText : ' - Items Selected',enableFiltering : true,enableCaseInsensitiveFiltering : true,multiple : false});});}function loadCreatePrebookingListing(domId) {doAjaxRequestHandler(context + "/createPrebookingListing", "GET", function(response) {$('#' + domId).html(response);});}function loadPrebookingListings(domId) {doAjaxRequestHandler(context + "/getPrebookingListings", "GET", function(response) {$('#' + domId).html(response);});}function loadCreatePrebookingListings(domId) {doAjaxRequestHandler(context + "/createPrebookingOrder", "GET", function(response) {$('#' + domId).html(response);});}function loadPrebookingOrders(domId) {doAjaxRequestHandler(context + "/getPrebookingOrders", "GET", function(response) {$('#' + domId).html(response);});}function loadItemsDescriptionByBrand(domId, brand) {doAjaxRequestHandler(context + "/getItemsByBrand?brand=" + brand, "GET",function(response) {$('#' + domId).html(response);configureItemsDescriptionDropDown();});}function loadPrebookingListingDetails(prebookingListingId, domId) {doAjaxRequestHandler(context+ "/getPrebookingListingById?prebookingListingId="+ prebookingListingId, "GET", function(response) {$('#' + domId).html(response);window.dispatchEvent(new Event('resize'));});}function activePrebookingListing(prebookingListingId, offset, domId) {doAjaxRequestHandler(context+ "/activePrebookingListingById?prebookingListingId="+ prebookingListingId + "&offset=" + offset, "PUT", function(response) {$('#' + domId).html(response);$('#prebooking-listing-details-container').html('');});}function expirePrebookingListing(prebookingListingId, offset, domId) {doAjaxRequestHandler(context+ "/expirePrebookingListingById?prebookingListingId="+ prebookingListingId + "&offset=" + offset, "PUT", function(response) {$('#' + domId).html(response);$('#prebooking-listing-details-container').html('');});}function updatePrebookingListing(prebookingListingId, offset, domId) {datepickerRange = getDatesFromPicker('input[name="duration"]');doAjaxRequestHandler(context+ "/updatePrebookingListingById?prebookingListingId="+ prebookingListingId + "&activeTimestamp=" + datepickerRange.startDate+ "&expireTimestamp=" + datepickerRange.endDate + "&offset=" + offset, "PUT",function (response) {$('#' + domId).html(response);$('#prebooking-listing-details-container').html('');});}