@if (@isset($data) && !@empty($data) && count($data) >0 ) @php $i=1; @endphp
@foreach ($data as $product) @endforeach
{{ __('home.Invoice_no') }} {{ __('home.sallerName') }} {{ __('home.clietName') }} {{ __('home.date') }} تاريخ الإنتاج الخياط الحالة {{ __('home.branch') }} {{ __('home.total') }} {{ __('home.Pay') }} {{ __('home.paymentmethod') }} {{ __('home.operations') }}
{{ $product->id }} {{ $product->user->name??'' }} {{ $product->customer->name??'' }} {{ $product->created_at }} {{ $product->production_date ?? '---' }} {{ $product->employee->name_ar?? "لا يوجد" }} @switch($product->status_invoice) @case('NOT_STARTED') لم يبدأ @break @case('IN_PROGRESS') قيد التنفيذ @break @case('COMPLETED') مكتمل @break @default غير محدد @endswitch {{ $product->branch->name }} @php $totalPaid = ($product->cashamount ?? 0) + ($product->creaditamount ?? 0) + ($product->bankamount ?? 0) + ($product->Bank_transfer ?? 0); @endphp {{ number_format($totalPaid, 2) }} {{ $product->Pay ?? 0 }} @php $methods = []; // تحويل النص إلى حروف صغيرة لتجنب مشاكل حالة الأحرف (Cash vs cash) $currentMethod = strtolower($product->payment_methods_text ?? ''); // 1. الفحص بناءً على حقل النص الذي يتم تحديثه بالزر أولاً if ($currentMethod == 'cash') { $methods[] = __('report.cash'); } elseif ($currentMethod == 'span' || $currentMethod == 'network (mada)') { $methods[] = __('report.shabka'); } elseif ($currentMethod == 'credit') { $methods[] = 'آجل (Credit)'; // أو الترجمة الخاصة بك مثل __('sales.credit') } elseif ($currentMethod == 'bank_transfer') { $methods[] = __('home.Bank_transfer'); } elseif ($currentMethod == 'tabby') { $methods[] = 'تابي (Tabby)'; } elseif ($currentMethod == 'tamara') { $methods[] = 'تمارا (Tamara)'; } // 2. إذا كان حقل النص فارغاً، نعتمد على المبالغ المسجلة كخيار احتياطي (الوضع القديم) else { if (($product->cashamount ?? 0) > 0) $methods[] = __('report.cash'); if (($product->bankamount ?? 0) > 0) $methods[] = __('report.shabka'); if (($product->Bank_transfer ?? 0) > 0) $methods[] = __('home.Bank_transfer'); } // إزالة التكرار $methods = array_unique($methods); @endphp @if(count($methods) > 1) {{ __('sales.Partition of the amount') }} {{-- تجزئة المبلغ --}} @elseif(count($methods) == 1) {{ $methods[0] }} @else {{-- نص احتياطي في حال عدم وجود أي طريقة دفع --}} --- @endif @if($product->type == 'fabric') @endif @if($product->type == 'ready') {{-- رابط طباعة فاتورة الجاهز --}} @else {{-- رابط طباعة فاتورة التفصيل (القديم) --}} @endif @php // تعريف متغيرات الواتساب داخل الخلية لضمان عدم حدوث Undefined variable $customerPhone = $product->customer->phone ?? ''; $phone = "966" . substr($customerPhone, 1); $link = "https://demoo.ebdeaclients.online/ar/generate_pdf/" . $product->id; $message = "يسرنا خدمتك مرفق لكم فاتورتكم " . "فضلا لتحميل فاتورتك رقم : {$product->id}: {$link}\n" . "For download your invoice number :{$product->id } press here : {$link}"; $waLink = "https://web.whatsapp.com/send?phone={$phone}&text=" . urlencode($message); @endphp @if($product->type == 'fabric') @endif

@else
{{__('home.notfounddata')}}
@endif