Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe 2025-04-30 15:35:10 +01:00
commit 85bd47c240
7 changed files with 33 additions and 7 deletions

View file

@ -5,6 +5,8 @@ namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Transformers\ActionlogsTransformer;
use App\Models\Actionlog;
use App\Models\Company;
use App\Models\Setting;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
@ -18,10 +20,11 @@ class ReportsController extends Controller
*/
public function index(Request $request) : JsonResponse | array
{
$this->authorize('reports.view');
$this->authorize('activity.view');
$actionlogs = Actionlog::with('item', 'user', 'adminuser', 'target', 'location');
if ($request->filled('search')) {
$actionlogs = $actionlogs->TextSearch(e($request->input('search')));
}

View file

@ -33,7 +33,7 @@ class LocationPresenter extends Presenter
'switchable' => true,
'title' => trans('general.company'),
'visible' => false,
'formatter' => 'locationCompanyObjFilterFormatter'
'formatter' => 'companiesLinkObjFormatter'
],
[
'field' => 'name',

View file

@ -168,6 +168,15 @@ class AuthServiceProvider extends ServiceProvider
}
});
// -----------------------------------------
// Activity
// -----------------------------------------
Gate::define('activity.view', function ($user) {
if (($user->hasAccess('reports.view')) || ($user->hasAccess('admin'))) {
return true;
}
});
// -----------------------------------------
// Self
// -----------------------------------------

View file

@ -385,6 +385,7 @@ class BreadcrumbsServiceProvider extends ServiceProvider
Breadcrumbs::for('locations.edit', fn (Trail $trail, Location $location) =>
$trail->parent('locations.index', route('locations.index'))
->push($location->name, route('locations.show', $location))
->push(trans('general.breadcrumb_button_actions.edit_item', ['name' => $location->name]), route('locations.edit', $location))
);

View file

@ -390,6 +390,8 @@ return [
'new_license' => 'New License',
'new_accessory' => 'New Accessory',
'new_consumable' => 'New Consumable',
'new_component' => 'New Component',
'new_user' => 'New User',
'collapse' => 'Collapse',
'assigned' => 'Assigned',
'asset_count' => 'Asset Count',

View file

@ -172,6 +172,7 @@ return [
'url' => 'The :attribute field must be a valid URL.',
'ulid' => 'The :attribute field must be a valid ULID.',
'uuid' => 'The :attribute field must be a valid UUID.',
'fmcs_location' => 'Full multiple company support and location scoping is enabled in the Admin Settings, and the selected location and selected company are not compatible.',
/*

View file

@ -172,26 +172,36 @@
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="col-md-2">
@can('create', \App\Models\Asset::class)
<a class="btn bg-teal" style="width: 100%" href="{{ route('hardware.create') }}">{{ trans('general.new_asset') }}</a>
@endcan
</div>
<div class="col-md-3">
<div class="col-md-2">
@can('create', \App\Models\License::class)
<a class="btn bg-maroon" style="width: 100%" href="{{ route('licenses.create') }}">{{ trans('general.new_license') }}</a>
@endcan
</div>
<div class="col-md-3">
<div class="col-md-2">
@can('create', \App\Models\Accessory::class)
<a class="btn bg-orange" style="width: 100%" href="{{ route('accessories.create') }}">{{ trans('general.new_accessory') }}</a>
@endcan
</div>
<div class="col-md-3">
<div class="col-md-2">
@can('create', \App\Models\Consumable::class)
<a class="btn bg-purple" style="width: 100%" href="{{ route('consumables.create') }}">{{ trans('general.new_consumable') }}</a>
@endcan
</div>
<div class="col-md-2">
@can('create', \App\Models\Component::class)
<a class="btn bg-yellow" style="width: 100%" href="{{ route('components.create') }}">{{ trans('general.new_component') }}</a>
@endcan
</div>
<div class="col-md-2">
@can('create', \App\Models\User::class)
<a class="btn bg-light-blue" style="width: 100%" href="{{ route('users.create') }}">{{ trans('general.new_user') }}</a>
@endcan
</div>
</div>
</div>
</div>
@ -282,7 +292,7 @@
<div class="row">
<div class="col-md-6">
@if ($snipeSettings->full_multiple_companies_support=='1')
@if ((($snipeSettings->scope_locations_fmcs!='1') && ($snipeSettings->full_multiple_companies_support=='1')))
<!-- Companies -->
<div class="box box-default">
<div class="box-header with-border">