@extends("admin.master") @section("title", "User Guide") @section("content") @php // Tüm işlemleri sayfa içinde yapıyoruz - hiç external dependency yok use App\Types; use Illuminate\Support\Facades\Request; if(!isset($contents)) { $contents = \App\Contents::where("kid","main")->orderBy("s","ASC")->get(); } // Auth kontrolü - basit ve güvenli $user = null; try { $user = Auth::user(); } catch (\Exception $e) { // Auth hatası durumunda devam et } // URL'den module parametresini al - daha güvenli yöntem $currentPath = $_SERVER['REQUEST_URI'] ?? ''; $pathParts = explode('/', trim($currentPath, '/')); $moduleSlug = null; // URL pattern: /admin/user-guide/{module} $userGuideIndex = array_search('user-guide', $pathParts); if ($userGuideIndex !== false && isset($pathParts[$userGuideIndex + 1])) { $moduleSlug = $pathParts[$userGuideIndex + 1]; } $allModules = collect(); $currentModule = null; $content = ''; try { // Guide klasöründeki .md dosyalarını direkt oku $guideDirectory = resource_path('views/guide'); $guideFiles = []; if (is_dir($guideDirectory)) { $files = scandir($guideDirectory); foreach ($files as $file) { if (pathinfo($file, PATHINFO_EXTENSION) === 'md') { $slug = pathinfo($file, PATHINFO_FILENAME); $filePath = $guideDirectory . '/' . $file; $guideFiles[] = [ 'slug' => $slug, 'modified_time' => file_exists($filePath) ? filemtime($filePath) : 0 ]; } } } // Her .md dosyası için modül objesi oluştur $allModules = collect($guideFiles)->map(function($fileInfo) { $slug = $fileInfo['slug']; // Types tablosundan bilgi almaya çalış, yoksa default oluştur $typeModule = null; try { $typeModule = Types::where('slug', $slug)->first(); } catch (\Exception $e) { // Types tablosu hatası durumunda devam et } // Modül objesi oluştur $module = (object)[ 'id' => $typeModule->id ?? 'guide_' . md5($slug), 'slug' => $slug, 'title' => $typeModule->title ?? ucwords(str_replace(['-', '_'], ' ', $slug)), 'icon' => $typeModule->icon ?? 'default', 'kid' => null, // Hepsini ana modül olarak göster 'subModules' => collect([]), // Alt modül yok 'enabled' => true, 'from_guide' => true, // Guide'dan geldiğini belirt 'modified_time' => $fileInfo['modified_time'] ]; return $module; })->sortByDesc('modified_time'); // Tüm modülleri (guide'dan gelen) tek listede de tutalım $allModulesList = $allModules; if ($moduleSlug) { // Spesifik modül sayfası - hem ana hem alt modüllerde ara $currentModule = $allModulesList->where('slug', $moduleSlug)->first(); if ($currentModule) { $markdownPath = resource_path("views/guide/{$moduleSlug}.md"); if (file_exists($markdownPath)) { $content = file_get_contents($markdownPath); } else { $moduleType = $currentModule->kid ? 'Sub-module' : 'Module'; $content = "# {$currentModule->title} Documentation\n\n_{$moduleType} Documentation_\n\n## Overview\n\nThis module provides functionality for {$currentModule->title} management.\n\n## Features\n\n- CRUD operations\n- Data validation\n- Excel import/export\n- Advanced filtering\n- Real-time updates\n\n## Getting Started\n\n1. Navigate to the module from the admin menu\n2. Use the DataGrid to view existing records\n3. Click 'Add New' to create records\n4. Use filters to find specific data\n5. Export data to Excel when needed\n\n## DataGrid Features\n\n- **Sorting**: Click column headers to sort\n- **Filtering**: Use filter row to narrow results\n- **Pagination**: Navigate through large datasets\n- **Selection**: Select multiple rows for bulk operations\n\n## Common Tasks\n\n### Adding New Records\n1. Click the 'Add' button in the toolbar\n2. Fill in the required fields\n3. Click 'Save' to create the record\n\n### Editing Records\n1. Double-click on a row or use the edit button\n2. Modify the fields as needed\n3. Click 'Save' to update\n\n### Bulk Operations\n1. Select multiple rows using checkboxes\n2. Choose an action from the bulk operations menu\n3. Confirm the operation\n\n## Support\n\nFor technical support, please contact the development team."; } } else { $content = "# Module Not Found\n\nThe requested module '{$moduleSlug}' could not be found."; } } } catch (\Exception $e) { // Hata durumunda da guide klasöründen direkt oku $guideDirectory = resource_path('views/guide'); $guideFiles = []; if (is_dir($guideDirectory)) { $files = scandir($guideDirectory); foreach ($files as $file) { if (pathinfo($file, PATHINFO_EXTENSION) === 'md') { $slug = pathinfo($file, PATHINFO_FILENAME); $filePath = $guideDirectory . '/' . $file; $guideFiles[] = [ 'slug' => $slug, 'modified_time' => file_exists($filePath) ? filemtime($filePath) : 0 ]; } } } // Her .md dosyası için basit modül objesi oluştur $allModules = collect($guideFiles)->map(function($fileInfo) { return (object)[ 'id' => 'guide_' . md5($fileInfo['slug']), 'slug' => $fileInfo['slug'], 'title' => ucwords(str_replace(['-', '_'], ' ', $fileInfo['slug'])), 'icon' => 'default', 'kid' => null, 'subModules' => collect([]), 'enabled' => true, 'from_guide' => true, 'modified_time' => $fileInfo['modified_time'] ]; })->sortByDesc('modified_time'); $allModulesList = $allModules; if ($moduleSlug) { $currentModule = $allModules->where('slug', $moduleSlug)->first(); if ($currentModule) { $content = "# {$currentModule->title} Documentation\n\nComplete documentation for {$currentModule->title} module.\n\n## Overview\n\nThis module provides functionality for {$currentModule->title} management.\n\n## Features\n\n- CRUD operations\n- Data validation\n- Excel import/export\n- Advanced filtering"; } } } @endphp {{-- Her zaman sidebar layout kullan --}}

All Modules

@if($currentModule)

{{$currentModule->title}} - Documentation

{!! \Illuminate\Support\Str::markdown($content) !!}
@else

User Guide - Module Documentation

Welcome to the User Guide!
This comprehensive documentation covers all modules in the Stellar QC QA application. Select any module from the left sidebar to view detailed documentation including CRUD operations, DataGrid configurations, field relationships, and usage instructions.
{{$allModules->count()}} documented modules available {{$allModules->count()}} total guides From guide directory Last updated: {{date('Y-m-d H:i')}}
@foreach($allModules->take(6) as $module)
{{$module->title}}

Documentation for {{$module->title}} module

View Guide
@endforeach
@if($allModules->count() > 6)

Use the sidebar to see all {{$allModules->count()}} modules

@endif
@endif
@endsection