<div class="container-xxl flex-grow-1 container-p-y">
    
    <div class="row mx-1 my-1">
        <div class="col-md-9">
            <h4 class="fw-bold py-3 mb-4">User and Company <span class="text-muted fw-light">/ Detail</span></h4>
        </div>
    </div>

    <div class="row mx-1 my-1">
        
        <div class="card">
            <div class="card-body">
                <div class="table-responsive text-wrap" style="overflow-x: hidden">
                    <h4><strong>User Detail</strong></h4>
                    <div class="row">
                        <div class="col-md-2">
                            <div class="d-flex align-items-start align-items-sm-center gap-4" style="text-align: center;">
                                <img class="d-block rounded" src="{{ $company?->logo ?? asset('images/trading_fmcg_logo.png') }}" style="border-radius: 10%" alt="user image" height="130px">
                            </div>
                        </div>
                        <div class="col-md-10 px-2">
                            <table class="table">
                                <tr>
                                    <th>ID</th>
                                    <td>{{ $user->id ?? "" }}</td>
                                    <th>Name</th>
                                    <td>{{ $user->name ?? "" }}</td>
                                </tr>
                                <tr>
                                    <th>Email</th>
                                    <td colspan="3">{{ $user->email ?? "" }}</td>
                                </tr>
                                <tr>
                                    <th>Phone</th>
                                    <td>{{ $user->phone ?? "" }}</td>
                                    <th>Date of Join</th>
                                    <td>{{ $user->created_at->format('d M, Y') ?? "" }}</td>
                                </tr>
                            </table> 
                        </div>   
                    </div>
                        
                </div>
                @if($company != null)
                <hr>
                    <div class="table-responsive text-wrap mt-4">
                        <h4><strong>Company Detail</strong></h4>
                        <table class="table">
                            <tr>
                                <th>ID</th>
                                <td>{{ $company?->id ?? "" }}</td>
                                <th>Name</th>
                                <td>{{ $company?->name ?? "" }}</td>
                            </tr>
                            <tr>
                                <th>Email</th>
                                <td>{{ $company?->email ?? "" }}</td>
                                <th>Registerd Date</th>
                                <td>{{ $company?->created_at->format('d M, Y') ?? "" }}</td>
                            </tr>
                            <tr>
                                <th>Type</th>
                                <td>{{ $company?->type ?? "" }}</td>
                                <th>Category</th>
                                <td>{{ $company?->category->name ?? "N/A" }}</td>
                            </tr>
                            <tr>
                                <th>City</th>
                                <td>{{ $company?->city ?? "" }}</td>
                                <th>State</th>
                                <td>{{ $company?->state ?? "" }}</td>
                            </tr>
                            <tr>
                                <th>Post Code</th>
                                <td>{{ $company?->post_code ?? "" }}</td>
                                <th>Country</th>
                                <td>{{ $company?->country ?? "" }}</td>
                            </tr>
                            <tr>
                                <th>Address</th>
                                <td colspan="3">{{ $company?->address ?? "" }}</td>
                            </tr>
                            <tr>
                                <th>Description</th>
                                <td colspan="3">{{ $company?->description ?? "" }}</td>
                            </tr>
                        </table>   
                    </div>
                @endif
            </div>
        </div>
    </div>

    <div class="row mt-4 mx-1 my-1">
        <div class="card">
            <div class="card-body">
                <h4 class="fw-bold "><span class="text-muted fw-light"></span> Products</h4>
                <div class="table-responsive text-nowrap">
                    <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>Image</th>
                            <th>Name</th>
                            <th>Category</th>
                            <th>Type</th>
                            <th>Price</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    @if (isset($products) && count($products) > 0)
                    <tbody class="table-border-bottom-0">
                        @foreach ($products as $product)
                            <tr>
                                <td>{{$product->id}}</td>
                                <td>
                                    <img src="{{$product->images[0]->file ?? asset('images/placeholder.png')}}" class="listing-img"/>
                                </td>
                                <td>{{$product->name}}</td>
                                <td>{{$product->category->name}}</td>
                                <td>{{$product->type}}</td>
                                <td>{{$product->price}}</td>
                                <td>
                                    <a href="{{url('admin/products/detail/' . $product->id)}}">
                                        <i class="menu-icon tf-icons bx bx-show btn btn-primary btn-xs"></i>
                                    </a>
                                </td>
                            </tr>
                        @endforeach
                    </tbody>
                    @else
                        <td colspan="8" class="text-center">No record found</td>
                    @endif
                    </table>
                </div>
            </div>
        </div>
    </div>

    <div class="row mt-4 mx-1 my-1">
        <div class="card">
            <div class="card-body">
                <h4 class="fw-bold "><span class="text-muted fw-light"></span> Jobs</h4>
                <div class="table-responsive text-wrap">
                    <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>Title</th>
                            <th>Type</th>
                            {{-- <th>Salary</th> --}}
                            <th>Location</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    @if (isset($jobs) && count($jobs) > 0)
                    <tbody class="table-border-bottom-0">
                        @foreach ($jobs as $job)
                            <tr>
                                <td>{{$job->id}}</td>
                                <td>{{$job->title}}</td>
                                <td>{{$job->type}}</td>
                                {{-- <td>{{$job->currency ?? 'AED'}} {{$job->min_salary > 0 ? ($job->min_salary.' - ') : ''}}{{$job->max_salary}}<span>/year</span></td> --}}
                                <td>{{$job->location}}</td>
                                <td>
                                    <a href="{{url('admin/jobs/detail/' . $job->id)}}">
                                        <i class="menu-icon tf-icons bx bx-show btn btn-primary btn-xs"></i>
                                    </a>
                                </td>
                            </tr>
                        @endforeach
                    </tbody>
                    @else
                        <td colspan="6" class="text-center">No record found</td>
                    @endif
                    </table>
                </div>
            </div>
        </div>
    </div>

    <div class="row mt-4 mx-1 my-1">
        <div class="card">
            <div class="card-body">
                <h4 class="fw-bold "><span class="text-muted fw-light"></span> Forums</h4>
                <div class="table-responsive text-wrap">
                    <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>Title</th>
                            <th>description</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    @if (isset($forums) && count($forums) > 0)
                    <tbody class="table-border-bottom-0">
                        @foreach ($forums as $forum)
                            <tr>
                                <td>{{$forum->id}}</td>
                                <td>{{$forum->title}}</td>
                                <td>{{$forum->description}}</td>
                                <td>
                                    <a href="{{url('admin/forums/detail/' . $forum->id)}}">
                                        <i class="menu-icon tf-icons bx bx-show btn btn-primary btn-xs"></i>
                                    </a>
                                </td>
                            </tr>
                        @endforeach
                    </tbody>
                    @else
                        <td colspan="4" class="text-center">No record found</td>
                    @endif
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>