Change Accessories report to use server-side pagination from URL

This commit is contained in:
Brady Wetherington 2023-01-24 17:35:44 -08:00
parent 6f6f99f64e
commit c9f0f5fe8b
2 changed files with 7 additions and 17 deletions

View file

@ -51,9 +51,8 @@ class ReportsController extends Controller
public function getAccessoryReport()
{
$this->authorize('reports.view');
$accessories = Accessory::orderBy('created_at', 'DESC')->with('company')->get();
return view('reports/accessories', compact('accessories'));
return view('reports/accessories');
}
/**

View file

@ -27,6 +27,7 @@
data-sort-order="asc"
id="accessoriesReport"
class="table table-striped snipe-table"
data-url="{{ route('api.accessories.index') }}"
data-export-options='{
"fileName": "accessory-report-{{ date('Y-m-d') }}",
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
@ -34,27 +35,17 @@
<thead>
<tr>
<th class="col-sm-1">{{ trans('admin/companies/table.title') }}</th>
<th class="col-sm-1">{{ trans('admin/accessories/table.title') }}</th>
<th class="col-sm-1">{{ trans('general.model_no') }}</th>
<th class="col-sm-1">{{ trans('admin/accessories/general.total') }}</th>
<th class="col-sm-1">{{ trans('admin/accessories/general.remaining') }}</th>
<th class="col-sm-1" data-field="company">{{ trans('admin/companies/table.title') }}</th>
<th class="col-sm-1" data-field="name">{{ trans('admin/accessories/table.title') }}</th>
<th class="col-sm-1" data-field="model_number">{{ trans('general.model_no') }}</th>
<th class="col-sm-1" data-field="qty">{{ trans('admin/accessories/general.total') }}</th>
<th class="col-sm-1" data-field="remaining_qty">{{ trans('admin/accessories/general.remaining') }}</th>
</tr>
</thead>
<tbody>
@foreach ($accessories as $accessory)
<tr>
<td>{{ is_null($accessory->company) ? '' : $accessory->company->name }}</td>
<td>{{ $accessory->name }}</td>
<td>{{ $accessory->model_number }}</td>
<td>{{ $accessory->qty }}</td>
<td>{{ $accessory->numRemaining() }}</td>
</tr>
@endforeach
</tbody>
</table>
</table>
</div>
</div>
</div>