@extends('admin.layout.master') @section('css') @endsection @section('content')
{{-- Header Card --}}

{{ __('admin.provider_update_request_details') }}

{{ __('admin.back') }}

{{ __('admin.provider_name') }}

{{ $currentProvider->name ?? __('admin.no_name') }}

{{ __('admin.request_date') }}

{{ $entityUpdate->created_at->format('Y-m-d H:i:s') }}

{{ __('admin.status') }}

@if (is_null($entityUpdate->is_approved)) {{ __('admin.pending') }} @elseif($entityUpdate->is_approved == 1) {{ __('admin.approved') }} @elseif($entityUpdate->is_approved == 0) {{ __('admin.rejected') }} @endif

{{-- Tabs Navigation --}}
{{-- Changes Comparison Tab --}}
@php $allFields = array_keys($requestedData); $excludedFields = ['class', 'id', 'created_at', 'updated_at', 'deleted_at', 'is_active', 'is_blocked', 'is_notify', 'rejection_reason', 'is_approved', 'password', 'profit_rate', 'registration_documents']; $allFields = array_diff($allFields, $excludedFields); $fieldLabels = [ 'name' => __('admin.name'), 'email' => __('admin.email'), 'phone' => __('admin.phone'), 'country_code' => __('admin.country_code'), 'national_id' => __('admin.national_id'), 'iban' => __('admin.iban'), 'vehicle_count' => __('admin.vehicle_count'), 'whatsapp' => __('admin.whatsapp'), 'bank_name' => __('admin.bank_name'), 'account_name' => __('admin.account_name'), 'account_num' => __('admin.account_num'), 'iban' => __('admin.iban'), 'social_phone' => __('admin.social_phone'), 'social_email' => __('admin.social_email'), 'city_id' => __('admin.city'), 'category_id' => __('admin.category'), 'lat' => __('admin.latitude'), 'lng' => __('admin.longitude'), 'map_desc' => __('admin.map_description'), 'address' => __('admin.address'), 'image' => __('admin.image'), 'license_image' => __('admin.license_image'), 'owner_image' => __('admin.owner_image'), ]; @endphp @foreach ($allFields as $field) @php $label = $fieldLabels[$field] ?? ucfirst(str_replace('_', ' ', $field)); $currentValue = $currentProvider->$field ?? ''; $requestedValue = $requestedData[$field] ?? ''; // Check if field is an image field $isImageField = in_array($field, ['image', 'license_image', 'owner_image']); // Get image paths if it's an image field $currentImagePath = ''; $requestedImagePath = ''; if ($isImageField) { // For current value, use the model's image accessor if available if ($currentValue && method_exists($currentProvider, 'get' . ucfirst($field) . 'Attribute')) { $currentImagePath = $currentProvider->$field; } else { $currentImagePath = $currentValue; } // For requested value, check if it's a valid image path if ($requestedValue) { // Check if it's already a full URL or needs asset() if (filter_var($requestedValue, FILTER_VALIDATE_URL) || strpos($requestedValue, 'http') === 0) { $requestedImagePath = $requestedValue; } elseif (strpos($requestedValue, 'storage/images/providers/') === 0 || strpos($requestedValue, '/storage/') === 0) { $requestedImagePath = asset($requestedValue); } else { $requestedImagePath = asset('storage/images/providers/' . $requestedValue); } } // Also check if current value needs asset() if ($currentImagePath && !filter_var($currentImagePath, FILTER_VALIDATE_URL) && strpos($currentImagePath, 'http') !== 0) { if (strpos($currentImagePath, 'storage/') === 0 || strpos($currentImagePath, '/storage/') === 0) { $currentImagePath = asset($currentImagePath); } else { $currentImagePath = asset('storage/' . $currentImagePath); } } } if ($field == 'city_id' && $currentValue) { $currentCity = $currentProvider->city ?? null; $currentValue = $currentCity ? ($currentCity->getTranslations('name')[app()->getLocale()] ?? $currentCity->name) : $currentValue; } if ($field == 'city_id' && $requestedValue) { $requestedCity = \App\Models\City::find($requestedValue); $requestedValue = $requestedCity ? ($requestedCity->getTranslations('name')[app()->getLocale()] ?? $requestedCity->name) : $requestedValue; } if ($field == 'category_id' && $currentValue) { $currentCategory = $currentProvider->category ?? null; $currentValue = $currentCategory ? ($currentCategory->getTranslations('name')[app()->getLocale()] ?? $currentCategory->name) : $currentValue; } if ($field == 'category_id' && $requestedValue) { $requestedCategory = \App\Models\Category::find($requestedValue); $requestedValue = $requestedCategory ? ($requestedCategory->getTranslations('name')[app()->getLocale()] ?? $requestedCategory->name) : $requestedValue; } $hasChange = $currentValue != $requestedValue || $currentImagePath != $requestedImagePath; @endphp @endforeach
{{ __('admin.field') }} {{ __('admin.current_value') }} {{ __('admin.requested_value') }}
{{ $label }} @if ($isImageField && $currentImagePath)
{{ __('admin.current_image') }}
@else @if ($hasChange) {{ $currentValue !== '' && $currentValue !== null ? $currentValue : __('admin.no_value') }} @else {{ $currentValue !== '' && $currentValue !== null ? $currentValue : __('admin.no_value') }} @endif @endif
@if ($isImageField && $requestedImagePath)
{{ __('admin.requested_image') }}
@else @if ($hasChange) {{ $requestedValue !== '' && $requestedValue !== null ? $requestedValue : __('admin.no_value') }} @else {{ $requestedValue !== '' && $requestedValue !== null ? $requestedValue : __('admin.no_value') }} @endif @endif
{{-- Relations Tab --}} @if (isset($allData['relations']) && !empty($allData['relations']))
@foreach ($allData['relations'] as $relationName => $relationData)
{{ ucfirst(str_replace('_', ' ', $relationName)) }}
@if (is_array($relationData)) @if (isset($relationData[0]) && is_array($relationData[0]))
@foreach (array_keys($relationData[0]) as $key) @if (!in_array($key, ['class', 'id', 'created_at', 'updated_at'])) @endif @endforeach @foreach ($relationData as $item) @foreach ($item as $key => $value) @if (!in_array($key, ['class', 'id', 'created_at', 'updated_at'])) @endif @endforeach @endforeach
{{ ucfirst(str_replace('_', ' ', $key)) }}
@if (is_array($value)) {{ json_encode($value, JSON_UNESCAPED_UNICODE) }} @elseif(is_bool($value)) {{ $value ? __('admin.yes') : __('admin.no') }} @else {{ $value ?? __('admin.no_value') }} @endif
@else
@foreach ($relationData as $key => $value) @if (!in_array($key, ['class', 'id', 'created_at', 'updated_at'])) @endif @endforeach
{{ ucfirst(str_replace('_', ' ', $key)) }} @if (is_array($value)) {{ json_encode($value, JSON_UNESCAPED_UNICODE) }} @elseif(is_bool($value)) {{ $value ? __('admin.yes') : __('admin.no') }} @else {{ $value ?? __('admin.no_value') }} @endif
@endif @else

{{ __('admin.no_data') }}

@endif
@endforeach
@endif
{{-- Action Buttons --}} @if (is_null($entityUpdate->is_approved)) @hasanypermission(['admin.provider_update_requests.approve', 'admin.provider_update_requests.reject'])
@haspermission('admin.provider_update_requests.approve') @endhaspermission @haspermission('admin.provider_update_requests.reject') @endhaspermission
@endhasanypermission @endif
{{-- Image Modal --}}
@endsection @section('js') @endsection