diff --git a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Pages/EditVisaMasterPaymentOrder.php b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Pages/EditVisaMasterPaymentOrder.php index 73c8742..26d1ad8 100644 --- a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Pages/EditVisaMasterPaymentOrder.php +++ b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Pages/EditVisaMasterPaymentOrder.php @@ -7,7 +7,6 @@ use App\Modules\VisaMasterPaymentOrder\Filament\Actions\PayVisaMasterPaymentActi 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; @@ -25,7 +24,7 @@ class EditVisaMasterPaymentOrder extends EditRecord ]; } - public function getTitle(): string | Htmlable + public function getTitle(): string|Htmlable { return __('Order details'); } diff --git a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderInfolist.php b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderInfolist.php index d862963..910e000 100644 --- a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderInfolist.php +++ b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/Schemas/VisaMasterPaymentOrderInfolist.php @@ -5,9 +5,7 @@ namespace App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOr use App\Modules\OrderStatus\Repositories\OrderStatusRepository; use App\Modules\Region\Repositories\RegionRepository; use App\Modules\TurkmenPassport\Repositories\TurkmenPassportRepository; -use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder; use Filament\Infolists\Components\IconEntry; -use Illuminate\Support\Str; use Filament\Infolists\Components\SpatieMediaLibraryImageEntry; use Filament\Infolists\Components\TextEntry; use Filament\Schemas\Components\Fieldset; @@ -15,8 +13,6 @@ use Filament\Schemas\Components\Section; use Filament\Schemas\Components\Tabs; use Filament\Schemas\Components\Tabs\Tab; use Filament\Schemas\Schema; -use Filament\Support\Enums\IconSize; -use Filament\Support\Enums\TextSize; use Filament\Support\Icons\Heroicon; class VisaMasterPaymentOrderInfolist @@ -33,7 +29,6 @@ class VisaMasterPaymentOrderInfolist ->label(__('Payment type')) ->extraAttributes(['style' => 'text-transform:uppercase;font-size:1.5em;font-weight:bold;']), - TextEntry::make('status') ->label(__('Status')) ->formatStateUsing(fn (string $state) => OrderStatusRepository::statusFormatted($state)) @@ -47,7 +42,7 @@ class VisaMasterPaymentOrderInfolist ->falseIcon(Heroicon::XCircle) ->trueColor('success') ->falseColor('danger'), - + TextEntry::make('notes') ->label(__('Bellik')) ->html() @@ -59,7 +54,6 @@ class VisaMasterPaymentOrderInfolist ->tabs([ Tab::make(__('Order type and bank')) ->schema([ - Fieldset::make(__('Location')) ->schema([ diff --git a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php index a1867e9..011c894 100644 --- a/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php +++ b/app/Filament/Clusters/VisaMasterPayments/Resources/VisaMasterPaymentOrders/VisaMasterPaymentOrderResource.php @@ -7,12 +7,10 @@ use App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\P use App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\Pages\ListVisaMasterPaymentOrders; use App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\Pages\ViewVisaMasterPaymentOrder; use App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\Schemas\VisaMasterPaymentOrderForm; -use App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\Schemas\VisaMasterPaymentOrderInfolist; use App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\Tables\VisaMasterPaymentOrdersTable; 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; diff --git a/app/Modules/CurrencyRate/Controllers/CurrencyRateController.php b/app/Modules/CurrencyRate/Controllers/CurrencyRateController.php new file mode 100644 index 0000000..ff7496d --- /dev/null +++ b/app/Modules/CurrencyRate/Controllers/CurrencyRateController.php @@ -0,0 +1,49 @@ +enabled; + } + + /** + * Disable module + */ + public function disable(): void + { + $this->enabled = false; + } + + /** + * Enable module + */ + public function enable(): void + { + $this->enabled = true; + } + + /** + * Check if module has a filament resource + */ + public function hasFilamentResource(): bool + { + return false; + } + + /** + * Get module composer requirements + */ + public function getComposerRequirements(): array + { + return []; + } + + /** + * Get module composer suggestions + */ + public function getComposerSuggestions(): array + { + return []; + } +} diff --git a/app/Modules/CurrencyRate/Database/Migrations/2025_11_13_214929_create_currency_rates_table.php b/app/Modules/CurrencyRate/Database/Migrations/2025_11_13_214929_create_currency_rates_table.php new file mode 100644 index 0000000..63ff895 --- /dev/null +++ b/app/Modules/CurrencyRate/Database/Migrations/2025_11_13_214929_create_currency_rates_table.php @@ -0,0 +1,31 @@ +id(); + $table->string('currency_from'); + $table->string('currency_to'); + $table->string('value'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('currency_rates'); + + } +}; diff --git a/app/Modules/CurrencyRate/Models/CurrencyRate.php b/app/Modules/CurrencyRate/Models/CurrencyRate.php new file mode 100644 index 0000000..baca9b8 --- /dev/null +++ b/app/Modules/CurrencyRate/Models/CurrencyRate.php @@ -0,0 +1,199 @@ + + */ + public static function currencies(): array + { + return [ + 'AED' => 'AED', + 'AFN' => 'AFN', + 'ALL' => 'ALL', + 'AMD' => 'AMD', + 'ANG' => 'ANG', + 'AOA' => 'AOA', + 'ARS' => 'ARS', + 'AUD' => 'AUD', + 'AWG' => 'AWG', + 'AZN' => 'AZN', + 'BAM' => 'BAM', + 'BBD' => 'BBD', + 'BDT' => 'BDT', + 'BGN' => 'BGN', + 'BHD' => 'BHD', + 'BIF' => 'BIF', + 'BMD' => 'BMD', + 'BND' => 'BND', + 'BOB' => 'BOB', + 'BRL' => 'BRL', + 'BSD' => 'BSD', + 'BTN' => 'BTN', + 'BWP' => 'BWP', + 'BYN' => 'BYN', + 'BZD' => 'BZD', + 'CAD' => 'CAD', + 'CDF' => 'CDF', + 'CHF' => 'CHF', + 'CKD' => 'CKD', + 'CLP' => 'CLP', + 'CNY' => 'CNY', + 'COP' => 'COP', + 'CRC' => 'CRC', + 'CUC' => 'CUC', + 'CUP' => 'CUP', + 'CVE' => 'CVE', + 'CZK' => 'CZK', + 'DJF' => 'DJF', + 'DKK' => 'DKK', + 'DOP' => 'DOP', + 'DZD' => 'DZD', + 'EGP' => 'EGP', + 'EHP' => 'EHP', + 'ERN' => 'ERN', + 'ETB' => 'ETB', + 'EUR' => 'EUR', + 'FJD' => 'FJD', + 'FKP' => 'FKP', + 'FOK' => 'FOK', + 'GBP' => 'GBP', + 'GEL' => 'GEL', + 'GGP' => 'GGP', + 'GHS' => 'GHS', + 'GIP' => 'GIP', + 'GMD' => 'GMD', + 'GNF' => 'GNF', + 'GTQ' => 'GTQ', + 'GYD' => 'GYD', + 'HKD' => 'HKD', + 'HNL' => 'HNL', + 'HRK' => 'HRK', + 'HTG' => 'HTG', + 'HUF' => 'HUF', + 'IDR' => 'IDR', + 'ILS' => 'ILS', + 'IMP' => 'IMP', + 'INR' => 'INR', + 'IQD' => 'IQD', + 'IRR' => 'IRR', + 'ISK' => 'ISK', + 'JEP' => 'JEP', + 'JMD' => 'JMD', + 'JOD' => 'JOD', + 'JPY' => 'JPY', + 'KES' => 'KES', + 'KGS' => 'KGS', + 'KHR' => 'KHR', + 'KID' => 'KID', + 'KMF' => 'KMF', + 'KPW' => 'KPW', + 'KRW' => 'KRW', + 'KWD' => 'KWD', + 'KYD' => 'KYD', + 'KZT' => 'KZT', + 'LAK' => 'LAK', + 'LBP' => 'LBP', + 'LKR' => 'LKR', + 'LRD' => 'LRD', + 'LSL' => 'LSL', + 'LYD' => 'LYD', + 'MAD' => 'MAD', + 'MDL' => 'MDL', + 'MGA' => 'MGA', + 'MKD' => 'MKD', + 'MMK' => 'MMK', + 'MNT' => 'MNT', + 'MOP' => 'MOP', + 'MRU' => 'MRU', + 'MUR' => 'MUR', + 'MVR' => 'MVR', + 'MWK' => 'MWK', + 'MXN' => 'MXN', + 'MYR' => 'MYR', + 'MZN' => 'MZN', + 'NAD' => 'NAD', + 'NGN' => 'NGN', + 'NIO' => 'NIO', + 'NOK' => 'NOK', + 'NPR' => 'NPR', + 'NZD' => 'NZD', + 'OMR' => 'OMR', + 'PAB' => 'PAB', + 'PEN' => 'PEN', + 'PGK' => 'PGK', + 'PHP' => 'PHP', + 'PKR' => 'PKR', + 'PLN' => 'PLN', + 'PND' => 'PND', + 'PRB' => 'PRB', + 'PYG' => 'PYG', + 'QAR' => 'QAR', + 'RON' => 'RON', + 'RSD' => 'RSD', + 'RUB' => 'RUB', + 'RWF' => 'RWF', + 'SAR' => 'SAR', + 'SBD' => 'SBD', + 'SCR' => 'SCR', + 'SDG' => 'SDG', + 'SEK' => 'SEK', + 'SGD' => 'SGD', + 'SHP' => 'SHP', + 'SLL' => 'SLL', + 'SLS' => 'SLS', + 'SOS' => 'SOS', + 'SRD' => 'SRD', + 'SSP' => 'SSP', + 'STN' => 'STN', + 'SVC' => 'SVC', + 'SYP' => 'SYP', + 'SZL' => 'SZL', + 'THB' => 'THB', + 'TJS' => 'TJS', + 'TMT' => 'TMT', + 'TND' => 'TND', + 'TOP' => 'TOP', + 'TRY' => 'TRY', + 'TTD' => 'TTD', + 'TVD' => 'TVD', + 'TWD' => 'TWD', + 'TZS' => 'TZS', + 'UAH' => 'UAH', + 'UGX' => 'UGX', + 'USD' => 'USD', + 'UYU' => 'UYU', + 'UZS' => 'UZS', + 'VED' => 'VED', + 'VES' => 'VES', + 'VND' => 'VND', + 'VUV' => 'VUV', + 'WST' => 'WST', + 'XAF' => 'XAF', + 'XCD' => 'XCD', + 'XOF' => 'XOF', + 'XPF' => 'XPF', + 'YER' => 'YER', + 'ZAR' => 'ZAR', + 'ZMW' => 'ZMW', + 'ZWB' => 'ZWB', + 'ZWL' => 'ZWL', + 'Abkhazia' => 'Abkhazia', + 'Artsakh' => 'Artsakh', + ]; + } +} diff --git a/app/Modules/CurrencyRate/Repositories/CurrencyRateRepository.php b/app/Modules/CurrencyRate/Repositories/CurrencyRateRepository.php new file mode 100644 index 0000000..c5f1ce0 --- /dev/null +++ b/app/Modules/CurrencyRate/Repositories/CurrencyRateRepository.php @@ -0,0 +1,5 @@ +icon('heroicon-o-credit-card') ->modal() ->schema(function () { - // $usd_to_tmt = floatval(CurrencyRate::where('currency_from', 'USD')->where('currency_to', 'TMT')->first('value')?->value); + $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([ @@ -38,48 +38,48 @@ class PayVisaMasterPaymentAction // ->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 @@ -88,7 +88,7 @@ class PayVisaMasterPaymentAction // $field->setValue(''); // } // }), - + // Heading::make(Blade::render(<< // @@ -105,4 +105,4 @@ class PayVisaMasterPaymentAction }) ->modalFooterActions([]); } -} \ No newline at end of file +} diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 87be80e..58515a5 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -3,14 +3,14 @@ namespace App\Providers; use AbdulmajeedJamaan\FilamentTranslatableTabs\TranslatableTabs; +use BezhanSalleh\LanguageSwitch\Events\LocaleChanged; +use BezhanSalleh\LanguageSwitch\LanguageSwitch; use Illuminate\Contracts\Foundation\Application; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Facades\Event; use Illuminate\Support\ServiceProvider; use Spatie\Translatable\HasTranslations; -use BezhanSalleh\LanguageSwitch\LanguageSwitch; -use BezhanSalleh\LanguageSwitch\Events\LocaleChanged; -use Illuminate\Support\Facades\Event; class AppServiceProvider extends ServiceProvider { diff --git a/app/Providers/Filament/WorkPanelProvider.php b/app/Providers/Filament/WorkPanelProvider.php index 2814a00..3e1c7c3 100644 --- a/app/Providers/Filament/WorkPanelProvider.php +++ b/app/Providers/Filament/WorkPanelProvider.php @@ -5,10 +5,7 @@ namespace App\Providers\Filament; use App\Http\Middleware\EnsureProfileIsFilled; use App\Livewire\UserProfileFields; use App\Modules\BaseAuth\Middleware\RedirectIfUserPhoneIsUnVerfied; -use App\Modules\BaseLocale\Middleware\SetLocale; use BezhanSalleh\FilamentShield\FilamentShieldPlugin; -use CraftForge\FilamentLanguageSwitcher\FilamentLanguageSwitcherPlugin; -use Filament\Enums\GlobalSearchPosition; use Filament\Http\Middleware\Authenticate; use Filament\Http\Middleware\AuthenticateSession; use Filament\Http\Middleware\DisableBladeIconComponents;