<?php $__env->startSection('content'); ?>
    <div class="page-container">

        <div class="page-title-head d-flex align-items-sm-center flex-sm-row flex-column gap-2">
            <div class="flex-grow-1">
                <h4 class="fs-18 fw-semibold mb-0"><?php echo e($title); ?></h4>
            </div>

            <div class="text-end">
                <?php if (isset($component)) { $__componentOriginalf249638ac7504c50bf0259c0cb71919d = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalf249638ac7504c50bf0259c0cb71919d = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.dashboard.user.breadcrumbs','data' => ['breadcrumbs' => $breadcrumbs]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('dashboard.user.breadcrumbs'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['breadcrumbs' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($breadcrumbs)]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalf249638ac7504c50bf0259c0cb71919d)): ?>
<?php $attributes = $__attributesOriginalf249638ac7504c50bf0259c0cb71919d; ?>
<?php unset($__attributesOriginalf249638ac7504c50bf0259c0cb71919d); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalf249638ac7504c50bf0259c0cb71919d)): ?>
<?php $component = $__componentOriginalf249638ac7504c50bf0259c0cb71919d; ?>
<?php unset($__componentOriginalf249638ac7504c50bf0259c0cb71919d); ?>
<?php endif; ?>
            </div>
        </div>

        <div class="row">
            
            <div class="col-xl-12 col-lg-12">
                <div class="col-lg-10 mx-auto">
                    <div class="card border-0 shadow rounded-4 overflow-hidden">

                        
                        <div
                            class="card-header bg-light border-bottom px-4 px-md-5 py-3 d-flex justify-content-between align-items-center gap-2 flex-wrap">
                            <div>
                                <p class="text-uppercase text-muted fw-bold mb-0"
                                    style="font-size:.68rem;letter-spacing:.08em;">Loan Application</p>
                                <span class="fw-semibold"><?php echo e($title); ?></span>
                            </div>
                            <span class="<?php echo e($loan->status->badge()); ?> rounded-pill px-3 py-2"
                                style="font-size:.72rem;letter-spacing:.04em;">
                                <?php echo e($loan->status->label()); ?>

                            </span>
                        </div>

                        
                        <div class="text-center py-5 px-3 position-relative loan-hero">
                            <div class="loan-hero-glow"></div>
                            <div class="position-relative">
                                <p class="text-uppercase fw-bold mb-2 text-muted"
                                    style="font-size:.68rem;letter-spacing:.1em;">Requested Amount</p>
                                <h2 class="display-5 fw-bold text-dark mb-1">
                                    <?php echo e(currency($loan->user->currency)); ?><?php echo e(formatAmount($loan->amount)); ?>

                                </h2>
                                <div class="d-flex justify-content-center gap-2 flex-wrap mt-2">
                                    <span class="badge bg-white border text-muted fw-semibold px-3 py-2 rounded-pill"
                                        style="font-size:.72rem;">
                                        <i class="bi bi-calendar3 me-1"></i><?php echo e($loan->duration); ?> months
                                    </span>
                                    <span class="badge bg-white border text-muted fw-semibold px-3 py-2 rounded-pill"
                                        style="font-size:.72rem;">
                                        <i class="bi bi-building me-1"></i><?php echo e($loan->facility); ?>

                                    </span>
                                </div>
                            </div>
                        </div>

                        <div class="card-body px-4 px-md-5 py-4">

                            
                            <p class="text-uppercase text-muted fw-bold mb-3 pb-2 border-bottom"
                                style="font-size:.68rem;letter-spacing:.1em;">
                                Application Details
                            </p>

                            <div class="row g-0 mb-4">

                                <div class="col-12 col-sm-6 py-3 pe-sm-4 border-bottom">
                                    <p class="text-muted mb-1" style="font-size:.75rem;font-weight:500;">Purpose</p>
                                    <strong><?php echo e($loan->purpose); ?></strong>
                                </div>

                                <div class="col-12 col-sm-6 py-3 ps-sm-4 border-bottom loan-border-start-sm">
                                    <p class="text-muted mb-1" style="font-size:.75rem;font-weight:500;">Monthly Income</p>
                                    <strong><?php echo e($loan->monthly_income); ?></strong>
                                </div>

                                <?php if($loan->isRejected() && $loan->remarks): ?>
                                    <div class="col-12 py-3 border-bottom">
                                        <p class="text-muted mb-1" style="font-size:.75rem;font-weight:500;">Rejection
                                            Remarks</p>
                                        <strong class="text-danger"><?php echo e($loan->remarks); ?></strong>
                                    </div>
                                <?php endif; ?>

                            </div>

                            
                            <?php if($loan->isApproved() || $loan->isDisbursed()): ?>
                                <p class="text-uppercase text-muted fw-bold mb-3 pb-2 border-bottom"
                                    style="font-size:.68rem;letter-spacing:.1em;">
                                    Approval Details
                                </p>

                                <div class="bg-light rounded-3 p-3 p-md-4 mb-4">
                                    <div class="row g-0">

                                        <div class="col-12 col-sm-4 py-3 pe-sm-3 border-bottom">
                                            <p class="text-muted mb-1" style="font-size:.75rem;font-weight:500;">Approved
                                                Amount</p>
                                            <strong
                                                class="fs-6"><?php echo e(currency($user->currency)); ?><?php echo e(formatAmount($loan->approved_amount)); ?></strong>
                                        </div>

                                        <div class="col-12 col-sm-4 py-3 px-sm-3 border-bottom loan-border-start-sm">
                                            <p class="text-muted mb-1" style="font-size:.75rem;font-weight:500;">Interest
                                                Rate</p>
                                            <strong class="fs-6"><?php echo e($loan->interest_rate); ?>%</strong>
                                        </div>

                                        <div class="col-12 col-sm-4 py-3 ps-sm-3 border-bottom loan-border-start-sm">
                                            <p class="text-muted mb-1" style="font-size:.75rem;font-weight:500;">Total
                                                Payable</p>
                                            <strong
                                                class="fs-6"><?php echo e(currency($user->currency)); ?><?php echo e(formatAmount($loan->total_payable)); ?></strong>
                                        </div>

                                        <?php if($loan->isDisbursed()): ?>
                                            <div class="col-12 py-3">
                                                <p class="text-muted mb-1" style="font-size:.75rem;font-weight:500;">
                                                    Disbursed At</p>
                                                <strong><?php echo e(formatDate($loan->disbursed_at)); ?></strong>
                                            </div>
                                        <?php endif; ?>

                                    </div>
                                </div>
                            <?php endif; ?>

                            
                            <?php if($loan->loanRepayment && count($loan->loanRepayment)): ?>
                                <p class="text-uppercase text-muted fw-bold mb-3 pb-2 border-bottom"
                                    style="font-size:.68rem;letter-spacing:.1em;">
                                    Repayment History
                                </p>

                                <div class="d-flex flex-column gap-2 mb-4">
                                    <?php $__currentLoopData = $loan->loanRepayment; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $loanRepayment): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <div
                                            class="border rounded-3 px-4 py-3 d-flex justify-content-between align-items-center flex-wrap gap-2">
                                            <div>
                                                <p class="text-muted mb-0"
                                                    style="font-size:.68rem;font-weight:500;letter-spacing:.06em;text-transform:uppercase;">
                                                    Amount</p>
                                                <strong style="font-family:monospace;">
                                                    <?php echo e(currency($loan->user->currency)); ?><?php echo e(formatAmount($loanRepayment->amount)); ?>

                                                </strong>
                                            </div>
                                            <div class="text-center">
                                                <p class="text-muted mb-0"
                                                    style="font-size:.68rem;font-weight:500;letter-spacing:.06em;text-transform:uppercase;">
                                                    Repaid At</p>
                                                <strong><?php echo e($loanRepayment->repaid_at ? formatDate($loanRepayment->repaid_at) : 'N/A'); ?></strong>
                                            </div>
                                            <span class="<?php echo e($loanRepayment->status->badge()); ?> rounded-pill px-3 py-1"
                                                style="font-size:.7rem;">
                                                <?php echo e($loanRepayment->status->label()); ?>

                                            </span>
                                        </div>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </div>
                            <?php endif; ?>

                            
                            <?php if($loan->isRejected()): ?>
                                <div
                                    class="rounded-3 border border-danger-subtle bg-danger-subtle px-4 py-3 mb-4 d-flex align-items-start gap-3">
                                    <i class="bi bi-x-circle-fill text-danger mt-1 flex-shrink-0"></i>
                                    <p class="mb-0 small text-danger-emphasis">
                                        This loan application was rejected. Please review the remarks above or contact
                                        support for more information.
                                    </p>
                                </div>
                            <?php endif; ?>

                            
                            <div class="d-flex flex-wrap justify-content-between align-items-center gap-2 pt-3 border-top">

                                <?php if (isset($component)) { $__componentOriginal85363d436c73ae3b977fe300a0042f5d = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal85363d436c73ae3b977fe300a0042f5d = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.dashboard.user.back-button','data' => ['href' => ''.e(route('user.loan.index')).'','name' => 'Back to Loans']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('dashboard.user.back-button'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['href' => ''.e(route('user.loan.index')).'','name' => 'Back to Loans']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal85363d436c73ae3b977fe300a0042f5d)): ?>
<?php $attributes = $__attributesOriginal85363d436c73ae3b977fe300a0042f5d; ?>
<?php unset($__attributesOriginal85363d436c73ae3b977fe300a0042f5d); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal85363d436c73ae3b977fe300a0042f5d)): ?>
<?php $component = $__componentOriginal85363d436c73ae3b977fe300a0042f5d; ?>
<?php unset($__componentOriginal85363d436c73ae3b977fe300a0042f5d); ?>
<?php endif; ?>

                                <?php if($loan->isDisbursed() && !$latestLoanRepayment->isPaid()): ?>
                                    <a href="<?php echo e(route('user.loan.repay', $loan->uuid)); ?>"
                                        onclick="return confirm('Are you sure?')"
                                        class="btn btn-primary d-inline-flex align-items-center gap-2 rounded-3">
                                        <i class="bi bi-cash-stack"></i>
                                        Repay
                                        (<?php echo e(currency($loan->user->currency)); ?><?php echo e(formatAmount($loan->total_payable)); ?>)
                                    </a>
                                <?php endif; ?>

                            </div>

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

            <style>
                .loan-hero {
                    /* background-color: #f7f8fa; */
                }

                .loan-hero-glow {
                    position: absolute;
                    inset: 0;
                    pointer-events: none;
                    background: radial-gradient(ellipse 70% 70% at 50% 0%, rgba(13, 110, 253, .07) 0%, transparent 70%);
                }

                @media (min-width: 576px) {
                    .loan-border-start-sm {
                        border-left: 1px solid #dee2e6 !important;
                    }
                }
            </style>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('dashboard.user.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\projects\online-banking-v7.3-seacoast-bank\resources\views/dashboard/user/loan/show.blade.php ENDPATH**/ ?>