<?php $__env->startSection('title', 'ব্যয় তালিকা - আমবাগান যুব কল্যাণ সমিতি'); ?>

<?php $__env->startSection('styles'); ?>
<style>
    .expense-card {
        border-left: 4px solid #dc3545;
        border-radius: 8px;
        margin-bottom: 15px;
    }
    
    .expense-card.approved {
        border-left-color: #28a745;
    }
    
    .expense-card.pending {
        border-left-color: #ffc107;
    }
    
    .expense-card.rejected {
        border-left-color: #6c757d;
    }
    
    .expense-amount {
        font-size: 1.2rem;
        font-weight: 600;
        color: #dc3545;
    }
    
    .expense-date {
        background-color: #f8f9fa;
        padding: 5px 10px;
        border-radius: 5px;
        font-size: 0.9rem;
    }
    
    .status-badge {
        padding: 5px 10px;
        border-radius: 20px;
        font-size: 0.8rem;
        font-weight: 600;
    }
    
    .badge-pending {
        background-color: #fff3cd;
        color: #856404;
    }
    
    .badge-approved {
        background-color: #d4edda;
        color: #155724;
    }
    
    .badge-rejected {
        background-color: #f8d7da;
        color: #721c24;
    }
</style>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('breadcrumbs'); ?>
<nav aria-label="breadcrumb">
    <ol class="breadcrumb bg-light">
        <li class="breadcrumb-item"><a href="<?php echo e(route('dashboard')); ?>">ড্যাশবোর্ড</a></li>
        <li class="breadcrumb-item active">ব্যয় ব্যবস্থাপনা</li>
    </ol>
</nav>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="container-fluid">
    <!-- পরিসংখ্যান কার্ড -->
    <div class="row mb-4">
        <div class="col-md-3">
            <div class="card stat-card">
                <div class="card-body text-center">
                    <h5 class="card-title"><?php echo e(number_format($totalExpense, 2)); ?> টাকা</h5>
                    <p class="card-text">মোট ব্যয়</p>
                </div>
            </div>
        </div>
        <div class="col-md-3">
            <div class="card stat-card">
                <div class="card-body text-center">
                    <h5 class="card-title"><?php echo e(number_format($monthlyExpense, 2)); ?> টাকা</h5>
                    <p class="card-text">এই মাসের ব্যয়</p>
                </div>
            </div>
        </div>
        <div class="col-md-3">
            <div class="card stat-card">
                <div class="card-body text-center">
                    <h5 class="card-title"><?php echo e($expenses->where('status', 'pending')->count()); ?></h5>
                    <p class="card-text">মুলতুবি ব্যয়</p>
                </div>
            </div>
        </div>
        <div class="col-md-3">
            <div class="card stat-card">
                <div class="card-body text-center">
                    <h5 class="card-title"><?php echo e($expenses->where('status', 'approved')->count()); ?></h5>
                    <p class="card-text">অনুমোদিত ব্যয়</p>
                </div>
            </div>
        </div>
    </div>
    
    <!-- একশন বাটন -->
    <div class="row mb-4">
        <div class="col-md-12">
            <div class="d-flex justify-content-between">
                <div class="btn-group" role="group">
                    <a href="<?php echo e(route('expenses.index')); ?>" class="btn btn-outline-primary active">
                        <i class="fas fa-list me-2"></i>সকল ব্যয়
                    </a>
                    <a href="<?php echo e(route('expenses.report')); ?>" class="btn btn-outline-info">
                        <i class="fas fa-chart-bar me-2"></i>রিপোর্ট
                    </a>
                    <a href="<?php echo e(route('expenses.monthly-report')); ?>" class="btn btn-outline-success">
                        <i class="fas fa-calendar-alt me-2"></i>মাসিক রিপোর্ট
                    </a>
                </div>
                
                <div>
                    <a href="<?php echo e(route('expenses.create')); ?>" class="btn btn-primary">
                        <i class="fas fa-plus me-2"></i>নতুন ব্যয় যোগ করুন
                    </a>
                </div>
            </div>
        </div>
    </div>
    
    <!-- ব্যয় তালিকা -->
    <div class="card">
        <div class="card-header">
            <h5 class="card-title mb-0">
                <i class="fas fa-money-bill-wave me-2"></i>ব্যয় তালিকা
            </h5>
        </div>
        <div class="card-body">
            <?php if($expenses->isEmpty()): ?>
            <div class="text-center py-5">
                <i class="fas fa-receipt fa-4x text-muted mb-3"></i>
                <h4>কোনো ব্যয় রেকর্ড পাওয়া যায়নি</h4>
                <p class="text-muted">আপনার প্রথম ব্যয় রেকর্ড যোগ করুন।</p>
                <a href="<?php echo e(route('expenses.create')); ?>" class="btn btn-primary mt-3">
                    <i class="fas fa-plus me-2"></i>প্রথম ব্যয় যোগ করুন
                </a>
            </div>
            <?php else: ?>
            <div class="table-responsive">
                <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>তারিখ</th>
                            <th>শিরোনাম</th>
                            <th>ক্যাটাগরি</th>
                            <th>পরিমাণ</th>
                            <th>পেমেন্ট পদ্ধতি</th>
                            <th>স্ট্যাটাস</th>
                            <th>কার্যক্রম</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__currentLoopData = $expenses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $expense): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr class="expense-card <?php echo e($expense->status); ?>">
                            <td>
                                <div class="expense-date">
                                    <?php echo e(date('d/m/Y', strtotime($expense->date))); ?>

                                </div>
                            </td>
                            <td>
                                <strong><?php echo e($expense->title); ?></strong>
                                <?php if($expense->description): ?>
                                <small class="d-block text-muted"><?php echo e(Str::limit($expense->description, 50)); ?></small>
                                <?php endif; ?>
                            </td>
                            <td>
                                <?php if($expense->category): ?>
                                <?php echo e($expense->category->name_in_bangla); ?>

                                <?php else: ?>
                                <span class="text-muted">N/A</span>
                                <?php endif; ?>
                            </td>
                            <td>
                                <span class="expense-amount"><?php echo e(number_format($expense->amount, 2)); ?> টাকা</span>
                            </td>
                            <td><?php echo e($expense->payment_method_in_bangla); ?></td>
                            <td>
                                <span class="status-badge badge-<?php echo e($expense->status); ?>">
                                    <?php echo e($expense->status_in_bangla); ?>

                                </span>
                            </td>
                            <td>
                                <div class="btn-group btn-group-sm">
                                    <a href="<?php echo e(route('expenses.show', $expense)); ?>" class="btn btn-outline-info" title="দেখুন">
                                        <i class="fas fa-eye"></i>
                                    </a>
                                    <a href="<?php echo e(route('expenses.edit', $expense)); ?>" class="btn btn-outline-warning" title="সম্পাদনা">
                                        <i class="fas fa-edit"></i>
                                    </a>
                                    <form action="<?php echo e(route('expenses.destroy', $expense)); ?>" method="POST" class="d-inline delete-form">
                                        <?php echo csrf_field(); ?>
                                        <?php echo method_field('DELETE'); ?>
                                        <button type="submit" class="btn btn-outline-danger" title="ডিলিট" onclick="return confirm('আপনি কি নিশ্চিত?')">
                                            <i class="fas fa-trash"></i>
                                        </button>
                                    </form>
                                </div>
                            </td>
                        </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
            </div>
            
            <!-- পেজিনেশন -->
            <div class="d-flex justify-content-center mt-4">
                <?php echo e($expenses->links()); ?>

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

<?php $__env->startSection('scripts'); ?>
<script>
$(document).ready(function() {
    // ফিল্টার ফর্ম
    $('#filterForm').on('submit', function(e) {
        e.preventDefault();
        const formData = $(this).serialize();
        window.location.href = "<?php echo e(route('expenses.index')); ?>?" + formData;
    });
    
    // ফিল্টার রিসেট
    $('#resetFilter').click(function() {
        $('#filterForm')[0].reset();
        window.location.href = "<?php echo e(route('expenses.index')); ?>";
    });
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/naowarin/somoti.naowarinternational.my.id/resources/views/expenses/index.blade.php ENDPATH**/ ?>