@extends('layouts.app') @section('title', __('accounting.journal_entries')) @section('content') {{ __('accounting.journal_entries') }} @if(session('status')) @php $msg = session('status'); @endphp × {{ $msg['msg'] }} @endif @if(auth()->user()->can('view_journal_entries') || auth()->user()->can('account.access')) {{-- فلاتر البحث --}} {{ __('accounting.filters') }} {{ __('accounting.status') }} {{ __('accounting.all') }} @foreach(['draft' => __('accounting.status_draft'), 'posted' => __('accounting.status_posted'), 'reversed' => __('accounting.status_reversed'), 'void' => __('accounting.status_void')] as $val => $label) {{ $label }} @endforeach {{ __('accounting.approval_status') }} {{ __('accounting.all') }} @foreach(['not_required' => __('accounting.approval_not_required'), 'draft' => __('accounting.approval_draft'), 'pending' => __('accounting.approval_pending'), 'approved' => __('accounting.approval_approved'), 'rejected' => __('accounting.approval_rejected')] as $val => $label) {{ $label }} @endforeach {{ __('accounting.source') }} {{ __('accounting.start_date') }} {{ __('accounting.end_date') }} {{ __('accounting.filter') }} @if(auth()->user()->can('create_manual_journal') || auth()->user()->can('account.access')) {{ __('accounting.new_journal_entry') }} @endif {{-- جدول القيود --}} {{ __('accounting.journal_entries') }} {{ $journal_entries->total() }} {{ __('accounting.entry_no') }} {{ __('accounting.date') }} {{ __('accounting.period') }} {{ __('accounting.status') }} {{ __('accounting.approval_status') }} {{ __('accounting.source') }} {{ __('accounting.debit') }} {{ __('accounting.lines') }} {{ __('accounting.actions') }} @forelse($journal_entries as $entry) @php $debit_total = $entry->lines->where('type','debit')->sum('amount'); $status_class = match($entry->status) { 'posted' => 'tw-dw-badge-success', 'draft' => 'tw-dw-badge-warning', 'reversed' => 'tw-dw-badge-info', 'void' => 'tw-dw-badge-error', default => 'tw-dw-badge-ghost', }; $status_label = match($entry->status) { 'posted' => __('accounting.status_posted'), 'draft' => __('accounting.status_draft'), 'reversed' => __('accounting.status_reversed'), 'void' => __('accounting.status_void'), default => ucfirst($entry->status), }; $approval = $entry->approval_status ?: 'not_required'; $approval_class = match($approval) { 'approved' => 'tw-dw-badge-success', 'pending' => 'tw-dw-badge-warning', 'rejected' => 'tw-dw-badge-error', 'not_required' => 'tw-dw-badge-ghost', default => 'tw-dw-badge-ghost', }; $approval_label = match($approval) { 'not_required' => __('accounting.approval_not_required'), 'draft' => __('accounting.approval_draft'), 'pending' => __('accounting.approval_pending'), 'approved' => __('accounting.approval_approved'), 'rejected' => __('accounting.approval_rejected'), default => ucfirst(str_replace('_',' ',$approval)), }; @endphp {{ $entry->entry_no }} {{ $entry->entry_date->format('Y-m-d') }} {{ optional($entry->period)->name ?: '—' }} {{ $status_label }} {{ $approval_label }} @php $source_labels = [ 'transaction' => 'فاتورة', 'transaction_payment' => 'دفعة مالية', 'stock_adjustment' => 'تسوية مخزون', 'manual_journal' => 'قيد يدوي', 'opening_balance' => 'أرصدة افتتاحية', 'reversal' => 'عكس قيد', ]; @endphp {{ $source_labels[$entry->source_type] ?? ($entry->source_type ? str_replace('_',' ', $entry->source_type) : '—') }} {{ number_format($debit_total, 2) }} {{ $entry->lines_count }} @empty {{ __('accounting.no_journal_entries') }} @endforelse @endif @endsection