Skip to content

Commit

Permalink
fix(admin): reg status display on user
Browse files Browse the repository at this point in the history
  • Loading branch information
Fenrikur committed Feb 15, 2024
1 parent 864256d commit 5c16f2b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
})

])
Expand Down
12 changes: 6 additions & 6 deletions app/Filament/Resources/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'))),
]),
]);
}
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/Client/RegSysClientController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5c16f2b

Please sign in to comment.