
<?php $__env->startSection('content'); ?>
<style>
    .status-pending {
        color: #ffc107;
        font-weight: 500;
    }
    .status-approved {
        color: #28a745;
        font-weight: 500;
    }
    .status-rejected {
        color: #dc3545;
        font-weight: 500;
    }
    .document-link {
        color: #4e73df;
    }
    .document-link:hover {
        text-decoration: underline;
    }
    .action-btns .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
</style>

<!-- begin::main content -->
<main class="main-content">
    <div class="container">
        <!-- begin::page header -->
        <div class="page-header">
            <h3>Investments</h3>
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="<?php echo e(route('dashboard')); ?>">Dashboard</a></li>
                    <li class="breadcrumb-item active" aria-current="page">Investments</li>
                </ol>
            </nav>
        </div>
        
        <?php if (isset($component)) { $__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\FlashMessage::class, []); ?>
<?php $component->withName('flashMessage'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74)): ?>
<?php $component = $__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74; ?>
<?php unset($__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74); ?>
<?php endif; ?>
        
        <div class="card">
            <div class="card-header pt-5">
                <div class="row">
                    <div class="col-md-10">
                        <form action="<?php echo e(asset('hrms/investments-list')); ?>" class="row" method="GET">
                            <div class="form-group col-md-3">
                                <label>Employee Id</label>
                                <input type="text" class="form-control" name="employee_id" value="<?php echo e(isset($_GET['employee_id']) ? $_GET['employee_id'] : ''); ?>">
                            </div>
                            <div class="form-group col-2">
                                <label>Financial Year</label>
                                <input type="text" name="financial_year" placeholder="2025-26" class="form-control" value="<?php echo e(isset($_GET['financial_year']) ? $_GET['financial_year'] : ''); ?>">
                            </div>
                            
                            <div class="form-group col-3">
                                    <label for="claim_type" class="required-field">Investment Type</label>
                                    <select class="form-control" id="claim_type" name="investment_type" required>
                                        <option selected disabled>Select Claim Type</option>
                                        <option value="house_rent" <?php echo e(isset($_GET['investment_type']) && $_GET['investment_type'] == 'house_rent' ? 'selected' : ''); ?>>House Rent</option>
                                        <option value="house_loan" <?php echo e(isset($_GET['investment_type']) && $_GET['investment_type'] == 'house_loan' ? 'selected' : ''); ?>>Home Loan</option>
                                        <option value="investment" <?php echo e(isset($_GET['investment_type']) && $_GET['investment_type'] == 'investment' ? 'selected' : ''); ?>>Investment</option>
                                        
                                    </select>
                                </div>
                            <div class=" col-2 pt-4">
                                <div>
                                    <button class="btn btn-outline-secondary" type="submit"><i class="ti ti-search"></i></button>
                                    <a class="btn btn-outline-secondary" href="<?php echo e(asset('hrms/investments-list')); ?>"><i class="ti ti-reload"></i></a>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="col-md-2 text-right pt-4">
                        <!-- <a href="<?php echo e(asset('employee/add-reimbursement')); ?>" class="btn btn-success text-white">
                            <i class="fa fa-plus mr-2"></i> New Claim
                        </a> -->
                    </div>
                </div>
            </div>
            <?php if(isset($policy)): ?>
            <div class="card-body">
                <div class="table-responsive">
                    <table class="table table-striped table-hover">
                        <thead class="thead-light">
                            <tr>
                                <th>#</th>
                                <th>Employee Id</th>
                                <th>Name</th>                                
                                <th>Investment Type</th>
                                <th>Amount</th>
                                <th>Approved By</th>
                                <th>Financial Year</th>
                                <th>Status</th>
                                
                            </tr>
                        </thead>
                        <?php if($policy->count() != 0): ?>
                            <tbody>
                                <?php $__currentLoopData = $policy; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td><?php echo e(++$key); ?></td>
                                    <td><?php echo e($value->employee_id); ?></td>
                                    <td><?php echo e($value->employee_name); ?></td>
                                    <td><?php echo e($value->investment_name); ?></td>
                                    <td><?php echo e($value->amount); ?></td>
                                    <td><?php echo e($value->approved_name); ?></td>
                                    <td><?php echo e($value->financial_year); ?></td>
                            
                                    
                                    <td>
                                        <select class="form-control investment_status" investment_id="<?php echo e($value->id); ?>" investment_type="policy">
                                            <option value="pending" <?php echo e($value->status=="pending" ? 'selected' : ''); ?>>Pending</option>
                                            <option value="reject" <?php echo e($value->status=="reject" ? 'selected' : ''); ?>>Reject</option>
                                            <option value="approved" <?php echo e($value->status=="approved" ? 'selected' : ''); ?>>Approved</option>
                                        </select>
                                        
                                    </td>
                                    
                                </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                
                            </tbody>
                        <?php endif; ?>
                    </table>
                </div>
                
                
                <div class="mt-3 d-flex justify-content-center">
                <?php echo e($policy->links('pagination::bootstrap-4')); ?> 
                </div>
            
            </div>
            <?php endif; ?>
            <?php if(isset($house_rent)): ?>
            <div class="card-body">
                <div class="table-responsive">
                    <table class="table table-striped table-hover">
                        <thead class="thead-light">
                            <tr>
                                <th>#</th>
                                <th>Employee Id</th>
                                <th>Name</th> 
                                <th>LandLord Name</th>  
                                <th>LandLord PAN</th>                               
                                <th>Amount</th>
                                <th>Approved By</th>
                                <th>Financial Year</th>
                                <th>Status</th>
                                
                            </tr>
                        </thead>
                        <?php if($house_rent->count() != 0): ?>
                            <tbody>
                                <?php $__currentLoopData = $house_rent; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td><?php echo e(++$key); ?></td>
                                    <td><?php echo e($value->employee_id); ?></td>
                                    <td><?php echo e($value->employee_name); ?></td>
                                    <td><?php echo e($value->landlord_name); ?></td>
                                    <td><?php echo e($value->landlord_pan); ?></td>
                                    <td><?php echo e($value->amount); ?></td>
                                    <td><?php echo e($value->approved_name); ?></td>
                                    <td><?php echo e($value->financial_year); ?></td>
                            
                                    
                                    <td>
                                        <select class="form-control investment_status" investment_id="<?php echo e($value->id); ?>" investment_type="house_rent">
                                            <option value="pending" <?php echo e($value->status=="pending" ? 'selected' : ''); ?>>Pending</option>
                                            <option value="reject" <?php echo e($value->status=="reject" ? 'selected' : ''); ?>>Reject</option>
                                            <option value="approved" <?php echo e($value->status=="approved" ? 'selected' : ''); ?>>Approved</option>
                                        </select>
                                        
                                    </td>
                                    
                                </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                
                            </tbody>
                        <?php endif; ?>
                    </table>
                </div>
                
                
                <div class="mt-3 d-flex justify-content-center">
                <?php echo e($house_rent->links('pagination::bootstrap-4')); ?> 
                </div>
            
            </div>
            <?php endif; ?>
            <?php if(isset($house_loan)): ?>
            <div class="card-body">
                <div class="table-responsive">
                    <table class="table table-striped table-hover">
                        <thead class="thead-light">
                            <tr>
                                <th>#</th>
                                <th>Employee Id</th>
                                <th>Name</th> 
                                <th>Lander Name</th>  
                                <th>Lander PAN</th> 
                                <th>Bank Name</th>                              
                                <th>Principal Amount</th>
                                <th>Interest Amount</th>
                                <th>Approved By</th>
                                <th>Financial Year</th>
                                <th>Status</th>
                                
                            </tr>
                        </thead>
                        <?php if($house_loan->count() != 0): ?>
                            <tbody>
                                <?php $__currentLoopData = $house_loan; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td><?php echo e(++$key); ?></td>
                                    <td><?php echo e($value->employee_id); ?></td>
                                    <td><?php echo e($value->employee_name); ?></td>
                                    <td><?php echo e($value->lander_name); ?></td>
                                    <td><?php echo e($value->lander_pan); ?></td>
                                    <td><?php echo e($value->bank_name); ?></td>
                                    <td><?php echo e($value->principal_amount); ?></td>
                                    <td><?php echo e($value->interest_amount); ?></td>
                                    <td><?php echo e($value->approved_name); ?></td>
                                    <td><?php echo e($value->financial_year); ?></td>
                            
                                    
                                    <td>
                                        <select class="form-control investment_status" investment_id="<?php echo e($value->id); ?>" investment_type="house_loan">
                                            <option value="pending" <?php echo e($value->status=="pending" ? 'selected' : ''); ?>>Pending</option>
                                            <option value="reject" <?php echo e($value->status=="reject" ? 'selected' : ''); ?>>Reject</option>
                                            <option value="approved" <?php echo e($value->status=="approved" ? 'selected' : ''); ?>>Approved</option>
                                        </select>
                                        
                                    </td>
                                    
                                </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                
                            </tbody>
                        <?php endif; ?>
                    </table>
                </div>
                
                
                <div class="mt-3 d-flex justify-content-center">
                <?php echo e($house_loan->links('pagination::bootstrap-4')); ?> 
                </div>
            
            </div>
            <?php endif; ?>
        </div>
    </div>
</main>
<!-- end::main content -->
<?php $__env->stopSection(); ?>

<?php $__env->startPush('footer-script'); ?>
<script>
    $(document).ready(function(){
        $(".investment_status").on("change",function(){
            var investment_id = $(this).attr("investment_id");
            var investment_type = $(this).attr("investment_type");
            var status = $(this).val();
            //alert(claim_id);
            $.ajaxSetup({
                            headers: {
                                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                            }
                        });
            $.ajax({
                type: "post",
                data: {
                    "investment_id": investment_id,
                    "investment_type": investment_type,
                    "status": status
                },
                url: "<?php echo e(asset('hrms/investment-status-change')); ?>",
                dataType: "html",
                success: function(result) 
                {
                    toastr.success("Status changed successfully !");
                    window.location.reload();
                },
                error: function(error,xhr,status)
                {
                    toastr.error("Failed !");
                    window.location.reload();
                }
            });
        });
    });
    
</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\blurb_erp\resources\views/hrms/investments/list.blade.php ENDPATH**/ ?>