improve
This commit is contained in:
@@ -59,21 +59,22 @@ class CardResource extends Resource
|
|||||||
TextInput::make('number')
|
TextInput::make('number')
|
||||||
->label(__('Card number'))
|
->label(__('Card number'))
|
||||||
->mask('9999 9999 9999 9999')
|
->mask('9999 9999 9999 9999')
|
||||||
->columnSpan('1')
|
->dehydrateStateUsing(fn ($state) => str_replace(' ', '', $state))
|
||||||
|
->columnSpan(1)
|
||||||
->required(),
|
->required(),
|
||||||
|
|
||||||
Select::make('month')
|
Select::make('month')
|
||||||
->label(__('Card month'))
|
->label(__('Card month'))
|
||||||
->options(DateHelper::staticNumberMonths())
|
->options(DateHelper::staticNumberMonths())
|
||||||
->native(false)
|
->native(false)
|
||||||
->columnSpan('1')
|
->columnSpan(1)
|
||||||
->required(),
|
->required(),
|
||||||
|
|
||||||
Select::make('year')
|
Select::make('year')
|
||||||
->label(__('Card year'))
|
->label(__('Card year'))
|
||||||
->options(DateHelper::staticNumberYears())
|
->options(DateHelper::staticNumberYears())
|
||||||
->native(false)
|
->native(false)
|
||||||
->columnSpan('1')
|
->columnSpan(1)
|
||||||
->required(),
|
->required(),
|
||||||
|
|
||||||
TextInput::make('name')
|
TextInput::make('name')
|
||||||
@@ -90,6 +91,7 @@ class CardResource extends Resource
|
|||||||
->columns([
|
->columns([
|
||||||
TextColumn::make('number')
|
TextColumn::make('number')
|
||||||
->label(__('Card number'))
|
->label(__('Card number'))
|
||||||
|
->formatStateUsing(fn ($state) => trim(chunk_split($state, 4, ' ')))
|
||||||
->searchable(),
|
->searchable(),
|
||||||
|
|
||||||
TextColumn::make('name')
|
TextColumn::make('name')
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ class CardBalanceRepository
|
|||||||
{
|
{
|
||||||
/** @var \App\Modules\CardBalance\Type\CardBalanceResponse */
|
/** @var \App\Modules\CardBalance\Type\CardBalanceResponse */
|
||||||
$data = $this->fetchCardBalance(
|
$data = $this->fetchCardBalance(
|
||||||
passport_serie: user()->getOption('passport_serie'),
|
passport_serie: user()->getOption('passport_serie') ?? 'I',
|
||||||
passport_id: user()->getOption('passport_id'),
|
passport_id: user()->getOption('passport_id') ?? '909090',
|
||||||
card_masked: Str::mask($record->number, '*', 6, 6),
|
card_masked: Str::mask($record->number, '*', 6, 6),
|
||||||
card_expire_date: $record->month.'/'.substr($record->year, 2),
|
card_expire_date: $record->month.'/'.substr($record->year, 2),
|
||||||
);
|
);
|
||||||
@@ -68,8 +68,11 @@ class CardBalanceRepository
|
|||||||
|
|
||||||
curl_close($curl);
|
curl_close($curl);
|
||||||
|
|
||||||
return Str::isJson($response)
|
/** @var object */
|
||||||
|
$safeResponse = Str::isJson($response)
|
||||||
? json_decode($response)
|
? json_decode($response)
|
||||||
: emptyClass(errCode: 1, message: 'Connection issue to VP');
|
: emptyClass(errCode: 1, message: 'Connection issue to VP');
|
||||||
|
|
||||||
|
return $safeResponse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user