Skip to content

Commit

Permalink
Merge pull request #20 from achmadhadikurnia/main
Browse files Browse the repository at this point in the history
Feature: Add filament resource
  • Loading branch information
achmadhadikurnia authored Feb 19, 2024
2 parents a941c0b + 8baf1ae commit e040948
Show file tree
Hide file tree
Showing 49 changed files with 3,318 additions and 1 deletion.
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
],
"require": {
"php": "^8.1",
"filament/filament": "^3.2",
"guzzlehttp/guzzle": "^7.2",
"illuminate/contracts": "^10.0",
"kanekescom/laravel-helperia": "^2.0",
Expand Down Expand Up @@ -84,7 +85,8 @@
"extra": {
"laravel": {
"providers": [
"Kanekescom\\Siasn\\Referensi\\ReferensiServiceProvider"
"Kanekescom\\Siasn\\Referensi\\ReferensiServiceProvider",
"Kanekescom\\Siasn\\Referensi\\SiasnReferensiPanelProvider"
],
"aliases": {
"Referensi": "Kanekescom\\Siasn\\Referensi\\Facades\\Referensi"
Expand Down
5 changes: 5 additions & 0 deletions config/siasn-referensi.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,9 @@

'delete_model_before_pull' => true,

'filament' => [
'id' => 'siasn-referensi',
'path' => 'siasn/referensi',
],

];
83 changes: 83 additions & 0 deletions src/Filament/Resources/AgamaResource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php

namespace Kanekescom\Siasn\Referensi\Filament\Resources;

use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Kanekescom\Siasn\Referensi\Filament\Resources\AgamaResource\Pages;
use Kanekescom\Siasn\Referensi\Models\Agama;

class AgamaResource extends Resource
{
protected static ?string $model = Agama::class;

protected static ?string $slug = 'agama';

protected static ?string $pluralLabel = 'Agama';

protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';

protected static ?string $navigationLabel = 'Agama';

protected static ?string $navigationGroup = 'SIASN REFERENSI';

protected static bool $shouldRegisterNavigation = true;

public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('id')
->maxLength(255)
->label('ID'),
Forms\Components\TextInput::make('nama')
->maxLength(255),
]);
}

public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('id')
->toggleable(isToggledHiddenByDefault: true)
->searchable()
->label('ID'),
Tables\Columns\TextColumn::make('nama')
->grow()
->wrap()
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('created_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('deleted_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
//
])
->actions([
Tables\Actions\ActionGroup::make([
Tables\Actions\ViewAction::make(),
]),
]);
}

public static function getPages(): array
{
return [
'index' => Pages\ManageAgamas::route('/'),
];
}
}
22 changes: 22 additions & 0 deletions src/Filament/Resources/AgamaResource/Pages/ManageAgamas.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Kanekescom\Siasn\Referensi\Filament\Resources\AgamaResource\Pages;

use Filament\Actions;
use Filament\Resources\Pages\ManageRecords;
use Illuminate\Support\Facades\Artisan;
use Kanekescom\Siasn\Referensi\Filament\Resources\AgamaResource;

class ManageAgamas extends ManageRecords
{
protected static string $resource = AgamaResource::class;

protected function getHeaderActions(): array
{
return [
Actions\Action::make('sync')
->requiresConfirmation()
->action(fn () => Artisan::call('siasn-referensi:pull agama')),
];
}
}
90 changes: 90 additions & 0 deletions src/Filament/Resources/AlasanHukumanDisiplinResource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?php

namespace Kanekescom\Siasn\Referensi\Filament\Resources;

use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Kanekescom\Siasn\Referensi\Filament\Resources\AlasanHukumanDisiplinResource\Pages;
use Kanekescom\Siasn\Referensi\Models\AlasanHukumanDisiplin;

class AlasanHukumanDisiplinResource extends Resource
{
protected static ?string $model = AlasanHukumanDisiplin::class;

protected static ?string $slug = 'alasan-hukuman-disiplin';

protected static ?string $pluralLabel = 'Alasan Hukuman Disiplin';

protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';

protected static ?string $navigationLabel = 'Alasan Hukuman Disiplin';

protected static ?string $navigationGroup = 'SIASN REFERENSI';

protected static bool $shouldRegisterNavigation = true;

public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('id')
->maxLength(255)
->label('ID'),
Forms\Components\Textarea::make('nama')
->maxLength(65535)
->columnSpanFull(),
Forms\Components\TextInput::make('keterangan')
->maxLength(255),
]);
}

public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('id')
->toggleable(isToggledHiddenByDefault: true)
->searchable()
->label('ID'),
Tables\Columns\TextColumn::make('nama')
->grow()
->wrap()
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('keterangan')
->wrap()
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('created_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('deleted_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
//
])
->actions([
Tables\Actions\ActionGroup::make([
Tables\Actions\ViewAction::make(),
]),
]);
}

public static function getPages(): array
{
return [
'index' => Pages\ManageAlasanHukumanDisiplins::route('/'),
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Kanekescom\Siasn\Referensi\Filament\Resources\AlasanHukumanDisiplinResource\Pages;

use Filament\Actions;
use Filament\Resources\Pages\ManageRecords;
use Illuminate\Support\Facades\Artisan;
use Kanekescom\Siasn\Referensi\Filament\Resources\AlasanHukumanDisiplinResource;

class ManageAlasanHukumanDisiplins extends ManageRecords
{
protected static string $resource = AlasanHukumanDisiplinResource::class;

protected function getHeaderActions(): array
{
return [
Actions\Action::make('sync')
->requiresConfirmation()
->action(fn () => Artisan::call('siasn-referensi:pull alasan-hukuman-disiplin')),
];
}
}
83 changes: 83 additions & 0 deletions src/Filament/Resources/AsnJenisJabatanResource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php

namespace Kanekescom\Siasn\Referensi\Filament\Resources;

use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Kanekescom\Siasn\Referensi\Filament\Resources\AsnJenisJabatanResource\Pages;
use Kanekescom\Siasn\Referensi\Models\AsnJenisJabatan;

class AsnJenisJabatanResource extends Resource
{
protected static ?string $model = AsnJenisJabatan::class;

protected static ?string $slug = 'asn-jenis-jabatan';

protected static ?string $pluralLabel = 'ASN Jenis Jabatan';

protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';

protected static ?string $navigationLabel = 'ASN Jenis Jabatan';

protected static ?string $navigationGroup = 'SIASN REFERENSI';

protected static bool $shouldRegisterNavigation = true;

public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('id')
->maxLength(255)
->label('ID'),
Forms\Components\TextInput::make('nama')
->maxLength(255),
]);
}

public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('id')
->toggleable(isToggledHiddenByDefault: true)
->searchable()
->label('ID'),
Tables\Columns\TextColumn::make('nama')
->grow()
->wrap()
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('created_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('deleted_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
//
])
->actions([
Tables\Actions\ActionGroup::make([
Tables\Actions\ViewAction::make(),
]),
]);
}

public static function getPages(): array
{
return [
'index' => Pages\ManageAsnJenisJabatans::route('/'),
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Kanekescom\Siasn\Referensi\Filament\Resources\AsnJenisJabatanResource\Pages;

use Filament\Actions;
use Filament\Resources\Pages\ManageRecords;
use Illuminate\Support\Facades\Artisan;
use Kanekescom\Siasn\Referensi\Filament\Resources\AsnJenisJabatanResource;

class ManageAsnJenisJabatans extends ManageRecords
{
protected static string $resource = AsnJenisJabatanResource::class;

protected function getHeaderActions(): array
{
return [
Actions\Action::make('sync')
->requiresConfirmation()
->action(fn () => Artisan::call('siasn-referensi:pull asn-jenis-jabatan')),
];
}
}
Loading

0 comments on commit e040948

Please sign in to comment.