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

234 lines
7.1 KiB
PHP

<?php
namespace App\Nova\Resources\Order\Loan;
use App\Models\Order\Loan\LoanOrder as LoanOrderModel;
use App\Nova\Resource;
use App\Nova\Resources\Branch\Concerns\BranchNovaRepo;
use App\Repos\Order\Loan\BranchRepo;
use App\Repos\Order\Loan\LoanTypeRepo;
use App\Repos\System\Settings\Legal\EducationRepo;
use App\Repos\System\Settings\Legal\MarriageRepo;
use App\Repos\System\Settings\Legal\PassportRepo;
use App\Repos\System\Settings\Location\RegionRepo;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\Date;
use Laravel\Nova\Fields\Email;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Number;
use Laravel\Nova\Fields\Select;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
use Nurmuhammet\NovaInputmask\NovaInputmask;
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())
->dependsOn('region', BranchNovaRepo::dependsOnRegion())
->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'),
Text::make(__('Residence (passport)'), 'passport_address')
->rules('required', 'string', 'max:255'),
Text::make(__('Current Residence'), 'real_address')
->rules('required', 'string', 'max:255'),
Select::make(__('Passport serie'), 'passport_serie')
->displayUsingLabels()
->searchable()
->options(PassportRepo::values())
->rules('required')
->sortable(),
Number::make(__('Passport id'), 'passport_id')
->rules('required'),
Date::make(__('Passport date of issue'), 'passport_given_at')
->rules('required'),
Text::make(__('Passport given by'), 'passport_given_by')
->rules('required'),
Text::make(__('Born place (passport)'), 'born_place')
->rules('required'),
Date::make(__('Date of birth'), 'born_at')
->rules('required'),
Email::make(__('Email'), 'email')
->rules('nullable', 'email'),
NovaInputmask::make(__('Phone'), 'phone')
->phonenumber('TM')
->rules('required'),
NovaInputmask::make(__('Phone Additional'), 'phone_additional')
->phonenumber('TM')
->rules('required'),
NovaInputmask::make(__('Home phone'), 'phone_home')
->rules('required'),
Select::make(__('Work region'), 'work_region')
->displayUsingLabels()
->searchable()
->options(RegionRepo::values())
->default(RegionRepo::default())
->rules('required')
->sortable(),
Select::make(__('Work province'), 'work_province')
->displayUsingLabels()
->searchable()
->dependsOn('region', BranchNovaRepo::dependsOnRegion('work_region')),
Text::make(__('Work company name'), 'work_company')
->rules('required', 'string', 'max:255'),
NovaInputmask::make(__('HR department work number'), 'work_company_accountant_number'),
Date::make(__('Work started at'), 'work_started_at')
->rules('required'),
Text::make(__('Salary'), 'work_salary')
->rules('required'),
Text::make(__('Position'), 'work_position')
->rules('required'),
Select::make(__('Education'), 'education')
->displayUsingLabels()
->searchable()
->options(EducationRepo::values())
->rules('required')
->sortable(),
Select::make(__('Marriage status'), 'marriage_status')
->displayUsingLabels()
->searchable()
->options(MarriageRepo::values())
->rules('required')
->sortable(),
// $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 [];
}
}