Subversion Repositories SmartDukaan

Rev

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

Rev 24334 Rev 24349
Line 431... Line 431...
431
	else {
431
	else {
432
		bootbox.prompt(bootBoxObj);
432
		bootbox.prompt(bootBoxObj);
433
	}
433
	}
434
	
434
	
435
}
435
}
-
 
436
function getColorsForItems(catalogId, callback) {
-
 
437
	bootBoxObj = { 
-
 
438
			size: "small",
-
 
439
			title: "Choose Warehouse", 
-
 
440
			callback: callback,
-
 
441
			inputType:'checkbox',
-
 
442
			inputOptions : typeof inputOptions == "undefined" ? undefined : inputOptions
-
 
443
	}
-
 
444
	if(typeof inputOptions=="undefined") {
-
 
445
		doGetAjaxRequestHandler(context+"/authorisedWarehouses", function(response){
-
 
446
			response = JSON.parse(response);
-
 
447
			inputOptions = [];
-
 
448
			response.forEach(function(warehouse){
-
 
449
				inputOptions.push({
-
 
450
					text:warehouse.name,
-
 
451
					value:warehouse.id,
-
 
452
				});
-
 
453
			});
-
 
454
			bootBoxObj['inputOptions'] = inputOptions;
-
 
455
			bootbox.prompt(bootBoxObj);
-
 
456
		});
-
 
457
	} else if(inputOptions.length==1) {
-
 
458
		callback(inputOptions[0].warehouse.id);
-
 
459
	}
-
 
460
	else {
-
 
461
		bootbox.prompt(bootBoxObj);
-
 
462
	}
-
 
463
	
-
 
464
	
-
 
465
}
436
function getItemAheadOptions(jqElement, callback) {
466
function getItemAheadOptions(jqElement, callback) {
437
	jqElement.typeahead('destroy').typeahead({
467
	jqElement.typeahead('destroy').typeahead({
438
		source: function(q, process) {
468
		source: function(q, process) {
439
			if(q.length <= 3) {
469
			if(q.length <= 3) {
440
				if(typeof queryData != "undefined") {
470
				if(typeof queryData != "undefined") {
Line 460... Line 490...
460
		displayText: function(item){return item.itemDescription;},
490
		displayText: function(item){return item.itemDescription;},
461
		autoSelect: true,
491
		autoSelect: true,
462
		afterSelect: callback
492
		afterSelect: callback
463
	});
493
	});
464
}
494
}
-
 
495
function getPartnerAheadOptions(jqElement, callback) {
-
 
496
	jqElement.typeahead('destroy').typeahead({
-
 
497
		source: function(q, process) {
-
 
498
			if(q.length <= 3) {
-
 
499
				if(typeof queryData != "undefined") {
-
 
500
					queryData = undefined;
-
 
501
				}
-
 
502
				return;
-
 
503
			} else if (q.length > 3 && typeof queryData == "undefined"){
-
 
504
				return $.ajax(context+"/partners", {
-
 
505
					global:false,
-
 
506
					data: {query : q}, 
-
 
507
					success: function(data){
-
 
508
						queryData = JSON.parse(data);
-
 
509
						process(queryData);
-
 
510
					},
-
 
511
				});
-
 
512
			} else {
-
 
513
				return process(queryData);
-
 
514
			}
-
 
515
			return;
-
 
516
		},
-
 
517
		delay: 400,
-
 
518
		items: 20,
-
 
519
		displayText: function(partner){return partner.displayName;},
-
 
520
		autoSelect: true,
-
 
521
		afterSelect: callback
-
 
522
	});
-
 
523
}