vernova/storage/framework/views/15dc9805bd50ffbccd898a04c0572745.php
2026-07-26 19:58:27 +03:30

183 lines
13 KiB
PHP

<?php $__env->startSection('content'); ?>
<div class="space-y-6">
<!-- Page Header -->
<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
<h1 class="text-2xl font-bold text-gray-900"><?php echo e(__('expense.expenses')); ?></h1>
<a href="<?php echo e(route('expenses.create')); ?>" class="inline-flex items-center gap-2 px-4 py-2 bg-teal-600 text-white text-sm font-medium rounded-lg hover:bg-teal-700 transition-colors">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/></svg>
<?php echo e(__('expense.new')); ?>
</a>
</div>
<!-- Filters -->
<div class="bg-white rounded-xl border border-gray-200 p-4">
<form method="GET" action="<?php echo e(route('expenses.index')); ?>" class="flex flex-wrap gap-3 items-end">
<div class="w-44">
<label class="block text-xs font-medium text-gray-500 mb-1"><?php echo e(__('expense.project')); ?></label>
<select name="project_id" class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500">
<option value=""><?php echo e(__('common.all')); ?></option>
<?php $__currentLoopData = $projects; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $project): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($project->id); ?>" <?php echo e(request('project_id') == $project->id ? 'selected' : ''); ?>><?php echo e($project->name); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
<div class="w-36">
<label class="block text-xs font-medium text-gray-500 mb-1"><?php echo e(__('expense.category')); ?></label>
<select name="category" class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500">
<option value=""><?php echo e(__('common.all')); ?></option>
<?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($cat); ?>" <?php echo e(request('category') === $cat ? 'selected' : ''); ?>><?php echo e(__('expense.category_' . $cat)); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
<div class="w-36">
<label class="block text-xs font-medium text-gray-500 mb-1"><?php echo e(__('expense.status')); ?></label>
<select name="status" class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-teal-500">
<option value=""><?php echo e(__('common.all')); ?></option>
<?php $__currentLoopData = $statuses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $status): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($status); ?>" <?php echo e(request('status') === $status ? 'selected' : ''); ?>><?php echo e(__('expense.status_' . $status)); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
<div class="w-36">
<label class="block text-xs font-medium text-gray-500 mb-1"><?php echo e(__('expense.from_date')); ?></label>
<?php if (isset($component)) { $__componentOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.date-input','data' => ['name' => 'from_date','value' => request('from_date')]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('date-input'); ?>
<?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(['name' => 'from_date','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(request('from_date'))]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1)): ?>
<?php $attributes = $__attributesOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1; ?>
<?php unset($__attributesOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1)): ?>
<?php $component = $__componentOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1; ?>
<?php unset($__componentOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1); ?>
<?php endif; ?>
</div>
<div class="w-36">
<label class="block text-xs font-medium text-gray-500 mb-1"><?php echo e(__('expense.to_date')); ?></label>
<?php if (isset($component)) { $__componentOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.date-input','data' => ['name' => 'to_date','value' => request('to_date')]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('date-input'); ?>
<?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(['name' => 'to_date','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(request('to_date'))]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1)): ?>
<?php $attributes = $__attributesOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1; ?>
<?php unset($__attributesOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1)): ?>
<?php $component = $__componentOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1; ?>
<?php unset($__componentOriginal2c7cd37e2e80199b9dbc9a9aa91b96b1); ?>
<?php endif; ?>
</div>
<button type="submit" class="px-4 py-2 bg-gray-100 text-gray-700 text-sm font-medium rounded-lg hover:bg-gray-200 transition-colors">
<?php echo e(__('common.filter')); ?>
</button>
</form>
</div>
<!-- Expense List -->
<div class="bg-white rounded-xl border border-gray-200 overflow-hidden">
<div class="overflow-x-auto">
<table class="w-full">
<thead class="bg-gray-50 border-b border-gray-200">
<tr>
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500"><?php echo e(__('expense.title')); ?></th>
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500"><?php echo e(__('expense.project')); ?></th>
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500"><?php echo e(__('expense.amount')); ?></th>
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500"><?php echo e(__('expense.category')); ?></th>
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500"><?php echo e(__('expense.date')); ?></th>
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500"><?php echo e(__('expense.status')); ?></th>
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500"><?php echo e(__('common.actions')); ?></th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100">
<?php $__empty_1 = true; $__currentLoopData = $expenses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $expense): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
<tr class="hover:bg-gray-50 transition-colors">
<td class="px-5 py-3">
<a href="<?php echo e(route('expenses.show', $expense)); ?>" class="text-sm font-medium text-gray-900 hover:text-teal-600"><?php echo e($expense->title); ?></a>
</td>
<td class="px-5 py-3 text-sm text-gray-600"><?php echo e($expense->project?->name); ?></td>
<td class="px-5 py-3 text-sm font-medium text-gray-900">
<?php echo e(format_currency((float)$expense->amount, $expense->currency?->code)); ?>
<?php if($expense->original_amount): ?>
<span class="text-xs text-gray-400 block">(<?php echo e(format_currency((float)$expense->original_amount, $expense->currency?->code)); ?>)</span>
<?php endif; ?>
</td>
<td class="px-5 py-3 text-sm text-gray-600"><?php echo e(__('expense.category_' . $expense->category)); ?></td>
<td class="px-5 py-3 text-sm text-gray-600"><?php echo e(calendar_date($expense->expense_date)); ?></td>
<td class="px-5 py-3">
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium
<?php echo e($expense->status === 'approved' ? 'bg-emerald-50 text-emerald-700' :
($expense->status === 'rejected' ? 'bg-red-50 text-red-700' :
($expense->status === 'paid' ? 'bg-blue-50 text-blue-700' : 'bg-amber-50 text-amber-700'))); ?>">
<?php echo e($expense->status_label); ?>
</span>
</td>
<td class="px-5 py-3">
<div class="flex items-center gap-1">
<?php if($expense->status === 'pending'): ?>
<button onclick="approveExpense(<?php echo e($expense->id); ?>)" class="px-2 py-1 text-xs font-medium text-emerald-700 bg-emerald-50 rounded hover:bg-emerald-100 transition-colors"><?php echo e(__('expense.approve')); ?></button>
<button onclick="rejectExpense(<?php echo e($expense->id); ?>)" class="px-2 py-1 text-xs font-medium text-red-700 bg-red-50 rounded hover:bg-red-100 transition-colors"><?php echo e(__('expense.reject')); ?></button>
<?php endif; ?>
</div>
</td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
<tr>
<td colspan="7" class="text-center py-12 text-gray-500"><?php echo e(__('expense.no_expenses')); ?></td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
<!-- Pagination -->
<div class="flex justify-center">
<?php echo e($expenses->withQueryString()->links()); ?>
</div>
</div>
<?php $__env->startPush('scripts'); ?>
<script>
async function approveExpense(id) {
const res = await fetch(`/expenses/${id}/approve`, {
method: 'PUT',
headers: { 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content, 'Accept': 'application/json' }
});
if ((await res.json()).success) location.reload();
}
async function rejectExpense(id) {
if (!confirm('<?php echo e(__("expense.confirm_reject")); ?>')) return;
const res = await fetch(`/expenses/${id}/reject`, {
method: 'PUT',
headers: { 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content, 'Accept': 'application/json' }
});
if ((await res.json()).success) location.reload();
}
</script>
<?php $__env->stopPush(); ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\projectra\resources\views/expenses/index.blade.php ENDPATH**/ ?>