Untitled
unknown
php
10 months ago
3.0 kB
5
Indexable
public function newIndex(Request $request){
$columns = [
GenericColumn::make('id', 'ID')->sortable()->toArray(),
GenericColumn::make('reference', 'Reference')->sortable()->toArray(),
GenericColumn::make('description', 'Description')->sortable()->toArray(),
GenericColumn::make('stage.name', 'Stage')->sortable()->toArray(),
GenericColumn::make('status.name', 'Status')->sortable()->toArray(),
GenericColumn::make('docket_priority.name', 'Priority')->sortable()->toArray(),
GenericColumn::make('company_level_five.name', CompanyLevelDescriptions::first()->company_level_5_description)->sortable()->toArray(),
GenericColumn::make('categories', 'Categories')->sortable()->toArray(),
GenericColumn::make('due_date', 'Due Date')->sortable()->toArray(),
GenericColumn::make('created_by_user.full_name', 'Created By')->sortable()->toArray(),
];
$headerActions = [
'excel' => ExportAction::make('url', route('export-dockets-excel'))
->color('green')
->icon('mdi-file-excel')
->toArray(),
];
$actions = [
'show' => ShowAction::make('url', route('docket.show', '#id#'))
->color('blue')
->toArray(),
];
$filters = [
'tags' => [
'items' => DocketTag::get()->toArray(),
'index' => 'name'
],
'categories' => [
'items' => DocketCategory::select(['id', 'name'])->get()->toArray(), // Array of objects
'index' => 'name',
],
'users' => [
'items' => User::get()->toArray(), // Array of objects
'index' => 'full_name',
],
'company_level_fives' => [
'items' => CompanyLevelFive::select(['id', 'name'])->get()->toArray(), // Array of objects
'index' => 'name',
],
'stages' => [
'items' => DocketStage::select(['id', 'name'])->get()->toArray(), // Array of objects
'index' => 'name',
],
'statuses' => [
'items' => DocketStatus::select(['id', 'name'])->get()->toArray(), // Array of objects
'index' => 'name',
],
];
$itemsPerPage = $request->input('itemsPerPage', 10);
$page = $request->input('page', 1);
$ajaxTableUrl = route('ajax.table.dockets');
$title = CompanyLevelDescriptions::first()->docket_description;
return Inertia::render('Docket/IndexTest',[
'columns' => $columns,
'itemsPerPage' => $itemsPerPage,
'page' => $page,
'headerActions' => $headerActions,
'actions' => $actions,
'ajaxTableUrl' => $ajaxTableUrl,
'filters' => $filters,
'title' => $title,
]);
}Editor is loading...
Leave a Comment