Initial commit - lms-v2 + CLAUDE.md

This commit is contained in:
Iwit
2026-05-30 22:15:16 +07:00
commit 5811409e2d
183 changed files with 23225 additions and 0 deletions
+69
View File
@@ -0,0 +1,69 @@
<?php
namespace App\Exports;
use App\Models\Position;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Concerns\WithCustomStartCell;
use Maatwebsite\Excel\Events\AfterSheet;
use Carbon\Carbon;
class PositionsExport implements FromCollection, WithHeadings, WithMapping, ShouldAutoSize, WithEvents, WithCustomStartCell
{
public function collection()
{
return Position::orderBy('name', 'asc')->get();
}
public function startCell(): string
{
return 'A6';
}
public function headings(): array
{
return ['No', 'Nama Jabatan / Posisi', 'Dibuat Pada'];
}
public function map($position): array
{
static $number = 0;
$number++;
return [
$number,
$position->name,
$position->created_at ? Carbon::parse($position->created_at)->format('d-m-Y H:i') : '-',
];
}
public function registerEvents(): array
{
return [
AfterSheet::class => function(AfterSheet $event) {
$sheet = $event->sheet->getDelegate();
$count = Position::count();
$user = auth()->user()->first_name . ' ' . auth()->user()->last_name;
$date = Carbon::now()->translatedFormat('d F Y - H:i:s');
$sheet->setCellValue('A1', 'LAPORAN MASTER DATA JABATAN');
$sheet->setCellValue('A2', 'Total Data : ' . $count . ' Jabatan');
$sheet->setCellValue('A3', 'Dicetak Oleh: ' . $user);
$sheet->setCellValue('A4', 'Waktu Cetak : ' . $date);
$sheet->mergeCells('A1:C1');
$sheet->getStyle('A1')->getFont()->setBold(true)->setSize(14);
$sheet->getStyle('A2:A4')->getFont()->setBold(true);
$sheet->getStyle('A6:C6')->getFont()->setBold(true);
$sheet->getStyle('A6:C6')->getFill()
->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)
->getStartColor()->setARGB('FFE2E8F0');
},
];
}
}