feat(Admin Panel & Charts)
This commit is contained in:
@@ -18,6 +18,8 @@ class MemberGroupResource extends Resource
|
||||
{
|
||||
protected static ?string $model = MemberGroup::class;
|
||||
|
||||
protected static string|null|\UnitEnum $navigationGroup = 'Administration';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedGlobeEuropeAfrica;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
|
||||
@@ -18,6 +18,8 @@ class MemberResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Member::class;
|
||||
|
||||
protected static string|null|\UnitEnum $navigationGroup = 'Administration';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedUserGroup;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
@@ -55,4 +57,5 @@ class MemberResource extends Resource
|
||||
{
|
||||
return Member::getAttributeLabel('members');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
22
app/Filament/Resources/Members/Widgets/MemberCount.php
Normal file
22
app/Filament/Resources/Members/Widgets/MemberCount.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Members\Widgets;
|
||||
|
||||
use App\Models\Member;
|
||||
use Filament\Support\Enums\IconPosition;
|
||||
use Filament\Widgets\StatsOverviewWidget;
|
||||
use Filament\Widgets\StatsOverviewWidget\Stat;
|
||||
|
||||
class MemberCount extends StatsOverviewWidget
|
||||
{
|
||||
protected function getStats(): array
|
||||
{
|
||||
return [
|
||||
Stat::make(Member::getAttributeLabel('widgets.stats.name'), Member::count())
|
||||
->description(Member::getAttributeLabel('widgets.stats.description'))
|
||||
->descriptionIcon('heroicon-o-user-group', IconPosition::Before)
|
||||
->chart([7, 2, 10, 3, 15, 4, 17])
|
||||
->color('primary')
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,8 @@ class MembershipResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Membership::class;
|
||||
|
||||
protected static string|null|\UnitEnum $navigationGroup = 'Administration';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedIdentification;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Memberships\Widgets;
|
||||
|
||||
use App\Models\Membership;
|
||||
use Filament\Widgets\ChartWidget;
|
||||
|
||||
class MembershipsChart extends ChartWidget
|
||||
{
|
||||
protected ?string $heading = 'Adhésions';
|
||||
|
||||
protected function getData(): array
|
||||
{
|
||||
$memberships = Membership::query()
|
||||
->selectRaw('status, count(*) as total')
|
||||
->groupBy('status')
|
||||
->get();
|
||||
|
||||
return [
|
||||
'datasets' => [
|
||||
[
|
||||
'data' => $memberships->pluck('total')->toArray(),
|
||||
'backgroundColor' => [
|
||||
'rgb(54, 162, 235)',
|
||||
'rgb(255, 99, 132)',
|
||||
'rgb(255, 205, 86)',
|
||||
],
|
||||
],
|
||||
],
|
||||
'labels' => $memberships->pluck('status')->toArray(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getType(): string
|
||||
{
|
||||
return 'doughnut';
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,8 @@ class PackageResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Package::class;
|
||||
|
||||
protected static string|null|\UnitEnum $navigationGroup = 'Modules';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedShoppingCart;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
|
||||
@@ -18,6 +18,8 @@ class ServiceResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Service::class;
|
||||
|
||||
protected static string|null|\UnitEnum $navigationGroup = 'Modules';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedPuzzlePiece;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
|
||||
11
app/Filament/Resources/Users/Pages/CreateUser.php
Normal file
11
app/Filament/Resources/Users/Pages/CreateUser.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Users\Pages;
|
||||
|
||||
use App\Filament\Resources\Users\UserResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateUser extends CreateRecord
|
||||
{
|
||||
protected static string $resource = UserResource::class;
|
||||
}
|
||||
19
app/Filament/Resources/Users/Pages/EditUser.php
Normal file
19
app/Filament/Resources/Users/Pages/EditUser.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Users\Pages;
|
||||
|
||||
use App\Filament\Resources\Users\UserResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditUser extends EditRecord
|
||||
{
|
||||
protected static string $resource = UserResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Resources/Users/Pages/ListUsers.php
Normal file
19
app/Filament/Resources/Users/Pages/ListUsers.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Users\Pages;
|
||||
|
||||
use App\Filament\Resources\Users\UserResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListUsers extends ListRecords
|
||||
{
|
||||
protected static string $resource = UserResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
27
app/Filament/Resources/Users/Schemas/UserForm.php
Normal file
27
app/Filament/Resources/Users/Schemas/UserForm.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Users\Schemas;
|
||||
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class UserForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
TextInput::make('email')
|
||||
->label('Email address')
|
||||
->email()
|
||||
->required(),
|
||||
DateTimePicker::make('email_verified_at'),
|
||||
TextInput::make('password')
|
||||
->password()
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
46
app/Filament/Resources/Users/Tables/UsersTable.php
Normal file
46
app/Filament/Resources/Users/Tables/UsersTable.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Users\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class UsersTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->searchable(),
|
||||
TextColumn::make('email')
|
||||
->label('Email address')
|
||||
->searchable(),
|
||||
TextColumn::make('email_verified_at')
|
||||
->dateTime()
|
||||
->sortable(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
49
app/Filament/Resources/Users/UserResource.php
Normal file
49
app/Filament/Resources/Users/UserResource.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Users;
|
||||
|
||||
use App\Filament\Resources\Users\Pages\CreateUser;
|
||||
use App\Filament\Resources\Users\Pages\EditUser;
|
||||
use App\Filament\Resources\Users\Pages\ListUsers;
|
||||
use App\Filament\Resources\Users\Schemas\UserForm;
|
||||
use App\Filament\Resources\Users\Tables\UsersTable;
|
||||
use App\Models\User;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class UserResource extends Resource
|
||||
{
|
||||
protected static ?string $model = User::class;
|
||||
|
||||
protected static string|null|\UnitEnum $navigationGroup = 'Paramètres';
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return UserForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return UsersTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListUsers::route('/'),
|
||||
'create' => CreateUser::route('/create'),
|
||||
'edit' => EditUser::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,18 @@ class User extends Authenticatable
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public static function getAttributeLabel(string $attribute): string
|
||||
{
|
||||
return __("users.fields.' . $attribute");
|
||||
}
|
||||
|
||||
/*public static function getRoleLabel(string $role): string
|
||||
{
|
||||
return __("roles.fields.' . $role");
|
||||
}*/
|
||||
|
||||
|
||||
public function members(): hasMany
|
||||
{
|
||||
return $this->hasMany(Member::class);
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
namespace App\Providers\Filament;
|
||||
|
||||
use Andreia\FilamentNordTheme\FilamentNordThemePlugin;
|
||||
use App\Filament\Resources\Members\Widgets\MemberCount;
|
||||
use App\Filament\Resources\Memberships\Widgets\MembershipsChart;
|
||||
use Filament\Http\Middleware\Authenticate;
|
||||
use Filament\Http\Middleware\AuthenticateSession;
|
||||
use Filament\Http\Middleware\DisableBladeIconComponents;
|
||||
@@ -42,6 +44,8 @@ class AdminPanelProvider extends PanelProvider
|
||||
->widgets([
|
||||
AccountWidget::class,
|
||||
FilamentInfoWidget::class,
|
||||
MemberCount::class,
|
||||
//MembershipsChart::class,
|
||||
])
|
||||
->middleware([
|
||||
EncryptCookies::class,
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
|
||||
return [
|
||||
'fields' => [
|
||||
'user' => 'Utilisateur',
|
||||
'users' => 'Utilisateurs',
|
||||
'name' => 'Nom',
|
||||
'user' => 'User',
|
||||
'users' => 'Users',
|
||||
'name' => 'Name',
|
||||
'email' => 'Email',
|
||||
'email_verified_at' => 'Email vérifié le',
|
||||
'password' => '',
|
||||
'password_confirmation' => '',
|
||||
'role' => 'Rôle'
|
||||
'email_verified_at' => 'Email verified at',
|
||||
'password' => 'Password',
|
||||
'role' => 'Role'
|
||||
]
|
||||
];
|
||||
|
||||
@@ -32,5 +32,11 @@ return [
|
||||
'created_at' => 'Créé le',
|
||||
'updated_at' => 'Mis à jour le',
|
||||
'deleted_at' => 'Supprimé le',
|
||||
'widgets' => [
|
||||
'stats' => [
|
||||
'name' => 'Nouveaux Membres',
|
||||
'description' => 'Nombre de nouveaux membres par jour',
|
||||
]
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
@@ -1 +1,13 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'fields' => [
|
||||
'user' => 'Utilisateur',
|
||||
'users' => 'Utilisateurs',
|
||||
'name' => 'Nom',
|
||||
'email' => 'Email',
|
||||
'email_verified_at' => 'Email vérifié le',
|
||||
'password' => 'Mot de passe',
|
||||
'role' => 'Rôle'
|
||||
]
|
||||
];
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition } from './../../../../../../wayfinder'
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\CreateService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/CreateService.php:7
|
||||
* @route '/admin/services/create'
|
||||
*/
|
||||
const CreateService = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
url: CreateService.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
CreateService.definition = {
|
||||
methods: ["get","head"],
|
||||
url: '/admin/services/create',
|
||||
} satisfies RouteDefinition<["get","head"]>
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\CreateService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/CreateService.php:7
|
||||
* @route '/admin/services/create'
|
||||
*/
|
||||
CreateService.url = (options?: RouteQueryOptions) => {
|
||||
return CreateService.definition.url + queryParams(options)
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\CreateService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/CreateService.php:7
|
||||
* @route '/admin/services/create'
|
||||
*/
|
||||
CreateService.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
url: CreateService.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\CreateService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/CreateService.php:7
|
||||
* @route '/admin/services/create'
|
||||
*/
|
||||
CreateService.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
|
||||
url: CreateService.url(options),
|
||||
method: 'head',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\CreateService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/CreateService.php:7
|
||||
* @route '/admin/services/create'
|
||||
*/
|
||||
const CreateServiceForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: CreateService.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\CreateService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/CreateService.php:7
|
||||
* @route '/admin/services/create'
|
||||
*/
|
||||
CreateServiceForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: CreateService.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\CreateService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/CreateService.php:7
|
||||
* @route '/admin/services/create'
|
||||
*/
|
||||
CreateServiceForm.head = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: CreateService.url({
|
||||
[options?.mergeQuery ? 'mergeQuery' : 'query']: {
|
||||
_method: 'HEAD',
|
||||
...(options?.query ?? options?.mergeQuery ?? {}),
|
||||
}
|
||||
}),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
CreateService.form = CreateServiceForm
|
||||
|
||||
export default CreateService
|
||||
@@ -0,0 +1,101 @@
|
||||
import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition, applyUrlDefaults } from './../../../../../../wayfinder'
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\EditService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/EditService.php:7
|
||||
* @route '/admin/services/{record}/edit'
|
||||
*/
|
||||
const EditService = (args: { record: string | number } | [record: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
url: EditService.url(args, options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
EditService.definition = {
|
||||
methods: ["get","head"],
|
||||
url: '/admin/services/{record}/edit',
|
||||
} satisfies RouteDefinition<["get","head"]>
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\EditService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/EditService.php:7
|
||||
* @route '/admin/services/{record}/edit'
|
||||
*/
|
||||
EditService.url = (args: { record: string | number } | [record: string | number ] | string | number, options?: RouteQueryOptions) => {
|
||||
if (typeof args === 'string' || typeof args === 'number') {
|
||||
args = { record: args }
|
||||
}
|
||||
|
||||
if (Array.isArray(args)) {
|
||||
args = {
|
||||
record: args[0],
|
||||
}
|
||||
}
|
||||
|
||||
args = applyUrlDefaults(args)
|
||||
|
||||
const parsedArgs = {
|
||||
record: args.record,
|
||||
}
|
||||
|
||||
return EditService.definition.url
|
||||
.replace('{record}', parsedArgs.record.toString())
|
||||
.replace(/\/+$/, '') + queryParams(options)
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\EditService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/EditService.php:7
|
||||
* @route '/admin/services/{record}/edit'
|
||||
*/
|
||||
EditService.get = (args: { record: string | number } | [record: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
url: EditService.url(args, options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\EditService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/EditService.php:7
|
||||
* @route '/admin/services/{record}/edit'
|
||||
*/
|
||||
EditService.head = (args: { record: string | number } | [record: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
|
||||
url: EditService.url(args, options),
|
||||
method: 'head',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\EditService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/EditService.php:7
|
||||
* @route '/admin/services/{record}/edit'
|
||||
*/
|
||||
const EditServiceForm = (args: { record: string | number } | [record: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: EditService.url(args, options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\EditService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/EditService.php:7
|
||||
* @route '/admin/services/{record}/edit'
|
||||
*/
|
||||
EditServiceForm.get = (args: { record: string | number } | [record: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: EditService.url(args, options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\EditService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/EditService.php:7
|
||||
* @route '/admin/services/{record}/edit'
|
||||
*/
|
||||
EditServiceForm.head = (args: { record: string | number } | [record: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: EditService.url(args, {
|
||||
[options?.mergeQuery ? 'mergeQuery' : 'query']: {
|
||||
_method: 'HEAD',
|
||||
...(options?.query ?? options?.mergeQuery ?? {}),
|
||||
}
|
||||
}),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
EditService.form = EditServiceForm
|
||||
|
||||
export default EditService
|
||||
@@ -0,0 +1,83 @@
|
||||
import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition } from './../../../../../../wayfinder'
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\ListServices::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/ListServices.php:7
|
||||
* @route '/admin/services'
|
||||
*/
|
||||
const ListServices = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
url: ListServices.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
ListServices.definition = {
|
||||
methods: ["get","head"],
|
||||
url: '/admin/services',
|
||||
} satisfies RouteDefinition<["get","head"]>
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\ListServices::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/ListServices.php:7
|
||||
* @route '/admin/services'
|
||||
*/
|
||||
ListServices.url = (options?: RouteQueryOptions) => {
|
||||
return ListServices.definition.url + queryParams(options)
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\ListServices::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/ListServices.php:7
|
||||
* @route '/admin/services'
|
||||
*/
|
||||
ListServices.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
url: ListServices.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\ListServices::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/ListServices.php:7
|
||||
* @route '/admin/services'
|
||||
*/
|
||||
ListServices.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
|
||||
url: ListServices.url(options),
|
||||
method: 'head',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\ListServices::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/ListServices.php:7
|
||||
* @route '/admin/services'
|
||||
*/
|
||||
const ListServicesForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: ListServices.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\ListServices::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/ListServices.php:7
|
||||
* @route '/admin/services'
|
||||
*/
|
||||
ListServicesForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: ListServices.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\ListServices::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/ListServices.php:7
|
||||
* @route '/admin/services'
|
||||
*/
|
||||
ListServicesForm.head = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: ListServices.url({
|
||||
[options?.mergeQuery ? 'mergeQuery' : 'query']: {
|
||||
_method: 'HEAD',
|
||||
...(options?.query ?? options?.mergeQuery ?? {}),
|
||||
}
|
||||
}),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
ListServices.form = ListServicesForm
|
||||
|
||||
export default ListServices
|
||||
@@ -0,0 +1,11 @@
|
||||
import ListServices from './ListServices'
|
||||
import CreateService from './CreateService'
|
||||
import EditService from './EditService'
|
||||
|
||||
const Pages = {
|
||||
ListServices: Object.assign(ListServices, ListServices),
|
||||
CreateService: Object.assign(CreateService, CreateService),
|
||||
EditService: Object.assign(EditService, EditService),
|
||||
}
|
||||
|
||||
export default Pages
|
||||
@@ -0,0 +1,7 @@
|
||||
import Pages from './Pages'
|
||||
|
||||
const Services = {
|
||||
Pages: Object.assign(Pages, Pages),
|
||||
}
|
||||
|
||||
export default Services
|
||||
@@ -2,12 +2,14 @@ import MemberGroups from './MemberGroups'
|
||||
import Members from './Members'
|
||||
import Memberships from './Memberships'
|
||||
import Packages from './Packages'
|
||||
import Services from './Services'
|
||||
|
||||
const Resources = {
|
||||
MemberGroups: Object.assign(MemberGroups, MemberGroups),
|
||||
Members: Object.assign(Members, Members),
|
||||
Memberships: Object.assign(Memberships, Memberships),
|
||||
Packages: Object.assign(Packages, Packages),
|
||||
Services: Object.assign(Services, Services),
|
||||
}
|
||||
|
||||
export default Resources
|
||||
@@ -2,12 +2,14 @@ import memberGroups from './member-groups'
|
||||
import members from './members'
|
||||
import memberships from './memberships'
|
||||
import packages from './packages'
|
||||
import services from './services'
|
||||
|
||||
const resources = {
|
||||
memberGroups: Object.assign(memberGroups, memberGroups),
|
||||
members: Object.assign(members, members),
|
||||
memberships: Object.assign(memberships, memberships),
|
||||
packages: Object.assign(packages, packages),
|
||||
services: Object.assign(services, services),
|
||||
}
|
||||
|
||||
export default resources
|
||||
269
resources/js/routes/filament/admin/resources/services/index.ts
Normal file
269
resources/js/routes/filament/admin/resources/services/index.ts
Normal file
@@ -0,0 +1,269 @@
|
||||
import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition, applyUrlDefaults } from './../../../../../wayfinder'
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\ListServices::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/ListServices.php:7
|
||||
* @route '/admin/services'
|
||||
*/
|
||||
export const index = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
url: index.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
index.definition = {
|
||||
methods: ["get","head"],
|
||||
url: '/admin/services',
|
||||
} satisfies RouteDefinition<["get","head"]>
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\ListServices::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/ListServices.php:7
|
||||
* @route '/admin/services'
|
||||
*/
|
||||
index.url = (options?: RouteQueryOptions) => {
|
||||
return index.definition.url + queryParams(options)
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\ListServices::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/ListServices.php:7
|
||||
* @route '/admin/services'
|
||||
*/
|
||||
index.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
url: index.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\ListServices::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/ListServices.php:7
|
||||
* @route '/admin/services'
|
||||
*/
|
||||
index.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
|
||||
url: index.url(options),
|
||||
method: 'head',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\ListServices::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/ListServices.php:7
|
||||
* @route '/admin/services'
|
||||
*/
|
||||
const indexForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: index.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\ListServices::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/ListServices.php:7
|
||||
* @route '/admin/services'
|
||||
*/
|
||||
indexForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: index.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\ListServices::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/ListServices.php:7
|
||||
* @route '/admin/services'
|
||||
*/
|
||||
indexForm.head = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: index.url({
|
||||
[options?.mergeQuery ? 'mergeQuery' : 'query']: {
|
||||
_method: 'HEAD',
|
||||
...(options?.query ?? options?.mergeQuery ?? {}),
|
||||
}
|
||||
}),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
index.form = indexForm
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\CreateService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/CreateService.php:7
|
||||
* @route '/admin/services/create'
|
||||
*/
|
||||
export const create = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
url: create.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
create.definition = {
|
||||
methods: ["get","head"],
|
||||
url: '/admin/services/create',
|
||||
} satisfies RouteDefinition<["get","head"]>
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\CreateService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/CreateService.php:7
|
||||
* @route '/admin/services/create'
|
||||
*/
|
||||
create.url = (options?: RouteQueryOptions) => {
|
||||
return create.definition.url + queryParams(options)
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\CreateService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/CreateService.php:7
|
||||
* @route '/admin/services/create'
|
||||
*/
|
||||
create.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
url: create.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\CreateService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/CreateService.php:7
|
||||
* @route '/admin/services/create'
|
||||
*/
|
||||
create.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
|
||||
url: create.url(options),
|
||||
method: 'head',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\CreateService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/CreateService.php:7
|
||||
* @route '/admin/services/create'
|
||||
*/
|
||||
const createForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: create.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\CreateService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/CreateService.php:7
|
||||
* @route '/admin/services/create'
|
||||
*/
|
||||
createForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: create.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\CreateService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/CreateService.php:7
|
||||
* @route '/admin/services/create'
|
||||
*/
|
||||
createForm.head = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: create.url({
|
||||
[options?.mergeQuery ? 'mergeQuery' : 'query']: {
|
||||
_method: 'HEAD',
|
||||
...(options?.query ?? options?.mergeQuery ?? {}),
|
||||
}
|
||||
}),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
create.form = createForm
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\EditService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/EditService.php:7
|
||||
* @route '/admin/services/{record}/edit'
|
||||
*/
|
||||
export const edit = (args: { record: string | number } | [record: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
url: edit.url(args, options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
edit.definition = {
|
||||
methods: ["get","head"],
|
||||
url: '/admin/services/{record}/edit',
|
||||
} satisfies RouteDefinition<["get","head"]>
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\EditService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/EditService.php:7
|
||||
* @route '/admin/services/{record}/edit'
|
||||
*/
|
||||
edit.url = (args: { record: string | number } | [record: string | number ] | string | number, options?: RouteQueryOptions) => {
|
||||
if (typeof args === 'string' || typeof args === 'number') {
|
||||
args = { record: args }
|
||||
}
|
||||
|
||||
if (Array.isArray(args)) {
|
||||
args = {
|
||||
record: args[0],
|
||||
}
|
||||
}
|
||||
|
||||
args = applyUrlDefaults(args)
|
||||
|
||||
const parsedArgs = {
|
||||
record: args.record,
|
||||
}
|
||||
|
||||
return edit.definition.url
|
||||
.replace('{record}', parsedArgs.record.toString())
|
||||
.replace(/\/+$/, '') + queryParams(options)
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\EditService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/EditService.php:7
|
||||
* @route '/admin/services/{record}/edit'
|
||||
*/
|
||||
edit.get = (args: { record: string | number } | [record: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
url: edit.url(args, options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\EditService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/EditService.php:7
|
||||
* @route '/admin/services/{record}/edit'
|
||||
*/
|
||||
edit.head = (args: { record: string | number } | [record: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
|
||||
url: edit.url(args, options),
|
||||
method: 'head',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\EditService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/EditService.php:7
|
||||
* @route '/admin/services/{record}/edit'
|
||||
*/
|
||||
const editForm = (args: { record: string | number } | [record: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: edit.url(args, options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\EditService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/EditService.php:7
|
||||
* @route '/admin/services/{record}/edit'
|
||||
*/
|
||||
editForm.get = (args: { record: string | number } | [record: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: edit.url(args, options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see \App\Filament\Resources\Services\Pages\EditService::__invoke
|
||||
* @see app/Filament/Resources/Services/Pages/EditService.php:7
|
||||
* @route '/admin/services/{record}/edit'
|
||||
*/
|
||||
editForm.head = (args: { record: string | number } | [record: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: edit.url(args, {
|
||||
[options?.mergeQuery ? 'mergeQuery' : 'query']: {
|
||||
_method: 'HEAD',
|
||||
...(options?.query ?? options?.mergeQuery ?? {}),
|
||||
}
|
||||
}),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
edit.form = editForm
|
||||
|
||||
const services = {
|
||||
index: Object.assign(index, index),
|
||||
create: Object.assign(create, create),
|
||||
edit: Object.assign(edit, edit),
|
||||
}
|
||||
|
||||
export default services
|
||||
Reference in New Issue
Block a user