@if(function_exists('module_enabled') && module_enabled('Loyalty') && function_exists('restaurant_modules') && in_array('Loyalty', restaurant_modules()) && $loyaltyColumnName) @endif @forelse ($customers as $item) @if(function_exists('module_enabled') && module_enabled('Loyalty') && function_exists('restaurant_modules') && in_array('Loyalty', restaurant_modules()) && $loyaltyColumnName) @endif @empty @endforelse
@lang('modules.customer.name') @lang('modules.customer.email') @lang('modules.customer.phone') @lang('modules.order.totalOrder') {{ $loyaltyColumnName }} @lang('app.action')
{{ $item->name }} {{ $item->email ?? '--' }} {{ $item->phone ?? '--' }} {{ $item->orders_count }} @lang('menu.orders') @php $restaurantId = restaurant()->id ?? null; $displayValue = 0; $displayLabel = ''; $displayText = ''; if ($restaurantId) { // Points only if ($enablePoints && !$enableStamps) { $displayValue = $item->loyalty_points ?? 0; $displayLabel = __('loyalty::app.points'); $displayText = $displayValue > 0 ? $displayValue . ' ' . $displayLabel : '0 ' . $displayLabel; } // Stamps only elseif ($enableStamps && !$enablePoints) { $totalStamps = 0; try { if (module_enabled('Loyalty')) { $loyaltyService = app(\Modules\Loyalty\Services\LoyaltyService::class); $customerStamps = $loyaltyService->getCustomerStamps($restaurantId, $item->id); if (!empty($customerStamps)) { foreach ($customerStamps as $stampData) { $availableStamps = $stampData['available_stamps'] ?? 0; $totalStamps += $availableStamps; } } } } catch (\Exception $e) { // Silently fail } $displayLabel = __('loyalty::app.stamps'); $displayText = $totalStamps > 0 ? $totalStamps . ' ' . $displayLabel : '0 ' . $displayLabel; } // Both points and stamps elseif ($enablePoints && $enableStamps) { $points = $item->loyalty_points ?? 0; $totalStamps = 0; try { if (module_enabled('Loyalty')) { $loyaltyService = app(\Modules\Loyalty\Services\LoyaltyService::class); $customerStamps = $loyaltyService->getCustomerStamps($restaurantId, $item->id); if (!empty($customerStamps)) { foreach ($customerStamps as $stampData) { $availableStamps = $stampData['available_stamps'] ?? 0; $totalStamps += $availableStamps; } } } } catch (\Exception $e) { // Silently fail } // Show both if available, or whichever is available if ($points > 0 && $totalStamps > 0) { $displayText = $points . ' ' . __('loyalty::app.points') . ' / ' . $totalStamps . ' ' . __('loyalty::app.stamps'); } elseif ($points > 0) { $displayText = $points . ' ' . __('loyalty::app.points'); } elseif ($totalStamps > 0) { $displayText = $totalStamps . ' ' . __('loyalty::app.stamps'); } else { $displayText = '0 ' . __('loyalty::app.points') . ' / 0 ' . __('loyalty::app.stamps'); } } } @endphp {{ $displayText }} @if(user_can('Update Customer')) @lang('app.update') @endif @if(user_can('Delete Customer')) @endif
@lang('messages.noCustomerFound')
{{ $customers->links() }}
{{ __("modules.customer.editCustomer") }} @if ($customer) @livewire('forms.editCustomer', ['customer' => $customer], key('edit-customer-form-'.$customer->id)) @endif {{ __('app.close') }} {{ __("menu.orders") }} @if ($customer) @livewire('customer.customerOrders', ['customer' => $customer], key('customer-orders-form-'.$customer->id)) @endif {{ __('app.close') }} @if(function_exists('module_enabled') && module_enabled('Loyalty') && function_exists('restaurant_modules') && in_array('Loyalty', restaurant_modules())) {{ __('loyalty::app.loyaltyAccount') }} - {{ $customer->name ?? '' }} @if ($customer) @livewire('loyalty::customer.loyalty-account', ['customer' => $customer], key('loyalty-account-'.$customer->id)) @endif {{ __('app.close') }} @endif @lang('modules.customer.deleteCustomer')? @lang('modules.customer.deleteCustomerMessage') {{ __('app.cancel') }} @if ($customer) @lang('modules.customer.deleteWithOrder') {{ __('app.delete') }} @endif