@extends('backend.layouts.app')
@section('content')

<div class="row page-titles">
   <div class="col-md-5 align-self-center">
      <h4 class="text-themecolor">Payment Manager</h4>
   </div>
   <div class="col-md-7 align-self-center text-right">
      <div class="d-flex justify-content-end align-items-center">
         <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="{{ route('dashboard') }}">Dashboard</a></li>
            <li class="breadcrumb-item "><a href="{{ route('payments') }}">Payment Manager</a></li>
            <li class="breadcrumb-item active">View Payment</li>
         </ol>
      </div>
   </div>
</div>

<div class="container-fluid">
    <div class="content-wrapper">
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-12">
                        <div class="card">
                            <!-- Card header -->
                            <div class="card-body">
                                <div class="card-title" style="width:100%;display: inline-block;">
                                    <span class="caption-subject font-green bold uppercase">Payment Details</span>
                                    <a href="{{ route('payments') }}">
                                        <button type="button" class="btn btn-primary btn-sm float-right"><i class="fa fa-arrow-left"></i> Back</button>
                                    </a>
                                </div>

                                <table class="table table-bordered table-striped">
                                    <tbody>
                                        <tr>
                                            <th>Transaction Id</th>
                                            <td>{{ ($payment->payment_reference) ? $payment->payment_reference : '-' }}</td>
                                        </tr>
                                        <tr>
                                            <th>Service Name</th>
                                            <td><a href='{{ route("service.view",['id'=>$payment->service->id]) }}'>{{ ($payment->service) ? $payment->service->title : '-' }}</a></td>
                                        </tr>
                                        <tr>
                                            <th>Amount</th>
                                            <td>{{ ($payment->total_price) ? config('GET.currency_symbol'). $payment->total_price : '-' }}</td>
                                        </tr>

                                        <tr>
                                            <th>Payment Method</th>
                                            <td>{{ (!empty($payment->payment_method)) ?  ucfirst($payment->payment_method) :  '-' }}</td>
                                        </tr>

                                        <tr>
                                            <th>Payment Status</th>
                                            <td>{{ (!empty($payment->payment_status)) ?  ucfirst($payment->payment_status) :  '-' }}</td>
                                        </tr>

                                        <tr>
                                            <th>Payment Reference</th>
                                            <td style="word-wrap: break-word;">{{ (!empty($payment->payment_reference)) ?  ucfirst($payment->payment_reference) :  '-' }}</td>
                                        </tr>

                                        <tr>
                                            <th>Created At</th>
                                            <td>{{ \Carbon\Carbon::parse($payment->created_at)->format('Y-m-d H:i:s') ?? '-' }}</td>
                                        </tr>
                                    </tbody>
                                </table>
                                @if($payment->user)
                                <h5> Service Provider Detail </h5>
                                    <table class="table table-bordered">
                                        <thead>
                                            <tr>
                                                <th>Name</th>
                                                <th>Email</th>
                                                <th>Mobile</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td>{{ $payment->service?->service_provider?->first_name . ' ' . ($payment->service?->service_provider?->last_name ? $payment->service?->service_provider?->last_name : '') }}</td>
                                                <td>{{ ($payment->user->email) ? $payment->user->email : '-'    }}</td>
                                                <td>{{ ($payment->user->mobile ) ? $payment->user->mobile : '-'}} </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                @endif
                                <hr>
                                <h5> Client Detail </h5>
                                <table class="table table-bordered">
                                    <thead>
                                        <tr>
                                            <th>Name</th>
                                            <th>Email</th>
                                            <th>Mobile</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>{{ ($payment->user?->userInformations?->company_name) ? $payment->user?->userInformations?->company_name : '-' }}</td>
                                            <td>{{ ($payment->email) ? $payment->email : '-'    }}</td>
                                            <td>{{ ($payment->mobile_number ) ? $payment->mobile_number : '-'}} </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>
</div>
@stop
