@extends('layouts.app') @section('content')

قائمة أوامر الشراء

عرض وإدارة جميع أوامر الشراء

أمر شراء جديد

إجمالي الأوامر

{{ $data->total() ?? 0 }}

إجمالي المبلغ

{{ number_format(collect($data->items())->sum('total_amount') ?? 0, 2) }} ر.س

الأوامر المعلقة

{{ collect($data->items())->whereIn('status', ['draft', 'approved'])->count() ?? 0 }}

الأوامر الملغاة

{{ collect($data->items())->where('status', 'cancelled')->count() ?? 0 }}

@forelse($data->items() ?? [] as $po) @empty @endforelse
# رقم الأمر المورد التاريخ المبلغ الحالة الإجراءات
{{ $loop->iteration + ($data->currentPage() - 1) * $data->perPage() }}
{{ $po->po_number }}
{{ $po->id }}
@if($po->supplier)
{{ $po->supplier->name }}
{{ $po->supplier->city ?? 'N/A' }}
@else غير محدد @endif
{{ \Carbon\Carbon::parse($po->po_date)->format('d/m/Y') }}
{{ \Carbon\Carbon::parse($po->po_date)->format('H:i') }}
{{ number_format($po->total_amount, 2) }} ر.س
@switch($po->status) @case('draft') مسودة @break @case('approved') موافق عليها @break @case('sent') مرسلة @break @case('received') مستلمة @break @case('partially_received') مستلمة جزئياً @break @case('cancelled') ملغاة @break @default {{ ucfirst($po->status) }} @endswitch
@can('purchase-orders.view') @endcan @can('purchase-orders.edit') @if(in_array($po->status, ['draft', 'approved'])) @endif @endcan @can('purchase-orders.delete') @if($po->status === 'draft')
@csrf @method('DELETE')
@endif @endcan

لا توجد أوامر شراء حالياً

ابدأ بإنشاء أمر شراء جديد

@if($data->hasPages())
{{ $data->links() }}
@endif
@endsection