currency rates
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
@@ -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([
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\CurrencyRate\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CurrencyRateController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
64
app/Modules/CurrencyRate/CurrencyRateModule.php
Normal file
64
app/Modules/CurrencyRate/CurrencyRateModule.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\CurrencyRate;
|
||||
|
||||
use App\Modules\Makeable;
|
||||
use App\Modules\ModuleContract;
|
||||
|
||||
class CurrencyRateModule implements ModuleContract
|
||||
{
|
||||
use Makeable;
|
||||
|
||||
/**
|
||||
* Module is enabled
|
||||
*/
|
||||
protected bool $enabled = true;
|
||||
|
||||
/**
|
||||
* Check if is module enabled
|
||||
*/
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return $this->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 [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('currency_rates', function (Blueprint $table) {
|
||||
$table->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');
|
||||
|
||||
}
|
||||
};
|
||||
199
app/Modules/CurrencyRate/Models/CurrencyRate.php
Normal file
199
app/Modules/CurrencyRate/Models/CurrencyRate.php
Normal file
@@ -0,0 +1,199 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\CurrencyRate\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $currency_from
|
||||
* @property string $currency_to
|
||||
* @property string $value
|
||||
* @property \Illuminate\Support\Carbon $created_at
|
||||
* @property \Illuminate\Support\Carbon $updated_at
|
||||
*/
|
||||
class CurrencyRate extends Model
|
||||
{
|
||||
/**
|
||||
* Currencies
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
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',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\CurrencyRate\Repositories;
|
||||
|
||||
class CurrencyRateRepository {}
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Modules\VisaMasterPaymentOrder\Filament\Actions;
|
||||
|
||||
use App\Modules\CurrencyRate\Models\CurrencyRate;
|
||||
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
|
||||
class PayVisaMasterPaymentAction
|
||||
{
|
||||
@@ -15,16 +15,16 @@ class PayVisaMasterPaymentAction
|
||||
->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(<<<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">
|
||||
@@ -105,4 +105,4 @@ class PayVisaMasterPaymentAction
|
||||
})
|
||||
->modalFooterActions([]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user