@extends('main')

@section('css')
<link href="{{ asset('/css/bootstrapValidator.min.css')}}" rel="stylesheet">
<link href="{{ asset('/css/jquery.fileupload.css')}}" rel="stylesheet">
<link href="{{ asset('/css/bootstrap-select.css')}}" rel="stylesheet">
<style type="text/css"> 
    #Rasing_Funding{ display: none;}
    .Business{ display: none;}
    #Funding_Businesses{ display: none;}
    .Finance{ display: none;}
</style>
@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">Organization Profile</li>
            </ol>
      @if ($error_msg)
              <div class="alert alert-danger clearfix">
                 <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                   <span aria-hidden="true">&times;</span>
                 </button>
                  {{$error_msg}}
              </div>
          @endif
          @if ($succ_msg)
              <div class="alert alert-success clearfix">
                 <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                   <span aria-hidden="true">&times;</span>
                 </button>
                  {{$succ_msg}}
              </div>
          @endif
        <!--<div class="col-sm-12">
          <h1 class="heading">Advertising Agency</h1>
        </div>-->

        <div class="clearfix"></div>
      <div class="row talent_profile">
         
          
        <div class="col-md-12">
            <div class="profile_edit org-profile-edit">
              <div class="col-sm-6">  
                <!--@if($prof_det->private || strpos($prof_det->private_permission,'B,') ===false)-->
                  <form method="post" id="nameForm" name="nameForm">
                      <input type="hidden" name="_token" value="{{ csrf_token() }}">
                      <input type="hidden" name="save_type" value="name">
                      <div class="panel panel-default">
                        <div class="panel-body row">
                          <div class="col-sm-6 col-xs-6">
                            <h3>Name</h3>
                          </div>
                        @if($prof_det->private)
                          <!--@if(strpos($prof_det->private_permission,'B,') === false)
                            <a href="{{url('/profile_permision/'.$prof_det->id.'?lock=B')}}"><i class="fa fa-unlock"></i></a>
                          @else
                            <a href="{{url('/profile_permision/'.$prof_det->id.'?unlock=B')}}"><i class="fa fa-lock"></i></a>
                          @endif-->
                          <div class="col-sm-6 col-xs-6">
                            <div class="talent_show" href="javascript:void(0)"> 
                              @if($prof_det->name)
                                <i class="fa fa-pencil"></i><span>Edit</span>
                              @else
                               <span class="prof_plus-icon"> <i class="fa fa-plus"></i></span><span>You can add your name here</span>
                              @endif
                            </div>
                          </div>
                        @endif
                          <div class="clearfix"></div>
                          <div class="profile_display_data">
                            <div class="col-sm-12">
                              {{$prof_det->name}}
                            </div>
                          </div>
                          <div class="profile_edit_data">
                              <div class="col-sm-8">
                              <!--  <textarea name="name" id="name" limit="255" rows="4" class="form-control" placeholder="You can add your name here">{{$prof_det->name}}</textarea>-->
                                <input type="text" name="name" id="name" maxlength="255" class="form-control" placeholder="You can add your name here" value="{{$prof_det->name}}">
                              </div>
                              <div class="col-sm-4 org_prof-btn-block">
                                <button type="submit" name="submit_name" id="submit_name" value="skill" class="btn talent_close">Save</button>
                                <button type="button" class="btn talent_close_open">Cancel</button>
                              </div>
                          </div>
                        </div>
                      </div>
                  </form>
              <!-- @endif  -->
              @if($prof_det->private || strpos($prof_det->private_permission,'A,') ===false || (isset($prof_det->full_profile) && $prof_det->full_profile))
                  <form method="post" id="aboutusForm" name="aboutusForm">
                      <input type="hidden" name="_token" value="{{ csrf_token() }}">
                      <input type="hidden" name="save_type" value="aboutus">
                      <div class="panel panel-default">
                        <div class="panel-body row">
                          <div class="col-sm-6 col-xs-6">
                            <h3 class="pull-left">About us<span class="profile-loc-icon">  @if($prof_det->private)                            
                              @if(strpos($prof_det->private_permission,'A,') === false)
                                <a href="{{url('/profile_permision/'.$prof_det->id.'?lock=A')}}" class="lock_unlock"><i class="fa fa-unlock"></i></a>
                              @else
                                <a href="{{url('/profile_permision/'.$prof_det->id.'?unlock=A')}}" class="lock_unlock"><i class="fa fa-lock"></i></a>
                              @endif
                            @endif     </span></h3>
                           
                          </div>
                        @if($prof_det->private)
                          <div class="col-sm-6 col-xs-6">
                            <div class="talent_show" href="javascript:void(0)"> 
                              @if($prof_det->about_us)
                                <i class="fa fa-pencil"></i><span>Edit</span>
                              @else
                               <span class="prof_plus-icon"> <i class="fa fa-plus"></i></span><span>You can add about us here</span>
                              @endif
                            </div>
                          </div>
                        @endif  
                          <div class="clearfix"></div>
                          <div class="profile_display_data">
                            <div class="col-sm-12">
                              {{$prof_det->about_us}}
                            </div>
                          </div>
                          <div class="profile_edit_data">
                              <div class="col-sm-8">
                                <textarea name="aboutus" id="aboutus" limit="255" rows="4" class="form-control" placeholder="You can add about us here">{{$prof_det->about_us}}</textarea>
                              </div>
                              <div class="col-sm-4 org_prof-btn-block">
                                <button type="submit" name="submit_aboutus" id="submit_aboutus" value="aboutus" class="btn talent_close">Save</button>
                                <button type="button" class="btn talent_close_open">Cancel</button>
                              </div>
                          </div>
                        </div>
                      </div>
                  </form>
              @endif  
              @if($prof_det->private || strpos($prof_det->private_permission,'P,') ===false || (isset($prof_det->full_profile) && $prof_det->full_profile))
                  <form method="post" id="pservicesForm" name="pservicesForm">
                      <input type="hidden" name="_token" value="{{ csrf_token() }}">
                      <input type="hidden" name="save_type" value="products_services">
                      <div class="panel panel-default">
                        <div class="panel-body row">
                          <div class="col-sm-6 col-xs-6">
                            <h3 class="pull-left">Products / Services <span class="profile-loc-icon">  @if($prof_det->private)                            
                              @if(strpos($prof_det->private_permission,'P,') === false)
                                <a href="{{url('/profile_permision/'.$prof_det->id.'?lock=P')}}" class="lock_unlock"><i class="fa fa-unlock"></i></a>
                              @else
                                <a href="{{url('/profile_permision/'.$prof_det->id.'?unlock=P')}}" class="lock_unlock"><i class="fa fa-lock"></i></a>
                              @endif
                            @endif  </span></h3>
                           
                          </div>
                        @if($prof_det->private)
                          <div class="col-sm-6 col-xs-6">
                            <div class="talent_show" href="javascript:void(0)"> 
                              @if($prof_det->products_services)
                                <i class="fa fa-pencil"></i><span>Edit</span>
                              @else
                               <span class="prof_plus-icon"> <i class="fa fa-plus"></i></span><span>Add description here</span>
                              @endif
                            </div>
                          </div>
                        @endif    
                          <div class="clearfix"></div>
                          <div class="profile_display_data">
                            <div class="col-sm-12">
                              {{$prof_det->products_services}}
                            </div>
                          </div>
                          <div class="profile_edit_data">
                              <div class="col-sm-8">
                                <textarea name="products_services" id="products_services" limit="255" rows="4" class="form-control" placeholder="You can add your description here">{{$prof_det->products_services}}</textarea>
                              </div>
                              <div class="col-sm-4 org_prof-btn-block">
                                <button type="submit" name="submit_products_services" id="submit_products_services" value="whyus" class="btn talent_close">Save</button>
                                <button type="button" class="btn talent_close_open">Cancel</button>
                              </div>
                          </div>
                        </div>
                      </div>
                  </form>
              @endif  
              @if($prof_det->private || strpos($prof_det->private_permission,'L,') ===false || (isset($prof_det->full_profile) && $prof_det->full_profile))
                  <form method="post" id="locationForm" name="locationForm">
                      <input type="hidden" name="_token" value="{{ csrf_token() }}">
                      <input type="hidden" name="save_type" value="location">
    
                    <div class="panel panel-default">
                      <div class="panel-body row">
                        <div class="col-sm-6 col-xs-6">
                          <h3 class="pull-left">Location(s) <span class="profile-loc-icon">@if($prof_det->private)                            
                            @if(strpos($prof_det->private_permission,'L,') === false)
                              <a href="{{url('/profile_permision/'.$prof_det->id.'?lock=L')}}" class="lock_unlock"><i class="fa fa-unlock"></i></a>
                            @else
                              <a href="{{url('/profile_permision/'.$prof_det->id.'?unlock=L')}}" class="lock_unlock"><i class="fa fa-lock"></i></a>
                            @endif
                          @endif     </span></h3>
                            
                        </div>
                      @if($prof_det->private)
                        <div class="col-sm-6 col-xs-6">
                          <div class="talent_show add_location" href="javascript:void(0)"><span class="prof_plus-icon"><i class="fa fa-plus"></i></span><span>You can add locations here</span></div>
                        </div>
                      @endif  
                        <div class="clearfix"></div>
                        <div class="profile_display_data"> 
                          @foreach($profile_loc as $loc)
                            <div class="col-sm-12 alert-warning">
                              <div>
                                <ul>
                                  <li>{{$loc['loc_name']}}</li>
                                  <li>{{$loc['loc_number']}}</li>
                                  <li>{{$loc['loc_street']}}</li>
                                  <li>{{$loc['loc_city']}}</li>
                                  <li>{{$loc['loc_state']}}</li>
                                  <li>{{$loc['loc_zip']}}</li>
                                  <li>{{$loc['loc_country']}}</li>
                                  <li>{{$loc['loc_description']}}</li>
                                </ul>
                              @if($prof_det->private)
                                <div class="edit_btns">
                                 <button type="button" class='pull-right btn btn-primary delete' data-parent="{{$prof_det->id}}" data-type="loc" data-value="{{$loc['id']}}">Delete</button>&nbsp; &nbsp;
                                 <button type="button" class='pull-right btn btn-primary loc_edit' data-parent="{{$prof_det->id}}" data-type="loc" data-id="{{$loc['id']}}">Edit</button>
                                </div>
                              @endif  
                              </div>
                            </div>
                          @endforeach
                        </div>
                        <div class="profile_edit_data">
                          <div class="col-sm-8">
                            <ul>
                              <li>
                              <div class="form-group">
                                <input class="form-control" type="text" placeholder="Name"  name="loc_name" id="loc_name">
                              </div>
                              </li>
                              <li>
                              <div class="form-group">
                                <input class="form-control" type="text" placeholder="N?" name="loc_number" id="loc_number">
                              </div>
                              </li>
                              <li>
                              <div class="form-group">
                                <input class="form-control" type="text" placeholder="Street, Avenue, etc." name="loc_street" id="loc_street">
                              </div>
                              </li>
                              <li>
                              <div class="form-group">
                                <input class="form-control" type="text" placeholder="City" name="loc_city" id="loc_city">
                              </div>
                              </li>
                              <li>
                              <li>
                                <div class="form-group">
                                  <input class="form-control" type="text" placeholder="State" name="loc_state" id="loc_state">
                                </div>
                              </li>
                              <li>
                                <div class="form-group">
                                  <input class="form-control" type="text" placeholder="Postal Code" name="loc_zip" id="loc_zip">
                                </div>
                              </li>
                              <div class="form-group">
                                <!--<input class="form-control" type="text" placeholder="Country" name="loc_country" id="loc_country">-->
                                <select name="loc_country" id="loc_country" class="form-control country-selectbox">
                                  <option value="">Country</option>
                                  @if(count($countries)>0)
                                    @foreach($countries as $c)
                                     <option value="{{$c['printable_name']}}" <?php if(!empty($loc['loc_country'])){if($c['printable_name']==$loc['loc_country'])echo 'selected="selected"';}?>>{{$c['printable_name']}}</option>
                                    @endforeach
                                  @endif  
                                </select>
                              </div>
                              <div class="clearfix"></div>
                              </li>
                              <li>
                              <div class="form-group">
                                <textarea limit="255" rows="2" class="form-control" placeholder="Description" name="loc_description" id="loc_description"></textarea>
                              </div>  
                              </li>
                            </ul>
                              </div>
                           <div class="col-sm-4 org_prof-btn-block">
                        <button type="submit" name="submit_education" id="submit_awards" value="awards" class="btn talent_close">Save</button>
                        <button type="button" class="btn talent_close_open">Cancel</button>
                      </div>
                          
                         <!-- <div class="col-sm-4"><a class="tp_add_image" href="javascript:void(0)"> <i class="fa fa-plus"></i><span>Add Image</span></a> </div>-->
                        </div>
                      </div>
                    </div>
                  </form> 
              @endif  
              @if($prof_det->private || strpos($prof_det->private_permission,'AW,') ===false || (isset($prof_det->full_profile) && $prof_det->full_profile))
              <form method="post" id="awardsForm" name="awardsForm">
                  <input type="hidden" name="_token" value="{{ csrf_token() }}">
                  <input type="hidden" name="save_type" value="awards">
                <div class="panel panel-default">
                  <div class="panel-body row">
                    <div class="col-sm-6 col-xs-6">
                      <h3 class="pull-left">Awards <span class="profile-loc-icon"> @if($prof_det->private)
                        @if(strpos($prof_det->private_permission,'AW,') === false)
                          <a href="{{url('/profile_permision/'.$prof_det->id.'?lock=AW')}}" class="lock_unlock"><i class="fa fa-unlock"></i></a>
                        @else
                          <a href="{{url('/profile_permision/'.$prof_det->id.'?unlock=AW')}}" class="lock_unlock"><i class="fa fa-lock"></i></a>
                        @endif
                      @endif  <span></h3>
                      
                    </div>
                  @if($prof_det->private)
                    <div class="col-sm-6 col-xs-6">
                      <div class="talent_show add_awards" href="javascript:void(0)"> <span class="prof_plus-icon"><i class="fa fa-plus"></i></span><span>You can add your awards here</span></div>
                    </div>
                  @endif    
                    <div class="clearfix"></div>
                    <div class="profile_display_data"> 
                      @foreach($profile_aw as $aw)
                        <div class="col-sm-12 alert-warning">
                          <div>
                            <ul>
                              <li>
                                @if($aw['from_date'])
                                {{$aw['from_date']}}
                                @endif
                              </li>
                              <li>{{$aw['aw_company']}}</li>
                              <li>{{$aw['aw_description']}}</li>
                              <li>{{$aw['aw_location']}}</li>
                            </ul>
                        @if($prof_det->private)
                            <div class="edit_btns">
                             <button type="button" class='pull-right btn btn-primary delete' data-parent="{{$prof_det->id}}" data-type="aw" data-value="{{$aw['id']}}">Delete</button>&nbsp; &nbsp;
                             <button type="button" class='pull-right btn btn-primary aw_edit' data-parent="{{$prof_det->id}}" data-type="aw" data-id="{{$aw['id']}}">Edit</button>
                            </div>
                        @endif    
                          </div>
                        </div>
                      @endforeach
                    </div>
                    <div class="profile_edit_data">
                      <div class="col-sm-8">
                        <ul>
                          <li><span>Award </span>
                            <div class="form-group">
                              <select class="form-control" name="aw_from_mm" id="aw_from_mm">
                                <option value="">Month</option>
                                <?php
                                for($m=1; $m<=12; ++$m):
                                   $m_name = date('F', mktime(0, 0, 0, $m, 1)); 
                                  echo '<option value="'.$m_name.'">'.$m_name.'</option>';
                                endfor;
                                ?>
                              </select>
                              <select class="form-control" name="aw_from_yy" id="aw_from_yy">
                                <option value="">Year</option>
                                <?php
                                  for($y=date('Y'); $y>=date('Y')-90; --$y):
                                    echo '<option>'.$y.'</option>';
                                  endfor;
                                ?>
                              </select>
                            </div>
                              <div class="clearfix"></div>
                          </li>
                          <li>
                          <div class="form-group">
                            <input class="form-control" type="text" placeholder="Location" name="aw_location" id="aw_location">
                            </div>
                          </li>
                          <li>
                          <div class="form-group">
                            <input class="form-control" type="text" placeholder="Name of company/project/collective..." name="aw_company" id="aw_company">
                            </div>
                          </li>
                          <li>
                          <div class="form-group">
                            <textarea limit="255" rows="2" class="form-control" placeholder="Description" name="aw_description" id="aw_description"></textarea>
                            </div>
                          </li>
                        </ul>
                      </div>
                      <div class="col-sm-4 org_prof-btn-block">
                        <button type="submit" name="submit_education" id="submit_awards" value="awards" class="btn talent_close">Save</button>
                        <button type="button" class="btn talent_close_open">Cancel</button>
                      </div>
                    </div>
                  </div>
                </div>
               </form> 
              @endif
              <?php //echo $prof_det->id; echo Session::get('auth_selected_profile'); ?>
               @if($prof_det->is_approve=='NO' && ($prof_det->id != Session::get('auth_selected_profile')) && $prof_det->status_business != 'Business')
               <div class="panel panel-default">
                  <div class="panel-body row">
                    <div class="col-sm-12">
                      <h3 class="pull-left">Status</h3>
                      <div class="clearfix"></div>
                     <div class="col-sm-12">    
                         <div class="talent_show" style="color:red">                        
                        Sorry! You cannot view the business details of organization until it is approved by Administrator </div>
                     </div>                   
                    
                    </div>
                  </div>
               </div>
               @endif
              </div>
                
               
                    
              <div class="col-sm-6"> 
                @if($prof_det->private || strpos($prof_det->private_permission,'W,') ===false || (isset($prof_det->full_profile) && $prof_det->full_profile))
                  <form method="post" id="whyusForm" name="whyusForm">
                      <input type="hidden" name="_token" value="{{ csrf_token() }}">
                      <input type="hidden" name="save_type" value="whyus">
                      <div class="panel panel-default">
                        <div class="panel-body row">
                          <div class="col-sm-6 col-xs-6">
                            <h3 class="pull-left">Why us <span class="profile-loc-icon">  @if($prof_det->private)                            
                              @if(strpos($prof_det->private_permission,'W,') === false)
                                <a href="{{url('/profile_permision/'.$prof_det->id.'?lock=W')}}" class="lock_unlock"><i class="fa fa-unlock"></i></a>
                              @else
                                <a href="{{url('/profile_permision/'.$prof_det->id.'?unlock=W')}}" class="lock_unlock"><i class="fa fa-lock"></i></a>
                              @endif
                            @endif    </span></h3>
                          
                          </div>
                        @if($prof_det->private)
                          <div class="col-sm-6 col-xs-6">
                            <div class="talent_show" href="javascript:void(0)"> 
                              @if($prof_det->why_us)
                                <i class="fa fa-pencil"></i><span>Edit</span>
                              @else
                                <span class="prof_plus-icon"><i class="fa fa-plus"></i></span><span>You can add description here</span>
                              @endif
                            </div>
                          </div>
                        @endif    
                          <div class="clearfix"></div>
                          <div class="profile_display_data">
                            <div class="col-sm-12">
                              {{$prof_det->why_us}}
                            </div>
                          </div>
                          <div class="profile_edit_data">
                              <div class="col-sm-8">
                                <textarea name="whyus" id="whyus" limit="255" rows="4" class="form-control" placeholder="You can add your description here">{{$prof_det->why_us}}</textarea>
                              </div>
                              <div class="col-sm-4 org_prof-btn-block">
                                <button type="submit" name="submit_whyus" id="submit_whyus" value="whyus" class="btn talent_close">Save</button>
                                <button type="button" class="btn talent_close_open">Cancel</button>
                              </div>
                          </div>
                        </div>
                      </div>
                  </form>
                @endif 
                
                @if($prof_det->private || strpos($prof_det->private_permission,'Cont,') ===false || (isset($prof_det->full_profile) && $prof_det->full_profile))
                  <form method="post" id="contactinfoForm" name="contactinfoForm">
                      <input type="hidden" name="_token" value="{{ csrf_token() }}">
                      <input type="hidden" name="save_type" value="contact_info">
                      <div class="panel panel-default">
                        <div class="panel-body row">
                          <div class="col-sm-6 col-xs-6">
                            <h3 class="pull-left">Contact Info <span class="profile-loc-icon">  @if($prof_det->private)                            
                              @if(strpos($prof_det->private_permission,'Cont,') === false)
                                <a href="{{url('/profile_permision/'.$prof_det->id.'?lock=Cont')}}" class="lock_unlock"><i class="fa fa-unlock"></i></a>
                              @else
                                <a href="{{url('/profile_permision/'.$prof_det->id.'?unlock=Cont')}}" class="lock_unlock"><i class="fa fa-lock"></i></a>
                              @endif
                            @endif </span></h3>
                              
                          </div>
                        @if($prof_det->private)
                          <div class="col-sm-6 col-xs-6">
                            <div class="talent_show" href="javascript:void(0)"> 
                              @if($prof_det->contact_info)
                                <i class="fa fa-pencil"></i><span>Edit</span>
                              @else
                                <span class="prof_plus-icon"><i class="fa fa-plus"></i></span><span>You can add contact information here</span>
                              @endif
                            </div>
                          </div>
                        @endif  
                          <div class="clearfix"></div>
                          <div class="profile_display_data">
                            <div class="col-sm-12">
                              {{$prof_det->contact_info}}
                            </div>
                          </div>
                          <div class="profile_edit_data">
                              <div class="col-sm-8">
                                <textarea name="contact_info" id="contact_info" limit="255" rows="4" class="form-control" placeholder="You can add contact information here">{{$prof_det->contact_info}}</textarea>
                              </div>
                              <div class="col-sm-4 org_prof-btn-block">
                                <button type="submit" name="submit_contact_info" id="submit_contact_info" value="contact_info" class="btn talent_close">Save</button>
                                <button type="button" class="btn talent_close_open">Cancel</button>
                              </div>
                          </div>
                        </div>
                      </div>
                  </form>
              @endif  
                <!-- @if($prof_det->private)
                  <form method="post" id="fundingForm" name="fundingForm">
                      <input type="hidden" name="_token" value="{{ csrf_token() }}">
                      <input type="hidden" name="save_type" value="fundingForm">
                      <div class="panel panel-default">
                        <div class="panel-body row">
                          <div class="col-sm-12">
                           Are you Interested in Raising Funding or Finding Businesses that Need Funding 
                           <div class="form-group"><br>
                            <input type="radio" name="funding_type" class="show-funding" checked="true" value="1"> Rasing Funding (Selected)<br><br>
                            <input type="radio" name="funding_type" class="show-funding" value="2"> Funding Businesses<br><br>
                            <input type="radio" name="funding_type" class="show-funding" value="0"> No<br><br>
                           </div>
                          </div>
                        </div>
                      </div>
                  </form>
                @endif -->  
                
              </div>
              @if($prof_det->private || $funding_data || $fb_data)
                    
              <div class="clear"></div>
        <div class="clearfix"></div>  
              <div class="col-md-12">  
        <div class="clearfix"></div>        
                <div role="tabpanel">
                    <input type="hidden" id="bus_val" name="bus_val" value="<?php echo $prof_det->status_business; ?>">
                    <span id="raise_fun" style="display: none;">  <input type="checkbox" value="1" name="rasing_funding" id="rasing_funding" data-cat="{{$prof_det->id}}" <?php if($prof_det->is_interest=='YES'){echo 'checked="checked"';}?>>&nbsp;Interested to Raise Funding</span>
                    <span id="fund_business" style="display: none;">  <input type="checkbox" value="1" name="funding_businesses" id="funding_businesses" data-cat="{{$prof_det->id}}" <?php if($prof_det->is_interest=='YES'){echo 'checked="checked"';}?>>&nbsp;Funds Businesses</span>
                 
                    <!-- Nav tabs -->
                 
                  {{--*/ 
                      $funding = array('1'=>'Raise Funding','2'=>'Funding Businesses'); 
                      $funding_content = array('1'=>'Rasing_Funding','2'=>'Funding_Businesses');  
                      $funding_files = array('1'=>'funding','2'=>'funding','0'=>'funding');
                      $funding_active='';
                      $funding_content_active = '';
                  /*--}}
                  <?php //print_r($prof_det->toArray()) ?>
                   <?php //print_r($prof_det->status_business) ?>
                  <ul class="nav nav-tabs <?php if($prof_det->status_business == 'Business'){echo "Business";}else{echo "Finance";}?>" role="tablist">
                  <?php $val = ''; $res='';
                  //echo $prof_det->status_business;
                  if($prof_det->status_business == 'Business')
                      $val = $prof_det->funding = 1;
                  else
                      $val = $prof_det->funding = 2;                  
                   ?>
                      <?php if($prof_det->is_approve=='YES' && $prof_det->status_business == 'Finance')
                      {
                        $res = $prof_det->private." || ".$prof_det->funding;
                      }
                      else if($prof_det->is_approve=='NO' && $prof_det->status_business == 'Business')
                      {
                        $res = $prof_det->private." || ".$prof_det->funding;
                      }
                      else
                      {
                        $res = $prof_det->private;
                      }
                     ?>
                      <?php //echo $res ; exit; ?>
                    @if($res)                     
                       <li role="presentation" class="{{{$prof_det->funding==$val ? 'active' : ''}}}">
                        <a href="#{{$funding_content[$val]}}" class="tab_sel_funding" data-value="{{$val}}" aria-controls="{{$funding[$val]}}" role="tab" data-toggle="tab">{{$funding[$val]}}</a>
                      </li>                     
                    @endif 
                  </ul>
                  <!-- Tab panes -->
                  <div class="tab-content">
                    <?php //print_r($funding_content[$val]); ?>
                      @if($prof_det->private)
                        <div role="tabpanel" class="tab-pane {{{$prof_det->funding==$val ? 'active' : ''}}}" id="{{$funding_content[$val]}}">@include('profile.'.$funding_files[$val],array('funding'=>$val))</div>
                      @else
                      
                        <div role="tabpanel" class="tab-pane {{{$prof_det->funding==$val ? 'active' : ''}}}" id="{{$funding_content[$val]}}">@include('profile.'.$funding_files[$val]."_public",array('funding'=>$val))</div>
                      @endif
                  </div>
                  <!-- END Tab panes -->

                </div>
              </div>  
              @endif
              
            </div>
        </div>
      </div>
    </div>
  </section>

<!-- Modal -->
<div class="modal fade" id="popup" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
         <iframe src="" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen width="600" height="400" id="modal-iframe"></iframe>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" id="modal-close" >Close</button>
      </div>
    </div>
  </div>
</div>
  

  @endsection

@section('js')
<script src="{{ asset('js/bootstrapValidator.min.js')}}"></script>
<script src="{{ asset('js/bootbox.js')}}"></script>
<script src="{{ asset('js/maskedinput/jquery.maskedinput.min.js')}}"></script>
<script src="{{ asset('js/validation.js')}}"></script>

<script src="{{ asset('js/vendor/jquery.ui.widget.js')}}"></script>
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
<script src="{{ asset('js/jquery.iframe-transport.js')}}"></script>
<!-- The basic File Upload plugin -->
<script src="{{ asset('js/jquery.fileupload.js')}}"></script>
<!-- The File Upload processing plugin -->
<script src="{{ asset('js/jquery.fileupload-process.js')}}"></script>
<!-- The File Upload validation plugin -->
<script src="{{ asset('js/jquery.fileupload-validate.js')}}"></script>
<script src="{{ asset('js/bootstrap-select.js')}}"></script>
<script type="text/javascript">

  var locations = JSON.parse('<?php echo json_encode($profile_loc)?>');
  var awards = JSON.parse('<?php echo json_encode($profile_aw)?>');

  $(document).on('click','.add_location',function(){
    $("#locationForm").attr("action", '');
    $("#locationForm")[0].reset();   
  });

  /* video popup*/
  $(document).on('click','.popup',function(){
         $('#modal-iframe').attr('src',$(this).attr('iframe-src'))
         $('#popup').modal('show');
   });

  $("#modal-close").click(function(){
      $('#modal-iframe').attr('src',"");
      $('#popup').modal('hide');
  })

  /*$(document).on('click','.tab_sel_funding',function(){
    $("#sel_funding_type").val($(this).attr('data-value'));
  });*/
  /* video popup*/
  $(document).on('click','.loc_edit',function(){
    parent = $(this).attr('data-parent');
    type = $(this).attr('data-type');
    value = $(this).attr('data-id');
    loc_data = locations[value];  
    $.each(loc_data, function(key, values) {
      if($('#'+key).length)
        $('#'+key).val(values);
    });
    action = '/profiles/'+parent+'/edit/'+type+'/'+value;
    $("#locationForm").attr("action", action);
//    $(this).parent().parent().parent().parent().parent().children('.profile_edit_data').slideDown(600);
    $(this).parent().parent().parent().parent().parent().children('.profile_edit_data').show();
    $(this).parent().parent().parent().parent().parent().children('.profile_display_data').hide();
    //$('.talent_show').hide();
  });

$(document).on('click','.add_awards',function(){
    $("#awardsForm").attr("action", '');
    $("#awardsForm")[0].reset();   
   });

  $(document).on('click','.aw_edit',function(){
    parent = $(this).attr('data-parent');
    type = $(this).attr('data-type');
    value = $(this).attr('data-id');
    aw_data = awards[value];  
    console.log(aw_data);
    $.each(aw_data, function(key, values) {
      if($('#'+key).length)
        $('#'+key).val(values);
    });
    action = '/profiles/'+parent+'/edit/'+type+'/'+value;
    $("#awardsForm").attr("action", action);
//    $(this).parent().parent().parent().parent().parent().children('.profile_edit_data').slideDown(600);
    $(this).parent().parent().parent().parent().parent().children('.profile_edit_data').show();
    $(this).parent().parent().parent().parent().parent().children('.profile_display_data').hide();
    //$('.talent_show').hide();
  });

  $(document).on('click','.delete',function(){
    parent = $(this).attr('data-parent');
    type = $(this).attr('data-type');
    type_id = $(this).attr('data-value');
    location.href='/profiles/'+parent+'/delete/'+type+'/'+type_id;
  });

  $(document).ready(function(){
    // default open
   /* parent = '#funding'+$('input.show-funding:checked').val();
    $(parent).fadeIn(0);

    $(document).on('click','.show-funding',function(){
      $('.funding-block').fadeOut(0);
      parent = '#funding'+$(this).val();
      $(parent).fadeIn(0);
    });   */   
  })

$(function () {
  //$('.progress').hide();
    // Submit fund raising form
    /*$('#fundFormSubmit').on('click', function(e){//alert('{{ $action_url }}');

      e.preventDefault();
      
      // handle through ajax
      $.ajax({
        type: "POST",
        url: "{{ $action_url }}",
        data: $('#fundForm').serializeArray(),
        success: function(retVal){
          $('#_fb_id').val(retVal);
          //location.href= location.href;
          //alert(retVal);
        }
      });

    });*/
    //$('.progress').fadeOut(0);

    'use strict';
    // Change this to the location of your server-side upload handler:
    var url = "{{ url('profile/pplajaxupload/prev_profit_loss', $parameters = [], $secure = null) }}";
    $('#prev_profit_loss').fileupload({
        url: url,
        dataType: 'json',
        //acceptFileTypes: /(\.|\/)(docx?|pdf)$/i,
        acceptFileTypes: /(\.|\/)(docx?|pdf|txt|xls|xlsx|ppt|pptx)$/i,
        done: function (e, data) {
          //console.log(data);
          //console.log(data.files);
            $.each(data.result.prev_profit_loss, function (index, file) {
                if (file.url) {
                  //$('<p/>').text(file.name).appendTo('#files');
                }

                if (file.deleteUrl) {
                  //alert(file.deleteUrl);
                  $('#prev_profit_loss').prop('disabled', true);
                  $('<p/>').html(data.files[0].name+'<input type="hidden" name="final_ppl" value="'+file.name+'|'+file.url+'|'+file.deleteUrl+'|'+data.files[0].name+'" /> - <span class="pplremoveTh text-danger" style="cursor:pointer" data-url="'+file.deleteUrl+'">remove</span>').appendTo('#ppl_files');
                  $('.pplremoveTh').on('click', function(e){
                    $.ajax({
                      type: 'DELETE',
                      url: $(this).attr('data-url'),
                      data: '_token='+$('input[name=_token]').val(),
                      dataType: 'json',
                      context: this,
                      success: function(retVal){
                        //alert(retVal);
                        $(this).parent().remove();
                        $('#prev_profit_loss').prop('disabled', false);
                        $('#ppl_progress').fadeOut(0);
                      }
                    });
                  })                  
                }

            });lship_team_file
        },
        processfail: function (e, data) {
          //alert(data.files[data.index].name + "\n" + data.files[data.index].error);
          $("#prev_profit_loss_error").html('The attachment must be a file of type: doc, docx, pdf, txt, xls, xlsx, ppt')
;
        },
        progressall: function (e, data) {
            $('#prev_profit_loss').prop('disabled', true);
            $("#prev_profit_loss_error").html('');
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $('#ppl_progress').fadeIn(0);
            $('#ppl_progress .progress-bar').css(
                'width',
                progress + '%'
            );
          
        },
        formData: function (form) {
            return form.serializeArray();
        }
    }).prop('disabled', !$.support.fileInput)
        .parent().addClass($.support.fileInput ? undefined : 'disabled');
    /*------------------------------------------------------------------------------------------
    | Upload Handler for Next Profit & Loss
    */
    var url = "{{ url('profile/pplajaxupload/next_profit_loss', $parameters = [], $secure = null) }}";
    $('#next_profit_loss').fileupload({
        url: url,
        dataType: 'json',
        //acceptFileTypes: /(\.|\/)(docx?|pdf)$/i,
        acceptFileTypes: /(\.|\/)(docx?|pdf|txt|xls|xlsx|ppt|pptx)$/i,

        done: function (e, data) {
            $.each(data.result.next_profit_loss, function (index, file) {
                if (file.deleteUrl) {
                  $('#next_profit_loss').prop('disabled', true);
                  $('<p/>').html(data.files[0].name+'<input type="hidden" name="final_npl" value="'+file.name+'|'+file.url+'|'+file.deleteUrl+'|'+data.files[0].name+'" /> - <span class="nplremoveTh text-danger" style="cursor:pointer" data-url="'+file.deleteUrl+'">remove</span>').appendTo('#nppl_files');
                  $('.nplremoveTh').on('click', function(e){
                    $('#nppl_progress .progress-bar').css('width', '0');
                    $.ajax({
                      type: 'DELETE',
                      url: $(this).attr('data-url'),
                      data: '_token='+$('input[name=_token]').val(),
                      dataType: 'json',
                      context: this,
                      success: function(retVal){
                        //alert(retVal);
                        $(this).parent().remove();
                        $('#next_profit_loss').prop('disabled', false);
                        $('#nppl_progress').fadeOut(0);
                      }
                    });
                  })                  
                }

            });
        },
        processfail: function (e, data) {
          //alert(data.files[data.index].name + "\n" + data.files[data.index].error);
          $("#next_profit_loss_error").html('The attachment must be a file of type: doc, docx, pdf, xls, xlsx, txt, ppt, pptx');

        },
        progressall: function (e, data) {
            $("#next_profit_loss_error").html('');
            $('#next_profit_loss').prop('disabled', true);
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $('#nppl_progress').fadeIn(0);
            $('#nppl_progress .progress-bar').css(
                'width',
                progress + '%'
            );
        },
        formData: function (form) {
            return form.serializeArray();
        }
    }).prop('disabled', !$.support.fileInput)
        .parent().addClass($.support.fileInput ? undefined : 'disabled');

    /*------------------------------------------------------------------------------------------
    | Upload Handler for Leadership Team
    */
    var url = "{{ url('profile/pplajaxupload/lship_team_file', $parameters = [], $secure = null) }}";
    $('#lship_team_file').fileupload({
        url: url,
        dataType: 'json',
        //acceptFileTypes: /(\.|\/)(docx?|pdf)$/i,
        acceptFileTypes: /(\.|\/)(docx?|pdf|txt|xls|xlsx|ppt|pptx)$/i,


        done: function (e, data) {
            $.each(data.result.lship_team_file, function (index, file) {
                if (file.deleteUrl) {
                  $('#lship_team_file').prop('disabled', true);
                  $('<p/>').html(data.files[0].name+'<input type="hidden" name="final_ltf" value="'+file.name+'|'+file.url+'|'+file.deleteUrl+'|'+data.files[0].name+'" /> - <span class="ltfremoveTh text-danger" style="cursor:pointer" data-url="'+file.deleteUrl+'">remove</span>').appendTo('#lship_files');
                  $('.ltfremoveTh').on('click', function(e){
                    $('#lship_progress .progress-bar').css('width', '0');
                    $.ajax({
                      type: 'DELETE',
                      url: $(this).attr('data-url'),
                      data: '_token='+$('input[name=_token]').val(),
                      dataType: 'json',
                      context: this,
                      success: function(retVal){
                        //alert(retVal);
                        $(this).parent().remove();
                        $('#lship_team_file').prop('disabled', false);
                        $('#lship_progress').fadeOut(0);
                      }
                    });
                  })                  
                }

            });
        },
        processfail: function (e, data) {
          //alert(data.files[data.index].name + "\n" + data.files[data.index].error);
          $("#lship_team_file_error").html('The attachment must be a file of type: doc, docx, pdf, txt, xls, xlsx, ppt');
        },
        progressall: function (e, data) {
            $('#lship_team_file').prop('disabled', true);
            $("#lship_team_file_error").html('');
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $('#lship_progress').fadeIn(0);
            $('#lship_progress .progress-bar').css(
                'width',
                progress + '%'
            );
        },
        formData: function (form) {
            return form.serializeArray();
        }
    }).prop('disabled', !$.support.fileInput)
        .parent().addClass($.support.fileInput ? undefined : 'disabled');                


    /*------------------------------------------------------------------------------------------
    | Upload Handler for Assets Pics
    */
    var url = "{{ url('profile/pplajaxupload/assets_pics', $parameters = [], $secure = null) }}";
    $('#assets_pics').fileupload({
        url: url,
        dataType: 'json',
        acceptFileTypes: /(\.|\/)(jpe?g|gif|png)$/i,
        sequentialUploads: true,
        done: function (e, data) {
            $.each(data.result.assets_pics, function (index, file) {
                if (file.deleteUrl) {
                  //$('#assets_pics').prop('disabled', true);
                  $('<p/>').html(data.files[0].name+'<input type="hidden" name="final_images[]" value="'+file.name+'|'+file.url+'|'+file.deleteUrl+'|'+data.files[0].name+'" /> - <span class="picremoveTh text-danger" style="cursor:pointer" data-url="'+file.deleteUrl+'">remove</span>').appendTo('#pics_files');
                  $('.picremoveTh').on('click', function(e){
                    $('#pics_progress .progress-bar').css('width', '0');
                    $.ajax({
                      type: 'DELETE',
                      url: $(this).attr('data-url'),
                      data: '_token='+$('input[name=_token]').val(),
                      dataType: 'json',
                      context: this,
                      success: function(retVal){
                        //alert(retVal);
                        $(this).parent().remove();
                        $('#assets_pics').prop('disabled', false);
                        $('#pics_progress').fadeOut(0);
                      }
                    });
                  })                  
                }

            });
        },
        processfail: function (e, data) {
          //alert(data.files[data.index].name + "\n" + data.files[data.index].error);
          $("#assets_pics_error").html('The attachment must be a file of type: jpg, jpeg, gif, png');
        },
        progressall: function (e, data) {
          $("#assets_pics_error").html('');
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $('#pics_progress').fadeIn(0);
            $('#pics_progress .progress-bar').css(
                'width',
                progress + '%'
            );
        },
        formData: function (form) {
            return form.serializeArray();
        }
    }).prop('disabled', !$.support.fileInput)
        .parent().addClass($.support.fileInput ? undefined : 'disabled');                

    /*------------------------------------------------------------------------------------------
    | Upload Handler for Assets Doc
    */
    var url = "{{ url('profile/pplajaxupload/assets_docs', $parameters = [], $secure = null) }}";
    $('#assets_docs').fileupload({
        url: url,
        dataType: 'json',
        //acceptFileTypes: /(\.|\/)(docx?|pdf)$/i,
        acceptFileTypes: /(\.|\/)(docx?|pdf|txt|xls|xlsx|ppt|pptx)$/i,
        sequentialUploads: true,
        done: function (e, data) {
            $.each(data.result.assets_docs, function (index, file) {
                if (file.deleteUrl) {
                  //$('#assets_docs').prop('disabled', true);
                  $('<p/>').html(data.files[0].name+'<input type="hidden" name="final_docs[]" value="'+file.name+'|'+file.url+'|'+file.deleteUrl+'|'+data.files[0].name+'" /> - <span class="docremoveTh text-danger" style="cursor:pointer" data-url="'+file.deleteUrl+'">remove</span>').appendTo('#doc_files');
                  $('.docremoveTh').on('click', function(e){
                    $('#docs_progress .progress-bar').css('width', '0');
                    $.ajax({
                      type: 'DELETE',
                      url: $(this).attr('data-url'),
                      data: '_token='+$('input[name=_token]').val(),
                      dataType: 'json',
                      context: this,
                      success: function(retVal){
                        //alert(retVal);
                        $(this).parent().remove();
                        $('#assets_docs').prop('disabled', false);
                        $('#docs_progress').fadeOut(0);
                      }
                    });
                  })                  
                }

            });
        },
        processfail: function (e, data) {
          //alert(data.files[data.index].name + "\n" + data.files[data.index].error);
          $("#assets_docs_error").html('The attachment must be a file of type: doc, docx, pdf, txt, xls, xlsx, ppt');
        },
        progressall: function (e, data) {
          $("#assets_docs_error").html('');
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $('#docs_progress').fadeIn(0);
            $('#docs_progress .progress-bar').css(
                'width',
                progress + '%'
            );
        },
        formData: function (form) {
            return form.serializeArray();
        }
    }).prop('disabled', !$.support.fileInput)
        .parent().addClass($.support.fileInput ? undefined : 'disabled');                


    /*------------------------------------------------------------------------------------------
    | Upload Handler for Assets Videos
    */
    var url = "{{ url('profile/ajaxvideo', $parameters = [], $secure = null) }}";
    $('#assets_videos').fileupload({
        url: url,
        dataType: 'json',
        acceptFileTypes: /(\.|\/)(avi|mp4|mkv|flv|mov)$/i,
        sequentialUploads: true,
        done: function (e, data) {

            $.each(data.result.assets_video, function (index, file) {
                if (file.path) {
                  //$('#assets_docs').prop('disabled', true);
                  $('<p/>').html(data.files[0].name+'<input type="hidden" name="final_videos[]" value="'+file.name+'|'+file.path+'" /> - <span class="removeTh text-danger" style="cursor:pointer" data-url="'+file.deleteUrl+'">remove</span>').appendTo('#video_files');
                  $('.removeTh').on('click', function(e){
                    $('#video_progress .progress-bar').css('width', '0');
                    /*$.ajax({
                      type: 'DELETE',
                      url: $(this).attr('data-url'),
                      data: '_token='+$('input[name=_token]').val(),
                      dataType: 'json',
                      context: this,
                      success: function(retVal){*/
                        //alert(retVal);
                        $(this).parent().remove();
                        $('#assets_videos').prop('disabled', false);
                        $('#video_progress').fadeOut(0);
                      /*}
                    });*/
                  })                  
                }

            });
        },
        processfail: function (e, data) {
          //alert(data.files[data.index].name + "\n" + data.files[data.index].error);
          $("#assets_videos_error").html('The attachment must be a file of type: avi, mp4, mkv, flv, mov');
        },
        progressall: function (e, data) {
          $("#assets_videos_error").html('');
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $('#video_progress').fadeIn(0);
            $('#video_progress .progress-bar').css(
                'width',
                progress + '%'
            );
        },
        formData: function (form) {
            return form.serializeArray();
        }
    }).prop('disabled', !$.support.fileInput)
        .parent().addClass($.support.fileInput ? undefined : 'disabled');                

  /*$('.removeTh').on('click', function(e){
    $.ajax({
      type: 'DELETE',
      url: $(this).attr('data-url'),
      data: '_token='+$('input[name=_token]').val(),
      dataType: 'json',
      context: this,
      success: function(retVal){
        //alert(retVal);
        $(this).parent().remove();
        $('#assets_pics').prop('disabled', false);
        $('#docs_progress').fadeOut(0);
      }
    });
  });*/

  /*Delete assets*/
  $(document).on('click','.delete_assets',function(){
    var selected = $(this);
    var delete_url = $(this).attr("data-url");
    bootbox.confirm("Are you sure, you want to delete?", function(result) {
      if(result)
      {
          location.href = delete_url;
        /*$('#pics_progress').fadeIn(0);
        $.ajax({
          type: 'DELETE',
          url: delete_url,
          data: '_token='+$('input[name=_token]').val(),
          dataType: 'json',
          context: this,
          success: function(retVal){
            //alert(retVal);
            selected.parent().parent.remove();
            $('#pics_progress').fadeOut(0);
          }
        });*/
      }  
    });  

  });
  /*end Delete assets*/


  /* Funding Business*/
    $(document).on("click","#add_fb_portfolio",function(){
      var append_fb_portfolio;
      append_fb_portfolio = '<div class="form-group"><div class="col-sm-8"><input type="text" name="portfolio[]" id="portfolio" class="form-control cur-port-f"></div><div class="col-sm-4"><span class="btn btn-success blue-btn remove-btn remove_fb_portfolio"><i class="fa fa-minus-circle"></i> Remove</span></div></div>';
      $("#append_fb_portfolio").append(append_fb_portfolio);
    });

    $(document).on("click",".remove_fb_portfolio",function(){
      $(this).parent().parent().remove();
    });

    $("input[name$='min_inv']").click(function() {
        var min_inv = $(this).val();
        if(min_inv=='Y')
          $("#min_inv_det").show();
        else
        {
          $('#min_investment_currency').val('');
          $('#min_investment_amt').val('');
          $('#min_investment_currency_units').val('');
          $("#min_inv_det").hide();
        }
    }); 

    $("input[name$='max_inv']").click(function() {
        var max_inv = $(this).val();
        if(max_inv=='Y')
          $("#max_inv_det").show();
        else
        {
          $('#max_investment_currency').val('');
          $('#max_investment_amt').val('');
          $('#max_investment_currency_units').val('');
          $("#max_inv_det").hide();
        }
    }); 
    /*------------------------------------------------------------------------------------------
    | Upload Handler for Assets Pics
    */
    var url = "{{ url('profile/pplajaxupload/assets_pics', $parameters = [], $secure = null) }}";
    $('#fb_assets_pics').fileupload({
        url: url,
        dataType: 'json',
        acceptFileTypes: /(\.|\/)(jpe?g|gif|png)$/i,
        sequentialUploads: true,
        done: function (e, data) {
            $.each(data.result.assets_pics, function (index, file) {
                if (file.deleteUrl) {
                  //$('#assets_pics').prop('disabled', true);
                  $('<p/>').html(data.files[0].name+'<input type="hidden" name="fb_final_images[]" value="'+file.name+'|'+file.url+'|'+file.deleteUrl+'|'+data.files[0].name+'" /> - <span class="fb_picremoveTh text-danger" style="cursor:pointer" data-url="'+file.deleteUrl+'">remove</span>').appendTo('#fb_pics_files');
                  $('.fb_picremoveTh').on('click', function(e){
                    $('#fb_pics_progress .progress-bar').css('width', '0');
                    $.ajax({
                      type: 'DELETE',
                      url: $(this).attr('data-url'),
                      data: '_token='+$('input[name=_token]').val(),
                      dataType: 'json',
                      context: this,
                      success: function(retVal){
                        //alert(retVal);
                        $(this).parent().remove();
                        $('#fb_assets_pics').prop('disabled', false);
                        $('#fb_pics_progress').fadeOut(0);
                      }
                    });
                  })                  
                }

            });
        },
        processfail: function (e, data) {
          //alert(data.files[data.index].name + "\n" + data.files[data.index].error);
          $("#fb_assets_pics_error").html('The attachment must be a file of type: jpg, jpeg, gif, png');
        },
        progressall: function (e, data) {
          $("#fb_assets_pics_error").html('');
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $('#fb_pics_progress').fadeIn(0);
            $('#fb_pics_progress .progress-bar').css(
                'width',
                progress + '%'
            );
        },
        formData: function (form) {
            return form.serializeArray();
        }
    }).prop('disabled', !$.support.fileInput)
        .parent().addClass($.support.fileInput ? undefined : 'disabled');                

    /*------------------------------------------------------------------------------------------
    | Upload Handler for Assets Doc
    */
    var url = "{{ url('profile/pplajaxupload/assets_docs', $parameters = [], $secure = null) }}";
    $('#fb_assets_docs').fileupload({
        url: url,
        dataType: 'json',
        //acceptFileTypes: /(\.|\/)(docx?|pdf)$/i,
        acceptFileTypes: /(\.|\/)(docx?|pdf|txt|xls|xlsx|ppt|pptx)$/i,
        sequentialUploads: true,
        done: function (e, data) {
            $.each(data.result.assets_docs, function (index, file) {
                if (file.deleteUrl) {
                  //$('#assets_docs').prop('disabled', true);
                  $('<p/>').html(data.files[0].name+'<input type="hidden" name="fb_final_docs[]" value="'+file.name+'|'+file.url+'|'+file.deleteUrl+'|'+data.files[0].name+'" /> - <span class="fb_docremoveTh text-danger" style="cursor:pointer" data-url="'+file.deleteUrl+'">remove</span>').appendTo('#fb_doc_files');
                  $('.fb_docremoveTh').on('click', function(e){
                    $('#fb_docs_progress .progress-bar').css('width', '0');
                    $.ajax({
                      type: 'DELETE',
                      url: $(this).attr('data-url'),
                      data: '_token='+$('input[name=_token]').val(),
                      dataType: 'json',
                      context: this,
                      success: function(retVal){
                        //alert(retVal);
                        $(this).parent().remove();
                        $('#fb_assets_docs').prop('disabled', false);
                        $('#fb_docs_progress').fadeOut(0);
                      }
                    });
                  })                  
                }

            });
        },
        processfail: function (e, data) {
          //alert(data.files[data.index].name + "\n" + data.files[data.index].error);
          $("#fb_assets_docs_error").html('The attachment must be a file of type: doc, docx, pdf, txt, xls, xlsx, ppt');
        },
        progressall: function (e, data) {
          $("#fb_assets_docs_error").html('');
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $('#fb_docs_progress').fadeIn(0);
            $('#fb_docs_progress .progress-bar').css(
                'width',
                progress + '%'
            );
        },
        formData: function (form) {
            return form.serializeArray();
        }
    }).prop('disabled', !$.support.fileInput)
        .parent().addClass($.support.fileInput ? undefined : 'disabled');                

    /*------------------------------------------------------------------------------------------
    | Upload Handler for Assets Videos
    */
    var url = "{{ url('profile/ajaxvideo', $parameters = [], $secure = null) }}";
    $('#fb_assets_videos').fileupload({
        url: url,
        dataType: 'json',
        acceptFileTypes: /(\.|\/)(avi|mp4|mkv|flv|mov)$/i,
        sequentialUploads: true,
        done: function (e, data) {

            $.each(data.result.assets_video, function (index, file) {
                if (file.path) {
                  //$('#assets_docs').prop('disabled', true);
                  $('<p/>').html(data.files[0].name+'<input type="hidden" name="fb_final_videos[]" value="'+file.name+'|'+file.path+'" /> - <span class="fb_removeTh text-danger" style="cursor:pointer" data-url="'+file.deleteUrl+'">remove</span>').appendTo('#fb_video_files');
                  $('.fb_removeTh').on('click', function(e){
                    $('#fb_video_progress .progress-bar').css('width', '0');
                    /*$.ajax({
                      type: 'DELETE',
                      url: $(this).attr('data-url'),
                      data: '_token='+$('input[name=_token]').val(),
                      dataType: 'json',
                      context: this,
                      success: function(retVal){*/
                        //alert(retVal);
                        $(this).parent().remove();
                        $('#fb_assets_videos').prop('disabled', false);
                        $('#fb_video_progress').fadeOut(0);
                      /*}
                    });*/
                  })                  
                }

            });
        },
        processfail: function (e, data) {
          //alert(data.files[data.index].name + "\n" + data.files[data.index].error);
          $("#fb_assets_videos_error").html('The attachment must be a file of type: avi, mp4, mkv, flv, mov');
        },
        progressall: function (e, data) {
          $("#fb_assets_videos_error").html('');
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $('#fb_video_progress').fadeIn(0);
            $('#fb_video_progress .progress-bar').css(
                'width',
                progress + '%'
            );
        },
        formData: function (form) {
            return form.serializeArray();
        }
    }).prop('disabled', !$.support.fileInput)
        .parent().addClass($.support.fileInput ? undefined : 'disabled');                


  /* End Funding Business*/
  
 
  
});

$(function(){

var fund=$('.tab_sel_funding').attr('aria-controls');
   
   if(fund=='Raise Funding')
    {  
        $('#raise_fun').show();
        if($("[name='rasing_funding']").is(':checked'))
        {
                    $('#Rasing_Funding').show();
                    $('.nav-tabs').show(); 
        }
        else
        {
                    $('#Rasing_Funding').hide();
                    $('.nav-tabs').hide(); 
        }
    }
     if(fund=='Funding Businesses')
    {  
        $('#fund_business').show();
        if($("[name='funding_businesses']").is(':checked'))
        {
                    $('#Funding_Businesses').show();
                    $('.nav-tabs').show(); 
        }
        else
        {
                    $('#Funding_Businesses').hide();
                    $('.nav-tabs').hide(); 
        }
    }

    $('#rasing_funding').change(function(){ 

         if(fund=='Raise Funding')
         {
           if($("[name='rasing_funding']").is(':checked'))
           {
                       $('#Rasing_Funding').show();
                       $('.nav-tabs').show(); 
                       var result='YES';
                        
           }
           else
           {
                       $('#Rasing_Funding').hide();
                       $('.nav-tabs').hide();
                       var result='NO';
                      
           }
            var pro_id = $(this).attr("data-cat");
            var dataString = 'pro_id='+ pro_id + '&result=' + result + '&_token=' + $("input[name=_token]").val();
             $.ajax({
                        type: "get",
                        url : "/profile/checkbusiness",
                        data : dataString,
                        success : function(data){
                           //alert(data);
                          }
                    },"json");
         } 

    });
    $('#funding_businesses').change(function(){ 

         if(fund=='Funding Businesses')
         {
           if($("[name='funding_businesses']").is(':checked'))
           {
                       $('#Funding_Businesses').show();
                       $('.nav-tabs').show(); 
                       var result='YES';
                        
           }
           else
           {
                       $('#Funding_Businesses').hide();
                       $('.nav-tabs').hide();
                       var result='NO';
                      
           }
            var pro_id = $(this).attr("data-cat");
            var dataString = 'pro_id='+ pro_id + '&result=' + result + '&_token=' + $("input[name=_token]").val();
             $.ajax({
                        type: "get",
                        url : "/profile/checkbusiness",
                        data : dataString,
                        success : function(data){
                           //alert(data);
                          }
                    },"json");
         } 

    });
});
</script>
@endsection
 