-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from bcgov/update-readme
Update readme
- Loading branch information
Showing
31 changed files
with
866 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
<?php | ||
|
||
namespace App\Filament\Fodig\Resources; | ||
|
||
use App\Filament\Fodig\Resources\SystemMessageResource\Pages; | ||
use App\Filament\Fodig\Resources\SystemMessageResource\RelationManagers; | ||
use App\Models\SystemMessage; | ||
use Filament\Forms; | ||
use Filament\Forms\Components\Select; | ||
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 SystemMessageResource extends Resource | ||
{ | ||
protected static ?string $model = SystemMessage::class; | ||
|
||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; | ||
|
||
protected static ?string $navigationGroup = 'System Messages'; | ||
|
||
public static function form(Form $form): Form | ||
{ | ||
return $form | ||
->schema([ | ||
Forms\Components\Textarea::make('error_code') | ||
->required() | ||
->columnSpanFull(), | ||
Forms\Components\Textarea::make('error_message') | ||
->required() | ||
->columnSpanFull(), | ||
Forms\Components\Textarea::make('icm_error_solution') | ||
->label('ICM error solution') | ||
->columnSpanFull(), | ||
Forms\Components\Textarea::make('explanation') | ||
->columnSpanFull(), | ||
Forms\Components\Textarea::make('fix') | ||
->columnSpanFull(), | ||
Select::make('error_entity_id') | ||
->relationship('errorEntity', 'name'), | ||
Select::make('error_data_group_id') | ||
->relationship('errorDataGroup', 'name'), | ||
Select::make('error_integration_state_id') | ||
->relationship('errorIntegrationState', 'name'), | ||
Select::make('error_actor_id') | ||
->relationship('errorActor', 'name'), | ||
Select::make('error_source_id') | ||
->relationship('errorSource', 'name'), | ||
Forms\Components\Toggle::make('service_desk'), | ||
Forms\Components\Toggle::make('limited_data'), | ||
]); | ||
} | ||
|
||
public static function table(Table $table): Table | ||
{ | ||
return $table | ||
->columns([ | ||
Tables\Columns\TextColumn::make('error_code') | ||
->searchable(), | ||
Tables\Columns\TextColumn::make('errorEntity.name') | ||
->label('Error Entity') | ||
->sortable() | ||
->searchable(), | ||
Tables\Columns\TextColumn::make('errorDataGroup.name') | ||
->label('Error Data Group') | ||
->sortable() | ||
->searchable(), | ||
Tables\Columns\TextColumn::make('errorIntegrationState.name') | ||
->label('Error Integration State') | ||
->sortable() | ||
->searchable(), | ||
Tables\Columns\TextColumn::make('errorActor.name') | ||
->label('Error Actor') | ||
->sortable() | ||
->searchable(), | ||
Tables\Columns\TextColumn::make('errorSource.name') | ||
->label('Error Source') | ||
->sortable() | ||
->searchable(), | ||
Tables\Columns\IconColumn::make('service_desk') | ||
->boolean(), | ||
Tables\Columns\IconColumn::make('limited_data') | ||
->boolean(), | ||
]) | ||
->filters([ | ||
Tables\Filters\SelectFilter::make('error_entity_id') | ||
->label('Error Entity') | ||
->relationship('errorEntity', 'name'), | ||
Tables\Filters\SelectFilter::make('error_data_group_id') | ||
->label('Error Data Group') | ||
->relationship('errorDataGroup', 'name'), | ||
Tables\Filters\SelectFilter::make('error_integration_state_id') | ||
->label('Error Integration State') | ||
->relationship('errorIntegrationState', 'name'), | ||
Tables\Filters\SelectFilter::make('error_actor_id') | ||
->label('Error Actor') | ||
->relationship('errorActor', 'name'), | ||
Tables\Filters\SelectFilter::make('error_source_id') | ||
->label('Error Source') | ||
->relationship('errorSource', 'name'), | ||
Tables\Filters\TernaryFilter::make('service_desk') | ||
->label('Service Desk'), | ||
Tables\Filters\TernaryFilter::make('limited_data') | ||
->label('Limited Data'), | ||
]) | ||
->actions([ | ||
Tables\Actions\ViewAction::make(), | ||
Tables\Actions\EditAction::make(), | ||
]) | ||
->bulkActions([ | ||
// | ||
]) | ||
->paginated([ | ||
10, | ||
25, | ||
50, | ||
100, | ||
]);; | ||
} | ||
|
||
public static function getRelations(): array | ||
{ | ||
return [ | ||
// | ||
]; | ||
} | ||
|
||
public static function getPages(): array | ||
{ | ||
return [ | ||
'index' => Pages\ListSystemMessages::route('/'), | ||
'create' => Pages\CreateSystemMessage::route('/create'), | ||
'view' => Pages\ViewSystemMessage::route('/{record}'), | ||
'edit' => Pages\EditSystemMessage::route('/{record}/edit'), | ||
]; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
app/Filament/Fodig/Resources/SystemMessageResource/Pages/CreateSystemMessage.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace App\Filament\Fodig\Resources\SystemMessageResource\Pages; | ||
|
||
use App\Filament\Fodig\Resources\SystemMessageResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\CreateRecord; | ||
|
||
class CreateSystemMessage extends CreateRecord | ||
{ | ||
protected static string $resource = SystemMessageResource::class; | ||
} |
20 changes: 20 additions & 0 deletions
20
app/Filament/Fodig/Resources/SystemMessageResource/Pages/EditSystemMessage.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace App\Filament\Fodig\Resources\SystemMessageResource\Pages; | ||
|
||
use App\Filament\Fodig\Resources\SystemMessageResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\EditRecord; | ||
|
||
class EditSystemMessage extends EditRecord | ||
{ | ||
protected static string $resource = SystemMessageResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\ViewAction::make(), | ||
Actions\DeleteAction::make(), | ||
]; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/Filament/Fodig/Resources/SystemMessageResource/Pages/ListSystemMessages.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace App\Filament\Fodig\Resources\SystemMessageResource\Pages; | ||
|
||
use App\Filament\Fodig\Resources\SystemMessageResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\ListRecords; | ||
|
||
class ListSystemMessages extends ListRecords | ||
{ | ||
protected static string $resource = SystemMessageResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\CreateAction::make(), | ||
]; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/Filament/Fodig/Resources/SystemMessageResource/Pages/ViewSystemMessage.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace App\Filament\Fodig\Resources\SystemMessageResource\Pages; | ||
|
||
use App\Filament\Fodig\Resources\SystemMessageResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\ViewRecord; | ||
|
||
class ViewSystemMessage extends ViewRecord | ||
{ | ||
protected static string $resource = SystemMessageResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\EditAction::make(), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace App\Filament\Imports; | ||
|
||
use App\Models\SelectOptions; | ||
use Filament\Actions\Imports\ImportColumn; | ||
use Filament\Actions\Imports\Importer; | ||
use Filament\Actions\Imports\Models\Import; | ||
use Illuminate\Support\Str; | ||
|
||
class SelectOptionsImporter extends Importer | ||
{ | ||
protected static ?string $model = SelectOptions::class; | ||
|
||
public static function getColumns(): array | ||
{ | ||
return [ | ||
ImportColumn::make('name') | ||
->requiredMapping() | ||
->rules(['required']) | ||
->example('eye_color_brown'), | ||
ImportColumn::make('label') | ||
->example('Brown'), | ||
ImportColumn::make('value') | ||
->example('1'), | ||
ImportColumn::make('description') | ||
->example('This option is used for...'), | ||
]; | ||
} | ||
|
||
public function resolveRecord(): ?SelectOptions | ||
{ | ||
return SelectOptions::firstOrNew([ | ||
// Update existing records, matching them by `$this->data['column_name']` | ||
'name' => $this->data['name'], | ||
]); | ||
|
||
return new SelectOptions(); | ||
} | ||
|
||
public static function getCompletedNotificationBody(Import $import): string | ||
{ | ||
$body = 'Your select options import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.'; | ||
|
||
if ($failedRowsCount = $import->getFailedRowsCount()) { | ||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.'; | ||
} | ||
|
||
return $body; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.