# Script untuk mengkonversi direktori yang tersisa $viewsPath = "resources/views" # Daftar direktori yang tersisa $directories = @( "semesters", "jadwals", "prestasis", "pelanggarans", "catatan_kesehatans", "pembayarans" ) foreach ($dir in $directories) { $fullPath = Join-Path $viewsPath $dir if (Test-Path $fullPath) { Write-Host "Processing directory: $dir" # Proses semua file .blade.php dalam direktori $files = Get-ChildItem -Path $fullPath -Filter "*.blade.php" foreach ($file in $files) { Write-Host " Converting: $($file.Name)" $content = Get-Content $file.FullName -Raw # Skip jika sudah menggunakan x-app-layout if ($content -match '') { Write-Host " Skipped (already converted): $($file.Name)" continue } # Konversi @extends('layouts.app') ke $content = $content -replace '@extends\(''layouts\.app''\)', '' # Hapus @section('content') $content = $content -replace '@section\(''content''\)', '' # Ganti @endsection dengan $content = $content -replace '@endsection', '' # Tambah header slot setelah $title = "" if ($file.Name -match 'index\.blade\.php') { $title = "Daftar " + ($dir -replace '_', ' ' -replace 's$', '') } elseif ($file.Name -match 'create\.blade\.php') { $title = "Tambah " + ($dir -replace '_', ' ' -replace 's$', '') } elseif ($file.Name -match 'edit\.blade\.php') { $title = "Edit " + ($dir -replace '_', ' ' -replace 's$', '') } elseif ($file.Name -match 'show\.blade\.php') { $title = "Detail " + ($dir -replace '_', ' ' -replace 's$', '') } else { $title = "Manage " + ($dir -replace '_', ' ' -replace 's$', '') } # Tambah header slot $headerSlot = "`n `n

`n {{ __('$title') }}`n

`n
`n`n
`n
`n
`n
" $content = $content -replace '', "$headerSlot" # Tutup div wrapper $content = $content -replace '', "`n
`n
`n
`n
`n
" # Update styling untuk container dan card $content = $content -replace '
', '' $content = $content -replace '
', '' $content = $content -replace '
\s*
\s*', '' # Update button styling $content = $content -replace 'class="btn-primary mb-3 inline-block"', 'class="btn-primary"' # Update alert styling $content = $content -replace 'class="alert-success"', 'class="alert-success mb-4"' # Simpan file Set-Content -Path $file.FullName -Value $content -Encoding UTF8 } } } Write-Host "Conversion completed!"