Files
online.tbbank.gov.tm-larave…/app/Nova/Resources/Order/Loan/LoanOrder.php

163 lines
4.8 KiB
PHP

<?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 [];
}
}