@extends('layouts.admin')
@section('pageTitle')
  <title>Best Insurance | Completed Leads</title>
@stop
@section('pageCss')
<link rel="stylesheet" href="{{ URL::asset('assets/plugins/datepicker/datepicker3.css') }}">
@stop
@section('content')
<?php
$insurance_startdate = date('d/m/Y',strtotime($information->insurance_startdate));
if($information->mta_date!="")
    $mid_term_date=date('d/m/Y',strtotime($information->mta_date));
else
$mid_term_date = date('d/m/Y',strtotime($information->insurance_startdate));
?>
<style>
.datepicker table tr td.disabled, .datepicker table tr td.disabled:hover{background: #f0f0f0; 
opacity: 0.2;}
</style>
<section class="content mtablock">
    <div class="box">
            <div class="box box-warning ">
              <div class="box-header with-border text-center">
                <h2 class="box-title " > <b>MTA</b></h2> 
              </div>
            </div>
            <div class="box-body no-padding ">
              {!! Form::open(array('url' => 'account/completed-leads/mta-completed-lead/'.$information->id.'','id' => 'formValidation')) !!}
                <!-- text input -->
                <div class="form-group col-md-12">
                    <!-- Quote Id -->
                    {{ Form::hidden('id', $information->id)}}
                    {{ Form::hidden('premiseName', $information->premiseName)}}
                    <div class="col-md-3">&nbsp;&nbsp;&nbsp;{!! Form::label('Date of issue:') !!} </div>
                    <div class="col-md-4">
                        {{ Form::text('txtDateOfIssue', $insurance_startdate, 
                           array( 'readOnly' => 'true',
                          'class'=>'form-control')) 
                        }}
                    </div>
                </div>

                <div class="form-group col-md-12 required">
                    <div class="col-md-3"><b>
                    <span class=" control-label "></span>&nbsp;
                     Policy number:</b> </div>
                    <div class="col-md-4">
                        <span></span>
                        {{ Form::text('policy_number', $information->policy_number_full, 
                           array('readOnly' => 'true', 
                          'class'=>'form-')) 
                        }}
                    </div>
                </div>
                <div class="form-group col-md-12 required">
                    <div class="col-md-3"><b>
                    <span class=" control-label "></span>&nbsp;
                     Title:</b> </div>
                    <div class="col-md-4">
                        {{ Form::select('title', [
                           '0' => 'Select',
                           'Mr.' => 'Mr.',
                           'Ms.' => 'Ms.',
                           'Mrs.' => 'Mrs.',
                           'Dr.' => 'Dr.',
                           'Rev.' => 'Rev.',
                           'Miss.' => 'Miss.'],$information->title,
                           ['class' => 'form-control select2 select2-hidden-accessible']
                        ) }}
                    </div>
                </div>

                <div class="form-group col-md-12 required">
                    <div class="col-md-3"><b>
                    <span class=" control-label "></span>&nbsp;
                     First Name:</b> </div>
                    <div class="col-md-4">
                        {{ Form::text('fname', $information->fname, 
                           array( 
                          'class'=>'form-control')) 
                        }}
                    </div>
                </div>

                <div class="form-group col-md-12 required">
                    <div class="col-md-3"><b>
                    <span class=" control-label "></span>&nbsp;
                     Last Name:</b> </div>
                    <div class="col-md-4">
                        {{ Form::text('lname', $information->lname, 
                           array( 
                          'class'=>'form-control')) 
                        }}
                    </div>
                </div>

               
                <?php
                        $address = "";
                        if($information->address1 != ""){
                            $address .=  $information->address1 . ", ";
                        }
                        if($information->address2 != ""){
                            $address .=  $information->address2 . ", ";
                        }

                        if($information->address3 != ""){
                            $address .= $information->address3 . ", ";
                        }

                        if($information->address4 != ""){
                            $address .=  $information->address4 . ", ";
                        }

                        if($information->postcode != ""){
                            $address .=  $information->postcode . ", ";
                        }
                        if($information->postaltown != ""){
                            $address .=  $information->postaltown . ", ";
                        }
                        if($information->county != ""){
                            $address .=  $information->county;
                        }
                ?>
                <div class="form-group col-md-12">
                    <div class="col-md-3">&nbsp;&nbsp;&nbsp;{!! Form::label('Policy holder Address:') !!} </div>
                    <div class="col-md-6">
                    <span>{{$address}} </span><br><br>
                    <div class="col-xs-4">

                        <input name="postcode2" class="search_postcode form-control col-md-3" id="postcode2-<?php echo $information->id; ?>" placeholder="Please enter postcode" title="Please enter postcode" value="" maxLength="8">&nbsp;&nbsp;
                        <span class="text text-red error-msg"> </span>
                        <!-- refresh button -->
                    <div class="col-xs-1 refresh-btn">
                       
                    </div>
                    <!-- /refresh button -->
                    </div>

                    <a href="#address" class="find_address_cls2 find_add_btn btn btn-info btn-sm" id="btnPO2-<?php echo $information->id; ?>" style="font-size:14px;"><span>Find Address</span></a>
                    <a href="#" class="btn btn-warning btn-sm" id="manual_address" style="font-size:14px;">
                        <span>Add Address Manually</span>
                    </a>
                    
                    <div class="fornRow search_new_address" id="POAddress2-<?php echo $information->id; ?>" style="display:none;">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                         <tr>
                            <td width="10%" align="left" valign="middle"><p class="blue">Highlight the address that matches your selection and Select</p>
                              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td align="left" valign="middle">
                                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                            <tr id="address_tr">
                                                <div class="address-results2" id="address-results2-<?php echo $information->id; ?>">
                                                </div>
                                                <td align="" valign="middle">                       
                                                </td>
                                                
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                              </table>
                            </td>
                         </tr>
                        </table>
                    </div> 
                    <div class="form-group col-xs-12 selected_add">
                        <b>Selected Address</b>
                            <p id="new_line1"> </p>
                            <p id="new_line2"> </p>
                            <p id="new_line3"> </p>
                            <p id="new_line4"> </p>
                            <p id="new_town"> </p>
                            <p id="new_country"> </p>
                            <p id="new_postcode"> </p>

                            {{ Form::hidden('form_new_line1', null, array( 'id' => 'form_new_line1' ,'class'=>'form-control'))}}
                            {{ Form::hidden('form_new_line2', null, array('id' => 'form_new_line2', 'class'=>'form-control'))}}
                            {{ Form::hidden('form_new_line3', null, array('id' => 'form_new_line3', 'class'=>'form-control'))}}
                            {{ Form::hidden('form_new_line4', null, array('id' => 'form_new_line4', 'class'=>'form-control'))}}
                            {{ Form::hidden('form_new_town', null, array('id' => 'form_new_town' ,'class'=>'form-control'))}}
                            {{ Form::hidden('form_new_country', null, array('id' => 'form_new_country', 'class'=>'form-control'))}}
                            {{ Form::hidden('form_new_postcode', null, array('id' => 'form_new_postcode', 'class'=>'form-control'))}}
                            <br>
                    </div>
                    <br>
                    <div class="form_manual_address">
                        <h4><b>If you are unable to find the address please enter the manual Address here</b></h4>
                        <div class="form-group col-md-12 required">
                            <div class="col-md-4"><b>
                            <span class=" control-label "></span>&nbsp;
                            Line1</b> </div>
                            <div class="col-md-8">
                                {{ Form::text('line1', null, 
                                   array( 'class'=>'form-control')) 
                                }}
                               
                            </div>
                        </div>
                        <div class="form-group col-md-12 required">
                           <div class="col-md-4"><b>
                            <span class=" control-label "></span>&nbsp;
                            Line2</b> </div>
                            <div class="col-md-8">
                                {{ Form::text('line2',null, 
                                   array( 'class'=>'form-control')) 
                                }}
                                
                            </div>
                        </div>
                        <div class="form-group col-md-12 required">
                            <div class="col-md-4"><b>
                            <span class=" control-label "></span>&nbsp;
                            Line3</b> </div>
                            <div class="col-md-8">
                                {{ Form::text('line3', null, 
                                   array( 'class'=>'form-control')) 
                                }}
                               
                            </div>
                        </div>
                        <div class="form-group col-md-12 required">
                           <div class="col-md-4"><b>
                            <span class=" control-label "></span>&nbsp;
                            Line4</b> </div>
                            <div class="col-md-8">
                                {{ Form::text('line4', null, 
                                   array( 'class'=>'form-control')) 
                                }}
                            </div>
                        </div>
                        <div class="form-group col-md-12 required">
                            <div class="col-md-4"><b>
                            <span class=" control-label "></span>&nbsp;
                            Town</b> </div>
                            <div class="col-md-8">
                                {{ Form::text('town', null, 
                                   array( 'class'=>'form-control')) 
                                }}
                            </div>
                        </div>
                        <div class="form-group col-md-12 required">
                            <div class="col-md-4"><b>
                            <span class=" control-label "></span>&nbsp;
                            Country</b> </div>
                            <div class="col-md-8">
                                {{ Form::text('country', null, 
                                   array( 'class'=>'form-control')) 
                                }}
                            </div>
                        </div>
                        <div class="form-group col-md-12 required">
                            <div class="col-md-4"><b>
                            <span class=" control-label "></span>&nbsp;
                            Postal Code</b> </div>
                            <div class="col-md-8">
                                {{ Form::text('postal_code', null, 
                                   array( 'class'=>'form-control')) 
                                }}
                            </div>
                        </div>
                    </div>
                    <div class="fornRow">
                        <table width="100%" cellspacing="0" cellpadding="0" border="0">
                            <tbody>
                                <tr>
                                    <td valign="middle" align="left" style="display:none; " id="tblFullAddress2-<?php echo $information->id; ?>" colspan="2">
                                        <p><strong>Address Information</strong>:</p>
                                        <p id="CompleteAddress2-<?php echo $information->id; ?>"></p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <hr>
                <div class="form-group col-md-12">
                    <div class="text-center"> 
                        <h3 style="color:#009aa9">SCHEDULE OF INSURANCE </h3> 
                        <span>{{$policy_prefix->pdf_underwritten_txt}} </span>
                    </div>
                </div>
               
                <div class="form-group col-md-6 required">

                    <div class="col-md-4"><b>
                    <span class=" control-label "></span>&nbsp;
                    MTA Date:</b> </div>
                    <div class="col-md-8">
                        {{ Form::text('policyStartdate', '', 
                           array( 'id' => 'policyStartdate',
                          'class'=>'form-control','data-date-format'=>'dd/mm/yyyy')) 
                        }}

                        
                    </div>
                </div>

                <div class="form-group col-md-6">
                    <div class="col-md-4">{!! Form::label('Policy End Date:') !!} </div>
                    <div class="col-md-8">
                         {{ Form::text('txtPolicyEndDate', date('d/m/Y',strtotime($information->insurance_enddate)), 
                           array( 'readOnly' => true,
                          'class'=>'form-control')) 
                        }}
                    </div>
                </div>
                <div class="form-group col-md-6 required">
                    <div class="col-md-4"><b>
                    <span class=" control-label "></span>&nbsp;
                    Cover type:</b> </div>
                    <div class="col-md-8">
                        {{ Form::select('typeofcover', [
                          '0' => 'select',
                          'ASU' => 'Unemployment, Accident &amp; Sickness',
                          'U' => 'Unemployment only',
                          'AS' => 'Accident &amp; Sickness only'

                    ],$information->typeofcover, 
                       array('class'=>'form-control','id' => 'typeofcover')) 
                    }}
                    </div>
                </div>
                <input type="hidden" id="cover_type" value="{{$information->typeofcover}}">
                <input type="hidden" id="excess_period_value" value="{{$information->excessperiod}}">
                <div class="form-group col-md-6 required">

                    <div class="col-md-4"><b>
                    <span class=" control-label "></span>&nbsp;
                    Excess Period:</b> </div>
                    <div class="col-md-8">
                        <select name="excessperiod" id="excessperiod"
                                class="form-control">
                           
                        </select> 
                    </div>
                </div>

                <div class="form-group col-md-6 required">
                    <div class="col-md-4"><b>
                    <span class=" control-label "></span>&nbsp;
                    Monthly Benefit:</b> </div>
                    <div class="col-md-8">
                        {{ Form::text('monthlybenefit', $information->monthlybenefit, 
                           array( 
                          'class'=>'form-control','id' => 'monthlybenefit')) 
                        }}
                    </div>
                </div>

                <div class="form-group col-md-6">
                    <div class="col-md-4">{!! Form::label('Maximum Benefit Period:') !!} </div>
                    <div class="col-md-8">
                    {{$information->benefit_period.' Months'}}
                    {{ Form::hidden('benefit_period',$information->benefit_period, 
                       array('class'=>'form-control')) 
                    }}
                    </div>
                </div>

                <div class="form-group col-md-6 required">
                    <div class="col-md-4"><b>
                    <span class=" control-label "></span>&nbsp;
                    Monthly premium:</b> </div>
                    <div class="col-md-8">
                        {{ Form::text('monthlycost', $information->monthlycost, 
                           array( 
                          'class'=>'form-control','id' => 'monthlycost')) 
                        }}
                    </div>
                </div>
                
                <div class="form-group col-md-6 required">
                    <div class="col-md-4"><b>
                    <span class=" control-label "></span>&nbsp;
                    Payment option:</b> </div>
                    <div class="col-md-8">
                    Monthly direct debit
                    </div>
                </div>
                
                <div class="form-group col-md-6 required" id="raf_mta_div" style="display:none;">
                    <div class="col-md-4"><b>
                    <span class=" control-label "></span>&nbsp;
                    RAF MTA Date:</b> </div>
                    <div class="col-md-8">
                        {{ Form::text('raf_date', '', 
                           array( 
                          'class'=>'form-control','id' => 'raf_date','data-date-format'=>'dd/mm/yyyy')) 
                        }}
                    </div>
                </div>
                
                <div class="form-group col-md-6 required" id="raf_premium_div" style="display:none;">
                    <div class="col-md-4"><b>
                    <span class=" control-label "></span>&nbsp;
                    New Annual Premium:</b> </div>
                    <div class="col-md-8">
                        {{ Form::text('new_premium', '', 
                            array( 
                            'class'=>'form-control','id' => 'new_premium')) 
                            }}
                    </div>
                </div>



                <div class="form-group col-md-6 required">
                    <div class="col-md-4"><b>
                    <span class=" control-label "></span>&nbsp;
                     Date of Birth:</b> </div>
                    <div class="col-md-8">
                        {{ Form::text('dob', $information->dob, 
                           array( 'id' => 'dob',
                          'class'=>'form-control','data-date-format'=>'dd/mm/yyyy')) 
                        }}
                    </div>
                </div>
                
                <!-- <div class="form-group col-md-6 required">
                    <div class="col-md-4"><b>
                    <span class=" control-label "></span>&nbsp;
                     Direct debit date:</b> </div>
                     <div class="col-md-8">

              <select class="form-control required" id="preferreddate" name="preferreddate"  title="Please enter your preferred Direct Debit date">
                <option value="">DD</option>
                   
                                                  <?php
                                                            for ($i=1;$i<=28;$i++) {
                                                            $i=sprintf("%02d",$i);
                                                    ?>
                                                    <option value="<?php echo $i; ?>" {{ ($information->preferreddate == $i ? "selected":"") }}><?php echo $i; ?>  </option>

                                                    <?php } ?>
                                            
              </select>
            </div>
          </div> -->

                <div class="form-group col-md-6 required">
                    <div class="col-md-4"><b>
                    <span class=" control-label "></span>&nbsp;
                    Reason for update: * </b> </div>
                    <div class="col-md-8">
                     <textarea name="reason" required></textarea>
                    </div>
                </div>

                
                

                <input type="hidden" id="cover_type" value="{{$information->typeofcover}}">
                <input type="hidden" id="excess_period_value" value="{{$information->excessperiod}}">
                 <input type="hidden" id="old_monthly_premium" value="{{$information->monthlycost}}">
                <input type="hidden" id="information_id" value="{{$information->id}}">


                <!-- hidden varialbles -->
                {{ Form::hidden('insurer_type', $information->insurer, 
                           array( 
                          'class'=>'form-control')) 
                }}
                <div class="form-group col-md-12 text-center">
                    &nbsp;&nbsp;&nbsp;
                    {{ Form::submit('Confirm',array('class'=>'btn btn-success','rows' => '4')) 
                    }}
                </div>
              </form>
            </div>
        </div>
    <!-- </div> -->
</section>

<!-- Download Pdf section  -->
@if(isset($downloadBtn))
    {!! $downloadBtn !!}
@endif

<!-- Download Pdf Popup after submit -->
<a data-target="#DownloadPdfTarget" role="button" data-toggle="modal" id="downloadPopBtn"></a>
<div class="modal fade" id="DownloadPdfTarget" style="text-align:center; height: auto;">
    <div class="modal-dialog">
      <div class="modal-content">
          <!-- modal header -->
            <div class="modal-header">
                <div class="pull-left" >
                    <h4 style="color:#12a1a5" ><b>{{strtoupper( 'Download Pdf')}}</b></h4>
                </div>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close" id="close-model">
                    <span aria-hidden="true">×</span>
                </button>
            </div>
          <!-- modal body -->
            <div class="modal-body">
                {{Form::open(array('url' => '/account/download-pdf-for-mta', 'method' => 'POST', 'id' => 'PdfForm'))}}
                <p align="left">Do you want to download pdf?</p>
                {{Form::hidden('id',$information->id,array(''))}}
            </div>
          <!-- modal footer -->  
            <div class="modal-footer" style="padding-top: 15px">
<!--                 <div class="col-md-9">
                </div> -->
                <div class="col-md-4">
                    <button type="button"  class="btn btn-default pull-left" data-dismiss="modal">No</button>
                    <div class="" style="float: left;margin-left: 10px;" >{{Form::submit('Yes',array('class' => 'btn btn-success','id'=>'downlBtn','onClick' => 'downlBtn'))}}</div>
                </div>
                <div class="col-md-8">
                     <input type="button" name="email_send" value="Mail" class="btn btn-success" id="btn-mta-mail-send"/>
                </div>
            </div>
          {{Form::close()}}
      </div>
    </div>
</div>
<!-- // Download Pdf section  -->

<!-- Modal mail to send -->
<div class="modal fade" id="mta_email_send" tabindex="-1" role="dialog" aria-labelledby="email_send_Label">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title" >Email to send</h4>
            </div>
            <div class="modal-body">
              <form id="cc_email_form" class="popform">  
                <input type="hidden" name="lead_id" value="{{$information->id}}">
                <input type="hidden" name="id" value="{{$information->id}}">
                <input type="hidden" name="send_email" value="true">
                <div class="form-group">
                  <label>CC</label>
                  <input type="text"  data-role="tagsinput" name="cc_emails" required>
                </div>
                
                <div class="form-group">
                  <label>BCC</label>
                  <input type="text"  data-role="tagsinput" name="bcc_emails" required> 
                </div>
                
                <div class="form-group" style="text-align: center;">
                  <input type="button" value="Send Email" id="final_btn_mta_email_send" class="btn btn-success" />
                </div>
                
              </form>
            </div>
        </div>
    </div>
</div>
<!-- End Modal -->


@stop
@section('pageBottomJs')
<style type="text/css">
    .error{
        color: red
    }
    #mta_email_send .modal-dialog{
        width: 300px;
    }
    #mta_email_send .modal-content{
        border-radius: 8px;
    }
  .popform label{
   width: 35px;
 }
 .popform input{
   outline: none;
   border: 1px solid #cecece;
   height: 30px;
   width: 210px;
   padding: 5px 15px;
   font-size: 14px;
   box-shadow: none;
 }
 .popform .btn{
    width: auto !important;
    height: auto;
    line-height: normal;
 }
.address-results1, .address-results2 {
    border: 1px solid #d5d6d7;
    height: 150px;
    overflow: auto;
    width: 300px;
}
.fancybox-skin {
    color: #444;
    text-shadow: none;
}

/*required field asterisk symbol */
.form-group.required .control-label:after {
  content:"*";
  color:red;
}

/* hover color for postal address  */
/*a:hover, a:active, a:focus {
    background-color: #72afd2;
    color: white;
    outline: medium none;
    text-decoration: none;
}*/
input[type="checkbox"], input[type="radio"] {
    vertical-align: middle;
}
</style>
<link rel="stylesheet" href="{{ URL::asset('assets/plugins/iCheck/all.css') }}">
<!-- pretty scroll bar(AdminLite Documentation page css) -->
<link rel="stylesheet" href="{{ URL::asset('assets/plugins/PrettyScroll/style.css') }}">
<!-- iCheck 1.0.1 -->
<script src="{{ URL::asset('assets/plugins/iCheck/icheck.min.js') }}"></script>
<script src="{{ URL::asset('assets/plugins/datepicker/bootstrap-datepicker.js') }}"></script>
<script src="{{ URL::asset('assets/js/views/leads/mta-comleted-view.js') }}"></script>
@stop