<?php
ob_start();
error_reporting(0);
include("connect.php");
session_start(); 
$ver = $_SESSION["admin_id"];
$admin_id = $_SESSION["admin_id"];
$dis_id = $_SESSION["manager_id"];
$user_type = $_SESSION["user_type"];
$user_session = $_SESSION["user_session"];

$id = $_REQUEST["id"];
$id6 = $_REQUEST["id6"];
$id1 = base64_decode($_GET['id']);
$mang_id = base64_decode($_GET['id5']);
if(!isset($_SESSION["admin_id"])){
   header('location:http://www.btcover.appexperts.net');
}
date_default_timezone_set('Asia/Calcutta');
	//$cdate  = date("Y-m-d");
	$cdate = date("m/d/Y");
	$new_policy_no1='TMP_'.time();
	$n=rand(10,99);
	$new_policy_no=$new_policy_no1.'_'.$n;
?>
<!DOCTYPE html>
<html dir="ltr" lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Favicon icon -->
    <link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon.png">
    <title>BTCOVER : Admin Dashboard</title>
    <!-- Custom CSS -->
    <link rel="stylesheet" type="text/css" href="assets/libs/select2/dist/css/select2.min.css">
    <link rel="stylesheet" type="text/css" href="assets/libs/jquery-minicolors/jquery.minicolors.css">
    <link rel="stylesheet" type="text/css" href="assets/libs/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
    <link rel="stylesheet" type="text/css" href="assets/libs/quill/dist/quill.snow.css">
    <link href="dist/css/style.min.css" rel="stylesheet">
		<script type="text/javascript">
window.onload=function WindowLoad(event)
{			
			 document.getElementById('com').style.display="none";	
			 
		
		console.log(admin_id);
	
}
</script>
   <script>
	
		function myFunction() {
			var txt;
		
			var r = confirm("Are you sure to Cancel!");
			if (r == true) {
				window.location.href="customer-policy7.php?id="+<?php echo $id6 ?>;
			} 
		}
		</script>
		<script>
		function getvehicle(str)
		{
			if(str=='new')
			{
				window.location.href="add-vehicle-category.php?id2=addproposal";
				
						 
			}
		
			
		}
		</script>
		<script>
		function addnew(str)
		{
			if(str=='new')
			{
				window.location.href="add-insurance-company.php?id2=addproposal";
				//document.getElementById('com').style.display="block";
			}
			else
			{
				//document.getElementById('com').style.display="none";
				//document.getElementById('com_id').value='';
				var req=new XMLHttpRequest();
			 req.open("POST","https://www.btcover.appexperts.net/get-vehicle.php?id="+str,true);
			 req.send();
			 	
			 req.onreadystatechange=function()
			 {
				
				 if(req.readyState == 4 && req.status == 200)
				 {
					
			 document.getElementById("vehicle_id").innerHTML=req.responseText;
	
			 }
			  }
			}
		}
		</script>
		
		<script>
		function ckeckdate(str)
		{
			var l=str.length;
			if(l==4)
			{
				var d = new Date();
				var n = d.getFullYear();
				if(str>=n)
				alert("year should be less than or equal to Current Year");
			else if(str<='1899')
				alert("enter correct Year");
			}
			else
			{
				alert("Invalid Year");
			}
		}
		</script>
		<script>
		function validate(str)
		{
			
			var t=(str>=0 && str <= 100);
          
            if (!t ) {
                alert("Please enter correct percentage.");
				document.getElementById('cgst').value="";
                document.form.discount.focus();
                return false;
            }
	
		}
	 </script>
		<script>
		function checkphone(str)
		{
			var l=str.length;
			if(l!=10)
			{
				
				alert("Invalid Phone Number");
			}
			
		}
		</script>
		
		<script>
		function checkregistration(str)
		{
		
		var patt = "^[A-Z]{2}[ -][0-9]{1,2}[ -][A-Z0-9]{1,2}[ -][0-9]{4}$";
		var result = patt.test(str);
		alert(result);
		if(!result)
		{
			alert("enter correct registration number");
		}
		}
		</script>
		
		<script>
		function exist(str)
		{
			 document.getElementById('cus_name').style.display="none";	
			 document.getElementById('phone').style.display="none";	
			 document.getElementById('cus_email').style.display="none";	
			 document.getElementById('cus_add').style.display="none";	
			 document.getElementById('cus_id').style.display="block";	
			 
		
		}
		</script>
		<script>
		function new1(str)
		{
			 document.getElementById('cus_name').style.display="block";	
			 document.getElementById('phone').style.display="block";	
			 document.getElementById('cus_email').style.display="block";	
			 document.getElementById('cus_add').style.display="block";	
			 document.getElementById('cus_id').style.display="none";	
		
		}
		
		function ncb(str)
		{
		if(str=='Yes')
			{
				document.getElementById('ncb').style.display="block";	
				
			}
			else
			{
				document.getElementById('ncb').style.display="none";	
			}
		}
		</script>
		
</head>

<body>
    <!-- ============================================================== -->
    <!-- Preloader - style you can find in spinners.css -->
    <!-- ============================================================== -->
  
	 <div id="main-wrapper">
   <?php include("header.php"); ?>
    
     <?php include("menu.php"); ?>
	<?php	
if('policy7'==base64_decode($_GET['id4']))
 {
		
	$name="Policy Renewal Within & days";
	 $url="customer-policy7.php?id=".base64_decode($_GET['id4']);
 }	
elseif('policy10'==base64_decode($_GET['id4']))
{
	$name="policy Renewal B/W 7-10 Days";
	 $url="customer-policy7.php?id=".base64_decode($_GET['id4']);
} 
elseif('policy15'==base64_decode($_GET['id4']))
{
	$name="policy Renewal B/W 10-15 Days";
	 $url="customer-policy7.php?id=".base64_decode($_GET['id4']);
} 
elseif('graced'==base64_decode($_GET['id4']))
{
	$name="Graced Policy Renewal";
	 $url="customer-policy7.php?id=".base64_decode($_GET['id4']);
} 
elseif('missed'==base64_decode($_GET['id4']))
{
	$name="Missed Policy";
	 $url="customer-policy7.php?id=".base64_decode($_GET['id4']);
} 
?>
        <div class="page-wrapper">
            <!-- ============================================================== -->
            <!-- Bread crumb and right sidebar toggle -->
            <!-- ============================================================== -->
            <div class="page-breadcrumb">
                <div class="row">
                    <div class="col-12 d-flex no-block align-items-center">
                        <h4 class="page-title">Add Proposal</h4>
                        <div class="ml-auto text-right">
                            <nav aria-label="breadcrumb">
                                <ol class="breadcrumb">
                                   
                                   <li class="breadcrumb-item"><a href="dashboard.php">Dashboard</a></li>
                                    <li class="breadcrumb-item"><a href="<?php echo $url; ?>"><?php echo $name;?></a></li>
                                   
                                   
									<li class="breadcrumb-item active" aria-current="page">Add Proposal</li>
                                </ol>
                            </nav>
                        </div>
                    </div>
                </div>
            </div>
            <!-- ============================================================== -->
            <!-- End Bread crumb and right sidebar toggle -->
            <!-- ============================================================== -->
            <!-- ============================================================== -->
            <!-- Container fluid  -->
            <!-- ============================================================== -->
            <div class="container-fluid" >
                <!-- ============================================================== -->
                <!-- Start Page Content -->
                <!-- ============================================================== -->
				<div >
                <div class="row" >
			<?php	
			$manager_id = base64_decode($_GET['id5']);
			$admin_id = $_SESSION["admin_id"];
	$policy_number = base64_decode($_GET['id2']);


	$select_policy = mysqli_query($con,"select * from tbl_policy_master where status in ('Active','Renewal Pending') and policy_no='$policy_number'");
	
	$policies=array();
	if(mysqli_num_rows($select_policy)>0)
	{     
		while($fetch_policies=mysqli_fetch_assoc($select_policy))
		{
			$policies['admin_id'] = $fetch_policies['admin_id'];
			$policies['manager_id'] = $fetch_policies['manager_id'];


			
					
			$policies['customer_id']=$fetch_policies['customer_id'];
			$policies['id']=$fetch_policies['id'];
			$policies['policy_no']=$fetch_policies['policy_no'];
			$policies['policy_date']=$fetch_policies['policy_date'];
			$policies['renewal_date']=$fetch_policies['renewal_date'];
			$policies['company_id']=$fetch_policies['company_id'];
			$policies['policy_type']=$fetch_policies['policy_type'];
			$policies['vehicle_id']=$fetch_policies['vehicle_id'];

			

			$policies['make_model']=$fetch_policies['make_model'];
			$policies['idv']=$fetch_policies['idv'];
			$policies['registration_no']=$fetch_policies['registration_no'];
			$policies['engine_no']=$fetch_policies['engine_no'];
			$policies['chassis_no']=$fetch_policies['chassis_no'];
			$policies['manufacturing_year']=$fetch_policies['manufacturing_year'];
			$policies['seating_capacity']=$fetch_policies['seating_capacity'];
			$policies['body_type']=$fetch_policies['body_type'];
			$policies['fuel_type']=$fetch_policies['fuel_type'];
			$policies['hp_cc']=$fetch_policies['hp_cc'];
			$policies['policy_term']=$fetch_policies['policy_term'];
			$policies['term_value']=$fetch_policies['term_value'];
			$policies['NCB']=$fetch_policies['NCB'];
			$policies['NCB_value']=$fetch_policies['NCB_value'];
			$policies['od']=$fetch_policies['od'];
			$policies['od_discount_per']=$fetch_policies['od_discount_per'];
			$policies['od_discount']=$fetch_policies['od_discount'];
			$policies['cover']=$fetch_policies['cover'];
			$policies['pa']=$fetch_policies['pa'];
			$policies['liabilities']=$fetch_policies['liabilities'];
			$policies['passenger_assist']=$fetch_policies['passenger_assist'];
			$policies['depreciation']=$fetch_policies['depreciation'];
			$policies['totalA']=$fetch_policies['totalA'];
			$policies['totalB']=$fetch_policies['totalB'];
			$policies['totalC']=$fetch_policies['totalC'];
			$policies['calculation_param']=$fetch_policies['calculation_param'];
			$policies['net_premium']=$fetch_policies['net_premium'];
			$policies['gst_typeA']=$fetch_policies['gst_typeA'];
			$policies['gst_typeB']=$fetch_policies['gst_typeB'];
			$policies['gst_typeC']=$fetch_policies['gst_typeC'];
			$policies['gst_percentageA']=$fetch_policies['gst_percentageA'];
			$policies['gst_percentageB']=$fetch_policies['gst_percentageB'];
			$policies['gst_percentageC']=$fetch_policies['gst_percentageC'];
			$policies['cGstA']=$fetch_policies['cGstA'];
			$policies['sGstA']=$fetch_policies['sGstA'];
			$policies['iGstA']=$fetch_policies['iGstA'];
			
			$policies['cGstB']=$fetch_policies['cGstB'];
			$policies['sGstB']=$fetch_policies['sGstB'];
			$policies['iGstB']=$fetch_policies['iGstB'];
			
			$policies['cGstC']=$fetch_policies['cGstC'];
			$policies['sGstC']=$fetch_policies['sGstC'];
			$policies['iGstC']=$fetch_policies['iGstC'];
			
			$policies['totalGst']=$fetch_policies['totalGst'];
			$policies['premium_amt']=$fetch_policies['premium_amt'];
			$policies['status']=$fetch_policies['status'];
			$response['policies'][]=$policies;
			$query1 = mysqli_query($con,"SELECT * FROM tbl_insurance_company,tbl_policy_type,tbl_vehicle_master where tbl_insurance_company.company_id='".$fetch_policies['company_id']."' and tbl_policy_type.policy_id = '".$fetch_policies['policy_type']."' and tbl_vehicle_master.vehicle_id = '".$fetch_policies['vehicle_id']."'");
			$fetch_query1=mysqli_fetch_assoc($query1);
					
				
			?>
                    <div class="col-md-12">
                        <div class="card" style="float:left; width:100%; overflow-Y: auto; height: 550px;">
                            <form class="form-horizontal" action="add-policy-proposal.php" method="post" name="form"   enctype="multipart/form-data">
                                <div class="card-body">
                                    <h4 class="card-title">Basic Information</h4>
									
                                   <div class="form-group row">
                                   
                                   <?php     $query = mysqli_query($con,"SELECT * FROM tbl_customer where customer_id='".$fetch_policies['customer_id']."'");
		
				$fetch_query=mysqli_fetch_assoc($query);
					
                             ?>               <input type="hidden" class="form-control" id="customer_id" name="customer_id" value="<?php echo $fetch_policies['customer_id']?>" readonly placeholder="Customer Name" >
											
								<div class="col-md-4" id="cus_name">	
									<div class="form-group ">
                                        <label for="cname" class=" text-left control-label col-form-label"><b>Customer Name</b></label>
                                         <input type="text" class="form-control" id="customer_name" name="customer_name" placeholder="Customer Name" value="<?php echo $fetch_query['customer_name']?>" readonly >
									</div>
                                </div>
								<div class="col-md-4" id="phone">	
									<div class="form-group ">
                                        <label for="pnumber" class=" text-left control-label col-form-label"><b>Customer Phone</b></label>
                                         <input type="text" class="form-control" onkeypress='return event.charCode >= 48 && event.charCode <= 57' minlength="10" maxlength="10" size="10" onchange="checkphone(this.value)" id="phone_no" name="phone_no" placeholder="Customer Phone"  value="<?php echo $fetch_query['phone_no']?>" readonly>
									</div>
                                </div>
								<div class="col-md-4" id="cus_email">	
									<div class="form-group ">
                                        <label for="pnumber" class=" text-left control-label col-form-label"><b>Customer Email</b></label>
                                         <input type="email" class="form-control" id="email" name="email" placeholder="Email" value="<?php echo $fetch_query['email']?>" readonly>
									</div>
                                </div>
								<div class="col-md-4" id="cus_add">	
									<div class="form-group ">
                                        <label for="pnumber" class=" text-left control-label col-form-label"><b>Customer Address</b></label>
                                         <input type="text" class="form-control" id="address" name="address" placeholder="Customer Address" value="<?php echo $fetch_query['address']?>" readonly>
									</div>
                                </div>
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="pnumber" class=" text-left control-label col-form-label"><b>Policy Number</b></label>
                                         <input type="text" class="form-control" id="policy_no" name="policy_no" placeholder="Policy Number" required value="<?php echo $new_policy_no ?>" readonly>
										  <input type="hidden" class="form-control" id="previous_policy" name="previous_policy" placeholder="Policy Number" required value="<?php echo  $fetch_policies['policy_no'] ?>" readonly>
									</div>
                                </div>
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="pnumber" class=" text-left control-label col-form-label"><b>Insurance Company Name</b></label>
                                         <select class="select2 form-control custom-select" style="width: 100%; height:36px;" name="company_id" onchange="addnew(this.value)"  required>
                                            <option value="<?php echo $fetch_policies['company_id']?>" selected="selected"><?=$fetch_query1['company_name']?></option>	
											<?php $query=mysqli_query($con,"select * from tbl_insurance_company where admin_id='$ver' and status='Active'");
													while($agent=mysqli_fetch_assoc($query))
													{?>
													 <option value="<?php echo $agent['company_id']?>"><?=$agent['company_name']?></option>	
														
												<?php	}
												
											?>
                                      <option value="new"><b>Add New Company</b></option>
                                        </select>
									</div>
                                </div>
								<!--<div class="col-md-4" id="com">	
									<div class="form-group ">
                                        <label for="pnumber" class=" text-left control-label col-form-label"><b>New Company Name</b></label>
                                         <input type="text" class="form-control" id="com_id" name="com" placeholder="Company Name" >
									</div>
                                </div>-->
								<div class="col-md-4">	
									<div class="form-group ">
								<?php	$querya = mysqli_query($con,"SELECT tbl_customer_premium.agent_id,tbl_agent.agent_name,tbl_agent.agent_code FROM `tbl_customer_premium`,tbl_agent where tbl_agent.agent_id=tbl_customer_premium.agent_id and tbl_customer_premium.policy_no='$policy_number'");
							$fetch_querya=mysqli_fetch_assoc($querya);
						?>
                                        <label for="fname" class=" text-left control-label col-form-label"><b>Agent Name</b></label>
                                        <select class="select2 form-control custom-select" style="width: 100%; height:36px;" name="agent_id"  required>
                                             <option value="<?php echo $fetch_querya['agent_id']?>" selected><?=$fetch_querya['agent_name'].'-'.$fetch_querya['agent_code']?></option>
											<?php 
												$query=mysqli_query($con,"select * from tbl_agent where manager_id='".$fetch_policies['manager_id']."'");
													while($agent=mysqli_fetch_assoc($query))
													{?>
													 <option value="<?php echo $agent['agent_id']?>"><?=$agent['agent_name'].'-'.$agent['agent_code']?></option>	
														
												<?php	}
											?>
                                      </select>
                                     </div>
                                </div>
								
                                    <input type="hidden" class="form-control"  name="manager_id" placeholder="Manager Name" value="<?php echo $fetch_policies['manager_id']?>" >
								
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="fname" class=" text-left control-label col-form-label"><b>Policy Date</b></label>
                                        <div class="input-group">
                                    <input type="text" class="form-control" id="datepicker-autoclose" name="policy_date" placeholder="mm/dd/yyyy" value="<?php echo $cdate?>" >
									
                                    <div class="input-group-append">
                                        <span class="input-group-text"><i class="fa fa-calendar"></i></span>
                                    </div>
                                </div>
                                     </div>
                                </div>
                               
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="fname" class=" text-left control-label col-form-label"><b>Policy Type</b></label>
                                   
									  <input type="hidden" class="form-control" id="policy_type" name="policy_type" placeholder="Make & Model" required value="<?php echo $fetch_policies['policy_type']?>" readonly>
									    <input type="hidden" class="form-control" id="policy_id" name="policy_id" placeholder="Make & Model" required value="<?php echo $fetch_policies['policy_id']?>" readonly>
										 <input type="hidden" class="form-control" id="previous_policy" name="previous_policy" placeholder="Make & Model" required value="<?php echo $fetch_policies['policy_no']?>" readonly>
										<input type="text" class="form-control" id="policy_name" name="policy_name" placeholder="Make & Model" required value="<?php echo $fetch_query1['policy_name']?>" readonly>
										<input type="hidden" class="form-control" id="unique_id" name="unique_id" placeholder="Make & Model" required value="<?php echo $fetch_policies['unique_id']?>" readonly>
										

                                     </div>
                                </div>
								
								<!--<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="fname" class=" text-left control-label col-form-label"><b>Vehicle Type</b></label>
                                      
									  <input type="hidden" class="form-control" id="vehicle_id" name="vehicle_id" placeholder="Make & Model" required value="<?php //echo $fetch_policies['vehicle_id']?>" readonly>
									    <input type="text" class="form-control" id="vehicl" name="vehicl" placeholder="Make & Model" required value="<?php //echo $fetch_query1['vehicle_type']?>" readonly>
                                     </div>
                                </div>-->
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="fname" class=" text-left control-label col-form-label"><b>Vehicle Type</b></label>
                                       <select class="select2 form-control custom-select" style="width: 100%; height:36px;" name="vehicle_id" id="vehicle_id" onchange="getvehicle(this.value)" required>
                                            <!--<option value='' selected="selected" >Select vehicle Type</option>-->
											<option value="<?php echo $fetch_policies['vehicle_id']?>"><?=$fetch_query1['vehicle_type']?></option>	
											<?php/*  $query=mysqli_query($con,"select * from tbl_vehicle_master where admin_id='$ver' and status='Active'");
													while($agent=mysqli_fetch_assoc($query))
													{?>
													 <option value="<?php echo $agent['vehicle_id']?>"><?=$agent['vehicle_type']?></option>	
														
												<?php	} */
											?>
                                      </select>
                                     </div>
                                </div>
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="pnumber" class=" text-left control-label col-form-label"><b>Make & Model</b></label>
                                         <input type="text" class="form-control" id="make_model" name="make_model" placeholder="Make & Model" required value="<?php echo $fetch_policies['make_model']?>" readonly>
									</div>
                                </div>
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="pnumber" class=" text-left control-label col-form-label"><b>Vehicle Total IDV</b></label>
                                         <input type="text" class="form-control" onkeypress='return event.charCode >= 48 && event.charCode <= 57' id="idv" name="idv" placeholder="Vehicle Total IDV" required value="<?php echo $fetch_policies['idv']?>" readonly>
									</div>
                                </div>
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="pnumber" class=" text-left control-label col-form-label"><b>Registration Number</b></label>
                                         <input type="text" class="form-control" id="reg_no" name="reg_no" pattern="^[A-Z]{2}[ -][0-9]{1,2}[ -][A-Z0-9]{1,2}[ -][0-9]{4}$" placeholder="Registration Number" onchange="checkregistration(this.value)" required value="<?php echo $fetch_policies['registration_no']?>" readonly>
									</div>
                                </div>
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="eng_no" class=" text-left control-label col-form-label"><b>Engine Number</b></label>
                                         <input type="text" class="form-control" id="engine_no" name="engine_no" placeholder="Engine Number" required value="<?php echo $fetch_policies['engine_no']?>" readonly>
									</div>
                                </div>
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="chassis" class=" text-left control-label col-form-label"><b>Chassis Number</b></label>
                                         <input type="text" class="form-control" id="chassis_no" name="chassis_no" placeholder="Chassis Number" required value="<?php echo $fetch_policies['chassis_no']?>" readonly>
									</div>
                                </div>
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="manufacturing" class=" text-left control-label col-form-label"><b>Manufacturing Year</b></label>
                                         <input type="text" class="form-control" id="mfg_year" name="mfg_year" onkeypress='return event.charCode >= 48 && event.charCode <= 57' size="4" maxlength="4" minlength="4" onchange="ckeckdate(this.value)" placeholder="Manufacturing Year" required value="<?php echo $fetch_policies['manufacturing_year']?>" readonly>
									</div>
                                </div>
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="chassis" class=" text-left control-label col-form-label"><b>Seating Capacity</b></label>
                                         <input type="text" class="form-control" onkeypress='return event.charCode >= 48 && event.charCode <= 57' id="seating_cap" name="seating_cap" value="<?php echo $fetch_policies['seating_capacity']?>" readonly placeholder="Seating Capacity" required>
									</div>
                                </div>
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="chassis" class=" text-left control-label col-form-label"><b>Body Type</b></label>
                                         <input type="text" class="form-control" id="body_type" name="body_type" placeholder="Body Type" required value="<?php echo $fetch_policies['body_type']?>" readonly>
									</div>
                                </div>
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="chassis" class=" text-left control-label col-form-label"><b>Fuel Type</b></label>
                                         <input type="text" class="form-control" id="fuel_type" name="fuel_type" placeholder="Fuel Type" required value="<?php echo $fetch_policies['fuel_type']?>" readonly>
									</div>
                                </div>
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="chassis" class=" text-left control-label col-form-label"><b>HP/CC</b></label>
                                         <input type="text" class="form-control" onkeypress='return event.charCode >= 48 && event.charCode <= 57' id="body_type" name="hp" placeholder="Body Type" required value="<?php echo $fetch_policies['hp_cc']?>" readonly>
									</div>
                                </div>
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="chassis" class=" text-left control-label col-form-label"><b>Policy Term</b></label>
                                         <input type="text" class="form-control" onkeypress='return event.charCode >= 48 && event.charCode <= 57' id="policy_term" name="policy_term" value="<?php echo $fetch_policies['policy_term']?>"  placeholder="Policy Term" required>
									</div>
                                </div>
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="chassis" class=" text-left control-label col-form-label"><b>Term Value</b></label>
                                     
										
										 <select class="select2 form-control custom-select" style="width: 100%; height:36px;" name="term_value"  required>
                                            <option value="<?php echo $fetch_policies['term_value']?>" selected="selected" ><?php echo $fetch_policies['term_value']?></option>
											<option value="Month">Month</option>	
											<option value="Year">Year</option>	
										</select>
									</div>
                                </div>
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="chassis" class=" text-left control-label col-form-label"><b>No Claim Bonus</b></label>
                                     
											
											  <select class="select2 form-control custom-select" style="width: 100%; height:36px;" name="NCB" onchange="ncb(this.value)" required>
                                            <option value="<?php echo $fetch_policies['NCB']?>" selected><?php echo $fetch_policies['NCB']?></option>	
                                            <option value="Yes">Yes</option>	
											<option value="No">No</option>	
										</select>
									</div>
                                </div>
								<?php if($fetch_policies['NCB']=='Yes' ) { ?>
								<div class="col-md-4" id="ncb">	
									<div class="form-group ">
                                        <label for="chassis" class=" text-left control-label col-form-label"><b>NCB Value</b></label>
                                         <input type="text" class="form-control" onkeypress='return event.charCode >= 48 && event.charCode <= 57' id="NCB_value" value="<?php echo $fetch_policies['NCB_value']?>"  name="NCB_value" placeholder="NCB Value" >
									</div>
                                </div>
								<?php } ?>
                                </div>
								 <h4 class="card-title">Section A(Own Damage)</h4>
                                   <div class="form-group row">
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="chassis" class=" text-left control-label col-form-label"><b>Basic OD</b></label>
                                         <input type="text" class="form-control" onkeypress='return event.charCode >= 48 && event.charCode <= 57' id="policy_term" name="od" placeholder="Basic OD" required>
									</div>
                                </div>
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="chassis" class=" text-left control-label col-form-label"><b>OD Discount</b></label>
                                         <input type="text" class="form-control" id="discount" onkeypress="validate(this.value)" onkeyup="validate(this.value)" name="discount" placeholder="OD Discount" required>
									</div>
                                </div>
                                </div>
								 <h4 class="card-title">Section B(Liability)</h4>
                                   <div class="form-group row">
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="number" class=" text-left control-label col-form-label"><b>Basic Cover Third Party</b></label>
                                         <input type="text" class="form-control" onkeypress='return event.charCode >= 48 && event.charCode <= 57' id="cover" name="cover" placeholder="Basic Cover Third Party" required>
									</div>
                                </div>
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="chassis" class=" text-left control-label col-form-label"><b>PA To Owner Driver</b></label>
                                         <input type="text" class="form-control" onkeypress='return event.charCode >= 48 && event.charCode <= 57' id="pa" name="pa" placeholder="PA To Owner Driver" required>
									</div>
                                </div>
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="chassis" class=" text-left control-label col-form-label"><b>Legal Liability To Paid Driver</b></label>
                                         <input type="text" class="form-control" onkeypress='return event.charCode >= 48 && event.charCode <= 57' id="liabilities" name="liabilities" placeholder="Legal Liability To Paid Driver" required>
									</div>
                                </div>
                                </div>
								<h4 class="card-title">Section C(Add On Covers)</h4>
                                   <div class="form-group row">
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="chassis" class=" text-left control-label col-form-label"><b>Passenger Assist</b></label>
                                         <input type="text" class="form-control" onkeypress='return event.charCode >= 48 && event.charCode <= 57' id="passenger_assist" name="passenger_assist" placeholder="Passenger Assist" required>
									</div>
                                </div>
								<div class="col-md-4">	
									<div class="form-group ">
                                        <label for="chassis" class=" text-left control-label col-form-label"><b>Depreciation Cover</b></label>
                                         <input type="text" class="form-control" onkeypress='return event.charCode >= 48 && event.charCode <= 57' id="depreciation" name="depreciation" placeholder="Depreciation Cover" required>
									</div>
                                </div>
                                </div>
								 </div> 
								<div class="form-group row">
                                 <div class="col-md-4">   
                                <div class="border-top">
                                    <div class="card-body">
                                       <div class="card-body">
                                    <button type="submit" name="sub" class="btn btn-success">Next</button>
                                    <button type="button" onclick="myFunction()" name="subcancel" class="btn btn-primary">Cancel</button>
                                    
                                </div>
                                    </div>
                                </div>
                                </div>
                                </div>
								<?php 
								}}
								?>
                            </form>
			
							
							
                        </div>
                    
          

                    </div>
              
                </div>
                <!-- editor -->
               
                <!-- ============================================================== -->
                <!-- End PAge Content -->
                <!-- ============================================================== -->
                <!-- ============================================================== -->
                <!-- Right sidebar -->
                <!-- ============================================================== -->
                <!-- .right-sidebar -->
                <!-- ============================================================== -->
                <!-- End Right sidebar -->
                <!-- ============================================================== -->
            </div>
            </div>
            </div>
            <!-- ============================================================== -->
            <!-- End Container fluid  -->
            <!-- ============================================================== -->
            <!-- ============================================================== -->
            <!-- footer -->
            <!-- ============================================================== -->
             <footer class="footer text-center">
                  2019 &copy; All Rights Reserved by BTCOVER. Designed and Developed by <a href="http://www.belltechnology.in/">Bell Technology</a>.
            </footer>
          
            <!-- ============================================================== -->
            <!-- End footer -->
            <!-- ============================================================== -->
        </div>
        <!-- ============================================================== -->
        <!-- End Page wrapper  -->
        <!-- ============================================================== -->
    </div>
    <!-- ============================================================== -->
    <!-- End Wrapper -->
    <!-- ============================================================== -->
    <!-- ============================================================== -->
    <!-- All Jquery -->
    <!-- ============================================================== -->
    <script src="assets/libs/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap tether Core JavaScript -->
    <script src="assets/libs/popper.js/dist/umd/popper.min.js"></script>
    <script src="assets/libs/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- slimscrollbar scrollbar JavaScript -->
    <script src="assets/libs/perfect-scrollbar/dist/perfect-scrollbar.jquery.min.js"></script>
    <script src="assets/extra-libs/sparkline/sparkline.js"></script>
    <!--Wave Effects -->
    <script src="dist/js/waves.js"></script>
    <!--Menu sidebar -->
    <script src="dist/js/sidebarmenu.js"></script>
    <!--Custom JavaScript -->
    <script src="dist/js/custom.min.js"></script>
    <!-- This Page JS -->
    <script src="assets/libs/inputmask/dist/min/jquery.inputmask.bundle.min.js"></script>
    <script src="dist/js/pages/mask/mask.init.js"></script>
    <script src="assets/libs/select2/dist/js/select2.full.min.js"></script>
    <script src="assets/libs/select2/dist/js/select2.min.js"></script>
    <script src="assets/libs/jquery-asColor/dist/jquery-asColor.min.js"></script>
    <script src="assets/libs/jquery-asGradient/dist/jquery-asGradient.js"></script>
    <script src="assets/libs/jquery-asColorPicker/dist/jquery-asColorPicker.min.js"></script>
    <script src="assets/libs/jquery-minicolors/jquery.minicolors.min.js"></script>
    <script src="assets/libs/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>
    <script src="assets/libs/quill/dist/quill.min.js"></script>
    <script>
        //***********************************//
        // For select 2
        //***********************************//
        $(".select2").select2();

        /*colorpicker*/
        $('.demo').each(function() {
        //
        // Dear reader, it's actually very easy to initialize MiniColors. For example:
        //
        //  $(selector).minicolors();
        //
        // The way I've done it below is just for the demo, so don't get confused
        // by it. Also, data- attributes aren't supported at this time...they're
        // only used for this demo.
        //
        $(this).minicolors({
                control: $(this).attr('data-control') || 'hue',
                position: $(this).attr('data-position') || 'bottom left',

                change: function(value, opacity) {
                    if (!value) return;
                    if (opacity) value += ', ' + opacity;
                    if (typeof console === 'object') {
                        console.log(value);
                    }
                },
                theme: 'bootstrap'
            });

        });
        /*datwpicker*/
        jQuery('.mydatepicker').datepicker();
        jQuery('#datepicker-autoclose').datepicker({
            autoclose: true,
            todayHighlight: true
        });
        var quill = new Quill('#editor', {
            theme: 'snow'
        });

    </script>
</body>

</html>