From c94ac5d12dac47190334e082f2963be6110b0ce8 Mon Sep 17 00:00:00 2001 From: Nurmuhammet Allanov Date: Sat, 15 Nov 2025 21:32:03 +0500 Subject: [PATCH] some stan --- .../Cards/CardOrders/Pages/ListCardOrders.php | 9 --------- .../VisaMasterPaymentOrderResource.php | 5 +++++ app/Modules/CurrencyRate/Models/CurrencyRate.php | 4 +++- .../Repositories/OnlinePaymentRepository.php | 4 ++-- .../Filament/Actions/PayVisaMasterPaymentAction.php | 11 ++++++----- .../Models/VisaMasterPaymentOrder.php | 12 ++++++------ .../Models/VisaMasterPaymentOrderItem.php | 4 ++-- .../VisaMasterPaymentOrderRepository.php | 8 ++++---- 8 files changed, 28 insertions(+), 29 deletions(-) diff --git a/app/Filament/Clusters/Cards/CardOrders/Pages/ListCardOrders.php b/app/Filament/Clusters/Cards/CardOrders/Pages/ListCardOrders.php index d5ef782..b309b45 100644 --- a/app/Filament/Clusters/Cards/CardOrders/Pages/ListCardOrders.php +++ b/app/Filament/Clusters/Cards/CardOrders/Pages/ListCardOrders.php @@ -31,14 +31,5 @@ class ListCardOrders extends ListRecords } return $data; - - return [ - null => Tab::make('All'), - 'new' => Tab::make()->query(fn ($query) => $query->where('status', 'new')), - 'processing' => Tab::make()->query(fn ($query) => $query->where('status', 'processing')), - 'shipped' => Tab::make()->query(fn ($query) => $query->where('status', 'shipped')), - 'delivered' => Tab::make()->query(fn ($query) => $query->where('status', 'delivered')), - 'cancelled' => Tab::make()->query(fn ($query) => $query->where('status', 'cancelled')), - ]; } } diff --git a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php index 011c894..97e29b0 100644 --- a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php +++ b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php @@ -71,6 +71,11 @@ class VisaMasterPaymentOrderResource extends Resource ]; } + /** + * Get the query for the record route binding + * + * @return \Illuminate\Database\Eloquent\Builder<\App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder> + */ public static function getRecordRouteBindingEloquentQuery(): Builder { return parent::getRecordRouteBindingEloquentQuery() diff --git a/app/Modules/CurrencyRate/Models/CurrencyRate.php b/app/Modules/CurrencyRate/Models/CurrencyRate.php index 0716ed9..a879db5 100644 --- a/app/Modules/CurrencyRate/Models/CurrencyRate.php +++ b/app/Modules/CurrencyRate/Models/CurrencyRate.php @@ -22,11 +22,13 @@ class CurrencyRate extends Model /** * Get the user's first name. + * + * @return Attribute */ protected function name(): Attribute { return Attribute::make( - get: fn () => $this->currency_from.'-'.$this->currency_to, + get: fn (): string => $this->currency_from.'-'.$this->currency_to, ); } diff --git a/app/Modules/OnlinePayment/Repositories/OnlinePaymentRepository.php b/app/Modules/OnlinePayment/Repositories/OnlinePaymentRepository.php index 5b65ab3..98a2bca 100644 --- a/app/Modules/OnlinePayment/Repositories/OnlinePaymentRepository.php +++ b/app/Modules/OnlinePayment/Repositories/OnlinePaymentRepository.php @@ -46,7 +46,7 @@ class OnlinePaymentRepository /** * Online payment */ - protected ?OnlinePayment $onlinePayment; + protected OnlinePayment $onlinePayment; /** * If payment is successful @@ -117,7 +117,7 @@ class OnlinePaymentRepository /** * Online payment */ - public function onlinePayment(): ?OnlinePayment + public function onlinePayment(): OnlinePayment { return $this->onlinePayment; } diff --git a/app/Modules/VisaMasterPaymentOrder/Filament/Actions/PayVisaMasterPaymentAction.php b/app/Modules/VisaMasterPaymentOrder/Filament/Actions/PayVisaMasterPaymentAction.php index 5b45812..5ec76dd 100644 --- a/app/Modules/VisaMasterPaymentOrder/Filament/Actions/PayVisaMasterPaymentAction.php +++ b/app/Modules/VisaMasterPaymentOrder/Filament/Actions/PayVisaMasterPaymentAction.php @@ -74,17 +74,18 @@ class PayVisaMasterPaymentAction ->helperText(sprintf('Iň ýokary möçberi: %s TMT', $max_value)) ->live() ->afterStateUpdated(function (Set $set, ?string $state) use ($usd_to_tmt, $bankFee, $gbusFee) { - if (! $state || $state === 0 || $state === '') { + if (is_null($state) || $state == 0 || $state == '') { $set('usd_rate', ''); return; } + $state = floatval($state); - $usd_rate = floatval(number_format($state / $usd_to_tmt, 2, '.', '')); - $total_amount = floatval(number_format($state, 2, '.', '')) + $bankFee + $gbusFee; + $usd_rate = $state / $usd_to_tmt; + $total_amount = $state + $bankFee + $gbusFee; - $set('usd_rate', $usd_rate); - $set('total_amount', $total_amount); + $set('usd_rate', number_format($usd_rate, 2, '.', '')); + $set('total_amount', number_format($total_amount, 2, '.', '')); }), TextInput::make('usd_rate') diff --git a/app/Modules/VisaMasterPaymentOrder/Models/VisaMasterPaymentOrder.php b/app/Modules/VisaMasterPaymentOrder/Models/VisaMasterPaymentOrder.php index 5564ffc..7650743 100644 --- a/app/Modules/VisaMasterPaymentOrder/Models/VisaMasterPaymentOrder.php +++ b/app/Modules/VisaMasterPaymentOrder/Models/VisaMasterPaymentOrder.php @@ -21,9 +21,9 @@ use Spatie\MediaLibrary\InteractsWithMedia; * @property string $email * @property string $region * @property string $address - * @property array $sender_datas - * @property array $payment_reciever - * @property array $documents + * @property array $sender_datas + * @property array $payment_reciever + * @property array $documents * @property string $status * @property string $notes * @property string $sender_full_name @@ -77,7 +77,7 @@ class VisaMasterPaymentOrder extends Model implements HasMedia /** * User * - * @return BelongsTo + * @return BelongsTo */ public function user(): BelongsTo { @@ -87,7 +87,7 @@ class VisaMasterPaymentOrder extends Model implements HasMedia /** * Branch * - * @return BelongsTo + * @return BelongsTo */ public function branch(): BelongsTo { @@ -97,7 +97,7 @@ class VisaMasterPaymentOrder extends Model implements HasMedia /** * Payment itmes * - * @return HasMany + * @return HasMany */ public function paymentItems(): HasMany { diff --git a/app/Modules/VisaMasterPaymentOrder/Models/VisaMasterPaymentOrderItem.php b/app/Modules/VisaMasterPaymentOrder/Models/VisaMasterPaymentOrderItem.php index 7b63b8b..8ac7843 100644 --- a/app/Modules/VisaMasterPaymentOrder/Models/VisaMasterPaymentOrderItem.php +++ b/app/Modules/VisaMasterPaymentOrder/Models/VisaMasterPaymentOrderItem.php @@ -38,7 +38,7 @@ class VisaMasterPaymentOrderItem extends Model /** * Parent order * - * @return BelongsTo + * @return BelongsTo */ public function parent(): BelongsTo { @@ -48,7 +48,7 @@ class VisaMasterPaymentOrderItem extends Model /** * Online payment * - * @return BelongsTo + * @return BelongsTo */ public function onlinePayment(): BelongsTo { diff --git a/app/Modules/VisaMasterPaymentOrder/Repositories/VisaMasterPaymentOrderRepository.php b/app/Modules/VisaMasterPaymentOrder/Repositories/VisaMasterPaymentOrderRepository.php index 19004d9..3505d58 100644 --- a/app/Modules/VisaMasterPaymentOrder/Repositories/VisaMasterPaymentOrderRepository.php +++ b/app/Modules/VisaMasterPaymentOrder/Repositories/VisaMasterPaymentOrderRepository.php @@ -16,17 +16,17 @@ class VisaMasterPaymentOrderRepository /** * Bank fee */ - public int|string|float $bankFee = 20; + public int|float $bankFee = 20; /** * Gbus fee */ - public int|string|float $gbusFee = 3; + public int|float $gbusFee = 3; /** * Bank fee */ - public function bankFee(): int|string|float + public function bankFee(): int|float { return $this->bankFee; } @@ -34,7 +34,7 @@ class VisaMasterPaymentOrderRepository /** * Gbus fee */ - public function gbusFee(): int|string|float + public function gbusFee(): int|float { return $this->gbusFee; }