@extends('backend.header')
@section('index-content')
<?php
function convertToUnicodeNumber($input) {
    
    $standard_numsets = array("0","1","2","3","4","5","6","7","8","9");
    $devanagari_numsets = array("०","१","२","३","४","५","६","७","८","९");
    
    return str_replace($standard_numsets, $devanagari_numsets, $input);
  }
?>
				<section role="main" class="content-body">
					<header class="page-header">
						<h2> Survey Form</h2>
					
						<div class="right-wrapper pull-right">
							<ol class="breadcrumbs">
								<li>
									<a href="/">
										<i class="fa fa-home"></i>
									</a>
								</li>
								<li><span>Form</span></li>
								<li><span> Survey</span></li>
							</ol>
					
							<a class="sidebar-right-toggle" data-open="sidebar-right"><i class="fa fa-chevron-left"></i></a>
						</div>
					</header>

					<!-- start: page -->
					<div class="row">
						<div class="col-md-12">
							<form id="form" action="{{route('survey_info.store')}}" class="form-horizontal" method="post" enctype="multipart/form-data">
							@csrf
								<section class="panel">
									<header class="panel-heading">
										<div class="panel-actions">
											<a href="#" class="fa fa-caret-down"></a>
											<a href="#" class="fa fa-times"></a>
										</div>

										<h2 class="panel-title"> Survey Form</h2>
										<!--<p class="panel-subtitle">
											Basic validation will display a label with the error after the form control.
										</p>-->
									</header>
									<div class="panel-body">
									<div class="form-group">
											<label class="col-sm-3 control-label">S.No
											<span class="required">*</span>
											</label>
											<div class="col-sm-9">
												<input type="text" name="s_no" class="form-control" required>
												@error('s_no')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
											
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">District Name
											<span class="required">*</span></label>
											<div class="col-sm-9">
												<select name="district_name" class="form-control" id="jilla_id" required>
												<option value="">District Name</option>
												@foreach($jilla as $ai)
												<option value="{{$ai->id}}">{{$ai->area_name}}</option>
												
												@endforeach
												</select>
													
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">Mandal Name
											<span class="required">*</span></label>
											<div class="col-sm-9">
												<select name="mandal_name" class="form-control" id="taluka" required>
												<option value="">Mandal Name</option>
												</select>
												@error('taluka_name')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">Panchayat Name
											<span class="required">*</span></label>
											<div class="col-sm-9">
												<select name="panchayat_name" class="form-control" id="gram_id" required>
												<option value="">Panchayat Name</option>
												</select>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">Location/Landmark
											<span class="required">*</span>
											</label>
											<div class="col-sm-9">
												<input type="text" name="location" class="form-control" required>
												@error('location')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
											
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">Pole Number
											<span class="required">*</span></label>
											<div class="col-sm-9">
												<input type="text" name="pole_num" class="form-control" required>
												@error('pole_num')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
											
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">Road Width in mtrs
											<span class="required">*</span></label>
											<div class="col-sm-9">
												<input type="text" name="road_width" class="form-control" required >
												@error('road_width')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
											
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">Road configuration as per NLC
											<span class="required">*</span></label>
											<div class="col-sm-9">
												<input type="text" name="road_confi" class="form-control" required >
												@error('road_confi')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
											
										</div>
										<center><label class="col-md-12" for="">Mounting arrangement of Poles: [ Type of Pole || Pole arrangement ]</label></center>
										<div class="form-group">
											<label class="col-sm-3 control-label">Switch point No/ Type of switch point (3-Ph/1-Ph)
											<span class="required">*</span></label>
											</label>
											<div class="col-sm-9">
												<input type="text" name="switch_point" class="form-control" >
												@error('survey_name')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
											
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">Concrete/ Iron
											<span class="required">*</span>
											</label>
											<div class="col-sm-9">
												<input type="text" name="pole_type" class="form-control" required>
												@error('pole_type')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
											
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">Others (Wall mount, Wooden, etc)
											<span class="required">*</span>
											</label>
											<div class="col-sm-9">
												<input type="text" name="pole_other" class="form-control" required>
												@error('pole_other')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
											
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">One Sided/ Central
											<span class="required">*</span></label>
											</label>
											<div class="col-sm-9">
												<input type="text" name="pole_side" class="form-control" required>
												@error('pole_side')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
											
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">Height of the pole (mtrs.)
											<span class="required">*</span></label>
											</label>
											<div class="col-sm-9">
												<input type="text" name="pole_height" class="form-control" required>
												@error('pole_height')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
											
										</div>
										
										<div class="form-group">
											<label class="col-sm-3 control-label">Pole spacing (mtrs.)
											<span class="required">*</span></label>
											</label>
											<div class="col-sm-9">
												<input type="text" name="pole_spacing" class="form-control" required>
												@error('pole_spacing')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
											
										</div>
										<center><label class="col-md-12" for="">Existing:</label></center>
										<div class="form-group">
											<label class="col-sm-3 control-label"> Types of fixtures
											<span class="required">*</span></label>
											<div class="col-sm-9">
												<input type="text" name="type_of_fixtures" class="form-control" required>
												@error('type_of_fixtures')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
											
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">Fixture Wattage (W)
											<span class="required">*</span></label>
											</label>
											<div class="col-sm-9">
												<input type="text" name="fixture_wattage" class="form-control" required>
												@error('fixture_wattage')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
											
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">Warranty for Existing LED Fixtures if any
											<span class="required">*</span></label>
											</label>
											<div class="col-sm-9">
												<input type="text" name="warranty_existing" class="form-control" required>
												@error('warranty_existing')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
											
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">Condition of underground Cable (Working/ Damaged), if applicable
											<span class="required">*</span></label>
											</label>
											<div class="col-sm-9">
												<input type="text" name="condition_existing" class="form-control" required>
												@error('condition')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
											
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">Earth Condition
											<span class="required">*</span></label>
											</label>
											<div class="col-sm-9">
												<input type="text" name="earth_condition" class="form-control" required>
												@error('earth_condition')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
											
										</div>
										<div class="form-group">
  											<label class="col-sm-3 control-label">Cable Used for Installation Light in Mts
											  <span class="required">*</span>
											</label>
											<div class="col-sm-9">
												<input type="text" name="cable_user" class="form-control" required>
												@error('cable_user')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">Arms & Clamps Required:
											<span class="required">*</span></label>
											<div class="col-sm-9">
												<input type="radio" style="height:35px; width:20px; vertical-align: middle;" value="Yes" name="arms" class="armscondition"> Yes
												<input type="radio" style="height:35px; width:20px; vertical-align: middle;margin-left:30px;" value="No" name="arms" class="armscondition"> No

												
											</div>
											
										</div>
										<div id="maindiv" style="display:none">
										<div class="form-group">
											<label class="col-sm-1 control-label">25mm Dia 1.2mt
											<span class="required">*</span></label>
											<div class="col-sm-3">
											<input type="text" name="type1" class="form-control" required>
												@error('type1')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
												
											</div>
											<label class="col-sm-1 control-label">37mm Dia 1.2mt
											<span class="required">*</span></label>
											<div class="col-sm-3">
											<input type="text" name="type2" class="form-control" required>
												@error('type2')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
												
											</div>
											<label class="col-sm-1 control-label">45mm Dia 1.2mt
											<span class="required">*</span></label>
											<div class="col-sm-3">
											<input type="text" name="type3" class="form-control" required>
												@error('type3')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
												
											</div>

										</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">Dedicated Streetline Available:
											<span class="required">*</span></label>
											<div class="col-sm-9">
											<input type="radio" name="dedicated" style="height:35px; width:20px; vertical-align: middle;" value="Yes"> Yes
												<input type="radio" name="dedicated" style="height:35px; width:20px; vertical-align: middle;margin-left:30px;" value="No"> No

												
											</div>
											
										</div>
										<center><label class="col-md-12">Network Issues:</label></center>
										
		<div class="form-group">
		<label class="col-sm-3 control-label">Is the safe distance maintained between HT Lines - LED Lights
		<span class="required">*</span></label>
		<div class="col-sm-9">
		<input type="text" name="led_lights" class="form-control"  id="tolsqft" required>
		@error('led_lights')
		<font size="3" color="red">{{$message}}</font>
		@enderror	
		</div>
		</div> 
										
										<div class="form-group">
											<!-- <label class="col-sm-1 control-label">चर्तु:सिमा</label> -->
											<label class="col-sm-3 control-label"> Is there any tree Obstructions 
											<span class="required">*</span></label>
											<div class="col-sm-9">
												<input type="text" name="tree_obstruction" class="form-control" required>
												@error('tree_obstruction')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
											
										</div>
										<div class="form-group">
										<!-- <label class="col-sm-1 control-label">चर्तु:सिमा</label> -->
											<label class="col-sm-3 control-label">Suggested LED Wattage: 
											<span class="required">*</span></label>
											<div class="col-sm-9">
											<input type="checkbox" name="led_wattage1" value="18 W" style="height:35px; width:20px; vertical-align: middle;"> 18 W
												<input type="checkbox" name="led_wattage2" value="35 W" style="height:35px; width:20px; vertical-align: middle;margin-left:30px;"> 35 W
												<input type="checkbox" name="led_wattage3" value="70 W" style="height:35px; width:20px; vertical-align: middle;"> 70 W
												<input type="checkbox" name="led_wattage4" value="110 W" style="height:35px; width:20px; vertical-align: middle;"> 110 W
												<input type="checkbox" name="led_wattage5" value="190 W" style="height:35px; width:20px; vertical-align: middle;"> 190 W

											</div>
											
										</div>
										<div class="form-group">
  											<label class="col-sm-3 control-label">Reducer Used
											  <span class="required">*</span>
											</label>
											<div class="col-sm-9">
												<input type="text" name="reducer_used" class="form-control" required>
												@error('light_in_mtr')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
										</div>
										<div class="form-group">
  											<label class="col-sm-3 control-label">Minimast Clamp Used
											  <span class="required">*</span>
											</label>
											<div class="col-sm-9">
												<input type="text" name="minimast_clamp_used" class="form-control" required>
												@error('light_in_mtr')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
										</div>
										<div class="form-group">
										<!-- <label class="col-sm-1 control-label">चर्तु:सिमा</label> -->
											<label class="col-sm-3 control-label">Remarks, if any
											<span class="required">*</span></label>
											<div class="col-sm-9">
												<textarea name="remark_data" class="form-control" required rows="10" cols="10"></textarea>
												@error('east')
												<font size="3" color="red">{{$message}}</font>
												@enderror	
											</div>
											
										</div>
										
										
									</div>
									<footer class="panel-footer">
										<div class="row">
											<div class="col-sm-9 col-sm-offset-3">
												<button class="btn btn-primary" type="submit">Submit</button>
												<!--<button type="reset" class="btn btn-default">Reset</button>-->
											</div>
										</div>
									</footer>
								</section>
							</form>
						</div>
						
					</div>
					<!-- end: page -->
				</section>
				<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
				<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
		<script>
		
function CalFt(val)
            {
                mval = parseInt($("#chf"+val).val())/10.76;
                $("#chm"+val).val(mval)
                //alert(val);
            }
            function CalM(val)
            {
                mval = parseInt($("#chm"+val).val())*10.76;
                $("#chf"+val).val(mval)
                //alert(val);
            }
		$(document).ready(function(){
		$("#gram_id").on("change",function()
   		 	{
        		var id=$(this).val();
				//alert(id);
				var data={
				jilla_id:$("#jilla_id").val(),
				taluka_id:$("#taluka").val(),
				gram_id:$(this).val()
			}
			//console.log(data);
			$.ajax({
			url:'{{url("/api/gramdata/"")}}',
			method:'get',
			data:data,
			success:function(data)
			{
				var test=data.split("::");
				var $row=$("#rowcount").val();
				$i=1;
				for($j=6; $j<=8; $j++)
				{
					$("#bharank"+$j).val(test[0+$i-1]);
					$i++;
				}
				for($i=1; $i<$row-2; $i++)
				{
					$("#ready"+$i).val(test[2+$i]);
					//alert($i);
				}
				
			},
			error:function(data)
			{
				alert(data);
			}
		});
		});
		$("#yearcon").on("change",function(){
			var id=$(this).val();
			var date=new Date().getFullYear();
			var remd=date-id;
			var data={
				jilla_id:$("#jilla_id").val(),
				taluka_id:$("#taluka").val(),
				gram_id:$("#gram_id").val(),
				yearcin:remd
			}
			$.ajax({
				url:'{{url("/api/getghasara/")}}',
				method:'get',
				data:data,
				success:function(data)
				{
					var test=data.split("::");
					$("#ghasara1").val(test[0])
					for($k=2; $k<=5; $k++)
					{
						$("#ghasara"+$k).val(test[0+$k-1]);
					}
				},
				error:function(data)
				{
					//alert(data);
				}

			});
		});
		
			
// 			$(".chfdemo").on("change",function(){
// 			var chf=$(this).val();
// 			//alert(chf);
// 			var test=chf/10.76;
// 			$(".chm").on('click',function() {
    			
// 					$(this).val(test);
				
// 				})
			
			
			
// 			});
			
			
			
		
		});
		$(".armscondition").on('click',function(){
			var id=$(this).val();
			if(id=='Yes')
			{
				document.getElementById('maindiv').style.cssText="display:block";
			}
			else if(id=='No')
			{
				document.getElementById('maindiv').style.cssText="display:none";
			}
		});
		</script>
		
		
	@stop