loan order improvemetns
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Nova\Resources\Order\Loan\Concerns;
|
||||
|
||||
use App\Nova\Resources\Order\Loan\Concerns\LoanOrderNovaRepo;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
|
||||
@@ -10,9 +9,6 @@ trait LoanOrderEvents
|
||||
{
|
||||
/**
|
||||
* Register a callback to be called after the resource is created.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
*/
|
||||
public static function afterCreate(NovaRequest $request, Model $model): void
|
||||
{
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova\Resources\Order\Loan\Concerns;
|
||||
|
||||
use App\Repos\Order\Loan\BranchRepo;
|
||||
use App\Repos\Order\Loan\LoanTypeRepo;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use App\Repos\System\Settings\Location\RegionRepo;
|
||||
use Laravel\Nova\Fields\Badge;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\Select;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
|
||||
class LoanOrderFieldsForIndex
|
||||
{
|
||||
/**
|
||||
* Loan Order fields for "create"
|
||||
*/
|
||||
public static function make(): array
|
||||
{
|
||||
return [
|
||||
ID::make()->hide(),
|
||||
|
||||
Text::make(__('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(__('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()
|
||||
->sortable(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ namespace App\Nova\Resources\Order\Loan\Concerns;
|
||||
|
||||
use App\Models\Branch\Branch;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use Closure;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
|
||||
@@ -13,7 +12,7 @@ class LoanOrderNovaRepo
|
||||
public static function fillUniqueId($request, $model): string
|
||||
{
|
||||
return mb_strtoupper(sprintf(
|
||||
'%s-%s',
|
||||
'%s-%s',
|
||||
Branch::find($request->branch_id)->unique_code ?? 'TB',
|
||||
$model->id
|
||||
)) ?? uniqid();
|
||||
|
||||
Reference in New Issue
Block a user