@extends('admin.layouts.master') @section('title', 'تفاصيل الشفت') @section('css') @endsection @section('content')
تفاصيل الشفت — {{ auth()->user()->name }}
#{{ $shift->id }} الخزنة: {{ $shift->treasury?->name ?? '-' }} المستخدم: {{ $shift->actor?->name ?? '-' }}
@if($shift->status === 'open') قفل الشفت @endif رجوع
@include('admin.Alerts') @php $isOpen = $shift->status === 'open'; $diff = (float) ($shift->difference ?? 0); $diffClass = $diff == 0 ? 'text-success' : ($diff < 0 ? 'text-danger' : 'text-primary'); $statusBadge = $isOpen ? 'مفتوح' : 'مغلق'; $openedAt = optional($shift->opened_at)->timezone('Africa/Cairo'); $closedAt = optional($shift->closed_at)->timezone('Africa/Cairo'); @endphp {{-- ====== Summary Header ====== --}}
حالة الشفت
{!! $statusBadge !!}
فتح: {{ $openedAt ? $openedAt->format('Y-m-d h:i A') : '-' }}
إقفال: {{ $shift->closed_at ? $closedAt->format('Y-m-d h:i A') : '—' }}
Opening Balance
{{ number_format((float)$shift->opening_balance, 2) }}
المبلغ اللي اتحط في بداية الشفت
رصيد الشفت الحالي (داخل الشفت)
{{ number_format((float)($shiftBalance ?? 0), 2) }}
Opening + صافي الحركات
الرصيد المفترض تسليمه
{{ number_format((float)($expected ?? $shift->closing_expected), 2) }}
هذا هو المبلغ الذي يجب أن يكون فعليًا في الخزنة عند الإقفال

{{-- ====== Movement Summary ====== --}}
إجمالي التحصيل (Collections)
{{ number_format((float)($collections ?? 0), 2) }}
إجمالي الصرف (Payments)
{{ number_format((float)($payments ?? 0), 2) }}
تحويلات داخل (Transfer In)
{{ number_format((float)($transferIn ?? 0), 2) }}
تحويلات خارج (Transfer Out)
{{ number_format((float)($transferOut ?? 0), 2) }}
{{-- ===== Close Results ===== --}} @if(!$isOpen)
Actual @ Close
{{ $shift->closing_actual !== null ? number_format((float)$shift->closing_actual, 2) : '—' }}
المبلغ اللي اتقفل بيه الشفت
Difference
{{ number_format($diff, 2) }}
Actual - Expected
Closed By
{{ $shift->closed_by ?: '—' }}
توقيع الإقفال
@endif
{{-- ===== Deliveries Table ===== --}}
حركات الشفت ({{ $shift->deliveries->count() }})
كل الحركات هنا مربوطة بـ shift_id = {{ $shift->id }}
@forelse($shift->deliveries as $delivery) @php $typeLabel = $delivery->type === 'collection' ? 'تحصيل' : ($delivery->type === 'payment' ? 'صرف' : 'تحويل'); @endphp @empty @endforelse
# التاريخ النوع من إلى المبلغ رقم السند الطرف المقابل قيد السبب/ملاحظات
{{ $loop->iteration }} {{ optional($delivery->doc_date)->format('Y-m-d') ?? '—' }} {!! $typeLabel !!}
{{ $delivery->fromTreasury?->name ?? '—' }}
@if($delivery->from_treasury_id)
#{{ $delivery->from_treasury_id }}
@endif
{{ $delivery->toTreasury?->name ?? '—' }}
@if($delivery->to_treasury_id)
#{{ $delivery->to_treasury_id }}
@endif
{{ number_format((float)$delivery->amount, 2) }} {{ $delivery->receipt_no ?? '—' }} {{ $delivery->counterpartyAccount?->name ?? '—' }} {{ $delivery->journal_entry_id ?? '—' }}
{{ $delivery->reason ?? '—' }}
@if($delivery->notes)
{{ \Illuminate\Support\Str::limit($delivery->notes, 80) }}
@endif
لا توجد حركات مسجلة لهذا الشفت.
@endsection