fleetvu/vexpense/assets/js/seek_truck.js
2017-06-22 16:11:47 +05:30

1011 lines
30 KiB
JavaScript

function showRequirement(id)
{
$(".requirement").hide();
if(id==1)
{
$("#local").show();
$("#showToInterCity").show();
}
if(id==2)
{
$("#outstation").show();
$("#showToInterCity").show();
}
if(id==3)
{
$("#local").show();
$("#showToInterCity").hide();
}
//$("#"+id).show();
}
function showAdvanceSearch()
{
$("#basicSearch").hide();
$("#showAdvanceSearch").show();
}
function showFromInterCity(stateid)
{
$("#showFromInterCity").load("seekTruckAjaxAction.php?action=showFromInterCity&stateid="+stateid);
$("#showToInterCity").load("seekTruckAjaxAction.php?action=showToInterCity&stateid="+stateid);
}
function showFromInterAreas(cityid)
{
$("#showFromInterAreas").load("seekTruckAjaxAction.php?action=showFromInterAreas&cityid="+cityid);
}
function showFromInterPincode(areaid)
{
$("#showFromInterPincode").load("seekTruckAjaxAction.php?action=showFromInterPincode&areaid="+areaid);
}
function showToInterAreas(cityid)
{
$("#showToInterAreas").load("seekTruckAjaxAction.php?action=showToInterAreas&cityid="+cityid);
}
function showToInterPincode(areaid)
{
$("#showToInterPincode").load("seekTruckAjaxAction.php?action=showToInterPincode&areaid="+areaid);
}
function showFromIntraCity(stateid)
{
$("#showFromIntraCity").load("seekTruckAjaxAction.php?action=showFromIntraCity&stateid="+stateid);
}
function showFromIntraAreas(cityid)
{
$("#showFromIntraAreas").load("seekTruckAjaxAction.php?action=showFromIntraAreas&cityid="+cityid);
}
function showFromIntraPincode(areaid)
{
$("#showFromIntraPincode").load("seekTruckAjaxAction.php?action=showFromIntraPincode&areaid="+areaid);
}
function showToIntraCity(stateid)
{
$("#showToIntraCity").load("seekTruckAjaxAction.php?action=showToIntraCity&stateid="+stateid);
}
function showToIntraAreas(cityid)
{
$("#showToIntraAreas").load("seekTruckAjaxAction.php?action=showToIntraAreas&cityid="+cityid);
}
function showToIntraPincode(areaid)
{
$("#showToIntraPincode").load("seekTruckAjaxAction.php?action=showToIntraPincode&areaid="+areaid);
}
function validateClickSeekTruckForm()
{
var trucktype=$("#trucktype").val();
var dos=$("#dos").val();
if(trucktype=="")
{
alert("Please select the truck type");
$("#trucktype").focus();
return false;
}
if(dos=="")
{
alert("Please select the date of service");
$("#dos").focus();
return false;
}
if(trucktype!="" && dos!="")
{
$.fancybox({
'autoScale': true,
'transitionIn': 'fade',
'transitionOut': 'fade',
'type': 'ajax',
'href': 'login.php?action=seektruck&trucktype='+trucktype+"&truckdos="+dos
});
}
}
function postload()
{
$.post("ajaxFile.php",{"action":"postloadsession"},function(data)
{
$.fancybox({
'autoScale': true,
'transitionIn': 'fade',
'transitionOut': 'fade',
'type': 'ajax',
'href': 'login.php'
});
//alert(data);
});
//$("#postloadbutton").hide();
//$("#loginregister").show();
}
function showMaterialSpecification(materialid)
{
$("#showMaterialSpecification").load("seekTruckAjaxAction.php?action=showMaterialSpecification&materialid="+materialid);
}
function addmore(i,materialid)
{
$(".more").remove();
$.post("ajaxFile.php",{"materialid":materialid,"id":i,"action":"addmore"},function(data)
{
//alert(data);
$("#showMaterialSpecification").append(data);
});
}
function showRequirementFields()
{
var rows = document.getElementsByName('reqbasis[]');
var reqbasis = [];
for(var i = 0, l = rows.length; i < l; i++)
{
if(rows[i].checked)
{
reqbasis.push(rows[i].value);
}
}
$("#showRequirementFields").load("seekTruckAjaxAction.php?action=showRequirementFields&reqbasis="+reqbasis);
}
function showTransportOffered(transporttype)
{
$(".showTransportOffered").hide();
$("#showTransportOffered"+transporttype).show();
}
function showSpecification(vehicletypeid)
{
$("#showSpecification").load("seekTruckAjaxAction.php?action=showSpecification&vehicletypeid="+vehicletypeid);
}
function showMovement(trucktype)
{
$("#showMovement").load("seekTruckAjaxAction.php?action=showMovement&trucktype="+trucktype);
}
function showTrucktype(type)
{
if(type=="ftl")
{
$("#showTrucktype").show();
$("#showIBAreg").show();
$("#showPickup").hide();
$("#showDelivery").hide();
}
else
{
$("#showTrucktype").hide();
$("#showIBAreg").hide();
$("#showPickup").show();
$("#showDelivery").show();
}
}
function showDate(date)
{
if(date=="Required")
{
$("#showDate").show();
}
else
{
$("#showDate").hide();
}
}
function validateSeekTruck()
{
var loadtype="";
var trucktype=$("#trucktype").val();
var pickupoption=$("#pickupoption").val();
var deliveryoption=$("#deliveryoption").val();
var materialtype=$("#materialtype").val();
var natureofmaterial=$("#natureofmaterial").val();
var operationtype="";
var operationtype=$("#operationtype").val();
var frominterstate=$("#frominterstate").val();
var fromintercity=$("#fromintercity").val();
var tointercity=$("#tointercity").val();
var tointerarea=$("#tointerarea").val();
var tointerpincode=$("#tointerpincode").val();
var fromintrastate=$("#fromintrastate").val();
var fromintracity=$("#fromintracity").val();
var tointrastate=$("#tointrastate").val();
var tointracity=$("#tointracity").val();
var dos=$("#dos").val();
var servicetime=$("#servicetime").val();
if($("#loadtype1").prop("checked")==false && $("#loadtype2").prop("checked")==false)
{
alert("Please Select Load Type");
$("#loadtype").focus();
return false;
}
else
{
if($("#loadtype1").prop("checked")==true)
{
if(trucktype=="")
{
alert("Please select the truck type");
$("#trucktype").focus();
return false;
}
if(materialtype=="")
{
alert("Please select the material type");
$("#materialtype").focus();
return false;
}
if(natureofmaterial=="")
{
alert("Please select the special cargo");
$("#natureofmaterial").focus();
return false;
}
if(dos=="")
{
alert("Please select the date of service");
$("#dos").focus();
return false;
}
if(servicetime=="")
{
alert("Please enter the service time");
$("#servicetime").focus();
return false;
}
if(operationtype=="")
{
alert("Please select movement type");
$("#operationtype").focus();
return false;
}
else if(operationtype==1)
{
if(frominterstate=="")
{
alert("Please select the state");
$("#frominterstate").focus();
return false;
}
if(fromintercity=="")
{
alert("Please select the city");
$("#fromintercity").focus();
return false;
}
if(tointercity=="")
{
alert("Please select the city");
$("#tointercity").focus();
return false;
}
}
else if(operationtype==2)
{
if(fromintrastate=="")
{
alert("Please select the state");
$("#fromintrastate").focus();
return false;
}
if(fromintracity=="")
{
alert("Please select the city");
$("#fromintracity").focus();
return false;
}
if(tointrastate=="")
{
alert("Please select the state");
$("#tointrastate").focus();
return false;
}
if(tointracity=="")
{
alert("Please select the city");
$("#tointracity").focus();
return false;
}
}
else if(operationtype==3)
{
if(frominterstate=="")
{
alert("Please select the state");
$("#frominterstate").focus();
return false;
}
if(fromintercity=="")
{
alert("Please select the city");
$("#fromintercity").focus();
return false;
}
if(tointerarea=="")
{
alert("Please select the area");
$("#tointerarea").focus();
return false;
}
if(tointerpincode=="")
{
alert("Please select the pincode");
$("#tointerpincode").focus();
return false;
}
}
}
if($("#loadtype2").prop("checked")==true)
{
if(pickupoption=="")
{
alert("Please select pickup option");
$("#pickupoption").focus();
return false;
}
if(deliveryoption=="")
{
alert("Please select delivery option");
$("#deliveryoption").focus();
return false;
}
if(materialtype=="")
{
alert("Please select the material type");
$("#materialtype").focus();
return false;
}
if(natureofmaterial=="")
{
alert("Please select the special cargo");
$("#natureofmaterial").focus();
return false;
}
if(dos=="")
{
alert("Please select the date of service");
$("#dos").focus();
return false;
}
if(servicetime=="")
{
alert("Please enter the service time");
$("#servicetime").focus();
return false;
}
if(operationtype=="")
{
alert("Please select movement type");
$("#operationtype").focus();
return false;
}
else if(operationtype==1)
{
if(frominterstate=="")
{
alert("Please select the state");
$("#frominterstate").focus();
return false;
}
if(fromintercity=="")
{
alert("Please select the city");
$("#fromintercity").focus();
return false;
}
if(tointercity=="")
{
alert("Please select the city");
$("#tointercity").focus();
return false;
}
}
else if(operationtype==2)
{
if(fromintrastate=="")
{
alert("Please select the state");
$("#fromintrastate").focus();
return false;
}
if(fromintracity=="")
{
alert("Please select the city");
$("#fromintracity").focus();
return false;
}
if(tointrastate=="")
{
alert("Please select the state");
$("#tointrastate").focus();
return false;
}
if(tointracity=="")
{
alert("Please select the city");
$("#tointracity").focus();
return false;
}
}
else if(operationtype==3)
{
if(frominterstate=="")
{
alert("Please select the state");
$("#frominterstate").focus();
return false;
}
if(fromintercity=="")
{
alert("Please select the city");
$("#fromintercity").focus();
return false;
}
if(tointerarea=="")
{
alert("Please select the area");
$("#tointerarea").focus();
return false;
}
if(tointerpincode=="")
{
alert("Please select the pincode");
$("#tointerpincode").focus();
return false;
}
}
}
}
}
function validateSeekTruckAdvanced()
{
var loadtype="";
var trucktype=$("#trucktype").val();
var pickupoption=$("#pickupoption").val();
var deliveryoption=$("#deliveryoption").val();
var materialtype=$("#materialtype").val();
var natureofmaterial=$("#natureofmaterial").val();
var operationtype="";
var operationtype=$("#operationtype").val();
var frominterstate=$("#frominterstate").val();
var fromintercity=$("#fromintercity").val();
var tointercity=$("#tointercity").val();
var tointerarea=$("#tointerarea").val();
var tointerpincode=$("#tointerpincode").val();
var fromintrastate=$("#fromintrastate").val();
var fromintracity=$("#fromintracity").val();
var tointrastate=$("#tointrastate").val();
var tointracity=$("#tointracity").val();
var dos=$("#dos").val();
var servicetime=$("#servicetime").val();
var agree=$("#agree").val();
if($("#loadtype1").prop("checked")==false && $("#loadtype2").prop("checked")==false)
{
alert("Please Select Load Type");
$("#loadtype").focus();
return false;
}
else
{
if($("#loadtype1").prop("checked")==true)
{
if(trucktype=="")
{
alert("Please select the truck type");
$("#trucktype").focus();
return false;
}
if(materialtype=="")
{
alert("Please select the material type");
$("#materialtype").focus();
return false;
}
if(natureofmaterial=="")
{
alert("Please select the special cargo");
$("#natureofmaterial").focus();
return false;
}
if(dos=="")
{
alert("Please select the date of service");
$("#dos").focus();
return false;
}
if(servicetime=="")
{
alert("Please enter the service time");
$("#servicetime").focus();
return false;
}
if(operationtype=="")
{
alert("Please select movement type");
$("#operationtype").focus();
return false;
}
else if(operationtype==1)
{
if(frominterstate=="")
{
alert("Please select the state");
$("#frominterstate").focus();
return false;
}
if(fromintercity=="")
{
alert("Please select the city");
$("#fromintercity").focus();
return false;
}
if(tointercity=="")
{
alert("Please select the city");
$("#tointercity").focus();
return false;
}
}
else if(operationtype==2)
{
if(fromintrastate=="")
{
alert("Please select the state");
$("#fromintrastate").focus();
return false;
}
if(fromintracity=="")
{
alert("Please select the city");
$("#fromintracity").focus();
return false;
}
if(tointrastate=="")
{
alert("Please select the state");
$("#tointrastate").focus();
return false;
}
if(tointracity=="")
{
alert("Please select the city");
$("#tointracity").focus();
return false;
}
}
else if(operationtype==3)
{
if(frominterstate=="")
{
alert("Please select the state");
$("#frominterstate").focus();
return false;
}
if(fromintercity=="")
{
alert("Please select the city");
$("#fromintercity").focus();
return false;
}
if(tointerarea=="")
{
alert("Please select the area");
$("#tointerarea").focus();
return false;
}
if(tointerpincode=="")
{
alert("Please select the pincode");
$("#tointerpincode").focus();
return false;
}
}
}
if($("#loadtype2").prop("checked")==true)
{
if(pickupoption=="")
{
alert("Please select pickup option");
$("#pickupoption").focus();
return false;
}
if(deliveryoption=="")
{
alert("Please select delivery option");
$("#deliveryoption").focus();
return false;
}
if(materialtype=="")
{
alert("Please select the material type");
$("#materialtype").focus();
return false;
}
if(natureofmaterial=="")
{
alert("Please select the special cargo");
$("#natureofmaterial").focus();
return false;
}
if(dos=="")
{
alert("Please select the date of service");
$("#dos").focus();
return false;
}
if(servicetime=="")
{
alert("Please enter the service time");
$("#servicetime").focus();
return false;
}
if(operationtype=="")
{
alert("Please select movement type");
$("#operationtype").focus();
return false;
}
else if(operationtype==1)
{
if(frominterstate=="")
{
alert("Please select the state");
$("#frominterstate").focus();
return false;
}
if(fromintercity=="")
{
alert("Please select the city");
$("#fromintercity").focus();
return false;
}
if(tointercity=="")
{
alert("Please select the city");
$("#tointercity").focus();
return false;
}
}
else if(operationtype==2)
{
if(fromintrastate=="")
{
alert("Please select the state");
$("#fromintrastate").focus();
return false;
}
if(fromintracity=="")
{
alert("Please select the city");
$("#fromintracity").focus();
return false;
}
if(tointrastate=="")
{
alert("Please select the state");
$("#tointrastate").focus();
return false;
}
if(tointracity=="")
{
alert("Please select the city");
$("#tointracity").focus();
return false;
}
}
else if(operationtype==3)
{
if(frominterstate=="")
{
alert("Please select the state");
$("#frominterstate").focus();
return false;
}
if(fromintercity=="")
{
alert("Please select the city");
$("#fromintercity").focus();
return false;
}
if(tointerarea=="")
{
alert("Please select the area");
$("#tointerarea").focus();
return false;
}
if(tointerpincode=="")
{
alert("Please select the pincode");
$("#tointerpincode").focus();
return false;
}
}
}
}
if($("#agree").prop("checked")==false)
{
alert("Please agree the terms and conditions");
return false;
}
}
function postloadbutton()
{
var loadtype="";
var trucktype=$("#trucktype").val();
var pickupoption=$("#pickupoption").val();
var deliveryoption=$("#deliveryoption").val();
var materialtype=$("#materialtype").val();
var natureofmaterial=$("#natureofmaterial").val();
var operationtype="";
var operationtype=$("#operationtype").val();
var frominterstate=$("#frominterstate").val();
var fromintercity=$("#fromintercity").val();
var tointercity=$("#tointercity").val();
var tointerarea=$("#tointerarea").val();
var tointerpincode=$("#tointerpincode").val();
var fromintrastate=$("#fromintrastate").val();
var fromintracity=$("#fromintracity").val();
var tointrastate=$("#tointrastate").val();
var tointracity=$("#tointracity").val();
var dos=$("#dos").val();
var servicetime=$("#servicetime").val();
if($("#loadtype1").prop("checked")==false && $("#loadtype2").prop("checked")==false)
{
alert("Please Select Load Type");
$("#loadtype").focus();
return false;
}
else
{
if($("#loadtype1").prop("checked")==true)
{
if(trucktype=="")
{
alert("Please select the truck type");
$("#trucktype").focus();
return false;
}
if(materialtype=="")
{
alert("Please select the material type");
$("#materialtype").focus();
return false;
}
if(natureofmaterial=="")
{
alert("Please select the special cargo");
$("#natureofmaterial").focus();
return false;
}
if(dos=="")
{
alert("Please select the date of service");
$("#dos").focus();
return false;
}
if(operationtype=="")
{
alert("Please select movement type");
$("#operationtype").focus();
return false;
}
else if(operationtype==1)
{
if(frominterstate=="")
{
alert("Please select the state");
$("#frominterstate").focus();
return false;
}
if(fromintercity=="")
{
alert("Please select the city");
$("#fromintercity").focus();
return false;
}
if(tointercity=="")
{
alert("Please select the city");
$("#tointercity").focus();
return false;
}
}
else if(operationtype==2)
{
if(fromintrastate=="")
{
alert("Please select the state");
$("#fromintrastate").focus();
return false;
}
if(fromintracity=="")
{
alert("Please select the city");
$("#fromintracity").focus();
return false;
}
if(tointrastate=="")
{
alert("Please select the state");
$("#tointrastate").focus();
return false;
}
if(tointracity=="")
{
alert("Please select the city");
$("#tointracity").focus();
return false;
}
}
else if(operationtype==3)
{
if(frominterstate=="")
{
alert("Please select the state");
$("#frominterstate").focus();
return false;
}
if(fromintercity=="")
{
alert("Please select the city");
$("#fromintercity").focus();
return false;
}
if(tointerarea=="")
{
alert("Please select the area");
$("#tointerarea").focus();
return false;
}
if(tointerpincode=="")
{
alert("Please select the pincode");
$("#tointerpincode").focus();
return false;
}
}
if(servicetime=="")
{
alert("Please enter the service time");
$("#servicetime").focus();
return false;
}
else
{
$("#postloadbutton").hide();
$("#loginregister").show();
}
}
if($("#loadtype2").prop("checked")==true)
{
if(pickupoption=="")
{
alert("Please select pickup option");
$("#pickupoption").focus();
return false;
}
if(deliveryoption=="")
{
alert("Please select delivery option");
$("#deliveryoption").focus();
return false;
}
if(materialtype=="")
{
alert("Please select the material type");
$("#materialtype").focus();
return false;
}
if(natureofmaterial=="")
{
alert("Please select the special cargo");
$("#natureofmaterial").focus();
return false;
}
if(dos=="")
{
alert("Please select the date of service");
$("#dos").focus();
return false;
}
if(operationtype=="")
{
alert("Please select movement type");
$("#operationtype").focus();
return false;
}
else if(operationtype==1)
{
if(frominterstate=="")
{
alert("Please select the state");
$("#frominterstate").focus();
return false;
}
if(fromintercity=="")
{
alert("Please select the city");
$("#fromintercity").focus();
return false;
}
if(tointercity=="")
{
alert("Please select the city");
$("#tointercity").focus();
return false;
}
}
else if(operationtype==2)
{
if(fromintrastate=="")
{
alert("Please select the state");
$("#fromintrastate").focus();
return false;
}
if(fromintracity=="")
{
alert("Please select the city");
$("#fromintracity").focus();
return false;
}
if(tointrastate=="")
{
alert("Please select the state");
$("#tointrastate").focus();
return false;
}
if(tointracity=="")
{
alert("Please select the city");
$("#tointracity").focus();
return false;
}
}
else if(operationtype==3)
{
if(frominterstate=="")
{
alert("Please select the state");
$("#frominterstate").focus();
return false;
}
if(fromintercity=="")
{
alert("Please select the city");
$("#fromintercity").focus();
return false;
}
if(tointerarea=="")
{
alert("Please select the area");
$("#tointerarea").focus();
return false;
}
if(tointerpincode=="")
{
alert("Please select the pincode");
$("#tointerpincode").focus();
return false;
}
}
if(servicetime=="")
{
alert("Please enter the service time");
$("#servicetime").focus();
return false;
}
else
{
$("#postloadbutton").hide();
$("#loginregister").show();
}
}
}
}