diff --git a/app/Filament/Pages/ProgresDataPage.php b/app/Filament/Pages/ProgresDataPage.php index 7b2633cb..2e3e4356 100644 --- a/app/Filament/Pages/ProgresDataPage.php +++ b/app/Filament/Pages/ProgresDataPage.php @@ -114,23 +114,23 @@ protected function getHeaderActions(): array $mahasiswa = Mahasiswa::with(['prodi', 'jurusan'])->where('user_id', $user->id)->first(); $data = $mahasiswa ? Parameter::where('mahasiswa_id', $mahasiswa->id)->first() : null; - if ($data && $data->status === 'valid' && $data->hasil === 'Diterima') { - return [ - Action::make('exportSurat') - ->label('Download Surat Keterangan') - ->icon('heroicon-o-document-arrow-down') - ->action(function () use ($mahasiswa) { - $pdf = PDF::loadView('surat.keterangan', [ - 'mahasiswa' => $mahasiswa, - 'tanggal' => now()->format('Y-m-d'), - ]); + // if ($data && $data->status === 'valid' && $data->hasil === 'Diterima') { + // return [ + // Action::make('exportSurat') + // ->label('Download Surat Keterangan') + // ->icon('heroicon-o-document-arrow-down') + // ->action(function () use ($mahasiswa) { + // $pdf = PDF::loadView('surat.keterangan', [ + // 'mahasiswa' => $mahasiswa, + // 'tanggal' => now()->format('Y-m-d'), + // ]); - return response()->streamDownload(function () use ($pdf) { - echo $pdf->output(); - }, 'surat-keterangan-kipk.pdf'); - }) - ]; - } + // return response()->streamDownload(function () use ($pdf) { + // echo $pdf->output(); + // }, 'surat-k`eterangan-kipk.pdf'); + // }) + // ]; + // } return []; } diff --git a/app/Filament/Resources/HasilResource.php b/app/Filament/Resources/HasilResource.php index 41912b3f..7eb1e280 100644 --- a/app/Filament/Resources/HasilResource.php +++ b/app/Filament/Resources/HasilResource.php @@ -32,6 +32,76 @@ public static function table(Table $table): Table { return $table ->headerActions([ + Tables\Actions\Action::make('exportExcel') + ->label('Export Excel') + ->icon('heroicon-o-table-cells') + ->color('success') + ->action(function () { + $data = Parameter::with(['mahasiswa.jurusan', 'mahasiswa.prodi']) + ->where('status', 'valid') + ->orderBy('total_nilai', 'desc') + ->get(); + + $fileName = 'hasil-penilaian-' . now()->format('Y-m-d') . '.xlsx'; + + return response()->streamDownload(function () use ($data) { + $spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet(); + $sheet = $spreadsheet->getActiveSheet(); + + // Set header + $sheet->setCellValue('A1', 'No'); + $sheet->setCellValue('B1', 'Nama Mahasiswa'); + $sheet->setCellValue('C1', 'Jurusan'); + $sheet->setCellValue('D1', 'Program Studi'); + $sheet->setCellValue('E1', 'Akreditasi'); + $sheet->setCellValue('F1', 'Total Nilai'); + $sheet->setCellValue('G1', 'Hasil'); + + // Isi data + $row = 2; + foreach ($data as $index => $item) { + $sheet->setCellValue('A' . $row, $index + 1); + $sheet->setCellValue('B' . $row, $item->mahasiswa->nama); + $sheet->setCellValue('C' . $row, $item->mahasiswa->jurusan->nama); + $sheet->setCellValue('D' . $row, $item->mahasiswa->prodi->nama); + $sheet->setCellValue('E' . $row, $item->mahasiswa->prodi->akreditasi); + $sheet->setCellValue('F' . $row, number_format($item->total_nilai, 4)); + $sheet->setCellValue('G' . $row, $item->hasil); + $row++; + } + + // Auto size columns + foreach (range('A', 'G') as $col) { + $sheet->getColumnDimension($col)->setAutoSize(true); + } + + // Set header style + $headerStyle = [ + 'font' => ['bold' => true], + 'alignment' => ['horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER], + 'borders' => [ + 'allBorders' => ['borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN], + ], + 'fill' => [ + 'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID, + 'startColor' => ['rgb' => 'E2E8F0'], + ], + ]; + $sheet->getStyle('A1:G1')->applyFromArray($headerStyle); + + // Set data style + $dataStyle = [ + 'borders' => [ + 'allBorders' => ['borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN], + ], + ]; + $sheet->getStyle('A2:G' . ($row - 1))->applyFromArray($dataStyle); + + $writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet); + $writer->save('php://output'); + }, $fileName); + }), + Tables\Actions\Action::make('exportPdf') ->label('Export PDF') ->icon('heroicon-o-document-arrow-down') diff --git a/app/Filament/Resources/KriteriaResource.php b/app/Filament/Resources/KriteriaResource.php index 807b7ee4..a3fe18ef 100644 --- a/app/Filament/Resources/KriteriaResource.php +++ b/app/Filament/Resources/KriteriaResource.php @@ -26,6 +26,10 @@ class KriteriaResource extends Resource // protected static ?string $pluralModelLabel = 'Kriteria'; protected static ?string $slug = 'kriteria'; protected static ?int $navigationSort = 1; + public static function canCreate(): bool + { + return false; + } public static function form(Form $form): Form { diff --git a/app/Filament/Resources/MahasiswaResource.php b/app/Filament/Resources/MahasiswaResource.php index b3cde37f..339584e4 100644 --- a/app/Filament/Resources/MahasiswaResource.php +++ b/app/Filament/Resources/MahasiswaResource.php @@ -28,6 +28,11 @@ class MahasiswaResource extends Resource protected static ?string $slug = 'mahasiswa'; protected static ?int $navigationSort = 3;//buat urutannya + public static function canCreate(): bool + { + return false; + } + public static function form(Form $form): Form { return $form diff --git a/app/Filament/Resources/PengumumanResource.php b/app/Filament/Resources/PengumumanResource.php deleted file mode 100644 index d5402013..00000000 --- a/app/Filament/Resources/PengumumanResource.php +++ /dev/null @@ -1,78 +0,0 @@ -columns([ -// TextColumn::make('mahasiswa.nama') -// ->label('Nama Mahasiswa') -// ->searchable() -// ->sortable(), - -// TextColumn::make('status') -// ->label('Status Berkas') -// ->badge() -// ->color(fn (string $state): string => match ($state) { -// 'valid' => 'success', -// 'tidak_valid' => 'danger', -// 'belum_validasi' => 'warning', -// default => 'gray', -// }), - -// TextColumn::make('hasil') -// ->label('Hasil Seleksi') -// ->badge() -// ->color(fn (string $state): string => match ($state) { -// 'Layak' => 'success', -// 'Dipertimbangkan' => 'warning', -// 'Tidak Layak' => 'danger', -// default => 'gray', -// }), - -// ViewColumn::make('keterangan') -// ->label('Keterangan') -// ->view('filament.tables.columns.keterangan-pengumuman'), -// ]) -// ->defaultSort('total_nilai', 'desc') -// ->modifyQueryUsing(function (Builder $query): Builder { -// $user = auth()->user(); -// if ($user->roles[0]->name == 'Mahasiswa') { -// return $query->where('mahasiswa_id', $user->id); -// } -// return $query; -// }); -// } - -// public static function getPages(): array -// { -// return [ -// 'index' => Pages\ListPengumuman::route('/'), -// ]; -// } -// } diff --git a/app/Filament/Resources/SubKriteriaResource.php b/app/Filament/Resources/SubKriteriaResource.php index 7779a647..80ef5a57 100644 --- a/app/Filament/Resources/SubKriteriaResource.php +++ b/app/Filament/Resources/SubKriteriaResource.php @@ -35,6 +35,10 @@ class SubKriteriaResource extends Resource protected static ?string $slug = 'sub-kriteria'; protected static ?int $navigationSort = 2; + public static function canCreate(): bool + { + return false; + } public static function form(Form $form): Form { diff --git a/app/Models/Pengumuman.php b/app/Models/Pengumuman.php deleted file mode 100644 index 0ee0bb44..00000000 --- a/app/Models/Pengumuman.php +++ /dev/null @@ -1,30 +0,0 @@ -belongsTo(Parameter::class); -// } - -// public function user(): BelongsTo -// { -// return $this->belongsTo(User::class); -// } -// } \ No newline at end of file diff --git a/app/Providers/Filament/AdminPanelProvider.php b/app/Providers/Filament/AdminPanelProvider.php index 2918bb6b..db40757d 100644 --- a/app/Providers/Filament/AdminPanelProvider.php +++ b/app/Providers/Filament/AdminPanelProvider.php @@ -62,6 +62,7 @@ public function panel(Panel $panel): Panel ->authMiddleware([ Authenticate::class, ]) + ->sidebarCollapsibleOnDesktop() ->plugins([ \BezhanSalleh\FilamentShield\FilamentShieldPlugin::make(), ]); diff --git a/composer.json b/composer.json index c58ca9b0..ede86984 100644 --- a/composer.json +++ b/composer.json @@ -12,6 +12,7 @@ "filament/filament": "^3.2", "laravel/framework": "^11.31", "laravel/tinker": "^2.9", + "phpoffice/phpspreadsheet": "*", "spatie/laravel-permission": "*" }, "require-dev": { diff --git a/composer.lock b/composer.lock index ca8cc35f..76f127f1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "37d23fa0748ae9cc0599922cd0df01a3", + "content-hash": "57dba14cea890cadf8142ea60b0ac958", "packages": [ { "name": "anourvalar/eloquent-serialize", @@ -515,6 +515,85 @@ ], "time": "2024-02-09T16:56:22+00:00" }, + { + "name": "composer/pcre", + "version": "3.3.2", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "conflict": { + "phpstan/phpstan": "<1.11.10" + }, + "require-dev": { + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-strict-rules": "^1 || ^2", + "phpunit/phpunit": "^8 || ^9" + }, + "type": "library", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + }, + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.3.2" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-11-12T16:29:46+00:00" + }, { "name": "danharrin/date-format-converter", "version": "v0.3.1", @@ -3459,6 +3538,191 @@ ], "time": "2025-03-04T21:48:52+00:00" }, + { + "name": "maennchen/zipstream-php", + "version": "3.1.2", + "source": { + "type": "git", + "url": "https://github.com/maennchen/ZipStream-PHP.git", + "reference": "aeadcf5c412332eb426c0f9b4485f6accba2a99f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/aeadcf5c412332eb426c0f9b4485f6accba2a99f", + "reference": "aeadcf5c412332eb426c0f9b4485f6accba2a99f", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "ext-zlib": "*", + "php-64bit": "^8.2" + }, + "require-dev": { + "brianium/paratest": "^7.7", + "ext-zip": "*", + "friendsofphp/php-cs-fixer": "^3.16", + "guzzlehttp/guzzle": "^7.5", + "mikey179/vfsstream": "^1.6", + "php-coveralls/php-coveralls": "^2.5", + "phpunit/phpunit": "^11.0", + "vimeo/psalm": "^6.0" + }, + "suggest": { + "guzzlehttp/psr7": "^2.4", + "psr/http-message": "^2.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "ZipStream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paul Duncan", + "email": "pabs@pablotron.org" + }, + { + "name": "Jonatan Männchen", + "email": "jonatan@maennchen.ch" + }, + { + "name": "Jesse Donat", + "email": "donatj@gmail.com" + }, + { + "name": "András Kolesár", + "email": "kolesar@kolesar.hu" + } + ], + "description": "ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.", + "keywords": [ + "stream", + "zip" + ], + "support": { + "issues": "https://github.com/maennchen/ZipStream-PHP/issues", + "source": "https://github.com/maennchen/ZipStream-PHP/tree/3.1.2" + }, + "funding": [ + { + "url": "https://github.com/maennchen", + "type": "github" + } + ], + "time": "2025-01-27T12:07:53+00:00" + }, + { + "name": "markbaker/complex", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/MarkBaker/PHPComplex.git", + "reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/95c56caa1cf5c766ad6d65b6344b807c1e8405b9", + "reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "dev-master", + "phpcompatibility/php-compatibility": "^9.3", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "squizlabs/php_codesniffer": "^3.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Complex\\": "classes/src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Baker", + "email": "mark@lange.demon.co.uk" + } + ], + "description": "PHP Class for working with complex numbers", + "homepage": "https://github.com/MarkBaker/PHPComplex", + "keywords": [ + "complex", + "mathematics" + ], + "support": { + "issues": "https://github.com/MarkBaker/PHPComplex/issues", + "source": "https://github.com/MarkBaker/PHPComplex/tree/3.0.2" + }, + "time": "2022-12-06T16:21:08+00:00" + }, + { + "name": "markbaker/matrix", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/MarkBaker/PHPMatrix.git", + "reference": "728434227fe21be27ff6d86621a1b13107a2562c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/728434227fe21be27ff6d86621a1b13107a2562c", + "reference": "728434227fe21be27ff6d86621a1b13107a2562c", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "dev-master", + "phpcompatibility/php-compatibility": "^9.3", + "phpdocumentor/phpdocumentor": "2.*", + "phploc/phploc": "^4.0", + "phpmd/phpmd": "2.*", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "sebastian/phpcpd": "^4.0", + "squizlabs/php_codesniffer": "^3.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Matrix\\": "classes/src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Baker", + "email": "mark@demon-angel.eu" + } + ], + "description": "PHP Class for working with matrices", + "homepage": "https://github.com/MarkBaker/PHPMatrix", + "keywords": [ + "mathematics", + "matrix", + "vector" + ], + "support": { + "issues": "https://github.com/MarkBaker/PHPMatrix/issues", + "source": "https://github.com/MarkBaker/PHPMatrix/tree/3.0.1" + }, + "time": "2022-12-02T22:17:43+00:00" + }, { "name": "masterminds/html5", "version": "2.9.0", @@ -4121,6 +4385,112 @@ ], "time": "2025-01-30T13:51:11+00:00" }, + { + "name": "phpoffice/phpspreadsheet", + "version": "4.2.0", + "source": { + "type": "git", + "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", + "reference": "5f6d7410e5fd72cac1aa67d4f05f4fe664d01ba6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/5f6d7410e5fd72cac1aa67d4f05f4fe664d01ba6", + "reference": "5f6d7410e5fd72cac1aa67d4f05f4fe664d01ba6", + "shasum": "" + }, + "require": { + "composer/pcre": "^1||^2||^3", + "ext-ctype": "*", + "ext-dom": "*", + "ext-fileinfo": "*", + "ext-gd": "*", + "ext-iconv": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-simplexml": "*", + "ext-xml": "*", + "ext-xmlreader": "*", + "ext-xmlwriter": "*", + "ext-zip": "*", + "ext-zlib": "*", + "maennchen/zipstream-php": "^2.1 || ^3.0", + "markbaker/complex": "^3.0", + "markbaker/matrix": "^3.0", + "php": "^8.1", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0", + "psr/simple-cache": "^1.0 || ^2.0 || ^3.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "dev-main", + "dompdf/dompdf": "^2.0 || ^3.0", + "friendsofphp/php-cs-fixer": "^3.2", + "mitoteam/jpgraph": "^10.3", + "mpdf/mpdf": "^8.1.1", + "phpcompatibility/php-compatibility": "^9.3", + "phpstan/phpstan": "^1.1 || ^2.0", + "phpstan/phpstan-deprecation-rules": "^1.0 || ^2.0", + "phpstan/phpstan-phpunit": "^1.0 || ^2.0", + "phpunit/phpunit": "^10.5", + "squizlabs/php_codesniffer": "^3.7", + "tecnickcom/tcpdf": "^6.5" + }, + "suggest": { + "dompdf/dompdf": "Option for rendering PDF with PDF Writer", + "ext-intl": "PHP Internationalization Functions", + "mitoteam/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers", + "mpdf/mpdf": "Option for rendering PDF with PDF Writer", + "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maarten Balliauw", + "homepage": "https://blog.maartenballiauw.be" + }, + { + "name": "Mark Baker", + "homepage": "https://markbakeruk.net" + }, + { + "name": "Franck Lefevre", + "homepage": "https://rootslabs.net" + }, + { + "name": "Erik Tilt" + }, + { + "name": "Adrien Crivelli" + } + ], + "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", + "homepage": "https://github.com/PHPOffice/PhpSpreadsheet", + "keywords": [ + "OpenXML", + "excel", + "gnumeric", + "ods", + "php", + "spreadsheet", + "xls", + "xlsx" + ], + "support": { + "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", + "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/4.2.0" + }, + "time": "2025-04-17T02:41:45+00:00" + }, { "name": "phpoption/phpoption", "version": "1.9.3", diff --git a/config/filament-shield.php b/config/filament-shield.php index 37b90493..003dc7b1 100644 --- a/config/filament-shield.php +++ b/config/filament-shield.php @@ -2,7 +2,7 @@ return [ 'shield_resource' => [ - 'should_register_navigation' => true, + 'should_register_navigation' => false, 'slug' => 'shield/roles', 'navigation_sort' => 4, 'navigation_badge' => true, diff --git a/resources/views/exports/hasil-penilaian.blade.php b/resources/views/exports/hasil-penilaian.blade.php index 0d236f09..55a07413 100644 --- a/resources/views/exports/hasil-penilaian.blade.php +++ b/resources/views/exports/hasil-penilaian.blade.php @@ -154,10 +154,8 @@