Updated compose dependencies

This commit is contained in:
Constantin Graf
2026-09-16 23:01:42 +02:00
committed by Constantin Graf
parent b33cf00788
commit 37579b1e5c
98 changed files with 2688 additions and 1819 deletions

View File

@@ -64,3 +64,6 @@ GOTENBERG_URL=http://localhost:3000
# Octane # Octane
OCTANE_SERVER=frankenphp OCTANE_SERVER=frankenphp
# Inertia
INERTIA_SSR_ENABLED=false

View File

@@ -88,3 +88,6 @@ FORWARD_DB_PORT=54329
VITE_HOST_NAME=vite.solidtime.test VITE_HOST_NAME=vite.solidtime.test
VITE_APP_NAME="${APP_NAME}" VITE_APP_NAME="${APP_NAME}"
#SAIL_XDEBUG_MODE=develop,debug,coverage #SAIL_XDEBUG_MODE=develop,debug,coverage
# This app does not ship a Node SSR bundle, so Inertia SSR must stay disabled.
INERTIA_SSR_ENABLED=false

View File

@@ -13,3 +13,5 @@ LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug LOG_LEVEL=debug
DB_CONNECTION=pgsql DB_CONNECTION=pgsql
INERTIA_SSR_ENABLED=false

View File

@@ -7,6 +7,7 @@ namespace App\Auth;
use Illuminate\Auth\EloquentUserProvider; use Illuminate\Auth\EloquentUserProvider;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Override;
/** /**
* User provider that only resolves non-placeholder users. * User provider that only resolves non-placeholder users.
@@ -26,7 +27,7 @@ class ActiveUserProvider extends EloquentUserProvider
* @param Model|null $model * @param Model|null $model
* @return Builder<Model> * @return Builder<Model>
*/ */
#[\Override] #[Override]
protected function newModelQuery($model = null): Builder protected function newModelQuery($model = null): Builder
{ {
$query = parent::newModelQuery($model); $query = parent::newModelQuery($model);

View File

@@ -10,6 +10,7 @@ use Illuminate\Database\Query\JoinClause;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use stdClass;
class SelfHostDatabaseConsistency extends Command class SelfHostDatabaseConsistency extends Command
{ {
@@ -101,7 +102,7 @@ class SelfHostDatabaseConsistency extends Command
} }
/** /**
* @param Collection<int, \stdClass> $problems * @param Collection<int, stdClass> $problems
*/ */
private function logProblems(Collection $problems, string $message, bool &$hadAProblem): void private function logProblems(Collection $problems, string $message, bool &$hadAProblem): void
{ {

View File

@@ -7,7 +7,7 @@ namespace App\Console\Commands\SelfHost;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Encryption\Encrypter; use Illuminate\Encryption\Encrypter;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use phpseclib3\Crypt\RSA; use phpseclib4\Crypt\RSA;
class SelfHostGenerateKeysCommand extends Command class SelfHostGenerateKeysCommand extends Command
{ {

View File

@@ -4,6 +4,8 @@ declare(strict_types=1);
namespace App\Exceptions\Api; namespace App\Exceptions\Api;
use Override;
class EntityStillInUseApiException extends ApiException class EntityStillInUseApiException extends ApiException
{ {
private string $modelToDelete; private string $modelToDelete;
@@ -32,7 +34,7 @@ class EntityStillInUseApiException extends ApiException
/** /**
* Get the translated message for the exception. * Get the translated message for the exception.
*/ */
#[\Override] #[Override]
public function getTranslatedMessage(): string public function getTranslatedMessage(): string
{ {
return __('exceptions.api.'.$this->getKey(), [ return __('exceptions.api.'.$this->getKey(), [

View File

@@ -4,13 +4,17 @@ declare(strict_types=1);
namespace App\Filament\Resources; namespace App\Filament\Resources;
use App\Filament\Resources\AuditResource\Pages; use App\Filament\Resources\AuditResource\Pages\CreateAudit;
use App\Filament\Resources\AuditResource\Pages\ListAudits;
use App\Filament\Resources\AuditResource\Pages\ViewAudit;
use App\Models\Audit; use App\Models\Audit;
use Filament\Forms; use Filament\Actions\ViewAction;
use Filament\Forms\Form; use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Schemas\Schema;
use Filament\Tables\Columns\IconColumn; use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Novadaemon\FilamentPrettyJson\Form\PrettyJsonField; use Novadaemon\FilamentPrettyJson\Form\PrettyJsonField;
@@ -19,32 +23,32 @@ class AuditResource extends Resource
{ {
protected static ?string $model = Audit::class; protected static ?string $model = Audit::class;
protected static ?string $navigationIcon = 'heroicon-o-archive-box'; protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-archive-box';
protected static ?string $navigationGroup = 'System'; protected static string|\UnitEnum|null $navigationGroup = 'System';
public static function form(Form $form): Form public static function form(Schema $schema): Schema
{ {
return $form return $schema
->schema([ ->components([
Forms\Components\TextInput::make('user_type') TextInput::make('user_type')
->maxLength(255), ->maxLength(255),
Forms\Components\TextInput::make('user_id'), TextInput::make('user_id'),
Forms\Components\TextInput::make('event') TextInput::make('event')
->required() ->required()
->maxLength(255), ->maxLength(255),
Forms\Components\TextInput::make('auditable_type') TextInput::make('auditable_type')
->required() ->required()
->maxLength(255), ->maxLength(255),
Forms\Components\TextInput::make('auditable_id') TextInput::make('auditable_id')
->required(), ->required(),
PrettyJsonField::make('old_values'), PrettyJsonField::make('old_values'),
PrettyJsonField::make('new_values'), PrettyJsonField::make('new_values'),
Forms\Components\Textarea::make('url'), Textarea::make('url'),
Forms\Components\TextInput::make('ip_address'), TextInput::make('ip_address'),
Forms\Components\TextInput::make('user_agent') TextInput::make('user_agent')
->maxLength(1023), ->maxLength(1023),
Forms\Components\TextInput::make('tags') TextInput::make('tags')
->maxLength(255), ->maxLength(255),
]); ]);
} }
@@ -53,27 +57,27 @@ class AuditResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('user.name'), TextColumn::make('user.name'),
Tables\Columns\TextColumn::make('event'), TextColumn::make('event'),
Tables\Columns\TextColumn::make('auditable_type'), TextColumn::make('auditable_type'),
Tables\Columns\TextColumn::make('auditable_id'), TextColumn::make('auditable_id'),
IconColumn::make('was_command') IconColumn::make('was_command')
->getStateUsing(fn (Audit $record) => Str::startsWith($record->url, 'artisan ')) ->getStateUsing(fn (Audit $record) => Str::startsWith($record->url, 'artisan '))
->boolean(), ->boolean(),
Tables\Columns\TextColumn::make('created_at') TextColumn::make('created_at')
->sortable() ->sortable()
->dateTime(), ->dateTime(),
Tables\Columns\TextColumn::make('updated_at') TextColumn::make('updated_at')
->sortable() ->sortable()
->dateTime(), ->dateTime(),
]) ])
->filters([ ->filters([
// //
]) ])
->actions([ ->recordActions([
Tables\Actions\ViewAction::make(), ViewAction::make(),
]) ])
->bulkActions([ ->toolbarActions([
]) ])
->defaultSort('created_at', 'desc'); ->defaultSort('created_at', 'desc');
} }
@@ -87,9 +91,9 @@ class AuditResource extends Resource
public static function getPages(): array public static function getPages(): array
{ {
return [ return [
'index' => Pages\ListAudits::route('/'), 'index' => ListAudits::route('/'),
'create' => Pages\CreateAudit::route('/create'), 'create' => CreateAudit::route('/create'),
'view' => Pages\ViewAudit::route('/{record}'), 'view' => ViewAudit::route('/{record}'),
]; ];
} }
} }

View File

@@ -4,13 +4,18 @@ declare(strict_types=1);
namespace App\Filament\Resources; namespace App\Filament\Resources;
use App\Filament\Resources\ClientResource\Pages; use App\Filament\Resources\ClientResource\Pages\CreateClient;
use App\Filament\Resources\ClientResource\Pages\EditClient;
use App\Filament\Resources\ClientResource\Pages\ListClients;
use App\Models\Client; use App\Models\Client;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\Select; use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Schemas\Schema;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter; use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table; use Filament\Tables\Table;
@@ -18,16 +23,16 @@ class ClientResource extends Resource
{ {
protected static ?string $model = Client::class; protected static ?string $model = Client::class;
protected static ?string $navigationIcon = 'heroicon-o-briefcase'; protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-briefcase';
protected static ?string $navigationGroup = 'Timetracking'; protected static string|\UnitEnum|null $navigationGroup = 'Timetracking';
protected static ?int $navigationSort = 4; protected static ?int $navigationSort = 4;
public static function form(Form $form): Form public static function form(Schema $schema): Schema
{ {
return $form return $schema
->schema([ ->components([
TextInput::make('name') TextInput::make('name')
->label('Name') ->label('Name')
->required(), ->required(),
@@ -43,17 +48,17 @@ class ClientResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('name') TextColumn::make('name')
->label('Name') ->label('Name')
->searchable() ->searchable()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('organization.name') TextColumn::make('organization.name')
->sortable() ->sortable()
->label('Organization'), ->label('Organization'),
Tables\Columns\TextColumn::make('created_at') TextColumn::make('created_at')
->label('Created at') ->label('Created at')
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('updated_at') TextColumn::make('updated_at')
->label('Updated at') ->label('Updated at')
->sortable(), ->sortable(),
]) ])
@@ -68,12 +73,12 @@ class ClientResource extends Resource
->relationship('organization', 'id') ->relationship('organization', 'id')
->searchable(), ->searchable(),
]) ])
->actions([ ->recordActions([
Tables\Actions\EditAction::make(), EditAction::make(),
]) ])
->bulkActions([ ->toolbarActions([
Tables\Actions\BulkActionGroup::make([ BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(), DeleteBulkAction::make(),
]), ]),
]); ]);
} }
@@ -88,9 +93,9 @@ class ClientResource extends Resource
public static function getPages(): array public static function getPages(): array
{ {
return [ return [
'index' => Pages\ListClients::route('/'), 'index' => ListClients::route('/'),
'create' => Pages\CreateClient::route('/create'), 'create' => CreateClient::route('/create'),
'edit' => Pages\EditClient::route('/{record}/edit'), 'edit' => EditClient::route('/{record}/edit'),
]; ];
} }
} }

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\ClientResource\Pages; namespace App\Filament\Resources\ClientResource\Pages;
use App\Filament\Resources\ClientResource; use App\Filament\Resources\ClientResource;
use Filament\Actions; use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord; use Filament\Resources\Pages\EditRecord;
class EditClient extends EditRecord class EditClient extends EditRecord
@@ -15,7 +15,7 @@ class EditClient extends EditRecord
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [
Actions\DeleteAction::make() DeleteAction::make()
->icon('heroicon-m-trash'), ->icon('heroicon-m-trash'),
]; ];
} }

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\ClientResource\Pages; namespace App\Filament\Resources\ClientResource\Pages;
use App\Filament\Resources\ClientResource; use App\Filament\Resources\ClientResource;
use Filament\Actions; use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords; use Filament\Resources\Pages\ListRecords;
class ListClients extends ListRecords class ListClients extends ListRecords
@@ -15,7 +15,7 @@ class ListClients extends ListRecords
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [
Actions\CreateAction::make() CreateAction::make()
->icon('heroicon-s-plus'), ->icon('heroicon-s-plus'),
]; ];
} }

View File

@@ -7,16 +7,16 @@ namespace App\Filament\Resources;
use App\Filament\Resources\FailedJobResource\Pages\ListFailedJobs; use App\Filament\Resources\FailedJobResource\Pages\ListFailedJobs;
use App\Filament\Resources\FailedJobResource\Pages\ViewFailedJobs; use App\Filament\Resources\FailedJobResource\Pages\ViewFailedJobs;
use App\Models\FailedJob; use App\Models\FailedJob;
use Filament\Actions\Action;
use Filament\Actions\BulkAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\ViewAction;
use Filament\Forms\Components\Textarea; use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Notifications\Notification; use Filament\Notifications\Notification;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables\Actions\Action; use Filament\Schemas\Schema;
use Filament\Tables\Actions\BulkAction;
use Filament\Tables\Actions\DeleteAction;
use Filament\Tables\Actions\DeleteBulkAction;
use Filament\Tables\Actions\ViewAction;
use Filament\Tables\Columns\TextColumn; use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
@@ -30,19 +30,19 @@ class FailedJobResource extends Resource
{ {
protected static ?string $model = FailedJob::class; protected static ?string $model = FailedJob::class;
protected static ?string $navigationIcon = 'heroicon-o-exclamation-circle'; protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-exclamation-circle';
protected static ?string $navigationGroup = 'System'; protected static string|\UnitEnum|null $navigationGroup = 'System';
public static function getNavigationBadge(): ?string public static function getNavigationBadge(): ?string
{ {
return (string) FailedJob::query()->count(); return (string) FailedJob::query()->count();
} }
public static function form(Form $form): Form public static function form(Schema $schema): Schema
{ {
return $form return $schema
->schema([ ->components([
TextInput::make('uuid')->disabled()->columnSpan(4), TextInput::make('uuid')->disabled()->columnSpan(4),
TextInput::make('failed_at')->disabled(), TextInput::make('failed_at')->disabled(),
TextInput::make('id')->disabled(), TextInput::make('id')->disabled(),
@@ -74,7 +74,7 @@ class FailedJobResource extends Resource
TextColumn::make('queue')->sortable()->searchable()->toggleable(isToggledHiddenByDefault: true), TextColumn::make('queue')->sortable()->searchable()->toggleable(isToggledHiddenByDefault: true),
]) ])
->filters([]) ->filters([])
->bulkActions([ ->toolbarActions([
BulkAction::make('retry') BulkAction::make('retry')
->icon('heroicon-o-arrow-path') ->icon('heroicon-o-arrow-path')
->label('Retry selected') ->label('Retry selected')
@@ -91,7 +91,7 @@ class FailedJobResource extends Resource
}), }),
DeleteBulkAction::make(), DeleteBulkAction::make(),
]) ])
->actions([ ->recordActions([
DeleteAction::make(), DeleteAction::make(),
ViewAction::make(), ViewAction::make(),
Action::make('retry') Action::make('retry')

View File

@@ -5,14 +5,21 @@ declare(strict_types=1);
namespace App\Filament\Resources; namespace App\Filament\Resources;
use App\Enums\Role; use App\Enums\Role;
use App\Filament\Resources\OrganizationInvitationResource\Pages; use App\Filament\Resources\OrganizationInvitationResource\Pages\EditOrganizationInvitation;
use App\Filament\Resources\OrganizationInvitationResource\Pages\ListOrganizationInvitations;
use App\Filament\Resources\OrganizationInvitationResource\Pages\ViewOrganizationInvitation;
use App\Models\OrganizationInvitation; use App\Models\OrganizationInvitation;
use App\Service\OrganizationInvitationService; use App\Service\OrganizationInvitationService;
use Filament\Forms; use Filament\Actions\BulkAction;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Select; use Filament\Forms\Components\Select;
use Filament\Forms\Form; use Filament\Forms\Components\TextInput;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Schemas\Schema;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
@@ -22,18 +29,18 @@ class OrganizationInvitationResource extends Resource
protected static ?string $label = 'Invitations'; protected static ?string $label = 'Invitations';
protected static ?string $navigationIcon = 'heroicon-o-user-plus'; protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-user-plus';
protected static ?string $navigationGroup = 'Users'; protected static string|\UnitEnum|null $navigationGroup = 'Users';
protected static ?int $navigationSort = 9; protected static ?int $navigationSort = 9;
public static function form(Form $form): Form public static function form(Schema $schema): Schema
{ {
return $form return $schema
->columns(1) ->columns(1)
->schema([ ->components([
Forms\Components\TextInput::make('email') TextInput::make('email')
->label('Email') ->label('Email')
->disabledOn(['edit']) ->disabledOn(['edit'])
->required(), ->required(),
@@ -45,11 +52,11 @@ class OrganizationInvitationResource extends Resource
->searchable(['name']) ->searchable(['name'])
->disabledOn(['edit']) ->disabledOn(['edit'])
->required(), ->required(),
Forms\Components\DateTimePicker::make('created_at') DateTimePicker::make('created_at')
->label('Created At') ->label('Created At')
->hiddenOn(['create']) ->hiddenOn(['create'])
->disabled(), ->disabled(),
Forms\Components\DateTimePicker::make('updated_at') DateTimePicker::make('updated_at')
->label('Updated At') ->label('Updated At')
->hiddenOn(['create']) ->hiddenOn(['create'])
->disabled(), ->disabled(),
@@ -60,17 +67,17 @@ class OrganizationInvitationResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('organization.name') TextColumn::make('organization.name')
->searchable() ->searchable()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('email') TextColumn::make('email')
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('role'), TextColumn::make('role'),
Tables\Columns\TextColumn::make('created_at') TextColumn::make('created_at')
->label('Created At') ->label('Created At')
->dateTime() ->dateTime()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('updated_at') TextColumn::make('updated_at')
->label('Updated At') ->label('Updated At')
->dateTime() ->dateTime()
->sortable() ->sortable()
@@ -80,13 +87,13 @@ class OrganizationInvitationResource extends Resource
->filters([ ->filters([
// //
]) ])
->actions([ ->recordActions([
Tables\Actions\EditAction::make(), EditAction::make(),
Tables\Actions\DeleteAction::make(), DeleteAction::make(),
]) ])
->bulkActions([ ->toolbarActions([
Tables\Actions\BulkActionGroup::make([ BulkActionGroup::make([
Tables\Actions\BulkAction::make('resend') BulkAction::make('resend')
->label('Resend') ->label('Resend')
->action(function (Collection $records): void { ->action(function (Collection $records): void {
foreach ($records as $organizationInvite) { foreach ($records as $organizationInvite) {
@@ -106,9 +113,9 @@ class OrganizationInvitationResource extends Resource
public static function getPages(): array public static function getPages(): array
{ {
return [ return [
'index' => Pages\ListOrganizationInvitations::route('/'), 'index' => ListOrganizationInvitations::route('/'),
'edit' => Pages\EditOrganizationInvitation::route('/{record}/edit'), 'edit' => EditOrganizationInvitation::route('/{record}/edit'),
'view' => Pages\ViewOrganizationInvitation::route('/{record}'), 'view' => ViewOrganizationInvitation::route('/{record}'),
]; ];
} }
} }

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\OrganizationInvitationResource\Pages; namespace App\Filament\Resources\OrganizationInvitationResource\Pages;
use App\Filament\Resources\OrganizationInvitationResource; use App\Filament\Resources\OrganizationInvitationResource;
use Filament\Actions; use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord; use Filament\Resources\Pages\EditRecord;
class EditOrganizationInvitation extends EditRecord class EditOrganizationInvitation extends EditRecord
@@ -15,7 +15,7 @@ class EditOrganizationInvitation extends EditRecord
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [
Actions\DeleteAction::make() DeleteAction::make()
->icon('heroicon-m-trash'), ->icon('heroicon-m-trash'),
]; ];
} }

View File

@@ -9,7 +9,10 @@ use App\Enums\DateFormat;
use App\Enums\IntervalFormat; use App\Enums\IntervalFormat;
use App\Enums\NumberFormat; use App\Enums\NumberFormat;
use App\Enums\TimeFormat; use App\Enums\TimeFormat;
use App\Filament\Resources\OrganizationResource\Pages; use App\Filament\Resources\OrganizationResource\Pages\CreateOrganization;
use App\Filament\Resources\OrganizationResource\Pages\EditOrganization;
use App\Filament\Resources\OrganizationResource\Pages\ListOrganizations;
use App\Filament\Resources\OrganizationResource\Pages\ViewOrganization;
use App\Filament\Resources\OrganizationResource\RelationManagers\InvitationsRelationManager; use App\Filament\Resources\OrganizationResource\RelationManagers\InvitationsRelationManager;
use App\Filament\Resources\OrganizationResource\RelationManagers\UsersRelationManager; use App\Filament\Resources\OrganizationResource\RelationManagers\UsersRelationManager;
use App\Models\Organization; use App\Models\Organization;
@@ -21,13 +24,19 @@ use App\Service\Import\Importers\ReportDto;
use App\Service\Import\ImportService; use App\Service\Import\ImportService;
use App\Service\TimezoneService; use App\Service\TimezoneService;
use Brick\Money\ISOCurrencyProvider; use Brick\Money\ISOCurrencyProvider;
use Filament\Forms; use Exception;
use Filament\Actions\Action;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Select; use Filament\Forms\Components\Select;
use Filament\Forms\Form; use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Notifications\Notification; use Filament\Notifications\Notification;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Schemas\Schema;
use Filament\Tables\Actions\Action; use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn; use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
@@ -36,22 +45,22 @@ class OrganizationResource extends Resource
{ {
protected static ?string $model = Organization::class; protected static ?string $model = Organization::class;
protected static ?string $navigationIcon = 'heroicon-o-building-office-2'; protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-building-office-2';
protected static ?string $navigationGroup = 'Users'; protected static string|\UnitEnum|null $navigationGroup = 'Users';
protected static ?int $navigationSort = 7; protected static ?int $navigationSort = 7;
public static function form(Form $form): Form public static function form(Schema $schema): Schema
{ {
return $form return $schema
->columns(1) ->columns(1)
->schema([ ->components([
Forms\Components\TextInput::make('name') TextInput::make('name')
->label('Name') ->label('Name')
->required() ->required()
->maxLength(255), ->maxLength(255),
Forms\Components\Toggle::make('personal_team') Toggle::make('personal_team')
->label('Is personal?') ->label('Is personal?')
->hiddenOn(['create']) ->hiddenOn(['create'])
->required(), ->required(),
@@ -89,7 +98,7 @@ class OrganizationResource extends Resource
}) })
->required() ->required()
->searchable(), ->searchable(),
Forms\Components\TextInput::make('billable_rate') TextInput::make('billable_rate')
->label('Billable rate (in Cents)') ->label('Billable rate (in Cents)')
->nullable() ->nullable()
->rules([ ->rules([
@@ -99,11 +108,11 @@ class OrganizationResource extends Resource
'max:2147483647', 'max:2147483647',
]) ])
->numeric(), ->numeric(),
Forms\Components\DateTimePicker::make('created_at') DateTimePicker::make('created_at')
->label('Created At') ->label('Created At')
->hiddenOn(['create']) ->hiddenOn(['create'])
->disabled(), ->disabled(),
Forms\Components\DateTimePicker::make('updated_at') DateTimePicker::make('updated_at')
->label('Updated At') ->label('Updated At')
->hiddenOn(['create']) ->hiddenOn(['create'])
->disabled(), ->disabled(),
@@ -117,7 +126,7 @@ class OrganizationResource extends Resource
TextColumn::make('name') TextColumn::make('name')
->searchable() ->searchable()
->sortable(), ->sortable(),
Tables\Columns\IconColumn::make('personal_team') IconColumn::make('personal_team')
->boolean() ->boolean()
->label('Is personal?') ->label('Is personal?')
->sortable(), ->sortable(),
@@ -138,9 +147,9 @@ class OrganizationResource extends Resource
->filters([ ->filters([
// //
]) ])
->actions([ ->recordActions([
Tables\Actions\EditAction::make(), EditAction::make(),
Tables\Actions\DeleteAction::make() DeleteAction::make()
->using(function (Organization $record): void { ->using(function (Organization $record): void {
app(DeletionService::class)->deleteOrganization($record); app(DeletionService::class)->deleteOrganization($record);
}), }),
@@ -158,7 +167,7 @@ class OrganizationResource extends Resource
return response()->streamDownload(function () use ($file): void { return response()->streamDownload(function () use ($file): void {
echo Storage::disk(config('filesystems.private'))->get($file); echo Storage::disk(config('filesystems.private'))->get($file);
}, 'export.zip'); }, 'export.zip');
} catch (\Exception $exception) { } catch (Exception $exception) {
report($exception); report($exception);
Notification::make() Notification::make()
->title('Export failed') ->title('Export failed')
@@ -174,7 +183,7 @@ class OrganizationResource extends Resource
try { try {
$file = Storage::disk(config('filament.default_filesystem_disk'))->get($data['file']); $file = Storage::disk(config('filament.default_filesystem_disk'))->get($data['file']);
if ($file === null) { if ($file === null) {
throw new \Exception('File not found'); throw new Exception('File not found');
} }
/** @var string $timezone */ /** @var string $timezone */
$timezone = $data['timezone']; $timezone = $data['timezone'];
@@ -209,8 +218,8 @@ class OrganizationResource extends Resource
} }
}) })
->tooltip(fn (Organization $record): string => 'Import into '.$record->name) ->tooltip(fn (Organization $record): string => 'Import into '.$record->name)
->form([ ->schema([
Forms\Components\FileUpload::make('file') FileUpload::make('file')
->label('File') ->label('File')
->required(), ->required(),
Select::make('type') Select::make('type')
@@ -230,7 +239,7 @@ class OrganizationResource extends Resource
->required(), ->required(),
]), ]),
]) ])
->bulkActions([ ->toolbarActions([
]); ]);
} }
@@ -245,10 +254,10 @@ class OrganizationResource extends Resource
public static function getPages(): array public static function getPages(): array
{ {
return [ return [
'index' => Pages\ListOrganizations::route('/'), 'index' => ListOrganizations::route('/'),
'create' => Pages\CreateOrganization::route('/create'), 'create' => CreateOrganization::route('/create'),
'edit' => Pages\EditOrganization::route('/{record}/edit'), 'edit' => EditOrganization::route('/{record}/edit'),
'view' => Pages\ViewOrganization::route('/{record}'), 'view' => ViewOrganization::route('/{record}'),
]; ];
} }
} }

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\OrganizationResource\Pages; namespace App\Filament\Resources\OrganizationResource\Pages;
use App\Filament\Resources\OrganizationResource; use App\Filament\Resources\OrganizationResource;
use App\Filament\Resources\OrganizationResource\Actions\DeleteOrganization;
use Filament\Resources\Pages\EditRecord; use Filament\Resources\Pages\EditRecord;
class EditOrganization extends EditRecord class EditOrganization extends EditRecord
@@ -14,7 +15,7 @@ class EditOrganization extends EditRecord
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [
OrganizationResource\Actions\DeleteOrganization::make(), DeleteOrganization::make(),
]; ];
} }
} }

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\OrganizationResource\Pages; namespace App\Filament\Resources\OrganizationResource\Pages;
use App\Filament\Resources\OrganizationResource; use App\Filament\Resources\OrganizationResource;
use Filament\Actions; use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords; use Filament\Resources\Pages\ListRecords;
class ListOrganizations extends ListRecords class ListOrganizations extends ListRecords
@@ -15,7 +15,7 @@ class ListOrganizations extends ListRecords
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [
Actions\CreateAction::make() CreateAction::make()
->icon('heroicon-s-plus'), ->icon('heroicon-s-plus'),
]; ];
} }

View File

@@ -9,12 +9,17 @@ use App\Filament\Resources\OrganizationInvitationResource;
use App\Models\Organization; use App\Models\Organization;
use App\Models\OrganizationInvitation; use App\Models\OrganizationInvitation;
use App\Service\InvitationService; use App\Service\InvitationService;
use Filament\Actions\Action;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\CreateAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\DetachBulkAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\Select; use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\RelationManagers\RelationManager; use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables; use Filament\Schemas\Schema;
use Filament\Tables\Actions\Action; use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
@@ -25,10 +30,10 @@ class InvitationsRelationManager extends RelationManager
protected static ?string $title = 'Invitations'; protected static ?string $title = 'Invitations';
public function form(Form $form): Form public function form(Schema $schema): Schema
{ {
return $form return $schema
->schema([ ->components([
TextInput::make('email') TextInput::make('email')
->label('Email') ->label('Email')
->disabledOn(['edit']) ->disabledOn(['edit'])
@@ -53,33 +58,33 @@ class InvitationsRelationManager extends RelationManager
->modelLabel('Invitation') ->modelLabel('Invitation')
->pluralModelLabel('Invitations') ->pluralModelLabel('Invitations')
->columns([ ->columns([
Tables\Columns\TextColumn::make('email'), TextColumn::make('email'),
Tables\Columns\TextColumn::make('role'), TextColumn::make('role'),
]) ])
->headerActions([ ->headerActions([
Tables\Actions\CreateAction::make() CreateAction::make()
->icon('heroicon-s-plus') ->icon('heroicon-s-plus')
->using(function (array $data, string $model): Model { ->using(function (array $data, string $model): Model {
/** @var Organization $ownerRecord */ /** @var Organization $ownerRecord */
$ownerRecord = $this->getOwnerRecord(); $ownerRecord = $this->getOwnerRecord();
return app(InvitationService::class) return app(InvitationService::class)
->inviteUser($ownerRecord, $data['email'], Role::from($data['role']), auth()->user()); ->inviteUser($ownerRecord, $data['email'], ($data['role'] instanceof Role ? $data['role'] : Role::from($data['role'])), auth()->user());
}), }),
]) ])
->actions([ ->recordActions([
Action::make('view') Action::make('view')
->icon('heroicon-o-eye') ->icon('heroicon-o-eye')
->color('gray') ->color('gray')
->url(fn (OrganizationInvitation $record): string => OrganizationInvitationResource::getUrl('view', [ ->url(fn (OrganizationInvitation $record): string => OrganizationInvitationResource::getUrl('view', [
'record' => $record->getKey(), 'record' => $record->getKey(),
])), ])),
Tables\Actions\EditAction::make(), EditAction::make(),
Tables\Actions\DeleteAction::make(), DeleteAction::make(),
]) ])
->bulkActions([ ->toolbarActions([
Tables\Actions\BulkActionGroup::make([ BulkActionGroup::make([
Tables\Actions\DetachBulkAction::make(), DetachBulkAction::make(),
]), ]),
]); ]);
} }

View File

@@ -12,14 +12,15 @@ use App\Models\Organization;
use App\Models\User; use App\Models\User;
use App\Service\BillableRateService; use App\Service\BillableRateService;
use App\Service\MemberService; use App\Service\MemberService;
use Filament\Actions\Action;
use Filament\Actions\AttachAction;
use Filament\Actions\DetachAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\Select; use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Notifications\Notification; use Filament\Notifications\Notification;
use Filament\Resources\RelationManagers\RelationManager; use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables; use Filament\Schemas\Schema;
use Filament\Tables\Actions\Action;
use Filament\Tables\Actions\AttachAction;
use Filament\Tables\Columns\TextColumn; use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
@@ -28,10 +29,10 @@ class UsersRelationManager extends RelationManager
{ {
protected static string $relationship = 'users'; protected static string $relationship = 'users';
public function form(Form $form): Form public function form(Schema $schema): Schema
{ {
return $form return $schema
->schema([ ->components([
Select::make('role') Select::make('role')
->options(Role::class), ->options(Role::class),
TextInput::make('billable_rate') TextInput::make('billable_rate')
@@ -75,17 +76,17 @@ class UsersRelationManager extends RelationManager
->using(function (User $record, array $data): void { ->using(function (User $record, array $data): void {
/** @var Organization $organization */ /** @var Organization $organization */
$organization = $this->getOwnerRecord(); $organization = $this->getOwnerRecord();
app(MemberService::class)->addMember($record, $organization, Role::from($data['role']), true); app(MemberService::class)->addMember($record, $organization, ($data['role'] instanceof Role ? $data['role'] : Role::from($data['role'])), true);
}), }),
]) ])
->actions([ ->recordActions([
Action::make('view') Action::make('view')
->icon('heroicon-o-eye') ->icon('heroicon-o-eye')
->color('gray') ->color('gray')
->url(fn (User $record): string => UserResource::getUrl('view', [ ->url(fn (User $record): string => UserResource::getUrl('view', [
'record' => $record->getKey(), 'record' => $record->getKey(),
])), ])),
Tables\Actions\EditAction::make() EditAction::make()
->using(function (User $record, array $data): User { ->using(function (User $record, array $data): User {
/** @var Organization $organization */ /** @var Organization $organization */
$organization = $this->getOwnerRecord(); $organization = $this->getOwnerRecord();
@@ -99,7 +100,7 @@ class UsersRelationManager extends RelationManager
if ($data['role'] !== $member->role) { if ($data['role'] !== $member->role) {
try { try {
app(MemberService::class)->changeRole($member, $organization, Role::from($data['role']), true); app(MemberService::class)->changeRole($member, $organization, ($data['role'] instanceof Role ? $data['role'] : Role::from($data['role'])), true);
} catch (ApiException $exception) { } catch (ApiException $exception) {
Notification::make() Notification::make()
->danger() ->danger()
@@ -113,7 +114,7 @@ class UsersRelationManager extends RelationManager
return $record; return $record;
}), }),
Tables\Actions\DetachAction::make() DetachAction::make()
->using(function (User $record): void { ->using(function (User $record): void {
/** @var Organization $organization */ /** @var Organization $organization */
$organization = $this->getOwnerRecord(); $organization = $this->getOwnerRecord();
@@ -133,7 +134,7 @@ class UsersRelationManager extends RelationManager
} }
}), }),
]) ])
->bulkActions([ ->toolbarActions([
]); ]);
} }
} }

View File

@@ -4,12 +4,19 @@ declare(strict_types=1);
namespace App\Filament\Resources; namespace App\Filament\Resources;
use App\Filament\Resources\ProjectMemberResource\Pages; use App\Filament\Resources\ProjectMemberResource\Pages\CreateProjectMember;
use App\Filament\Resources\ProjectMemberResource\Pages\EditProjectMember;
use App\Filament\Resources\ProjectMemberResource\Pages\ListProjectMembers;
use App\Filament\Resources\ProjectMemberResource\Pages\ViewProjectMembers;
use App\Models\ProjectMember; use App\Models\ProjectMember;
use Filament\Forms; use Filament\Actions\BulkActionGroup;
use Filament\Forms\Form; use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Schemas\Schema;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
class ProjectMemberResource extends Resource class ProjectMemberResource extends Resource
@@ -18,11 +25,11 @@ class ProjectMemberResource extends Resource
protected static bool $shouldRegisterNavigation = false; protected static bool $shouldRegisterNavigation = false;
public static function form(Form $form): Form public static function form(Schema $schema): Schema
{ {
return $form return $schema
->schema([ ->components([
Forms\Components\TextInput::make('billable_rate') TextInput::make('billable_rate')
->label('Billable rate (in Cents)') ->label('Billable rate (in Cents)')
->nullable() ->nullable()
->rules([ ->rules([
@@ -32,10 +39,10 @@ class ProjectMemberResource extends Resource
'max:2147483647', 'max:2147483647',
]) ])
->numeric(), ->numeric(),
Forms\Components\Select::make('user_id') Select::make('user_id')
->relationship('user', 'name') ->relationship('user', 'name')
->required(), ->required(),
Forms\Components\Select::make('member_id') Select::make('member_id')
->relationship('member', 'id') ->relationship('member', 'id')
->required(), ->required(),
]); ]);
@@ -45,17 +52,17 @@ class ProjectMemberResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('id') TextColumn::make('id')
->label('ID'), ->label('ID'),
Tables\Columns\TextColumn::make('billable_rate') TextColumn::make('billable_rate')
->numeric() ->numeric()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('project.name'), TextColumn::make('project.name'),
Tables\Columns\TextColumn::make('user.name'), TextColumn::make('user.name'),
Tables\Columns\TextColumn::make('created_at') TextColumn::make('created_at')
->dateTime() ->dateTime()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('updated_at') TextColumn::make('updated_at')
->dateTime() ->dateTime()
->sortable() ->sortable()
->toggleable(isToggledHiddenByDefault: true), ->toggleable(isToggledHiddenByDefault: true),
@@ -63,12 +70,12 @@ class ProjectMemberResource extends Resource
->filters([ ->filters([
// //
]) ])
->actions([ ->recordActions([
Tables\Actions\EditAction::make(), EditAction::make(),
]) ])
->bulkActions([ ->toolbarActions([
Tables\Actions\BulkActionGroup::make([ BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(), DeleteBulkAction::make(),
]), ]),
]); ]);
} }
@@ -83,10 +90,10 @@ class ProjectMemberResource extends Resource
public static function getPages(): array public static function getPages(): array
{ {
return [ return [
'index' => Pages\ListProjectMembers::route('/'), 'index' => ListProjectMembers::route('/'),
'create' => Pages\CreateProjectMember::route('/create'), 'create' => CreateProjectMember::route('/create'),
'edit' => Pages\EditProjectMember::route('/{record}/edit'), 'edit' => EditProjectMember::route('/{record}/edit'),
'view' => Pages\ViewProjectMembers::route('/{record}'), 'view' => ViewProjectMembers::route('/{record}'),
]; ];
} }
} }

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\ProjectMemberResource\Pages; namespace App\Filament\Resources\ProjectMemberResource\Pages;
use App\Filament\Resources\ProjectMemberResource; use App\Filament\Resources\ProjectMemberResource;
use Filament\Actions; use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord; use Filament\Resources\Pages\EditRecord;
class EditProjectMember extends EditRecord class EditProjectMember extends EditRecord
@@ -15,7 +15,7 @@ class EditProjectMember extends EditRecord
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [
Actions\DeleteAction::make() DeleteAction::make()
->icon('heroicon-m-trash'), ->icon('heroicon-m-trash'),
]; ];
} }

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\ProjectMemberResource\Pages; namespace App\Filament\Resources\ProjectMemberResource\Pages;
use App\Filament\Resources\ProjectMemberResource; use App\Filament\Resources\ProjectMemberResource;
use Filament\Actions; use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords; use Filament\Resources\Pages\ListRecords;
class ListProjectMembers extends ListRecords class ListProjectMembers extends ListRecords
@@ -15,7 +15,7 @@ class ListProjectMembers extends ListRecords
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [
Actions\CreateAction::make() CreateAction::make()
->icon('heroicon-s-plus'), ->icon('heroicon-s-plus'),
]; ];
} }

View File

@@ -4,14 +4,19 @@ declare(strict_types=1);
namespace App\Filament\Resources; namespace App\Filament\Resources;
use App\Filament\Resources\ProjectResource\Pages; use App\Filament\Resources\ProjectResource\Pages\CreateProject;
use App\Filament\Resources\ProjectResource\Pages\EditProject;
use App\Filament\Resources\ProjectResource\Pages\ListProjects;
use App\Filament\Resources\ProjectResource\RelationManagers\ProjectMembersRelationManager; use App\Filament\Resources\ProjectResource\RelationManagers\ProjectMembersRelationManager;
use App\Models\Project; use App\Models\Project;
use Filament\Forms; use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\ColorPicker; use Filament\Forms\Components\ColorPicker;
use Filament\Forms\Form; use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Schemas\Schema;
use Filament\Tables\Columns\ColorColumn; use Filament\Tables\Columns\ColorColumn;
use Filament\Tables\Columns\TextColumn; use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter; use Filament\Tables\Filters\SelectFilter;
@@ -21,24 +26,24 @@ class ProjectResource extends Resource
{ {
protected static ?string $model = Project::class; protected static ?string $model = Project::class;
protected static ?string $navigationIcon = 'heroicon-o-folder'; protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-folder';
protected static ?string $navigationGroup = 'Timetracking'; protected static string|\UnitEnum|null $navigationGroup = 'Timetracking';
protected static ?int $navigationSort = 2; protected static ?int $navigationSort = 2;
public static function form(Form $form): Form public static function form(Schema $schema): Schema
{ {
return $form return $schema
->schema([ ->components([
Forms\Components\TextInput::make('name') TextInput::make('name')
->label('Name') ->label('Name')
->required() ->required()
->maxLength(255), ->maxLength(255),
ColorPicker::make('color') ColorPicker::make('color')
->label('Color') ->label('Color')
->required(), ->required(),
Forms\Components\TextInput::make('billable_rate') TextInput::make('billable_rate')
->label('Billable rate (in Cents)') ->label('Billable rate (in Cents)')
->nullable() ->nullable()
->rules([ ->rules([
@@ -48,7 +53,7 @@ class ProjectResource extends Resource
'max:2147483647', 'max:2147483647',
]) ])
->numeric(), ->numeric(),
Forms\Components\Select::make('organization_id') Select::make('organization_id')
->relationship(name: 'organization', titleAttribute: 'name') ->relationship(name: 'organization', titleAttribute: 'name')
->searchable(['name']) ->searchable(['name'])
->required(), ->required(),
@@ -81,12 +86,12 @@ class ProjectResource extends Resource
->searchable(), ->searchable(),
]) ])
->defaultSort('created_at', 'desc') ->defaultSort('created_at', 'desc')
->actions([ ->recordActions([
Tables\Actions\EditAction::make(), EditAction::make(),
]) ])
->bulkActions([ ->toolbarActions([
Tables\Actions\BulkActionGroup::make([ BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(), DeleteBulkAction::make(),
]), ]),
]); ]);
} }
@@ -101,9 +106,9 @@ class ProjectResource extends Resource
public static function getPages(): array public static function getPages(): array
{ {
return [ return [
'index' => Pages\ListProjects::route('/'), 'index' => ListProjects::route('/'),
'create' => Pages\CreateProject::route('/create'), 'create' => CreateProject::route('/create'),
'edit' => Pages\EditProject::route('/{record}/edit'), 'edit' => EditProject::route('/{record}/edit'),
]; ];
} }
} }

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\ProjectResource\Pages; namespace App\Filament\Resources\ProjectResource\Pages;
use App\Filament\Resources\ProjectResource; use App\Filament\Resources\ProjectResource;
use Filament\Actions; use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord; use Filament\Resources\Pages\EditRecord;
class EditProject extends EditRecord class EditProject extends EditRecord
@@ -15,7 +15,7 @@ class EditProject extends EditRecord
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [
Actions\DeleteAction::make() DeleteAction::make()
->icon('heroicon-m-trash'), ->icon('heroicon-m-trash'),
]; ];
} }

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\ProjectResource\Pages; namespace App\Filament\Resources\ProjectResource\Pages;
use App\Filament\Resources\ProjectResource; use App\Filament\Resources\ProjectResource;
use Filament\Actions; use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords; use Filament\Resources\Pages\ListRecords;
class ListProjects extends ListRecords class ListProjects extends ListRecords
@@ -15,7 +15,7 @@ class ListProjects extends ListRecords
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [
Actions\CreateAction::make() CreateAction::make()
->icon('heroicon-s-plus'), ->icon('heroicon-s-plus'),
]; ];
} }

View File

@@ -6,10 +6,10 @@ namespace App\Filament\Resources\ProjectResource\RelationManagers;
use App\Filament\Resources\ProjectMemberResource; use App\Filament\Resources\ProjectMemberResource;
use App\Models\ProjectMember; use App\Models\ProjectMember;
use Filament\Forms\Form; use Filament\Actions\Action;
use Filament\Resources\RelationManagers\RelationManager; use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables; use Filament\Schemas\Schema;
use Filament\Tables\Actions\Action; use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
class ProjectMembersRelationManager extends RelationManager class ProjectMembersRelationManager extends RelationManager
@@ -18,10 +18,10 @@ class ProjectMembersRelationManager extends RelationManager
protected static string $relationship = 'members'; protected static string $relationship = 'members';
public function form(Form $form): Form public function form(Schema $schema): Schema
{ {
return $form return $schema
->schema([ ->components([
]); ]);
} }
@@ -30,8 +30,8 @@ class ProjectMembersRelationManager extends RelationManager
return $table return $table
->recordTitleAttribute('name') ->recordTitleAttribute('name')
->columns([ ->columns([
Tables\Columns\TextColumn::make('user.name'), TextColumn::make('user.name'),
Tables\Columns\TextColumn::make('billable_rate') TextColumn::make('billable_rate')
->numeric() ->numeric()
->sortable(), ->sortable(),
]) ])
@@ -40,7 +40,7 @@ class ProjectMembersRelationManager extends RelationManager
]) ])
->headerActions([ ->headerActions([
]) ])
->actions([ ->recordActions([
Action::make('view') Action::make('view')
->icon('heroicon-o-eye') ->icon('heroicon-o-eye')
->color('gray') ->color('gray')
@@ -54,7 +54,7 @@ class ProjectMembersRelationManager extends RelationManager
])) ]))
->openUrlInNewTab(), ->openUrlInNewTab(),
]) ])
->bulkActions([ ->toolbarActions([
]); ]);
} }
} }

View File

@@ -4,16 +4,21 @@ declare(strict_types=1);
namespace App\Filament\Resources; namespace App\Filament\Resources;
use App\Filament\Resources\ReportResource\Pages; use App\Filament\Resources\ReportResource\Pages\EditReport;
use App\Filament\Resources\ReportResource\Pages\ListReports;
use App\Filament\Resources\ReportResource\Pages\ViewReport;
use App\Models\Report; use App\Models\Report;
use App\Service\Dto\ReportPropertiesDto; use App\Service\Dto\ReportPropertiesDto;
use Filament\Forms; use Filament\Actions\Action;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
use Filament\Actions\ViewAction;
use Filament\Forms\Components\DateTimePicker; use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle; use Filament\Forms\Components\Toggle;
use Filament\Forms\Form;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Schemas\Schema;
use Filament\Tables\Actions\Action;
use Filament\Tables\Columns\TextColumn; use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\ToggleColumn; use Filament\Tables\Columns\ToggleColumn;
use Filament\Tables\Filters\SelectFilter; use Filament\Tables\Filters\SelectFilter;
@@ -24,22 +29,22 @@ class ReportResource extends Resource
{ {
protected static ?string $model = Report::class; protected static ?string $model = Report::class;
protected static ?string $navigationIcon = 'heroicon-o-document-chart-bar'; protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-document-chart-bar';
protected static ?string $navigationGroup = 'Timetracking'; protected static string|\UnitEnum|null $navigationGroup = 'Timetracking';
protected static ?int $navigationSort = 7; protected static ?int $navigationSort = 7;
public static function form(Form $form): Form public static function form(Schema $schema): Schema
{ {
return $form return $schema
->columns(1) ->columns(1)
->schema([ ->components([
Forms\Components\TextInput::make('name') TextInput::make('name')
->label('Name') ->label('Name')
->required() ->required()
->maxLength(255), ->maxLength(255),
Forms\Components\TextInput::make('description') TextInput::make('description')
->label('Description') ->label('Description')
->nullable() ->nullable()
->maxLength(255), ->maxLength(255),
@@ -49,13 +54,13 @@ class ReportResource extends Resource
DateTimePicker::make('public_until') DateTimePicker::make('public_until')
->label('Public until') ->label('Public until')
->nullable(), ->nullable(),
Forms\Components\Select::make('organization_id') Select::make('organization_id')
->label('Organization') ->label('Organization')
->relationship(name: 'organization', titleAttribute: 'name') ->relationship(name: 'organization', titleAttribute: 'name')
->searchable(['name']) ->searchable(['name'])
->disabled() ->disabled()
->required(), ->required(),
Forms\Components\TextInput::make('share_secret') TextInput::make('share_secret')
->label('Share Secret') ->label('Share Secret')
->nullable(), ->nullable(),
PrettyJsonField::make('properties') PrettyJsonField::make('properties')
@@ -109,18 +114,18 @@ class ReportResource extends Resource
->relationship('organization', 'id') ->relationship('organization', 'id')
->searchable(), ->searchable(),
]) ])
->actions([ ->recordActions([
Action::make('public-view') Action::make('public-view')
->label('Public') ->label('Public')
->icon('heroicon-o-eye') ->icon('heroicon-o-eye')
->color('gray') ->color('gray')
->hidden(fn (Report $record): bool => $record->getShareableLink() === null) ->hidden(fn (Report $record): bool => $record->getShareableLink() === null)
->url(fn (Report $record): string => $record->getShareableLink(), true), ->url(fn (Report $record): string => $record->getShareableLink(), true),
Tables\Actions\ViewAction::make(), ViewAction::make(),
Tables\Actions\EditAction::make(), EditAction::make(),
Tables\Actions\DeleteAction::make(), DeleteAction::make(),
]) ])
->bulkActions([ ->toolbarActions([
]); ]);
} }
@@ -133,9 +138,9 @@ class ReportResource extends Resource
public static function getPages(): array public static function getPages(): array
{ {
return [ return [
'index' => Pages\ListReports::route('/'), 'index' => ListReports::route('/'),
'edit' => Pages\EditReport::route('/{record}/edit'), 'edit' => EditReport::route('/{record}/edit'),
'view' => Pages\ViewReport::route('/{record}'), 'view' => ViewReport::route('/{record}'),
]; ];
} }
} }

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\ReportResource\Pages; namespace App\Filament\Resources\ReportResource\Pages;
use App\Filament\Resources\ReportResource; use App\Filament\Resources\ReportResource;
use Filament\Actions; use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord; use Filament\Resources\Pages\EditRecord;
class EditReport extends EditRecord class EditReport extends EditRecord
@@ -15,7 +15,7 @@ class EditReport extends EditRecord
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [
Actions\DeleteAction::make() DeleteAction::make()
->icon('heroicon-m-trash'), ->icon('heroicon-m-trash'),
]; ];
} }

View File

@@ -4,13 +4,18 @@ declare(strict_types=1);
namespace App\Filament\Resources; namespace App\Filament\Resources;
use App\Filament\Resources\TagResource\Pages; use App\Filament\Resources\TagResource\Pages\CreateTag;
use App\Filament\Resources\TagResource\Pages\EditTag;
use App\Filament\Resources\TagResource\Pages\ListTags;
use App\Models\Tag; use App\Models\Tag;
use Filament\Forms; use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Schemas\Schema;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter; use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table; use Filament\Tables\Table;
@@ -18,20 +23,20 @@ class TagResource extends Resource
{ {
protected static ?string $model = Tag::class; protected static ?string $model = Tag::class;
protected static ?string $navigationIcon = 'heroicon-o-tag'; protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-tag';
protected static ?string $navigationGroup = 'Timetracking'; protected static string|\UnitEnum|null $navigationGroup = 'Timetracking';
protected static ?int $navigationSort = 5; protected static ?int $navigationSort = 5;
public static function form(Form $form): Form public static function form(Schema $schema): Schema
{ {
return $form return $schema
->schema([ ->components([
TextInput::make('name') TextInput::make('name')
->label('Name') ->label('Name')
->required(), ->required(),
Forms\Components\Select::make('organization_id') Select::make('organization_id')
->relationship(name: 'organization', titleAttribute: 'name') ->relationship(name: 'organization', titleAttribute: 'name')
->label('Organization') ->label('Organization')
->searchable(['name']) ->searchable(['name'])
@@ -43,17 +48,17 @@ class TagResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('name') TextColumn::make('name')
->label('Name') ->label('Name')
->searchable() ->searchable()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('organization.name') TextColumn::make('organization.name')
->sortable() ->sortable()
->label('Organization'), ->label('Organization'),
Tables\Columns\TextColumn::make('created_at') TextColumn::make('created_at')
->label('Created at') ->label('Created at')
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('updated_at') TextColumn::make('updated_at')
->label('Updated at') ->label('Updated at')
->sortable(), ->sortable(),
]) ])
@@ -68,12 +73,12 @@ class TagResource extends Resource
->relationship('organization', 'id') ->relationship('organization', 'id')
->searchable(), ->searchable(),
]) ])
->actions([ ->recordActions([
Tables\Actions\EditAction::make(), EditAction::make(),
]) ])
->bulkActions([ ->toolbarActions([
Tables\Actions\BulkActionGroup::make([ BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(), DeleteBulkAction::make(),
]), ]),
]); ]);
} }
@@ -88,9 +93,9 @@ class TagResource extends Resource
public static function getPages(): array public static function getPages(): array
{ {
return [ return [
'index' => Pages\ListTags::route('/'), 'index' => ListTags::route('/'),
'create' => Pages\CreateTag::route('/create'), 'create' => CreateTag::route('/create'),
'edit' => Pages\EditTag::route('/{record}/edit'), 'edit' => EditTag::route('/{record}/edit'),
]; ];
} }
} }

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\TagResource\Pages; namespace App\Filament\Resources\TagResource\Pages;
use App\Filament\Resources\TagResource; use App\Filament\Resources\TagResource;
use Filament\Actions; use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord; use Filament\Resources\Pages\EditRecord;
class EditTag extends EditRecord class EditTag extends EditRecord
@@ -15,7 +15,7 @@ class EditTag extends EditRecord
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [
Actions\DeleteAction::make() DeleteAction::make()
->icon('heroicon-m-trash'), ->icon('heroicon-m-trash'),
]; ];
} }

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\TagResource\Pages; namespace App\Filament\Resources\TagResource\Pages;
use App\Filament\Resources\TagResource; use App\Filament\Resources\TagResource;
use Filament\Actions; use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords; use Filament\Resources\Pages\ListRecords;
class ListTags extends ListRecords class ListTags extends ListRecords
@@ -15,7 +15,7 @@ class ListTags extends ListRecords
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [
Actions\CreateAction::make() CreateAction::make()
->icon('heroicon-s-plus'), ->icon('heroicon-s-plus'),
]; ];
} }

View File

@@ -4,13 +4,18 @@ declare(strict_types=1);
namespace App\Filament\Resources; namespace App\Filament\Resources;
use App\Filament\Resources\TaskResource\Pages; use App\Filament\Resources\TaskResource\Pages\CreateTask;
use App\Filament\Resources\TaskResource\Pages\EditTask;
use App\Filament\Resources\TaskResource\Pages\ListTasks;
use App\Models\Task; use App\Models\Task;
use Filament\Forms; use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\Select; use Filament\Forms\Components\Select;
use Filament\Forms\Form; use Filament\Forms\Components\TextInput;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Schemas\Schema;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter; use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table; use Filament\Tables\Table;
@@ -18,17 +23,17 @@ class TaskResource extends Resource
{ {
protected static ?string $model = Task::class; protected static ?string $model = Task::class;
protected static ?string $navigationIcon = 'heroicon-o-list-bullet'; protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-list-bullet';
protected static ?string $navigationGroup = 'Timetracking'; protected static string|\UnitEnum|null $navigationGroup = 'Timetracking';
protected static ?int $navigationSort = 3; protected static ?int $navigationSort = 3;
public static function form(Form $form): Form public static function form(Schema $schema): Schema
{ {
return $form return $schema
->schema([ ->components([
Forms\Components\TextInput::make('name') TextInput::make('name')
->label('Name') ->label('Name')
->required() ->required()
->maxLength(255), ->maxLength(255),
@@ -47,16 +52,16 @@ class TaskResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('name') TextColumn::make('name')
->searchable() ->searchable()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('project.name') TextColumn::make('project.name')
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('organization.name') TextColumn::make('organization.name')
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('created_at') TextColumn::make('created_at')
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('updated_at') TextColumn::make('updated_at')
->sortable(), ->sortable(),
]) ])
->filters([ ->filters([
@@ -70,12 +75,12 @@ class TaskResource extends Resource
->searchable(), ->searchable(),
]) ])
->defaultSort('created_at', 'desc') ->defaultSort('created_at', 'desc')
->actions([ ->recordActions([
Tables\Actions\EditAction::make(), EditAction::make(),
]) ])
->bulkActions([ ->toolbarActions([
Tables\Actions\BulkActionGroup::make([ BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(), DeleteBulkAction::make(),
]), ]),
]); ]);
} }
@@ -90,9 +95,9 @@ class TaskResource extends Resource
public static function getPages(): array public static function getPages(): array
{ {
return [ return [
'index' => Pages\ListTasks::route('/'), 'index' => ListTasks::route('/'),
'create' => Pages\CreateTask::route('/create'), 'create' => CreateTask::route('/create'),
'edit' => Pages\EditTask::route('/{record}/edit'), 'edit' => EditTask::route('/{record}/edit'),
]; ];
} }
} }

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\TaskResource\Pages; namespace App\Filament\Resources\TaskResource\Pages;
use App\Filament\Resources\TaskResource; use App\Filament\Resources\TaskResource;
use Filament\Actions; use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord; use Filament\Resources\Pages\EditRecord;
class EditTask extends EditRecord class EditTask extends EditRecord
@@ -15,7 +15,7 @@ class EditTask extends EditRecord
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [
Actions\DeleteAction::make() DeleteAction::make()
->icon('heroicon-m-trash'), ->icon('heroicon-m-trash'),
]; ];
} }

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\TaskResource\Pages; namespace App\Filament\Resources\TaskResource\Pages;
use App\Filament\Resources\TaskResource; use App\Filament\Resources\TaskResource;
use Filament\Actions; use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords; use Filament\Resources\Pages\ListRecords;
class ListTasks extends ListRecords class ListTasks extends ListRecords
@@ -15,7 +15,7 @@ class ListTasks extends ListRecords
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [
Actions\CreateAction::make() CreateAction::make()
->icon('heroicon-s-plus'), ->icon('heroicon-s-plus'),
]; ];
} }

View File

@@ -4,16 +4,20 @@ declare(strict_types=1);
namespace App\Filament\Resources; namespace App\Filament\Resources;
use App\Filament\Resources\TimeEntryResource\Pages; use App\Filament\Resources\TimeEntryResource\Pages\CreateTimeEntry;
use App\Filament\Resources\TimeEntryResource\Pages\EditTimeEntry;
use App\Filament\Resources\TimeEntryResource\Pages\ListTimeEntries;
use App\Models\Member; use App\Models\Member;
use App\Models\TimeEntry; use App\Models\TimeEntry;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\DateTimePicker; use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Select; use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle; use Filament\Forms\Components\Toggle;
use Filament\Forms\Form;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Schemas\Schema;
use Filament\Tables\Columns\TextColumn; use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter; use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table; use Filament\Tables\Table;
@@ -23,16 +27,16 @@ class TimeEntryResource extends Resource
{ {
protected static ?string $model = TimeEntry::class; protected static ?string $model = TimeEntry::class;
protected static ?string $navigationIcon = 'heroicon-o-clock'; protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-clock';
protected static ?string $navigationGroup = 'Timetracking'; protected static string|\UnitEnum|null $navigationGroup = 'Timetracking';
protected static ?int $navigationSort = 1; protected static ?int $navigationSort = 1;
public static function form(Form $form): Form public static function form(Schema $schema): Schema
{ {
return $form return $schema
->schema([ ->components([
TextInput::make('id') TextInput::make('id')
->label('ID') ->label('ID')
->readOnly() ->readOnly()
@@ -111,12 +115,12 @@ class TimeEntryResource extends Resource
->searchable(), ->searchable(),
]) ])
->defaultSort('created_at', 'desc') ->defaultSort('created_at', 'desc')
->actions([ ->recordActions([
Tables\Actions\EditAction::make(), EditAction::make(),
]) ])
->bulkActions([ ->toolbarActions([
Tables\Actions\BulkActionGroup::make([ BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(), DeleteBulkAction::make(),
]), ]),
]); ]);
} }
@@ -131,9 +135,9 @@ class TimeEntryResource extends Resource
public static function getPages(): array public static function getPages(): array
{ {
return [ return [
'index' => Pages\ListTimeEntries::route('/'), 'index' => ListTimeEntries::route('/'),
'create' => Pages\CreateTimeEntry::route('/create'), 'create' => CreateTimeEntry::route('/create'),
'edit' => Pages\EditTimeEntry::route('/{record}/edit'), 'edit' => EditTimeEntry::route('/{record}/edit'),
]; ];
} }
} }

View File

@@ -6,7 +6,7 @@ namespace App\Filament\Resources\TimeEntryResource\Pages;
use App\Filament\Resources\TimeEntryResource; use App\Filament\Resources\TimeEntryResource;
use App\Models\Member; use App\Models\Member;
use Filament\Actions; use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord; use Filament\Resources\Pages\EditRecord;
class EditTimeEntry extends EditRecord class EditTimeEntry extends EditRecord
@@ -16,7 +16,7 @@ class EditTimeEntry extends EditRecord
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [
Actions\DeleteAction::make() DeleteAction::make()
->icon('heroicon-m-trash'), ->icon('heroicon-m-trash'),
]; ];
} }

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\TimeEntryResource\Pages; namespace App\Filament\Resources\TimeEntryResource\Pages;
use App\Filament\Resources\TimeEntryResource; use App\Filament\Resources\TimeEntryResource;
use Filament\Actions; use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords; use Filament\Resources\Pages\ListRecords;
class ListTimeEntries extends ListRecords class ListTimeEntries extends ListRecords
@@ -15,7 +15,7 @@ class ListTimeEntries extends ListRecords
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [
Actions\CreateAction::make() CreateAction::make()
->icon('heroicon-s-plus'), ->icon('heroicon-s-plus'),
]; ];
} }

View File

@@ -4,12 +4,18 @@ declare(strict_types=1);
namespace App\Filament\Resources; namespace App\Filament\Resources;
use App\Filament\Resources\TokenResource\Pages; use App\Filament\Resources\TokenResource\Pages\ListTokens;
use App\Filament\Resources\TokenResource\Pages\ViewToken;
use App\Models\Passport\Token; use App\Models\Passport\Token;
use Filament\Forms; use Filament\Actions\ViewAction;
use Filament\Forms\Form; use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Schemas\Schema;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\TernaryFilter; use Filament\Tables\Filters\TernaryFilter;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
@@ -18,48 +24,48 @@ class TokenResource extends Resource
{ {
protected static ?string $model = Token::class; protected static ?string $model = Token::class;
protected static ?string $navigationIcon = 'heroicon-o-key'; protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-key';
protected static ?string $navigationGroup = 'Auth'; protected static string|\UnitEnum|null $navigationGroup = 'Auth';
protected static ?int $navigationSort = 6; protected static ?int $navigationSort = 6;
public static function form(Form $form): Form public static function form(Schema $schema): Schema
{ {
return $form return $schema
->columns(1) ->columns(1)
->schema([ ->components([
Forms\Components\TextInput::make('id') TextInput::make('id')
->label('ID') ->label('ID')
->disabled() ->disabled()
->visibleOn(['update', 'show']) ->visibleOn(['update', 'show'])
->readOnly() ->readOnly()
->maxLength(255), ->maxLength(255),
Forms\Components\TextInput::make('name') TextInput::make('name')
->label('Name') ->label('Name')
->required() ->required()
->maxLength(255), ->maxLength(255),
Forms\Components\Select::make('owner_id') Select::make('owner_id')
->label('User') ->label('User')
->relationship(name: 'user', titleAttribute: 'name') ->relationship(name: 'user', titleAttribute: 'name')
->searchable(['name']) ->searchable(['name'])
->disabled() ->disabled()
->required(), ->required(),
Forms\Components\Select::make('client_id') Select::make('client_id')
->label('Client') ->label('Client')
->relationship(name: 'client', titleAttribute: 'name') ->relationship(name: 'client', titleAttribute: 'name')
->searchable(['name']) ->searchable(['name'])
->required(), ->required(),
Forms\Components\Toggle::make('revoked') Toggle::make('revoked')
->label('Revoked') ->label('Revoked')
->required(), ->required(),
Forms\Components\DateTimePicker::make('expires_at') DateTimePicker::make('expires_at')
->label('Expires At') ->label('Expires At')
->disabled(), ->disabled(),
Forms\Components\DateTimePicker::make('created_at') DateTimePicker::make('created_at')
->label('Created At') ->label('Created At')
->disabled(), ->disabled(),
Forms\Components\DateTimePicker::make('updated_at') DateTimePicker::make('updated_at')
->label('Updated At') ->label('Updated At')
->disabled(), ->disabled(),
]); ]);
@@ -69,32 +75,32 @@ class TokenResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('name') TextColumn::make('name')
->searchable() ->searchable()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('user.name') TextColumn::make('user.name')
->searchable() ->searchable()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('client.name') TextColumn::make('client.name')
->searchable() ->searchable()
->sortable(), ->sortable(),
Tables\Columns\IconColumn::make('personal_access_client') IconColumn::make('personal_access_client')
->state(function (Token $token): bool { ->state(function (Token $token): bool {
return in_array('personal_access', $token->client->grant_types ?? [], true); return in_array('personal_access', $token->client->grant_types ?? [], true);
}) })
->boolean() ->boolean()
->label('API token?'), ->label('API token?'),
Tables\Columns\IconColumn::make('revoked') IconColumn::make('revoked')
->boolean() ->boolean()
->label('Revoked?') ->label('Revoked?')
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('expires_at') TextColumn::make('expires_at')
->dateTime() ->dateTime()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('created_at') TextColumn::make('created_at')
->dateTime() ->dateTime()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('updated_at') TextColumn::make('updated_at')
->dateTime() ->dateTime()
->sortable() ->sortable()
->toggleable(isToggledHiddenByDefault: true), ->toggleable(isToggledHiddenByDefault: true),
@@ -120,10 +126,10 @@ class TokenResource extends Resource
TernaryFilter::make('revoked') TernaryFilter::make('revoked')
->label('Revoked?'), ->label('Revoked?'),
]) ])
->actions([ ->recordActions([
Tables\Actions\ViewAction::make(), ViewAction::make(),
]) ])
->bulkActions([ ->toolbarActions([
]); ]);
} }
@@ -136,8 +142,8 @@ class TokenResource extends Resource
public static function getPages(): array public static function getPages(): array
{ {
return [ return [
'index' => Pages\ListTokens::route('/'), 'index' => ListTokens::route('/'),
'view' => Pages\ViewToken::route('/{record}'), 'view' => ViewToken::route('/{record}'),
]; ];
} }
} }

View File

@@ -6,7 +6,10 @@ namespace App\Filament\Resources;
use App\Enums\Weekday; use App\Enums\Weekday;
use App\Exceptions\Api\ApiException; use App\Exceptions\Api\ApiException;
use App\Filament\Resources\UserResource\Pages; use App\Filament\Resources\UserResource\Pages\CreateUser;
use App\Filament\Resources\UserResource\Pages\EditUser;
use App\Filament\Resources\UserResource\Pages\ListUsers;
use App\Filament\Resources\UserResource\Pages\ViewUser;
use App\Filament\Resources\UserResource\RelationManagers\OrganizationsRelationManager; use App\Filament\Resources\UserResource\RelationManagers\OrganizationsRelationManager;
use App\Filament\Resources\UserResource\RelationManagers\OwnedOrganizationsRelationManager; use App\Filament\Resources\UserResource\RelationManagers\OwnedOrganizationsRelationManager;
use App\Models\User; use App\Models\User;
@@ -15,12 +18,18 @@ use App\Service\TimezoneService;
use App\Service\UserService; use App\Service\UserService;
use Brick\Money\ISOCurrencyProvider; use Brick\Money\ISOCurrencyProvider;
use Exception; use Exception;
use Filament\Forms; use Filament\Actions\BulkAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Forms\Form; use Filament\Forms\Components\Toggle;
use Filament\Notifications\Notification; use Filament\Notifications\Notification;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Schemas\Schema;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\TernaryFilter; use Filament\Tables\Filters\TernaryFilter;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
@@ -28,26 +37,26 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Hash;
use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent; use Korridor\LaravelModelValidationRules\Rules\UniqueEloquent;
use STS\FilamentImpersonate\Tables\Actions\Impersonate; use STS\FilamentImpersonate\Actions\Impersonate;
class UserResource extends Resource class UserResource extends Resource
{ {
protected static ?string $model = User::class; protected static ?string $model = User::class;
protected static ?string $navigationIcon = 'heroicon-o-user'; protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-user';
protected static ?string $navigationGroup = 'Users'; protected static string|\UnitEnum|null $navigationGroup = 'Users';
protected static ?int $navigationSort = 6; protected static ?int $navigationSort = 6;
public static function form(Form $form): Form public static function form(Schema $schema): Schema
{ {
/** @var User|null $record */ /** @var User|null $record */
$record = $form->getRecord(); $record = $schema->getRecord();
return $form return $schema
->columns(1) ->columns(1)
->schema([ ->components([
TextInput::make('id') TextInput::make('id')
->label('ID') ->label('ID')
->disabled() ->disabled()
@@ -69,23 +78,23 @@ class UserResource extends Resource
'email:rfc,strict', 'email:rfc,strict',
]) ])
->maxLength(255), ->maxLength(255),
Forms\Components\Toggle::make('is_placeholder') Toggle::make('is_placeholder')
->label('Is Placeholder?') ->label('Is Placeholder?')
->hiddenOn(['create']) ->hiddenOn(['create'])
->disabledOn(['edit']), ->disabledOn(['edit']),
Forms\Components\DateTimePicker::make('email_verified_at') DateTimePicker::make('email_verified_at')
->label('Email Verified At') ->label('Email Verified At')
->hiddenOn(['create']) ->hiddenOn(['create'])
->nullable(), ->nullable(),
Forms\Components\Toggle::make('is_email_verified') Toggle::make('is_email_verified')
->label('Email Verified?') ->label('Email Verified?')
->visibleOn(['create']), ->visibleOn(['create']),
Forms\Components\Select::make('timezone') Select::make('timezone')
->label('Timezone') ->label('Timezone')
->options(fn (): array => app(TimezoneService::class)->getSelectOptions()) ->options(fn (): array => app(TimezoneService::class)->getSelectOptions())
->searchable() ->searchable()
->required(), ->required(),
Forms\Components\Select::make('week_start') Select::make('week_start')
->label('Week Start') ->label('Week Start')
->options(Weekday::class) ->options(Weekday::class)
->required(), ->required(),
@@ -103,7 +112,7 @@ class UserResource extends Resource
->visibleOn(['create']) ->visibleOn(['create'])
->required(fn (string $context): bool => $context === 'create') ->required(fn (string $context): bool => $context === 'create')
->maxLength(255), ->maxLength(255),
Forms\Components\Select::make('currency') Select::make('currency')
->label('Currency (Personal Organization)') ->label('Currency (Personal Organization)')
->options(function (): array { ->options(function (): array {
$currencies = ISOCurrencyProvider::getInstance()->getAvailableCurrencies(); $currencies = ISOCurrencyProvider::getInstance()->getAvailableCurrencies();
@@ -117,11 +126,11 @@ class UserResource extends Resource
->required() ->required()
->visibleOn(['create']) ->visibleOn(['create'])
->searchable(), ->searchable(),
Forms\Components\DateTimePicker::make('created_at') DateTimePicker::make('created_at')
->label('Created At') ->label('Created At')
->hiddenOn(['create']) ->hiddenOn(['create'])
->disabled(), ->disabled(),
Forms\Components\DateTimePicker::make('updated_at') DateTimePicker::make('updated_at')
->label('Updated At') ->label('Updated At')
->hiddenOn(['create']) ->hiddenOn(['create'])
->disabled(), ->disabled(),
@@ -132,25 +141,25 @@ class UserResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('name') TextColumn::make('name')
->searchable() ->searchable()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('email') TextColumn::make('email')
->icon('heroicon-m-envelope') ->icon('heroicon-m-envelope')
->searchable() ->searchable()
->sortable(), ->sortable(),
Tables\Columns\IconColumn::make('is_real_user') IconColumn::make('is_real_user')
->getStateUsing(fn (User $record): bool => ! $record->is_placeholder) ->getStateUsing(fn (User $record): bool => ! $record->is_placeholder)
->label('Real user?') ->label('Real user?')
->boolean(), ->boolean(),
Tables\Columns\IconColumn::make('email_verified') IconColumn::make('email_verified')
->getStateUsing(fn (User $record): bool => $record->email_verified_at !== null) ->getStateUsing(fn (User $record): bool => $record->email_verified_at !== null)
->label('Email verified?') ->label('Email verified?')
->boolean(), ->boolean(),
Tables\Columns\TextColumn::make('created_at') TextColumn::make('created_at')
->dateTime() ->dateTime()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('updated_at') TextColumn::make('updated_at')
->dateTime() ->dateTime()
->sortable() ->sortable()
->toggleable(isToggledHiddenByDefault: true), ->toggleable(isToggledHiddenByDefault: true),
@@ -178,7 +187,7 @@ class UserResource extends Resource
->attribute('email_verified_at') ->attribute('email_verified_at')
->nullable(), ->nullable(),
]) ])
->actions([ ->recordActions([
Impersonate::make()->before(function (User $record): void { Impersonate::make()->before(function (User $record): void {
if ($record->currentOrganization === null) { if ($record->currentOrganization === null) {
$organization = $record->organizations()->where('personal_team', '=', true)->first(); $organization = $record->organizations()->where('personal_team', '=', true)->first();
@@ -191,8 +200,8 @@ class UserResource extends Resource
app(UserService::class)->switchCurrentOrganization($record, $organization); app(UserService::class)->switchCurrentOrganization($record, $organization);
} }
}), }),
Tables\Actions\EditAction::make(), EditAction::make(),
Tables\Actions\DeleteAction::make() DeleteAction::make()
->hidden(fn (User $record) => $record->is(Auth::user())) ->hidden(fn (User $record) => $record->is(Auth::user()))
->using(function (User $record): void { ->using(function (User $record): void {
try { try {
@@ -207,8 +216,8 @@ class UserResource extends Resource
} }
}), }),
]) ])
->bulkActions([ ->toolbarActions([
Tables\Actions\BulkAction::make('Resend verification email') BulkAction::make('Resend verification email')
->icon('heroicon-o-paper-airplane') ->icon('heroicon-o-paper-airplane')
->action(function (Collection $records): void { ->action(function (Collection $records): void {
foreach ($records as $user) { foreach ($records as $user) {
@@ -230,10 +239,10 @@ class UserResource extends Resource
public static function getPages(): array public static function getPages(): array
{ {
return [ return [
'index' => Pages\ListUsers::route('/'), 'index' => ListUsers::route('/'),
'create' => Pages\CreateUser::route('/create'), 'create' => CreateUser::route('/create'),
'edit' => Pages\EditUser::route('/{record}/edit'), 'edit' => EditUser::route('/{record}/edit'),
'view' => Pages\ViewUser::route('/{record}'), 'view' => ViewUser::route('/{record}'),
]; ];
} }
} }

View File

@@ -22,7 +22,7 @@ class CreateUser extends CreateRecord
$data['email'], $data['email'],
$data['password_create'], $data['password_create'],
$data['timezone'], $data['timezone'],
Weekday::from($data['week_start']), $data['week_start'] instanceof Weekday ? $data['week_start'] : Weekday::from($data['week_start']),
$data['currency'], $data['currency'],
verifyEmail: (bool) $data['is_email_verified'] verifyEmail: (bool) $data['is_email_verified']
); );

View File

@@ -5,8 +5,9 @@ declare(strict_types=1);
namespace App\Filament\Resources\UserResource\Pages; namespace App\Filament\Resources\UserResource\Pages;
use App\Filament\Resources\UserResource; use App\Filament\Resources\UserResource;
use App\Filament\Resources\UserResource\Actions\DeleteUser;
use Filament\Resources\Pages\EditRecord; use Filament\Resources\Pages\EditRecord;
use STS\FilamentImpersonate\Pages\Actions\Impersonate; use STS\FilamentImpersonate\Actions\Impersonate;
class EditUser extends EditRecord class EditUser extends EditRecord
{ {
@@ -16,7 +17,7 @@ class EditUser extends EditRecord
{ {
return [ return [
Impersonate::make()->record($this->getRecord()), Impersonate::make()->record($this->getRecord()),
UserResource\Actions\DeleteUser::make(), DeleteUser::make(),
]; ];
} }
} }

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace App\Filament\Resources\UserResource\Pages; namespace App\Filament\Resources\UserResource\Pages;
use App\Filament\Resources\UserResource; use App\Filament\Resources\UserResource;
use Filament\Actions; use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords; use Filament\Resources\Pages\ListRecords;
class ListUsers extends ListRecords class ListUsers extends ListRecords
@@ -15,7 +15,7 @@ class ListUsers extends ListRecords
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [
Actions\CreateAction::make() CreateAction::make()
->icon('heroicon-s-plus'), ->icon('heroicon-s-plus'),
]; ];
} }

View File

@@ -7,7 +7,7 @@ namespace App\Filament\Resources\UserResource\Pages;
use App\Filament\Resources\UserResource; use App\Filament\Resources\UserResource;
use Filament\Actions\EditAction; use Filament\Actions\EditAction;
use Filament\Resources\Pages\ViewRecord; use Filament\Resources\Pages\ViewRecord;
use STS\FilamentImpersonate\Pages\Actions\Impersonate; use STS\FilamentImpersonate\Actions\Impersonate;
class ViewUser extends ViewRecord class ViewUser extends ViewRecord
{ {

View File

@@ -11,12 +11,13 @@ use App\Models\Member;
use App\Models\Organization; use App\Models\Organization;
use App\Models\User; use App\Models\User;
use App\Service\MemberService; use App\Service\MemberService;
use Filament\Actions\Action;
use Filament\Actions\DetachAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\Select; use Filament\Forms\Components\Select;
use Filament\Forms\Form;
use Filament\Notifications\Notification; use Filament\Notifications\Notification;
use Filament\Resources\RelationManagers\RelationManager; use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables; use Filament\Schemas\Schema;
use Filament\Tables\Actions\Action;
use Filament\Tables\Columns\TextColumn; use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
@@ -24,10 +25,10 @@ class OrganizationsRelationManager extends RelationManager
{ {
protected static string $relationship = 'organizations'; protected static string $relationship = 'organizations';
public function form(Form $form): Form public function form(Schema $schema): Schema
{ {
return $form return $schema
->schema([ ->components([
Select::make('role') Select::make('role')
->options(Role::class), ->options(Role::class),
]); ]);
@@ -46,21 +47,21 @@ class OrganizationsRelationManager extends RelationManager
]) ])
->headerActions([ ->headerActions([
]) ])
->actions([ ->recordActions([
Action::make('view') Action::make('view')
->icon('heroicon-o-eye') ->icon('heroicon-o-eye')
->color('gray') ->color('gray')
->url(fn (Organization $record): string => OrganizationResource::getUrl('view', [ ->url(fn (Organization $record): string => OrganizationResource::getUrl('view', [
'record' => $record->getKey(), 'record' => $record->getKey(),
])), ])),
Tables\Actions\EditAction::make() EditAction::make()
->using(function (Organization $record, array $data): Organization { ->using(function (Organization $record, array $data): Organization {
/** @var Member $member */ /** @var Member $member */
$member = $record->getRelation('membership'); $member = $record->getRelation('membership');
if ($data['role'] !== $member->role) { if ($data['role'] !== $member->role) {
try { try {
app(MemberService::class)->changeRole($member, $record, Role::from($data['role']), true); app(MemberService::class)->changeRole($member, $record, ($data['role'] instanceof Role ? $data['role'] : Role::from($data['role'])), true);
} catch (ApiException $exception) { } catch (ApiException $exception) {
Notification::make() Notification::make()
->danger() ->danger()
@@ -74,7 +75,7 @@ class OrganizationsRelationManager extends RelationManager
return $record; return $record;
}), }),
Tables\Actions\DetachAction::make() DetachAction::make()
->using(function (Organization $record): void { ->using(function (Organization $record): void {
/** @var User $user */ /** @var User $user */
$user = $this->getOwnerRecord(); $user = $this->getOwnerRecord();
@@ -94,7 +95,7 @@ class OrganizationsRelationManager extends RelationManager
} }
}), }),
]) ])
->bulkActions([ ->toolbarActions([
]); ]);
} }
} }

View File

@@ -6,10 +6,10 @@ namespace App\Filament\Resources\UserResource\RelationManagers;
use App\Filament\Resources\OrganizationResource; use App\Filament\Resources\OrganizationResource;
use App\Models\Organization; use App\Models\Organization;
use Filament\Forms\Form; use Filament\Actions\Action;
use Filament\Resources\RelationManagers\RelationManager; use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables; use Filament\Schemas\Schema;
use Filament\Tables\Actions\Action; use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
class OwnedOrganizationsRelationManager extends RelationManager class OwnedOrganizationsRelationManager extends RelationManager
@@ -18,10 +18,10 @@ class OwnedOrganizationsRelationManager extends RelationManager
protected static string $relationship = 'ownedOrganizations'; protected static string $relationship = 'ownedOrganizations';
public function form(Form $form): Form public function form(Schema $schema): Schema
{ {
return $form return $schema
->schema([ ->components([
]); ]);
} }
@@ -30,14 +30,14 @@ class OwnedOrganizationsRelationManager extends RelationManager
return $table return $table
->recordTitleAttribute('name') ->recordTitleAttribute('name')
->columns([ ->columns([
Tables\Columns\TextColumn::make('name'), TextColumn::make('name'),
]) ])
->filters([ ->filters([
// //
]) ])
->headerActions([ ->headerActions([
]) ])
->actions([ ->recordActions([
Action::make('view') Action::make('view')
->icon('heroicon-o-eye') ->icon('heroicon-o-eye')
->color('gray') ->color('gray')
@@ -51,7 +51,7 @@ class OwnedOrganizationsRelationManager extends RelationManager
])) ]))
->openUrlInNewTab(), ->openUrlInNewTab(),
]) ])
->bulkActions([ ->toolbarActions([
]); ]);
} }
} }

View File

@@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Cache;
class ServerOverview extends Widget class ServerOverview extends Widget
{ {
protected static string $view = 'filament.widgets.server-overview'; protected string $view = 'filament.widgets.server-overview';
/** /**
* @return array<string, mixed> * @return array<string, mixed>

View File

@@ -11,7 +11,7 @@ use Flowframe\Trend\TrendValue;
class TimeEntriesCreated extends ChartWidget class TimeEntriesCreated extends ChartWidget
{ {
protected static ?string $heading = 'Time Entries Created'; protected ?string $heading = 'Time Entries Created';
public ?string $filter = 'week'; public ?string $filter = 'week';
@@ -53,7 +53,7 @@ class TimeEntriesCreated extends ChartWidget
return [ return [
'datasets' => [ 'datasets' => [
[ [
'label' => self::$heading, 'label' => $this->heading,
'data' => $data->map(fn (TrendValue $value) => $value->aggregate), 'data' => $data->map(fn (TrendValue $value) => $value->aggregate),
], ],
], ],

View File

@@ -11,7 +11,7 @@ use Flowframe\Trend\TrendValue;
class TimeEntriesImported extends ChartWidget class TimeEntriesImported extends ChartWidget
{ {
protected static ?string $heading = 'Time Entries Imported'; protected ?string $heading = 'Time Entries Imported';
public ?string $filter = 'week'; public ?string $filter = 'week';
@@ -53,7 +53,7 @@ class TimeEntriesImported extends ChartWidget
return [ return [
'datasets' => [ 'datasets' => [
[ [
'label' => self::$heading, 'label' => $this->heading,
'data' => $data->map(fn (TrendValue $value) => $value->aggregate), 'data' => $data->map(fn (TrendValue $value) => $value->aggregate),
], ],
], ],

View File

@@ -11,7 +11,7 @@ use Flowframe\Trend\TrendValue;
class UserRegistrations extends ChartWidget class UserRegistrations extends ChartWidget
{ {
protected static ?string $heading = 'User Registrations'; protected ?string $heading = 'User Registrations';
public ?string $filter = 'week'; public ?string $filter = 'week';
@@ -54,7 +54,7 @@ class UserRegistrations extends ChartWidget
return [ return [
'datasets' => [ 'datasets' => [
[ [
'label' => self::$heading, 'label' => $this->heading,
'data' => $data->map(fn (TrendValue $value) => $value->aggregate), 'data' => $data->map(fn (TrendValue $value) => $value->aggregate),
], ],
], ],

View File

@@ -14,6 +14,7 @@ use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use RuntimeException;
class ApiTokenController extends Controller class ApiTokenController extends Controller
{ {
@@ -62,7 +63,7 @@ class ApiTokenController extends Controller
$tokenModel = $token->getToken(); $tokenModel = $token->getToken();
return new ApiTokenWithAccessTokenResource($tokenModel, $token->accessToken); return new ApiTokenWithAccessTokenResource($tokenModel, $token->accessToken);
} catch (\RuntimeException $exception) { } catch (RuntimeException $exception) {
report($exception); report($exception);
if (Str::contains($exception->getMessage(), ['Personal access client not found'])) { if (Str::contains($exception->getMessage(), ['Personal access client not found'])) {
throw new PersonalAccessClientIsNotConfiguredException; throw new PersonalAccessClientIsNotConfiguredException;

View File

@@ -33,6 +33,7 @@ use Illuminate\Http\JsonResponse;
use Illuminate\Http\Resources\Json\JsonResource; use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Throwable;
class MemberController extends Controller class MemberController extends Controller
{ {
@@ -146,7 +147,7 @@ class MemberController extends Controller
* *
* @throws AuthorizationException * @throws AuthorizationException
* @throws OnlyPlaceholdersCanBeMergedIntoAnotherMember * @throws OnlyPlaceholdersCanBeMergedIntoAnotherMember
* @throws \Throwable * @throws Throwable
* *
* @operationId mergeMember * @operationId mergeMember
*/ */

View File

@@ -55,6 +55,7 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use LogicException;
use Maatwebsite\Excel\Facades\Excel; use Maatwebsite\Excel\Facades\Excel;
use Spatie\TemporaryDirectory\TemporaryDirectory; use Spatie\TemporaryDirectory\TemporaryDirectory;
@@ -265,7 +266,7 @@ class TimeEntryController extends Controller
} }
$viewFile = file_get_contents(resource_path('views/reports/time-entry-index/pdf.blade.php')); $viewFile = file_get_contents(resource_path('views/reports/time-entry-index/pdf.blade.php'));
if ($viewFile === false) { if ($viewFile === false) {
throw new \LogicException('View file not found'); throw new LogicException('View file not found');
} }
$timeEntriesAggregateQuery = $this->getTimeEntriesAggregateQuery($organization, $request, $memberFilter); $timeEntriesAggregateQuery = $this->getTimeEntriesAggregateQuery($organization, $request, $memberFilter);
$aggregatedData = $timeEntryAggregationService->getAggregatedTimeEntries( $aggregatedData = $timeEntryAggregationService->getAggregatedTimeEntries(
@@ -293,7 +294,7 @@ class TimeEntryController extends Controller
]); ]);
$footerViewFile = file_get_contents(resource_path('views/reports/time-entry-index/pdf-footer.blade.php')); $footerViewFile = file_get_contents(resource_path('views/reports/time-entry-index/pdf-footer.blade.php'));
if ($footerViewFile === false) { if ($footerViewFile === false) {
throw new \LogicException('View file not found'); throw new LogicException('View file not found');
} }
$footerHtml = Blade::render($footerViewFile); $footerHtml = Blade::render($footerViewFile);
if ($debug) { if ($debug) {
@@ -495,7 +496,7 @@ class TimeEntryController extends Controller
]); ]);
$viewFile = file_get_contents(resource_path('views/reports/time-entry-aggregate/pdf.blade.php')); $viewFile = file_get_contents(resource_path('views/reports/time-entry-aggregate/pdf.blade.php'));
if ($viewFile === false) { if ($viewFile === false) {
throw new \LogicException('View file not found'); throw new LogicException('View file not found');
} }
$html = Blade::render($viewFile, [ $html = Blade::render($viewFile, [
'aggregatedData' => $aggregatedData, 'aggregatedData' => $aggregatedData,
@@ -512,7 +513,7 @@ class TimeEntryController extends Controller
]); ]);
$footerViewFile = file_get_contents(resource_path('views/reports/time-entry-aggregate/pdf-footer.blade.php')); $footerViewFile = file_get_contents(resource_path('views/reports/time-entry-aggregate/pdf-footer.blade.php'));
if ($footerViewFile === false) { if ($footerViewFile === false) {
throw new \LogicException('View file not found'); throw new LogicException('View file not found');
} }
$footerHtml = Blade::render($footerViewFile); $footerHtml = Blade::render($footerViewFile);
if ($debug) { if ($debug) {

View File

@@ -16,6 +16,7 @@ use Inertia\Inertia;
use Inertia\Response; use Inertia\Response;
use Laravel\Fortify\Actions\DisableTwoFactorAuthentication; use Laravel\Fortify\Actions\DisableTwoFactorAuthentication;
use Laravel\Fortify\Features; use Laravel\Fortify\Features;
use stdClass;
class UserProfileController extends Controller class UserProfileController extends Controller
{ {
@@ -103,7 +104,7 @@ class UserProfileController extends Controller
/** /**
* Get the current sessions. * Get the current sessions.
* *
* @return array<int, object{agent: array{is_desktop: bool, platform: string|null, browser: string|null}, ip_address: string, is_current_device: bool, last_active: string}&\stdClass> * @return array<int, object{agent: array{is_desktop: bool, platform: string|null, browser: string|null}, ip_address: string, is_current_device: bool, last_active: string}&stdClass>
*/ */
public function sessions(Request $request): array public function sessions(Request $request): array
{ {

View File

@@ -9,6 +9,7 @@ use App\Models\Organization;
use App\Service\BillingContract; use App\Service\BillingContract;
use Closure; use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use LogicException;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
class CheckOrganizationBlocked class CheckOrganizationBlocked
@@ -25,7 +26,7 @@ class CheckOrganizationBlocked
$organization = $request->route('organization'); $organization = $request->route('organization');
if (! ($organization instanceof Organization)) { if (! ($organization instanceof Organization)) {
throw new \LogicException('The organization must be loaded before this middleware.'); throw new LogicException('The organization must be loaded before this middleware.');
} }
/** @var BillingContract $billing */ /** @var BillingContract $billing */

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Http\Middleware; namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Middleware\TrustHosts as BaseTrustHosts; use Illuminate\Http\Middleware\TrustHosts as BaseTrustHosts;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
@@ -39,7 +40,7 @@ class TrustHosts extends BaseTrustHosts
} }
/** /**
* @param \Closure(Request): Response $next * @param Closure(Request):Response $next
*/ */
public function handle(Request $request, $next) public function handle(Request $request, $next)
{ {

View File

@@ -13,11 +13,13 @@ use App\Enums\Weekday;
use App\Http\Requests\V1\BaseFormRequest; use App\Http\Requests\V1\BaseFormRequest;
use App\Models\Organization; use App\Models\Organization;
use App\Service\TimeEntryFilter; use App\Service\TimeEntryFilter;
use Closure;
use Illuminate\Contracts\Validation\Rule as LegacyValidationRule; use Illuminate\Contracts\Validation\Rule as LegacyValidationRule;
use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
use LogicException;
/** /**
* @property Organization $organization Organization from model binding * @property Organization $organization Organization from model binding
@@ -27,7 +29,7 @@ class ReportStoreRequest extends BaseFormRequest
/** /**
* Get the validation rules that apply to the request. * Get the validation rules that apply to the request.
* *
* @return array<string, array<string|ValidationRule|LegacyValidationRule|\Closure>> * @return array<string, array<string|ValidationRule|LegacyValidationRule|Closure>>
*/ */
public function rules(): array public function rules(): array
{ {
@@ -85,7 +87,7 @@ class ReportStoreRequest extends BaseFormRequest
], ],
'properties.client_ids.*' => [ 'properties.client_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }
@@ -101,7 +103,7 @@ class ReportStoreRequest extends BaseFormRequest
], ],
'properties.project_ids.*' => [ 'properties.project_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }
@@ -117,7 +119,7 @@ class ReportStoreRequest extends BaseFormRequest
], ],
'properties.tag_ids.*' => [ 'properties.tag_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }
@@ -137,7 +139,7 @@ class ReportStoreRequest extends BaseFormRequest
], ],
'properties.task_ids.*' => [ 'properties.task_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }
@@ -213,7 +215,7 @@ class ReportStoreRequest extends BaseFormRequest
{ {
$start = Carbon::createFromFormat('Y-m-d\TH:i:s\Z', $this->input('properties.start')); $start = Carbon::createFromFormat('Y-m-d\TH:i:s\Z', $this->input('properties.start'));
if ($start === null) { if ($start === null) {
throw new \LogicException('Start date validation is not working'); throw new LogicException('Start date validation is not working');
} }
return $start; return $start;
@@ -223,7 +225,7 @@ class ReportStoreRequest extends BaseFormRequest
{ {
$end = Carbon::createFromFormat('Y-m-d\TH:i:s\Z', $this->input('properties.end')); $end = Carbon::createFromFormat('Y-m-d\TH:i:s\Z', $this->input('properties.end'));
if ($end === null) { if ($end === null) {
throw new \LogicException('End date validation is not working'); throw new LogicException('End date validation is not working');
} }
return $end; return $end;

View File

@@ -19,11 +19,13 @@ use App\Models\Tag;
use App\Models\Task; use App\Models\Task;
use App\Models\User; use App\Models\User;
use App\Service\TimeEntryFilter; use App\Service\TimeEntryFilter;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent; use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
use LogicException;
/** /**
* @property Organization $organization * @property Organization $organization
@@ -33,7 +35,7 @@ class TimeEntryAggregateExportRequest extends BaseFormRequest
/** /**
* Get the validation rules that apply to the request. * Get the validation rules that apply to the request.
* *
* @return array<string, array<string|ValidationRule|\Illuminate\Contracts\Validation\Rule|\Closure>> * @return array<string, array<string|ValidationRule|\Illuminate\Contracts\Validation\Rule|Closure>>
*/ */
public function rules(): array public function rules(): array
{ {
@@ -97,7 +99,7 @@ class TimeEntryAggregateExportRequest extends BaseFormRequest
], ],
'project_ids.*' => [ 'project_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }
@@ -114,7 +116,7 @@ class TimeEntryAggregateExportRequest extends BaseFormRequest
], ],
'client_ids.*' => [ 'client_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }
@@ -131,7 +133,7 @@ class TimeEntryAggregateExportRequest extends BaseFormRequest
], ],
'tag_ids.*' => [ 'tag_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }
@@ -152,7 +154,7 @@ class TimeEntryAggregateExportRequest extends BaseFormRequest
], ],
'task_ids.*' => [ 'task_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }
@@ -236,7 +238,7 @@ class TimeEntryAggregateExportRequest extends BaseFormRequest
{ {
$start = Carbon::createFromFormat('Y-m-d\TH:i:s\Z', $this->input('start'), 'UTC'); $start = Carbon::createFromFormat('Y-m-d\TH:i:s\Z', $this->input('start'), 'UTC');
if ($start === null) { if ($start === null) {
throw new \LogicException('Start date validation is not working'); throw new LogicException('Start date validation is not working');
} }
return $start; return $start;
@@ -246,7 +248,7 @@ class TimeEntryAggregateExportRequest extends BaseFormRequest
{ {
$end = Carbon::createFromFormat('Y-m-d\TH:i:s\Z', $this->input('end'), 'UTC'); $end = Carbon::createFromFormat('Y-m-d\TH:i:s\Z', $this->input('end'), 'UTC');
if ($end === null) { if ($end === null) {
throw new \LogicException('End date validation is not working'); throw new LogicException('End date validation is not working');
} }
return $end; return $end;

View File

@@ -17,6 +17,7 @@ use App\Models\Tag;
use App\Models\Task; use App\Models\Task;
use App\Models\User; use App\Models\User;
use App\Service\TimeEntryFilter; use App\Service\TimeEntryFilter;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
@@ -31,7 +32,7 @@ class TimeEntryAggregateRequest extends BaseFormRequest
/** /**
* Get the validation rules that apply to the request. * Get the validation rules that apply to the request.
* *
* @return array<string, array<string|ValidationRule|\Illuminate\Contracts\Validation\Rule|\Closure>> * @return array<string, array<string|ValidationRule|\Illuminate\Contracts\Validation\Rule|Closure>>
*/ */
public function rules(): array public function rules(): array
{ {
@@ -83,7 +84,7 @@ class TimeEntryAggregateRequest extends BaseFormRequest
], ],
'project_ids.*' => [ 'project_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }
@@ -100,7 +101,7 @@ class TimeEntryAggregateRequest extends BaseFormRequest
], ],
'client_ids.*' => [ 'client_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }
@@ -117,7 +118,7 @@ class TimeEntryAggregateRequest extends BaseFormRequest
], ],
'tag_ids.*' => [ 'tag_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }
@@ -138,7 +139,7 @@ class TimeEntryAggregateRequest extends BaseFormRequest
], ],
'task_ids.*' => [ 'task_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }

View File

@@ -15,11 +15,13 @@ use App\Models\Project;
use App\Models\Tag; use App\Models\Tag;
use App\Models\Task; use App\Models\Task;
use App\Service\TimeEntryFilter; use App\Service\TimeEntryFilter;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent; use Korridor\LaravelModelValidationRules\Rules\ExistsEloquent;
use LogicException;
/** /**
* @property Organization $organization * @property Organization $organization
@@ -29,7 +31,7 @@ class TimeEntryIndexExportRequest extends TimeEntryIndexRequest
/** /**
* Get the validation rules that apply to the request. * Get the validation rules that apply to the request.
* *
* @return array<string, array<string|ValidationRule|\Illuminate\Contracts\Validation\Rule|\Closure>> * @return array<string, array<string|ValidationRule|\Illuminate\Contracts\Validation\Rule|Closure>>
*/ */
public function rules(): array public function rules(): array
{ {
@@ -68,7 +70,7 @@ class TimeEntryIndexExportRequest extends TimeEntryIndexRequest
], ],
'client_ids.*' => [ 'client_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }
@@ -85,7 +87,7 @@ class TimeEntryIndexExportRequest extends TimeEntryIndexRequest
], ],
'project_ids.*' => [ 'project_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }
@@ -102,7 +104,7 @@ class TimeEntryIndexExportRequest extends TimeEntryIndexRequest
], ],
'tag_ids.*' => [ 'tag_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }
@@ -123,7 +125,7 @@ class TimeEntryIndexExportRequest extends TimeEntryIndexRequest
], ],
'task_ids.*' => [ 'task_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }
@@ -200,7 +202,7 @@ class TimeEntryIndexExportRequest extends TimeEntryIndexRequest
{ {
$start = Carbon::createFromFormat('Y-m-d\TH:i:s\Z', $this->input('start'), 'UTC'); $start = Carbon::createFromFormat('Y-m-d\TH:i:s\Z', $this->input('start'), 'UTC');
if ($start === null) { if ($start === null) {
throw new \LogicException('Start date validation is not working'); throw new LogicException('Start date validation is not working');
} }
return $start; return $start;
@@ -210,7 +212,7 @@ class TimeEntryIndexExportRequest extends TimeEntryIndexRequest
{ {
$end = Carbon::createFromFormat('Y-m-d\TH:i:s\Z', $this->input('end'), 'UTC'); $end = Carbon::createFromFormat('Y-m-d\TH:i:s\Z', $this->input('end'), 'UTC');
if ($end === null) { if ($end === null) {
throw new \LogicException('End date validation is not working'); throw new LogicException('End date validation is not working');
} }
return $end; return $end;

View File

@@ -15,6 +15,7 @@ use App\Models\Project;
use App\Models\Tag; use App\Models\Tag;
use App\Models\Task; use App\Models\Task;
use App\Service\TimeEntryFilter; use App\Service\TimeEntryFilter;
use Closure;
use Illuminate\Contracts\Validation\Rule as RuleContract; use Illuminate\Contracts\Validation\Rule as RuleContract;
use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
@@ -29,7 +30,7 @@ class TimeEntryIndexRequest extends BaseFormRequest
/** /**
* Get the validation rules that apply to the request. * Get the validation rules that apply to the request.
* *
* @return array<string, array<string|ValidationRule|RuleContract|\Closure>> * @return array<string, array<string|ValidationRule|RuleContract|Closure>>
*/ */
public function rules(): array public function rules(): array
{ {
@@ -61,7 +62,7 @@ class TimeEntryIndexRequest extends BaseFormRequest
], ],
'client_ids.*' => [ 'client_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }
@@ -78,7 +79,7 @@ class TimeEntryIndexRequest extends BaseFormRequest
], ],
'project_ids.*' => [ 'project_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }
@@ -95,7 +96,7 @@ class TimeEntryIndexRequest extends BaseFormRequest
], ],
'tag_ids.*' => [ 'tag_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }
@@ -116,7 +117,7 @@ class TimeEntryIndexRequest extends BaseFormRequest
], ],
'task_ids.*' => [ 'task_ids.*' => [
'string', 'string',
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryFilter::NONE_VALUE) { if ($value === TimeEntryFilter::NONE_VALUE) {
return; return;
} }

View File

@@ -12,6 +12,7 @@ use App\Models\Project;
use App\Models\Tag; use App\Models\Tag;
use App\Models\Task; use App\Models\Task;
use App\Service\PermissionStore; use App\Service\PermissionStore;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
@@ -26,7 +27,7 @@ class TimeEntryStoreRequest extends BaseFormRequest
/** /**
* Get the validation rules that apply to the request. * Get the validation rules that apply to the request.
* *
* @return array<string, array<string|\Closure|ValidationRule|\Illuminate\Contracts\Validation\Rule>> * @return array<string, array<string|Closure|ValidationRule|\Illuminate\Contracts\Validation\Rule>>
*/ */
public function rules(): array public function rules(): array
{ {
@@ -94,7 +95,7 @@ class TimeEntryStoreRequest extends BaseFormRequest
// Type of the time entry (work time or a break) // Type of the time entry (work time or a break)
'type' => [ 'type' => [
Rule::enum(TimeEntryType::class), Rule::enum(TimeEntryType::class),
function (string $attribute, mixed $value, \Closure $fail): void { function (string $attribute, mixed $value, Closure $fail): void {
if ($value === TimeEntryType::Break->value && ! $this->organization->breaks_enabled) { if ($value === TimeEntryType::Break->value && ! $this->organization->breaks_enabled) {
$fail('Breaks are disabled for this organization.'); $fail('Breaks are disabled for this organization.');
} }

View File

@@ -13,6 +13,7 @@ use App\Models\Tag;
use App\Models\Task; use App\Models\Task;
use App\Models\TimeEntry; use App\Models\TimeEntry;
use App\Service\PermissionStore; use App\Service\PermissionStore;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
@@ -29,7 +30,7 @@ class TimeEntryUpdateRequest extends BaseFormRequest
/** /**
* Get the validation rules that apply to the request. * Get the validation rules that apply to the request.
* *
* @return array<string, array<string|\Closure|ValidationRule|\Illuminate\Contracts\Validation\Rule|ProhibitedIf|ConditionalRules>> * @return array<string, array<string|Closure|ValidationRule|\Illuminate\Contracts\Validation\Rule|ProhibitedIf|ConditionalRules>>
*/ */
public function rules(): array public function rules(): array
{ {
@@ -105,7 +106,7 @@ class TimeEntryUpdateRequest extends BaseFormRequest
// Type of the time entry (work time or a break) // Type of the time entry (work time or a break)
'type' => [ 'type' => [
Rule::enum(TimeEntryType::class), Rule::enum(TimeEntryType::class),
function (string $attribute, mixed $value, \Closure $fail) use ($timeEntry): void { function (string $attribute, mixed $value, Closure $fail) use ($timeEntry): void {
// While breaks are disabled, entries that already are breaks may stay // While breaks are disabled, entries that already are breaks may stay
// breaks, but converting a work entry to a break is not allowed. // breaks, but converting a work entry to a break is not allowed.
if ($value === TimeEntryType::Break->value if ($value === TimeEntryType::Break->value

View File

@@ -25,7 +25,7 @@ use Dedoc\Scramble\Scramble;
use Dedoc\Scramble\Support\Generator\OpenApi; use Dedoc\Scramble\Support\Generator\OpenApi;
use Dedoc\Scramble\Support\Generator\SecurityScheme; use Dedoc\Scramble\Support\Generator\SecurityScheme;
use Dedoc\Scramble\Support\Generator\SecuritySchemes\OAuthFlow; use Dedoc\Scramble\Support\Generator\SecuritySchemes\OAuthFlow;
use Filament\Forms\Components\Section; use Filament\Schemas\Components\Section;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Database\Eloquent\Relations\Relation;

View File

@@ -13,7 +13,7 @@ use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\DisableBladeIconComponents; use Filament\Http\Middleware\DisableBladeIconComponents;
use Filament\Http\Middleware\DispatchServingFilamentEvent; use Filament\Http\Middleware\DispatchServingFilamentEvent;
use Filament\Navigation\NavigationGroup; use Filament\Navigation\NavigationGroup;
use Filament\Pages; use Filament\Pages\Dashboard;
use Filament\Panel; use Filament\Panel;
use Filament\PanelProvider; use Filament\PanelProvider;
use Filament\Support\Colors\Color; use Filament\Support\Colors\Color;
@@ -41,7 +41,7 @@ class AdminPanelProvider extends PanelProvider
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources') ->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages') ->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
->pages([ ->pages([
Pages\Dashboard::class, Dashboard::class,
]) ])
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets') ->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
->widgets([ ->widgets([
@@ -51,7 +51,6 @@ class AdminPanelProvider extends PanelProvider
TimeEntriesCreated::class, TimeEntriesCreated::class,
TimeEntriesImported::class, TimeEntriesImported::class,
]) ])
->viteTheme('resources/css/filament/admin/theme.css')
->plugins([ ->plugins([
EnvironmentIndicatorPlugin::make() EnvironmentIndicatorPlugin::make()
->color(fn () => match (App::environment()) { ->color(fn () => match (App::environment()) {

View File

@@ -15,6 +15,7 @@ use App\Models\User;
use Exception; use Exception;
use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Http;
use Log; use Log;
use Throwable;
class ApiService class ApiService
{ {
@@ -42,7 +43,7 @@ class ApiService
return null; return null;
} }
} catch (\Throwable $e) { } catch (Throwable $e) {
Log::warning('Failed to check for update', [ Log::warning('Failed to check for update', [
'message' => $e->getMessage(), 'message' => $e->getMessage(),
]); ]);

View File

@@ -16,6 +16,7 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use RuntimeException;
class DashboardService class DashboardService
{ {
@@ -101,7 +102,7 @@ class DashboardService
$value1 = Carbon::createFromFormat('Y-m-d', $possibleDates->first(), $timeZone); $value1 = Carbon::createFromFormat('Y-m-d', $possibleDates->first(), $timeZone);
$value2 = Carbon::createFromFormat('Y-m-d', $possibleDates->last(), $timeZone); $value2 = Carbon::createFromFormat('Y-m-d', $possibleDates->last(), $timeZone);
if ($value2 === null || $value1 === null) { if ($value2 === null || $value1 === null) {
throw new \RuntimeException('Provided date is not valid'); throw new RuntimeException('Provided date is not valid');
} }
if ($value1->gt($value2)) { if ($value1->gt($value2)) {
$last = $value1; $last = $value1;

View File

@@ -17,6 +17,7 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use InvalidArgumentException;
class ReportPropertiesDto implements Castable class ReportPropertiesDto implements Castable
{ {
@@ -101,15 +102,15 @@ class ReportPropertiesDto implements Castable
public function get(Model $model, string $key, mixed $value, array $attributes): ReportPropertiesDto public function get(Model $model, string $key, mixed $value, array $attributes): ReportPropertiesDto
{ {
if (! is_string($value)) { if (! is_string($value)) {
throw new \InvalidArgumentException('The given value is not a string'); throw new InvalidArgumentException('The given value is not a string');
} }
$data = json_decode($value, false); $data = json_decode($value, false);
if ($data === null) { if ($data === null) {
throw new \InvalidArgumentException('The given value is not a JSON string'); throw new InvalidArgumentException('The given value is not a JSON string');
} }
foreach (self::REQUIRED_PROPERTIES as $property) { foreach (self::REQUIRED_PROPERTIES as $property) {
if (! property_exists($data, $property)) { if (! property_exists($data, $property)) {
throw new \InvalidArgumentException('The given JSON string does not contain the required property "'.$property.'"'); throw new InvalidArgumentException('The given JSON string does not contain the required property "'.$property.'"');
} }
} }
$dto = new ReportPropertiesDto; $dto = new ReportPropertiesDto;
@@ -145,7 +146,7 @@ class ReportPropertiesDto implements Castable
public function set(Model $model, string $key, mixed $value, array $attributes): string public function set(Model $model, string $key, mixed $value, array $attributes): string
{ {
if (! ($value instanceof ReportPropertiesDto)) { if (! ($value instanceof ReportPropertiesDto)) {
throw new \InvalidArgumentException('The given value is not an instance of ReportPropertiesDto'); throw new InvalidArgumentException('The given value is not an instance of ReportPropertiesDto');
} }
$data = (object) [ $data = (object) [
@@ -171,7 +172,7 @@ class ReportPropertiesDto implements Castable
$jsonString = json_encode($data); $jsonString = json_encode($data);
if ($jsonString === false) { if ($jsonString === false) {
throw new \InvalidArgumentException('Could not encode the given data to a JSON string'); throw new InvalidArgumentException('Could not encode the given data to a JSON string');
} }
return $jsonString; return $jsonString;
@@ -188,10 +189,10 @@ class ReportPropertiesDto implements Castable
$collection = new Collection; $collection = new Collection;
foreach ($ids as $id) { foreach ($ids as $id) {
if (! is_string($id)) { if (! is_string($id)) {
throw new \InvalidArgumentException('The given ID is not a string'); throw new InvalidArgumentException('The given ID is not a string');
} }
if ($id !== TimeEntryFilter::NONE_VALUE && ! Str::isUuid($id)) { if ($id !== TimeEntryFilter::NONE_VALUE && ! Str::isUuid($id)) {
throw new \InvalidArgumentException('The given ID is not a valid UUID'); throw new InvalidArgumentException('The given ID is not a valid UUID');
} }
$collection->push($id); $collection->push($id);
} }

View File

@@ -9,6 +9,7 @@ use Closure;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use RuntimeException;
/** /**
* @template TModel of Model * @template TModel of Model
@@ -133,7 +134,7 @@ class ImportDatabaseHelper
{ {
$jsonData = json_encode($data); $jsonData = json_encode($data);
if ($jsonData === false) { if ($jsonData === false) {
throw new \RuntimeException('Failed to encode data to JSON'); throw new RuntimeException('Failed to encode data to JSON');
} }
return md5($jsonData); return md5($jsonData);
@@ -164,7 +165,7 @@ class ImportDatabaseHelper
return $this->createEntity($identifierData, $createValues, $externalIdentifier); return $this->createEntity($identifierData, $createValues, $externalIdentifier);
} else { } else {
throw new \RuntimeException('Not implemented'); throw new RuntimeException('Not implemented');
} }
} }

View File

@@ -9,13 +9,14 @@ use Illuminate\Support\Carbon;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use League\Csv\Exception as CsvException; use League\Csv\Exception as CsvException;
use League\Csv\Reader; use League\Csv\Reader;
use Override;
class ClockifyProjectsImporter extends DefaultImporter class ClockifyProjectsImporter extends DefaultImporter
{ {
/** /**
* @throws ImportException * @throws ImportException
*/ */
#[\Override] #[Override]
public function importData(string $data, string $timezone): void public function importData(string $data, string $timezone): void
{ {
try { try {
@@ -129,13 +130,13 @@ class ClockifyProjectsImporter extends DefaultImporter
return $billableRateKey; return $billableRateKey;
} }
#[\Override] #[Override]
public function getName(): string public function getName(): string
{ {
return __('importer.clockify_projects.name'); return __('importer.clockify_projects.name');
} }
#[\Override] #[Override]
public function getDescription(): string public function getDescription(): string
{ {
return __('importer.clockify_projects.description'); return __('importer.clockify_projects.description');

View File

@@ -15,6 +15,7 @@ use Illuminate\Support\Carbon;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use League\Csv\Exception as CsvException; use League\Csv\Exception as CsvException;
use League\Csv\Reader; use League\Csv\Reader;
use Override;
class ClockifyTimeEntriesImporter extends DefaultImporter class ClockifyTimeEntriesImporter extends DefaultImporter
{ {
@@ -44,7 +45,7 @@ class ClockifyTimeEntriesImporter extends DefaultImporter
/** /**
* @throws ImportException * @throws ImportException
*/ */
#[\Override] #[Override]
public function importData(string $data, string $timezone): void public function importData(string $data, string $timezone): void
{ {
try { try {
@@ -262,13 +263,13 @@ class ClockifyTimeEntriesImporter extends DefaultImporter
return null; return null;
} }
#[\Override] #[Override]
public function getName(): string public function getName(): string
{ {
return __('importer.clockify_time_entries.name'); return __('importer.clockify_time_entries.name');
} }
#[\Override] #[Override]
public function getDescription(): string public function getDescription(): string
{ {
return __('importer.clockify_time_entries.description'); return __('importer.clockify_time_entries.description');

View File

@@ -18,6 +18,7 @@ use App\Service\ColorService;
use App\Service\Import\ImportDatabaseHelper; use App\Service\Import\ImportDatabaseHelper;
use App\Service\TimezoneService; use App\Service\TimezoneService;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Override;
abstract class DefaultImporter implements ImporterContract abstract class DefaultImporter implements ImporterContract
{ {
@@ -193,7 +194,7 @@ abstract class DefaultImporter implements ImporterContract
} }
} }
#[\Override] #[Override]
public function getReport(): ReportDto public function getReport(): ReportDto
{ {
return new ReportDto( return new ReportDto(

View File

@@ -14,6 +14,7 @@ use Illuminate\Support\Carbon;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use League\Csv\Exception as CsvException; use League\Csv\Exception as CsvException;
use League\Csv\Reader; use League\Csv\Reader;
use Override;
class GenericTimeEntriesImporter extends DefaultImporter class GenericTimeEntriesImporter extends DefaultImporter
{ {
@@ -59,7 +60,7 @@ class GenericTimeEntriesImporter extends DefaultImporter
/** /**
* @throws ImportException * @throws ImportException
*/ */
#[\Override] #[Override]
public function importData(string $data, string $timezone): void public function importData(string $data, string $timezone): void
{ {
try { try {
@@ -195,13 +196,13 @@ class GenericTimeEntriesImporter extends DefaultImporter
} }
} }
#[\Override] #[Override]
public function getName(): string public function getName(): string
{ {
return __('importer.generic_time_entries.name'); return __('importer.generic_time_entries.name');
} }
#[\Override] #[Override]
public function getDescription(): string public function getDescription(): string
{ {
return __('importer.generic_time_entries.description'); return __('importer.generic_time_entries.description');

View File

@@ -7,6 +7,7 @@ namespace App\Service\Import\Importers;
use Exception; use Exception;
use League\Csv\Exception as CsvException; use League\Csv\Exception as CsvException;
use League\Csv\Reader; use League\Csv\Reader;
use Override;
class HarvestClientsImporter extends DefaultImporter class HarvestClientsImporter extends DefaultImporter
{ {
@@ -20,7 +21,7 @@ class HarvestClientsImporter extends DefaultImporter
/** /**
* @throws ImportException * @throws ImportException
*/ */
#[\Override] #[Override]
public function importData(string $data, string $timezone): void public function importData(string $data, string $timezone): void
{ {
try { try {
@@ -62,13 +63,13 @@ class HarvestClientsImporter extends DefaultImporter
} }
} }
#[\Override] #[Override]
public function getName(): string public function getName(): string
{ {
return __('importer.harvest_clients.name'); return __('importer.harvest_clients.name');
} }
#[\Override] #[Override]
public function getDescription(): string public function getDescription(): string
{ {
return __('importer.harvest_clients.description'); return __('importer.harvest_clients.description');

View File

@@ -8,6 +8,7 @@ use Exception;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use League\Csv\Exception as CsvException; use League\Csv\Exception as CsvException;
use League\Csv\Reader; use League\Csv\Reader;
use Override;
class HarvestProjectsImporter extends DefaultImporter class HarvestProjectsImporter extends DefaultImporter
{ {
@@ -24,7 +25,7 @@ class HarvestProjectsImporter extends DefaultImporter
/** /**
* @throws ImportException * @throws ImportException
*/ */
#[\Override] #[Override]
public function importData(string $data, string $timezone): void public function importData(string $data, string $timezone): void
{ {
try { try {
@@ -93,13 +94,13 @@ class HarvestProjectsImporter extends DefaultImporter
} }
} }
#[\Override] #[Override]
public function getName(): string public function getName(): string
{ {
return __('importer.harvest_projects.name'); return __('importer.harvest_projects.name');
} }
#[\Override] #[Override]
public function getDescription(): string public function getDescription(): string
{ {
return __('importer.harvest_projects.description'); return __('importer.harvest_projects.description');

View File

@@ -4,4 +4,6 @@ declare(strict_types=1);
namespace App\Service\Import\Importers; namespace App\Service\Import\Importers;
class ImportException extends \Exception {} use Exception;
class ImportException extends Exception {}

View File

@@ -4,6 +4,8 @@ declare(strict_types=1);
namespace App\Service\Import\Importers; namespace App\Service\Import\Importers;
use InvalidArgumentException;
class ImporterProvider class ImporterProvider
{ {
/** /**
@@ -49,7 +51,7 @@ class ImporterProvider
public function getImporter(string $type): ImporterContract public function getImporter(string $type): ImporterContract
{ {
if (! array_key_exists($type, $this->importers)) { if (! array_key_exists($type, $this->importers)) {
throw new \InvalidArgumentException('Invalid importer type'); throw new InvalidArgumentException('Invalid importer type');
} }
return new $this->importers[$type]; return new $this->importers[$type];

View File

@@ -14,6 +14,7 @@ use Illuminate\Support\Carbon;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use League\Csv\Exception as CsvException; use League\Csv\Exception as CsvException;
use League\Csv\Reader; use League\Csv\Reader;
use Override;
class TogglTimeEntriesImporter extends DefaultImporter class TogglTimeEntriesImporter extends DefaultImporter
{ {
@@ -43,7 +44,7 @@ class TogglTimeEntriesImporter extends DefaultImporter
/** /**
* @throws ImportException * @throws ImportException
*/ */
#[\Override] #[Override]
public function importData(string $data, string $timezone): void public function importData(string $data, string $timezone): void
{ {
try { try {
@@ -193,13 +194,13 @@ class TogglTimeEntriesImporter extends DefaultImporter
} }
} }
#[\Override] #[Override]
public function getName(): string public function getName(): string
{ {
return __('importer.toggl_time_entries.name'); return __('importer.toggl_time_entries.name');
} }
#[\Override] #[Override]
public function getDescription(): string public function getDescription(): string
{ {
return __('importer.toggl_time_entries.description'); return __('importer.toggl_time_entries.description');

View File

@@ -14,6 +14,7 @@ use League\Csv\CannotInsertRecord;
use League\Csv\Exception; use League\Csv\Exception;
use League\Csv\UnavailableStream; use League\Csv\UnavailableStream;
use League\Csv\Writer; use League\Csv\Writer;
use LogicException;
use Spatie\TemporaryDirectory\TemporaryDirectory; use Spatie\TemporaryDirectory\TemporaryDirectory;
/** /**
@@ -116,7 +117,7 @@ abstract class CsvExport
private function validateRow(array $row): void private function validateRow(array $row): void
{ {
if (array_keys($row) !== static::HEADER) { if (array_keys($row) !== static::HEADER) {
throw new \LogicException('Invalid row'); throw new LogicException('Invalid row');
} }
} }
} }

View File

@@ -20,6 +20,7 @@ use Illuminate\Support\Carbon;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use InvalidArgumentException;
class TimeEntryAggregationService class TimeEntryAggregationService
{ {
@@ -526,7 +527,7 @@ class TimeEntryAggregationService
public function timeSlotsBetween(Carbon $start, Carbon $end, string $timezone, Weekday $startOfWeek, TimeEntryAggregationTypeInterval $interval, string $format): Collection public function timeSlotsBetween(Carbon $start, Carbon $end, string $timezone, Weekday $startOfWeek, TimeEntryAggregationTypeInterval $interval, string $format): Collection
{ {
if ($start->gt($end)) { if ($start->gt($end)) {
throw new \InvalidArgumentException('Start date must be before end date'); throw new InvalidArgumentException('Start date must be before end date');
} }
$slots = new Collection; $slots = new Collection;
$current = $start->copy()->timezone($timezone); $current = $start->copy()->timezone($timezone);
@@ -539,7 +540,7 @@ class TimeEntryAggregationService
} elseif ($interval === TimeEntryAggregationTypeInterval::Year) { } elseif ($interval === TimeEntryAggregationTypeInterval::Year) {
$current->startOfYear(); $current->startOfYear();
} else { } else {
throw new \InvalidArgumentException('Invalid interval'); throw new InvalidArgumentException('Invalid interval');
} }
while ($current->lt($end)) { while ($current->lt($end)) {

View File

@@ -6,6 +6,7 @@ namespace App\Service;
use App\Models\User; use App\Models\User;
use Carbon\CarbonTimeZone; use Carbon\CarbonTimeZone;
use Exception;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
@@ -287,7 +288,7 @@ class TimezoneService
{ {
try { try {
return new CarbonTimeZone($user->timezone); return new CarbonTimeZone($user->timezone);
} catch (\Exception $e) { } catch (Exception $e) {
Log::error('User has a invalid timezone', [ Log::error('User has a invalid timezone', [
'user_id' => $user->getKey(), 'user_id' => $user->getKey(),
'timezone' => $user->timezone, 'timezone' => $user->timezone,

View File

@@ -20,6 +20,7 @@ use App\Models\User;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use InvalidArgumentException;
class UserService class UserService
{ {
@@ -148,7 +149,7 @@ class UserService
->whereBelongsTo($newOwner, 'user') ->whereBelongsTo($newOwner, 'user')
->first(); ->first();
if ($userMembership === null) { if ($userMembership === null) {
throw new \InvalidArgumentException('User is not a member of the organization'); throw new InvalidArgumentException('User is not a member of the organization');
} }
$userMembership->role = Role::Owner->value; $userMembership->role = Role::Owner->value;
$userMembership->save(); $userMembership->save();

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Support; namespace App\Support;
use finfo;
use Symfony\Component\Mime\MimeTypes; use Symfony\Component\Mime\MimeTypes;
class Base64File class Base64File
@@ -27,7 +28,7 @@ class Base64File
return null; return null;
} }
$mimeType = (new \finfo(FILEINFO_MIME_TYPE))->buffer($decoded); $mimeType = (new finfo(FILEINFO_MIME_TYPE))->buffer($decoded);
if ($mimeType === false) { if ($mimeType === false) {
return null; return null;
} }

View File

@@ -7,14 +7,14 @@
"require": { "require": {
"php": "8.3.*", "php": "8.3.*",
"ext-zip": "*", "ext-zip": "*",
"brick/money": "^0.10.0", "brick/money": "^0.11.2",
"datomatic/laravel-enum-helper": "^2.0.0", "datomatic/laravel-enum-helper": "^2.0.0",
"dedoc/scramble": "^0.12.2", "dedoc/scramble": "^0.13.43",
"filament/filament": "^3.2", "filament/filament": "^5.0",
"flowframe/laravel-trend": "^0.4.0", "flowframe/laravel-trend": "^0.5.0",
"gotenberg/gotenberg-php": "^2.8", "gotenberg/gotenberg-php": "^2.8",
"guzzlehttp/guzzle": "^7.2", "guzzlehttp/guzzle": "^7.2",
"inertiajs/inertia-laravel": "^2.0.3", "inertiajs/inertia-laravel": "^3.3.4",
"korridor/laravel-computed-attributes": "^3.1", "korridor/laravel-computed-attributes": "^3.1",
"korridor/laravel-has-many-sync": "^3.1", "korridor/laravel-has-many-sync": "^3.1",
"korridor/laravel-model-validation-rules": "^3.0", "korridor/laravel-model-validation-rules": "^3.0",
@@ -26,15 +26,15 @@
"league/csv": "^9.16.0", "league/csv": "^9.16.0",
"league/flysystem-aws-s3-v3": "^3.0", "league/flysystem-aws-s3-v3": "^3.0",
"league/iso3166": "^4.3", "league/iso3166": "^4.3",
"maatwebsite/excel": "^3.1", "maatwebsite/excel": "^4.0.3",
"mobiledetect/mobiledetectlib": "^4.11", "mobiledetect/mobiledetectlib": "^4.11",
"novadaemon/filament-pretty-json": "^2.2", "novadaemon/filament-pretty-json": "^4.0",
"nwidart/laravel-modules": "^12.0.4", "nwidart/laravel-modules": "^13.0.0",
"owen-it/laravel-auditing": "^14.0.0", "owen-it/laravel-auditing": "^14.0.0",
"pxlrbt/filament-environment-indicator": "^2.1.0", "pxlrbt/filament-environment-indicator": "^3.0",
"spatie/temporary-directory": "^2.2", "spatie/temporary-directory": "^2.2",
"staudenmeir/eloquent-json-relations": "^1.1", "staudenmeir/eloquent-json-relations": "^1.1",
"stechstudio/filament-impersonate": "^3.8", "stechstudio/filament-impersonate": "^5.0",
"tightenco/ziggy": "^2.1.0", "tightenco/ziggy": "^2.1.0",
"tpetry/laravel-postgresql-enhanced": "^3.0.0", "tpetry/laravel-postgresql-enhanced": "^3.0.0",
"wikimedia/composer-merge-plugin": "^2.1.0" "wikimedia/composer-merge-plugin": "^2.1.0"

3118
composer.lock generated

File diff suppressed because it is too large Load Diff

208
config/inertia.php Normal file
View File

@@ -0,0 +1,208 @@
<?php
declare(strict_types=1);
return [
/*
|--------------------------------------------------------------------------
| Server Side Rendering
|--------------------------------------------------------------------------
|
| These options configures if and how Inertia uses Server Side Rendering
| to pre-render the initial visits made to your application's pages.
|
| You can specify a custom SSR bundle path, or omit it to let Inertia
| try and automatically detect it for you.
|
| Do note that enabling these options will NOT automatically make SSR work,
| as a separate rendering service needs to be available. To learn more,
| please visit https://inertiajs.com/server-side-rendering
|
*/
'ssr' => [
'enabled' => (bool) env('INERTIA_SSR_ENABLED', true),
'runtime' => env('INERTIA_SSR_RUNTIME', 'node'),
'ensure_runtime_exists' => (bool) env('INERTIA_SSR_ENSURE_RUNTIME_EXISTS', false),
'url' => env('INERTIA_SSR_URL', 'http://127.0.0.1:13714'),
'hot_url' => env('INERTIA_SSR_HOT_URL'),
'ensure_bundle_exists' => (bool) env('INERTIA_SSR_ENSURE_BUNDLE_EXISTS', true),
// 'bundle' => base_path('bootstrap/ssr/ssr.mjs'),
/*
|--------------------------------------------------------------------------
| SSR Error Handling
|--------------------------------------------------------------------------
|
| When SSR rendering fails, Inertia gracefully falls back to client-side
| rendering. Set throw_on_error to true to throw an exception instead.
| This is useful for E2E testing where you want SSR errors to fail loudly.
|
| You can also listen for the Inertia\Ssr\SsrRenderFailed event to handle
| failures in your own way (e.g., logging, error tracking service).
|
*/
'throw_on_error' => (bool) env('INERTIA_SSR_THROW_ON_ERROR', false),
],
/*
|--------------------------------------------------------------------------
| Pages
|--------------------------------------------------------------------------
|
| Set `ensure_pages_exist` to true if you want to enforce that Inertia page
| components exist on disk when rendering a page. This is useful for
| catching missing or misnamed components.
|
| The `paths` and `extensions` options define where to look for page
| components and which file extensions to consider.
|
*/
'pages' => [
'ensure_pages_exist' => false,
'paths' => [
resource_path('js/Pages'),
base_path('extensions/Invoicing/resources/js/Pages'),
],
'extensions' => [
'js',
'jsx',
'svelte',
'ts',
'tsx',
'vue',
],
],
/*
|--------------------------------------------------------------------------
| Testing
|--------------------------------------------------------------------------
|
| When using `assertInertia`, the assertion attempts to locate the
| component as a file relative to the `pages.paths` AND with any of
| the `pages.extensions` specified above.
|
| You can disable this behavior by setting `ensure_pages_exist`
| to false.
|
*/
'testing' => [
'ensure_pages_exist' => true,
],
/*
|--------------------------------------------------------------------------
| Expose Shared Prop Keys
|--------------------------------------------------------------------------
|
| When enabled, each page response includes a `sharedProps` metadata key
| listing the top-level prop keys that were registered via `Inertia::share`.
| The frontend can use this to carry shared props over during instant visits.
|
*/
'expose_shared_prop_keys' => true,
/*
|--------------------------------------------------------------------------
| History
|--------------------------------------------------------------------------
|
| Enable `encrypt` to encrypt page data before it is stored in the
| browser's history state, preventing sensitive information from
| being accessible after logout. Can also be enabled per-request
| or via the `inertia.encrypt` middleware.
|
*/
'history' => [
'encrypt' => (bool) env('INERTIA_ENCRYPT_HISTORY', false),
],
/*
|--------------------------------------------------------------------------
| DevTools
|--------------------------------------------------------------------------
|
| Records one entry per request to disk so the DevTools Chrome extension may
| read it back over HTTP. Recording is limited to your local environment.
| See https://inertiajs.com/docs/devtools for the gate and storage options.
|
*/
'devtools' => [
'enabled' => env('INERTIA_DEVTOOLS_ENABLED'),
'except' => ['telescope*', 'horizon*', '_inertia/devtools*'],
'storage' => [
'path' => storage_path('inertia-devtools'),
'ttl' => (int) env('INERTIA_DEVTOOLS_TTL_HOURS', 24),
'prune_interval' => (int) env('INERTIA_DEVTOOLS_PRUNE_INTERVAL_SECONDS', 300),
'limit' => (int) env('INERTIA_DEVTOOLS_LIMIT', 100),
],
'middleware' => ['web'],
'gate' => env('INERTIA_DEVTOOLS_GATE'),
'redact' => [
'keys' => [
'password',
'password_confirmation',
'current_password',
'token',
'_token',
'access_token',
'refresh_token',
'secret',
'client_secret',
'api_key',
],
'headers' => [
'cookie',
'set-cookie',
'authorization',
'proxy-authorization',
'x-xsrf-token',
'x-csrf-token',
],
],
],
];

View File

@@ -1,14 +1,14 @@
{ {
"Billing": { "Billing": {
"repository": "solidtime-io/extension-billing", "repository": "solidtime-io/extension-billing",
"ref": "main" "ref": "feature/composer-update"
}, },
"Services": { "Services": {
"repository": "solidtime-io/extension-services", "repository": "solidtime-io/extension-services",
"ref": "v0.0.2" "ref": "feature/composer-update"
}, },
"Invoicing": { "Invoicing": {
"repository": "solidtime-io/extension-invoicing", "repository": "solidtime-io/extension-invoicing",
"ref": "v0.0.6" "ref": "feature/composer-update"
} }
} }

View File

@@ -0,0 +1 @@
@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-cyrillic-ext-wght-normal-SP7Z6XGK.woff2") format("woff2-variations");unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-cyrillic-wght-normal-DR6K5BQD.woff2") format("woff2-variations");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-greek-ext-wght-normal-A2J6H3EX.woff2") format("woff2-variations");unicode-range:U+1F00-1FFF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-greek-wght-normal-ZABHMKQG.woff2") format("woff2-variations");unicode-range:U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-vietnamese-wght-normal-VWEHJHBA.woff2") format("woff2-variations");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-latin-ext-wght-normal-ZIT2UBIY.woff2") format("woff2-variations");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-latin-wght-normal-DIHYUR35.woff2") format("woff2-variations");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

View File

@@ -1,10 +0,0 @@
import preset from '../../../../vendor/filament/filament/tailwind.config.preset';
export default {
presets: [preset],
content: [
'./app/Filament/**/*.php',
'./resources/views/filament/**/*.blade.php',
'./vendor/filament/**/*.blade.php',
],
};

View File

@@ -1,3 +0,0 @@
@import '/vendor/filament/filament/resources/css/theme.css';
@config 'tailwind.config.js';

View File

@@ -21,7 +21,7 @@ class CurrencyEndpointTest extends ApiEndpointTestAbstract
// Assert // Assert
$response->assertOk(); $response->assertOk();
$response->assertJsonCount(166); $response->assertJsonCount(214);
$responseObj = collect($response->json()); $responseObj = collect($response->json());
$this->assertSame([ $this->assertSame([
'code' => 'EUR', 'code' => 'EUR',

View File

@@ -5,11 +5,7 @@ import checker from 'vite-plugin-checker';
import { collectModuleAssetsPaths, collectModulePlugins } from './vite-module-loader.js'; import { collectModuleAssetsPaths, collectModulePlugins } from './vite-module-loader.js';
async function getConfig() { async function getConfig() {
const paths = [ const paths = ['resources/js/app.ts', 'resources/css/app.css'];
'resources/js/app.ts',
'resources/css/app.css',
'resources/css/filament/admin/theme.css',
];
const modulePaths = await collectModuleAssetsPaths('extensions'); const modulePaths = await collectModuleAssetsPaths('extensions');
const additionalPlugins = await collectModulePlugins('extensions'); const additionalPlugins = await collectModulePlugins('extensions');