

<?php $__env->startSection('title', 'Expense Claims- Canindigo INC'); ?>

<?php $__env->startSection('content'); ?>
<div class="bg-white rounded-lg shadow">
    <div class="px-6 py-4 border-b border-gray-200 flex justify-between items-center">
        <h3 class="text-lg font-medium text-gray-900">Expense Claims</h3>
        <a href="<?php echo e(route('expenses.create')); ?>" class="bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 flex items-center">
            <i class="fas fa-plus mr-2"></i>Add New Expense
        </a>
    </div>
    <div class="mt-2 grid grid-cols-1 md:grid-cols-4 gap-4">
        <div class="bg-blue-50 p-4 rounded-lg">
            <p class="text-sm font-medium text-blue-800">Total Expenses All Time</p>
            <p class="text-2xl font-bold text-blue-900"><?php echo e(number_format($totalAmount, 2)); ?>-OMR</p>
        </div>
        <div class="bg-green-50 p-4 rounded-lg">
            <p class="text-sm font-medium text-green-800">Total Approved</p>
            <p class="text-2xl font-bold text-green-900"><?php echo e(number_format($totalApproved, 2)); ?>-OMR</p>
        </div>
        <div class="bg-red-50 p-4 rounded-lg">
            <p class="text-sm font-medium text-red-800">Total Rejected</p>
            <p class="text-2xl font-bold text-red-900"><?php echo e(number_format($totalRejected, 2)); ?>-OMR</p>
        </div>
        <div class="bg-gray-50 p-4 rounded-lg">
            <p class="text-sm font-medium text-gray-800">Total Pending</p>
            <p class="text-2xl font-bold text-gray-900"><?php echo e(number_format($totalPending, 2)); ?>-OMR</p>
        </div>
    </div>
    
    <div class="p-6">
        <?php if(session('success')): ?>
            <div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded mb-4"><?php echo e(session('success')); ?></div>
        <?php endif; ?>

        <?php if($expenses->isEmpty()): ?>
            <div class="text-center py-8">
                <p class="text-gray-500 text-lg">No expense claims found.</p>
                <a href="<?php echo e(route('expenses.create')); ?>" class="mt-4 inline-flex items-center px-4 py-2 bg-blue-600 border border-transparent rounded-md font-semibold text-white hover:bg-blue-700">Submit Your Claim</a>
            </div>
        <?php else: ?>
            <div class="overflow-x-auto">
                <table class="min-w-full divide-y divide-gray-200">
                    <thead class="bg-gray-50">
                        <tr>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Description</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Category</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Amount</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Client Site</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
                        </tr>
                    </thead>
                    <tbody class="bg-white divide-y divide-gray-200">
                        <?php $__currentLoopData = $expenses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $expense): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <div class="text-sm font-medium text-gray-900"><?php echo e($expense->expense_date->format('M d, Y')); ?></div>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <div class="text-sm font-medium text-gray-900"><?php echo e($expense->description); ?></div>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <div class="text-sm font-medium text-gray-900"><?php echo e($expense->category->name); ?></div>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <div class="text-sm font-medium text-gray-900"><?php echo e(number_format($expense->amount, 2)); ?>-OMR</div>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <div class="text-sm font-medium text-gray-900"><?php echo e($expense->clientSite->name); ?></div>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <span class="badge 
                                    <?php if($expense->status == 'approved'): ?> badge-success
                                    <?php elseif($expense->status == 'rejected'): ?> badge-danger
                                    <?php else: ?> badge-warning <?php endif; ?>">
                                    <div class="text-sm font-medium text-gray-900"><?php echo e(ucfirst($expense->status)); ?></div>
                                    
                                </span>
                            </td>
                            <td class="px-6 py-4 whitespace-nowrap">
                                <a href="<?php echo e(route('expenses.show', $expense)); ?>" class="btn btn-sm btn-info">
                                    <i class="fas fa-eye"></i>
                                </a>
                                <?php if($expense->receipt_path): ?>
                                <a href="<?php echo e(route('expenses.download-receipt', $expense)); ?>" class="btn btn-sm btn-secondary">
                                    <i class="fas fa-download"></i>
                                </a>
                                <?php endif; ?>
                            </td>
                        </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
            </div>
        <?php endif; ?>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH D:\xampp\htdocs\Scratch\resources\views/expenses/index.blade.php ENDPATH**/ ?>