<?php
if (Auth('admin')->User()->dashboard_style == 'light') {
    $text = 'dark';
    $bg = 'light';
} else {
    $bg = 'dark';
    $text = 'light';
}
?>


<?php $__env->startSection('title', $title ?? 'Leave Application Details'); ?>

<?php $__env->startSection('content'); ?>
    <?php echo $__env->make('admin.topmenu', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <?php echo $__env->make('admin.sidebar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <div class="main-panel">
        <div class="content">
            <div class="page-inner">
                <p>
                    <a href="<?php echo e(route('admin.leave-applications.index')); ?>">
                        <i class="p-2 rounded-lg fa fa-arrow-circle-left fa-2x bg-light"></i>
                    </a>
                </p>

                <div class="mt-2 mb-4">
                    <h1 class="title1 text-<?php echo e($text); ?>"><?php echo e($title ?? 'Leave Application Details'); ?></h1>
                    <p class="text-muted mt-1">Application ID: LA-<?php echo e(str_pad($leaveApplication->id, 6, '0', STR_PAD_LEFT)); ?></p>
                </div>

                <?php if (isset($component)) { $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4 = $component; } ?>
<?php $component = $__env->getContainer()->make(Illuminate\View\AnonymousComponent::class, ['view' => 'components.danger-alert','data' => []]); ?>
<?php $component->withName('danger-alert'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4)): ?>
<?php $component = $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4; ?>
<?php unset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4); ?>
<?php endif; ?>
                <?php if (isset($component)) { $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4 = $component; } ?>
<?php $component = $__env->getContainer()->make(Illuminate\View\AnonymousComponent::class, ['view' => 'components.success-alert','data' => []]); ?>
<?php $component->withName('success-alert'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4)): ?>
<?php $component = $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4; ?>
<?php unset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4); ?>
<?php endif; ?>

                <!-- Status and Actions -->
                <div class="row mb-4">
                    <div class="col-md-8">
                        <div class="card border-left-<?php echo e($leaveApplication->status_color); ?> shadow">
                            <div class="card-body">
                                <div class="row align-items-center">
                                    <div class="col">
                                        <h5 class="font-weight-bold mb-1 text-<?php echo e($text); ?>">
                                            Current Status:
                                            <?php if($leaveApplication->status === 'pending'): ?>
                                                <span class="badge badge-warning badge-lg">
                                                    <i class="fas fa-clock mr-1"></i>Pending Review
                                                </span>
                                            <?php elseif($leaveApplication->status === 'approved'): ?>
                                                <span class="badge badge-success badge-lg">
                                                    <i class="fas fa-check mr-1"></i>Approved
                                                </span>
                                            <?php elseif($leaveApplication->status === 'rejected'): ?>
                                                <span class="badge badge-danger badge-lg">
                                                    <i class="fas fa-times mr-1"></i>Rejected
                                                </span>
                                            <?php endif; ?>
                                        </h5>
                                        <p class="text-muted mb-0">Submitted: <?php echo e($leaveApplication->formatted_submitted_at); ?></p>
                                    </div>
                                    <div class="col-auto">
                        <?php if($leaveApplication->status === 'pending'): ?>
                            <div class="btn-group">
                                <form method="POST" action="<?php echo e(route('admin.leave-applications.update-status', $leaveApplication)); ?>" class="d-inline mr-2">
                                    <?php echo csrf_field(); ?>
                                    <?php echo method_field('PATCH'); ?>
                                    <input type="hidden" name="status" value="approved">
                                    <button type="submit" class="btn btn-success"
                                            onclick="return confirm('Are you sure you want to approve this application?')">
                                        <i class="fas fa-check mr-1"></i>Approve Application
                                    </button>
                                </form>

                                <form method="POST" action="<?php echo e(route('admin.leave-applications.update-status', $leaveApplication)); ?>" class="d-inline">
                                    <?php echo csrf_field(); ?>
                                    <?php echo method_field('PATCH'); ?>
                                    <input type="hidden" name="status" value="rejected">
                                    <button type="submit" class="btn btn-warning"
                                            onclick="return confirm('Are you sure you want to reject this application?')">
                                        <i class="fas fa-times mr-1"></i>Reject Application
                                    </button>
                                </form>
                            </div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-4">
            <div class="card border-left-danger shadow">
                <div class="card-body text-center">
                    <h6 class="font-weight-bold text-danger mb-2">Danger Zone</h6>
                    <form method="POST" action="<?php echo e(route('admin.leave-applications.destroy', $leaveApplication)); ?>">
                        <?php echo csrf_field(); ?>
                        <?php echo method_field('DELETE'); ?>
                        <button type="submit" class="btn btn-danger btn-sm"
                                onclick="return confirm('Are you sure you want to delete this application? This action cannot be undone.')">
                            <i class="fas fa-trash mr-1"></i>Delete Application
                        </button>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <!-- Service Member Information -->
        <div class="col-xl-6 mb-4">
            <div class="card shadow">
                <div class="card-header bg-primary text-white">
                    <h6 class="m-0 font-weight-bold">
                        <i class="fas fa-user-circle mr-2"></i>Service Member Information
                    </h6>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-sm-6">
                            <strong class="text-<?php echo e($text); ?>">Full Name:</strong><br>
                            <span class="text-primary font-weight-bold"><?php echo e($leaveApplication->full_name); ?></span>
                        </div>
                        <div class="col-sm-6">
                            <strong class="text-<?php echo e($text); ?>">Service Number:</strong><br>
                            <span class="text-<?php echo e($text); ?>"><?php echo e($leaveApplication->service_number); ?></span>
                        </div>
                    </div>
                    <hr>
                    <div class="row">
                        <div class="col-sm-4">
                            <strong class="text-<?php echo e($text); ?>">Rank:</strong><br>
                            <span class="badge badge-secondary"><?php echo e($leaveApplication->rank); ?></span>
                        </div>
                        <div class="col-sm-4">
                            <strong class="text-<?php echo e($text); ?>">Service Status:</strong><br>
                            <span class="text-<?php echo e($text); ?>"><?php echo e(ucfirst(str_replace('_', ' ', $leaveApplication->service_status))); ?></span>
                        </div>
                        <div class="col-sm-4">
                            <strong class="text-<?php echo e($text); ?>">Country of Service:</strong><br>
                            <span class="text-<?php echo e($text); ?>"><?php echo e(ucfirst(str_replace('_', ' ', $leaveApplication->country))); ?></span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- Applicant Information -->
        <div class="col-xl-6 mb-4">
            <div class="card shadow">
                <div class="card-header bg-info text-white">
                    <h6 class="m-0 font-weight-bold">
                        <i class="fas fa-user mr-2"></i>Applicant Information
                    </h6>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-sm-6">
                            <strong class="text-<?php echo e($text); ?>">Applicant Name:</strong><br>
                            <span class="text-<?php echo e($text); ?>"><?php echo e($leaveApplication->applicant_name); ?></span>
                        </div>
                        <div class="col-sm-6">
                            <strong class="text-<?php echo e($text); ?>">Relationship:</strong><br>
                            <span class="badge badge-info"><?php echo e(ucfirst(str_replace('_', ' ', $leaveApplication->relationship))); ?></span>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Leave Details -->
        <div class="col-xl-8 mb-4">
            <div class="card shadow">
                <div class="card-header bg-warning text-white">
                    <h6 class="m-0 font-weight-bold">
                        <i class="fas fa-calendar-alt mr-2"></i>Leave Details
                    </h6>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-md-4">
                            <strong class="text-<?php echo e($text); ?>">Leave Type:</strong><br>
                            <span class="badge badge-warning"><?php echo e(ucfirst(str_replace('_', ' ', $leaveApplication->leave_type))); ?></span>
                        </div>
                        <div class="col-md-4">
                            <strong class="text-<?php echo e($text); ?>">Days Requested:</strong><br>
                            <span class="h5 text-primary"><?php echo e($leaveApplication->days_requested); ?></span> <span class="text-<?php echo e($text); ?>">days</span>
                        </div>
                        <div class="col-md-4">
                            <strong class="text-<?php echo e($text); ?>">Current Balance:</strong><br>
                            <span class="text-<?php echo e($text); ?>"><?php echo e($leaveApplication->leave_balance ?? 'Not specified'); ?> days</span>
                        </div>
                    </div>
                    <hr>
                    <div class="row">
                        <div class="col-md-6">
                            <strong class="text-<?php echo e($text); ?>">Start Date:</strong><br>
                            <i class="fas fa-calendar mr-1 text-success"></i><span class="text-<?php echo e($text); ?>"><?php echo e($leaveApplication->formatted_start_date); ?></span>
                        </div>
                        <div class="col-md-6">
                            <strong class="text-<?php echo e($text); ?>">End Date:</strong><br>
                            <i class="fas fa-calendar mr-1 text-danger"></i><span class="text-<?php echo e($text); ?>"><?php echo e($leaveApplication->formatted_end_date); ?></span>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Contact Information -->
        <div class="col-xl-4 mb-4">
            <div class="card shadow">
                <div class="card-header bg-success text-white">
                    <h6 class="m-0 font-weight-bold">
                        <i class="fas fa-phone mr-2"></i>Contact Information
                    </h6>
                </div>
                <div class="card-body">
                    <div class="mb-3">
                        <strong class="text-<?php echo e($text); ?>">Phone:</strong><br>
                        <a href="tel:<?php echo e($leaveApplication->applicant_phone); ?>" class="text-decoration-none">
                            <i class="fas fa-phone mr-1"></i><?php echo e($leaveApplication->applicant_phone); ?>

                        </a>
                    </div>
                    <div>
                        <strong class="text-<?php echo e($text); ?>">Email:</strong><br>
                        <a href="mailto:<?php echo e($leaveApplication->applicant_email); ?>" class="text-decoration-none">
                            <i class="fas fa-envelope mr-1"></i><?php echo e($leaveApplication->applicant_email); ?>

                        </a>
                    </div>
                </div>
            </div>
        </div>

        <!-- Leave Address -->
        <div class="col-xl-6 mb-4">
            <div class="card shadow">
                <div class="card-header bg-secondary text-white">
                    <h6 class="m-0 font-weight-bold">
                        <i class="fas fa-map-marker-alt mr-2"></i>Address During Leave
                    </h6>
                </div>
                <div class="card-body">
                    <p class="mb-0 text-<?php echo e($text); ?>"><?php echo e($leaveApplication->leave_address); ?></p>
                </div>
            </div>
        </div>

        <!-- Justification -->
        <div class="col-xl-6 mb-4">
            <div class="card shadow">
                <div class="card-header bg-dark text-white">
                    <h6 class="m-0 font-weight-bold">
                        <i class="fas fa-file-alt mr-2"></i>Justification & Purpose
                    </h6>
                </div>
                <div class="card-body">
                    <p class="mb-0 text-<?php echo e($text); ?>"><?php echo e($leaveApplication->justification); ?></p>
                </div>
            </div>
        </div>
    </div>
            </div>
        </div>
    </div>

<?php if(session('success')): ?>
    <script>
        Swal.fire({
            icon: 'success',
            title: 'Success!',
            text: '<?php echo e(session('success')); ?>',
            confirmButtonColor: '#28a745'
        });
    </script>
<?php endif; ?>

<?php if(session('error')): ?>
    <script>
        Swal.fire({
            icon: 'error',
            title: 'Error!',
            text: '<?php echo e(session('error')); ?>',
            confirmButtonColor: '#dc3545'
        });
    </script>
<?php endif; ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/lpzmfgmrni/usgodefense.com/resources/views/admin/leave-applications/show.blade.php ENDPATH**/ ?>