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

<?php $__env->startSection('content'); ?>

<style>

.details-card{
    border-top:6px solid #104042;
}

.details-label{
    color:#6c757d;
    font-size:13px;
    margin-bottom:4px;
}

.details-value{
    font-weight:600;
    word-break:break-word;
}

.section-title{
    border-bottom:1px solid #dee2e6;
    padding-bottom:10px;
    margin-bottom:25px;
    font-weight:600;
}

.back-btn{
    text-decoration:none;
    color:#000;
}

.back-btn:hover{
    color:#104042;
}

.status-btn{
    min-width:120px;
}

</style>

<section class="container py-3">

    <div class="row g-3">

        <!-- SIDEBAR -->

        <div class="col-md-3 d-none d-md-block">

            <div class="row">

                <div class="col-12">

                    <h4 class="fw-bold mb-3">

                        Admin Dashboard

                    </h4>

                </div>

            </div>

            <div class="sidebar">

                <a href="<?php echo e(route('admin.dashboard')); ?>">

                    <i class="fa fa-chart-line"></i>

                    Dashboard

                </a>

                <a href="<?php echo e(route('admin.dashboard')); ?>#users-tab"
                   class="active">

                    <i class="fa fa-users"></i>

                    Users

                </a>
                
                <form method="POST"
                      action="<?php echo e(route('admin.logout')); ?>">

                    <?php echo csrf_field(); ?>

                    <button class="btn btn-primary-custom w-100 mt-3">

                        Logout

                    </button>

                </form>

            </div>

        </div>

        <!-- CONTENT -->

        <div class="col-md-9">

            <!-- HEADER -->

            <div class="d-flex justify-content-between align-items-center gap-2 mb-3">

    <a href="<?php echo e(url('admin/user-loans/' . $loanApplication->user_id)); ?>"
       class="back-btn fw-semibold">

        <h4>
            <i class="fa-solid fa-arrow-left-long me-2"></i>
            Loan Application Details
        </h4>

    </a>

    
    <a href="<?php echo e(route('admin.loan.details.download', $loanApplication->id)); ?>"
       class="btn btn-primary-custom">
        <i class="fa fa-download me-1"></i>
        Download PDF & Documents
    </a>

</div>

            <!-- STATUS UPDATE -->
 <?php if($loanApplication->status == "completed"): ?>
            <div class="row mb-3">
                
              

    <div class="col-12 col-lg-12">
        <div class="d-flex gap-3 justify-content-end">
            <form method="POST"
                  action="<?php echo e(route('admin.loan.status.update', $loanApplication->id)); ?>">
                <?php echo csrf_field(); ?>
    
                <input type="hidden" name="status" value="approved">
    
                <button class="card-custom border-0 btn text-center bg-success text-white">
                    <div class="fw-semibold">Approve</div>
                </button>
            </form>
            <form method="POST"
                  action="<?php echo e(route('admin.loan.status.update', $loanApplication->id)); ?>">
                <?php echo csrf_field(); ?>
    
                <input type="hidden" name="status" value="rejected">
    
                <button class="card-custom border-0 btn text-center bg-danger text-white">
                    <div class="fw-semibold">Reject</div>
                </button>
            </form>
            
            <a href="<?php echo e(url('view-application')); ?>"
               class="btn btn-primary-custom">
                <i class="fa fa-eye me-1"></i>
                View Application
            </a>
        </div>
    </div>

    <div class="col-4">
        
    </div>

    <!--<div class="col-4">-->
    <!--    <form method="POST"-->
    <!--          action="<?php echo e(route('admin.loan.status.update', $loanApplication->id)); ?>">-->
    <!--        <?php echo csrf_field(); ?>-->

    <!--        <input type="hidden" name="status" value="completed">-->

    <!--        <button class="card-custom border-0 w-100 px-2 py-3 p-md-4 text-center bg-dark text-white">-->
    <!--            <div class="fw-semibold">Completed</div>-->
    <!--        </button>-->
    <!--    </form>-->
    <!--</div>-->

</div>
<?php endif; ?>

            <!-- CARD -->

            <div class="card-custom p-4 details-card">

                <!-- PERSONAL -->

                 <!-- PERSONAL -->
                <div class="preview-section mb-5">

                    <h5 class="section-title">
                        Personal Information
                    </h5>

                    <div class="row g-3">

                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Full Name</div>
                            <div class="details-value">
                                <?php echo e($loanApplication->full_name ?? 'N/A'); ?>

                            </div>
                        </div>

                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Date of Birth</div>
                            <div class="details-value">
                                <?php echo e($loanApplication->dob ? \Carbon\Carbon::parse($loanApplication->dob)->format('m-d-Y') : 'N/A'); ?>

                            </div>
                        </div>

                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Gender</div>
                            <div class="details-value">
                                <?php echo e($loanApplication->gender ?? 'N/A'); ?>

                            </div>
                        </div>

                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Marital Status</div>
                            <div class="details-value">
                                <?php echo e($loanApplication->marital_status ?? 'N/A'); ?>

                            </div>
                        </div>

                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Father Name</div>
                            <div class="details-value">
                                <?php echo e($loanApplication->father_name ?? 'N/A'); ?>

                            </div>
                        </div>

                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">PAN Number</div>
                            <div class="details-value">
                                <?php echo e($loanApplication->pan_number ?? 'N/A'); ?>

                            </div>
                        </div>

                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Aadhaar Number</div>
                            <div class="details-value">
                                <?php echo e($loanApplication->aadhaar_number ?? 'N/A'); ?>

                            </div>
                        </div>

                    </div>

                </div>

                <!-- ADDRESS -->
                <div class="preview-section mb-5">

                    <h5 class="section-title">
                        Address Details
                    </h5>

                    <div class="row g-3">

                        <div class="col-12 col-lg-6">
                            <div class="details-label">Current Address</div>

                             <div>
                                <strong>Address :</strong>
                                <span ><?php echo e($loanApplication->current_address ?? 'N/A'); ?></span>
                            </div>
                            
                            <div>
                                <strong>City :</strong>
                                <span ><?php echo e($loanApplication->current_city ?? 'N/A'); ?></span>
                            </div>
                
                
                            <div>
                                <strong>State :</strong>
                                <span ><?php echo e($loanApplication->current_state ?? 'N/A'); ?></span>
                            </div>
                                        <div>
                                <strong>Country :</strong>
                                <span ><?php echo e($loanApplication->current_country ?? 'N/A'); ?></span>
                            </div>
                            
                        </div>

                        <div class="col-12 col-lg-6">
                            <div class="details-label">Permanent Address</div>

                             <div>
                                <strong>Address :</strong>
                                <span ><?php echo e($loanApplication->permanent_address ?? 'N/A'); ?></span>
                            </div>
                            
                            <div>
                                <strong>City :</strong>
                                <span ><?php echo e($loanApplication->permanent_city ?? 'N/A'); ?></span>
                            </div>
                
                
                            <div>
                                <strong>State :</strong>
                                <span ><?php echo e($loanApplication->permanent_state ?? 'N/A'); ?></span>
                            </div>
                                        <div>
                                <strong>Country :</strong>
                                <span ><?php echo e($loanApplication->permanent_country ?? 'N/A'); ?></span>
                            </div>
                        </div>

                    </div>

                </div>

                <!-- LOAN -->
                <div class="preview-section mb-5">

                    <h5 class="section-title">
                        Loan Details
                    </h5>

                    <div class="row g-3">

                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Loan Type</div>
                            <div class="details-value">
                                <?php echo e($loanApplication->loan_type ?? 'N/A'); ?>

                            </div>
                        </div>

                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Purpose</div>
                            <div class="details-value">
                                <?php echo e($loanApplication->purpose_of_loan ?? 'N/A'); ?>

                            </div>
                        </div>



                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Kit Cost</div>
                            <div class="details-value">
                                ₹ <?php echo e(number_format((float)($loanApplication->kit_cost ?? 0))); ?>

                            </div>
                        </div>

                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Down Payment</div>
                            <div class="details-value">
                                ₹ <?php echo e(number_format((float)($loanApplication->down_payment ?? 0))); ?>

                            </div>
                        </div>

                         <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Loan Amount</div>
                            <div class="details-value">
                                ₹ <?php echo e(number_format((float)($loanApplication->loan_amount ?? 0))); ?>

                            </div>
                        </div>

                        
                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Period in Months</div>
                            <div class="details-value">
                                <?php echo e($loanApplication->loan_tenure ?? 0); ?> Months
                            </div>
                        </div>

                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Membership Fees</div>
                            <div class="details-value">
                                ₹ <?php echo e(number_format((float)($loanApplication->membership_fees ?? 0))); ?>

                            </div>
                        </div>

                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Documentation Fees</div>
                            <div class="details-value">
                                ₹ <?php echo e(number_format((float)($loanApplication->documentation_fees ?? 0))); ?>

                            </div>
                        </div>

                         <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Processing Fees</div>
                            <div class="details-value">
                                ₹ <?php echo e(number_format((float)($loanApplication->processing_charges ?? 0))); ?>

                            </div>
                        </div>

                        
                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Total Loan Amount</div>
                            <div class="details-value">
                                ₹ <?php echo e(number_format((float)($loanApplication->total_payment ?? 0))); ?>

                            </div>
                        </div>

                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Rate of Interest</div>
                            <div class="details-value">
                                <?php echo e($loanApplication->rate_of_intrest !== null && $loanApplication->rate_of_intrest !== '' ? $loanApplication->rate_of_intrest . '%' : 'N/A'); ?>

                            </div>
                        </div>
                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Total Interest</div>
                            <div class="details-value">
                                ₹ <?php echo e(number_format((float)($loanApplication->total_interest ?? 0))); ?>

                            </div>
                        </div>


                        <div class="col-12 col-sm-6 col-lg-4" style="display:none;">
                            <div class="details-label">Preferred EMI</div>
                            <div class="details-value">
                                ₹ <?php echo e(number_format((float)($loanApplication->preferred_emi ?? 0))); ?>

                            </div>
                        </div>






                    </div>

                </div>

                <!-- FINANCIAL -->
                <div class="preview-section mb-5">

                    <h5 class="section-title">
                        Financial Details
                    </h5>

                    <div class="row g-3">

                    <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Occupation</div>
                            <div class="details-value">
                                <?php echo e($loanApplication->occupation ?? ''); ?>

                            </div>
                        </div>


                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Income particulars</div>
                            <div class="details-value">
                                 <?php echo e($loanApplication->income_particulars ?? ''); ?>

                            </div>
                        </div>

                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Repayment schedule</div>
                            <div class="details-value">
                                 <?php echo e($loanApplication->repayment_schedule ?? ''); ?>

                            </div>
                        </div>

                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Renewal After</div>
                            <div class="details-value">
                                 <?php echo e($loanApplication->renewal_after ?? ''); ?>

                            </div>
                        </div>


                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Security Purpose</div>
                            <div class="details-value">
                                 <?php echo e($loanApplication->security_purpose ??  ''); ?>

                            </div>
                        </div>


                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Monthly Income</div>
                            <div class="details-value">
                                ₹ <?php echo e(number_format((float)($loanApplication->monthly_income ?? 0))); ?>

                            </div>
                        </div>

                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Annual Income</div>
                            <div class="details-value">
                                ₹ <?php echo e(number_format((float)($loanApplication->annual_income ?? 0))); ?>

                            </div>
                        </div>

                        <div class="col-12 col-sm-6 col-lg-4">
                            <div class="details-label">Employment Type</div>
                            <div class="details-value">
                                <?php echo e($loanApplication->employment_type ?? 'N/A'); ?>

                            </div>
                        </div>

                    </div>

                </div>

                <!-- DOCUMENTS -->
                <div class="preview-section">

                    <h5 class="section-title">
                        Documents
                    </h5>

                    <div class="row g-2 g-md-3">

                        <?php if($loanApplication->id_proof): ?>
                            <div class="col-6 col-sm-6 col-lg-4">
                                <a href="<?php echo e(asset('storage/' . $loanApplication->id_proof)); ?>"
                                   target="_blank"
                                   class="btn btn-primary-custom w-100">
                                   View ID Proof
                                </a>
                            </div>
                        <?php endif; ?>

                        <?php if($loanApplication->address_proof): ?>
                            <div class="col-6 col-sm-6 col-lg-4">
                                <a href="<?php echo e(asset('storage/' . $loanApplication->address_proof)); ?>"
                                   target="_blank"
                                   class="btn btn-primary-custom w-100">
                                    View Address Proof
                                </a>
                            </div>
                        <?php endif; ?>

                        <?php if($loanApplication->income_proof): ?>
                            <div class="col-6 col-sm-6 col-lg-4">
                                <a href="<?php echo e(asset('storage/' . $loanApplication->income_proof)); ?>"
                                   target="_blank"
                                   class="btn btn-primary-custom w-100">
                                    View Income Proof
                                </a>
                            </div>
                        <?php endif; ?>
                        
                        <?php if($loanApplication->bankstatements_proof): ?>
                            <div class="col-6 col-sm-6 col-lg-4">
                                <a href="<?php echo e(asset('storage/' . $loanApplication->bankstatements_proof)); ?>"
                                   target="_blank"
                                   class="btn btn-primary-custom w-100">
                                    View Bank Statements
                                </a>
                            </div>
                        <?php endif; ?>
                        
                        <?php if($loanApplication->business_proof): ?>
                            <div class="col-6 col-sm-6 col-lg-4">
                                <a href="<?php echo e(asset('storage/' . $loanApplication->business_proof)); ?>"
                                   target="_blank"
                                   class="btn btn-primary-custom w-100">
                                    View Business Proof
                                </a>
                            </div>
                        <?php endif; ?>

                            <?php if($loanApplication->on_boarding_letter): ?>
                            <div class="col-6 col-sm-6 col-lg-4">
                                <a href="<?php echo e(asset('storage/' . $loanApplication->on_boarding_letter)); ?>"
                                   target="_blank"
                                   class="btn btn-primary-custom w-100">
                                   Onboarding letter
                                </a>
                            </div>
                        <?php endif; ?>

                         <?php if($loanApplication->background_verification): ?>
                            <div class="col-6 col-sm-6 col-lg-4">
                                <a href="<?php echo e(asset('storage/' . $loanApplication->background_verification)); ?>"
                                   target="_blank"
                                   class="btn btn-primary-custom w-100">
                                   background verification
                                </a>
                            </div>
                        <?php endif; ?>
                         <?php if($loanApplication->file_name3): ?>
                            <div class="col-6 col-sm-6 col-lg-4">
                                <a href="<?php echo e(asset('storage/' . $loanApplication->file_name3)); ?>"
                                   target="_blank"
                                   class="btn btn-primary-custom w-100">
                                    File name3
                                </a>
                            </div>
                        <?php endif; ?>
                         <?php if($loanApplication->file_name4): ?>
                            <div class="col-6 col-sm-6 col-lg-4">
                                <a href="<?php echo e(asset('storage/' . $loanApplication->file_name4)); ?>"
                                   target="_blank"
                                   class="btn btn-primary-custom w-100">
                                    File name4
                                </a>
                            </div>
                        <?php endif; ?>
                         <?php if($loanApplication->file_name5): ?>
                            <div class="col-6 col-sm-6 col-lg-4">
                                <a href="<?php echo e(asset('storage/' . $loanApplication->file_name5)); ?>"
                                   target="_blank"
                                   class="btn btn-primary-custom w-100">
                                   File name5
                                </a>
                            </div>
                        <?php endif; ?>

                        <?php if($loanApplication->photo_proof): ?>
                            <div class="col-6 col-sm-6 col-lg-4">
                                <a href="<?php echo e(asset('storage/' . $loanApplication->photo_proof)); ?>"
                                   target="_blank"
                                   class="btn btn-primary-custom w-100">
                                   Photo Proof
                                </a>
                            </div>
                        <?php endif; ?>
                    </div>

                </div>

            </div>

        </div>

    </div>

</section>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/neefc25/public_html/kapstono/resources/views/admin/loan-details.blade.php ENDPATH**/ ?>