@extends('layouts.master') @section('css') @endsection @section('title') دليل العملاء الشامل @stop @section('page-header')
{{-- 1. كارت إجمالي عدد العملاء --}}
إجمالي العملاء المسجلين

{{ number_format($totalCustomersCount) }} عميل

{{-- 2. كارت محرك البحث الذكي --}}
البحث السريع عن عميل
@if(request('search')) مصفى حسب: "{{ request('search') }}" @endif
@if(request('search')) @endif
@endsection @section('content')
@forelse($customers as $customer) @php $rawPhone = preg_replace('/[^0-9]/', '', $customer->phone ?? ''); $waPhone = str_starts_with($rawPhone, '05') ? '966' . substr($rawPhone, 1) : $rawPhone; $msgWa = urlencode("السلام عليكم ورحمة الله، أهلاً بك عميلنا العزيز " . ($customer->name ?? '')); @endphp {{-- 1. كود العميل --}} {{-- 2. اسم العميل --}} {{-- 3. تاريخ الاشتراك --}} {{-- 4. رقم الجوال والتواصل --}} {{-- 5. الرابط وبيانات الدخول --}} {{-- 6. إنشاء العقد --}} @empty @endforelse
# ID اسم العميل / المؤسسة تاريخ الاشتراك والمدة رقم الجوال والتواصل الرابط وبيانات الدخول العقد
#{{ $customer->id }}
{{ mb_substr($customer->name ?? 'ع', 0, 1, 'utf-8') }}
{{ $customer->name ?? '---' }} @if($customer->address) {{ $customer->address }} @endif
@if($customer->subscription_date)
{{ \Carbon\Carbon::parse($customer->subscription_date)->format('Y-m-d') }} @php $startDate = \Carbon\Carbon::parse($customer->subscription_date); $totalMonths = $startDate->diffInMonths(\Carbon\Carbon::now()); $years = round($totalMonths / 12); if ($years == 0 && $totalMonths >= 6) { $years = 1; } $yearsText = match(true) { $years <= 0 => 'أقل من سنة', $years == 1 => 'منذ سنة', $years == 2 => 'منذ سنتين', $years >= 3 && $years <= 10 => 'منذ ' . $years . ' سنوات', default => 'منذ ' . $years . ' سنة' }; @endphp {{ $yearsText }}
@else --- @endif
{{ $customer->phone ?? '---' }} @if(!empty($customer->phone)) @endif
@if($customer->website_link) {{-- للعميل السحابي الذي يمتلك رابط --}} فتح النظام السحابي @else {{-- في حال عدم وجود رابط (عميل محلي) --}} برنامج محلي @endif {{-- بيانات الدخول إن وجدت --}}
@if($customer->admin_credentials)
{{ $customer->admin_credentials }}
@elseif($customer->website_link) (لا توجد بيانات دخول) @endif
العقد
لم يتم العثور على أي عملاء مسجلين يطابقون البحث.
{{-- الترقيم والتنقل بين الصفحات --}}
{!! $customers->links() !!}
@endsection