<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>
        Survey Report
    </title>
        <!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
   <link rel="stylesheet" href="//code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
   <script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script> -->

   <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

   
   <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
   <script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
   <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

   <style>
    body{
        font-family: 'Times New Roman';
        overflow-x: hidden;
    }
    *,
    ::after,
    ::before {
        box-sizing: border-box !important;
    }
    @media print {
        @page {
            size: A3 portrait;
        }
        .print_action {
            display: none !important;
        }
        .page-break {
            page-break-before: always;
        }
    }
    .btn-primary,
    .btn-primary:hover {
        background-color: #008cba;
        border-color: #008cba;
    }
    .vertical-text {
        writing-mode: vertical-lr;
        /*transform: rotate(-180deg);*/
    }

    .text-uppercase {
        text-transform: uppercase;
    }
    .heading {
        font-size: 20px;
        color: #000;
        font-weight: bold;
    }
    .sub-heading {
        font-size: 18px;
        color: #000;
        font-weight: bold;
    }
    .table td,
    .table th {
        padding: 10px;
    }
    .table td {
        vertical-align: middle;
         font-family: 'Times New Roman';
    }
    .table td,
    .table th {
        border-top: 1px solid #000;
         font-family: 'Times New Roman';
    }
    .table-bordered thead td,
    .table-bordered thead th {
        border-bottom-width: 1px;
    }
    .table-bordered td,
    .table-bordered th {
        border: 1px solid #000000;
    }
    .table thead th {
        border-bottom: 1px solid #000 !important;
    }
    .row.px-3.pt-4.model *, .modal-dialog.modal-lg *{
      box-sizing: border-box !important;
    }
    .row.px-3.pt-4.model::before, .modal-dialog.modal-lg::before{
      box-sizing: border-box !important;
    }
    .row.px-3.pt-4.model::after, .modal-dialog.modal-lg::after{
      box-sizing: border-box !important;
    }

    .table tbody+tbody {
        border-top: 1px solid #000000;
    }
    .table td:last-child { 
        border-right: 1px solid #000 !important; 
    }
    /*.text-indent{
        padding-left: 50px;
    }*/
</style>

<script type="text/javascript">
    $(document).ready(function(){
    $('[data-toggle="tooltip"]').tooltip();
    });
</script>
</head>
<body>
    <div class="container">
      <div class="row px-5 mx-5 mt-4 mb-3">
                    <div class="col-4">
                        <div>
                            <button class="btn btn-primary print_action" id="dashboard"><a href="{{url('/gp_completion_list')}}" style="text-decoration:none;color:white;">Back To Dashboard</a></button>
                        </div>
                    </div>
                    <div class="col-5">
                    <?php if(isset($_GET['pedding']) && $_GET['pedding']!=""){}else{?>
                    <form action="{{url('gp_survey_lights')}}" class="print_action" method="get">

                    <div class="d-flex">

                        <input type="hidden" name="id" value="{{Request::get('id')}}">
                         <select class="form-control mr-3" name="phase_no">
                        <option value="">All Phases</option>
                        @foreach($phase as $ph)
                        <option value="{{$ph->phase_no}}" @if($request['phase_no']==$ph->phase_no) Selected @endif>Phase-{{$ph->phase_no}}</option>
                        @endforeach
                    </select>
                     <button class="btn btn-primary print_action" type="submit">Search</button>
                     </div>
                    </form>
                    <?php } ?>
               
                    </div>
                    <div class="col-3 pr-3">
                        <div class="text-right">
                            <button onclick="window.print();return false;" class="btn btn-primary print_action" id="print">Print</button> 
                        </div>
                    </div>
                    </div>        
        <div class="row px-5 mx-5 mt-5">
            <div class="col-12">
                <h4 class="text-center font-weight-bold">Survey for Installation of LED Street Lights by EESL</h4>
                </div>
            <div class="col-3 offset-9 mt-3">
<div class="mt-4 ml-5 text-left">
<span>Date:</span>
<span></span>
</div>
</div>
        </div>
        <div class="row px-5 mx-5 mt-4">
            <div class="col-12">
                <div class="heading mb-3">I). Particulars of the Village Location</div>
                <div class="my-1">
                    <span class="font-weight-bold">1. Name of the District&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                    <span class="text-indent">: {{$area_list->super_details->area_name??""}}</span>
                </div>
                <div class="my-1">
                    <span class="font-weight-bold">2. Name of the Mandal&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                    <span class="text-indent">: {{$area_list->parent_details->area_name??""}}</span>
                </div>
                <div class="my-1">
                    <span class="font-weight-bold">3. Name of the Village&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                    <span class="text-indent">: {{$area_list->area_name??""}}</span>
                </div>
            </div>
        </div>

        <div class="row px-5 mx-5 mt-4">
            <div class="col-12">
                <div class="heading mb-3">II). Staff Particulars of the GP Office:</div>
                <table class="table" border="1" width="80%">
                    <thead>
                        <th>Sl No</th>
                        <th>Name of the Post</th>
                        <th>Name of the Person</th>
                        <th>Cell No</th>
                    </thead>
                    <tbody>
                        <tr>
                            <td>1</td>
                            <td>Sarpanch</td>
                            <td></td>
                            <td></td>
                        </tr>
                        <tr>
                            <td>2</td>
                            <td>GP Secretary</td>
                            <td></td>
                            <td></td>
                        </tr>
                        <tr>
                            <td>3</td>
                            <td>VA/Electrician</td>
                            <td></td>
                            <td></td>
                        </tr>
                        <tr>
                            <td>4</td>
                            <td>Resolution Received (Yes/No)</td>
                            <td></td>
                            <td></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>

        <div class="row px-5 mx-5 mt-4">
            <div class="col-12">
                <div class="heading mb-3">III). NPDCL Unit offices & Staff Particulars:</div>
                <table class="table" border="1" width="80%">
                    <thead>
                        <th>Sl No</th>
                        <th>Name of the Post</th>
                        <th>Name of the Person</th>
                        <th>Cell No</th>
                    </thead>
                    <tbody>
                        <tr>
                            <td>1</td>
                            <td>Sarpanch</td>
                            <td></td>
                            <td></td>
                        </tr>
                        <tr>
                            <td>2</td>
                            <td>GP Secretary</td>
                            <td></td>
                            <td></td>
                        </tr>
                        <tr>
                            <td>3</td>
                            <td>VA/Electrician</td>
                            <td></td>
                            <td></td>
                        </tr>
                        <tr>
                            <td>4</td>
                            <td>Resolution Received (Yes/No)</td>
                            <td></td>
                            <td></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>

        <div class="row px-5 mx-5 mt-4">
            <div class="col-12">
                <div class="heading mb-3">IV). Street Lights Particulars of the GP:</div>
                <table class="table" border="1" width="80%">
                    <thead>
                        <?php $date=""; $i=1; $sum=0; $wattages=["18 W","35 W","70 W","110 W","190 W"];
                     $query="";
                     if($request->phase_no){
                        $query=" and phase_no=".$request->phase_no;
                    }?>
                                @foreach($wattages as $value) 
                                <?php $counts= DB::select("SELECT created_at,LED_wattage,    
                                    ROUND (   
                                    (
                                    LENGTH(LED_wattage)
                                    - LENGTH( REPLACE ( LED_wattage, '".$value."', '') ) 
                                    ) / LENGTH('".$value."')        
                                    ) AS count    
                                    FROM survey_infos where gram_id=".$area_list->id.$query);
                                    //dd($request->phase_no);
                                $count=array_sum(array_column($counts,'count'));
                         $list[]=$count;

                                ?>

 @endforeach
                           
                       <tr>
                            <th rowspan="2">Sl No</th>
                            <th rowspan="2">No of Poles</th>
                            <th colspan="4">Pole Type</th>
                            <th rowspan="2">Present Lights Available in GP</th>
                            <th colspan="4">Required type of LED lights</th>
                       </tr>
                       <tr>
                            <th>8.1mts</th>
                            <th>9.1mts</th>
                            <th>12mts</th>
                            <th>Poles without 3rd Wire</th>
                            <th>18W</th>
                            <th>35W</th>
                            <th>70W</th>
                            <th>Others</th>
                       </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>1</td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td><?php $w1=isset($list[0])?$list[0]:0?>{{$w1}}</td>
         <td><?php $w2=isset($list[1])?$list[1]:0?>{{$w2}}</td>
                          <td><?php $w3=isset($list[2])?$list[2]:0?>{{$w3}}</td>
                            <td></td>
                        </tr>
                         <?php $i++; $sum=$sum+$count; ?>
                               
                    </tbody>
                </table>
            </div>
        </div>

        <div class="row px-5 mx-5 my-5 pt-5">
            <div class="col-4 pt-4">
                <div>GP Secretary/</div>
                <div>Date&Seal</div>
            </div>
            <div class="col-4 pt-4">
                <div>Sarpanch</div>
                <div>Date&Seal</div>
            </div>
            <div class="col-4 pt-4">
                <div>DM TSREDCO</div>
                <div>Date&Seal</div>
            </div>
        </div>

    </div>
</body>
</html>
