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
{
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');
}
};

View File

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

View File

@@ -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()