@extends('iqec.layouts.app')

@section('content')
    <div class="container-fluid">
        <div class="row page-titles">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="{{ route('authorised-partners.index') }}">Authorised Partners</a></li>
                <li class="breadcrumb-item active"><a href="javascript:void(0)">Details</a></li>
            </ol>
        </div>
        @include('iqec.partials.flash')
        <div class="card">
            <div class="card-header d-flex justify-content-between">
                <h4 class="card-title mb-0">{{ $authorisedPartner->applicant_name }}</h4>
                <span class="badge {{ $authorisedPartner->user->status->badgeClass() }}">{{ $authorisedPartner->user->status->label() }}</span>
            </div>
            <div class="card-body">
                <div class="row">
                    <div class="col-md-6">
                        <p><strong>Email:</strong> {{ $authorisedPartner->email }}</p>
                        <p><strong>Phone:</strong> {{ $authorisedPartner->phone }}</p>
                        <p><strong>Institute:</strong> {{ $authorisedPartner->institute_name }}</p>
                    </div>
                    <div class="col-md-6">
                        <p><strong>Promoter:</strong> {{ $authorisedPartner->promoter?->applicant_name ?: 'None' }}</p>
                        <p><strong>Courseware partners:</strong> {{ $authorisedPartner->coursewarePartners->pluck('applicant_name')->join(', ') ?: 'None' }}</p>
                    </div>
                </div>
                <a href="{{ route('authorised-partners.edit', $authorisedPartner) }}" class="btn btn-primary" onclick="return confirm('Are you sure you want to edit this authorised partner?')">Edit</a>
                <a href="{{ route('authorised-partners.index') }}" class="btn btn-light">Back</a>
            </div>
        </div>
    </div>
@endsection
