From a0684910504f4d226d0a55ceb2d03c392bd50a50 Mon Sep 17 00:00:00 2001 From: Nurmuhammet Allanov Date: Mon, 2 Sep 2024 18:05:31 +0500 Subject: [PATCH] fix payments --- ...8_31_151813_create_swiftpayments_table.php | 4 +- .../Swiftpayment/Models/Swiftpayment.php | 1 - .../Nova/Resources/NovaSwiftpayment.php | 38 +++++++++++++------ 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/app/Modules/Swiftpayment/Database/Migrations/2024_08_31_151813_create_swiftpayments_table.php b/app/Modules/Swiftpayment/Database/Migrations/2024_08_31_151813_create_swiftpayments_table.php index fc8b562..c93b74e 100644 --- a/app/Modules/Swiftpayment/Database/Migrations/2024_08_31_151813_create_swiftpayments_table.php +++ b/app/Modules/Swiftpayment/Database/Migrations/2024_08_31_151813_create_swiftpayments_table.php @@ -12,7 +12,7 @@ return new class extends Migration public function up(): void { Schema::create('swift_payments', function (Blueprint $table) { - $table->uuid('id'); + $table->id(); $table->string('type')->nullable(); $table->string('passport_name')->nullable(); $table->string('passport_surname')->nullable(); @@ -41,6 +41,6 @@ return new class extends Migration */ public function down(): void { - // + Schema::dropIfExists('swift_payments'); } }; diff --git a/app/Modules/Swiftpayment/Models/Swiftpayment.php b/app/Modules/Swiftpayment/Models/Swiftpayment.php index 5bcdea3..94767e8 100644 --- a/app/Modules/Swiftpayment/Models/Swiftpayment.php +++ b/app/Modules/Swiftpayment/Models/Swiftpayment.php @@ -12,7 +12,6 @@ use Spatie\MediaLibrary\MediaCollections\Models\Media; class Swiftpayment extends Model implements HasMedia { - use HasUuids; use InteractsWithMedia; /** diff --git a/app/Modules/Swiftpayment/Nova/Resources/NovaSwiftpayment.php b/app/Modules/Swiftpayment/Nova/Resources/NovaSwiftpayment.php index 33674a5..52acd95 100644 --- a/app/Modules/Swiftpayment/Nova/Resources/NovaSwiftpayment.php +++ b/app/Modules/Swiftpayment/Nova/Resources/NovaSwiftpayment.php @@ -6,6 +6,7 @@ use App\Models\Branch\Branch; use App\Modules\Swiftpayment\Models\ApplicationTypes; use App\Modules\Swiftpayment\Models\SwiftPaymentStatus; use App\Nova\Resource; +use App\Repos\Order\OrderRepo; use App\Repos\System\Nova\NovaRepo; use App\Repos\System\Settings\Legal\PassportRepo; use App\Repos\System\Settings\Location\RegionRepo; @@ -77,13 +78,24 @@ class NovaSwiftpayment extends Resource Hidden::make('user_id')->default(auth()->id()), + Select::make(__('Status'), 'status') + ->displayUsingLabels() + ->searchable() + ->options(OrderRepo::statusValues()) + ->default(OrderRepo::defaultStatus()) + ->fullWidth() + ->rules('required') + ->canSeeWhen('systemUser', $this), + Select::make(__('Ýüztutmanyň görnüşi'), 'type') + ->fullWidth() ->searchable() ->rules('required') ->displayUsingLabels() ->options(ApplicationTypes::applicationTypes()), Select::make(__('Region'), 'region') + ->fullWidth() ->displayUsingLabels() ->searchable() ->options(RegionRepo::values()) @@ -92,6 +104,7 @@ class NovaSwiftpayment extends Resource ->sortable(), Select::make(__('Branch'), 'branch_id') + ->fullWidth() ->displayUsingLabels() ->searchable() ->dependsOn('region', NovaRepo::dependsOnRegion('region', Branch::class)) @@ -99,21 +112,26 @@ class NovaSwiftpayment extends Resource ->sortable(), Text::make('Pasportdaky ady', 'passport_name') + ->fullWidth() ->rules('required', 'string', 'max:255'), Text::make('Pasportdaky familiýa', 'passport_surname') + ->fullWidth() ->rules('required', 'string', 'max:255'), NovaInputmask::make('Telefon belgi', 'phone') + ->fullWidth() ->phonenumber('TM') ->rules('required', 'max:255') ->hideFromIndex(), Text::make('Email', 'email') + ->fullWidth() ->rules('required', 'max:255', 'email') ->hideFromIndex(), Text::make('Ýaşaýan ýeriň salgysy', 'address') + ->fullWidth() ->rules('required', 'string', 'max:255') ->hideFromIndex(), @@ -152,18 +170,14 @@ class NovaSwiftpayment extends Resource ->rules('required') ->hideFromIndex(), - Badge::make('Status')->map(SwiftPaymentStatus::classes())->addTypes([ - 'primary' => 'dark:bg-gray-900 bg-gray-600 text-white', - ])->labels(SwiftPaymentStatus::values()), - - Select::make(__('Status'), 'status') - ->onlyOnForms() - ->hideWhenCreating() - ->displayUsingLabels() - ->options(SwiftPaymentStatus::values()) - ->canSee(function ($request) { - return $request->user()->hasRole(['admin', 'manager', 'operator']); - }), + Badge::make(__('Status'), 'status') + ->map(OrderRepo::statusClasses()) + ->addTypes([ + 'primary' => 'dark:bg-gray-900 bg-gray-600 text-white', + ]) + ->labels(OrderRepo::statusValues()) + ->withIcons() + ->icons(OrderRepo::statusIcons()), Trix::make(__('Notes'), 'notes') ->hideWhenCreating()