Refactor VisaMasterPaymentOrder components and enhance seeding process
- Updated record title attribute in VisaMasterPaymentOrderResource to 'unique_id'. - Improved schema layout in VisaMasterPaymentOrderForm and VisaMasterPaymentOrderInfolist for better user experience. - Added 'unique_id' field to VisaMasterPaymentOrderInfolist with styling adjustments. - Implemented BelongsToBranch interface in VisaMasterPaymentOrder model and added a boot method for loan order creation. - Expanded FillJsonData seeder to include migration for VisaMasterPaymentOrders.
This commit is contained in:
@@ -148,15 +148,9 @@ class VisaMasterPaymentOrderForm
|
|||||||
->columns(2)
|
->columns(2)
|
||||||
->schema([
|
->schema([
|
||||||
AdvancedFileUpload::make('sender_passport_local')
|
AdvancedFileUpload::make('sender_passport_local')
|
||||||
->collection('sender_passport_local')
|
->spatieMediaLibrary(collection: 'sender_passport_local')
|
||||||
->spatieMediaLibrary()
|
|
||||||
->multiple(),
|
->multiple(),
|
||||||
|
|
||||||
// SpatieMediaLibraryFileUpload::make('sender_passport_local')
|
|
||||||
// ->collection('sender_passport_local')
|
|
||||||
// ->label(__('Ugradyja degişli Türkmenistanyň raýatynyň (içki milli) pasportynyň asyl görnüşi we göçürmesi'))
|
|
||||||
// ->required(),
|
|
||||||
|
|
||||||
SpatieMediaLibraryFileUpload::make('sender_passport_international')
|
SpatieMediaLibraryFileUpload::make('sender_passport_international')
|
||||||
->collection('sender_passport_international')
|
->collection('sender_passport_international')
|
||||||
->label(__('Ugradyja degişli Türkmenistandan çykmak we Türkmenistana girmek üçin pasportynyň asyl görnüşi we göçürmesi')),
|
->label(__('Ugradyja degişli Türkmenistandan çykmak we Türkmenistana girmek üçin pasportynyň asyl görnüşi we göçürmesi')),
|
||||||
|
|||||||
@@ -25,8 +25,13 @@ class VisaMasterPaymentOrderInfolist
|
|||||||
->components([
|
->components([
|
||||||
Section::make()
|
Section::make()
|
||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
->columns(3)
|
->columns(4)
|
||||||
->components([
|
->components([
|
||||||
|
TextEntry::make('unique_id')
|
||||||
|
->label(__('Order ID'))
|
||||||
|
->columnSpan(1)
|
||||||
|
->extraAttributes(['style' => 'text-transform:uppercase;font-size:1.5em;font-weight:bold;']),
|
||||||
|
|
||||||
TextEntry::make('type')
|
TextEntry::make('type')
|
||||||
->label(__('Payment type'))
|
->label(__('Payment type'))
|
||||||
->extraAttributes(['style' => 'text-transform:uppercase;font-size:1.5em;font-weight:bold;']),
|
->extraAttributes(['style' => 'text-transform:uppercase;font-size:1.5em;font-weight:bold;']),
|
||||||
@@ -55,7 +60,7 @@ class VisaMasterPaymentOrderInfolist
|
|||||||
->label(__('Branch'))
|
->label(__('Branch'))
|
||||||
->placeholder('-'),
|
->placeholder('-'),
|
||||||
])
|
])
|
||||||
->columnSpan(1),
|
->columnSpan(2),
|
||||||
|
|
||||||
TextEntry::make('notes')
|
TextEntry::make('notes')
|
||||||
->label(__('Bellik'))
|
->label(__('Bellik'))
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class VisaMasterPaymentOrderResource extends Resource
|
|||||||
|
|
||||||
protected static ?string $cluster = VisaMasterPaymentsCluster::class;
|
protected static ?string $cluster = VisaMasterPaymentsCluster::class;
|
||||||
|
|
||||||
protected static ?string $recordTitleAttribute = 'id';
|
protected static ?string $recordTitleAttribute = 'unique_id';
|
||||||
|
|
||||||
protected static string|BackedEnum|null $navigationIcon = 'icon-visa-plain';
|
protected static string|BackedEnum|null $navigationIcon = 'icon-visa-plain';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,9 @@
|
|||||||
namespace App\Modules\VisaMasterPaymentOrder\Models;
|
namespace App\Modules\VisaMasterPaymentOrder\Models;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Modules\Branch\Interfaces\BelongsToBranch;
|
||||||
use App\Modules\Branch\Models\Branch;
|
use App\Modules\Branch\Models\Branch;
|
||||||
|
use App\Modules\LoanOrder\Repositories\LoanOrderRepository;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
@@ -35,7 +37,7 @@ use Spatie\MediaLibrary\InteractsWithMedia;
|
|||||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||||
*/
|
*/
|
||||||
class VisaMasterPaymentOrder extends Model implements HasMedia
|
class VisaMasterPaymentOrder extends Model implements HasMedia, BelongsToBranch
|
||||||
{
|
{
|
||||||
use InteractsWithMedia;
|
use InteractsWithMedia;
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
@@ -116,4 +118,14 @@ class VisaMasterPaymentOrder extends Model implements HasMedia
|
|||||||
$this->addMediaCollection('sender_passport_local_old')->singleFile();
|
$this->addMediaCollection('sender_passport_local_old')->singleFile();
|
||||||
$this->addMediaCollection('sender_passport_local_old_replacement')->singleFile();
|
$this->addMediaCollection('sender_passport_local_old_replacement')->singleFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "boot" method for model
|
||||||
|
*/
|
||||||
|
protected static function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
|
||||||
|
static::created(LoanOrderRepository::created());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ class FillJsonData extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
|
$this->seedVisaMasterPaymentOrders();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function seedUsers(): void
|
protected function seedUsers(): void
|
||||||
@@ -62,4 +63,9 @@ class FillJsonData extends Seeder
|
|||||||
{
|
{
|
||||||
(new Migrators\CardPinOrdersMigrator)->migrate();
|
(new Migrators\CardPinOrdersMigrator)->migrate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function seedVisaMasterPaymentOrders(): void
|
||||||
|
{
|
||||||
|
(new Migrators\VisaMasterPaymentOrdersMigrator)->migrate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders\Migrators;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use JsonMachine\JsonMachine;
|
||||||
|
use JsonMachine\Items;
|
||||||
|
|
||||||
|
class VisaMasterPaymentOrdersMigrator
|
||||||
|
{
|
||||||
|
public function migrate(): void
|
||||||
|
{
|
||||||
|
DB::table('visa_master_payment_orders')->truncate();
|
||||||
|
|
||||||
|
$path = database_path('data/nurmuhammetsdb/visa_master_payment_orders.json');
|
||||||
|
|
||||||
|
$items = Items::fromFile($path);
|
||||||
|
|
||||||
|
foreach ($items as $id => $item) {
|
||||||
|
if (! $item) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "id": 5,
|
||||||
|
"unique_id": "TB1304-5",
|
||||||
|
"type": "visa",
|
||||||
|
"passport_name": "Döwran",
|
||||||
|
"passport_surname": "Myratlyýew",
|
||||||
|
"phone": "+(993)-65-87-59-99",
|
||||||
|
"email": null,
|
||||||
|
"region": "ag",
|
||||||
|
"branch_id": 5,
|
||||||
|
"user_id": 3,
|
||||||
|
"address": "Aşgabat ş. A.Gowşudow, 57, 2",
|
||||||
|
"sender_datas": "[{\"passport_serie\":\"I-AH\",\"passport_number\":144505,\"full_name\":\"D\\u00f6wran Myratly\\u00fdew\"}]",
|
||||||
|
"payment_reciever": "[{\"passport_serie\":\"II-AH\",\"passport_number\":121445,\"full_name\":\"Kerimberdi Myratly\\u00fdew\"}]",
|
||||||
|
"documents": null,
|
||||||
|
"status": "processing",
|
||||||
|
"notes": null,
|
||||||
|
"created_at": "2024-09-24 19:34:35",
|
||||||
|
"updated_at": "2024-11-24 15:12:04",
|
||||||
|
"paid": true,
|
||||||
|
"deleted_at": "2024-11-24 15:12:04",
|
||||||
|
"sender_full_name": null,
|
||||||
|
"sender_passport_serie": null,
|
||||||
|
"sender_passport_number": null,
|
||||||
|
"sender_deposit_account": null
|
||||||
|
*/
|
||||||
|
|
||||||
|
DB::table('loan_orders')->insert((array) $item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -729,5 +729,6 @@
|
|||||||
"USD rate": "USD kursy",
|
"USD rate": "USD kursy",
|
||||||
"Total": "Jemi",
|
"Total": "Jemi",
|
||||||
"Data": "Maglumatlar",
|
"Data": "Maglumatlar",
|
||||||
"Watch Full": "Giňişleýin"
|
"Watch Full": "Giňişleýin",
|
||||||
|
"Order ID": "Sargyt belgisi"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user