{{ $title }}

@if(isset($data) && count($data) > 0)
@php $firstItem = $data[0]; $keys = is_object($firstItem) ? array_keys(get_object_vars($firstItem)) : array_keys((array)$firstItem); $hasRoute = isset($route) && !empty($route); // Eğer route yoksa ve bazı id kolonları varsa işlem kolonu ekleyelim $hasIdColumns = false; if (!$hasRoute) { foreach ($keys as $key) { $lowerKey = strtolower($key); if ($lowerKey === 'product_id' || $lowerKey === 'urun_id' || $lowerKey === 'user_id' || $lowerKey === 'musteri_id' || $lowerKey === 'order_id' || $lowerKey === 'siparis_id') { $hasIdColumns = true; break; } } } @endphp @foreach($keys as $key) @endforeach @if($hasRoute || $hasIdColumns) @endif @foreach($data as $index => $item) @php $itemArray = is_object($item) ? get_object_vars($item) : (array)$item; @endphp @foreach($itemArray as $key => $value) @endforeach @if($hasRoute || $hasIdColumns) @endif @endforeach
@switch(strtolower($key)) @case('name') Ad @break @case('surname') Soyad @break @case('email') E-Posta @break @case('phone') Telefon @break @case('total_orders') Toplam Sipariş @break @case('price') Fiyat @break @case('quantity') Miktar @break @case('stock') Stok @break @default @php // Alt çizgileri boşluklara çevir ve her kelimenin ilk harfini büyüt $formattedKey = str_replace('_', ' ', $key); //türkçe destekle ve ilk harfi büyüt $formattedKey = mb_convert_case($formattedKey,MB_CASE_TITLE, 'UTF-8'); $formattedKey=str_replace('Urun','Ürün',$formattedKey); $formattedKey=str_replace('Adi','Adı',$formattedKey); $formattedKey=str_replace('Soyadi','Soyadı',$formattedKey); $formattedKey=str_replace('Satis','Satış',$formattedKey); $formattedKey=str_replace('Id','No',$formattedKey); $formattedKey=str_replace('Aylik','Aylık',$formattedKey); $formattedKey=str_replace('Yillik','Yıllık',$formattedKey); @endphp {{ $formattedKey }} @endswitch İşlem
@if(is_numeric($value) && (strpos(strtolower($key), 'price') !== false || strpos(strtolower($key), 'tutar') !== false || strpos(strtolower($key), 'fiyat') !== false)) ₺{{ number_format($value, 2, ',', '.') }} @elseif(is_numeric($value) && (strpos(strtolower($key), 'total_orders') !== false || strpos(strtolower($key), 'quantity') !== false || strpos(strtolower($key), 'miktar') !== false || strpos(strtolower($key), 'adet') !== false || strpos(strtolower($key), 'stock') !== false || strpos(strtolower($key), 'stok') !== false)) {{ number_format($value, 0, ',', '.') }} @elseif(strpos($key, 'date') !== false || strpos($key, 'created_at') !== false || strpos($key, 'updated_at') !== false) {{ \Carbon\Carbon::parse($value)->format('d.m.Y H:i') }} @else {{ $value }} @endif @php // Önce $route varsa onu kullan $routeUrl = null; $buttonText = "DETAY"; if ($hasRoute) { // Önce standart ID kontrolü yapalım $itemId = is_object($item) ? ($item->id ?? null) : ($item['id'] ?? null); // Route'daki placeholder'ları tespit edip değiştirelim if (!empty($route)) { $routeUrl = $route; // Standart ID değiştirmeleri if ($itemId) { $routeUrl = str_replace(':cariId', $itemId, $routeUrl); $routeUrl = str_replace('{cariId}', $itemId, $routeUrl); $routeUrl = str_replace(':stokId', $itemId, $routeUrl); $routeUrl = str_replace('{stokId}', $itemId, $routeUrl); $routeUrl = str_replace(':siparisId', $itemId, $routeUrl); $routeUrl = str_replace('{siparisId}', $itemId, $routeUrl); } // Özel ID alanları için kontrol foreach ($itemArray as $fieldName => $fieldValue) { $lowerFieldName = strtolower($fieldName); if ($lowerFieldName == 'musteri_id') { $routeUrl = str_replace(':musteri_id', $fieldValue, $routeUrl); $routeUrl = str_replace(':cariId', $fieldValue, $routeUrl); $routeUrl = str_replace('{cariId}', $fieldValue, $routeUrl); } elseif ($lowerFieldName == 'user_id') { $routeUrl = str_replace(':user_id', $fieldValue, $routeUrl); $routeUrl = str_replace(':cariId', $fieldValue, $routeUrl); $routeUrl = str_replace('{cariId}', $fieldValue, $routeUrl); } elseif ($lowerFieldName == 'product_id') { $routeUrl = str_replace(':product_id', $fieldValue, $routeUrl); $routeUrl = str_replace(':stokId', $fieldValue, $routeUrl); $routeUrl = str_replace('{stokId}', $fieldValue, $routeUrl); } elseif ($lowerFieldName == 'urun_id') { $routeUrl = str_replace(':urun_id', $fieldValue, $routeUrl); $routeUrl = str_replace(':stokId', $fieldValue, $routeUrl); $routeUrl = str_replace('{stokId}', $fieldValue, $routeUrl); } elseif ($lowerFieldName == 'order_id') { $routeUrl = str_replace(':order_id', $fieldValue, $routeUrl); $routeUrl = str_replace(':siparisId', $fieldValue, $routeUrl); $routeUrl = str_replace('{siparisId}', $fieldValue, $routeUrl); } elseif ($lowerFieldName == 'siparis_id') { $routeUrl = str_replace(':siparis_id', $fieldValue, $routeUrl); $routeUrl = str_replace(':siparisId', $fieldValue, $routeUrl); $routeUrl = str_replace('{siparisId}', $fieldValue, $routeUrl); } } // Buton metnini belirleyelim if(strpos($route, 'cari') !== false) { $buttonText = "CARİ DETAY"; } elseif(strpos($route, 'stok') !== false) { $buttonText = "ÜRÜNE GİT"; } } } // Yoksa veya itemId yoksa ilgili ID kolonlarını kontrol et else { // Ürün ID kontrolü if (isset($itemArray['product_id']) && $itemArray['product_id']) { $routeUrl = '/stok/guncelle/' . $itemArray['product_id']; $buttonText = "ÜRÜNE GİT"; } elseif (isset($itemArray['urun_id']) && $itemArray['urun_id']) { $routeUrl = '/stok/guncelle/' . $itemArray['urun_id']; $buttonText = "ÜRÜNE GİT"; } // Kullanıcı/Müşteri ID kontrolü elseif (isset($itemArray['user_id']) && $itemArray['user_id']) { $routeUrl = '/cari/guncelle/' . $itemArray['user_id']; $buttonText = "CARİ DETAY"; } elseif (isset($itemArray['musteri_id']) && $itemArray['musteri_id']) { $routeUrl = '/cari/guncelle/' . $itemArray['musteri_id']; $buttonText = "CARİ DETAY"; } // Sipariş ID kontrolü elseif (isset($itemArray['order_id']) && $itemArray['order_id']) { $routeUrl = '/orders/' . $itemArray['order_id']; $buttonText = "DETAY"; } elseif (isset($itemArray['siparis_id']) && $itemArray['siparis_id']) { $routeUrl = '/orders/' . $itemArray['siparis_id']; $buttonText = "DETAY"; } } @endphp @if($routeUrl) {{ $buttonText }} @endif
@else

Veri Bulunamadı

Aradığınız kriterlere uygun veri bulunmamaktadır.

@endif