add-report-student
This commit is contained in:
parent
dee2805504
commit
22586ffb97
138
app/Filament/Pages/ReportPreview.php
Normal file
138
app/Filament/Pages/ReportPreview.php
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Pages;
|
||||||
|
|
||||||
|
use App\Models\AcademicYear;
|
||||||
|
use App\Models\ClassRoom;
|
||||||
|
use App\Models\ClassSubject;
|
||||||
|
use App\Models\Student;
|
||||||
|
use App\Models\SchoolInformation;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
|
use Filament\Pages\Page;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use function PHPUnit\Framework\isEmpty;
|
||||||
|
|
||||||
|
Carbon::setLocale('id');
|
||||||
|
|
||||||
|
class ReportPreview extends Page
|
||||||
|
{
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
||||||
|
|
||||||
|
protected static string $view = 'filament.pages.report-preview';
|
||||||
|
|
||||||
|
public $student;
|
||||||
|
public $class;
|
||||||
|
public $class_name;
|
||||||
|
public $academic_year;
|
||||||
|
public $semester;
|
||||||
|
|
||||||
|
public $school_information;
|
||||||
|
|
||||||
|
public $table = [];
|
||||||
|
|
||||||
|
public function mount()
|
||||||
|
{
|
||||||
|
$this->loadData();
|
||||||
|
$this->loadAssessment();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function loadData() : void
|
||||||
|
{
|
||||||
|
$this->student = Student::find(request()->query('studentId'));
|
||||||
|
$this->class = ClassRoom::find(request()->query('classId'));
|
||||||
|
$this->academic_year = AcademicYear::find(request()->query('yearId'));
|
||||||
|
$this->semester = request()->query('semester');
|
||||||
|
$this->school_information = SchoolInformation::first();
|
||||||
|
|
||||||
|
$this->class_name = $this->toRoman($this->class->class_level) . ' ' . $this->extractClassLetter($this->class->class_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function loadAssessment(): void
|
||||||
|
{
|
||||||
|
$requiredParams = ['studentId', 'classId', 'semester', 'yearId'];
|
||||||
|
|
||||||
|
foreach ($requiredParams as $param) {
|
||||||
|
if (blank(request()->query($param))) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Missing Data')
|
||||||
|
->body("The parameter '{$param}' is required.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$student_id = request()->query('studentId');
|
||||||
|
$class_id = request()->query('classId');
|
||||||
|
$semester = request()->query('semester');
|
||||||
|
$year_id = request()->query('yearId');
|
||||||
|
|
||||||
|
// Class Student Mapping
|
||||||
|
$classSubjects = ClassSubject::with(['subject', 'class', 'academicYear'])
|
||||||
|
->where('class_room_id', $class_id)
|
||||||
|
->where('academic_year_id', $year_id)
|
||||||
|
->get()
|
||||||
|
->sortByDesc(function ($item) {
|
||||||
|
return $item->subject->name;
|
||||||
|
})
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
|
||||||
|
$subjects = [];
|
||||||
|
|
||||||
|
foreach ($classSubjects as $classSubject) {
|
||||||
|
$category = strtolower($classSubject['subject']['category']);
|
||||||
|
$subjectName = $classSubject['subject']['name'];
|
||||||
|
$subjectId = $classSubject['subject']['id'];
|
||||||
|
$subjects[$category][$subjectId] = $subjectName;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->table["subjects"] = $subjects;
|
||||||
|
|
||||||
|
// dd($subjects);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function extractClassLetter($className)
|
||||||
|
{
|
||||||
|
preg_match('/[A-Z]+$/i', trim($className), $matches);
|
||||||
|
return $matches[0] ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toRoman($number)
|
||||||
|
{
|
||||||
|
$map = [
|
||||||
|
'M' => 1000,
|
||||||
|
'CM' => 900,
|
||||||
|
'D' => 500,
|
||||||
|
'CD' => 400,
|
||||||
|
'C' => 100,
|
||||||
|
'XC' => 90,
|
||||||
|
'L' => 50,
|
||||||
|
'XL' => 40,
|
||||||
|
'X' => 10,
|
||||||
|
'IX' => 9,
|
||||||
|
'V' => 5,
|
||||||
|
'IV' => 4,
|
||||||
|
'I' => 1,
|
||||||
|
];
|
||||||
|
|
||||||
|
$returnValue = '';
|
||||||
|
while ($number > 0) {
|
||||||
|
foreach ($map as $roman => $int) {
|
||||||
|
if ($number >= $int) {
|
||||||
|
$number -= $int;
|
||||||
|
$returnValue .= $roman;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function shouldRegisterNavigation(): bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
95
app/Filament/Pages/SchoolInformation.php
Normal file
95
app/Filament/Pages/SchoolInformation.php
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Pages;
|
||||||
|
|
||||||
|
use Filament\Forms\Components\Grid;
|
||||||
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
|
use Filament\Forms\Components\Textarea;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
|
use Filament\Pages\Page;
|
||||||
|
use Filament\Forms\Contracts\HasForms;
|
||||||
|
use Filament\Forms\Concerns\InteractsWithForms;
|
||||||
|
|
||||||
|
use App\Models\SchoolInformation as SchoolInformationModel;
|
||||||
|
|
||||||
|
class SchoolInformation extends Page implements HasForms
|
||||||
|
{
|
||||||
|
use InteractsWithForms;
|
||||||
|
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
||||||
|
protected static string $view = 'filament.pages.school-information';
|
||||||
|
protected static ?string $navigationGroup = 'Settings';
|
||||||
|
protected static ?int $navigationSort = 999; // Biar muncul paling bawah
|
||||||
|
|
||||||
|
public ?array $data = [];
|
||||||
|
|
||||||
|
public ?SchoolInformationModel $record = null;
|
||||||
|
|
||||||
|
public function mount(): void
|
||||||
|
{
|
||||||
|
$this->record = SchoolInformationModel::firstOrNew();
|
||||||
|
$this->form->fill($this->record->toArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form(Form $form): Form
|
||||||
|
{
|
||||||
|
return $form
|
||||||
|
->schema([
|
||||||
|
Grid::make(2)->schema([
|
||||||
|
TextInput::make('school_name')->label('Nama Sekolah')->required(),
|
||||||
|
TextInput::make('npsn')
|
||||||
|
->label('NPSN')
|
||||||
|
->numeric()
|
||||||
|
->nullable(),
|
||||||
|
TextInput::make('nss')
|
||||||
|
->label('NSS')
|
||||||
|
->nullable(),
|
||||||
|
Textarea::make('address')
|
||||||
|
->label('Alamat Sekolah')
|
||||||
|
->nullable(),
|
||||||
|
TextInput::make('postal_code')
|
||||||
|
->label('Kode Pos')
|
||||||
|
->numeric()
|
||||||
|
->nullable()
|
||||||
|
->default(null),
|
||||||
|
TextInput::make('sub_district')
|
||||||
|
->label('Desa / Kelurahan')
|
||||||
|
->nullable(),
|
||||||
|
TextInput::make('district')
|
||||||
|
->label('Kecamatan')
|
||||||
|
->nullable(),
|
||||||
|
TextInput::make('city')
|
||||||
|
->label('Kota / Kabupaten')
|
||||||
|
->nullable(),
|
||||||
|
TextInput::make('province')
|
||||||
|
->label('Provinsi')
|
||||||
|
->nullable(),
|
||||||
|
TextInput::make('email')
|
||||||
|
->label('Email')
|
||||||
|
->nullable(),
|
||||||
|
TextInput::make('headmaster_name')
|
||||||
|
->label('Nama Kepala Sekolah')
|
||||||
|
->nullable(),
|
||||||
|
TextInput::make('headmaster_nip')
|
||||||
|
->label('NIP Kepala Sekolah')
|
||||||
|
->nullable(),
|
||||||
|
TextInput::make('phase')
|
||||||
|
->label('Fase')
|
||||||
|
->nullable(),
|
||||||
|
])
|
||||||
|
])
|
||||||
|
->model($this->record)
|
||||||
|
->statePath('data');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save(): void
|
||||||
|
{
|
||||||
|
$this->record->fill($this->data)->save();
|
||||||
|
Notification::make()
|
||||||
|
->title('Success')
|
||||||
|
->body('Data saved successfully.')
|
||||||
|
->success()
|
||||||
|
->send();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -118,6 +118,7 @@ class StudentReport extends Page
|
|||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
|
|
||||||
$header = [];
|
$header = [];
|
||||||
|
|
||||||
foreach ($classSubjects as $classSubject) {
|
foreach ($classSubjects as $classSubject) {
|
||||||
@ -163,6 +164,7 @@ class StudentReport extends Page
|
|||||||
|
|
||||||
$studentData = [
|
$studentData = [
|
||||||
'name' => $fnl['name'],
|
'name' => $fnl['name'],
|
||||||
|
'id' => $fnl['student_id'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$mapel = $fnl['umum'] ?? null;
|
$mapel = $fnl['umum'] ?? null;
|
||||||
@ -187,6 +189,7 @@ class StudentReport extends Page
|
|||||||
}
|
}
|
||||||
|
|
||||||
$studentData['muatan lokal'] = $fnl['muatan lokal'] ?? null;
|
$studentData['muatan lokal'] = $fnl['muatan lokal'] ?? null;
|
||||||
|
$studentData['seni'] = $fnl['seni'] ?? null;
|
||||||
|
|
||||||
$result[] = $studentData;
|
$result[] = $studentData;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,8 @@ class AcademicYearResource extends Resource
|
|||||||
|
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
|
protected static ?string $navigationGroup = 'Academic Setup';
|
||||||
|
|
||||||
public static function form(Form $form): Form
|
public static function form(Form $form): Form
|
||||||
{
|
{
|
||||||
return $form
|
return $form
|
||||||
|
|||||||
@ -22,6 +22,8 @@ class ClassStudentResource extends Resource
|
|||||||
|
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
|
protected static ?string $navigationGroup = 'Academic Setup';
|
||||||
|
|
||||||
public static function form(Form $form): Form
|
public static function form(Form $form): Form
|
||||||
{
|
{
|
||||||
return $form
|
return $form
|
||||||
|
|||||||
@ -21,7 +21,7 @@ class ClassSubjectResource extends Resource
|
|||||||
|
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
|
protected static ?string $navigationGroup = 'Academic Setup';
|
||||||
|
|
||||||
public static function form(Form $form): Form
|
public static function form(Form $form): Form
|
||||||
{
|
{
|
||||||
|
|||||||
110
app/Filament/Resources/ExtracurricularAssessmentResource.php
Normal file
110
app/Filament/Resources/ExtracurricularAssessmentResource.php
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Resources\ExtracurricularAssessmentResource\Pages;
|
||||||
|
use App\Filament\Resources\ExtracurricularAssessmentResource\RelationManagers;
|
||||||
|
use App\Models\ClassStudent;
|
||||||
|
use App\Models\Extracurricular;
|
||||||
|
use App\Models\ExtracurricularAssessment;
|
||||||
|
use App\Models\TeacherSubject;
|
||||||
|
use Filament\Forms;
|
||||||
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Resources\Resource;
|
||||||
|
use Filament\Tables;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
|
|
||||||
|
class ExtracurricularAssessmentResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = ExtracurricularAssessment::class;
|
||||||
|
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
|
protected static ?string $navigationGroup = 'Academic Management';
|
||||||
|
|
||||||
|
public static function form(Form $form): Form
|
||||||
|
{
|
||||||
|
return $form
|
||||||
|
->schema([
|
||||||
|
Forms\Components\Select::make('class_student_id')
|
||||||
|
->relationship('classStudent', 'id') // atau gunakan relasi yang lebih deskriptif jika ada
|
||||||
|
->getOptionLabelFromRecordUsing(fn (ClassStudent $record) =>
|
||||||
|
$record->class->class_name . ' - ' . $record->student->full_name . ' - ' . $record->academicYear->name)
|
||||||
|
->searchable()
|
||||||
|
->preload()
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
Forms\Components\Select::make('extracurricular_id')
|
||||||
|
->relationship('extracurricular', 'name')
|
||||||
|
->label('Extracurricular')
|
||||||
|
->options(Extracurricular::all()->pluck('name', 'id'))
|
||||||
|
->searchable()
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
Forms\Components\Select::make('semester')
|
||||||
|
->options([
|
||||||
|
'first' => 'Ganjil',
|
||||||
|
'second' => 'Genap',
|
||||||
|
])
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
Forms\Components\TextInput::make('score')
|
||||||
|
->numeric()
|
||||||
|
->required(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->columns([
|
||||||
|
Tables\Columns\TextColumn::make('classStudent.student.full_name')
|
||||||
|
->label('Student')
|
||||||
|
->searchable(),
|
||||||
|
|
||||||
|
Tables\Columns\TextColumn::make('classStudent.class.class_name')
|
||||||
|
->label('Class')
|
||||||
|
->searchable(),
|
||||||
|
|
||||||
|
Tables\Columns\TextColumn::make('classStudent.academicYear.name')
|
||||||
|
->label('Academic Year'),
|
||||||
|
|
||||||
|
Tables\Columns\TextColumn::make('extracurricular.name')
|
||||||
|
->label('Extracurricular'),
|
||||||
|
|
||||||
|
Tables\Columns\TextColumn::make('semester'),
|
||||||
|
|
||||||
|
Tables\Columns\TextColumn::make('score')
|
||||||
|
->sortable(),
|
||||||
|
])
|
||||||
|
->filters([
|
||||||
|
//
|
||||||
|
])
|
||||||
|
->actions([
|
||||||
|
Tables\Actions\EditAction::make(),
|
||||||
|
])
|
||||||
|
->bulkActions([
|
||||||
|
Tables\Actions\BulkActionGroup::make([
|
||||||
|
Tables\Actions\DeleteBulkAction::make(),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getRelations(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => Pages\ListExtracurricularAssessments::route('/'),
|
||||||
|
'create' => Pages\CreateExtracurricularAssessment::route('/create'),
|
||||||
|
'edit' => Pages\EditExtracurricularAssessment::route('/{record}/edit'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\ExtracurricularAssessmentResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\ExtracurricularAssessmentResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateExtracurricularAssessment extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = ExtracurricularAssessmentResource::class;
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\ExtracurricularAssessmentResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\ExtracurricularAssessmentResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditExtracurricularAssessment extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = ExtracurricularAssessmentResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\ExtracurricularAssessmentResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\ExtracurricularAssessmentResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListExtracurricularAssessments extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = ExtracurricularAssessmentResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -22,6 +22,8 @@ class HomeRoomTeacherResource extends Resource
|
|||||||
|
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
|
protected static ?string $navigationGroup = 'Academic Setup';
|
||||||
|
|
||||||
public static function form(Form $form): Form
|
public static function form(Form $form): Form
|
||||||
{
|
{
|
||||||
return $form
|
return $form
|
||||||
|
|||||||
@ -22,7 +22,8 @@ class TeacherSubjectResource extends Resource
|
|||||||
protected static ?string $model = TeacherSubject::class;
|
protected static ?string $model = TeacherSubject::class;
|
||||||
|
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-academic-cap';
|
protected static ?string $navigationIcon = 'heroicon-o-academic-cap';
|
||||||
protected static ?string $navigationGroup = 'Academic Management';
|
|
||||||
|
protected static ?string $navigationGroup = 'Academic Setup';
|
||||||
|
|
||||||
public static function form(Form $form): Form
|
public static function form(Form $form): Form
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class ClassStudent extends Model
|
class ClassStudent extends Model
|
||||||
@ -25,4 +26,9 @@ class ClassStudent extends Model
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(AcademicYear::class, 'academic_year_id');
|
return $this->belongsTo(AcademicYear::class, 'academic_year_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function extracurricularAssessments() : HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(ExtracurricularAssessment::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,4 +7,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
class Extracurricular extends Model
|
class Extracurricular extends Model
|
||||||
{
|
{
|
||||||
protected $fillable = ['name', 'description'];
|
protected $fillable = ['name', 'description'];
|
||||||
|
|
||||||
|
public function assessments()
|
||||||
|
{
|
||||||
|
return $this->hasMany(ExtracurricularAssessment::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
25
app/Models/ExtracurricularAssessment.php
Normal file
25
app/Models/ExtracurricularAssessment.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ExtracurricularAssessment extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'class_student_id',
|
||||||
|
'extracurricular_id',
|
||||||
|
'score',
|
||||||
|
'semester',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function classStudent()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(ClassStudent::class, 'class_student_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function extracurricular()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Extracurricular::class, 'extracurricular_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
24
app/Models/SchoolInformation.php
Normal file
24
app/Models/SchoolInformation.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class SchoolInformation extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'school_name',
|
||||||
|
'npsn',
|
||||||
|
'nss',
|
||||||
|
'address',
|
||||||
|
'postal_code',
|
||||||
|
'sub_district',
|
||||||
|
'district',
|
||||||
|
'city',
|
||||||
|
'province',
|
||||||
|
'email',
|
||||||
|
'headmaster_name',
|
||||||
|
'headmaster_nip',
|
||||||
|
'phase',
|
||||||
|
];
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('extracurricular_assessments', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('class_student_id')->constrained('class_students');
|
||||||
|
$table->foreignId('extracurricular_id')->constrained('extracurriculars');
|
||||||
|
$table->float('score');
|
||||||
|
$table->string('semester');
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('extracurricular_assessments');
|
||||||
|
}
|
||||||
|
};
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('school_information', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('school_name');
|
||||||
|
$table->string('npsn')->nullable();
|
||||||
|
$table->string('nss')->nullable();
|
||||||
|
$table->string('address')->nullable();
|
||||||
|
$table->string('postal_code')->nullable();
|
||||||
|
$table->string('sub_district')->nullable();
|
||||||
|
$table->string('district')->nullable();
|
||||||
|
$table->string('city')->nullable();
|
||||||
|
$table->string('province')->nullable();
|
||||||
|
$table->string('email')->nullable();
|
||||||
|
$table->string('headmaster_name')->nullable();
|
||||||
|
$table->string('headmaster_nip')->nullable();
|
||||||
|
$table->string('phase')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('school_information');
|
||||||
|
}
|
||||||
|
};
|
||||||
@ -21,6 +21,7 @@ class DatabaseSeeder extends Seeder
|
|||||||
ClassSubjectSeeder::class,
|
ClassSubjectSeeder::class,
|
||||||
ClassStudentSeeder::class,
|
ClassStudentSeeder::class,
|
||||||
HomeRoomTeacherSeeder::class,
|
HomeRoomTeacherSeeder::class,
|
||||||
|
SchoolInformationSeeder::class,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
35
database/seeders/SchoolInformationSeeder.php
Normal file
35
database/seeders/SchoolInformationSeeder.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\SchoolInformation;
|
||||||
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class SchoolInformationSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
SchoolInformation::updateOrCreate(
|
||||||
|
['id' => 1],
|
||||||
|
[
|
||||||
|
'school_name' => 'UPTD SDN Cinere 1',
|
||||||
|
'npsn' => null,
|
||||||
|
'nss' => null,
|
||||||
|
'address' => 'Jl. Cinere Raya No.18, Depok',
|
||||||
|
'postal_code' => 0,
|
||||||
|
'sub_district' => 'Cinere',
|
||||||
|
'district' => 'Cinere',
|
||||||
|
'city' => 'Depok',
|
||||||
|
'province' => 'Jawa Barat',
|
||||||
|
'email' => null,
|
||||||
|
'headmaster_name' => 'Drs. Nasim',
|
||||||
|
'headmaster_nip' => '196804191992031008',
|
||||||
|
'phase' => 'C',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
194
resources/views/filament/pages/report-preview.blade.php
Normal file
194
resources/views/filament/pages/report-preview.blade.php
Normal file
@ -0,0 +1,194 @@
|
|||||||
|
<x-filament-panels::page >
|
||||||
|
<div class="w-full flex gap-8">
|
||||||
|
{{-- Report Preview --}}
|
||||||
|
<div class="w-full" style="font-family: 'Times New Roman', Times, serif;">
|
||||||
|
<div class="text-center mb-6">
|
||||||
|
<h2 class="text-lg font-bold uppercase">Laporan Hasil Belajar</h2>
|
||||||
|
<h3 class="text-sm font-bold uppercase">(RAPOR)</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-4 text-sm mt-6">
|
||||||
|
<table class="w-full">
|
||||||
|
<tr>
|
||||||
|
<td>Nama Peserta Didik</td><td>: {{ $this->student->full_name ?? "-" }}</td>
|
||||||
|
<td>Kelas</td><td>: {{ $this->class_name ?? "-" }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>NISN/NIS</td><td>: {{ $this->student->nisn ?? '-' }} / {{ $this->student->nis ?? '-' }}</td>
|
||||||
|
<td>Fase</td><td>: -</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Sekolah</td><td>: {{ $this->school_information->school_name ?? "-" }}</td>
|
||||||
|
<td>Semester</td><td>: {{ $this->semester === 'first' ? 'I' : 'II' }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Alamat</td><td>:{{ $this->school_information->address ?? "-" }}</td>
|
||||||
|
<td>Tahun Ajaran</td><td>: {{ $this->academic_year->name ?? "-" }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-sm">
|
||||||
|
<table class="w-full border border-black text-sm">
|
||||||
|
|
||||||
|
<thead>
|
||||||
|
<tr class="">
|
||||||
|
<th class="border border-black w-8">No</th>
|
||||||
|
<th style="width: 185px" class="border border-black">Muatan Pelajaran</th>
|
||||||
|
<th class="border border-black w-16">Nilai Akhir</th>
|
||||||
|
<th class="border border-black">Capaian Kompetensi</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
@php
|
||||||
|
$i = 1;
|
||||||
|
@endphp
|
||||||
|
<tbody>
|
||||||
|
@if(!empty($this->table['subjects']['umum']))
|
||||||
|
@foreach($this->table['subjects']['umum'] as $subjectId => $subjectName)
|
||||||
|
<tr>
|
||||||
|
<td class="border border-black text-center">{{ $i }}</td>
|
||||||
|
<td class="border border-black">{{ $subjectName }}</td>
|
||||||
|
<td class="border border-black text-center">90</td>
|
||||||
|
<td class="border border-black">Ananda sangat memahami materi ajaran dan menunjukkan perilaku religius dalam keseharian.</td>
|
||||||
|
</tr>
|
||||||
|
@php
|
||||||
|
$i++;
|
||||||
|
@endphp
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
@if(!empty($this->table['subjects']['seni']))
|
||||||
|
<tr>
|
||||||
|
<td class="border border-black text-center">{{ $i }}</td>
|
||||||
|
<td class="border border-black" colspan="3">Seni</td>
|
||||||
|
</tr>
|
||||||
|
@foreach($this->table['subjects']['seni'] as $subjectId => $subjectName)
|
||||||
|
<tr>
|
||||||
|
<td class="border border-black text-center">a</td>
|
||||||
|
<td class="border border-black">{{ $subjectName }}</td>
|
||||||
|
<td class="border border-black text-center">90</td>
|
||||||
|
<td class="border border-black">Ananda sangat memahami materi ajaran dan menunjukkan perilaku religius dalam keseharian.</td>
|
||||||
|
</tr>
|
||||||
|
@php
|
||||||
|
$i++;
|
||||||
|
@endphp
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<h4 class="font-semibold mt-6 mb-2">Muatan Lokal</h4>
|
||||||
|
<table class="w-full border border-black text-sm">
|
||||||
|
|
||||||
|
<thead>
|
||||||
|
<tr class="">
|
||||||
|
<th class="border border-black w-8">No</th>
|
||||||
|
<th style="width: 185px" class="border border-black">Muatan Pelajaran</th>
|
||||||
|
<th class="border border-black w-16">Nilai Akhir</th>
|
||||||
|
<th class="border border-black">Capaian Kompetensi</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
@if(!empty($this->table['subjects']['muatan lokal']))
|
||||||
|
@foreach($this->table['subjects']['muatan lokal'] as $subjectId => $subjectName)
|
||||||
|
<tr>
|
||||||
|
<td class="border border-black text-center">{{ $i }}</td>
|
||||||
|
<td class="border border-black">{{ $subjectName }}</td>
|
||||||
|
<td class="border border-black text-center">90</td>
|
||||||
|
<td class="border border-black">Ananda sangat memahami materi ajaran dan menunjukkan perilaku religius dalam keseharian.</td>
|
||||||
|
</tr>
|
||||||
|
@php
|
||||||
|
$i++;
|
||||||
|
@endphp
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<table style="table-layout: fixed" class="w-full border border-black text-sm mb-6 mt-6">
|
||||||
|
<thead>
|
||||||
|
<tr class="">
|
||||||
|
<th class="border border-black w-8">No</th>
|
||||||
|
<th style="width: 185px" class="border border-black">Ektrakurikuler</th>
|
||||||
|
<th class="border border-black w-16">Predikat</th>
|
||||||
|
<th class="border border-black">Keterangan</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="border border-black">1</td>
|
||||||
|
<td class="border border-black">Pramuka</td>
|
||||||
|
<td class="border border-black text-center">A</td>
|
||||||
|
<td class="border border-black">Sangat Berkembang</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<table class="border text-sm mt-6">
|
||||||
|
<tr>
|
||||||
|
<td class="border text-center" colspan="2">Ketidakhadiran</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Sakit</td><td>: 2 hari</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Izin</td><td>: 1 hari</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Tanpa Keterangan</td><td>: 0 hari</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="flex justify-between text-sm mt-6">
|
||||||
|
<div class="text-center">
|
||||||
|
Orang Tua / Wali <br><br><br>
|
||||||
|
______________________
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
@php
|
||||||
|
\Carbon\Carbon::setLocale('id');
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
Depok, {{ \Carbon\Carbon::now()->translatedFormat('d F Y') }} <br>
|
||||||
|
Wali Kelas {{ $this->class_name ?? "-" }} <br><br><br>
|
||||||
|
<strong>Siti Mawarni, S.Pd</strong><br>
|
||||||
|
NIP. 197502021990121001
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-center mt-8 text-sm">
|
||||||
|
Mengetahui, <br>
|
||||||
|
Kepala Sekolah <br><br><br>
|
||||||
|
<strong>{{ $this->school_information->headmaster_name ?? "-" }}</strong><br>
|
||||||
|
NIP. {{ $this->school_information->headmaster_nip ?? "-" }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{-- Sidebar Config --}}
|
||||||
|
<div class="w-1/4 border-l pl-4">
|
||||||
|
<div class="space-y-4">
|
||||||
|
<div>
|
||||||
|
<h4 class="font-semibold mb-1">Input Absensi</h4>
|
||||||
|
<label class="block text-sm">Sakit:</label>
|
||||||
|
<input type="number" class="w-full rounded border-gray-300" placeholder="0">
|
||||||
|
|
||||||
|
<label class="block text-sm mt-2">Izin:</label>
|
||||||
|
<input type="number" class="w-full rounded border-gray-300" placeholder="0">
|
||||||
|
|
||||||
|
<label class="block text-sm mt-2">Tanpa Keterangan:</label>
|
||||||
|
<input type="number" class="w-full rounded border-gray-300" placeholder="0">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h4 class="font-semibold mb-1">Catatan Wali Kelas</h4>
|
||||||
|
<textarea class="w-full rounded border-gray-300" rows="4" placeholder="Tulis catatan di sini..."></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<x-filament::button class="w-full">Simpan</x-filament::button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</x-filament-panels::page>
|
||||||
14
resources/views/filament/pages/school-information.blade.php
Normal file
14
resources/views/filament/pages/school-information.blade.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<x-filament-panels::page>
|
||||||
|
<form wire:submit.prevent="save" class="">
|
||||||
|
{{ $this->form }}
|
||||||
|
|
||||||
|
<div class="flex mt-6">
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="inline-flex items-center px-4 py-2 bg-primary-600 text-white rounded-md hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500"
|
||||||
|
>
|
||||||
|
Save
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</x-filament-panels::page>
|
||||||
@ -1,4 +1,4 @@
|
|||||||
<x-filament-panels::page>
|
<x-filament-panels::page xmlns:x-filament="http://www.w3.org/1999/html">
|
||||||
{{ $this->form }}
|
{{ $this->form }}
|
||||||
|
|
||||||
@if(!empty($this->list))
|
@if(!empty($this->list))
|
||||||
@ -14,7 +14,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
@foreach(['umum', 'muatan lokal'] as $category)
|
@foreach(['umum','seni', 'muatan lokal'] as $category)
|
||||||
@if(!empty($this->list['header'][$category]))
|
@if(!empty($this->list['header'][$category]))
|
||||||
<th colspan="{{ count($this->list['header'][$category]) }}" class="fi-ta-header-cell px-4 py-3 text-center border-b border-gray-200 dark:border-gray-700">
|
<th colspan="{{ count($this->list['header'][$category]) }}" class="fi-ta-header-cell px-4 py-3 text-center border-b border-gray-200 dark:border-gray-700">
|
||||||
<span class="text-sm font-medium text-gray-900 dark:text-white">
|
<span class="text-sm font-medium text-gray-900 dark:text-white">
|
||||||
@ -23,11 +23,17 @@
|
|||||||
</th>
|
</th>
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
|
<th rowspan="2" class="fi-ta-header-cell text-center px-4 py-3 text-left border-b border-gray-200 dark:border-gray-700">
|
||||||
|
<span class="text-sm font-medium text-gray-900 dark:text-white">
|
||||||
|
Action
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<!-- Baris Mata Pelajaran -->
|
<!-- Baris Mata Pelajaran -->
|
||||||
<tr>
|
<tr>
|
||||||
@foreach(['umum', 'muatan lokal'] as $category)
|
@foreach(['umum', 'seni', 'muatan lokal'] as $category)
|
||||||
@if(!empty($this->list['header'][$category]))
|
@if(!empty($this->list['header'][$category]))
|
||||||
@foreach($this->list['header'][$category] as $subjectName)
|
@foreach($this->list['header'][$category] as $subjectName)
|
||||||
<th class="fi-ta-header-cell px-4 py-3 text-center border-b border-gray-200 dark:border-gray-700">
|
<th class="fi-ta-header-cell px-4 py-3 text-center border-b border-gray-200 dark:border-gray-700">
|
||||||
@ -51,8 +57,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- Nilai Mata Pelajaran -->
|
@foreach(['umum', 'seni','muatan lokal'] as $category)
|
||||||
@foreach(['umum', 'muatan lokal'] as $category)
|
|
||||||
@if(!empty($this->list['header'][$category]))
|
@if(!empty($this->list['header'][$category]))
|
||||||
@foreach($this->list['header'][$category] as $subjectId => $subjectName)
|
@foreach($this->list['header'][$category] as $subjectId => $subjectName)
|
||||||
<td class="fi-ta-cell px-4 py-3 text-center border-b border-gray-200 dark:border-gray-700">
|
<td class="fi-ta-cell px-4 py-3 text-center border-b border-gray-200 dark:border-gray-700">
|
||||||
@ -63,6 +68,20 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
|
<td class="fi-ta-cell w-full flex justify-center px-4 py-3 border-b border-gray-200 dark:border-gray-700">
|
||||||
|
<x-filament::button
|
||||||
|
tag="a"
|
||||||
|
target="_blank"
|
||||||
|
href="{{ route('filament.admin.pages.report-preview', [
|
||||||
|
'studentId' => $student['id'],
|
||||||
|
'classId' => $this->class_id,
|
||||||
|
'yearId' => $this->academic_year,
|
||||||
|
'semester' => $this->semester
|
||||||
|
]) }}"
|
||||||
|
>
|
||||||
|
Raport
|
||||||
|
</x-filament::button>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user