@extends('layouts.master')
@section('page_title')
    @if(isset($page_title))
        {{ $page_title }}
    @endif
@endsection
@section('content')
<div class="">
  <div class="page-title">
    <div class="title_left" style="width:800px !important;">
      <ol class="breadcrumb">
        <li><a href="{!! url('dashboard') !!}">Dashboard</a></li>
        <li><a href="{!! url('clients') !!}">Clients</a></li>
        <li><a href="{{ url('clients',  $showclient->id) }}">{{ $showclient->name }}</a></li>
        <li class="active">Full Details</li>
      </ol>
    </div>
  </div>
  <div class="clearfix"></div>
  <div class="row">
    <div class="col-md-12 col-sm-12 col-xs-12">
      <div class="x_panel">
          <div class="x_title">
            Client Details
            @include('commons.notifications')
            <div class="clearfix"></div>
          </div>
          {{-- start of content --}}
          <div class="x_content">
              <div class="row">
                <div class="col-md-4">
                    <h4>Primary Details</h4>
                    <table class="table">
                      <tr>
                        <th>Name</th>
                        <td>{{ $showclient->name }}</td>
                      </tr>
                      <tr>
                        <th>Name</th>
                        <td>
                          {{ $showclient->country }}
                          @if($showclient->country_flag_info !== null)
                            &nbsp; &nbsp; &nbsp; &nbsp;
                            <img class="" src="{{ url($showclient->country_flag_info->url) }}" alt="Generic Client Icon" title="Country Flag" height="20px">
                          @endif
                        </td>
                      </tr>
                      <tr>
                        <th>Account Manager</th>
                        <td>{{ $showclient->auth_user_info->name }}</td>
                      </tr>
                      <tr>
                        <th>Contact Person</th>
                        <td>{{ $showclient->contact_person }}</td>
                      </tr>
                      <tr>
                        <th>Phone</th>
                        <td>{{ $showclient->phone }}</td>
                      </tr>
                      <tr>
                        <th>Email</th>
                        <td>{{ $showclient->email }}</td>
                      </tr>
                      <tr>
                        <th>Skype Name</th>
                        <td>{{ $showclient->skype_name }}</td>
                      </tr>
                      <tr>
                        <th>LinkedIn </th>
                        <td>{{ $showclient->linkedin_name }}</td>
                      </tr>
                      <tr>
                        <th>Contract Type </th>
                        <td>{{ $showclient->contract_type }}</td>
                      </tr>  
                      <tr>
                        <th>Contract Validity </th>
                        <td>{{ $showclient->contract_validity }}</td>
                      </tr> 
                      <tr>
                        <th>Contract Auto Renew </th>
                        <td>{{ $showclient->contract_auto_renew }}</td>
                      </tr>                    
                    </table>
                </div>
                <div class="col-md-4">
                    <h4>Company Details</h4>
                    <table class="table">
                      <tr>
                        <th>Name</th>
                        <td>{{ $showclient->country }}</td>
                      </tr>
                      <tr>
                        <th>Company Type</th>
                        <td>{{ $showclient->company_type }}</td>
                      </tr>
                      <tr>
                        <th>Connections</th>
                        <td>
                          <?php 
                            echo ($showclient->connections) ? implode(',', json_decode($showclient->connections)) : "";
                           ?>
                       </td>
                      </tr>
                      <tr>
                        <th>SMPP Details</th>
                        <td>
                          <?php 
                            echo ($showclient->smpp_details) ? implode(',', json_decode($showclient->smpp_details)) : "";
                           ?>
                        </td>
                      </tr>
                      <tr>
                        <th>Message Types</th>
                        <td>
                          <?php 
                            echo ($showclient->message_types) ? implode(',', json_decode($showclient->message_types)) : "";
                           ?>
                        </td>
                      </tr>
                      <tr>
                        <th>Support Phones</th>
                        <td>
                          <?php 
                            echo ($showclient->support_phones) ? implode(',', json_decode($showclient->support_phones)) : "";
                           ?>
                        </td>
                      </tr>
                      <tr>
                        <th>Support Emails</th>
                        <td>
                          <?php 
                            echo ($showclient->support_emails) ? implode(',', json_decode($showclient->support_emails)) : "";
                           ?>
                        </td>
                      </tr>
                      <tr>
                        <th>Rate Emails</th>
                        <td>
                          <?php 
                            echo ($showclient->rate_emails) ? implode(',', json_decode($showclient->rate_emails)) : "";
                           ?>
                        </td>
                      </tr>
                      <tr>
                        <th>Support Skype IDs</th>
                        <td>
                          <?php 
                            echo ($showclient->support_skype) ? implode(',', json_decode($showclient->support_skype)) : "";
                           ?>
                        </td>
                      </tr>
                      <tr>
                        <th>How We got this client</th>
                        <td>{{ $showclient->how_we_got_client }}</td>
                      </tr>
                                          
                    </table>
                </div>
                <div class="col-md-4">
                    <h4>Services </h4>
                    <div class="bg-info" style="padding: 5px;">
                      @if($show_services)
                      <ul>
                        @foreach($show_services as $service)
                        <li>{{ $service }}</li>
                        @endforeach
                      </ul>
                      @endif
                    </div>
                    <h4>Finance Details</h4>
                    <table class="table">
                      <tr>
                          <th>Payment Mode</th>
                          <td>
                            <?php echo $showclient->pay_mode ?? ""; ?></td>
                      </tr>
                      <tr>
                          <th>Finance Emails</th>
                          <td><?php echo ($showclient->finance_email) ? implode(',', json_decode($showclient->finance_email)) : ""; ?></td>
                      </tr>
                    </table>
                    <h5>Recent Payments</h5>
                    <div style="height: 250px; overflow: scroll;">
                      <div class="table-responsive">
                        <table class="table table-striped ">
                          <thead>
                            <tr class="headings">
                              <th class="column-title">Invoice Number</th>
                             <th class="column-title">Invoice Amount</th>
                              <th class="column-title">Invoice Date</th>
                              <th class="column-title">Services</th>          
                              <th class="column-title">Remarks</th>
                              <th class="column-title">Status</th>                                 
                            </tr>
                          </thead>
                          <tbody>
                            @if ($recent_payments->isEmpty())
                            <tr>
                              <td class="" colspan="12">No Records found</td>
                            </tr>
                            @else
                            @foreach ($recent_payments as $row)
                            <tr class="even pointer">
                              <td class="mes-td col-md-1">{{ $row->invoice_number }}</td>
                              <td class="mes-td col-md-1">{{ number_format($row->invoice_amount) }}</td>
                              <td class="mes-td col-md-2">{{ date('d-m-Y', strtotime($row->invoice_date)) }}</td>
                              <td class="mes-td col-md-3">{{ $row->services }} </td>
                              <td class="mes-td col-md-3" style="width: 100px;">{{ $row->remarks }}</td>
                              <td class="mes-td col-md-1"><span class="label label-<?php echo ($row->invoice_status == 'PAID') ? 'success' : 'danger';  ?>"> {{ $row->invoice_status }}</span></td>
                            </tr>
                            @endforeach
                            @endif
                          </tbody>
                        </table>
                      </div>
                    </div>                        
                </div>
              </div>
              <div class="row">                
                <div class="col-md-12 well">
                  <div class="tile fixed_height_60">
                    
                  
                    <h4>Documents</h4>
                    @if(!$showdocuments->isEmpty() == true)
                      <div class="row">
                      <div class="col-md-6">
                      <div class="row">       
                          @foreach($showdocuments as $docs)
                            <div class="col-md-3">
                              <p class="url">
                                <span class="fs1 text-info" aria-hidden="true" data-icon=""></span>
                                <a href="{{ url('clients/downloadfile', $docs->id) }}"><i class="fa fa-paperclip"></i> {{ $docs->name }}.{{ $docs->file_extension }}</a>
                              </p>
                            </div>                        
                          @endforeach
                      </div>
                      </div>
                      </div>
                    @else
                      <p>No Documents found</p>
                    @endif
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="col-md-6">
                  <h4>Notes</h4>
                  <div class="" style="height: 400px; overflow: scroll;">
                    <ul class="messages list-group" style="padding: 15px;">
                      @if($show_notes->isEmpty())
                      <li style="" class="">No notes found</li>
                      @else
                        <table class="table">
                          <thead>
                            <tr>
                              <th scope="col">#</th>
                              <th scope="col">Content</th>
                              <th scope="col">Services</th>
                              <th scope="col">Author</th>
                              <th scope="col">Date</th>
                            </tr>
                          </thead>
                          <tbody>
                            <?php $count = 1; ?>
                            @foreach($show_notes as $notes)
                            <tr>
                              <th scope="row">{{ $count }}</th>
                              <td>{{ $notes->notes_body }}</td>
                              <td>{{ $notes->services }}</td>
                              <td>{{ $notes->created_by_info->name }}</td>
                              <td>{{ $notes->created_at }}</td>
                            </tr>
                            <?php $count++; ?>
                            @endforeach

                          </tbody>
                        </table>
                      @endif
                    </ul>
                  </div>
                </div>
                <div class="col-md-6">
                  <div style="height: 400px; overflow: scroll;">
                    <h4>SMS Short Codes</h4>
                    <div>
                      <div class="table-responsive">
                      <table class="table table-striped table-bordered table-condensed">
                        <thead>
                          <tr class="headings">
                            {{-- <th>#</th> --}}
                            <th class="column-title">Name</th>
                            <th class="column-title">Code</th>
                            <th class="column-title">Type</th>
                            <th class="column-title">Network</th>
                            <th class="column-title">Toll Free</th>
                            <th class="column-title">Status</th>
                            <th class="column-title">Launch Date</th>
                            </th>
                           
                          </tr>
                        </thead>
                        <tbody>
                          @if ($all_shortcodes->isEmpty())
                          <tr>
                            <td class="" colspan="12">No Records found</td>
                          </tr>
                          @else
                          @foreach ($all_shortcodes as $row)
                          <tr class="even pointer">
                            <td class="mes-td col-md-2">{{ $row->name }}</td>
                            <td class="mes-td col-md-1">{{ $row->shortcode }}</td>
                            <td class="mes-td col-md-1">{{ $row->code_type }}</td>
                            <td class="mes-td col-md-2">{{ ucfirst($row->network) }}</td>
                            <td class="mes-td col-md-2">{{ ucfirst($row->country) }}</td>
                            <td class="mes-td col-md-1">{{ strtoupper($row->toll_free) }}</td>                               
                            <td class="mes-td col-md-1">{{ $row->status }}</td>
                            <td class="mes-td col-md-1" style="width: 100px;">{{ date('d-m-Y', strtotime($row->launch_date)) }}</td>
                          </tr>
                          @endforeach
                          @endif
                        </tbody>
                      </table>
                      </div>
                    </div>
                    
                  </div>
                </div>
                
              </div>
          {{-- end of x_content --}}
      </div>
      {{-- end of x_panel --}}
    </div>
  </div>        
</div>

@endsection

@section('javascript')
<script type="text/javascript" src="{{ url('public/assets/vendors/gauge.js/dist/gauge.min.js') }}"></script>
<script type="text/javascript" src="{{ url('public/assets/js/showclientreadonly.js') }}"></script>
<script type="text/javascript">
  $(function(){
  
  });
</script>
@endsection
