wip
This commit is contained in:
@@ -3,11 +3,13 @@
|
||||
namespace App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\Pages;
|
||||
|
||||
use App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\VisaMasterPaymentOrderResource;
|
||||
use App\Modules\VisaMasterPaymentOrder\Filament\Actions\PayVisaMasterPaymentAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\ForceDeleteAction;
|
||||
use Filament\Actions\RestoreAction;
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
|
||||
class EditVisaMasterPaymentOrder extends EditRecord
|
||||
{
|
||||
@@ -16,10 +18,15 @@ class EditVisaMasterPaymentOrder extends EditRecord
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// ViewAction::make(),
|
||||
PayVisaMasterPaymentAction::make(),
|
||||
DeleteAction::make(),
|
||||
ForceDeleteAction::make(),
|
||||
RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
public function getTitle(): string | Htmlable
|
||||
{
|
||||
return __('Order details');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class VisaMasterPaymentOrderForm
|
||||
->components([
|
||||
Hidden::make('user_id')->default(Auth::id()),
|
||||
|
||||
Section::make(__('Order details'))
|
||||
Section::make()
|
||||
->columnSpan(4)
|
||||
->columns(4)
|
||||
->disabled(fn (string $context): bool => FilamentPermissionRepository::forClients())
|
||||
|
||||
@@ -12,6 +12,7 @@ use App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\T
|
||||
use App\Filament\Clusters\VisaMasterPayments\VisaMasterPaymentsCluster;
|
||||
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder;
|
||||
use BackedEnum;
|
||||
use Filament\Pages\Enums\SubNavigationPosition;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\VisaMasterPaymentOrder\Filament\Actions;
|
||||
|
||||
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
|
||||
class PayVisaMasterPaymentAction
|
||||
{
|
||||
public static function make(): Action
|
||||
{
|
||||
return Action::make('pay_visa_master_payment')
|
||||
->label(__('Make payment'))
|
||||
->icon('heroicon-o-credit-card')
|
||||
->modal()
|
||||
->schema(function () {
|
||||
// $usd_to_tmt = floatval(CurrencyRate::where('currency_from', 'USD')->where('currency_to', 'TMT')->first('value')?->value);
|
||||
|
||||
// $payment_warning_text = VisaMasterSettings::where('name', 'payment_warning_text')->first();
|
||||
|
||||
// if (! $usd_to_tmt || ! $payment_warning_text) {
|
||||
// return [];
|
||||
// }
|
||||
|
||||
// $max_value = number_format($usd_to_tmt * 250, 2);
|
||||
|
||||
// return [
|
||||
// Section::make('Customer Information')
|
||||
// ->schema([
|
||||
// TextEntry::make('1 USD = $usd_to_tmt TMT')
|
||||
// ->extraAttributes(['class' => 'uppercase tracking-wide font-bold text-xs'])
|
||||
// ->label(__('1 USD = $usd_to_tmt TMT')),
|
||||
// TextEntry::make('Bankyň tutumy: 20 TMT')
|
||||
// ->extraAttributes(['class' => 'uppercase tracking-wide font-bold text-xs'])
|
||||
// ->label(__('Bankyň tutumy: 20 TMT')),
|
||||
// TextEntry::make('GBÜS tutumy: 3 TMT')
|
||||
// ->extraAttributes(['class' => 'uppercase tracking-wide font-bold text-xs'])
|
||||
// ->label(__('GBÜS tutumy: 3 TMT')),
|
||||
// ])
|
||||
|
||||
// Text::make(__('Töleg aý'), 'month')
|
||||
// ->fullWidth()
|
||||
// ->readonly()
|
||||
// ->default(today()->translatedFormat('F')),
|
||||
|
||||
// Text::make(sprintf('%s (%s)', __('Töleg möçberi'), __('TMT')), 'payment_amount')
|
||||
// ->fullWidth()
|
||||
// ->required()
|
||||
// ->rules('required', 'numeric', 'max:'.$max_value)
|
||||
// ->help("Iň ýokary möçberi: {$max_value} TMT"),
|
||||
|
||||
// Text::make(__('USD ekwalendi'), 'usd_rate')
|
||||
// ->fullWidth()
|
||||
// ->readonly()
|
||||
// ->dependsOn('payment_amount', function (Text $field, NovaRequest $request, FormData $formData) use ($usd_to_tmt) {
|
||||
// $payment_amount = $formData->get('payment_amount');
|
||||
|
||||
// if ($payment_amount) {
|
||||
// $field->setValue(number_format($payment_amount / $usd_to_tmt, 2, '.', ''));
|
||||
// } else {
|
||||
// $field->setValue('');
|
||||
// }
|
||||
// }),
|
||||
|
||||
// Hidden::make('usd_payment')
|
||||
// ->dependsOn('payment_amount', function (Hidden $field, NovaRequest $request, FormData $formData) use ($usd_to_tmt) {
|
||||
// $payment_amount = $formData->get('payment_amount');
|
||||
|
||||
// if ($payment_amount) {
|
||||
// $field->setValue(number_format($payment_amount / $usd_to_tmt, 2, '.', ''));
|
||||
// } else {
|
||||
// $field->setValue('');
|
||||
// }
|
||||
// }),
|
||||
|
||||
// Text::make(__('Jemi (TMT)'), 'total_amount')
|
||||
// ->fullWidth()
|
||||
// ->readonly()
|
||||
// ->dependsOn('payment_amount', function ($field, $request, $formData) {
|
||||
// $payment_amount = $formData->get('payment_amount');
|
||||
|
||||
// if ($payment_amount) {
|
||||
// $field->setValue(
|
||||
// floatval(number_format($payment_amount, 2, '.', '')) + 23
|
||||
// );
|
||||
// } else {
|
||||
// $field->setValue('');
|
||||
// }
|
||||
// }),
|
||||
|
||||
// Heading::make(Blade::render(<<<HTML
|
||||
// <div class="w-full border text-left appearance-none rounded text-sm font-bold focus:outline-none focus:ring ring-primary-200 dark:ring-gray-600 relative inline-flex items-center justify-center shadow h-9 px-3 bg-primary-500 border-primary-500 text-white dark:text-gray-900">
|
||||
// <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-current shrink-0 w-6 h-6 mr-2">
|
||||
// <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
||||
// </svg>
|
||||
// <span>$payment_warning_text->value</span>
|
||||
// </div>
|
||||
// HTML))->asHtml(),
|
||||
// ];
|
||||
})
|
||||
->action(function (array $data, VisaMasterPaymentOrder $record): void {
|
||||
// $record->author()->associate($data['authorId']);
|
||||
// $record->save();
|
||||
})
|
||||
->modalFooterActions([]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user