diff --git a/app/Filament/Resources/MsPasienResource.php b/app/Filament/Resources/MsPasienResource.php new file mode 100644 index 0000000..9466a86 --- /dev/null +++ b/app/Filament/Resources/MsPasienResource.php @@ -0,0 +1,100 @@ +schema([ + Forms\Components\TextInput::make('nik') + ->placeholder('Egs: 1234567890') + ->required() + ->unique() + ->maxLength(10), + Forms\Components\TextInput::make('nama') + ->required() + ->maxLength(255), + Forms\Components\Select::make('jenis_kelamin') + ->required() + ->options([ + 'L' => 'Laki-Laki', + 'P' => 'Perempuan', + ]), + Forms\Components\TextInput::make('no_hp') + ->maxLength(15), + Forms\Components\Textarea::make('alamat') + ->maxLength(255), + Forms\Components\TextInput::make('email') + ->required() + ->maxLength(255), + Forms\Components\DatePicker::make('tgl_lahir') + ]); + } + + public static function table(Table $table): Table + { + return $table + ->defaultSort('created_at', 'desc') + ->searchable() + ->columns([ + TextColumn::make('nik')->label('NIK')->default('-'), + TextColumn::make('nama')->label('Nama Pasien'), + TextColumn::make('jenis_kelamin')->label('Jenis Kelamin'), + TextColumn::make('created_at')->label('Tanggal Dibuat'), + TextColumn::make('updated_at')->label('Tanggal Diubah'), + ]) + ->filters([ + // + ]) + ->actions([ + Tables\Actions\EditAction::make(), + Tables\Actions\DeleteAction::make(), + Tables\Actions\ViewAction::make(), + ]) + ->bulkActions([ + Tables\Actions\BulkActionGroup::make([ + Tables\Actions\DeleteBulkAction::make(), + ]), + ]); + } + + public static function getRelations(): array + { + return [ + // + ]; + } + + public static function getPages(): array + { + return [ + 'index' => Pages\ListMsPasiens::route('/'), + 'create' => Pages\CreateMsPasien::route('/create'), + 'edit' => Pages\EditMsPasien::route('/{record}/edit'), + 'view' => Pages\ViewMsPasien::route('/{record}'), + ]; + } +} diff --git a/app/Filament/Resources/MsPasienResource/Pages/CreateMsPasien.php b/app/Filament/Resources/MsPasienResource/Pages/CreateMsPasien.php new file mode 100644 index 0000000..1ff2c02 --- /dev/null +++ b/app/Filament/Resources/MsPasienResource/Pages/CreateMsPasien.php @@ -0,0 +1,12 @@ +label('Tambah Pasien'), + ]; + } +} diff --git a/app/Filament/Resources/MsPasienResource/Pages/ViewMsPasien.php b/app/Filament/Resources/MsPasienResource/Pages/ViewMsPasien.php new file mode 100644 index 0000000..c35eb0f --- /dev/null +++ b/app/Filament/Resources/MsPasienResource/Pages/ViewMsPasien.php @@ -0,0 +1,20 @@ +label('Edit Pasien'), + Actions\DeleteAction::make()->label('Hapus Pasien'), + ]; + } +}