@extends('main')
@section('css')
<link href="{{ asset('/css/bootstrapValidator.min.css')}}" rel="stylesheet">
@endsection

@section('content')
<section class="main_content">
    <div class="container">
    <ol class="breadcrumb cust-breadcrumb">
              <li><a href="{{url('/')}}">Home</a></li>
              <li class="active">Search</li>
            </ol>
             <div class="row">

  <div class="clearfix"></div>
             @if (Session::get('error_msg'))
              <div class="col-md-12">
                <div class="alert alert-danger">
                   <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                     <span aria-hidden="true">&times;</span>
                   </button>
                    <?php echo Session::get('error_msg') ?>
                </div>
              </div>
            @endif
            @if (Session::get('succ_msg'))
              <div class="col-md-12">
                <div class="alert alert-success">
                   <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                     <span aria-hidden="true">&times;</span>
                   </button>
                    <?php echo Session::get('succ_msg')?>
                </div>
              </div>  
            @endif
          </div>
      <div class="row talent_home">
        @include("left_menu")
        <div class="col-md-9 col-sm-9">
        <div class="border-wraper search-page index-search">
          <div class="">
            <h1 class="heading">Search</h1>
           
                        
          </div>
          <div class="clearfix"></div>
         <form class="role" name="login" id="searchForm" action="{{url('/search') }}" method="get">
           <input type="hidden" name="_token" value="{{ csrf_token() }}">
            <div class="col-md-6">
               <div class="form-group">
                 <label class="col-sm-4 control-label">Search</label>
                 <div class="col-sm-8">
                   <select class="form-control" name="search_type" id="search_type">
                    @foreach($search_type as $key=>$value)
                     {{--*/ $selected='';/*--}}
                     <option value="{{$key}}" {{$selected}}>{{$value}}</option>
                    @endforeach
                   </select>
                 </div>
               </div>
            </div>
      <div class="clearfix hidden-md hidden-lg"></div>
            <div class="col-md-6">
              <div class="form-group">
                 <label class="col-sm-4 control-label">Keyword</label>
                 <div class="col-sm-8">
                  <input type="text" class="form-control" placeholder="Keyword" name="keyword" id="keyword">
                 </div> 
              </div>
            </div>
            <div class="clearfix"></div>
            <hr class="hidden-xs"/>
            
           
            <div class="col-md-6">
              <div class="form-group">
                 <label class="col-sm-4 control-label">First Name</label>
                 <div class="col-sm-8">
                  <input type="text" class="form-control" placeholder="First Name" name="first_name" id="first_name">
                 </div> 
              </div>
            </div>
            <div class="clearfix hidden-md hidden-lg"></div>
            <div class="col-md-6">
              <div class="form-group">
                 <label class="col-sm-4 control-label">Last Name</label>
                 <div class="col-sm-8">
                  <input type="text" class="form-control" placeholder="Last Name" name="last_name" id="last_name">
                 </div>
              </div>
            </div>
            <div class="clearfix"></div>
            <hr class="hidden-xs"/>
            <div class="col-md-6">
              <div class="form-group">
                 <label class="col-sm-4 control-label">Title</label>
                 <div class="col-sm-8">
                  <input type="text" class="form-control" placeholder="Title" name="profile_title" id="profile_title">
                 </div> 
              </div>
            </div>
            <div class="clearfix hidden-md hidden-lg"></div>
            <div class="col-md-6">
                <div class="form-group">
                   <label class="col-sm-4 control-label">Company</label>
                   <div class="col-sm-8">
                    <input type="text" class="form-control" placeholder="Company" name="company" id="company">
                    <input name="sea_cmpny_type" type="checkbox" value="c" /> Current experience <br>
                    <input name="sea_cmpny_type" type="checkbox" value="p" /> Past experience
                   </div> 
                </div>
              </div>
            <div class="clearfix"></div><hr class="hidden-xs">
            <div class="advanced_search_data">
              
              <div class="col-md-6">
                <div class="form-group">
                   <label class="col-sm-4 control-label">School Name</label>
                   <div class="col-sm-8">
                    <input type="text" class="form-control" placeholder="School Name" name="school" id="school">
                   </div>
                </div>
              </div>
              <div class="clearfix"></div><hr class="hidden-xs"/>
              <div class="col-md-6">
                <div class="form-group">
                   <label class="col-sm-4 control-label">Country</label>
                   <div class="col-sm-8">
                    <!--<input type="text" class="form-control" placeholder="Country" name="country" id="country">-->
                    <select name="country" id="country" class="form-control">
                      <option value="">Select</option>
                      @if(count($countries)>0)
                        @foreach($countries as $c)
                          <option value="{{$c['printable_name']}}">{{$c['printable_name']}}</option>
                        @endforeach
                      @endif  
                    </select>
                   </div> 
                </div>
              </div>
              <div class="col-md-6">
                <div class="form-group">
                   <label class="col-sm-4 control-label">State</label>
                   <div class="col-sm-8">
                    <input type="text" class="form-control" placeholder="State" name="state" id="state">
                   </div>
                </div>
              </div>
              <div class="clearfix"></div><hr class="hidden-xs"/>
              <div class="col-md-6">
                <div class="form-group">
                   <label class="col-sm-4 control-label">City</label>
                   <div class="col-sm-8">
                    <input type="text" class="form-control" placeholder="City" name="city" id="city">
                   </div> 
                </div>
              </div>
              <div class="col-md-6">
                <div class="form-group">
                   <label class="col-sm-4 control-label">Postal Code</label>
                   <div class="col-sm-8">
                    <input type="text" class="form-control" placeholder="Postal code" name="zip" id="zip">
                   </div>
                </div>
              </div>
              <div class="clearfix"></div><hr class="hidden-xs"/>
              <div class="col-md-6">
                <div class="form-group">
                   <label class="col-sm-4 control-label">Year of Experience</label>
                   <div class="col-sm-8">
                    <input type="text" class="form-control" placeholder="Year of Experience" name="exp" id="exp">
                   </div> 
                </div>
              </div>
              <div class="clearfix"></div><hr class="hidden-xs"/>
              <div class="col-md-6">
                <div class="form-group">
                   <label class="col-sm-4 control-label">Industry</label>
                   <div class="col-sm-8">
                    <?php
                        $option='<option value="">Select Industry</option>';
                        foreach($industry_data as $ind):
//                          $option .='<option value="'.$ind->id.'">'.$ind->name.'</option>'; 
                          $option .='<option value="'.$ind->name.'">'.$ind->name.'</option>'; 
                        endforeach;
                    ?>
                    <select class="form-control" name="industry" id="industry">
                       <?php echo $option; ?>   
                    </select>
                   </div> 
                </div>
              </div>
              <div class="col-md-6">
                <div class="form-group">
                   <label class="col-sm-4 control-label">Skills</label>
                   <div class="col-sm-8">
                    <?php
                        $option='<option value="">Select Skill</option>';
                        foreach($parent_data as $data):
//                          $option .='<option value="'.$data['id'].'">'.$data['name'].'</option>'; 
                          $option .='<optgroup label="'.$data['name'].'">';
                        if(isset($child_data[$data['id']])){
                            foreach($child_data[$data['id']] as $ch_data):
                              $option .='<option value="'.$ch_data['name'].'"> - '.$ch_data['name'].'</option>'; 
                        endforeach;  }
                          $option .='</optgroup>'; 
                        endforeach;
                    ?>
                    <select class="form-control" name="skill" id="skill">
                       <?php echo $option; ?>   
                    </select>
                   </div>
                </div>
              </div>
             
               @if($prof_det->status_business == 'Business' && $prof_det->profile_type=='O')
                 <div class="clearfix"></div><hr class="hidden-xs"/>
                  <div class="col-md-6">
                  <div class="form-group">
                   <label class="col-sm-4 control-label">Revenue</label>
                   <div class="col-sm-8">
                    <input type="text" class="form-control" placeholder="Revenue" name="revenue" id="revenue">
                   </div> 
                  </div>
                </div>
             @endif
             
              @if($prof_det->status_business == 'Finance' && $prof_det->profile_type=='O' && $prof_det->is_approve=='YES')
                <div class="clearfix"></div><hr class="hidden-xs"/>
              <div class="col-md-6">
                <div class="form-group">
                   <label class="col-sm-4 control-label">Revenue</label>
                   <div class="col-sm-8">
                    <input type="text" class="form-control" placeholder="Revenue From" name="revenue_from" id="revenue_from">
                   </div> 
                </div>
              </div>
             @endif
             
              @if($prof_det->status_business == 'Finance'  && $prof_det->is_approve=='YES' && $prof_det->profile_type=='O')
               <div class="col-md-6">
                <div class="form-group">
                   <label class="col-sm-4 control-label">Currency</label>
                   <div class="col-sm-8">
                        <select class="form-control" id="assets_currency" name="assets_currency" >
                           <option value="">Currency</option>
                           <?php foreach($currency_all as $curreny): ?>
                             <option {{(isset($funding_data->assets_currency) && $funding_data->assets_currency == $curreny->id) ? 'selected=selected' : '' }} value="{{$curreny->id}}">{{$curreny->name}}</option>
                           <?php endforeach; ?>
                         </select>
                   </div>
                </div>
               </div>
               @endif
               @if($prof_det->status_business == 'Business'  && $prof_det->profile_type=='O')
               <div class="col-md-6">
                <div class="form-group">
                   <label class="col-sm-4 control-label">Currency</label>
                   <div class="col-sm-8">
                        <select class="form-control" id="assets_currency" name="assets_currency" >
                           <option value="">Currency</option>
                           <?php foreach($currency_all as $curreny): ?>
                             <option {{(isset($funding_data->assets_currency) && $funding_data->assets_currency == $curreny->id) ? 'selected=selected' : '' }} value="{{$curreny->id}}">{{$curreny->name}}</option>
                           <?php endforeach; ?>
                         </select>
                   </div>
                </div>
               </div>
               @endif
               
               @if($prof_det->profile_type=='O')
                <div class="clearfix"></div><hr class="hidden-xs"/>
               @endif
              
                @if($prof_det->status_business == 'Finance'  && $prof_det->is_approve=='YES' && $prof_det->profile_type=='O')
               <div class="col-md-6">
                <div class="form-group">
                   <label class="col-sm-4 control-label">To</label>
                   <div class="col-sm-8">
                    <input type="text" class="form-control" placeholder="Revenue To" name="revenue_to" id="revenue_to">
                   </div> 
                </div>
              </div>
                @endif
                @if($prof_det->status_business == 'Business'  && $prof_det->profile_type=='O')
                <div class="col-md-6">
                <div class="form-group">
                 <label class="col-sm-4 control-label">Units</label>
                 <div class="col-sm-8">
                  <select class="form-control" id="assets_currency_units" name="assets_currency_units">
                  <option value="">Unit</option>
                  <?php foreach($currency_units as $unit): ?>
                    <option {{ (isset($funding_data->assets_currency_units) && $funding_data->assets_currency_units == $unit->id) ? 'selected=selected' : '' }} value="{{$unit->id}}">{{$unit->units}} ({{$unit->amount}})</option>
                  <?php endforeach; ?>
                  </select>
                  </div>
               </div>
              </div>
                 @endif
                @if($prof_det->status_business == 'Finance' && $prof_det->is_approve=='YES' && $prof_det->profile_type=='O')
                <div class="col-md-6">
                <div class="form-group">
                 <label class="col-sm-4 control-label">Units</label>
                 <div class="col-sm-8">
                  <select class="form-control" id="assets_currency_units" name="assets_currency_units">
                  <option value="">Unit</option>
                  <?php foreach($currency_units as $unit): ?>
                    <option {{ (isset($funding_data->assets_currency_units) && $funding_data->assets_currency_units == $unit->id) ? 'selected=selected' : '' }} value="{{$unit->id}}">{{$unit->units}} ({{$unit->amount}})</option>
                  <?php endforeach; ?>
                  </select>
                  </div>
               </div>
              </div>
                 @endif
              <div class="clearfix"></div><hr class="hidden-xs"/>
            </div>
            <div class="searchpage-btns-block">
              <div class="form-group ">
                <input type="hidden" name="req_search_type" id="req_search_type" value="n">
                <button type="button" name="search" value="search" class="btn btn-success close_advanced_search pull-right">Close Advanced Search</button>
                <button type="button" name="search" value="search" class="btn btn-success advanced_search pull-right">Advanced Search</button>
                <button type="submit" name="search" value="search" class="btn btn-success">Search</button>
                <!--<button type="submit" name="search" value="search_save" class="btn btn-success">Save And Search</button>-->
              </div>
            </div>
            @if(count($search_history)>0)
            <div class="mtop20 pull-left">
                <div class="btn-group">
                    <button aria-expanded="false" data-toggle="dropdown" class="btn btn-primary dropdown-toggle" type="button">Saved Searches<span class="caret"></span></button>
                    <ul role="menu" class="dropdown-menu" width="250px">
                      @foreach($search_history as $sh)
                      <li><a href="{{url('/search?history='.$sh->id)}}">{{ucfirst($sh->name)}}</a></li>
                     
                      @endforeach 
                    </ul>
                    
                </div>
                <a href="{{url('/savedsearch')}}" class="btn btn-default">View List</a>
            </div>
            @endif
          </form> 
          
          <div class="modal" id="v" data-backdrop="static">
            <div class="modal-dialog">
            <div class="modal-content">
            <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
            &times;</button>
            <h4 class="modal-title" align="center">Mentor Subject Information</h4>
            </div>
                <div class="modal-body">
                    <form role="form" action="mentor" method="POST"id="mentor_subject">
                    <div class="form-group">
                         <input type="hidden" name="_token" value="{{ csrf_token() }}">
                         <input type="hidden" name="checbox_val" id="checkbox_val" value="">
                       <label for="name">Title :</label>
                       <input type="text" class="form-control" id="mentor_sub" name="mentor_sub" 
                          placeholder="Enter subject">
                    </div> 
                <div class="modal-footer">
            <button type="submit" class="btn btn-primary">Submit</button>

            </div>          
                    </form>
                </div>

            </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
            </div>  
          
          
          
      <div class="clearfix"></div>  </div></div>
  </section>
@endsection
@section('js')
<script src="{{ asset('js/bootstrapValidator.min.js')}}"></script>
<script src="{{ asset('js/maskedinput/jquery.maskedinput.min.js')}}"></script>
<script src="{{ asset('js/validation.js')}}"></script>
@if($history_data)
<script type="text/javascript">
var history_det = JSON.parse('<?php echo json_encode($history_data)?>');
  $.each(history_det, function(key, values) {
      if($('#'+key).length)
        $('#'+key).val(values);
    });
</script>
@endif;
@endsection
