<?php $__env->startSection('title','Application Review'); ?>
<?php $__env->startSection('subtitle','Review the complete professional application and uploaded credentials.'); ?>
<?php $__env->startSection('content'); ?>
<?php
 $profile=$application->user?->profile;
 $documents=$application->documents;
 $apiUrl=rtrim(config('admin.api_url'),'/');
 $fileUrl=fn($file)=>$file ? $apiUrl.'/storage/professionals/'.$application->professional_uuid.'/'.ltrim($file,'/') : null;
 $profileImage=trim((string)($profile?->image??''));
 $profileImageUrl=$profileImage!==''?(Illuminate\Support\Str::startsWith($profileImage,['http://','https://'])?$profileImage:$apiUrl.'/storage/users/'.$application->user_id.'/'.ltrim($profileImage,'/')):null;
?>
<a class="back-link" href="<?php echo e(route('applications')); ?>">
    <i data-lucide="arrow-left"></i>Back to applications </a>
<section class="application-hero">
    <div class="review-avatar" style="--avatar-border:<?php echo e($application->profession?->color_hex??'#7bd300'); ?>"><?php if($profileImageUrl): ?> <img src="<?php echo e($profileImageUrl); ?>" alt="<?php echo e($profile?->full_name); ?>" onerror="this.hidden=true;this.nextElementSibling.hidden=false">
        <span hidden><?php echo e(strtoupper(substr($profile?->full_name??'P',0,1))); ?></span><?php else: ?> <span><?php echo e(strtoupper(substr($profile?->full_name??'P',0,1))); ?></span><?php endif; ?>
    </div>
    <div class="hero-copy">
        <small>PROFESSIONAL APPLICANT</small>
        <h2><?php echo e($profile?->full_name??'Professional'); ?></h2>
        <p><?php echo e($application->user?->email); ?> · <?php echo e($profile?->contact_number?:'No contact number'); ?></p>
        <div>
            <span class="profession-chip" style="--profession:<?php echo e($application->profession?->color_hex??'#7bd300'); ?>"><?php echo e($application->profession?->name??'Profession unavailable'); ?></span>
            <span class="application-status <?php echo e($application->status); ?>"><?php echo e(ucfirst($application->status)); ?></span>
        </div>
    </div>
    <dl>
        <div>
            <dt>Application ID</dt>
            <dd>#<?php echo e(str_pad($application->id,5,'0',STR_PAD_LEFT)); ?></dd>
        </div>
        <div>
            <dt>Submitted</dt>
            <dd><?php echo e($application->updated_at?->format('M d, Y')); ?></dd>
        </div>
    </dl>
</section>
<div class="review-layout">
    <div class="review-content">
        <section class="review-section">
            <div class="review-title">
                <i data-lucide="user-round"></i>
                <div>
                    <h2>Personal Information</h2>
                    <p>Identity and contact information</p>
                </div>
            </div>
            <dl class="detail-grid">
                <div>
                    <dt>Full Name</dt>
                    <dd><?php echo e($profile?->full_name??'—'); ?></dd>
                </div>
                <div>
                    <dt>Gender</dt>
                    <dd><?php echo e(ucfirst($profile?->gender??'—')); ?></dd>
                </div>
                <div>
                    <dt>Birthday</dt>
                    <dd><?php echo e($profile?->birthday?:'—'); ?></dd>
                </div>
                <div>
                    <dt>Email</dt>
                    <dd><?php echo e($application->user?->email); ?></dd>
                </div>
                <div>
                    <dt>Contact Number</dt>
                    <dd><?php echo e($profile?->contact_number?:'—'); ?></dd>
                </div>
                <div class="wide">
                    <dt>Current Address</dt>
                    <dd><?php echo e($profile?->current_address?:collect([$profile?->brgy,$profile?->city,$profile?->state,$profile?->country,$profile?->zip_code])->filter()->join(', ') ?: '—'); ?></dd>
                </div>
            </dl>
        </section>
        <section class="review-section">
            <div class="review-title">
                <i data-lucide="briefcase-business"></i>
                <div>
                    <h2>Professional Information</h2>
                    <p>Practice credentials and profile</p>
                </div>
            </div>
            <dl class="detail-grid">
                <div>
                    <dt>Profession</dt>
                    <dd><?php echo e($application->profession?->name??'—'); ?></dd>
                </div>
                <div>
                    <dt>Salutation</dt>
                    <dd><?php echo e($application->profession?->salutation??'—'); ?></dd>
                </div>
                <div>
                    <dt>Default Rate</dt>
                    <dd>₱<?php echo e(number_format($application->default_rate,2)); ?></dd>
                </div>
                <div>
                    <dt>PRC Number</dt>
                    <dd><?php echo e($documents?->prc_number??'—'); ?></dd>
                </div>
                <div>
                    <dt>Admission Date</dt>
                    <dd><?php echo e($documents?->admission_date?->format('M d, Y')??'—'); ?></dd>
                </div>
                <div class="wide">
                    <dt>Specialties</dt>
                    <dd class="specialty-list"><?php $__empty_1 = true; $__currentLoopData = $application->specialties; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $specialty): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?> <span><?php echo e($specialty->custom_name?:$specialty->specialty?->name??'Specialty'); ?></span><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?> — <?php endif; ?> </dd>
                </div>
                <div class="wide">
                    <dt>Professional Bio</dt>
                    <dd class="prose"><?php echo e($application->bio?:'No biography submitted.'); ?></dd>
                </div>
            </dl>
        </section>
        <section class="review-section">
            <div class="review-title">
                <i data-lucide="graduation-cap"></i>
                <div>
                    <h2>Educational Background</h2>
                    <p>Submitted academic qualifications</p>
                </div>
            </div>
            <div class="education-list"><?php $__empty_1 = true; $__currentLoopData = $application->educations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $education): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?> <article>
                    <i></i>
                    <div>
                        <b><?php echo e($education->degree); ?><?php echo e($education->field_of_study ? ' · '.$education->field_of_study : ''); ?></b>
                        <p><?php echo e($education->school); ?></p>
                        <small><?php echo e(collect([$education->start_year,$education->end_year])->filter()->join(' – ')); ?></small>
                    </div>
                </article><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?> <p class="empty">No educational background submitted.</p><?php endif; ?> </div>
        </section>
        <section class="review-section">
            <div class="review-title">
                <i data-lucide="paperclip"></i>
                <div>
                    <h2>Application Attachments</h2>
                    <p>Open an attachment to inspect the original file</p>
                </div>
            </div>
            <div class="attachment-grid"><?php $__currentLoopData = [['PRC Identification',$documents?->prc_id,'id-card'],['Signature',$documents?->signature,'signature'],['Selfie with PRC',$documents?->selfie_prc,'scan-face']]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $document): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <article>
                    <div class="attachment-preview"><?php if($fileUrl($document[1])): ?> <img src="<?php echo e($fileUrl($document[1])); ?>" alt="<?php echo e($document[0]); ?>" onerror="this.hidden=true;this.nextElementSibling.hidden=false">
                        <i hidden data-lucide="<?php echo e($document[2]); ?>"></i><?php else: ?> <i data-lucide="<?php echo e($document[2]); ?>"></i><?php endif; ?>
                    </div>
                    <b><?php echo e($document[0]); ?></b>
                    <small><?php echo e($document[1]?:'Not submitted'); ?></small><?php if($fileUrl($document[1])): ?> <a href="<?php echo e($fileUrl($document[1])); ?>" target="_blank" rel="noopener">View original <i data-lucide="external-link"></i>
                    </a><?php else: ?> <span>Unavailable</span><?php endif; ?>
                </article><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </div>
        </section>
        <section class="review-section">
            <div class="review-title">
                <i data-lucide="map-pin"></i>
                <div>
                    <h2>Office and Availability</h2>
                    <p>Practice address and submitted schedule</p>
                </div>
            </div>
            <p class="office-address"><?php echo e($application->office ? collect([$application->office->building_name,$application->office->address,$application->office->city,$application->office->province,$application->office->country,$application->office->zip_code])->filter()->join(', ') : 'No office information submitted.'); ?></p>
            <div class="schedule-grid"><?php $__empty_1 = true; $__currentLoopData = $application->schedules; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $schedule): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?> <article>
                    <b><?php echo e(ucfirst($schedule->day_of_week)); ?></b>
                    <span><?php echo e($schedule->time_from); ?> – <?php echo e($schedule->time_to); ?></span>
                    <small>₱<?php echo e(number_format($schedule->rate,2)); ?></small>
                </article><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?> <p class="empty">No availability submitted.</p><?php endif; ?> </div>
        </section>
    </div>
    <aside class="decision-panel">
        <small>CURRENT DECISION</small>
        <span class="application-status <?php echo e($application->status); ?>"><?php echo e(ucfirst($application->status)); ?></span>
        <h2>Application Decision</h2>
        <p>Review all information and uploaded credentials before making a final decision.</p>
        <form method="post" action="<?php echo e(route('applications.update',$application)); ?>"><?php echo csrf_field(); ?> <?php echo method_field('patch'); ?> <button class="approve-button" name="status" value="approved">
                <i data-lucide="check"></i>Approve Application </button>
            <button class="decline-button" name="status" value="declined" onclick="return confirm('Decline this professional application? The professional account will be deactivated.')">
                <i data-lucide="x"></i>Decline Application </button>
        </form>
        <div class="decision-note">
            <i data-lucide="shield-check"></i>
            <span>The decision immediately updates the professional and user account status.</span>
        </div>
    </aside>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/dev/desxpert-admin/resources/views/admin/application-detail.blade.php ENDPATH**/ ?>