mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
Merge pull request #12410 from uberbrady/paginate_accessories_report
Paginate accessories report
This commit is contained in:
commit
5e6ebb9a65
|
@ -26,7 +26,10 @@ class AccessoriesController extends Controller
|
||||||
*/
|
*/
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$this->authorize('view', Accessory::class);
|
if ($request->user()->cannot('reports.view')) {
|
||||||
|
$this->authorize('view', Accessory::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// This array is what determines which fields should be allowed to be sorted on ON the table itself, no relations
|
// This array is what determines which fields should be allowed to be sorted on ON the table itself, no relations
|
||||||
// Relations will be handled in query scopes a little further down.
|
// Relations will be handled in query scopes a little further down.
|
||||||
|
|
|
@ -51,9 +51,8 @@ class ReportsController extends Controller
|
||||||
public function getAccessoryReport()
|
public function getAccessoryReport()
|
||||||
{
|
{
|
||||||
$this->authorize('reports.view');
|
$this->authorize('reports.view');
|
||||||
$accessories = Accessory::orderBy('created_at', 'DESC')->with('company')->get();
|
|
||||||
|
|
||||||
return view('reports/accessories', compact('accessories'));
|
return view('reports/accessories');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
data-sort-order="asc"
|
data-sort-order="asc"
|
||||||
id="accessoriesReport"
|
id="accessoriesReport"
|
||||||
class="table table-striped snipe-table"
|
class="table table-striped snipe-table"
|
||||||
|
data-url="{{ route('api.accessories.index') }}"
|
||||||
data-export-options='{
|
data-export-options='{
|
||||||
"fileName": "accessory-report-{{ date('Y-m-d') }}",
|
"fileName": "accessory-report-{{ date('Y-m-d') }}",
|
||||||
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
|
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
|
||||||
|
@ -34,27 +35,17 @@
|
||||||
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="col-sm-1">{{ trans('admin/companies/table.title') }}</th>
|
<th class="col-sm-1" data-field="company">{{ trans('admin/companies/table.title') }}</th>
|
||||||
<th class="col-sm-1">{{ trans('admin/accessories/table.title') }}</th>
|
<th class="col-sm-1" data-field="name">{{ trans('admin/accessories/table.title') }}</th>
|
||||||
<th class="col-sm-1">{{ trans('general.model_no') }}</th>
|
<th class="col-sm-1" data-field="model_number">{{ trans('general.model_no') }}</th>
|
||||||
<th class="col-sm-1">{{ trans('admin/accessories/general.total') }}</th>
|
<th class="col-sm-1" data-field="qty">{{ trans('admin/accessories/general.total') }}</th>
|
||||||
<th class="col-sm-1">{{ trans('admin/accessories/general.remaining') }}</th>
|
<th class="col-sm-1" data-field="remaining_qty">{{ trans('admin/accessories/general.remaining') }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<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>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue