From c9f0f5fe8b428e6c4955fc4a8f621f6438e778c0 Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Tue, 24 Jan 2023 17:35:44 -0800 Subject: [PATCH] Change Accessories report to use server-side pagination from URL --- app/Http/Controllers/ReportsController.php | 3 +-- resources/views/reports/accessories.blade.php | 21 ++++++------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 6cf2091f60..399e99612c 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -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'); } /** diff --git a/resources/views/reports/accessories.blade.php b/resources/views/reports/accessories.blade.php index 49db62c7f6..44f90682ba 100644 --- a/resources/views/reports/accessories.blade.php +++ b/resources/views/reports/accessories.blade.php @@ -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 @@ - {{ trans('admin/companies/table.title') }} - {{ trans('admin/accessories/table.title') }} - {{ trans('general.model_no') }} - {{ trans('admin/accessories/general.total') }} - {{ trans('admin/accessories/general.remaining') }} + {{ trans('admin/companies/table.title') }} + {{ trans('admin/accessories/table.title') }} + {{ trans('general.model_no') }} + {{ trans('admin/accessories/general.total') }} + {{ trans('admin/accessories/general.remaining') }} - @foreach ($accessories as $accessory) - - {{ is_null($accessory->company) ? '' : $accessory->company->name }} - {{ $accessory->name }} - {{ $accessory->model_number }} - {{ $accessory->qty }} - {{ $accessory->numRemaining() }} - - @endforeach -