<?php $__env->startSection('content'); ?>
<div class="container">
    <h2>Investments</h2>
    <a href="<?php echo e(route('investments.create')); ?>" class="btn btn-primary mb-3">Add Investment</a>

    
    <form method="GET" action="<?php echo e(route('investments.index')); ?>" class="mb-4">
        <div class="row">
            <div class="col-md-3">
                <label for="investor_id">Investor</label>
                <select name="investor_id" id="investor_id" class="form-control">
                    <option value="">All Investors</option>
                    <?php $__currentLoopData = $investors; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $investor): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($investor->id); ?>" <?php echo e(request('investor_id') == $investor->id ? 'selected' : ''); ?>>
                            <?php echo e($investor->name); ?>

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

            <div class="col-md-3">
                <label for="type">Type</label>
                <select name="type" id="type" class="form-control">
                    <option value="">All Types</option>
                    <option value="IN" <?php echo e(request('type') == 'IN' ? 'selected' : ''); ?>>IN</option>
                    <option value="OUT" <?php echo e(request('type') == 'OUT' ? 'selected' : ''); ?>>OUT</option>
                    <option value="CAR" <?php echo e(request('type') == 'CAR' ? 'selected' : ''); ?>>CAR</option>
                </select>
            </div>

            <div class="col-md-3">
                <label for="date">Date</label>
                <input type="date" name="date" id="date" value="<?php echo e(request('date')); ?>" class="form-control">
            </div>

            <div class="col-md-3 d-flex align-items-end">
                <button type="submit" class="btn btn-success me-2">Filter</button>
                <a href="<?php echo e(route('investments.index')); ?>" class="btn btn-secondary">Reset</a>
            </div>
        </div>
    </form>

    
    <?php if(session('success')): ?>
        <div class="alert alert-success"><?php echo e(session('success')); ?></div>
    <?php endif; ?>

    
    <table class="table table-bordered">
        <thead>
            <tr>
                <th>ID</th>
                <th>Investor</th>
                <th>Type</th>
                <th>Amount</th>
                <th>Date</th>
                <th>Remarks</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
            <?php $__empty_1 = true; $__currentLoopData = $investments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $investment): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <tr>
                <td><?php echo e($investment->id); ?></td>
                <td><?php echo e($investment->investor->name ?? 'N/A'); ?></td>
                <td><?php echo e(ucfirst($investment->type)); ?></td>
                <td><?php echo e(number_format($investment->amount, 2)); ?></td>
                <td><?php echo e($investment->date); ?></td>
                <td><?php echo e($investment->remarks); ?></td>
                <td>
                    <a href="<?php echo e(route('investments.edit', $investment->id)); ?>" class="btn btn-sm btn-warning">Edit</a>
                    <form action="<?php echo e(route('investments.destroy', $investment->id)); ?>" method="POST" style="display:inline;">
                        <?php echo csrf_field(); ?>
                        <?php echo method_field('DELETE'); ?>
                        <button type="submit" onclick="return confirm('Are you sure?')" class="btn btn-sm btn-danger">
                            Delete
                        </button>
                    </form>
                </td>
            </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <tr>
                <td colspan="7" class="text-center">No investments found</td>
            </tr>
            <?php endif; ?>
        </tbody>
    </table>

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

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Applications/XAMPP/xamppfiles/htdocs/laravel-app12/resources/views/investments/index.blade.php ENDPATH**/ ?>