$(document).ready(function(){
 // vehiclechk
 $("#ticketsubmit").mouseover(function(){
    //alert('hai');
 var val = $("#vehiclenoadd").val();
 var len = val.length;
 if(len != 10 )
 {
   if(len < 8)
   {
   $(".vehiclealertno").click();
   $("#vehiclenoadd").focus();
   $("#ticketsubmit").prop("disabled",true);
   }
   else
 {
   $(".vehicleallcomp").each(function(){
         var allveh = $(this).val();
         if (val == allveh)
         {
          $(".vehiclealertin").click();
   $("#vehiclenoadd").focus();
   $("#ticketsubmit").prop("disabled",true);
         }
   });
 }
   
 }
 else
 {
   $(".vehicleallcomp").each(function(){
         var allveh = $(this).val();
         if (val == allveh)
         {
          $(".vehiclealertin").click();
          $("#vehiclenoadd").focus();
          $("#ticketsubmit").prop("disabled",true);
         }
   });
 }
//  vehiclechk over

  });
// vehicle chk
$("#ticketsubmit").keyup(function(){
  //alert('hai');
var val = $("#vehiclenoadd").val();
var len = val.length;
if(len != 10 )
{
 if(len < 8)
 
 {
     alert(len);
 $(".vehiclealertno").click();
 $("#vehiclenoadd").focus();
 $("#ticketsubmit").prop("disabled",true);
 }
 else
{
 $(".vehicleallcomp").each(function(){
       var allveh = $(this).val();
       if (val == allveh)
       {
        $(".vehiclealertin").click();
 $("#vehiclenoadd").focus();
 $("#ticketsubmit").prop("disabled",true);
       }
 });
}
 
}
else
{
 $(".vehicleallcomp").each(function(){
       var allveh = $(this).val();
       if (val == allveh)
       {
        $(".vehiclealertin").click();
        $("#vehiclenoadd").focus();
        $("#ticketsubmit").prop("disabled",true);
       }
 });
}
});
// restriction
$("#ticketsubmit").mouseover(function()
{
    //alert('hai');
// customerchk
var customer=$("#customeradd").val();
//alert(customer);
if(customer == "")
{
    $("#customeradd").focus();
    $("#ticketsubmit").prop("disabled",true)
}

// customerchk
// vehicle
var vehicle = $("#vehiclenameadd").val();
if(vehicle == "")
{
    $("#vehiclenameadd").css("border","1px solid red");
    $("#vehiclenameadd").css("box-shadow","2px 1px 3px 1px rgba(241, 70, 70, 0.979)");
    $("#vehiclenameadd").focus();
    $("#ticketsubmit").prop("disabled",true)
   // $("#getweightadd").css("border","1px solid red");
   

}
// vehcilename
// weightchk
var weightadd=$("#vehweightadd").val();
//alert(customer);
if(weightadd == "")
{
    $("#vehweightadd").focus();
    $("#ticketsubmit").prop("disabled",true);
}

// customerchk
// weightchk
var productadd=$("#productadd").val();
//alert(customer);
if(productadd == "")
{
    $("#productadd").focus();
    $("#ticketsubmit").prop("disabled",true);
}

// customerchk

// estqty
var estqty = $("#estqty").val();
if(estqty == "")
{
    $("#estqty").css("border","1px solid red");
    $("#estqty").css("box-shadow","2px 1px 3px 1px rgba(241, 70, 70, 0.979)");
    $("#estqty").focus();
    $("#ticketsubmit").prop("disabled",true);
   // $("#getweightadd").css("border","1px solid red");
   

}
// estqty
// delivery
var delivery = $("#deliveryadd").val();
if(delivery == "")
{
    $("#deliveryadd").css("border","1px solid red");
    $("#deliveryadd").css("box-shadow","2px 1px 3px 1px rgba(241, 70, 70, 0.979)");
   $("#deliveryadd").focus();
   $("#ticketsubmit").prop("disabled",true);
   // $("#getweightadd").css("border","1px solid red");
   

}
// delvery
// trip
var trip = $("#tripno").val();
if(trip == "")
{
    $("#tripno").css("border","1px solid red");
    $("#tripno").css("box-shadow","2px 1px 3px 1px rgba(241, 70, 70, 0.979)");
   $("#tripno").focus();
   $("#ticketsubmit").prop("disabled",true);
   // $("#getweightadd").css("border","1px solid red");
   

}
// delvery
});
// keyup restrction
// vehiclechk
$("#ticketsubmit").keyup(function(){
    //alert('hai');
 var val = $("#vehiclenoadd").val();
 var len = val.length;
 if(len != 8 )
 {
   if(len !=10)
   {
   $(".vehiclealertno").click();
   $("#vehiclenoadd").focus();
   }
   else
 {
   $(".vehicleallcomp").each(function(){
         var allveh = $(this).val();
         if (val == allveh)
         {
          $(".vehiclealertin").click();
   $("#vehiclenoadd").focus();
         }
   });
 }
   
 }
 else
 {
   $(".vehicleallcomp").each(function(){
         var allveh = $(this).val();
         if (val == allveh)
         {
          $(".vehiclealertin").click();
          $("#vehiclenoadd").focus();
         }
   });
 }
//  vehiclechk over

  });
// vehicle chk
$("#ticketsubmit").keyup(function(){
  //alert('hai');
var val = $("#vehiclenoadd").val();
var len = val.length;
if(len != 8 )
{
 if(len !=10)
 {
 $(".vehiclealertno").click();
 $("#vehiclenoadd").focus();
 }
 else
{
 $(".vehicleallcomp").each(function(){
       var allveh = $(this).val();
       if (val == allveh)
       {
        $(".vehiclealertin").click();
 $("#vehiclenoadd").focus();
       }
 });
}
 
}
else
{
 $(".vehicleallcomp").each(function(){
       var allveh = $(this).val();
       if (val == allveh)
       {
        $(".vehiclealertin").click();
        $("#vehiclenoadd").focus();
       }
 });
}
});
// restriction
$("#ticketsubmit").keyup(function()
{
    //alert('hai');
// customerchk
var customer=$("#customeradd").val();
//alert(customer);
if(customer == "")
{
    $("#customeradd").focus();
    $("#ticketsubmit").prop("disabled",true)
}

// customerchk
// vehicle
var vehicle = $("#vehiclenameadd").val();
if(vehicle == "")
{
    $("#vehiclenameadd").css("border","1px solid red");
    $("#vehiclenameadd").css("box-shadow","2px 1px 3px 1px rgba(241, 70, 70, 0.979)");
    $("#vehiclenameadd").focus();
    $("#ticketsubmit").prop("disabled",true)
   // $("#getweightadd").css("border","1px solid red");
   

}
// vehcilename
// weightchk
var weightadd=$("#vehweightadd").val();
//alert(customer);
if(weightadd == "")
{
    $("#vehweightadd").focus();
}

// customerchk
// weightchk
var productadd=$("#productadd").val();
//alert(customer);
if(productadd == "")
{
    $("#productadd").focus();
    $("#ticketsubmit").prop("disabled",true);
}

// customerchk

// estqty
var estqty = $("#estqty").val();
if(estqty == "")
{
    $("#estqty").css("border","1px solid red");
    $("#estqty").css("box-shadow","2px 1px 3px 1px rgba(241, 70, 70, 0.979)");
    $("#estqty").focus();
    $("#ticketsubmit").prop("disabled",true);
   // $("#getweightadd").css("border","1px solid red");
   

}
// estqty
// delivery
var delivery = $("#deliveryadd").val();
if(delivery == "")
{
    $("#deliveryadd").css("border","1px solid red");
    $("#deliveryadd").css("box-shadow","2px 1px 3px 1px rgba(241, 70, 70, 0.979)");
   $("#deliveryadd").focus();
   $("#ticketsubmit").prop("disabled",true);
   // $("#getweightadd").css("border","1px solid red");
   

}
// delvery
// trip
var trip = $("#tripno").val();
if(trip == "")
{
    $("#tripno").css("border","1px solid red");
    $("#tripno").css("box-shadow","2px 1px 3px 1px rgba(241, 70, 70, 0.979)");
   $("#tripno").focus();
   $("#ticketsubmit").prop("disabled",true);
   // $("#getweightadd").css("border","1px solid red");
   

}
// delvery
});
// keyuprestriction
// restriction
// keyup function
$("#vehiclenameadd").keyup(function(){
    $("#vehiclenameadd").css("border","1px solid skyblue");
    $("#vehiclenameadd").css("box-shadow","2px 1px 3px 1px skyblue");
    $("#ticketsubmit").prop("disabled",false)
});
// customer
$("#customeradd").on('change',function(){
    
    $("#ticketsubmit").prop("disabled",false);
});
// customer
// vehclenoadd
$("#vehiclenoadd").keyup(function(){
    
    $("#ticketsubmit").prop("disabled",false);
});
// customer
// customer
$("#vehweightadd").on('change',function(){
    
    $("#ticketsubmit").prop("disabled",false);
});
// customer
// product
$("#productadd").on('change',function(){
    
    $("#ticketsubmit").prop("disabled",false);
});
// product
// estqty
$("#estqty").keyup(function(){
    $("#estqty").css("border","1px solid skyblue");
    $("#estqty").css("box-shadow","2px 1px 3px 1px skyblue");
    $("#ticketsubmit").prop("disabled",false);
});

// estqty
// deliery
$("#deliveryadd").keyup(function(){
    $("#deliveryadd").css("border","1px solid skyblue");
    $("#deliveryadd").css("box-shadow","2px 1px 3px 1px skyblue");
    $("#ticketsubmit").prop("disabled",false);
});

// delivery
// tripno
$("#tripno").keyup(function(){
    $("#tripno").css("border","1px solid skyblue");
    $("#tripno").css("box-shadow","2px 1px 3px 1px skyblue");
    $("#ticketsubmit").prop("disabled",false);
});

// tripno

// keyup
});
// editpage
$(document).ready(function(){
    
$(".ticketupdate").mouseover(function(){
    var oldname=$(this).closest('.editticketfoot').find('.ticketedi').val();

   // alert(oldname);
    //alert('hai');
var remark=$(".remarkupdate"+oldname).val();
//alert(remark);
if(remark == "")
{
    $(".remarkupdate"+oldname).css("border","1px solid red");
    $(".remarkupdate"+oldname).css("box-shadow","2px 1px 3px 1px rgba(241, 70, 70, 0.979)");
    $(".ticketupdate").prop("disabled",true);
}
});
// keyup
$(".ticketupdate").keyup(function(){
    //alert('hai');
    var oldname=$(this).closest('.editticketfoot').find('.ticketedi').val();

    //alert(oldname);
var remark=$(".remarkupdate"+oldname).val();
//alert(remark);
if(remark == "")
{
    $(".remarkupdate"+oldname).css("border","1px solid red");
    $(".remarkupdate"+oldname).css("box-shadow","2px 1px 3px 1px rgba(241, 70, 70, 0.979)");
    $(".ticketupdate"+oldname).prop("disabled",true);
}
});
// keyup
//keyup remark
$(".remarkupdateedi").keyup(function(){
    var oldname=$(this).closest('.editticketfoot').find('.ticketedi').val();

    //alert(oldname);
    $(".remarkupdateedi").css("border","1px solid skyblue");
    $(".remarkupdateedi").css("box-shadow","2px 1px 3px 1px skyblue");
    $(".ticketupdate").prop("disabled",false);
});
// keyuptremark

});
$(document).ready(function(){
    $("#vehiclenochk").keypress(function (e) {
        //alert('hai');
        var keyCode = e.keyCode || e.which;
    
        
    
        //Regex for Valid Characters i.e. Alphabets and Numbers.
        var regex = /^[A-Za-z0-9]+$/;
    
        //Validate TextBox value against the Regex.
        var isValid = regex.test(String.fromCharCode(keyCode));
        if (!isValid) {
            $(".alertalpha").click();
        }
        else 
        {
            //alert('hai');
           var dup= $("#vehiclenochk").value.toUpperCase();
           var ori= $("#vehiclenoadd").val(dup);
        }
        return isValid;
        
    });

    // 

    $("#vehiclenochk").keyup(function() {
        //var dup= $("#vehiclenochk").value.toUpperCase();
           // alert(dup);
           var dup= this.value.toUpperCase();
           var ori= $("#vehiclenoadd").val(dup);
        
        
        
    });
    $("#vehiclenochk").keyup(function(){
        $("#ticketsubmit").prop("disabled",false);
    });
});