| 23419 |
ashik.ali |
1 |
$(function() {
|
| 26218 |
tejbeer |
2 |
|
| 23419 |
ashik.ali |
3 |
$(".create-prebooking-listing").live('click', function() {
|
|
|
4 |
console.log("Create Prebooking Listing Button Clicked...")
|
|
|
5 |
loadCreatePrebookingListing("main-content");
|
|
|
6 |
});
|
| 26218 |
tejbeer |
7 |
|
| 23419 |
ashik.ali |
8 |
$(".prebooking-listings").live('click', function() {
|
|
|
9 |
console.log("Prebooking Listings Button Clicked...")
|
|
|
10 |
loadPrebookingListings("main-content");
|
|
|
11 |
});
|
| 26218 |
tejbeer |
12 |
|
| 23419 |
ashik.ali |
13 |
$(".create-prebooking-order").live('click', function() {
|
|
|
14 |
console.log("Create Prebooking Order Button Clicked...")
|
|
|
15 |
loadCreatePrebookingListings("main-content");
|
|
|
16 |
});
|
| 26218 |
tejbeer |
17 |
|
| 23419 |
ashik.ali |
18 |
$(".prebooking-orders").live('click', function() {
|
|
|
19 |
console.log("Prebooking Orders Button Clicked...")
|
|
|
20 |
loadPrebookingOrders("main-content");
|
|
|
21 |
});
|
| 26218 |
tejbeer |
22 |
|
|
|
23 |
$("#prebooking-listings-paginated .next").live(
|
|
|
24 |
'click',
|
|
|
25 |
function() {
|
|
|
26 |
loadPaginatedNextItems('/getPaginatedPrebookingListings', null,
|
|
|
27 |
'prebooking-listings-paginated',
|
|
|
28 |
'prebooking-listings-table',
|
|
|
29 |
'prebooking-listing-details-container');
|
|
|
30 |
$(this).blur();
|
|
|
31 |
});
|
|
|
32 |
|
|
|
33 |
$("#prebooking-listings-paginated .previous").live(
|
|
|
34 |
'click',
|
|
|
35 |
function() {
|
|
|
36 |
loadPaginatedPreviousItems('/getPaginatedPrebookingListings',
|
|
|
37 |
null, 'prebooking-listings-paginated',
|
|
|
38 |
'prebooking-listings-table',
|
|
|
39 |
'prebooking-listing-details-container');
|
|
|
40 |
$(this).blur();
|
|
|
41 |
});
|
|
|
42 |
|
|
|
43 |
$("#prebooking-orders-paginated .next").live(
|
|
|
44 |
'click',
|
|
|
45 |
function() {
|
|
|
46 |
loadPaginatedNextItems('/getPaginatedPrebookingOrders', null,
|
|
|
47 |
'prebooking-orders-paginated',
|
|
|
48 |
'prebooking-orders-table',
|
|
|
49 |
'prebooking-order-details-container');
|
|
|
50 |
$(this).blur();
|
|
|
51 |
});
|
|
|
52 |
|
|
|
53 |
$("#prebooking-orders-paginated .previous").live(
|
|
|
54 |
'click',
|
|
|
55 |
function() {
|
|
|
56 |
loadPaginatedPreviousItems('/getPaginatedPrebookingOrders',
|
|
|
57 |
null, 'prebooking-orders-paginated',
|
|
|
58 |
'prebooking-orders-table',
|
|
|
59 |
'prebooking-order-details-container');
|
|
|
60 |
$(this).blur();
|
|
|
61 |
});
|
|
|
62 |
|
|
|
63 |
/*
|
|
|
64 |
* $('#brands li a').live('click', function(){
|
|
|
65 |
* $('#brand-value').text($(this).text());
|
|
|
66 |
* loadItemsDescriptionByBrand("items-description-container",
|
|
|
67 |
* $(this).text()); console.log($(this).text()); });
|
|
|
68 |
*/
|
|
|
69 |
|
|
|
70 |
$(".prebooking-listing-details").live(
|
|
|
71 |
'click',
|
|
|
72 |
function() {
|
|
|
73 |
var prebookingListingId = $(this).attr('data');
|
|
|
74 |
console.log("prebookingListingId = " + prebookingListingId);
|
|
|
75 |
loadPrebookingListingDetails(prebookingListingId,
|
|
|
76 |
"prebooking-listing-details-container");
|
|
|
77 |
});
|
|
|
78 |
|
|
|
79 |
$(".active-prebooking-listing")
|
|
|
80 |
.live(
|
|
|
81 |
'click',
|
|
|
82 |
function() {
|
|
|
83 |
var prebookingListingId = $(this).attr('data');
|
|
|
84 |
console.log("active-prebooking-listing id : "
|
|
|
85 |
+ prebookingListingId);
|
|
|
86 |
var start = $("#prebooking-listings-paginated .start")
|
|
|
87 |
.text();
|
|
|
88 |
// var end = $( "#schemes-paginated .end" ).text();
|
|
|
89 |
var offset = start - 1;
|
|
|
90 |
if (confirm("Are you sure you want to Active Prebooking Listing!") == true) {
|
|
|
91 |
activePrebookingListing(prebookingListingId,
|
|
|
92 |
offset, "prebooking-listings-table");
|
|
|
93 |
}
|
|
|
94 |
});
|
|
|
95 |
|
|
|
96 |
$(".expire-prebooking-listing")
|
|
|
97 |
.live(
|
|
|
98 |
'click',
|
|
|
99 |
function() {
|
|
|
100 |
var prebookingListingId = $(this).attr('data');
|
|
|
101 |
console.log("expire-prebooking-listing id : "
|
|
|
102 |
+ prebookingListingId);
|
|
|
103 |
var start = $("#prebooking-listings-paginated .start")
|
|
|
104 |
.text();
|
|
|
105 |
// var end = $( "#schemes-paginated .end" ).text();
|
|
|
106 |
var offset = start - 1;
|
|
|
107 |
if (confirm("Are you sure you want to Expire Prebooking Listing!") == true) {
|
|
|
108 |
expirePrebookingListing(prebookingListingId,
|
|
|
109 |
offset, "prebooking-listings-table");
|
|
|
110 |
}
|
|
|
111 |
});
|
|
|
112 |
|
|
|
113 |
$(".update-prebooking-duration")
|
|
|
114 |
.live(
|
|
|
115 |
'click',
|
|
|
116 |
function() {
|
|
|
117 |
var prebookingListingId = $(this).attr('data');
|
|
|
118 |
console.log("update-prebooking-listing id : "
|
|
|
119 |
+ prebookingListingId);
|
|
|
120 |
var start = $("#prebooking-listings-paginated .start")
|
|
|
121 |
.text();
|
|
|
122 |
// var end = $( "#schemes-paginated .end" ).text();
|
|
|
123 |
var offset = start - 1;
|
|
|
124 |
if (confirm("Are you sure you want to Active Prebooking Listing!") == true) {
|
|
|
125 |
updatePrebookingListing(prebookingListingId,
|
|
|
126 |
offset, "prebooking-listings-table");
|
|
|
127 |
}
|
|
|
128 |
});
|
|
|
129 |
|
| 23419 |
ashik.ali |
130 |
$("#quantity").live("change paste keyup", function() {
|
|
|
131 |
var quantity = parseFloat($(this).val());
|
| 26218 |
tejbeer |
132 |
if (quantity <= 0) {
|
| 23419 |
ashik.ali |
133 |
alert("Quantity must be greater than zero");
|
|
|
134 |
$(this).val(1);
|
| 26218 |
tejbeer |
135 |
} else if (quantity > 0) {
|
| 23419 |
ashik.ali |
136 |
var totalAmount = parseFloat($('#advanceAmount').val());
|
|
|
137 |
$('#totalAmount').val(quantity * totalAmount);
|
|
|
138 |
}
|
|
|
139 |
});
|
| 26218 |
tejbeer |
140 |
|
| 23419 |
ashik.ali |
141 |
});
|
|
|
142 |
|
|
|
143 |
$(document).ready(function() {
|
| 26218 |
tejbeer |
144 |
|
|
|
145 |
$("#quantity").live("blur", function() {
|
| 23419 |
ashik.ali |
146 |
console.log("quantity blur called");
|
| 26218 |
tejbeer |
147 |
if ($(this).val() == "") {
|
| 23419 |
ashik.ali |
148 |
$(this).val(1);
|
|
|
149 |
$('#totalAmount').val($('#advanceAmount').val());
|
|
|
150 |
}
|
|
|
151 |
});
|
| 26218 |
tejbeer |
152 |
|
| 23419 |
ashik.ali |
153 |
});
|
|
|
154 |
|
| 26218 |
tejbeer |
155 |
function configureItemsDescriptionDropDown() {
|
| 23419 |
ashik.ali |
156 |
$(document).ready(function() {
|
| 26218 |
tejbeer |
157 |
$('#itemsDescription').multiselect({
|
|
|
158 |
// includeSelectAllOption: true,
|
|
|
159 |
maxHeight : 200,
|
|
|
160 |
buttonWidth : '280px',
|
|
|
161 |
// numberDisplayed: 1,
|
|
|
162 |
nonSelectedText : 'Items',
|
|
|
163 |
nSelectedText : ' - Items Selected',
|
|
|
164 |
enableFiltering : true,
|
|
|
165 |
enableCaseInsensitiveFiltering : true,
|
|
|
166 |
multiple : false
|
|
|
167 |
});
|
|
|
168 |
});
|
| 23419 |
ashik.ali |
169 |
}
|
|
|
170 |
|
| 26218 |
tejbeer |
171 |
function loadCreatePrebookingListing(domId) {
|
|
|
172 |
doAjaxRequestHandler(context + "/createPrebookingListing", "GET", function(
|
|
|
173 |
response) {
|
| 23419 |
ashik.ali |
174 |
$('#' + domId).html(response);
|
|
|
175 |
});
|
|
|
176 |
}
|
|
|
177 |
|
| 26218 |
tejbeer |
178 |
function loadPrebookingListings(domId) {
|
|
|
179 |
doAjaxRequestHandler(context + "/getPrebookingListings", "GET", function(
|
|
|
180 |
response) {
|
| 23419 |
ashik.ali |
181 |
$('#' + domId).html(response);
|
|
|
182 |
});
|
|
|
183 |
}
|
|
|
184 |
|
| 26218 |
tejbeer |
185 |
function loadCreatePrebookingListings(domId) {
|
|
|
186 |
doAjaxRequestHandler(context + "/createPrebookingOrder", "GET", function(
|
|
|
187 |
response) {
|
| 23419 |
ashik.ali |
188 |
$('#' + domId).html(response);
|
|
|
189 |
});
|
|
|
190 |
}
|
|
|
191 |
|
| 26218 |
tejbeer |
192 |
function loadPrebookingOrders(domId) {
|
|
|
193 |
doAjaxRequestHandler(context + "/getPrebookingOrders", "GET", function(
|
|
|
194 |
response) {
|
| 23419 |
ashik.ali |
195 |
$('#' + domId).html(response);
|
|
|
196 |
});
|
|
|
197 |
}
|
|
|
198 |
|
| 26218 |
tejbeer |
199 |
function loadItemsDescriptionByBrand(domId, brand) {
|
|
|
200 |
doAjaxRequestHandler(context + "/getItemsByBrand?brand=" + brand, "GET",
|
|
|
201 |
function(response) {
|
|
|
202 |
$('#' + domId).html(response);
|
|
|
203 |
configureItemsDescriptionDropDown();
|
|
|
204 |
});
|
| 23419 |
ashik.ali |
205 |
}
|
|
|
206 |
|
| 26218 |
tejbeer |
207 |
function loadPrebookingListingDetails(prebookingListingId, domId) {
|
|
|
208 |
doAjaxRequestHandler(context
|
|
|
209 |
+ "/getPrebookingListingById?prebookingListingId="
|
|
|
210 |
+ prebookingListingId, "GET", function(response) {
|
| 23419 |
ashik.ali |
211 |
$('#' + domId).html(response);
|
|
|
212 |
window.dispatchEvent(new Event('resize'));
|
|
|
213 |
});
|
|
|
214 |
}
|
|
|
215 |
|
| 26218 |
tejbeer |
216 |
function activePrebookingListing(prebookingListingId, offset, domId) {
|
|
|
217 |
doAjaxRequestHandler(context
|
|
|
218 |
+ "/activePrebookingListingById?prebookingListingId="
|
|
|
219 |
+ prebookingListingId + "&offset=" + offset, "PUT", function(
|
|
|
220 |
response) {
|
| 23419 |
ashik.ali |
221 |
$('#' + domId).html(response);
|
|
|
222 |
$('#prebooking-listing-details-container').html('');
|
|
|
223 |
});
|
| 26218 |
tejbeer |
224 |
|
| 23419 |
ashik.ali |
225 |
}
|
|
|
226 |
|
| 26218 |
tejbeer |
227 |
function expirePrebookingListing(prebookingListingId, offset, domId) {
|
|
|
228 |
doAjaxRequestHandler(context
|
|
|
229 |
+ "/expirePrebookingListingById?prebookingListingId="
|
|
|
230 |
+ prebookingListingId + "&offset=" + offset, "PUT", function(
|
|
|
231 |
response) {
|
| 23419 |
ashik.ali |
232 |
$('#' + domId).html(response);
|
|
|
233 |
$('#prebooking-listing-details-container').html('');
|
|
|
234 |
});
|
| 26218 |
tejbeer |
235 |
}
|
|
|
236 |
function updatePrebookingListing(prebookingListingId, offset, domId) {
|
|
|
237 |
doAjaxRequestHandler(context
|
|
|
238 |
+ "/updatePrebookingListingById?prebookingListingId="
|
|
|
239 |
+ prebookingListingId + "&activeTimestamp=" + startDate
|
|
|
240 |
+ "&expireTimestamp=" + endDate + "&offset=" + offset, "PUT",
|
|
|
241 |
function(response) {
|
|
|
242 |
$('#' + domId).html(response);
|
|
|
243 |
$('#prebooking-listing-details-container').html('');
|
|
|
244 |
});
|
| 23419 |
ashik.ali |
245 |
}
|