Loan Paid off letter
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova\Resources\Order\Loan\LoanPaidOffLetter;
|
||||
|
||||
use App\Nova\Resources\Branch\Branch;
|
||||
use App\Nova\User;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
use App\Repos\System\Settings\Location\RegionRepo;
|
||||
use Laravel\Nova\Fields\Badge;
|
||||
use Laravel\Nova\Fields\BelongsTo;
|
||||
use Laravel\Nova\Fields\Date;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\Number;
|
||||
use Laravel\Nova\Fields\Select;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
use Laravel\Nova\Panel;
|
||||
use Nurmuhammet\NovaInputmask\NovaInputmask;
|
||||
|
||||
class LoanPaidOffLetterOrderFieldsForDetail
|
||||
{
|
||||
/**
|
||||
* Loan paidoff letter detail fields
|
||||
*
|
||||
* @param $resource
|
||||
* @param $request
|
||||
*/
|
||||
public static function make(): array
|
||||
{
|
||||
return [
|
||||
ID::make()->hide(),
|
||||
Text::make(__('ID'), 'unique_id'),
|
||||
|
||||
Badge::make(__('Status'), 'status')
|
||||
->map(OrderRepo::statusClasses())
|
||||
->addTypes([
|
||||
'primary' => 'dark:bg-gray-900 bg-gray-600 text-white',
|
||||
])
|
||||
->labels(OrderRepo::statusValues())
|
||||
->withIcons()
|
||||
->icons(OrderRepo::statusIcons()),
|
||||
|
||||
Text::make(__('Note'), 'notes'),
|
||||
|
||||
BelongsTo::make(__('Created by').': ', 'user', User::class),
|
||||
|
||||
new Panel(__('Location'), [
|
||||
Select::make(__('Region'), 'region')
|
||||
->displayUsingLabels()
|
||||
->options(RegionRepo::values()),
|
||||
|
||||
BelongsTo::make(__('Branch'), 'branch', Branch::class),
|
||||
]),
|
||||
|
||||
new Panel(__('Personal data'), [
|
||||
Text::make(
|
||||
__('Full Name'),
|
||||
fn ($model) => sprintf(
|
||||
'%s %s %s',
|
||||
$model->customer_name,
|
||||
$model->customer_surname,
|
||||
$model->customer_patronic_name
|
||||
)
|
||||
),
|
||||
|
||||
Date::make(__('Date of birth'), 'born_at')
|
||||
->toTurkmenFormat(),
|
||||
|
||||
NovaInputmask::make(__('Phone'), 'phone')
|
||||
->mask('+(\\9\\93)-99-99-99-99')
|
||||
->storeRawValue(),
|
||||
|
||||
Select::make(__('Passport serie'), 'passport_serie')
|
||||
->displayUsingLabels()
|
||||
->options(PassportRepo::values()),
|
||||
|
||||
Number::make(__('Passport id'), 'passport_id'),
|
||||
]),
|
||||
|
||||
new Panel(__('Karz barada maglumatlar'), [
|
||||
Text::make(__('Karz şertnamanyň belgisi'), 'loan_contract_number'),
|
||||
Text::make(__('Karz şertnamanyň senesi'), 'loan_contract_date'),
|
||||
Text::make(__('Karzyň möçberi'), 'loan_amount'),
|
||||
Text::make(__('Karzyň maksady'), 'loan_reason'),
|
||||
]),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova\Resources\Order\Loan\LoanPaidOffLetter;
|
||||
|
||||
use App\Nova\Resources\Branch\Branch;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use App\Repos\System\Settings\Location\RegionRepo;
|
||||
use Laravel\Nova\Fields\Badge;
|
||||
use Laravel\Nova\Fields\BelongsTo;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\Select;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
|
||||
class LoanPaidOffLetterOrderFieldsForIndex
|
||||
{
|
||||
/**
|
||||
* Loan paidoff letter index fields
|
||||
*/
|
||||
public static function make($resource, $request): array
|
||||
{
|
||||
return [
|
||||
ID::make()->hide(),
|
||||
|
||||
Text::make(__('ID'), 'unique_id')->sortable(),
|
||||
|
||||
Select::make(__('Region'), 'region')
|
||||
->displayUsingLabels()
|
||||
->options(RegionRepo::values())
|
||||
->canSeeWhen('isAdmin', $resource)
|
||||
->sortable(),
|
||||
|
||||
BelongsTo::make(__('Branch'), 'branch', Branch::class)
|
||||
->canSeeWhen('isAdmin', $resource)
|
||||
->filterable()
|
||||
->sortable(),
|
||||
|
||||
Text::make(__('Name'), 'customer_name'),
|
||||
|
||||
Text::make(__('Surname'), 'customer_surname'),
|
||||
|
||||
Text::make(__('Phone'), 'phone'),
|
||||
|
||||
Badge::make(__('Status'), 'status')
|
||||
->map(OrderRepo::statusClasses())
|
||||
->addTypes([
|
||||
'primary' => 'dark:bg-gray-900 bg-gray-600 text-white',
|
||||
])
|
||||
->labels(OrderRepo::statusValues())
|
||||
->withIcons()
|
||||
->icons(OrderRepo::statusIcons())
|
||||
->sortable(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ use App\Models\Order\Loan\LoanPaidOffLetterOrder as LoanPaidOffLetterOrderModel;
|
||||
use App\Nova\Filters\RegionFilter;
|
||||
use App\Nova\Filters\StatusFilter;
|
||||
use App\Nova\Resource;
|
||||
use App\Nova\Resources\Order\Loan\LoanPaidOffLetter\LoanPaidOffLetterOrderFieldsForDetail;
|
||||
use App\Nova\Resources\Order\Loan\LoanPaidOffLetter\LoanPaidOffLetterOrderFieldsForIndex;
|
||||
use App\Repos\Order\Card\CardOrderRepo;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use App\Repos\System\Nova\NovaRepo;
|
||||
@@ -125,17 +127,29 @@ class LoanPaidOffLetterOrder extends Resource
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields displayed by the resource.
|
||||
*
|
||||
* @return array
|
||||
* Get the fields for index.
|
||||
*/
|
||||
public function fields(NovaRequest $request)
|
||||
public function fieldsForIndex(NovaRequest $request): array
|
||||
{
|
||||
return LoanPaidOffLetterOrderFieldsForIndex::make($this, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields for detail
|
||||
*/
|
||||
public function fieldsForDetail(): array
|
||||
{
|
||||
return LoanPaidOffLetterOrderFieldsForDetail::make($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields displayed by the resource.
|
||||
*/
|
||||
public function fields(NovaRequest $request): array
|
||||
{
|
||||
return [
|
||||
ID::make()->sortable(),
|
||||
|
||||
ID::make()->sortable(),
|
||||
|
||||
Hidden::make('user_id')
|
||||
->default(auth()->id())
|
||||
->hideWhenUpdating(),
|
||||
|
||||
Reference in New Issue
Block a user