@extends('admin.layouts.app') @section('title', get_setting('site_name').' | '.__('Employee Bonus')) @section('content')

{{ __('Employee Bonus') }}

{{ __('Manage and track all types of employee bonuses (Festival, Performance, Special, etc.)') }}

@canany(['Salary-create', 'Salary-edit']) @elsecan('Salary-list') {{ __('Export') }} @endcanany
@if (session()->has('message'))
{{ session('message') }}
@endif @if (session()->has('error'))
{{ session('error') }}
@endif
{{ (int) ($stats->total ?? 0) }}
{{ __('Total') }}
{{ (int) ($stats->pending ?? 0) }}
{{ __('Pending') }}
{{ (int) ($stats->approved ?? 0) }}
{{ __('Approved') }}
{{ (int) ($stats->paid ?? 0) }}
{{ __('Paid') }}
{{ number_format((float) ($stats->total_amount ?? 0), 0) }}
{{ __('Total amount') }}
{{ number_format((float) ($stats->disbursed_amount ?? 0), 0) }}
{{ __('Disbursed') }}
{{ __('Filters') }} {{ __('Clear Filters') }}
@if($branches->isNotEmpty())
@endif
@php $canBulkApprove = auth()->user()->can('Salary-Approve') || auth()->user()->can('Salary-edit'); $canBulkMarkPaid = $canBulkApprove; $canBulkDelete = auth()->user()->can('Salary-delete'); $showBulkBar = $canBulkApprove || $canBulkDelete; @endphp @if($showBulkBar)
0 {{ __('selected') }} @if($canBulkApprove) @endif @if($canBulkMarkPaid)
@endif @if($canBulkDelete) @endif
@csrf
@csrf
@csrf
@endif
@if($showBulkBar) @endif @forelse($bonuses as $key => $row) @php $statusClass = match($row->status) { 'approved' => 'approved', 'paid' => 'paid', 'rejected' => 'rejected', default => 'pending' }; $isPending = $row->status === \App\Models\EmployeeBonus::STATUS_PENDING; $isApproved = $row->status === \App\Models\EmployeeBonus::STATUS_APPROVED; $isDeletable = in_array($row->status, [\App\Models\EmployeeBonus::STATUS_PENDING, \App\Models\EmployeeBonus::STATUS_REJECTED], true); $isSelectable = ($canBulkApprove && $isPending) || ($canBulkMarkPaid && $isApproved) || ($canBulkDelete && $isDeletable); @endphp @if($showBulkBar) @endif @empty @endforelse
# {{ __('Employee') }} {{ __('Type') }} {{ __('Period') }} {{ __('Amount') }} {{ __('Status') }} {{ __('Payment date') }} {{ __('Actions') }}
@if($isSelectable)
@endif
{{ $bonuses->firstItem() + $key }} {{ $row->staff?->user?->name ?? '—' }} ID: {{ $row->staff?->user_id ?? '—' }} · {{ $row->staff?->department?->name ?? '—' }} / {{ $row->staff?->warehouse?->name ?? '—' }} @if($row->title) {{ $row->title }} @endif {{ $row->typeLabel() }} {{ date('F Y', mktime(0, 0, 0, (int) $row->bonus_month, 1, (int) $row->bonus_year)) }} {{ number_format((float) $row->amount, 2) }} {{ $row->statusLabel() }} {{ $row->payment_date?->format('Y-m-d') ?? '—' }} @php $hasActions = $row->isEditable() || $row->status === \App\Models\EmployeeBonus::STATUS_APPROVED; @endphp @if($hasActions) @else @endif
{{ __('No employee bonus records found.') }}
@if($bonuses->hasPages()) @endif
@endsection @section('modal') @include('modals.delete_modal') @endsection @section('script') @endsection