@extends('layouts.app')
@section('title')
{{ $user->name }}
@parent
@stop
@section('header_styles')
<meta name="csrf_token" content="{{ csrf_token() }}">
<link href="{{ asset('assets/vendors/jasny-bootstrap/css/jasny-bootstrap.css') }}" rel="stylesheet"/>
<link href="{{ asset('assets/vendors/x-editable/css/bootstrap-editable.css') }}" rel="stylesheet"/>
<link href="{{ asset('assets/css/pages/user_profile.css') }}" rel="stylesheet"/>
<style type="text/css">
.text-orange{
  color: var(--orange);
}
.text-teal{
  color: var(--teal);
}
</style>
@stop
{{-- Page content --}}
@section('content')


<main id="users_ac">
   <!--section ends-->
   <section>
      <div class="container">
         <div class="row">
            <div class="col-md-12 mt-xs-5">
               <h2 class="h4 p-3 bg-dark-light text-primary-light">
                  <a href="{{route('crm.dashboard')}}"><i class="fa fa-home"></i> Dashboard / </a>  
                   <small  class="bg-dark-light text-dark"> Opportunity</small> /
                   <small  class="bg-dark-light text-dark"> Journal Wise Opportunity Detail</small> 
               </h2>
              <form  action="{{route('crm.opportunity')}}"  method="GET" class="form-group pt-1" >
                  @csrf
                  <div class="form-row">
                     <div class="form-group col-md-2">
                      <label for="by_year"><strong>By Year</strong></label>
                      <select class="form-control" name="by_year">
                        <option>-- Select --</option>
                        <?php 
                          for($i =0; $i <= 21 ;$i++)
                          {
                              $year = date('Y') - $i;
                              echo '<option value='.$year.'';
                              echo ( $by_year == $year) ? ' selected' : '';
                              echo '>'.$year.'</option>';
                          }
                        ?>
                      </select>
                    </div>
                    <div class="form-group col-md-5">
                      <label for="by_country"><strong>By Country</strong></label>
                      <select class="form-control" id="by_country" name="by_country">
                        <option value="" hidden="true">-- Select Country --</option>
                        @foreach (getCountrires() as $key => $country)
                            <option value="{{$key}}" {{ old('country_id') == $key ? "selected" : "" }}> {{$country}}</option>
                        @endforeach
                      </select>
                    </div>
                   
                   
                    <div class="form-group col-md-1 pt-4" style="margin-top: 5px;">
                      <button type="submit" class="btn btn-primary"><i class="fas fa-filter"></i> Filter</button>
                    </div>
                    <div class="form-group col-md-1 pt-4" style="margin-top: 5px;">
                      <a href="{{route('crm.opportunity')}}"class="btn btn-warning text-white"><i class="far fa-times-circle"></i>Reset </a>
                      
                    </div>
                  </div>
                </form>
               <table class="table table-striped mt-4">
                  <thead>
                    <tr bgcolor="#01547d" class="text-white">
                      <th >S.No</th>
                      <th >Country</th>
                      <th class="text-center">Total Denial</th>
                      <th>Action</th>
                    </tr>
                  </thead>
                  <tbody>
                    @if(!empty($country_count))
                        @if(!$country_count->isEmpty())
                          @php $cnt = 0; @endphp
                            @foreach($country_count as $row)
                            <tr>
                              <td width="7%">{{++$cnt}}</td>
                              <td width="18%">{{$row->country_name}}</td>
                              <td width="8%" class="text-center">{{$row->total_denial}}</td>
                              <td width="5%">
                                <a href="{{route('crm.bycountryuser',['country'=>$row->iso])}}" class="btn btn-primary btn-sm btn-block">View</a>
                              </td>
                            </tr>
                            @endforeach
                        @else
                          <tr><td colspan="5" class="text-center">No Record Found !!!</td></tr>
                        @endif
                     @else
                        <tr><td colspan="5" class="text-center">No Record Found !!!</td></tr>   
                     @endif

                  </tbody>
               </table>
               <div class="pt-2"> </div>
            </div>
            
            
         </div>
      </div>
      </div>
   </section>
</main>
@stop
{{-- page level scripts --}}
@section('footer_scripts') 
<!-- Bootstrap WYSIHTML5 --> 
<script  src="{{ asset('assets/vendors/jasny-bootstrap/js/jasny-bootstrap.js') }}" type="text/javascript"></script> 
@stop