/*================================================================================================================\ + + 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($('').val("").html("-Select-")); // add data to dropdown. if (data.list) { for (var counter = 0; counter < data.list.length; counter++) { $("#" + ddId).append( $('').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) { //alert(WCFRESTURL.GetTollfreeList + "in drop down data js"); $.ajax({ // type: "GET", type: "POST", url: WCFRESTURL.GetTollfreeList, success: function (data) { //alert($("#" + ddId).parent().siblings().html()); var html = "* "; var htmltypeLoad = "* "; var htmltollfree = "* "; $("#" + ddId).parent().siblings().append(html); $("#vehicle_type_of_load").parent().siblings().append(html); $("#" + ddId).text(""); // by default add select text. $("#" + ddId).append($('').val("").html("-Select-")); // add data to dropdown. if (data) { for (var counter = 0; counter < data.length; counter++) { // alert(data[counter].ReasonName); $("#" + ddId).append( $('').val(data[counter].Id).html(data[counter].ReasonName)); } $("#" + ddId).parent().append(htmltollfree); $("#vehicle_type_of_load").parent().append(htmltypeLoad); } }, 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) { $.ajax({ type: "GET", url: "/DropDownData/GetWarrentyAmcList/", success: function (data) { // empty Language dropdown $("#" + ddId).text(""); // by default add select text. $("#" + ddId).append($('').val("").html("-Select-")); // add data to dropdown. if (data.list) { for (var counter = 0; counter < data.list.length; counter++) { $("#" + ddId).append( $('').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() { // reset city list if ($("#eos_city").data("kendoComboBox") != undefined) { var multiselect = $("#eos_city").data("kendoComboBox"); multiselect.destroy(); } $("#eos_city").kendoComboBox({ dataTextField: "CityName", dataValueField: "CityName", filter: "contains", dataSource: [] }); var stateMultiselect = $("#eos_state").data("kendoMultiSelect").dataItems(); // console.log(stateMultiselect.length) if (stateMultiselect != "" && stateMultiselect != null && stateMultiselect.length > 0) { var combobox = $("#eos_city").data("kendoComboBox"); for (var counter = 0; counter < stateMultiselect.length; counter++) { $.ajax({ type: "GET", url: "/DropDownData/showCityStateWise/", data: { stateVal: stateMultiselect[counter].value }, success: function (data) { // console.log(data) for (var count = 0; count < data.list.length; count++) { //console.log(data.list[count].CityName) combobox.dataSource.add({ CityName: data.list[count].CityName, CityName: data.list[count].CityName }); } }, error: function (data) { console.log(data); } }); } } //var stateVal; //stateVal = $("#eos_state").val(); //var stateName = $('#eos_state').find('option:selected').text(); //$("#eos_city").val(''); //if (stateVal != "-Select-") { // stateVal = $("#eos_state").val(); //} //else { // stateVal = 0; //} } /** * Function to bind reasons list for dealer ticket in drop down * @method getReasonForDealerTicket * @param {String} ddId The id of the drop down list * @for DropDownData */ function getReasonForDealerTicket(ddId) { console.log(ddId); $.ajax({ type: "GET", url: "/DropDownData/GetReasonForDealerTicket/", success: function (data) { // empty Language dropdown $("#" + ddId).text(""); // by default add select text. $("#" + ddId).append($('').val("").html("-Select-")); // add data to dropdown. if (data.list) { for (var counter = 0; counter < data.list.length; counter++) { $("#" + ddId).append( $('').val(data.list[counter].Value).html(data.list[counter].Text)); } } }, error: function (data) { console.log(data); } }); }