{{-- ========================================================================= --}} {{-- 1. الهيدر الرئيسي وتفاصيل الفرع والفاتورة والعميل --}} {{-- ========================================================================= --}}
تاريخ التفصيل: {{ $invoice->created_at->format('Y-m-d') }}
تاريخ التسليم: {{ $invoice->delivery_date ? \Carbon\Carbon::parse($invoice->delivery_date)->format('Y-m-d') : '-' }}
@if($invoice->branch) {{ $invoice->branch->phone }}
الفرع: {{ $invoice->branch->name }} - {{ $invoice->branch->place }}
@else 0571700030  |  YAROB - يعرب
العنوان: لين - شارع الطائف
@endif
#{{ $invoice->customer->id ?? '-' }}  |  {{ $invoice->customer->name ?? 'سعود التميمي' }}  |  {{ $invoice->customer->phone ?? '0507970570' }}
Barcode
#{{ $invoice->id }}
الثياب: {{ $items->sum('qty') }} إجمالي القماش: {{ number_format($items->sum('total_measurements'), 2) }} م الدفع: @php $methods = explode('-', $invoice->payment_methods_text); $translatedMethods = []; foreach($methods as $method) { $method = trim($method); if(!empty($method)) { $translatedMethods[] = __('sales.' . strtolower($method)); } } @endphp {{ count($translatedMethods) > 0 ? implode(' + ', $translatedMethods) : $invoice->payment_methods_text }} المبلغ: {{ number_format($invoice->Price, 2) }} المدفوع: {{ number_format($invoice->Pay, 2) }} المتبقي: {{ number_format($invoice->Price - $invoice->Pay, 2) }}
{{-- ========================================================================= --}} {{-- 2. جدول شبكة المقاسات الأساسية --}} {{-- ========================================================================= --}} @php $firstItem = $items->first(); $global_measurements = json_decode($firstItem->order_measurements ?? '[]', true) ?? []; $meas_labels = [ 'front_length' => 'طول أمام', 'back_length' => 'طول خلف', 'shoulder_width' => 'عرض الكتف', 'sleeve_length' => 'يد سادة', 'arm_width' => 'وسع اليد', 'arm_mid_width' => 'يد كبك', 'arm_bottom_width' => 'اسفل اليد', 'chest_width' => 'وسع الصدر', 'neck_size' => 'وسع الورك', 'collar_size' => 'رقبة قلاب', 'neck_plain' => 'رقبة سادة', 'step_width' => 'وسع خطوة', 'arm_center_width' => 'وسط اليد', 'cuff_width' => 'وسع كبك', 'cuff_hem' => 'كفة كبك', 'bottom_width' => 'وسع أسفل', 'bottom_hem' => 'كفة أسفل', 'dropped_shoulder' => 'كتف نازل', ]; @endphp
@foreach($meas_labels as $key => $label)
{{ $label }}
{{ $global_measurements[$key] ?? '0' }}
@endforeach
{{-- ========================================================================= --}} {{-- 3. حلقة عرض الثياب والموديلات والمواصفات --}} {{-- ========================================================================= --}} @foreach($items as $index => $item) @php $item_styles = json_decode($item->order_styles ?? '[]', true) ?? []; $item_features = json_decode($item->order_features ?? '[]', true) ?? []; $item_m_data = json_decode($item->order_measurements ?? '[]', true) ?? []; $getVal = function($data) { return is_array($data) ? ($data['model'] ?? 1) : ($data ?? 1); }; @endphp
ثوب رقم: {{ $index + 1 }} الصنف: {{ $item->product->product_name ?? 'غير محدد' }} الكمية: {{ number_format($item->qty, 0) }} ثوب  |  السعر: {{ number_format($item->price, 2) }}
@foreach($item_styles as $s_key => $style) @php $imgNum = is_array($style) ? ($style['model'] ?? '1') : ($style->model ?? '1'); $note = is_array($style) ? ($style['note'] ?? '') : ($style->note ?? ''); @endphp
{{ __('sales.' . $s_key) }}
Model {{ $imgNum }}
موديل {{ $imgNum }}
@if(!empty($note))
{{ $note }}
@endif
@endforeach
@foreach($item_features as $f_key => $f_val) @if($f_val == 1) ✓ {{ __('sales.' . $f_key) }} @endif @endforeach @php $note_keys = ['notes_one', 'notes_two', 'notes_three', 'notes_four', 'buttons_count', 'pocket_type']; @endphp @foreach($note_keys as $n_key) @if(!empty($item_m_data[$n_key])) {{ __('sales.'.$n_key) }}: {{ $item_m_data[$n_key] }} @endif @endforeach
@endforeach {{-- ========================================================================= --}} {{-- 4. قسيمة التجهيز المقصوصة (أسفل الصفحة) --}} {{-- ========================================================================= --}}
✂ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{ $items->sum('qty') }}
عدد الثياب
{{ $invoice->created_at->format('Y-m-d') }}
#{{ $invoice->id }}
العميل:
{{ $invoice->customer->name ?? 'سعود التميمي' }}
رقم العميل: #{{ $invoice->customer->id ?? '-' }}
البائع: {{ $employee->name_ar ?? 'مدير' }}
الخياط: {{ $invoice->employee->name_ar ?? ($invoice->tailor_name ?? 'غير محدد') }}
Barcode
باركود التجهيز
{{-- زر الطباعة (للشاشة فقط) --}}