| 23419 |
ashik.ali |
1 |
$(function() {
|
|
|
2 |
|
|
|
3 |
$(".create-prebooking-listing").live('click', function() {
|
|
|
4 |
console.log("Create Prebooking Listing Button Clicked...")
|
|
|
5 |
loadCreatePrebookingListing("main-content");
|
|
|
6 |
});
|
|
|
7 |
|
|
|
8 |
$(".prebooking-listings").live('click', function() {
|
|
|
9 |
console.log("Prebooking Listings Button Clicked...")
|
|
|
10 |
loadPrebookingListings("main-content");
|
|
|
11 |
});
|
|
|
12 |
|
|
|
13 |
$(".create-prebooking-order").live('click', function() {
|
|
|
14 |
console.log("Create Prebooking Order Button Clicked...")
|
|
|
15 |
loadCreatePrebookingListings("main-content");
|
|
|
16 |
});
|
|
|
17 |
|
|
|
18 |
$(".prebooking-orders").live('click', function() {
|
|
|
19 |
console.log("Prebooking Orders Button Clicked...")
|
|
|
20 |
loadPrebookingOrders("main-content");
|
|
|
21 |
});
|
|
|
22 |
|
|
|
23 |
$("#prebooking-listings-paginated .next").live('click', function() {
|
| 23629 |
ashik.ali |
24 |
loadPaginatedNextItems('/getPaginatedPrebookingListings', null, 'prebooking-listings-paginated', 'prebooking-listings-table', 'prebooking-listing-details-container');
|
|
|
25 |
$(this).blur();
|
| 23419 |
ashik.ali |
26 |
});
|
|
|
27 |
|
|
|
28 |
$("#prebooking-listings-paginated .previous").live('click', function() {
|
| 23629 |
ashik.ali |
29 |
loadPaginatedPreviousItems('/getPaginatedPrebookingListings', null, 'prebooking-listings-paginated', 'prebooking-listings-table', 'prebooking-listing-details-container');
|
|
|
30 |
$(this).blur();
|
| 23419 |
ashik.ali |
31 |
});
|
|
|
32 |
|
|
|
33 |
$("#prebooking-orders-paginated .next").live('click', function() {
|
| 23629 |
ashik.ali |
34 |
loadPaginatedNextItems('/getPaginatedPrebookingOrders', null, 'prebooking-orders-paginated', 'prebooking-orders-table', 'prebooking-order-details-container');
|
|
|
35 |
$(this).blur();
|
| 23419 |
ashik.ali |
36 |
});
|
|
|
37 |
|
|
|
38 |
$("#prebooking-orders-paginated .previous").live('click', function() {
|
| 23629 |
ashik.ali |
39 |
loadPaginatedPreviousItems('/getPaginatedPrebookingOrders', null, 'prebooking-orders-paginated', 'prebooking-orders-table', 'prebooking-order-details-container');
|
|
|
40 |
$(this).blur();
|
| 23419 |
ashik.ali |
41 |
});
|
|
|
42 |
|
|
|
43 |
$('#brands li a').live('click', function(){
|
|
|
44 |
$('#brand-value').text($(this).text());
|
|
|
45 |
loadItemsDescriptionByBrand("items-description-container", $(this).text());
|
|
|
46 |
console.log($(this).text());
|
|
|
47 |
});
|
|
|
48 |
|
|
|
49 |
$(".prebooking-listing-details").live('click',function(){
|
|
|
50 |
var prebookingListingId = $(this).attr('data');
|
|
|
51 |
console.log("prebookingListingId = " + prebookingListingId);
|
|
|
52 |
loadPrebookingListingDetails(prebookingListingId, "prebooking-listing-details-container");
|
|
|
53 |
});
|
|
|
54 |
|
|
|
55 |
$(".active-prebooking-listing").live('click',function(){
|
|
|
56 |
var prebookingListingId = $(this).attr('data');
|
|
|
57 |
console.log("active-prebooking-listing id : "+prebookingListingId);
|
|
|
58 |
var start = $( "#prebooking-listings-paginated .start" ).text();
|
|
|
59 |
//var end = $( "#schemes-paginated .end" ).text();
|
|
|
60 |
var offset = start - 1;
|
|
|
61 |
if(confirm("Are you sure you want to Active Prebooking Listing!") == true){
|
|
|
62 |
activePrebookingListing(prebookingListingId, offset, "prebooking-listings-table");
|
|
|
63 |
}
|
|
|
64 |
});
|
|
|
65 |
|
|
|
66 |
$(".expire-prebooking-listing").live('click',function(){
|
|
|
67 |
var prebookingListingId = $(this).attr('data');
|
|
|
68 |
console.log("expire-prebooking-listing id : "+prebookingListingId);
|
|
|
69 |
var start = $( "#prebooking-listings-paginated .start" ).text();
|
|
|
70 |
//var end = $( "#schemes-paginated .end" ).text();
|
|
|
71 |
var offset = start - 1;
|
|
|
72 |
if(confirm("Are you sure you want to Expire Prebooking Listing!") == true){
|
|
|
73 |
expirePrebookingListing(prebookingListingId, offset, "prebooking-listings-table");
|
|
|
74 |
}
|
|
|
75 |
});
|
|
|
76 |
|
|
|
77 |
$("#quantity").live("change paste keyup", function() {
|
|
|
78 |
var quantity = parseFloat($(this).val());
|
|
|
79 |
if(quantity <= 0){
|
|
|
80 |
alert("Quantity must be greater than zero");
|
|
|
81 |
$(this).val(1);
|
|
|
82 |
}else if(quantity > 0){
|
|
|
83 |
var totalAmount = parseFloat($('#advanceAmount').val());
|
|
|
84 |
$('#totalAmount').val(quantity * totalAmount);
|
|
|
85 |
}
|
|
|
86 |
});
|
|
|
87 |
|
|
|
88 |
});
|
|
|
89 |
|
|
|
90 |
$(document).ready(function() {
|
|
|
91 |
|
|
|
92 |
$( "#quantity").live("blur", function() {
|
|
|
93 |
console.log("quantity blur called");
|
|
|
94 |
if($(this).val() == ""){
|
|
|
95 |
$(this).val(1);
|
|
|
96 |
$('#totalAmount').val($('#advanceAmount').val());
|
|
|
97 |
}
|
|
|
98 |
});
|
|
|
99 |
|
|
|
100 |
});
|
|
|
101 |
|
|
|
102 |
function configureItemsDescriptionDropDown(){
|
|
|
103 |
$(document).ready(function() {
|
|
|
104 |
$('#itemsDescription').multiselect({
|
| 23569 |
govind |
105 |
//includeSelectAllOption: true,
|
| 23419 |
ashik.ali |
106 |
maxHeight: 200,
|
|
|
107 |
buttonWidth: '280px',
|
|
|
108 |
// numberDisplayed: 1,
|
|
|
109 |
nonSelectedText: 'Items',
|
|
|
110 |
nSelectedText: ' - Items Selected',
|
|
|
111 |
enableFiltering: true,
|
| 23569 |
govind |
112 |
enableCaseInsensitiveFiltering:true,
|
| 23419 |
ashik.ali |
113 |
multiple: false
|
|
|
114 |
});
|
|
|
115 |
});
|
|
|
116 |
}
|
|
|
117 |
|
|
|
118 |
function loadCreatePrebookingListing(domId){
|
| 23569 |
govind |
119 |
doAjaxRequestHandler(context+"/createPrebookingListing", "GET", function(response){
|
| 23419 |
ashik.ali |
120 |
$('#' + domId).html(response);
|
|
|
121 |
});
|
|
|
122 |
}
|
|
|
123 |
|
|
|
124 |
function loadPrebookingListings(domId){
|
| 23569 |
govind |
125 |
doAjaxRequestHandler(context+"/getPrebookingListings", "GET", function(response){
|
| 23419 |
ashik.ali |
126 |
$('#' + domId).html(response);
|
|
|
127 |
});
|
|
|
128 |
}
|
|
|
129 |
|
|
|
130 |
function loadCreatePrebookingListings(domId){
|
| 23569 |
govind |
131 |
doAjaxRequestHandler(context+"/createPrebookingOrder", "GET", function(response){
|
| 23419 |
ashik.ali |
132 |
$('#' + domId).html(response);
|
|
|
133 |
});
|
|
|
134 |
}
|
|
|
135 |
|
|
|
136 |
function loadPrebookingOrders(domId){
|
| 23569 |
govind |
137 |
doAjaxRequestHandler(context+"/getPrebookingOrders", "GET", function(response){
|
| 23419 |
ashik.ali |
138 |
$('#' + domId).html(response);
|
|
|
139 |
});
|
|
|
140 |
}
|
|
|
141 |
|
|
|
142 |
function loadItemsDescriptionByBrand(domId, brand){
|
| 23569 |
govind |
143 |
doAjaxRequestHandler(context+"/getItemsByBrand?brand="+brand, "GET", function(response){
|
| 23419 |
ashik.ali |
144 |
$('#' + domId).html(response);
|
|
|
145 |
configureItemsDescriptionDropDown();
|
|
|
146 |
});
|
|
|
147 |
}
|
|
|
148 |
|
|
|
149 |
function loadPrebookingListingDetails(prebookingListingId, domId){
|
| 23569 |
govind |
150 |
doAjaxRequestHandler(context+"/getPrebookingListingById?prebookingListingId="+prebookingListingId, "GET", function(response){
|
| 23419 |
ashik.ali |
151 |
$('#' + domId).html(response);
|
|
|
152 |
window.dispatchEvent(new Event('resize'));
|
|
|
153 |
});
|
|
|
154 |
}
|
|
|
155 |
|
|
|
156 |
function activePrebookingListing(prebookingListingId, offset, domId){
|
| 23569 |
govind |
157 |
doAjaxRequestHandler(context+"/activePrebookingListingById?prebookingListingId="+prebookingListingId
|
|
|
158 |
+"&offset="+offset, "PUT", function(response){
|
| 23419 |
ashik.ali |
159 |
$('#' + domId).html(response);
|
|
|
160 |
$('#prebooking-listing-details-container').html('');
|
|
|
161 |
});
|
|
|
162 |
|
|
|
163 |
}
|
|
|
164 |
|
|
|
165 |
function expirePrebookingListing(prebookingListingId, offset, domId){
|
| 23569 |
govind |
166 |
doAjaxRequestHandler(context+"/expirePrebookingListingById?prebookingListingId="+prebookingListingId
|
|
|
167 |
+"&offset="+offset, "PUT", function(response){
|
| 23419 |
ashik.ali |
168 |
$('#' + domId).html(response);
|
|
|
169 |
$('#prebooking-listing-details-container').html('');
|
|
|
170 |
});
|
|
|
171 |
}
|