fix payments

This commit is contained in:
2024-09-02 18:05:31 +05:00
parent 061f09eca1
commit a068491050
3 changed files with 28 additions and 15 deletions

View File

@@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::create('swift_payments', function (Blueprint $table) { Schema::create('swift_payments', function (Blueprint $table) {
$table->uuid('id'); $table->id();
$table->string('type')->nullable(); $table->string('type')->nullable();
$table->string('passport_name')->nullable(); $table->string('passport_name')->nullable();
$table->string('passport_surname')->nullable(); $table->string('passport_surname')->nullable();
@@ -41,6 +41,6 @@ return new class extends Migration
*/ */
public function down(): void public function down(): void
{ {
// Schema::dropIfExists('swift_payments');
} }
}; };

View File

@@ -12,7 +12,6 @@ use Spatie\MediaLibrary\MediaCollections\Models\Media;
class Swiftpayment extends Model implements HasMedia class Swiftpayment extends Model implements HasMedia
{ {
use HasUuids;
use InteractsWithMedia; use InteractsWithMedia;
/** /**

View File

@@ -6,6 +6,7 @@ use App\Models\Branch\Branch;
use App\Modules\Swiftpayment\Models\ApplicationTypes; use App\Modules\Swiftpayment\Models\ApplicationTypes;
use App\Modules\Swiftpayment\Models\SwiftPaymentStatus; use App\Modules\Swiftpayment\Models\SwiftPaymentStatus;
use App\Nova\Resource; use App\Nova\Resource;
use App\Repos\Order\OrderRepo;
use App\Repos\System\Nova\NovaRepo; use App\Repos\System\Nova\NovaRepo;
use App\Repos\System\Settings\Legal\PassportRepo; use App\Repos\System\Settings\Legal\PassportRepo;
use App\Repos\System\Settings\Location\RegionRepo; use App\Repos\System\Settings\Location\RegionRepo;
@@ -77,13 +78,24 @@ class NovaSwiftpayment extends Resource
Hidden::make('user_id')->default(auth()->id()), 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') Select::make(__('Ýüztutmanyň görnüşi'), 'type')
->fullWidth()
->searchable() ->searchable()
->rules('required') ->rules('required')
->displayUsingLabels() ->displayUsingLabels()
->options(ApplicationTypes::applicationTypes()), ->options(ApplicationTypes::applicationTypes()),
Select::make(__('Region'), 'region') Select::make(__('Region'), 'region')
->fullWidth()
->displayUsingLabels() ->displayUsingLabels()
->searchable() ->searchable()
->options(RegionRepo::values()) ->options(RegionRepo::values())
@@ -92,6 +104,7 @@ class NovaSwiftpayment extends Resource
->sortable(), ->sortable(),
Select::make(__('Branch'), 'branch_id') Select::make(__('Branch'), 'branch_id')
->fullWidth()
->displayUsingLabels() ->displayUsingLabels()
->searchable() ->searchable()
->dependsOn('region', NovaRepo::dependsOnRegion('region', Branch::class)) ->dependsOn('region', NovaRepo::dependsOnRegion('region', Branch::class))
@@ -99,21 +112,26 @@ class NovaSwiftpayment extends Resource
->sortable(), ->sortable(),
Text::make('Pasportdaky ady', 'passport_name') Text::make('Pasportdaky ady', 'passport_name')
->fullWidth()
->rules('required', 'string', 'max:255'), ->rules('required', 'string', 'max:255'),
Text::make('Pasportdaky familiýa', 'passport_surname') Text::make('Pasportdaky familiýa', 'passport_surname')
->fullWidth()
->rules('required', 'string', 'max:255'), ->rules('required', 'string', 'max:255'),
NovaInputmask::make('Telefon belgi', 'phone') NovaInputmask::make('Telefon belgi', 'phone')
->fullWidth()
->phonenumber('TM') ->phonenumber('TM')
->rules('required', 'max:255') ->rules('required', 'max:255')
->hideFromIndex(), ->hideFromIndex(),
Text::make('Email', 'email') Text::make('Email', 'email')
->fullWidth()
->rules('required', 'max:255', 'email') ->rules('required', 'max:255', 'email')
->hideFromIndex(), ->hideFromIndex(),
Text::make('Ýaşaýan ýeriň salgysy', 'address') Text::make('Ýaşaýan ýeriň salgysy', 'address')
->fullWidth()
->rules('required', 'string', 'max:255') ->rules('required', 'string', 'max:255')
->hideFromIndex(), ->hideFromIndex(),
@@ -152,18 +170,14 @@ class NovaSwiftpayment extends Resource
->rules('required') ->rules('required')
->hideFromIndex(), ->hideFromIndex(),
Badge::make('Status')->map(SwiftPaymentStatus::classes())->addTypes([ Badge::make(__('Status'), 'status')
'primary' => 'dark:bg-gray-900 bg-gray-600 text-white', ->map(OrderRepo::statusClasses())
])->labels(SwiftPaymentStatus::values()), ->addTypes([
'primary' => 'dark:bg-gray-900 bg-gray-600 text-white',
Select::make(__('Status'), 'status') ])
->onlyOnForms() ->labels(OrderRepo::statusValues())
->hideWhenCreating() ->withIcons()
->displayUsingLabels() ->icons(OrderRepo::statusIcons()),
->options(SwiftPaymentStatus::values())
->canSee(function ($request) {
return $request->user()->hasRole(['admin', 'manager', 'operator']);
}),
Trix::make(__('Notes'), 'notes') Trix::make(__('Notes'), 'notes')
->hideWhenCreating() ->hideWhenCreating()