A free open source IT asset/license management system
Break the dashboard into new widget blade components
sniped8059d13fdda
diff --git a/resources/views/blade/dashboard/assets-by-status.blade.php b/resources/views/blade/dashboard/assets-by-status.blade.phpnew file mode 100644index 0000000000..154a2607a3--- /dev/null+++ b/resources/views/blade/dashboard/assets-by-status.blade.php@@ -0,0 +1,26 @@+@can('view', \App\Models\Asset::class)+ <div class="box box-default">+ <div class="box-header with-border">+ <h2 class="box-title">+ {{ (\App\Models\Setting::getSettings()->dash_chart_type == 'name') ? trans('general.assets_by_status') : trans('general.assets_by_status_type') }}+ </h2>+ <div class="box-tools pull-right">+ <button type="button" class="btn btn-box-tool" data-widget="collapse" aria-hidden="true">+ <x-icon type="minus"/>+ <span class="sr-only">{{ trans('general.collapse') }}</span>+ </button>+ </div>+ </div>+ {{-- Fixed-height wrapper with position:relative is the stable+ Chart.js responsive pattern. Canvas inside has no+ dimensions of its own and the responsive resize fills the+ wrapper. Height:100% here caused a resize loop against+ the flex-stretched box-body. Pinning to 300px gives the+ pie enough room without dominating the row. --}}+ <div class="box-body dashboard-chart-body">+ <div class="chart-responsive" style="position: relative; height: 300px;">+ <canvas id="statusPieChart"></canvas>+ </div>+ </div>+ </div>+@endcandiff --git a/resources/views/blade/dashboard/categories-summary.blade.php b/resources/views/blade/dashboard/categories-summary.blade.phpnew file mode 100644index 0000000000..31bb246129--- /dev/null+++ b/resources/views/blade/dashboard/categories-summary.blade.php@@ -0,0 +1,77 @@+@if (Gate::allows('view', \App\Models\Asset::class)+ || Gate::allows('view', \App\Models\Accessory::class)+ || Gate::allows('view', \App\Models\Consumable::class)+ || Gate::allows('view', \App\Models\Component::class)+ || Gate::allows('view', \App\Models\License::class))+ <div class="box box-default">+ <div class="box-header with-border">+ <h2 class="box-title">{{ trans('general.categories') }}</h2>+ <div class="box-tools pull-right">+ <button type="button" class="btn btn-box-tool" data-widget="collapse">+ <x-icon type="minus"/>+ <span class="sr-only">{{ trans('general.collapse') }}</span>+ </button>+ </div>+ </div>+ <div class="box-body">+ <div class="row">+ <div class="col-md-12">+ <table+ data-cookie-id-table="dashCategorySummary"+ data-height="400"+ data-pagination="false"+ data-side-pagination="server"+ data-show-columns="false"+ data-sort-order="desc"+ data-sort-field="assets_count"+ data-sticky-header="false"+ id="dashCategorySummary"+ class="table table-striped snipe-table"+ data-url="{{ route('api.dashboard.categories', ['sort' => 'assets_count', 'order' => 'asc']) }}">+ <thead>+ <tr>+ <th scope="col" class="col-sm-3" data-visible="true" data-field="name" data-formatter="categoriesLinkFormatter" data-sortable="true">{{ trans('general.name') }}</th>+ <th scope="col" class="col-sm-3" data-visible="true" data-field="category_type" data-sortable="true">+ {{ trans('general.type') }}+ </th>+ @can('view', \App\Models\Asset::class)+ <th scope="col" class="col-sm-1" data-visible="true" data-field="assets_count" data-sortable="true">+ <x-icon type="assets"/>+ <span class="sr-only">{{ trans('general.asset_count') }}</span>+ </th>+ @endcan+ @can('view', \App\Models\Accessory::class)+ <th scope="col" class="col-sm-1" data-visible="true" data-field="accessories_count" data-sortable="true">+ <x-icon type="accessories"/>+ <span class="sr-only">{{ trans('general.accessories_count') }}</span>+ </th>+ @endcan+ @can('view', \App\Models\Consumable::class)+ <th scope="col" class="col-sm-1" data-visible="true" data-field="consumables_count" data-sortable="true">+ <x-icon type="consumables"/>+ <span class="sr-only">{{ trans('general.consumables_count') }}</span>+ </th>+ @endcan+ @can('view', \App\Models\Component::class)+ <th scope="col" class="col-sm-1" data-visible="true" data-field="components_count" data-sortable="true">+ <x-icon type="components"/>+ <span class="sr-only">{{ trans('general.components_count') }}</span>+ </th>+ @endcan+ @can('view', \App\Models\License::class)+ <th scope="col" class="col-sm-1" data-visible="true" data-field="licenses_count" data-sortable="true">+ <x-icon type="licenses"/>+ <span class="sr-only">{{ trans('general.licenses_count') }}</span>+ </th>+ @endcan+ </tr>+ </thead>+ </table>+ </div>+ <div class="text-center col-md-12" style="padding-top: 10px;">+ <a href="{{ route('categories.index') }}" class="btn btn-theme btn-sm" style="width: 100%">{{ trans('general.viewall') }}</a>+ </div>+ </div>+ </div>+ </div>+@endifdiff --git a/resources/views/blade/dashboard/companies-summary.blade.php b/resources/views/blade/dashboard/companies-summary.blade.phpnew file mode 100644index 0000000000..1a4d0c7188--- /dev/null+++ b/resources/views/blade/dashboard/companies-summary.blade.php@@ -0,0 +1,76 @@+@can('canViewUsersAndCheckoutables')+ <div class="box box-default">+ <div class="box-header with-border">+ <h2 class="box-title">{{ trans('general.companies') }}</h2>+ <div class="box-tools pull-right">+ <button type="button" class="btn btn-box-tool" data-widget="collapse">+ <x-icon type="minus"/>+ <span class="sr-only">{{ trans('general.collapse') }}</span>+ </button>+ </div>+ </div>+ <div class="box-body">+ <div class="row">+ <div class="col-md-12">+ <table+ data-cookie-id-table="dashCompanySummary"+ data-height="400"+ data-pagination="false"+ data-side-pagination="server"+ data-sort-order="desc"+ data-show-columns="false"+ data-sort-field="assets_count"+ data-sticky-header="false"+ id="dashCompanySummary"+ class="table table-striped snipe-table"+ data-url="{{ route('api.dashboard.companies', ['sort' => 'assets_count', 'order' => 'asc']) }}">+ <thead>+ <tr>+ <th scope="col" class="col-sm-3" data-visible="true" data-field="name" data-formatter="companiesLinkFormatter" data-sortable="true">{{ trans('general.name') }}</th>+ @can('view', \App\Models\User::class)+ <th scope="col" class="col-sm-1" data-visible="true" data-field="users_count" data-sortable="true">+ <x-icon type="users"/>+ <span class="sr-only">{{ trans('general.people') }}</span>+ </th>+ @endcan+ @can('view', \App\Models\Asset::class)+ <th scope="col" class="col-sm-1" data-visible="true" data-field="assets_count" data-sortable="true">+ <x-icon type="assets"/>+ <span class="sr-only">{{ trans('general.asset_count') }}</span>+ </th>+ @endcan+ @can('view', \App\Models\Accessory::class)+ <th scope="col" class="col-sm-1" data-visible="true" data-field="accessories_count" data-sortable="true">+ <x-icon type="accessories"/>+ <span class="sr-only">{{ trans('general.accessories_count') }}</span>+ </th>+ @endcan+ @can('view', \App\Models\Consumable::class)+ <th scope="col" class="col-sm-1" data-visible="true" data-field="consumables_count" data-sortable="true">+ <x-icon type="consumables"/>+ <span class="sr-only">{{ trans('general.consumables_count') }}</span>+ </th>+ @endcan+ @can('view', \App\Models\Component::class)+ <th scope="col" class="col-sm-1" data-visible="true" data-field="components_count" data-sortable="true">+ <x-icon type="components"/>+ <span class="sr-only">{{ trans('general.components_count') }}</span>+ </th>+ @endcan+ @can('view', \App\Models\License::class)+ <th scope="col" class="col-sm-1" data-visible="true" data-field="licenses_count" data-sortable="true">+ <x-icon type="licenses"/>+ <span class="sr-only">{{ trans('general.licenses_count') }}</span>+ </th>+ @endcan+ </tr>+ </thead>+ </table>+ </div>+ <div class="text-center col-md-12" style="padding-top: 10px;">+ <a href="{{ route('companies.index') }}" class="btn btn-theme btn-sm" style="width: 100%">{{ trans('general.viewall') }}</a>+ </div>+ </div>+ </div>+ </div>+@endcandiff --git a/resources/views/blade/dashboard/empty-inventory-shortcut.blade.php b/resources/views/blade/dashboard/empty-inventory-shortcut.blade.phpnew file mode 100644index 0000000000..317753c220--- /dev/null+++ b/resources/views/blade/dashboard/empty-inventory-shortcut.blade.php@@ -0,0 +1,53 @@+<div class="row">+ <div class="col-md-12">+ <div class="box box-default">+ <div class="box-header with-border">+ <h2 class="box-title">{{ trans('general.dashboard_info') }}</h2>+ </div>+ <div class="box-body">+ <div class="row">+ <div class="col-md-12">+ <div class="progress">+ <div class="progress-bar progress-bar-yellow" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%">+ <span class="sr-only">{{ trans('general.60_percent_warning') }}</span>+ </div>+ </div>+ <p><strong>{{ trans('general.dashboard_empty') }}</strong></p>+ </div>+ </div>+ <div class="row">+ <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-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-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-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>+ </div>+</div>diff --git a/resources/views/blade/dashboard/index.blade.php b/resources/views/blade/dashboard/index.blade.phpnew file mode 100644index 0000000000..e8a795f2e7--- /dev/null+++ b/resources/views/blade/dashboard/index.blade.php@@ -0,0 +1,79 @@+{{-- Widget grid for the non-admin, non-empty-inventory dashboard+ branch.++ One flat .row (flex + wrap via .dashboard-row-eq) holding every+ visible widget at its natural col-md width. Bootstrap 3 handles+ the wrapping: when the running col-md total exceeds 12, the next+ widget wraps to a new visual line automatically. `.dashboard-row-eq`+ applies `align-items: stretch` per flex line, so widgets on the+ same visual line still equalize height. That means we get+ consistent-height boxes AND natural reflow when a widget hides,+ without hand-rolling row containment or bin-packing.++ Natural widths (from the historical admin layout):++ - Recent Activity is a wide table (col-md-8).+ - Today Calendar is a narrow agenda list (col-md-4).+ - Assets by Status is a pie chart (col-md-4).+ - Low Stock is a small table (col-md-4).+ - Needs Attention is a short list of counts (col-md-4).+ Wider columns just balloon the label / badge whitespace.+ - Companies / Locations / Categories are summary tables at+ their natural col-md-6. --}}+<div class="row dashboard-row-eq dashboard-row-compact">++ @can('canViewUsersAndCheckoutables')+ <div class="col-md-8">+ <x-dashboard.recent-activity/>+ </div>+ <div class="col-md-4">+ <x-dashboard.today-calendar/>+ </div>+ @endcan++ @can('view', \App\Models\Asset::class)+ <div class="col-md-4">+ <x-dashboard.assets-by-status/>+ </div>+ @endcan++ @if (Gate::allows('view', \App\Models\Consumable::class)+ || Gate::allows('view', \App\Models\Accessory::class)+ || Gate::allows('view', \App\Models\Component::class)+ || Gate::allows('view', \App\Models\AssetModel::class)+ || Gate::allows('view', \App\Models\License::class))+ <div class="col-md-4">+ <x-dashboard.low-stock/>+ </div>+ @endif++ @can('canViewUsersAndCheckoutables')+ <div class="col-md-4">+ {{-- Lazy Livewire component so the eight count queries+ that back this widget don't sit on the dashboard's+ critical render path. Rendered as a placeholder on+ first paint. Livewire fires a follow-up XHR to+ hydrate the real counts. --}}+ <livewire:needs-attention/>+ </div>++ <div class="col-md-6">+ @if (($snipeSettings->scope_locations_fmcs != '1') && ($snipeSettings->full_multiple_companies_support == '1'))+ <x-dashboard.companies-summary/>+ @else+ <x-dashboard.locations-summary/>+ @endif+ </div>+ @endcan++ @if (Gate::allows('view', \App\Models\Asset::class)+ || Gate::allows('view', \App\Models\Accessory::class)+ || Gate::allows('view', \App\Models\Consumable::class)+ || Gate::allows('view', \App\Models\Component::class)+ || Gate::allows('view', \App\Models\License::class))+ <div class="col-md-6">+ <x-dashboard.categories-summary/>+ </div>+ @endif++</div>diff --git a/resources/views/blade/dashboard/locations-summary.blade.php b/resources/views/blade/dashboard/locations-summary.blade.phpnew file mode 100644index 0000000000..5d5bce78fb--- /dev/null+++ b/resources/views/blade/dashboard/locations-summary.blade.php@@ -0,0 +1,73 @@+@can('canViewUsersAndCheckoutables')+ <div class="box box-default">+ <div class="box-header with-border">+ <h2 class="box-title">{{ trans('general.locations') }}</h2>+ <div class="box-tools pull-right">+ <button type="button" class="btn btn-box-tool" data-widget="collapse">+ <x-icon type="minus"/>+ <span class="sr-only">{{ trans('general.collapse') }}</span>+ </button>+ </div>+ </div>+ <div class="box-body">+ <div class="row">+ <div class="col-md-12">+ <table+ data-cookie-id-table="dashLocationSummary"+ data-height="400"+ data-side-pagination="server"+ data-pagination="false"+ data-sort-order="desc"+ data-sort-field="assets_count"+ data-sticky-header="false"+ id="dashLocationSummary"+ data-show-columns="false"+ class="table table-striped snipe-table"+ data-url="{{ route('api.dashboard.locations', ['sort' => 'assets_count', 'order' => 'asc']) }}">+ <thead>+ <tr>+ <th scope="col" class="col-sm-3" data-visible="true" data-field="name" data-formatter="locationsLinkFormatter" data-sortable="true">{{ trans('general.name') }}</th>+ @can('view', \App\Models\Asset::class)+ <th scope="col" class="col-sm-1" data-visible="true" data-field="assets_count" data-sortable="true">+ <x-icon type="assets"/>+ <span class="sr-only">{{ trans('general.asset_count') }}</span>+ </th>+ <th scope="col" class="col-sm-1" data-visible="true" data-field="assigned_assets_count" data-sortable="true">+ {{ trans('general.assigned') }}+ </th>+ @endcan+ @can('view', \App\Models\Accessory::class)+ <th scope="col" class="col-sm-1" data-visible="true" data-field="accessories_count" data-sortable="true">+ <x-icon type="accessories"/>+ <span class="sr-only">{{ trans('general.accessories_count') }}</span>+ </th>+ @endcan+ @can('view', \App\Models\Consumable::class)+ <th scope="col" class="col-sm-1" data-visible="true" data-field="consumables_count" data-sortable="true">+ <x-icon type="consumables"/>+ <span class="sr-only">{{ trans('general.consumables_count') }}</span>+ </th>+ @endcan+ @can('view', \App\Models\Component::class)+ <th scope="col" class="col-sm-1" data-visible="true" data-field="components_count" data-sortable="true">+ <x-icon type="components"/>+ <span class="sr-only">{{ trans('general.components_count') }}</span>+ </th>+ @endcan+ @can('view', \App\Models\User::class)+ <th scope="col" class="col-sm-1" data-visible="true" data-field="users_count" data-sortable="true">+ <x-icon type="users"/>+ <span class="sr-only">{{ trans('general.people') }}</span>+ </th>+ @endcan+ </tr>+ </thead>+ </table>+ </div>+ <div class="text-center col-md-12" style="padding-top: 10px;">+ <a href="{{ route('locations.index') }}" class="btn btn-theme btn-sm" style="width: 100%">{{ trans('general.viewall') }}</a>+ </div>+ </div>+ </div>+ </div>+@endcandiff --git a/resources/views/blade/dashboard/low-stock.blade.php b/resources/views/blade/dashboard/low-stock.blade.phpnew file mode 100644index 0000000000..1c95601aad--- /dev/null+++ b/resources/views/blade/dashboard/low-stock.blade.php@@ -0,0 +1,71 @@+{{-- bs-table backed by /api/v1/low-stock which delegates to+ Helper::checkLowInventory so this widget and the top-nav alert+ bell can't drift. polymorphicItemFormatter handles the per-type+ icon + drilldown link. The shared adjust-quantity button hangs+ off each row's available_actions.adjust_quantity via the generic+ actions column. LowStockController filters rows by per-type view+ permission server-side, so a viewer only sees rows for the types+ they can view. --}}+@if (Gate::allows('view', \App\Models\Consumable::class)+ || Gate::allows('view', \App\Models\Accessory::class)+ || Gate::allows('view', \App\Models\Component::class)+ || Gate::allows('view', \App\Models\AssetModel::class)+ || Gate::allows('view', \App\Models\License::class))+ <div class="box box-default">+ <div class="box-header with-border">+ <h2 class="box-title">+ {{ trans('general.dashboard_low_stock') }}+ {{-- Info icon: explains the formula the alert+ uses (remaining < min + alert_threshold) so+ the widget doesn't look arbitrary to someone+ who hasn't set a min_amt or threshold. No+ link on the icon since non-superuser admins+ see the dashboard but can't reach the alert-+ threshold setting. --}}+ <span data-tooltip="true"+ title="{{ trans('general.dashboard_low_stock_help', ['threshold' => (int) $snipeSettings->alert_threshold]) }}"+ class="text-muted"+ style="cursor: help;">+ <x-icon type="more-info" class="fa-fw"/>+ <span class="sr-only">{{ trans('general.dashboard_low_stock_help', ['threshold' => (int) $snipeSettings->alert_threshold]) }}</span>+ </span>+ </h2>+ <div class="box-tools pull-right">+ <button type="button" class="btn btn-box-tool" data-widget="collapse" aria-hidden="true">+ <x-icon type="minus"/>+ <span class="sr-only">{{ trans('general.collapse') }}</span>+ </button>+ </div>+ </div>+ <div class="box-body">+ <table+ data-cookie-id-table="dashLowStock"+ data-pagination="false"+ data-side-pagination="server"+ data-id-table="dashLowStock"+ data-sticky-header="false"+ data-search="false"+ data-show-columns="false"+ data-show-columns-toggle-all="false"+ data-show-fullscreen="false"+ data-show-print="false"+ data-show-refresh="false"+ data-show-export="false"+ data-empty-message="{{ trans('general.dashboard_low_stock_empty') }}"+ id="dashLowStock"+ class="table table-striped snipe-table snipe-table--sticky-right-1"+ data-url="{{ route('api.low-stock.index', ['limit' => 25]) }}">+ <thead>+ <tr>+ <th scope="col" data-field="item" data-formatter="polymorphicItemFormatter">{{ trans('general.name') }}</th>+ <th scope="col" data-field="remaining" data-sortable="true" class="text-right">{{ trans('general.remaining') }}</th>+ <th scope="col" data-field="min_amt" data-sortable="true" data-formatter="minAmtFormatter" class="text-right">{{ trans('general.min_amt') }}</th>+ <th scope="col" data-field="available_actions" data-formatter="lowStockActionsFormatter" class="hidden-print text-right">+ <span class="sr-only">{{ trans('table.actions') }}</span>+ </th>+ </tr>+ </thead>+ </table>+ </div>+ </div>+@endifdiff --git a/resources/views/blade/dashboard/recent-activity.blade.php b/resources/views/blade/dashboard/recent-activity.blade.phpnew file mode 100644index 0000000000..f54e159f3a--- /dev/null+++ b/resources/views/blade/dashboard/recent-activity.blade.php@@ -0,0 +1,53 @@+{{-- Dashboard recent-activity table. Renders just the box. The+ parent dashboard blade owns the row + col wrapper so it can+ redistribute width when neighbor widgets hide. Kept the internal+ gate as defense in depth for direct-invocation cases. Scoped+ viewers (canViewUsersAndCheckoutables but not activity.view) get+ results filtered server-side to actionlogs whose item_type or+ target_type they can view. See Api\ReportsController@index. --}}+@can('canViewUsersAndCheckoutables')+ <div class="box box-default">+ <div class="box-header with-border">+ <h2 class="box-title">{{ trans('general.recent_activity') }}</h2>+ <div class="box-tools pull-right">+ <button type="button" class="btn btn-box-tool" data-widget="collapse" aria-hidden="true">+ <x-icon type="minus" />+ <span class="sr-only">{{ trans('general.collapse') }}</span>+ </button>+ </div>+ </div>+ <div class="box-body">+ <div class="row">+ <div class="col-md-12">+ <table+ data-cookie-id-table="dashActivityReport"+ data-pagination="false"+ data-side-pagination="server"+ data-id-table="dashActivityReport"+ data-sort-order="desc"+ data-show-columns="false"+ data-sort-name="created_at"+ data-sticky-header="false"+ data-empty-message="{{ trans('general.dashboard_activity_empty') }}"+ id="dashActivityReport"+ class="table table-striped snipe-table"+ data-url="{{ route('api.dashboard.activity', ['limit' => 25]) }}">+ <thead>+ <tr>+ <th scope="col" data-field="icon" data-visible="true" style="width: 40px;" class="hidden-xs" data-formatter="iconFormatter"><span class="sr-only">{{ trans('admin/hardware/table.icon') }}</span></th>+ <th scope="col" class="col-sm-3" data-visible="true" data-field="created_at" data-formatter="dateDisplayFormatter">{{ trans('general.date') }}</th>+ <th scope="col" class="col-sm-2" data-visible="true" data-field="admin" data-formatter="usersLinkObjFormatter">{{ trans('general.created_by') }}</th>+ <th scope="col" class="col-sm-2" data-visible="true" data-field="action_type">{{ trans('general.action') }}</th>+ <th scope="col" class="col-sm-3" data-visible="true" data-field="item" data-formatter="polymorphicItemFormatter">{{ trans('general.item') }}</th>+ <th scope="col" class="col-sm-2" data-visible="true" data-field="target" data-formatter="polymorphicItemFormatter">{{ trans('general.target') }}</th>+ </tr>+ </thead>+ </table>+ </div>+ </div>+ </div>+ <div class="box-footer text-center">+ <a href="{{ route('reports.activity') }}" class="btn btn-theme btn-sm" style="width: 100%">{{ trans('general.viewall') }}</a>+ </div>+ </div>+@endcandiff --git a/resources/views/blade/dashboard/today-calendar.blade.php b/resources/views/blade/dashboard/today-calendar.blade.phpnew file mode 100644index 0000000000..c521837815--- /dev/null+++ b/resources/views/blade/dashboard/today-calendar.blade.php@@ -0,0 +1,29 @@+{{-- Today widget: agenda-style list of everything happening today+ across every HasCalendarEvents source. Uses the same reusable+ snipeit-calendar bundle as the main /calendar page, initialized+ with listUpcoming (rolling 7 days from today). Renders just the+ box. Parent dashboard blade owns the row + col wrapper. --}}+@can('canViewUsersAndCheckoutables')+ <div class="box box-default">+ <div class="box-header with-border">+ <h2 class="box-title">+ <a href="{{ route('calendar.index') }}">{{ trans('general.calendar_upcoming') }}</a>+ </h2>+ <div class="box-tools pull-right">+ <button type="button" class="btn btn-box-tool" data-widget="collapse" aria-hidden="true">+ <x-icon type="minus"/>+ <span class="sr-only">{{ trans('general.collapse') }}</span>+ </button>+ </div>+ </div>+ <div class="box-body">+ <div id="dashboard-today-calendar"></div>+ </div>+ {{-- Matches the "View all" btn-theme footers on the sibling+ dashboard panels. Shown only when the widget's+ onFetchMeta reports the API hit its row cap. --}}+ <div id="dashboard-today-more" class="box-footer text-center" style="display:none;">+ <a href="{{ route('calendar.index') }}" class="btn btn-theme btn-sm" style="width: 100%" id="dashboard-today-more-link"></a>+ </div>+ </div>+@endcandiff --git a/resources/views/blade/dashboard/top-boxes.blade.php b/resources/views/blade/dashboard/top-boxes.blade.phpnew file mode 100644index 0000000000..0aff73b9f8--- /dev/null+++ b/resources/views/blade/dashboard/top-boxes.blade.php@@ -0,0 +1,116 @@+@props(['counts'])++{{-- Admin-only inventory summary row. Trying to determine the box sizes+for an unpredictable number of boxes (logged in user can only see accessories,+nothing else, etc makes for a really awkward display view --}}+<div class="row">++ <div class="col-lg-2 col-xs-6">+ <a href="{{ route('hardware.index') }}">+ <div class="dashboard small-box bg-teal">+ <div class="inner">+ <h3>{{ number_format(\App\Models\Asset::AssetsForShow()->count()) }}</h3>+ <p>{{ trans('general.assets') }}</p>+ </div>+ <div class="icon" aria-hidden="true">+ <x-icon type="assets"/>+ </div>+ <span class="small-box-footer">+ {{ trans('general.view_all') }}+ <x-icon type="arrow-circle-right"/>+ </span>+ </div>+ </a>+ </div>++ <div class="col-lg-2 col-xs-6">+ <a href="{{ route('licenses.index') }}" aria-hidden="true">+ <div class="dashboard small-box bg-maroon">+ <div class="inner">+ <h3>{{ number_format($counts['license']) }}</h3>+ <p>{{ trans('general.licenses') }}</p>+ </div>+ <div class="icon" aria-hidden="true">+ <x-icon type="licenses"/>+ </div>+ <span class="small-box-footer">+ {{ trans('general.view_all') }}+ <x-icon type="arrow-circle-right"/>+ </span>+ </div>+ </a>+ </div>++ <div class="col-lg-2 col-xs-6">+ <a href="{{ route('accessories.index') }}">+ <div class="dashboard small-box bg-orange">+ <div class="inner">+ <h3>{{ number_format($counts['accessory']) }}</h3>+ <p>{{ trans('general.accessories') }}</p>+ </div>+ <div class="icon" aria-hidden="true">+ <x-icon type="accessories"/>+ </div>+ <span class="small-box-footer">+ {{ trans('general.view_all') }}+ <x-icon type="arrow-circle-right"/>+ </span>+ </div>+ </a>+ </div>++ <div class="col-lg-2 col-xs-6">+ <a href="{{ route('consumables.index') }}">+ <div class="dashboard small-box bg-purple">+ <div class="inner">+ <h3>{{ number_format($counts['consumable']) }}</h3>+ <p>{{ trans('general.consumables') }}</p>+ </div>+ <div class="icon" aria-hidden="true">+ <x-icon type="consumables"/>+ </div>+ <span class="small-box-footer">+ {{ trans('general.view_all') }}+ <x-icon type="arrow-circle-right"/>+ </span>+ </div>+ </a>+ </div>++ <div class="col-lg-2 col-xs-6">+ <a href="{{ route('components.index') }}">+ <div class="dashboard small-box bg-yellow">+ <div class="inner">+ <h3>{{ number_format($counts['component']) }}</h3>+ <p>{{ trans('general.components') }}</p>+ </div>+ <div class="icon" aria-hidden="true">+ <x-icon type="components"/>+ </div>+ <span class="small-box-footer">+ {{ trans('general.view_all') }}+ <x-icon type="arrow-circle-right"/>+ </span>+ </div>+ </a>+ </div>++ <div class="col-lg-2 col-xs-6">+ <a href="{{ route('users.index') }}">+ <div class="dashboard small-box bg-light-blue">+ <div class="inner">+ <h3>{{ number_format($counts['user']) }}</h3>+ <p>{{ trans('general.people') }}</p>+ </div>+ <div class="icon" aria-hidden="true">+ <x-icon type="users"/>+ </div>+ <span class="small-box-footer">+ {{ trans('general.view_all') }}+ <x-icon type="arrow-circle-right"/>+ </span>+ </div>+ </a>+ </div>++</div>diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.phpindex 5f22153248..cb9d569dab 100755--- a/resources/views/dashboard.blade.php+++ b/resources/views/dashboard.blade.php@@ -1,4 +1,5 @@@extends('layouts/default')+{{-- Page title --}}@section('title'){{ trans('general.dashboard') }}@@ -9,633 +10,71 @@{{-- Page content --}}@section('content')-@if ($snipeSettings->dashboard_message!='')-<div class="row">- <div class="col-md-12">- <div class="box box-default">- <!-- /.box-header -->- <div class="box-body">- <div class="row">- <div class="col-md-12">- {!! Helper::parseEscapedMarkedown($snipeSettings->dashboard_message) !!}- </div>- </div>- </div>- </div>- </div>-</div>-@endif--<div class="row">-- <!-- panel -->- <div class="col-lg-2 col-xs-6">- <a href="{{ route('hardware.index') }}">- <!-- small hardware box -->- <div class="dashboard small-box bg-teal">- <div class="inner">- <h3>{{ number_format(\App\Models\Asset::AssetsForShow()->count()) }}</h3>- <p>{{ trans('general.assets') }}</p>- </div>- <div class="icon" aria-hidden="true">- <x-icon type="assets" />- </div>- <span class="small-box-footer">- {{ trans('general.view_all') }}- <x-icon type="arrow-circle-right" />- </span>- </div>- </a>- </div><!-- ./col -->-- <div class="col-lg-2 col-xs-6">- <a href="{{ route('licenses.index') }}" aria-hidden="true">- <!-- small license box -->- <div class="dashboard small-box bg-maroon">- <div class="inner">- <h3>{{ number_format($counts['license']) }}</h3>- <p>{{ trans('general.licenses') }}</p>- </div>- <div class="icon" aria-hidden="true">- <x-icon type="licenses" />- </div>- <span class="small-box-footer">- {{ trans('general.view_all') }}- <x-icon type="arrow-circle-right" />- </span>- </div>- </a>- </div><!-- ./col -->--- <div class="col-lg-2 col-xs-6">- <!-- small accessories box -->- <a href="{{ route('accessories.index') }}">- <div class="dashboard small-box bg-orange">- <div class="inner">- <h3> {{ number_format($counts['accessory']) }}</h3>- <p>{{ trans('general.accessories') }}</p>- </div>- <div class="icon" aria-hidden="true">- <x-icon type="accessories" />- </div>- <span class="small-box-footer">- {{ trans('general.view_all') }}- <x-icon type="arrow-circle-right" />- </span>- </div>- </a>- </div><!-- ./col -->-- <div class="col-lg-2 col-xs-6">- <!-- small consumables box -->- <a href="{{ route('consumables.index') }}">- <div class="dashboard small-box bg-purple">- <div class="inner">- <h3> {{ number_format($counts['consumable']) }}</h3>- <p>{{ trans('general.consumables') }}</p>- </div>- <div class="icon" aria-hidden="true">- <x-icon type="consumables" />- </div>- <span class="small-box-footer">- {{ trans('general.view_all') }}- <x-icon type="arrow-circle-right" />- </span>- </div>- </a>- </div><!-- ./col -->-- <div class="col-lg-2 col-xs-6">- <!-- small components box -->- <a href="{{ route('components.index') }}">- <div class="dashboard small-box bg-yellow">- <div class="inner">- <h3>{{ number_format($counts['component']) }}</h3>- <p>{{ trans('general.components') }}</p>- </div>- <div class="icon" aria-hidden="true">- <x-icon type="components" />- </div>- <span class="small-box-footer">- {{ trans('general.view_all') }}- <x-icon type="arrow-circle-right" />- </span>- </div>- </a>- </div><!-- ./col -->-- <div class="col-lg-2 col-xs-6">- <!-- small users box -->- <a href="{{ route('users.index') }}">- <div class="dashboard small-box bg-light-blue">- <div class="inner">- <h3>{{ number_format($counts['user']) }}</h3>- <p>{{ trans('general.people') }}</p>- </div>- <div class="icon" aria-hidden="true">- <x-icon type="users" />- </div>- <span class="small-box-footer">- {{ trans('general.view_all') }}- <x-icon type="arrow-circle-right" />- </span>- </div>- </a>- </div><!-- ./col -->-</div>--@if ($counts['grand_total'] == 0)-- <div class="row">-- <div class="col-md-12">- <div class="box box-default">- <div class="box-header with-border">- <h2 class="box-title">{{ trans('general.dashboard_info') }}</h2>- </div>- <!-- /.box-header -->- <div class="box-body">- <div class="row">- <div class="col-md-12">-- <div class="progress">- <div class="progress-bar progress-bar-yellow" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%">- <span class="sr-only">{{ trans('general.60_percent_warning') }}</span>- </div>- </div>--- <p><strong>{{ trans('general.dashboard_empty') }}</strong></p>-- </div>- </div>- <div class="row">- <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-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-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-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>- </div>- </div>--@else+<x-container>- <!-- recent activity + today calendar -->- <div class="row dashboard-row-eq dashboard-row-compact">- <div class="col-md-8">- <div class="box box-default">- <div class="box-header with-border">- <h2 class="box-title">{{ trans('general.recent_activity') }}</h2>- <div class="box-tools pull-right">- <button type="button" class="btn btn-box-tool" data-widget="collapse" aria-hidden="true">- <x-icon type="minus" />- <span class="sr-only">{{ trans('general.collapse') }}</span>- </button>- </div>- </div><!-- /.box-header -->- <div class="box-body">+ @if ($snipeSettings->dashboard_message != '')<div class="row">- <div class="col-md-12">-- <table- data-cookie-id-table="dashActivityReport"- data-pagination="false"- data-side-pagination="server"- data-id-table="dashActivityReport"- data-sort-order="desc"- data-show-columns="false"- data-sort-name="created_at"- data-sticky-header="false"- data-empty-message="{{ trans('general.dashboard_activity_empty') }}"- id="dashActivityReport"- class="table table-striped snipe-table"- data-url="{{ route('api.activity.index', ['limit' => 25]) }}">- <thead>- <tr>- <th scope="col" data-field="icon" data-visible="true" style="width: 40px;" class="hidden-xs" data-formatter="iconFormatter"><span class="sr-only">{{ trans('admin/hardware/table.icon') }}</span></th>- <th scope="col" class="col-sm-3" data-visible="true" data-field="created_at" data-formatter="dateDisplayFormatter">{{ trans('general.date') }}</th>- <th scope="col" class="col-sm-2" data-visible="true" data-field="admin" data-formatter="usersLinkObjFormatter">{{ trans('general.created_by') }}</th>- <th scope="col" class="col-sm-2" data-visible="true" data-field="action_type">{{ trans('general.action') }}</th>- <th scope="col" class="col-sm-3" data-visible="true" data-field="item" data-formatter="polymorphicItemFormatter">{{ trans('general.item') }}</th>- <th scope="col" class="col-sm-2" data-visible="true" data-field="target" data-formatter="polymorphicItemFormatter">{{ trans('general.target') }}</th>- </tr>- </thead>- </table>- </div><!-- /.col -->- </div><!-- /.row -->- </div><!-- ./box-body -->- <div class="box-footer text-center">- <a href="{{ route('reports.activity') }}" class="btn btn-theme btn-sm" style="width: 100%">{{ trans('general.viewall') }}</a>- </div>- </div><!-- /.box -->- </div>-- {{-- Today widget: agenda-style list of everything happening- today across every HasCalendarEvents source. Uses the- same reusable snipeit-calendar bundle as the main- /calendar page, initialized with listDay (agenda list- for a single day). --}}- <div class="col-md-4">- @can('view', \App\Models\Asset::class)+ <div class="col-md-12"><div class="box box-default">- <div class="box-header with-border">- <h2 class="box-title">- <a href="{{ route('calendar.index') }}">{{ trans('general.calendar_upcoming') }}</a>- </h2>- <div class="box-tools pull-right">- <button type="button" class="btn btn-box-tool" data-widget="collapse" aria-hidden="true">- <x-icon type="minus"/>- <span class="sr-only">{{ trans('general.collapse') }}</span>- </button>- </div>- </div><div class="box-body">- <div id="dashboard-today-calendar"></div>- </div>- {{-- Matches the "View all" btn-theme footers on the- sibling dashboard panels. Shown only when the- widget's onFetchMeta reports the API hit its- row cap. --}}- <div id="dashboard-today-more" class="box-footer text-center" style="display:none;">- <a href="{{ route('calendar.index') }}" class="btn btn-theme btn-sm" style="width: 100%" id="dashboard-today-more-link"></a>+ {!! Helper::parseEscapedMarkedown($snipeSettings->dashboard_message) !!}</div></div>- @endcan- </div>- </div> <!--/row-->-- {{-- Row: pie chart + low-stock + overdue/pending. All three at- col-md-4 so the row lines up cleanly regardless of box height,- and each widget serves a distinct "what needs attention" role- for the admin scanning the dashboard. `dashboard-row-compact`- caps the box-body heights on this row so the pie/list/table- trio doesn't dwarf the rest of the dashboard when Needs- Attention or Low Stock grow long. --}}- <div class="row dashboard-row-eq dashboard-row-compact">- <div class="col-md-4">- <div class="box box-default">- <div class="box-header with-border">- <h2 class="box-title">- {{ (\App\Models\Setting::getSettings()->dash_chart_type == 'name') ? trans('general.assets_by_status') : trans('general.assets_by_status_type') }}- </h2>- <div class="box-tools pull-right">- <button type="button" class="btn btn-box-tool" data-widget="collapse" aria-hidden="true">- <x-icon type="minus" />- <span class="sr-only">{{ trans('general.collapse') }}</span>- </button>- </div></div>- {{-- Fixed-height wrapper with position:relative is the- stable Chart.js responsive pattern: canvas inside has- no dimensions of its own and the responsive resize- fills the wrapper. Height:100% here caused a resize- loop against the flex-stretched box-body (canvas- grows → box grows → canvas resizes). Pinning to 300px- gives the pie enough room without dominating the row- and stops the growth loop. --}}- <div class="box-body dashboard-chart-body">- <div class="chart-responsive" style="position: relative; height: 300px;">- <canvas id="statusPieChart"></canvas>- </div>- </div>- </div></div>+ @endif- <div class="col-md-4">- <div class="box box-default">- <div class="box-header with-border">- <h2 class="box-title">- {{ trans('general.dashboard_low_stock') }}- {{-- Info icon: explains the formula the alert- uses (remaining < min + alert_threshold)- so the widget doesn't look arbitrary to- someone who hasn't set a min_amt or- threshold. No link on the icon since- non-superuser admins see the dashboard- but can't reach the alert-threshold setting. --}}- <span data-tooltip="true"- title="{{ trans('general.dashboard_low_stock_help', ['threshold' => (int) $snipeSettings->alert_threshold]) }}"- class="text-muted"- style="cursor: help;">- <x-icon type="more-info" class="fa-fw"/>- <span class="sr-only">{{ trans('general.dashboard_low_stock_help', ['threshold' => (int) $snipeSettings->alert_threshold]) }}</span>- </span>- </h2>- <div class="box-tools pull-right">- <button type="button" class="btn btn-box-tool" data-widget="collapse" aria-hidden="true">- <x-icon type="minus"/>- <span class="sr-only">{{ trans('general.collapse') }}</span>- </button>- </div>- </div>- <div class="box-body">- {{-- Bs-table backed by /api/v1/low-stock which delegates- to Helper::checkLowInventory so this widget and the- top-nav alert bell can't drift. polymorphicItemFormatter- handles the per-type icon + drilldown link, and the- shared adjust-quantity button hangs off each row's- available_actions.adjust_quantity via the generic- actions column. --}}- <table- data-cookie-id-table="dashLowStock"- data-pagination="false"- data-side-pagination="server"- data-id-table="dashLowStock"- data-sticky-header="false"- data-search="false"- data-show-columns="false"- data-show-columns-toggle-all="false"- data-show-fullscreen="false"- data-show-print="false"- data-show-refresh="false"- data-show-export="false"- data-empty-message="{{ trans('general.dashboard_low_stock_empty') }}"- id="dashLowStock"- class="table table-striped snipe-table snipe-table--sticky-right-1"- data-url="{{ route('api.low-stock.index', ['limit' => 25]) }}">- <thead>- <tr>- <th scope="col" data-field="item" data-formatter="polymorphicItemFormatter">{{ trans('general.name') }}</th>- <th scope="col" data-field="remaining" data-sortable="true" class="text-right">{{ trans('general.remaining') }}</th>- <th scope="col" data-field="min_amt" data-sortable="true" data-formatter="minAmtFormatter" class="text-right">{{ trans('general.min_amt') }}</th>- <th scope="col" data-field="available_actions" data-formatter="lowStockActionsFormatter" class="hidden-print text-right">- <span class="sr-only">{{ trans('table.actions') }}</span>- </th>- </tr>- </thead>- </table>- </div>- </div>- </div>-- <div class="col-md-4">- {{-- Lazy Livewire component so the eight count queries- that back this widget don't sit on the dashboard's- critical render path. Rendered as a placeholder on- first paint; Livewire fires a follow-up XHR to hydrate- the real counts. Same pattern the top-nav AlertMenu- uses for its low-inventory + deprecation queries. --}}- <livewire:needs-attention/>- </div>-</div> <!--/row-->-<div class="row">- <div class="col-md-6">-- @if ((($snipeSettings->scope_locations_fmcs!='1') && ($snipeSettings->full_multiple_companies_support=='1')))- <!-- Companies -->- <div class="box box-default">- <div class="box-header with-border">- <h2 class="box-title">{{ trans('general.companies') }}</h2>- <div class="box-tools pull-right">- <button type="button" class="btn btn-box-tool" data-widget="collapse">- <x-icon type="minus" />- <span class="sr-only">{{ trans('general.collapse') }}</span>- </button>- </div>- </div>- <!-- /.box-header -->- <div class="box-body">- <div class="row">- <div class="col-md-12">- <table- data-cookie-id-table="dashCompanySummary"- data-height="400"- data-pagination="false"- data-side-pagination="server"- data-sort-order="desc"- data-show-columns="false"- data-sort-field="assets_count"- data-sticky-header="false"- id="dashCompanySummary"- class="table table-striped snipe-table"- data-url="{{ route('api.companies.index', ['sort' => 'assets_count', 'order' => 'asc']) }}">-- <thead>- <tr>- <th scope="col" class="col-sm-3" data-visible="true" data-field="name" data-formatter="companiesLinkFormatter" data-sortable="true">{{ trans('general.name') }}</th>- <th scope="col" class="col-sm-1" data-visible="true" data-field="users_count" data-sortable="true">- <x-icon type="users" />- <span class="sr-only">{{ trans('general.people') }}</span>- </th>- <th scope="col" class="col-sm-1" data-visible="true" data-field="assets_count" data-sortable="true">- <x-icon type="assets" />- <span class="sr-only">{{ trans('general.asset_count') }}</span>- </th>- <th scope="col" class="col-sm-1" data-visible="true" data-field="accessories_count" data-sortable="true">- <x-icon type="accessories" />- <span class="sr-only">{{ trans('general.accessories_count') }}</span>- </th>- <th scope="col" class="col-sm-1" data-visible="true" data-field="consumables_count" data-sortable="true">- <x-icon type="consumables" />- <span class="sr-only">{{ trans('general.consumables_count') }}</span>- </th>- <th scope="col" class="col-sm-1" data-visible="true" data-field="components_count" data-sortable="true">- <x-icon type="components" />- <span class="sr-only">{{ trans('general.components_count') }}</span>- </th>- <th scope="col" class="col-sm-1" data-visible="true" data-field="licenses_count" data-sortable="true">- <x-icon type="licenses" />- <span class="sr-only">{{ trans('general.licenses_count') }}</span>- </th>- </tr>- </thead>- </table>- </div> <!-- /.col -->- <div class="text-center col-md-12" style="padding-top: 10px;">- <a href="{{ route('companies.index') }}" class="btn btn-theme btn-sm" style="width: 100%">{{ trans('general.viewall') }}</a>- </div>- </div> <!-- /.row -->-- </div><!-- /.box-body -->- </div> <!-- /.box -->-- @else- <!-- Locations -->- <div class="box box-default">- <div class="box-header with-border">- <h2 class="box-title">{{ trans('general.locations') }}</h2>- <div class="box-tools pull-right">- <button type="button" class="btn btn-box-tool" data-widget="collapse">- <x-icon type="minus" />- <span class="sr-only">{{ trans('general.collapse') }}</span>- </button>- </div>- </div>- <!-- /.box-header -->- <div class="box-body">- <div class="row">- <div class="col-md-12">-- <table- data-cookie-id-table="dashLocationSummary"- data-height="400"- data-side-pagination="server"- data-pagination="false"- data-sort-order="desc"- data-sort-field="assets_count"- data-sticky-header="false"- id="dashLocationSummary"- data-show-columns="false"- class="table table-striped snipe-table"- data-url="{{ route('api.locations.index', ['sort' => 'assets_count', 'order' => 'asc']) }}">- <thead>- <tr>- <th scope="col" class="col-sm-3" data-visible="true" data-field="name" data-formatter="locationsLinkFormatter" data-sortable="true">{{ trans('general.name') }}</th>-- <th scope="col" class="col-sm-1" data-visible="true" data-field="assets_count" data-sortable="true">- <x-icon type="assets" />- <span class="sr-only">{{ trans('general.asset_count') }}</span>- </th>- <th scope="col" class="col-sm-1" data-visible="true" data-field="assigned_assets_count" data-sortable="true">-- {{ trans('general.assigned') }}- </th>- <th scope="col" class="col-sm-1" data-visible="true" data-field="users_count" data-sortable="true">- <x-icon type="users" />- <span class="sr-only">{{ trans('general.people') }}</span>-- </th>-- </tr>- </thead>- </table>- </div> <!-- /.col -->- <div class="text-center col-md-12" style="padding-top: 10px;">- <a href="{{ route('locations.index') }}" class="btn btn-theme btn-sm" style="width: 100%">{{ trans('general.viewall') }}</a>- </div>- </div> <!-- /.row -->-- </div><!-- /.box-body -->- </div> <!-- /.box -->-- @endif-- </div>- <div class="col-md-6">-- <!-- Categories -->- <div class="box box-default">- <div class="box-header with-border">- <h2 class="box-title">{{ trans('general.categories') }}</h2>- <div class="box-tools pull-right">- <button type="button" class="btn btn-box-tool" data-widget="collapse">- <x-icon type="minus" />- <span class="sr-only">{{ trans('general.collapse') }}</span>- </button>- </div>- </div>- <!-- /.box-header -->- <div class="box-body">- <div class="row">- <div class="col-md-12">-- <table- data-cookie-id-table="dashCategorySummary"- data-height="400"- data-pagination="false"- data-side-pagination="server"- data-show-columns="false"- data-sort-order="desc"- data-sort-field="assets_count"- data-sticky-header="false"- id="dashCategorySummary"- class="table table-striped snipe-table"- data-url="{{ route('api.categories.index', ['sort' => 'assets_count', 'order' => 'asc']) }}">- <thead>- <tr>- <th scope="col" class="col-sm-3" data-visible="true" data-field="name" data-formatter="categoriesLinkFormatter" data-sortable="true">{{ trans('general.name') }}</th>- <th scope="col" class="col-sm-3" data-visible="true" data-field="category_type" data-sortable="true">- {{ trans('general.type') }}- </th>- <th scope="col" class="col-sm-1" data-visible="true" data-field="assets_count" data-sortable="true">- <x-icon type="assets" />- <span class="sr-only">{{ trans('general.asset_count') }}</span>- </th>- <th scope="col" class="col-sm-1" data-visible="true" data-field="accessories_count" data-sortable="true">- <x-icon type="licenses" />- <span class="sr-only">{{ trans('general.accessories_count') }}</span>- </th>- <th scope="col" class="col-sm-1" data-visible="true" data-field="consumables_count" data-sortable="true">- <x-icon type="consumables" />- <span class="sr-only">{{ trans('general.consumables_count') }}</span>- </th>- <th scope="col" class="col-sm-1" data-visible="true" data-field="components_count" data-sortable="true">- <x-icon type="components" />- <span class="sr-only">{{ trans('general.components_count') }}</span>- </th>- <th scope="col" class="col-sm-1" data-visible="true" data-field="licenses_count" data-sortable="true">- <x-icon type="licenses" />- <span class="sr-only">{{ trans('general.licenses_count') }}</span>- </th>- </tr>- </thead>- </table>-- </div> <!-- /.col -->- <div class="text-center col-md-12" style="padding-top: 10px;">- <a href="{{ route('categories.index') }}" class="btn btn-theme btn-sm" style="width: 100%">{{ trans('general.viewall') }}</a>- </div>- </div> <!-- /.row -->-- </div><!-- /.box-body -->- </div> <!-- /.box -->- </div>-+ {{-- Top-boxes summary + empty-inventory shortcut are admin-only.+ Non-admins with view access to at least one HasCalendarEvents+ adopter reach this dashboard (see DashboardController::index),+ but the count boxes read as global inventory and the create-+ first-thing shortcuts assume admin-shaped permissions. The+ widget section below stays visible for everyone since each+ widget component already gates itself with @can and Companyable-+ scopes its queries. --}}+ @if (auth()->user()->hasAccess('admin'))+ <x-dashboard.top-boxes :counts="$counts" />+ @endif-@endif+ {{-- Empty-inventory shortcut is also admin-only. Non-admins take+ the @else branch below and see the widget section, whose+ queries Companyable-scope to what the caller can see. --}}+ @if (auth()->user()->hasAccess('admin') && $counts['grand_total'] == 0)+ <x-dashboard.empty-inventory-shortcut />+ @else+ <x-dashboard.index />+ @endif- {{-- Adjust-quantity modal wiring for the low-stock widget's inline- replenish button. Same shared modal used on the accessories /- consumables / components index and view pages. Included whenever- the viewer can update any of the three item types (one of those- grants is what makes the button actually appear in the widget). --}}+ {{-- Adjust-quantity modal wiring for the low-stock widget's+ inline replenish button. Same shared modal used on the+ accessories / consumables / components index and view pages.+ Included whenever the viewer can update any of the three item+ types (one of those grants is what makes the button actually+ appear in the widget). --}}@if (Gate::allows('update', \App\Models\Consumable::class)|| Gate::allows('update', \App\Models\Accessory::class)|| Gate::allows('update', \App\Models\Component::class))<x-modals.adjust-quantity/>@endif+</x-container>+@stop@section('moar_scripts')@include ('partials.bootstrap-table', ['simple_view' => true, 'nopages' => true])- @can('view', \App\Models\Asset::class)+ @can('canViewUsersAndCheckoutables'){{-- Today widget for the dashboard. Reuses the main calendar- bundle; initializes into listDay view scoped to today. No- URL sync (widgets don't own the page URL), no filter- buttons (too tight for the dashboard column), no toolbar- (title suffices). Users who want to filter head over to- the full /calendar page. --}}+ bundle. Initializes into listUpcoming view (rolling 7+ days from today). No URL sync (widgets don't own the+ page URL), no filter buttons (too tight for the+ dashboard column), no toolbar (title suffices). Users+ who want to filter head over to the full /calendar+ page. Gate matches the widget component's own gate so+ the JS bundle loads for every viewer the component+ renders for, otherwise the widget div stays empty.+ See resources/views/blade/dashboard/today-calendar.blade.php. --}}<script src="{{ url(mix('js/dist/snipeit-calendar.js')) }}" nonce="{{ csrf_token() }}"></script><script nonce="{{ csrf_token() }}">document.addEventListener('DOMContentLoaded', function () {@@ -732,7 +171,7 @@// `responsive` + `maintainAspectRatio` are top-level// chart options in Chart.js, not legend options. Before// this fix they were nested under `legend`, which- // Chart.js silently ignored — so the pie stayed at its+ // Chart.js silently ignored, so the pie stayed at its// canvas height="260" attribute and didn't fill its// container. Setting maintainAspectRatio: false lets the// pie fill both dimensions of the .chart-responsive