

<?php $__env->startSection('title', 'Expenses'); ?>
<?php $__env->startSection('heading', ($expenseScope ?? 'company') === 'self' ? 'My expense claims' : 'Expenses'); ?>

<?php $__env->startSection('content'); ?>
<?php $currency = config('app.currency_symbol', '₹'); ?>

<?php echo $__env->make('finance.top-submenu', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(count($expenseScopeOptions ?? []) > 1): ?>
    <div class="mb-4 flex flex-wrap gap-2">
        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $expenseScopeOptions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $scopeKey): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <a href="<?php echo e(route('expenses.index', array_merge(request()->only('status'), ['scope' => $scopeKey]))); ?>"
               class="rounded-full px-3 py-1.5 text-sm font-medium transition <?php echo e(($expenseScope ?? '') === $scopeKey ? 'bg-primary text-white' : 'bg-slate-100 text-slate-700 hover:bg-slate-200'); ?>">
                <?php echo e(app(\App\Services\Finance\FinanceNavService::class)->expenseScopeLabel($scopeKey)); ?>

            </a>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
    </div>
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

<?php if (isset($component)) { $__componentOriginal53747ceb358d30c0105769f8471417f6 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal53747ceb358d30c0105769f8471417f6 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.card','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('card'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
    <div class="mb-4 flex flex-wrap items-center justify-between gap-4">
        <div>
            <p class="text-sm text-slate-600">Track operational spend and reimbursement claims.</p>
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(request('status') === 'pending' && $expenses->total() > 0): ?>
                <p class="mt-1 text-xs text-amber-600"><?php echo e($expenses->total()); ?> expense(s) need review.</p>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </div>
        <div class="flex flex-wrap items-center gap-3">
            <form method="GET" class="flex gap-2">
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(request('scope')): ?>
                    <input type="hidden" name="scope" value="<?php echo e(request('scope')); ?>">
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                <select name="status" class="rounded-lg border border-slate-300 px-3 py-1.5 text-sm js-select2" onchange="this.form.submit()">
                    <option value="">All statuses</option>
                    <option value="pending" <?php echo e(request('status') === 'pending' ? 'selected' : ''); ?>>Pending</option>
                    <option value="approved" <?php echo e(request('status') === 'approved' ? 'selected' : ''); ?>>Approved</option>
                    <option value="paid" <?php echo e(request('status') === 'paid' ? 'selected' : ''); ?>>Paid</option>
                    <option value="rejected" <?php echo e(request('status') === 'rejected' ? 'selected' : ''); ?>>Rejected</option>
                </select>
            </form>
            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('create', App\Models\Expense::class)): ?>
            <a href="<?php echo e(route('expenses.create')); ?>" class="inline-flex items-center gap-1.5 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-white hover:bg-primary-hover">
                <i class="bi bi-plus-lg"></i> <?php echo e(app(\App\Services\Finance\FinanceNavService::class)->canViewCompanyExpenses(auth()->user()) ? 'Add expense' : 'Submit claim'); ?>

            </a>
            <?php endif; ?>
        </div>
    </div>
    <?php if (isset($component)) { $__componentOriginal163c8ba6efb795223894d5ffef5034f5 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal163c8ba6efb795223894d5ffef5034f5 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.table','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('table'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
         <?php $__env->slot('head', null, []); ?> 
            <tr>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(($expenseScope ?? 'company') !== 'self'): ?>
                    <th class="px-4 py-3 text-left text-xs font-medium uppercase text-slate-500">Employee</th>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                <th class="px-4 py-3 text-left text-xs font-medium uppercase text-slate-500">Category</th>
                <th class="px-4 py-3 text-left text-xs font-medium uppercase text-slate-500">Amount</th>
                <th class="px-4 py-3 text-left text-xs font-medium uppercase text-slate-500 hidden md:table-cell">Account</th>
                <th class="px-4 py-3 text-left text-xs font-medium uppercase text-slate-500">Date</th>
                <th class="px-4 py-3 text-left text-xs font-medium uppercase text-slate-500">Status</th>
                <th class="px-4 py-3 text-right text-xs font-medium uppercase text-slate-500">Actions</th>
            </tr>
         <?php $__env->endSlot(); ?>
        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $expenses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $e): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <tr class="hover:bg-slate-50/80">
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(($expenseScope ?? 'company') !== 'self'): ?>
                    <td class="whitespace-nowrap px-4 py-3 text-sm text-slate-700"><?php echo e($e->claimant?->name ?? '—'); ?></td>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                <td class="whitespace-nowrap px-4 py-3 text-sm font-medium text-slate-900"><?php echo e($e->category); ?></td>
                <td class="whitespace-nowrap px-4 py-3 text-sm font-semibold text-slate-800"><?php echo e($currency); ?><?php echo e(number_format($e->amount, 2)); ?></td>
                <td class="whitespace-nowrap px-4 py-3 text-sm text-slate-600 hidden md:table-cell"><?php echo e($e->account?->name ?? '—'); ?></td>
                <td class="whitespace-nowrap px-4 py-3 text-sm text-slate-600"><?php echo e($e->date?->format('M d, Y')); ?></td>
                <td class="whitespace-nowrap px-4 py-3 text-sm">
                    <?php if (isset($component)) { $__componentOriginal2ddbc40e602c342e508ac696e52f8719 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal2ddbc40e602c342e508ac696e52f8719 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.badge','data' => ['variant' => $e->statusBadgeVariant()]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('badge'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['variant' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($e->statusBadgeVariant())]); ?><?php echo e($e->statusLabel()); ?> <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal2ddbc40e602c342e508ac696e52f8719)): ?>
<?php $attributes = $__attributesOriginal2ddbc40e602c342e508ac696e52f8719; ?>
<?php unset($__attributesOriginal2ddbc40e602c342e508ac696e52f8719); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal2ddbc40e602c342e508ac696e52f8719)): ?>
<?php $component = $__componentOriginal2ddbc40e602c342e508ac696e52f8719; ?>
<?php unset($__componentOriginal2ddbc40e602c342e508ac696e52f8719); ?>
<?php endif; ?>
                </td>
                <td class="whitespace-nowrap px-4 py-3 text-right text-sm">
                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('view', $e)): ?>
                        <a href="<?php echo e(route('expenses.show', ['expense' => $e, 'scope' => request('scope')])); ?>" class="btn-icon-action btn-icon-action--view" title="View" aria-label="View"><i class="bi bi-eye"></i></a>
                    <?php endif; ?>
                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('update', $e)): ?>
                        <a href="<?php echo e(route('expenses.edit', ['expense' => $e, 'scope' => request('scope')])); ?>" class="btn-icon-action btn-icon-action--edit" title="Edit" aria-label="Edit"><i class="bi bi-pencil-square"></i></a>
                    <?php endif; ?>
                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('review', $e)): ?>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($e->status === 'pending'): ?>
                            <form action="<?php echo e(route('expenses.update-status', $e)); ?>" method="post" class="ms-2 inline">
                                <?php echo csrf_field(); ?>
                                <input type="hidden" name="status" value="approved">
                                <button type="submit" class="text-xs text-emerald-600 hover:underline">Approve</button>
                            </form>
                            <form action="<?php echo e(route('expenses.update-status', $e)); ?>" method="post" class="ms-1 inline">
                                <?php echo csrf_field(); ?>
                                <input type="hidden" name="status" value="rejected">
                                <button type="submit" class="text-xs text-red-600 hover:underline">Reject</button>
                            </form>
                        <?php elseif($e->status === 'approved'): ?>
                            <form action="<?php echo e(route('expenses.update-status', $e)); ?>" method="post" class="ms-2 inline">
                                <?php echo csrf_field(); ?>
                                <input type="hidden" name="status" value="paid">
                                <button type="submit" class="text-xs text-sky-600 hover:underline">Mark paid</button>
                            </form>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    <?php endif; ?>
                </td>
            </tr>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <tr><td colspan="<?php echo e(($expenseScope ?? 'company') === 'self' ? 6 : 7); ?>" class="p-0">
                <?php echo $__env->make('finance.partials.empty-state', [
                    'title' => ($expenseScope ?? 'self') === 'self' ? 'No claims submitted yet' : 'No expenses in this view',
                    'description' => ($expenseScope ?? 'self') === 'self'
                        ? 'Submit a reimbursement claim and track approval status here.'
                        : 'Try another status filter or check back when new claims are submitted.',
                    'actionUrl' => ($expenseScope ?? 'self') === 'self' && auth()->user()?->can('create', App\Models\Expense::class) ? route('expenses.create') : null,
                    'actionLabel' => 'Submit claim',
                    'icon' => 'bi-receipt',
                ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
            </td></tr>
        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal163c8ba6efb795223894d5ffef5034f5)): ?>
<?php $attributes = $__attributesOriginal163c8ba6efb795223894d5ffef5034f5; ?>
<?php unset($__attributesOriginal163c8ba6efb795223894d5ffef5034f5); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal163c8ba6efb795223894d5ffef5034f5)): ?>
<?php $component = $__componentOriginal163c8ba6efb795223894d5ffef5034f5; ?>
<?php unset($__componentOriginal163c8ba6efb795223894d5ffef5034f5); ?>
<?php endif; ?>
    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($expenses->hasPages()): ?><div class="mt-4"><?php echo e($expenses->links()); ?></div><?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal53747ceb358d30c0105769f8471417f6)): ?>
<?php $attributes = $__attributesOriginal53747ceb358d30c0105769f8471417f6; ?>
<?php unset($__attributesOriginal53747ceb358d30c0105769f8471417f6); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal53747ceb358d30c0105769f8471417f6)): ?>
<?php $component = $__componentOriginal53747ceb358d30c0105769f8471417f6; ?>
<?php unset($__componentOriginal53747ceb358d30c0105769f8471417f6); ?>
<?php endif; ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/kiyohr/v2_version/resources/views/finance/expenses.blade.php ENDPATH**/ ?>