@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.paymentmethod') }} {{ __('home.operations') }}
{{ $product->id }} {{ $product->user->name??'' }} {{ $product->customer->name??'' }} {{ $product->created_at }} {{ $product->employee->name_ar?? "لا يوجد" }} @switch($product->status_invoice) @case('NOT_STARTED') لم يبدأ @break @case('IN_PROGRESS') قيد التنفيذ @break @case('COMPLETED') مكتمل @break @default غير محدد @endswitch {{ $product->branch->name }} @if($product->type == 'fabric') {{-- في حالة التفصيل يعرض المدفوع فقط --}} {{ $product->Pay }} @else {{-- في حالة الجاهز يجمع خانات الدفع المختلفة --}} {{ ($product->cashamount ?? 0) + ($product->bankamount ?? 0) + ($product->creaditamount ?? 0) + ($product->Bank_transfer ?? 0) }} @endif @if($product->type == 'fabric') {{-- حالة التفصيل: نعتمد على المنطق القديم --}} @php $pay = ''; if ($product->payment_methods_text == 'Cash') { $pay = __('report.cash'); } elseif ($product->payment_methods_text == 'Network (Mada)') { $pay = __('report.shabka'); } elseif ($product->payment_methods_text == 'Tabby') { $pay = 'تابي (Tabby)'; } elseif ($product->payment_methods_text == 'Tamara') { $pay = 'تمارا (Tamara)'; } elseif ($product->payment_methods_text == "Bank_transfer") { $pay = __('home.Bank_transfer'); } else { $pay = __('home.Partition of the amount'); } @endphp {{ $pay }} {{-- لو الدفع مجزأ في التفصيل اظهر التفاصيل الصغير --}} @if($product->payment_methods_text == "Partition")
{{__('report.cash')}}: {{ $product->cash_amount ?? 0 }} | {{__('report.shabka')}}: {{ $product->bankamount ?? 0 }} @endif @else {{-- حالة الجاهز (ready): يجيب مباشرة من كولوم Pay --}} {{ $product->Pay ?? __('home.Cash') }} @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