File: DropDownData\dropDownData.js
/*================================================================================================================\
+
+ Project : GoData-Eicher
+ Filename : dropDownData.js
+ Module Name : DropDownData
+ Purpose : For Eicher drop down data
+ Coded By : Parul Gupta
+
+================================================================================================================*/
/**
* To bind Data in DropDownList
* @module DropDownData
*/
/**
* This class contains functionality of drop down data list binding.
* @class DropDownData
* @constructor
*/
/**
* Function to bind all languages in drop down
* @method getLanguageList
* @param {String} ddId The id of the drop down list
* @for DropDownData
*/
function getLanguageList(ddId) {
//console.log(ddId + "in drop down data js");
$.ajax({
type: "GET",
url: "/DropDownData/GetAllLanguageList/",
success: function (data) {
// empty Language dropdown
$("#" + ddId).text("");
// by default add select text.
$("#" + ddId).append($('<option></option>').val("").html("-Select-"));
// add data to dropdown.
if (data.list) {
for (var counter = 0; counter < data.list.length; counter++) {
$("#" + ddId).append(
$('<option></option>').val(data.list[counter].Value).html(data.list[counter].Text));
}
}
},
error: function (data) {
console.log(data);
}
});
}
/**
* Function to bind all source of toll free no. in drop down
* @method getTollFreeSourceList
* @param {String} ddId The id of the drop down list
* @for DropDownData
*/
function getTollFreeSourceList(ddId) {
//console.log(ddId + "in drop down data js");
$.ajax({
type: "GET",
url: "/DropDownData/GetSourceListOfTollFreeNo/",
success: function (data) {
// empty Language dropdown
$("#" + ddId).text("");
// by default add select text.
$("#" + ddId).append($('<option></option>').val("").html("-Select-"));
// add data to dropdown.
if (data.list) {
for (var counter = 0; counter < data.list.length; counter++) {
$("#" + ddId).append(
$('<option></option>').val(data.list[counter].Value).html(data.list[counter].Text));
}
}
},
error: function (data) {
console.log(data);
}
});
}
/**
* Function to bind all warrenty data in drop down
* @method getWarrentyAmcList
* @param {String} ddId The id of the drop down list
* @for DropDownData
*/
function getWarrentyAmcList(ddId) {
console.log(ddId + "in drop down data js");
$.ajax({
type: "GET",
url: "/DropDownData/GetWarrentyAmcList/",
success: function (data) {
// empty Language dropdown
$("#" + ddId).text("");
// by default add select text.
$("#" + ddId).append($('<option></option>').val("").html("-Select-"));
// add data to dropdown.
if (data.list) {
for (var counter = 0; counter < data.list.length; counter++) {
$("#" + ddId).append(
$('<option></option>').val(data.list[counter].Value).html(data.list[counter].Text));
}
}
},
error: function (data) {
console.log(data);
}
});
}
/**
* Function to bind all cities on state change in drop down
* @method LoadCityListOnStateChange
* @for DropDownData
*/
function LoadCityListOnStateChange() {
var stateVal;
stateVal = $("#eos_state").val();
var stateName = $('#eos_state').find('option:selected').text();
setMapCenterToAddress(stateName);
$("#eos_city").val('');
if (stateVal != "-Select-") {
stateVal = $("#eos_state").val();
}
else {
stateVal = 0;
}
if (stateVal != "") {
$.ajax({
type: "GET",
url: "/DropDownData/showCityStateWise/",
data: { stateVal: stateVal },
success: function (data) {
$("#eos_city").kendoComboBox({
dataTextField: "CityName",
dataValueField: "CityName",
filter: "contains",
dataSource: data.list
});
},
error: function (data) {
console.log(data);
}
});
}
}