@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('mnos') !!}">Mobile Network Operators</a></li>
        <li class="active"> {{ $mnoshow->name }} (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">
            FULL DETAILS <a href="{{ url('mnos/' . $mnoshow->id. '/edit') }}" class="btn btn-warning btn-sm pull-right"><i class="fa fa-edit"></i> Edit Details</a>
            @include('commons.notifications')
            <div class="clearfix"></div>
            <hr class="style-four">
          </div>
          <div class="x_content">
              <div class="row">
                <div class="col-md-4">
                    <h4 class="green">Primary Details</h4>
                    <table class="table">
                      <tr>
                        <th>Name</th>
                        <td>{{ $mnoshow->name }}</td>
                      </tr>
                      <tr>
                        <th>Country</th>
                        <td>{{ $mnoshow->country }}</td>
                      </tr>
                      <tr>
                        <th>Account Manager</th>
                        <td>{{ $mnoshow->account_manager_info->name }}</td>
                      </tr>
                      <tr>
                        <th>Contact Person</th>
                        <td>{{ $mnoshow->contact_person }}</td>
                      </tr>
                      <tr>
                        <th>Phone</th>
                        <td>{{ $mnoshow->contact_person_phone }}</td>
                      </tr>
                      <tr>
                        <th>Email</th>
                        <td>{{ $mnoshow->contact_person_email }}</td>
                      </tr>
                      <tr>
                        <th>Skype Name</th>
                        <td>{{ $mnoshow->contact_person_skype_name }}</td>
                      </tr>

                      <tr>
                        <th>Contract Type </th>
                        <td>{{ $mnoshow->contract_type }}</td>
                      </tr>
                      <tr>
                        <th>Contract Validity </th>
                        <td>{{ $mnoshow->contract_validity }}</td>
                      </tr>
                      <tr>
                        <th>Contract Auto Renew </th>
                        <td>{{ $mnoshow->contract_auto_renew }}</td>
                      </tr>
                    </table>
                </div>
                <div class="col-md-4">
                    <h4 class="green">Company Details</h4>
                    <table class="table">
                      <tr>
                        <th>Name</th>
                        <td>{{ $mnoshow->country }}</td>
                      </tr>
                      <tr>
                        <th>Support Phones</th>
                        <td>
                          <?php
                            echo ($mnoshow->support_phones) ? implode(',', json_decode($mnoshow->support_phones)) : "";
                           ?>
                        </td>
                      </tr>
                      <tr>
                        <th>Support Emails</th>
                        <td>
                          <?php
                            echo ($mnoshow->support_emails) ? implode(',', json_decode($mnoshow->support_emails)) : "";
                           ?>
                        </td>
                      </tr>
                      <tr>
                        <th>Rate Emails</th>
                        <td>
                          <?php
                            echo ($mnoshow->rate_emails) ? implode(',', json_decode($mnoshow->rate_emails)) : "";
                           ?>
                        </td>
                      </tr>
                      <tr>
                        <th>Support Skype IDs</th>
                        <td>
                          <?php
                            echo ($mnoshow->support_skype) ? implode(',', json_decode($mnoshow->support_skype)) : "";
                           ?>
                        </td>
                      </tr>
                      <tr>
                        <th>Technical Support Person</th>
                        <td>
                          <?php
                            echo ($mnoshow->technical_support_person) ?? "N/A";
                           ?>
                        </td>
                      </tr>
                      <tr>
                        <th>Finace Contact Person</th>
                        <td>
                          <?php
                            echo ($mnoshow->contact_person_finance) ?? "N/A";
                           ?>
                        </td>
                      </tr>


                    </table>
                </div>
                <div class="col-md-4">
                    <h4 class="green">Operations </h4>
                    <table class="table">
                      <tr>
                          <th>Services</th>
                          <td class="">
                            <span class="badge bg-blue">
                            <?php echo ($mnoshow->services) ? implode(', ', json_decode($mnoshow->services)) : ""; ?>
                            </span>
                            </td>
                      </tr>
                      <tr>
                          <th>Connnection Types</th>
                          <td>
                            <span class="btn btn-info btn-sm">
                            <?php echo ($mnoshow->connection_type) ? implode(', ', json_decode($mnoshow->connection_type)) : ""; ?>
                            </span>
                          </td>
                      </tr>
                    </table>
                    <h4 class="green">Rates</h4>
                    <table class="table">
                      @if($mnoshow->rate_type == 'flat_rate')
                      <tr>
                        <td>Buying Rate</td><td> <span class="label label-danger"> {{ $mnoshow->buying_rate or '' }}</span></td>
                      </tr>
                      <tr>
                        <td>Rate Type</td><td><span class="label label-danger">{{ $mnoshow->rate_type }}</span></td>
                      </tr>
                      @else
                      <tr>
                        <td>Sliding Scale Rate File</td>
                        <td>
                          <p class="url">
                            <span class="fs1 text-info" aria-hidden="true" data-icon=""></span>
                            <a href="{{ url('mnos/downloadfile', $mnoshow->id) }}"><i class="fa fa-paperclip"></i> {{ $mnoshow->sliding_rate_file }}</a>
                          </p>
                        </td>
                      </tr>
                      <tr>
                        <td>Rate Type</td><td><span class="label label-danger">{{ strtoupper($mnoshow->rate_type) }}</span></td>
                      </tr>
                      @endif
                    </table>
                </div>
              </div>
              <div class="row">
                <hr class="style-five">
              </div>
              <div class="row">
                <div class="col-md-12">
                  <h4 class="green">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 table-striped jambo_table table-bordered">
                          <thead>
                            <tr class="headings">
                              <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>
              <div class="row">
                <div class="col-md-6">
                  <h4 class="green">Payments</h4>
                  <div class="table-responsive">
                      <table class="table table-striped jambo_table table-bordered">
                        <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">{{ $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 class="col-md-6">
                  <h4 class="green">IP Addresses</h4>
                  <!-- overflow: scroll; -->
                  <div style="height: 400px; ">
                        <table class="table table-striped jambo_table table-bordered">
                          <thead>
                            <tr>
                              <th scope="col">#</th>
                              <th scope="col">IP Address</th>
                              <th scope="col">Port</th>
                              <th scope="col">Status</th>
                              <th scope="col">Added By</th>
                              <th scope="col">Date</th>
                            </tr>
                          </thead>
                          <tbody>
                            @if($ip_addresses->isEmpty())
                            <td class="" colspan="6">No Records found</td>
                            @else
                            <?php $count = 1; ?>
                            @foreach($ip_addresses as $row)
                            <tr>
                              <th scope="row">{{ $count }}</th>
                              <td>{{ $row->ip_address }}</td>
                              <td>{{ $row->port }}</td>
                              <td>{{ $row->status }}</td>
                              <td>{{ $row->created_by_info->name }}</td>
                              <td>{{ $row->created_at }}</td>
                            </tr>
                            <?php $count++; ?>
                            @endforeach
                            @endif
                          </tbody>
                        </table>
                  </div>
                </div>
              </div>
              <div class="row">
                <hr class="style-five">
              </div>
              <div class="row">

                <div class="col-md-12 well">
                  <h4 class="green">Uploaded Documents</h4>
                    @if($showdocuments->isEmpty() == false)
                      <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('mnos/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>
    </div>
  </div>
@endsection

@section('javascript')
<script type="text/javascript">
  $(function(){

  });
</script>
@endsection
