@extends('dashboard.layouts.app')
@section('title', trans('admin.partners.title') . ' - ')
@section('speedbar')
    <div class="content-header row">
        <div class="content-header-left col-md-9 col-12 mb-2">
            <div class="row breadcrumbs-top">
                <div class="col-12">
                    <h2 class="content-header-title float-left mb-0">@lang('admin.partners.requests')</h2>
                    <div class="breadcrumb-wrapper col-12">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item "><a href="{{ route('dashboard') }}">@lang('admin.home')</a>
                            </li>
                            <li class="breadcrumb-item active">
                                @lang('admin.partners.requests')
                            </li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('content')
    <div class="row" id="table-head">
        <div class="col-12">
            <div class="card">
                <div class="card-content">
                    <div class="table-responsive">
                        <table class="table mb-0">
                            <thead class="thead-dark">
                                <tr>
                                    <th scope="col" width="50">ID</th>
                                    <th scope="col" width="50">@lang('admin.partners.full_name')</th>
                                    <th scope="col">@lang('admin.partners.phone')</th>
                                    <th scope="col">@lang('admin.partners.partner')</th>
                                    <th scope="col">@lang('admin.partners.status')</th>
                                    <th scope="col" class="text-right">@lang('admin.actions')</th>
                                </tr>
                            </thead>
                            <tbody>
                                @if (count($requests) == 0)
                                    <tr>
                                        <td class="text-center" colspan="4">
                                            @lang('admin.no_data')
                                        </td>
                                    </tr>
                                @endif
                                @foreach ($requests as $request)
                                    <tr>
                                        <th scope="row">{{ $request->id }}</th>
                                        <td>{{ $request->full_name }}</td>
                                        <td>
                                            <a href="tel:+{{ $request->phone }}">+{{ $request->phone }}</a>
                                        </td>
                                        <td>{{ $request->partner->getName() }}</td>
                                        <td>@lang('admin.partner_requests.' . $request->status)</td>
                                        <td class="text-right">
                                            @can('update', 'partners')
                                                <a href="{{ route('dashboard.partner_requests.show', $request->id) }}"
                                                    class="btn btn-sm btn-success btn-icon" data-toggle="tooltip"
                                                    data-original-title="@lang('admin.see')">
                                                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16"
                                                        height="16" class="main-grid-item-icon" fill="none"
                                                        stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
                                                        stroke-width="2">
                                                        <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" />
                                                        <circle cx="12" cy="12" r="3" />
                                                    </svg>
                                                </a>
                                            @endcan
                                        </td>
                                    </tr>
                                @endforeach

                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

            {{ $requests->links('pagination::bootstrap-4') }}
        </div>
    </div>
@endsection
