61 lines
1.7 KiB
PHP
61 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Nova\Resources\Order\Card\Requisite\Concerns;
|
|
|
|
use App\Nova\Resources\Branch\Branch;
|
|
use App\Nova\Resources\Order\Card\CardType;
|
|
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 CardRequisiteFieldsForIndex
|
|
{
|
|
/**
|
|
* Fields for index
|
|
* @param $resource
|
|
* @param $request
|
|
*/
|
|
public static function make($resource, $request): array
|
|
{
|
|
return [
|
|
ID::make()->hide(),
|
|
|
|
Text::make(__('ID'), 'unique_id')->sortable(),
|
|
|
|
BelongsTo::make(__('Type'), 'cardType', CardType::class)
|
|
->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(),
|
|
];
|
|
}
|
|
}
|