{{-- resources/views/admin/services/show.blade.php --}} @extends('layouts.master') @section('title', 'عرض خدمة') @section('pages') {{ __('dashboard.home') }} @endsection @section('css') @endsection @section('content') @php $unitMap = ['days' => 'يوم', 'months' => 'شهر', 'years' => 'سنة']; $dayMap = [ 'sat' => 'السبت', 'sun' => 'الأحد', 'mon' => 'الإثنين', 'tue' => 'الثلاثاء', 'wed' => 'الأربعاء', 'thu' => 'الخميس', 'fri' => 'الجمعة', ]; $fmtTime = function ($t) { if (!$t) { return '—'; } $p = explode(':', $t); return sprintf('%02d:%02d', (int) ($p[0] ?? 0), (int) ($p[1] ?? 0)); }; $durText = $service->duration_value . ' ' . ($unitMap[$service->duration_unit] ?? $service->duration_unit); $settings = $service->settings ?? []; $on = function ($arr) { return is_array($arr) && ((isset($arr['enabled']) && (string) $arr['enabled'] === '1') || $arr['enabled'] === true); }; $pause = $settings['pause'] ?? null; $transfer = $settings['transfer'] ?? null; $renew = $settings['renew'] ?? null; $refund = $settings['refund'] ?? null; $days = $settings['days'] ?? null; @endphp
تعديل رجوع
{{ $service->getTranslation('name', app()->getLocale()) }}
{{ $service->type?->getTranslation('name', app()->getLocale()) ?? '—' }} {{ $service->category?->getTranslation('name', app()->getLocale()) ?? '—' }} {!! $service->active ? ' نشط' : ' غير نشط' !!}
{{-- كروت سريعة --}}
السعر
{{ number_format((float) $service->price, 2) }}
@if ($service->discount_price)
خصم: {{ number_format((float) $service->discount_price, 2) }}
@endif
المدة
{{ $durText }}
وقت البدء
{{ $fmtTime($service->start_time) }}
وقت الانتهاء
{{ $fmtTime($service->end_time) }}
{{-- الفروع المقدِّمة / المباعة --}}
الفروع المقدِّمة
@if ($service->providedBranches->count())
@foreach ($service->providedBranches as $b) {{ $b->getTranslation('name', app()->getLocale()) }} @endforeach
@else
لا توجد فروع مقدِّمة.
@endif
الفروع المباعة
@if ($service->soldBranches->count())
@foreach ($service->soldBranches as $b) {{ $b->getTranslation('name', app()->getLocale()) }} @endforeach
@else
لا توجد فروع مباعة.
@endif
{{-- الملاحظات --}}
الملاحظات
العربية:
{{ $service->getTranslation('notes', 'ar') ?: '—' }}
English:
{{ $service->getTranslation('notes', 'en') ?: '—' }}
{{-- الإعدادات --}}
الإعدادات
{{-- إيقاف --}}
إمكانية الإيقاف
{!! $on($pause) ? 'مفعّل' : 'غير مفعّل' !!}
@if ($on($pause))
  • عدد المرات: {{ $pause['max_times'] ?? '—' }}
  • أقصى مدة: {{ $pause['max_duration_value'] ?? '—' }} {{ $unitMap[$pause['max_duration_unit'] ?? 'days'] ?? 'يوم' }}
@else
غير مفعّل.
@endif
{{-- تنازل --}}
إمكانية التنازل
{!! $on($transfer) ? 'مفعّل' : 'غير مفعّل' !!}
@if ($on($transfer))
  • أقل مدة: {{ $transfer['min_duration_value'] ?? '—' }} {{ $unitMap[$transfer['min_duration_unit'] ?? 'days'] ?? 'يوم' }}
  • رسوم التنازل: {{ isset($transfer['fee']) ? number_format((float) $transfer['fee'], 2) : '—' }}
@else
غير مفعّل.
@endif
{{-- تجديد --}}
إمكانية التجديد
{!! $on($renew) ? 'مفعّل' : 'غير مفعّل' !!}
@if ($on($renew))
  • خدمة التجديد: @php $renewService = isset($renew['with_service_id']) ? \App\Models\Service::find($renew['with_service_id']) : null; @endphp {{ $renewService?->getTranslation('name', app()->getLocale()) ?? '—' }}
  • مدة إضافية: {{ $renew['extra_duration_value'] ?? '—' }} {{ $unitMap[$renew['extra_duration_unit'] ?? 'days'] ?? 'يوم' }}
  • أقصى مدة: {{ $renew['max_duration_value'] ?? '—' }} {{ $unitMap[$renew['max_duration_unit'] ?? 'days'] ?? 'يوم' }}
@else
غير مفعّل.
@endif
{{-- استرجاع --}}
إمكانية الاسترجاع
{!! $on($refund) ? 'مفعّل' : 'غير مفعّل' !!}
@if ($on($refund)) @php $methodMap = ['money' => 'مالي', 'points' => 'نقاط', 'exchange' => 'استبدال بخدمة']; @endphp
  • الطريقة: {{ $methodMap[$refund['method'] ?? 'money'] ?? '—' }}
  • @if (($refund['method'] ?? null) === 'exchange') @php $exS = isset($refund['exchange_service_id']) ? \App\Models\Service::find($refund['exchange_service_id']) : null; @endphp
  • الخدمة البديلة: {{ $exS?->getTranslation('name', app()->getLocale()) ?? '—' }}
  • @endif
@else
غير مفعّل.
@endif
{{-- أيام محددة --}}
الخدمة محددة بأيام
{!! $on($days) ? 'مفعّل' : 'غير مفعّل' !!}
@if ($on($days) && !empty($days['values']))
@foreach ($days['values'] as $d) {{ $dayMap[$d] ?? $d }} @endforeach
@else
غير مفعّل.
@endif
@endsection