some stan
This commit is contained in:
@@ -31,14 +31,5 @@ class ListCardOrders extends ListRecords
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
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')),
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
public static function getRecordRouteBindingEloquentQuery(): Builder
|
||||||
{
|
{
|
||||||
return parent::getRecordRouteBindingEloquentQuery()
|
return parent::getRecordRouteBindingEloquentQuery()
|
||||||
|
|||||||
@@ -22,11 +22,13 @@ class CurrencyRate extends Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the user's first name.
|
* Get the user's first name.
|
||||||
|
*
|
||||||
|
* @return Attribute<string, void>
|
||||||
*/
|
*/
|
||||||
protected function name(): Attribute
|
protected function name(): Attribute
|
||||||
{
|
{
|
||||||
return Attribute::make(
|
return Attribute::make(
|
||||||
get: fn () => $this->currency_from.'-'.$this->currency_to,
|
get: fn (): string => $this->currency_from.'-'.$this->currency_to,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class OnlinePaymentRepository
|
|||||||
/**
|
/**
|
||||||
* Online payment
|
* Online payment
|
||||||
*/
|
*/
|
||||||
protected ?OnlinePayment $onlinePayment;
|
protected OnlinePayment $onlinePayment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If payment is successful
|
* If payment is successful
|
||||||
@@ -117,7 +117,7 @@ class OnlinePaymentRepository
|
|||||||
/**
|
/**
|
||||||
* Online payment
|
* Online payment
|
||||||
*/
|
*/
|
||||||
public function onlinePayment(): ?OnlinePayment
|
public function onlinePayment(): OnlinePayment
|
||||||
{
|
{
|
||||||
return $this->onlinePayment;
|
return $this->onlinePayment;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,17 +74,18 @@ class PayVisaMasterPaymentAction
|
|||||||
->helperText(sprintf('Iň ýokary möçberi: %s TMT', $max_value))
|
->helperText(sprintf('Iň ýokary möçberi: %s TMT', $max_value))
|
||||||
->live()
|
->live()
|
||||||
->afterStateUpdated(function (Set $set, ?string $state) use ($usd_to_tmt, $bankFee, $gbusFee) {
|
->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', '');
|
$set('usd_rate', '');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$state = floatval($state);
|
||||||
|
|
||||||
$usd_rate = floatval(number_format($state / $usd_to_tmt, 2, '.', ''));
|
$usd_rate = $state / $usd_to_tmt;
|
||||||
$total_amount = floatval(number_format($state, 2, '.', '')) + $bankFee + $gbusFee;
|
$total_amount = $state + $bankFee + $gbusFee;
|
||||||
|
|
||||||
$set('usd_rate', $usd_rate);
|
$set('usd_rate', number_format($usd_rate, 2, '.', ''));
|
||||||
$set('total_amount', $total_amount);
|
$set('total_amount', number_format($total_amount, 2, '.', ''));
|
||||||
}),
|
}),
|
||||||
|
|
||||||
TextInput::make('usd_rate')
|
TextInput::make('usd_rate')
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ use Spatie\MediaLibrary\InteractsWithMedia;
|
|||||||
* @property string $email
|
* @property string $email
|
||||||
* @property string $region
|
* @property string $region
|
||||||
* @property string $address
|
* @property string $address
|
||||||
* @property array $sender_datas
|
* @property array<string, string> $sender_datas
|
||||||
* @property array $payment_reciever
|
* @property array<string, string> $payment_reciever
|
||||||
* @property array $documents
|
* @property array<string, string> $documents
|
||||||
* @property string $status
|
* @property string $status
|
||||||
* @property string $notes
|
* @property string $notes
|
||||||
* @property string $sender_full_name
|
* @property string $sender_full_name
|
||||||
@@ -77,7 +77,7 @@ class VisaMasterPaymentOrder extends Model implements HasMedia
|
|||||||
/**
|
/**
|
||||||
* User
|
* User
|
||||||
*
|
*
|
||||||
* @return BelongsTo<User, VisaMasterPaymentOrder>
|
* @return BelongsTo<User, $this>
|
||||||
*/
|
*/
|
||||||
public function user(): BelongsTo
|
public function user(): BelongsTo
|
||||||
{
|
{
|
||||||
@@ -87,7 +87,7 @@ class VisaMasterPaymentOrder extends Model implements HasMedia
|
|||||||
/**
|
/**
|
||||||
* Branch
|
* Branch
|
||||||
*
|
*
|
||||||
* @return BelongsTo<Branch, VisaMasterPaymentOrder>
|
* @return BelongsTo<Branch, $this>
|
||||||
*/
|
*/
|
||||||
public function branch(): BelongsTo
|
public function branch(): BelongsTo
|
||||||
{
|
{
|
||||||
@@ -97,7 +97,7 @@ class VisaMasterPaymentOrder extends Model implements HasMedia
|
|||||||
/**
|
/**
|
||||||
* Payment itmes
|
* Payment itmes
|
||||||
*
|
*
|
||||||
* @return HasMany<VisaMasterPaymentOrderItem, self>
|
* @return HasMany<VisaMasterPaymentOrderItem, $this>
|
||||||
*/
|
*/
|
||||||
public function paymentItems(): HasMany
|
public function paymentItems(): HasMany
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class VisaMasterPaymentOrderItem extends Model
|
|||||||
/**
|
/**
|
||||||
* Parent order
|
* Parent order
|
||||||
*
|
*
|
||||||
* @return BelongsTo<VisaMasterPaymentOrder, self>
|
* @return BelongsTo<VisaMasterPaymentOrder, $this>
|
||||||
*/
|
*/
|
||||||
public function parent(): BelongsTo
|
public function parent(): BelongsTo
|
||||||
{
|
{
|
||||||
@@ -48,7 +48,7 @@ class VisaMasterPaymentOrderItem extends Model
|
|||||||
/**
|
/**
|
||||||
* Online payment
|
* Online payment
|
||||||
*
|
*
|
||||||
* @return BelongsTo<OnlinePayment, self>
|
* @return BelongsTo<OnlinePayment, $this>
|
||||||
*/
|
*/
|
||||||
public function onlinePayment(): BelongsTo
|
public function onlinePayment(): BelongsTo
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,17 +16,17 @@ class VisaMasterPaymentOrderRepository
|
|||||||
/**
|
/**
|
||||||
* Bank fee
|
* Bank fee
|
||||||
*/
|
*/
|
||||||
public int|string|float $bankFee = 20;
|
public int|float $bankFee = 20;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gbus fee
|
* Gbus fee
|
||||||
*/
|
*/
|
||||||
public int|string|float $gbusFee = 3;
|
public int|float $gbusFee = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bank fee
|
* Bank fee
|
||||||
*/
|
*/
|
||||||
public function bankFee(): int|string|float
|
public function bankFee(): int|float
|
||||||
{
|
{
|
||||||
return $this->bankFee;
|
return $this->bankFee;
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ class VisaMasterPaymentOrderRepository
|
|||||||
/**
|
/**
|
||||||
* Gbus fee
|
* Gbus fee
|
||||||
*/
|
*/
|
||||||
public function gbusFee(): int|string|float
|
public function gbusFee(): int|float
|
||||||
{
|
{
|
||||||
return $this->gbusFee;
|
return $this->gbusFee;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user