Subversion Repositories SmartDukaan

Rev

Rev 32639 | Rev 33790 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 32639 Rev 32653
Line 184... Line 184...
184
 
184
 
185
		});
185
		});
186
 
186
 
187
	});
187
	});
188
 
188
 
-
 
189
	// direct go billing page skip checkout page
-
 
190
	$(document).on('click', "#addToBagButtonwithBillingpage", function () {
-
 
191
		var itemId = $("#bagModel .itemId").val();
-
 
192
		var poitemId = $("#bagModel .poitemId").val();
-
 
193
		var poId = $("#bagModel .poId").val();
-
 
194
		console.log(poitemId)
-
 
195
		console.log(poId)
-
 
196
 
-
 
197
		var tempAvailability = $("#bagModel .availability").val();
-
 
198
		var quantity = $("#bagModel .quantity").val();
-
 
199
		imeiCount = $('h4.bagModalEarlyImeis').find('input').length;
-
 
200
		if (imeiCount > 0) {
-
 
201
			quantity = $('h4.bagModalEarlyImeis').find('input:checked').length;
-
 
202
			if (quantity == 0) {
-
 
203
				alert("Please check one of the imei(s)");
-
 
204
				return;
-
 
205
			}
-
 
206
		} else if (!quantity || parseInt(quantity) <= 0 || isNaN(parseInt(quantity)) || quantity.indexOf('.') != -1) {
-
 
207
			alert("Please enter valid quantity");
-
 
208
			return;
-
 
209
		}
-
 
210
 
-
 
211
		doGetAjaxRequestHandler(context + "/checkItemAvailability/?itemId=" + itemId, function (response) {
-
 
212
			var obj = JSON.parse(response);
-
 
213
			console.log(obj);
-
 
214
			if (obj.availability < parseInt(quantity) || obj.availability == 0) {
-
 
215
				alert("You don't have enough inventory of this item");
-
 
216
				return;
-
 
217
			}
-
 
218
			var obj = {
-
 
219
				'itemId': obj.itemId,
-
 
220
				'displayName': obj.displayName,
-
 
221
				'quantity': parseInt(quantity),
-
 
222
				'iconUrl': obj.iconUrl,
-
 
223
				'poItemId': poitemId,
-
 
224
				'poId': poId
-
 
225
			};
-
 
226
			if (imeiCount > 0) {
-
 
227
				obj['imeis'] = [];
-
 
228
				$('h4.bagModalEarlyImeis').find('input:checked').each(function (index, ele) {
-
 
229
					obj['imeis'].push(ele.value);
-
 
230
				});
-
 
231
			}
-
 
232
			console.log(obj);
-
 
233
			addItemInLocalStorage(obj);
-
 
234
			//alert("Item added to bag successfully");
-
 
235
			showToast("Item, Item added to bag successfully!");
-
 
236
			$('#bagModel').modal('hide');
-
 
237
			// Trigger the click event for the cart icon
-
 
238
			$(".cart-checkout").trigger('click');
-
 
239
 
-
 
240
		});
-
 
241
 
-
 
242
	});
-
 
243
 
189
	$(document).on('click', ".cart-trash", function() {
244
	$(document).on('click', ".cart-trash", function() {
190
		var itemId = $(this).attr('data');
245
		var itemId = $(this).attr('data');
191
		removeItemFromLocalStorage(itemId);
246
		removeItemFromLocalStorage(itemId);
192
		$('div[itemId="' + itemId + '"]').remove();
247
		$('div[itemId="' + itemId + '"]').remove();
193
		if ($('#cart-details').html().trim() == "") {
248
		if ($('#cart-details').html().trim() == "") {