128 lines
3.2 KiB
PHP
128 lines
3.2 KiB
PHP
<?php
|
|
|
|
namespace App\Nova\Resources\Order\Loan\Remaining;
|
|
|
|
use App\Nova\Resource;
|
|
use App\Repos\System\Settings\Legal\PassportRepo;
|
|
use Illuminate\Http\Request;
|
|
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 Laravel\Nova\Panel;
|
|
use Nurmuhammet\NovaCustomHtml\NovaCustomHtml;
|
|
|
|
class NovaLoanRemainingOrder extends Resource
|
|
{
|
|
/**
|
|
* The model the resource corresponds to.
|
|
*
|
|
* @var class-string<\App\Modules\LoanRemainingOrder\Models\LoanRemainingOrder>
|
|
*/
|
|
public static $model = \App\Modules\LoanRemainingOrder\Models\LoanRemainingOrder::class;
|
|
|
|
/**
|
|
* The single value that should be used to represent the resource when being displayed.
|
|
*
|
|
* @var string
|
|
*/
|
|
public static $title = 'account_number';
|
|
|
|
/**
|
|
* The columns that should be searched.
|
|
*
|
|
* @var array
|
|
*/
|
|
public static $search = [
|
|
'account_number',
|
|
];
|
|
|
|
/**
|
|
* Get the displayable label of the resource.
|
|
*/
|
|
public static function label(): string
|
|
{
|
|
return __('Karzyň galyndysy');
|
|
}
|
|
|
|
/**
|
|
* Get the fields displayed by the resource.
|
|
*
|
|
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
|
* @return array
|
|
*/
|
|
public function fields(NovaRequest $request)
|
|
{
|
|
return [
|
|
ID::make()->sortable(),
|
|
|
|
Select::make(__('Passport serie'), 'passport_serie')
|
|
->displayUsingLabels()
|
|
->searchable()
|
|
->options(PassportRepo::values())
|
|
->rules('required')
|
|
->sortable(),
|
|
|
|
Number::make(__('Passport id'), 'passport_id')
|
|
->rules('required', 'numeric', 'digits:6'),
|
|
|
|
Text::make(__('Karz hasaby'), 'account_number')
|
|
->rules('required'),
|
|
|
|
new Panel(__('Karz taryhy'), [
|
|
NovaCustomHtml::make(__('Karz taryhy'), 'loan_history')
|
|
->onlyOnDetail()
|
|
->canSeeWhen('systemUser', $this)
|
|
->html(view('orders.loan.mobile.loan-remaining', [
|
|
'resource' => $this,
|
|
])->render()),
|
|
]),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the cards available for the request.
|
|
*
|
|
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
|
* @return array
|
|
*/
|
|
public function cards(NovaRequest $request)
|
|
{
|
|
return [];
|
|
}
|
|
|
|
/**
|
|
* Get the filters available for the resource.
|
|
*
|
|
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
|
* @return array
|
|
*/
|
|
public function filters(NovaRequest $request)
|
|
{
|
|
return [];
|
|
}
|
|
|
|
/**
|
|
* Get the lenses available for the resource.
|
|
*
|
|
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
|
* @return array
|
|
*/
|
|
public function lenses(NovaRequest $request)
|
|
{
|
|
return [];
|
|
}
|
|
|
|
/**
|
|
* Get the actions available for the resource.
|
|
*
|
|
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
|
* @return array
|
|
*/
|
|
public function actions(NovaRequest $request)
|
|
{
|
|
return [];
|
|
}
|
|
}
|