WIP
This commit is contained in:
@@ -4,10 +4,64 @@ namespace App\Models\Order\Loan;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class LoanOrder extends Model
|
class LoanOrder extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'unique_id',
|
||||||
|
'loan_type',
|
||||||
|
'region',
|
||||||
|
'branch_id',
|
||||||
|
'customer_name',
|
||||||
|
'customer_surname',
|
||||||
|
'customer_patronic_name',
|
||||||
|
'passport_address',
|
||||||
|
'real_address',
|
||||||
|
'passport_serie',
|
||||||
|
'passport_id',
|
||||||
|
'passport_given_at',
|
||||||
|
'passport_given_by',
|
||||||
|
'born_place',
|
||||||
|
'born_at',
|
||||||
|
'email',
|
||||||
|
'phone',
|
||||||
|
'phone_additional',
|
||||||
|
'phone_home',
|
||||||
|
'work_region',
|
||||||
|
'work_province',
|
||||||
|
'work_company',
|
||||||
|
'work_company_accountant_number',
|
||||||
|
'work_started_at',
|
||||||
|
'work_salary',
|
||||||
|
'work_position',
|
||||||
|
'education',
|
||||||
|
'marriage_status',
|
||||||
|
'passport_one',
|
||||||
|
'passport_two',
|
||||||
|
'passport_three',
|
||||||
|
'passport_four',
|
||||||
|
'filled_by',
|
||||||
|
'user_id',
|
||||||
|
'status',
|
||||||
|
'status_reason',
|
||||||
|
'notes',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loan type
|
||||||
|
*/
|
||||||
|
public function loanType(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(LoanType::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
163
app/Nova/Resources/Order/Loan/LoanOrder.php
Normal file
163
app/Nova/Resources/Order/Loan/LoanOrder.php
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Nova\Resources\Order\Loan;
|
||||||
|
|
||||||
|
use App\Models\Order\Loan\LoanOrder as LoanOrderModel;
|
||||||
|
use App\Nova\Resource;
|
||||||
|
use App\Repos\Order\Loan\BranchRepo;
|
||||||
|
use App\Repos\Order\Loan\LoanTypeRepo;
|
||||||
|
use App\Repos\System\Settings\Location\RegionRepo;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Laravel\Nova\Fields\ID;
|
||||||
|
use Laravel\Nova\Fields\Select;
|
||||||
|
use Laravel\Nova\Fields\Text;
|
||||||
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
|
|
||||||
|
class LoanOrder extends Resource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The model the resource corresponds to.
|
||||||
|
*
|
||||||
|
* @var class-string<LoanOrderModel>
|
||||||
|
*/
|
||||||
|
public static $model = LoanOrderModel::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The single value that should be used to represent the resource when being displayed.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public static $title = 'unique_id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The columns that should be searched.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $search = [
|
||||||
|
'unique_id',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the displayable label of the resource.
|
||||||
|
*/
|
||||||
|
public static function label(): string
|
||||||
|
{
|
||||||
|
return __('Loan orders');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the displayable singular label of the resource.
|
||||||
|
*/
|
||||||
|
public static function singularLabel(): string
|
||||||
|
{
|
||||||
|
return __('Loan order');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the fields displayed by the resource.
|
||||||
|
*/
|
||||||
|
public function fields(NovaRequest $request): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
ID::make()->sortable(),
|
||||||
|
|
||||||
|
// $table->string('unique_id')->unique();
|
||||||
|
|
||||||
|
Select::make(__('Region'), 'region')
|
||||||
|
->displayUsingLabels()
|
||||||
|
->searchable()
|
||||||
|
->options(RegionRepo::values())
|
||||||
|
->default(RegionRepo::default())
|
||||||
|
->rules('required')
|
||||||
|
->sortable(),
|
||||||
|
|
||||||
|
Select::make(__('Branch'), 'branch_id')
|
||||||
|
->displayUsingLabels()
|
||||||
|
->searchable()
|
||||||
|
->options(BranchRepo::values())
|
||||||
|
->rules('required')
|
||||||
|
->sortable(),
|
||||||
|
|
||||||
|
Select::make(__('Loan type'), 'loan_type')
|
||||||
|
->displayUsingLabels()
|
||||||
|
->searchable()
|
||||||
|
->options(LoanTypeRepo::values())
|
||||||
|
->rules('required')
|
||||||
|
->sortable(),
|
||||||
|
|
||||||
|
Text::make(__('Customer name'), 'customer_name')
|
||||||
|
->rules('required', 'string', 'max:255'),
|
||||||
|
|
||||||
|
Text::make(__('Customer surname'), 'customer_surname')
|
||||||
|
->rules('required', 'string', 'max:255'),
|
||||||
|
|
||||||
|
Text::make(__('Customer patronic name'), 'customer_patronic_name')
|
||||||
|
->rules('required', 'string', 'max:255'),
|
||||||
|
|
||||||
|
|
||||||
|
// $table->string('passport_address');
|
||||||
|
// $table->string('real_address');
|
||||||
|
// $table->string('passport_serie')->index();
|
||||||
|
// $table->integer('passport_id')->index();
|
||||||
|
// $table->date('passport_given_at');
|
||||||
|
// $table->string('passport_given_by');
|
||||||
|
// $table->string('born_place');
|
||||||
|
// $table->date('born_at');
|
||||||
|
// $table->string('email')->nullable()->index();
|
||||||
|
// $table->string('phone')->index();
|
||||||
|
// $table->string('phone_additional')->nullable();
|
||||||
|
// $table->string('phone_home')->nullable();
|
||||||
|
// $table->string('work_region')->nullable()->index();
|
||||||
|
// $table->string('work_province')->nullable();
|
||||||
|
// $table->string('work_company')->nullable();
|
||||||
|
// $table->string('work_company_accountant_number')->nullable();
|
||||||
|
// $table->date('work_started_at')->nullable();
|
||||||
|
// $table->string('work_salary')->nullable();
|
||||||
|
// $table->string('work_position')->nullable();
|
||||||
|
// $table->string('education');
|
||||||
|
// $table->string('marriage_status');
|
||||||
|
// $table->text('passport_one');
|
||||||
|
// $table->text('passport_two');
|
||||||
|
// $table->text('passport_three');
|
||||||
|
// $table->text('passport_four');
|
||||||
|
// $table->foreignId('filled_by')->constrained('users')->restrictOnDelete();
|
||||||
|
// $table->foreignId('user_id')->constrained('users')->restrictOnDelete();
|
||||||
|
// $table->string('status')->index();
|
||||||
|
// $table->string('status_reason')->nullable();
|
||||||
|
// $table->string('notes')->nullable();
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the cards available for the request.
|
||||||
|
*/
|
||||||
|
public function cards(NovaRequest $request): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the filters available for the resource.
|
||||||
|
*/
|
||||||
|
public function filters(NovaRequest $request): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the lenses available for the resource.
|
||||||
|
*/
|
||||||
|
public function lenses(NovaRequest $request): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the actions available for the resource.
|
||||||
|
*/
|
||||||
|
public function actions(NovaRequest $request): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -36,6 +36,22 @@ class LoanType extends Resource
|
|||||||
'name',
|
'name',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the displayable label of the resource.
|
||||||
|
*/
|
||||||
|
public static function label(): string
|
||||||
|
{
|
||||||
|
return __('Loan types');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the displayable singular label of the resource.
|
||||||
|
*/
|
||||||
|
public static function singularLabel(): string
|
||||||
|
{
|
||||||
|
return __('Loan type');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the fields displayed by the resource.
|
* Get the fields displayed by the resource.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use App\Nova\Resources\Branch\Branch;
|
use App\Nova\Resources\Branch\Branch;
|
||||||
|
use App\Nova\Resources\Order\Loan\LoanOrder;
|
||||||
use App\Nova\Resources\Order\Loan\LoanType;
|
use App\Nova\Resources\Order\Loan\LoanType;
|
||||||
use App\Nova\Resources\System\Location\Province;
|
use App\Nova\Resources\System\Location\Province;
|
||||||
use App\Nova\Resources\System\Roles\Permission;
|
use App\Nova\Resources\System\Roles\Permission;
|
||||||
@@ -111,6 +112,10 @@ class NovaServiceProvider extends NovaApplicationServiceProvider
|
|||||||
return [
|
return [
|
||||||
MenuSection::dashboard(Main::class)->icon('chart-bar'),
|
MenuSection::dashboard(Main::class)->icon('chart-bar'),
|
||||||
|
|
||||||
|
MenuSection::make(__('System'), [
|
||||||
|
MenuItem::resource(LoanOrder::class),
|
||||||
|
])->icon('collection')->collapsable(),
|
||||||
|
|
||||||
MenuSection::make(__('System'), [
|
MenuSection::make(__('System'), [
|
||||||
MenuGroup::make(__('User'), [
|
MenuGroup::make(__('User'), [
|
||||||
MenuItem::resource(User::class),
|
MenuItem::resource(User::class),
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Repos\Branch;
|
|
||||||
|
|
||||||
class BranchRepo
|
|
||||||
{
|
|
||||||
}
|
|
||||||
17
app/Repos/Order/Loan/BranchRepo.php
Normal file
17
app/Repos/Order/Loan/BranchRepo.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repos\Order\Loan;
|
||||||
|
|
||||||
|
use App\Models\Branch\Branch;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
class BranchRepo
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Branch values
|
||||||
|
*/
|
||||||
|
public static function values(): Collection|array
|
||||||
|
{
|
||||||
|
return Branch::pluck('name', 'id');
|
||||||
|
}
|
||||||
|
}
|
||||||
17
app/Repos/Order/Loan/LoanTypeRepo.php
Normal file
17
app/Repos/Order/Loan/LoanTypeRepo.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repos\Order\Loan;
|
||||||
|
|
||||||
|
use App\Models\Order\Loan\LoanType;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
class LoanTypeRepo
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Loan type values
|
||||||
|
*/
|
||||||
|
public static function values(): Collection|array
|
||||||
|
{
|
||||||
|
return LoanType::pluck('name', 'id');
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user