wip on loanorders
This commit is contained in:
@@ -5,6 +5,7 @@ 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\Nova\Resources\Order\Loan\Concerns\LoanOrderEvents;
|
||||
use App\Nova\Resources\Order\Loan\Concerns\LoanOrderNovaRepo;
|
||||
use App\Repos\Order\Loan\BranchRepo;
|
||||
use App\Repos\Order\Loan\LoanTypeRepo;
|
||||
@@ -17,7 +18,9 @@ use Konsulting\NovaTarget\NovaTarget;
|
||||
use Laravel\Nova\Fields\Date;
|
||||
use Laravel\Nova\Fields\Email;
|
||||
use Laravel\Nova\Fields\File;
|
||||
use Laravel\Nova\Fields\Hidden;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\Image;
|
||||
use Laravel\Nova\Fields\Number;
|
||||
use Laravel\Nova\Fields\Select;
|
||||
use Laravel\Nova\Fields\Slug;
|
||||
@@ -28,6 +31,8 @@ use Nurmuhammet\NovaInputmask\NovaInputmask;
|
||||
|
||||
class LoanOrder extends Resource
|
||||
{
|
||||
use LoanOrderEvents;
|
||||
|
||||
/**
|
||||
* The model the resource corresponds to.
|
||||
*
|
||||
@@ -48,9 +53,30 @@ class LoanOrder extends Resource
|
||||
* @var array
|
||||
*/
|
||||
public static $search = [
|
||||
'unique_id',
|
||||
'unique_id', 'customer_name', 'customer_surname'
|
||||
];
|
||||
|
||||
/**
|
||||
* Indicates whether the resource should automatically poll for new resources.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
// public static $polling = true;
|
||||
|
||||
// /**
|
||||
// * The interval at which Nova should poll for new resources.
|
||||
// *
|
||||
// * @var int
|
||||
// */
|
||||
// public static $pollingInterval = 120;
|
||||
|
||||
// /**
|
||||
// * Indicates whether to show the polling toggle button inside Nova.
|
||||
// *
|
||||
// * @var bool
|
||||
// */
|
||||
// public static $showPollingToggle = true;
|
||||
|
||||
/**
|
||||
* Get the displayable label of the resource.
|
||||
*/
|
||||
@@ -68,12 +94,37 @@ class LoanOrder extends Resource
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields for create.
|
||||
* Get the fields for index.
|
||||
*/
|
||||
// public function fieldsForCreate(NovaRequest $request): array
|
||||
// {
|
||||
public function fieldsForIndex(NovaRequest $request): array
|
||||
{
|
||||
return [
|
||||
ID::make()->hide(),
|
||||
|
||||
// }
|
||||
Text::make(__('Unique id'), 'unique_id')->sortable(),
|
||||
|
||||
Select::make(__('Loan type'), 'loan_type')
|
||||
->displayUsingLabels()
|
||||
->options(LoanTypeRepo::values())
|
||||
->sortable(),
|
||||
|
||||
Select::make(__('Region'), 'region')
|
||||
->displayUsingLabels()
|
||||
->options(RegionRepo::values())
|
||||
->sortable(),
|
||||
|
||||
Select::make(__('Branch'), 'branch_id')
|
||||
->displayUsingLabels()
|
||||
->options(BranchRepo::values())
|
||||
->sortable(),
|
||||
|
||||
Text::make(__('Customer name'), 'customer_name'),
|
||||
|
||||
Text::make(__('Customer surname'), 'customer_surname'),
|
||||
|
||||
Text::make(__('Phone'), 'phone')
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields displayed by the resource.
|
||||
@@ -81,7 +132,7 @@ class LoanOrder extends Resource
|
||||
public function fields(NovaRequest $request): array
|
||||
{
|
||||
return [
|
||||
ID::hidden()->sortable(),
|
||||
ID::make()->sortable(),
|
||||
|
||||
new Panel(__('Loan'), [
|
||||
Select::make(__('Loan type'), 'loan_type')
|
||||
@@ -196,7 +247,7 @@ class LoanOrder extends Resource
|
||||
NovaInputmask::make(__('Phone Additional'), 'phone_additional')
|
||||
->phonenumber('TM')
|
||||
->size('w-1/4')
|
||||
->rules('required'),
|
||||
->rules('nullable'),
|
||||
|
||||
NovaInputmask::make(__('Home phone'), 'phone_home')
|
||||
->size('w-1/4')
|
||||
@@ -225,8 +276,8 @@ class LoanOrder extends Resource
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->dependsOn('region', BranchNovaRepo::dependsOnRegion('work_region'))
|
||||
->size('w-1/2')
|
||||
->rules('required'),
|
||||
->size('w-1/2'),
|
||||
// ->rules('required'),
|
||||
|
||||
Text::make(__('Position'), 'work_position')
|
||||
->size('w-1/2')
|
||||
@@ -242,10 +293,21 @@ class LoanOrder extends Resource
|
||||
]),
|
||||
|
||||
new Panel(__('Passport'), [
|
||||
File::make(__('Passport (page 1)'), 'passport_one'),
|
||||
File::make(__('Passport (page 2-3)'), 'passport_two'),
|
||||
File::make(__('Passport (page 8-9)'), 'passport_three'),
|
||||
File::make(__('Passport (page 32)'), 'passport_four'),
|
||||
Image::make(__('Passport (page 1)'), 'passport_one')
|
||||
->size('w-1/2')
|
||||
->rules('required', 'max:2048'),
|
||||
|
||||
Image::make(__('Passport (page 2-3)'), 'passport_two')
|
||||
->size('w-1/2')
|
||||
->rules('required', 'max:2048'),
|
||||
|
||||
Image::make(__('Passport (page 8-9)'), 'passport_three')
|
||||
->size('w-1/2')
|
||||
->rules('required', 'max:2048'),
|
||||
|
||||
Image::make(__('Passport (page 32)'), 'passport_four')
|
||||
->size('w-1/2')
|
||||
->rules('required', 'max:2048'),
|
||||
]),
|
||||
|
||||
// $table->foreignId('filled_by')->constrained('users')->restrictOnDelete();
|
||||
|
||||
Reference in New Issue
Block a user