diff --git a/app/Filament/Resources/ApplicationResource/RelationManagers/UserRelationManager.php b/app/Filament/Resources/ApplicationResource/RelationManagers/UserRelationManager.php index 90ba315..050cc82 100644 --- a/app/Filament/Resources/ApplicationResource/RelationManagers/UserRelationManager.php +++ b/app/Filament/Resources/ApplicationResource/RelationManagers/UserRelationManager.php @@ -39,14 +39,14 @@ public function table(Table $table): Table Tables\Columns\TextColumn::make('packages booked') ->badge() - ->formatStateUsing(fn (?User $record): string => implode(RegSysClientController::getPackages($record->reg_id)) ?? ''), + ->getStateUsing(fn (?User $record): string => implode(array_replace(['none'], RegSysClientController::getPackages($record?->reg_id) ?? ['n/a']))), Tables\Columns\TextColumn::make('reg status') ->badge() - ->formatStateUsing(fn (?User $record): string => RegSysClientController::getSingleReg($record->reg_id)['status'] ?? '') + ->getStateUsing(fn (?User $record): string => RegSysClientController::getSingleReg($record?->reg_id)['status'] ?? 'n/a') ->color(fn (string $state): string => match ($state) { 'paid' => 'success', 'cancelled' => 'danger', - default => 'secondary', + default => 'primary', }) ]) diff --git a/app/Filament/Resources/UserResource.php b/app/Filament/Resources/UserResource.php index 563837f..f7f337e 100644 --- a/app/Filament/Resources/UserResource.php +++ b/app/Filament/Resources/UserResource.php @@ -39,12 +39,12 @@ public static function form(Form $form): Form ->maxLength(255), Forms\Components\Fieldset::make('Reg status')->inlineLabel()->columns(1)->schema([ - Forms\Components\Placeholder::make('packages booked') - ->content(fn (?User $record): string => implode(RegSysClientController::getPackages($record->reg_id) ?? [])), - Forms\Components\Placeholder::make('reg status') - ->content(fn (?User $record): string => RegSysClientController::getSingleReg($record->reg_id)['status'] ?? ''), - Forms\Components\Placeholder::make('active app synced to regsys') - ->content(fn (?User $record): string => (RegSysClientController::getAdditionalInfoDealerReg($record->reg_id) ? "yes" : "no") ?? ''), + Forms\Components\Placeholder::make('Packages booked') + ->content(fn (?User $record): string => implode(array_replace(['none'], RegSysClientController::getPackages($record?->reg_id) ?? ['n/a']))), + Forms\Components\Placeholder::make('Registration status') + ->content(fn (?User $record): string => RegSysClientController::getSingleReg($record?->reg_id)['status'] ?? 'n/a'), + Forms\Components\Placeholder::make('Flagged as active application?') + ->content(fn (?User $record): string => (($hasFlag = RegSysClientController::getAdditionalInfoDealerReg($record?->reg_id)) === null ? 'n/a' : ($hasFlag ? 'yes' : 'no'))), ]), ]); } diff --git a/app/Http/Controllers/Client/RegSysClientController.php b/app/Http/Controllers/Client/RegSysClientController.php index 8b883f6..95c2252 100644 --- a/app/Http/Controllers/Client/RegSysClientController.php +++ b/app/Http/Controllers/Client/RegSysClientController.php @@ -184,13 +184,13 @@ public static function setAdditionalInfoDealerReg(string $regId, bool $hasDealer /** * Check whether the `dealerreg` additional info flag is set for the given registration. * - * @param string $regId Registration number to retrieve the flag for - * @return bool|null true or false depending on whether the flag is set on the registration, null if an error was encountered. + * @param null|string $regId Registration number to retrieve the flag for + * @return null|bool true or false depending on whether the flag is set on the registration, null if an error was encountered. * @throws BindingResolutionException * @throws NotFoundExceptionInterface * @throws ContainerExceptionInterface */ - public static function getAdditionalInfoDealerReg(string $regId): bool|null + public static function getAdditionalInfoDealerReg(?string $regId): ?bool { if (empty($regId)) { return null;