var year;

$(document).ready(function(){
  year = $('.resp-tab-active').children().text();
  //loadExhibitionData(year);

  $('.slider').slick({
    slidesToShow: 5,
    slidesToScroll: 1,
    arrows: false,
    dots:false,
  
    responsive: [
      {
        breakpoint: 1024,
        settings: {
          slidesToShow: 5,
        }
      },
      {
        breakpoint: 600,
        settings: {
          slidesToShow: 3,
          slidesToScroll: 1
        }
      },
      {
        breakpoint: 400,
        settings: {
          slidesToShow: 2,
          slidesToScroll: 1
        }
      },
      {
        breakpoint: 320,
        settings: {
          slidesToShow: 1,
          slidesToScroll: 1
        }
      }
    ]
  });

  $('.next').click(function(){
    $('.slider').slick('slickPrev');
  })
  
  $('.previous').click(function(){
    $('.slider').slick('slickNext');
  })

  $('.slider li').click(function(){
		$('.slider li').removeClass('resp-tab-active');
    $(this).addClass('resp-tab-active');
    year = $(this).children().text();
  //  loadExhibitionData(year);
  });
  
  $('.radioBtn').click(function(){
    $('.radioBtn').removeClass('whiteColor');
    $(this).addClass('whiteColor');
  });


$("#exhsemwebformid").on("submit",function(e){
    e.preventDefault();
   // alert(1)
    $(".error").html("");
    $(".error").css("display", "none");
    
    var t = new FormData(this);
      $.ajax({
          type: "POST",
          data: t,
          url: CI_ROOT+"exhibitionseminarwebinar/createInvoice",
          dataType: "json",
          mimeType: "multipart/form-data",
          processData: false,
          contentType: false,
          success: function(result){
            if(result.status == "success"){
                window.location.href = CI_ROOT + "exhibitionseminarwebinar/sendtopaymentgateway/"+result.data;
            }
          }
      });
  });
  
  

	//$(function () {
		//	$("#txtIEC").onkeyup(function (e) {
		$("#txtIEC").keyup(function(){
			   // $("#txtIEC").on("onkeyup",function(e){
		//	function membersieccheck() {
			    //alert();
					txtIEC = $("#txtIEC").val();
					isCouncilUser = $("#isCouncilUser").val();
					if(txtIEC != ''){
						$.ajax({
						        url: CI_ROOT+"exhibitionseminarwebinar/MembersFetchDetails",
								//url : document.location.protocol+'//'+document.domain+'/<?=MAIN_FOLDER?>include/ajax/ajax_check_gst.php',
								type : 'POST',
								data : {isCouncilUser : isCouncilUser, txtIEC : txtIEC},
								dataTpe : 'html',
								success : function (res) {
									
									var data = res.split("||");
								if(data[0] > 0)
								{
									$('#memberid').val(data[0]);
									$('#exh_sem_web_company').val(data[1]);
								//	$('#txtIEC').val(data[2]);
									$('#exh_sem_web_email').val(data[4]);
									$('#exh_sem_web_contact').val(data[5]);
									$('#exh_sem_web_address').val(data[6]);
									$('#exh_sem_web_pan').val(data[7]);
									$('#exh_sem_web_gst').val(data[8]);
									//$('#state').val(data[9]);
									$('#exh_sem_web_contactperson').val(data[11]);
								    $('#exh_sem_web_hs').val(data[13]);
								   
	                               // alert(datahtml);
									
								}
									
								//	$('#InvoiceBaseAmount').val(data[9]);
								
									/*if(res == "ERROR"){
										alert("GST is invalid");
										//$("#submit").attr("disabled");
									}else if(res == "NOERROR"){
										//alert("GST not invalid");
										$("#submit").removeAttr("disabled");
										
									}
									else if(res == "STATEERROR"){
										alert("Please Select Your Country and State and than enter your Gst No");
										//$("#submit").removeAttr("disabled");
										
									}*/
								}					
						});
					}
		//	}	
		});
//	})



/*
  $(".exhsemwebformdiv").on("click",function(){
      //e.preventDefault();
      var productheaderid = $(this).data("value");
      //$('#exhsemwebformdiv').css('display','block');
      //var t = {productheaderid:productheaderid};
      alert(productheaderid);
      $.ajax({
          type: "POST",
          data: {productheaderid:productheaderid},
          url: CI_ROOT+"exhibitionseminarwebinar/getexhibitionseminarwebinarajax",
          dataType: "json",
          success: function(result){
              
            if(result.status == "success"){
                window.location.href = CI_ROOT + "exhibitionseminarwebinar/exhibitionseminarwebinardetails";
                $("#areasqmt").html('');
                $("#areasqmt").html(result.response); 
            }
          }
      });
  });
  *//*
  $("#areasqmt").on("change",function(){
        var areavalue =   $(this).val();
        var baseamount    =   $('#InvoiceBaseAmount').val();
        if(areavalue >0 && areavalue > '')
        {
            var totalamount   =   parseFloat(areavalue) * parseFloat(baseamount);
            $('#InvoiceTotalAmount').val(totalamount);
            
            var InvoiceTotalAmount= $('#Installment_amount').val();
								    var gstamount =(InvoiceTotalAmount * 18/100);
								    //alert(gstamount);
								    var finalamount =parseFloat(InvoiceTotalAmount) + parseFloat(gstamount);
								    //alert(finalamount);
								    var datahtml ="<label>GST </label><input type='text' class='form-control' id='gstamount' name='gstamount' placeholder='GST' value='"+gstamount+"' readonly ><label> Payable Amount</label><input type='text' class='form-control' id='InvoiceTotalAmount' name='InvoiceTotalAmount' value='"+finalamount+"' placeholder='Payable Amount' readonly>";
	                                $('#plexcouncilmember').html(datahtml);
            $('#exhsemwebformsubmit').css('display','block');
        }
        else
        {
            alert("Please select area !")
            $('#InvoiceTotalAmount').val('0');
            $('#exhsemwebformsubmit').css('display','none');
        }
  });*/
  
   $("#areasqmt").on("change",function(){
        var areavalue =   $(this).val();
        var baseamount    =   $('#Installment_amount').val();
        if(areavalue >0 && areavalue > '')
        {
            var totalamount   =   parseFloat(areavalue) * parseFloat(baseamount);
            $('#InvoiceBaseAmount').val(totalamount);
            
            var InvoiceBaseAmount= $('#InvoiceBaseAmount').val();
								    var gstamount =(InvoiceBaseAmount * 18/100);
								    //alert(gstamount);
								    var finalamount =parseFloat(InvoiceBaseAmount) + parseFloat(gstamount);
								    //alert(finalamount);
								    var datahtml ="<label>GST </label><input type='text' class='form-control' id='gstamount' name='gstamount' placeholder='GST' value='"+gstamount+"' readonly ><label> Payable Amount</label><input type='text' class='form-control' id='InvoiceTotalAmount' name='InvoiceTotalAmount' value='"+finalamount+"' placeholder='Payable Amount' readonly>";
	                                $('#plexcouncilmember').html(datahtml);
            $('#exhsemwebformsubmit').css('display','block');
        }
        else
        {
            alert("Please select area !")
            $('#InvoiceTotalAmount').val('0');
            $('#exhsemwebformsubmit').css('display','none');
        }
  });
        /* var areavalue =   $('#areasqmt').val();
        var baseamount    =   $('#InvoiceBaseAmount').val();
        if(areavalue >0 && areavalue > '')
        {
            var totalamount   =   parseFloat(areavalue) * parseFloat(baseamount);
            $('#InvoiceTotalAmount').val(totalamount);
            $('#exhsemwebformsubmit').css('display','block');
        }
        else
        {
            alert("Please select area !")
            $('#InvoiceTotalAmount').val('0');
            $('#exhsemwebformsubmit').css('display','none');
        }
  */
});