translate
This commit is contained in:
@@ -13,6 +13,8 @@ return new class extends Migration
|
||||
{
|
||||
Schema::create('swift_payments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('unique_id')->nullable()->unique();
|
||||
|
||||
$table->string('type')->nullable();
|
||||
$table->string('passport_name')->nullable();
|
||||
$table->string('passport_surname')->nullable();
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Modules\Swiftpayment\Models;
|
||||
|
||||
use App\Models\Branch\Branch;
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Swiftpayment\Nova\Resources\Concerns;
|
||||
|
||||
use App\Modules\Swiftpayment\Models\ApplicationTypes;
|
||||
use App\Nova\Resources\Branch\Branch;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use App\Repos\System\Settings\Location\RegionRepo;
|
||||
use Laravel\Nova\Fields\Badge;
|
||||
use Laravel\Nova\Fields\BelongsTo;
|
||||
use Laravel\Nova\Fields\DateTime;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\Select;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
|
||||
class SwiftpaymentFieldsForIndex
|
||||
{
|
||||
/**
|
||||
* Loan Order fields for "create"
|
||||
*/
|
||||
public static function make($resource): array
|
||||
{
|
||||
return [
|
||||
ID::make()->hide(),
|
||||
|
||||
Text::make(__('ID'), 'unique_id')->sortable(),
|
||||
|
||||
Select::make(__('Ýüztutmanyň görnüşi'), 'type')
|
||||
->fullWidth()
|
||||
->searchable()
|
||||
->rules('required')
|
||||
->displayUsingLabels()
|
||||
->options(ApplicationTypes::applicationTypes()),
|
||||
|
||||
DateTime::make(__('Created at'), 'created_at')
|
||||
->turkmenDateTime(),
|
||||
|
||||
Select::make(__('Region'), 'region')
|
||||
->displayUsingLabels()
|
||||
->options(RegionRepo::values())
|
||||
->canSeeWhen('isAdmin', $resource)
|
||||
->sortable(),
|
||||
|
||||
BelongsTo::make(__('Branch'), 'branch', Branch::class)
|
||||
->canSeeWhen('isAdmin', $resource)
|
||||
->filterable()
|
||||
->sortable(),
|
||||
|
||||
Text::make(__('Name'), 'passport_name'),
|
||||
|
||||
Text::make(__('Surname'), 'passport_surname'),
|
||||
|
||||
Text::make(__('Phone'), 'phone'),
|
||||
|
||||
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())
|
||||
->sortable(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -4,20 +4,22 @@ namespace App\Modules\Swiftpayment\Nova\Resources;
|
||||
|
||||
use App\Models\Branch\Branch;
|
||||
use App\Modules\Swiftpayment\Models\ApplicationTypes;
|
||||
use App\Modules\Swiftpayment\Models\SwiftPaymentStatus;
|
||||
use App\Modules\Swiftpayment\Nova\Resources\Concerns\SwiftpaymentFieldsForIndex;
|
||||
use App\Nova\Resource;
|
||||
use App\Repos\Order\Card\CardOrderRepo;
|
||||
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;
|
||||
use Ebess\AdvancedNovaMediaLibrary\Fields\Files;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Laravel\Nova\Fields\Badge;
|
||||
use Laravel\Nova\Fields\Hidden;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\Select;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
use Laravel\Nova\Fields\Trix;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
use Laravel\Nova\Panel;
|
||||
use Nurmuhammet\NovaInputmask\NovaInputmask;
|
||||
use Outl1ne\NovaSimpleRepeatable\SimpleRepeatable;
|
||||
|
||||
@@ -38,7 +40,7 @@ class NovaSwiftpayment extends Resource
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $title = 'id';
|
||||
public static $title = 'unique_id';
|
||||
|
||||
/**
|
||||
* The columns that should be searched.
|
||||
@@ -46,7 +48,7 @@ class NovaSwiftpayment extends Resource
|
||||
* @var array<int, string>
|
||||
*/
|
||||
public static $search = [
|
||||
'id',
|
||||
'unique_id', 'passport_name', 'passport_surname', 'phone',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -54,7 +56,7 @@ class NovaSwiftpayment extends Resource
|
||||
*/
|
||||
public static function label(): string
|
||||
{
|
||||
return __('Swiftpayments');
|
||||
return __('Swift payments');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +64,26 @@ class NovaSwiftpayment extends Resource
|
||||
*/
|
||||
public static function singularLabel(): string
|
||||
{
|
||||
return __('Swiftpayment');
|
||||
return __('Swift payment');
|
||||
}
|
||||
|
||||
/**
|
||||
* After resource created
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
*/
|
||||
public static function afterCreate(NovaRequest $request, Model $model): void
|
||||
{
|
||||
$model->update(['unique_id' => CardOrderRepo::fillUniqueId($model)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields for index.
|
||||
*/
|
||||
public function fieldsForIndex(): array
|
||||
{
|
||||
return SwiftpaymentFieldsForIndex::make($this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,117 +95,129 @@ class NovaSwiftpayment extends Resource
|
||||
public function fields(NovaRequest $request): array
|
||||
{
|
||||
return [
|
||||
ID::make('id')->sortable(),
|
||||
ID::hidden('id'),
|
||||
|
||||
Hidden::make('user_id')->default(auth()->id()),
|
||||
Hidden::make('user_id')
|
||||
->default(auth()->id())
|
||||
->hideWhenUpdating(),
|
||||
|
||||
Select::make(__('Status'), 'status')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(OrderRepo::statusValues())
|
||||
->default(OrderRepo::defaultStatus())
|
||||
->fullWidth()
|
||||
->rules('required')
|
||||
->canSeeWhen('systemUser', $this),
|
||||
new Panel(__('New :resource', ['resource' => $this->singularLabel()]), [
|
||||
Text::make(__('ID'), 'unique_id')
|
||||
->exceptOnForms(),
|
||||
|
||||
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())
|
||||
->default(RegionRepo::default())
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
|
||||
Select::make(__('Branch'), 'branch_id')
|
||||
->fullWidth()
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->dependsOn('region', NovaRepo::dependsOnRegion('region', Branch::class))
|
||||
->rules('required')
|
||||
->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(),
|
||||
|
||||
SimpleRepeatable::make('Tölegi ugradyjynyň maglumatlar', 'sender_datas', [
|
||||
Select::make(__('Passport serie'), 'passport_serie')
|
||||
Select::make(__('Status'), 'status')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(PassportRepo::values())
|
||||
->options(OrderRepo::statusValues())
|
||||
->default(OrderRepo::defaultStatus())
|
||||
->fullWidth()
|
||||
->hideFromDetail()
|
||||
->rules('required')
|
||||
->canSeeWhen('systemUser', $this),
|
||||
|
||||
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()),
|
||||
|
||||
Text::make(__('Note'), 'notes')
|
||||
->fullWidth()
|
||||
->canSeeWhen('systemUser', $this),
|
||||
]),
|
||||
|
||||
new Panel(__('Location'), [
|
||||
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())
|
||||
->default(RegionRepo::default())
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
|
||||
NovaInputmask::make('Passport nomeri')
|
||||
->mask('999999')
|
||||
->rules('required', 'max:255'),
|
||||
|
||||
Text::make('A.F.AA'),
|
||||
])->minRows(1)->rules('required'),
|
||||
|
||||
SimpleRepeatable::make('Tölegi kabul edijiniň maglumatlary', 'payment_reciever', [
|
||||
Select::make(__('Passport serie'), 'passport_serie')
|
||||
Select::make(__('Branch'), 'branch_id')
|
||||
->fullWidth()
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(PassportRepo::values())
|
||||
->dependsOn('region', NovaRepo::dependsOnRegion('region', Branch::class))
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
]),
|
||||
|
||||
NovaInputmask::make('Passport nomeri')
|
||||
->mask('999999')
|
||||
->rules('required', 'max:255'),
|
||||
new Panel(__('Personal data'), [
|
||||
Text::make('Pasportdaky ady', 'passport_name')
|
||||
->fullWidth()
|
||||
->rules('required', 'string', 'max:255'),
|
||||
|
||||
Text::make('A.F.AA'),
|
||||
])->maxRows(1)->rules('required'),
|
||||
Text::make('Pasportdaky familiýa', 'passport_surname')
|
||||
->fullWidth()
|
||||
->rules('required', 'string', 'max:255'),
|
||||
|
||||
Files::make('Talap edilýän resminamalar', 'main')
|
||||
->conversionOnIndexView('thumb')
|
||||
->rules('required')
|
||||
->hideFromIndex(),
|
||||
NovaInputmask::make('Telefon belgi', 'phone')
|
||||
->fullWidth()
|
||||
->phonenumber('TM')
|
||||
->rules('required', 'max:255')
|
||||
->hideFromIndex(),
|
||||
|
||||
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()),
|
||||
Text::make('Email', 'email')
|
||||
->fullWidth()
|
||||
->rules('required', 'max:255', 'email')
|
||||
->hideFromIndex(),
|
||||
|
||||
Trix::make(__('Notes'), 'notes')
|
||||
->hideWhenCreating()
|
||||
->alwaysShow()
|
||||
->readonly(function ($request) {
|
||||
return ! $request->user()->hasRole(['admin', 'manager', 'operator']);
|
||||
}),
|
||||
Text::make('Ýaşaýan ýeriň salgysy', 'address')
|
||||
->fullWidth()
|
||||
->rules('required', 'string', 'max:255')
|
||||
->hideFromIndex(),
|
||||
]),
|
||||
|
||||
new Panel(__('Töleg'), [
|
||||
SimpleRepeatable::make('Tölegi ugradyjynyň maglumatlar', 'sender_datas', [
|
||||
Select::make(__('Passport serie'), 'passport_serie')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(PassportRepo::values())
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
|
||||
NovaInputmask::make('Passport nomeri')
|
||||
->mask('999999')
|
||||
->rules('required', 'max:255'),
|
||||
|
||||
Text::make('A.F.AA'),
|
||||
])->minRows(1)->rules('required'),
|
||||
|
||||
SimpleRepeatable::make('Tölegi kabul edijiniň maglumatlary', 'payment_reciever', [
|
||||
Select::make(__('Passport serie'), 'passport_serie')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(PassportRepo::values())
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
|
||||
NovaInputmask::make('Passport nomeri')
|
||||
->mask('999999')
|
||||
->rules('required', 'max:255'),
|
||||
|
||||
Text::make('A.F.AA'),
|
||||
])->maxRows(1)->minRows(1)->rules('required'),
|
||||
|
||||
Files::make('Talap edilýän resminamalar', 'main')
|
||||
->conversionOnIndexView('thumb')
|
||||
->rules('required')
|
||||
->required()
|
||||
->hideFromIndex(),
|
||||
]),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,8 @@ class NovaMenuRepo
|
||||
])->collapsedByDefault(),
|
||||
|
||||
MenuGroup::make(__('Swift payments'), [
|
||||
MenuItem::resource(NovaSwiftpayment::class),
|
||||
MenuItem::resource(NovaSwiftpayment::class)
|
||||
->name(sprintf('%s (%s)', __('International payments'), __('Visa, Master, Sber, WU'))),
|
||||
])->collapsedByDefault(),
|
||||
])->icon('ticket')->collapsedByDefault(),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user