@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('promoters.index') }}">Promoters</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">{{ $promoter->applicant_name }}</h4>
                <span class="badge {{ $promoter->user->status->badgeClass() }}">{{ $promoter->user->status->label() }}</span>
            </div>
            <div class="card-body">
                <div class="row">
                    <div class="col-md-6">
                        <p><strong>Email:</strong> {{ $promoter->email }}</p>
                        <p><strong>Phone:</strong> {{ $promoter->phone }}</p>
                        <p><strong>Designation:</strong> {{ $promoter->designation }}</p>
                        <p><strong>Address:</strong> {{ collect([$promoter->building, $promoter->street, $promoter->city, $promoter->state, $promoter->postal_code, $promoter->country])->filter()->join(', ') }}</p>
                    </div>
                    <div class="col-md-6">
                        <p><strong>Institute:</strong> {{ $promoter->institute_name }}</p>
                        <p><strong>Firm type:</strong> {{ $promoter->firm_type }}</p>
                        <p><strong>Operational area:</strong> {{ $promoter->operational_area }}</p>
                        <p><strong>Experience:</strong> {{ $promoter->experience }}</p>
                    </div>
                </div>
                @if ($promoter->photo_path)
                    <p><strong>Photo:</strong> <a href="{{ Storage::url($promoter->photo_path) }}" target="_blank">View</a></p>
                @endif
                @if ($promoter->id_proof_path)
                    <p><strong>ID proof:</strong> <a href="{{ Storage::url($promoter->id_proof_path) }}" target="_blank">View</a></p>
                @endif
                <p><strong>Authorised partners:</strong> {{ $promoter->authorisedPartners->pluck('applicant_name')->join(', ') ?: 'None' }}</p>
                <a href="{{ route('promoters.edit', $promoter) }}" class="btn btn-primary" onclick="return confirm('Are you sure you want to edit this promoter?')">Edit</a>
                <a href="{{ route('promoters.index') }}" class="btn btn-light">Back</a>
            </div>
        </div>
    </div>
@endsection
