@extends('layouts/default') {{-- Page title --}} @section('title') {{ trans('general.dashboard') }} @parent @stop {{-- Page content --}} @section('content') @if ($snipeSettings->dashboard_message!='')
{!! Helper::parseEscapedMarkedown($snipeSettings->dashboard_message) !!}
@endif

{{ number_format(\App\Models\Asset::AssetsForShow()->count()) }}

{{ trans('general.assets') }}

{{ trans('general.view_all') }}

{{ number_format($counts['accessory']) }}

{{ trans('general.accessories') }}

{{ trans('general.view_all') }}

{{ number_format($counts['consumable']) }}

{{ trans('general.consumables') }}

{{ trans('general.view_all') }}

{{ number_format($counts['component']) }}

{{ trans('general.components') }}

{{ trans('general.view_all') }}

{{ number_format($counts['user']) }}

{{ trans('general.people') }}

{{ trans('general.view_all') }}
@if ($counts['grand_total'] == 0)

{{ trans('general.dashboard_info') }}

{{ trans('general.60_percent_warning') }}

{{ trans('general.dashboard_empty') }}

@can('create', \App\Models\Asset::class) {{ trans('general.new_asset') }} @endcan
@can('create', \App\Models\License::class) {{ trans('general.new_license') }} @endcan
@can('create', \App\Models\Accessory::class) {{ trans('general.new_accessory') }} @endcan
@can('create', \App\Models\Consumable::class) {{ trans('general.new_consumable') }} @endcan
@can('create', \App\Models\Component::class) {{ trans('general.new_component') }} @endcan
@can('create', \App\Models\User::class) {{ trans('general.new_user') }} @endcan
@else

{{ trans('general.recent_activity') }}

{{ trans('general.date') }} {{ trans('general.created_by') }} {{ trans('general.action') }} {{ trans('general.item') }} {{ trans('general.target') }}
{{-- 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). --}}
@can('view', \App\Models\Asset::class)

{{ trans('general.calendar_upcoming') }}

{{-- 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. --}}
@endcan
{{-- 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. --}}

{{ (\App\Models\Setting::getSettings()->dash_chart_type == 'name') ? trans('general.assets_by_status') : trans('general.assets_by_status_type') }}

{{-- 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. --}}

{{ 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. --}} {{ trans('general.dashboard_low_stock_help', ['threshold' => (int) $snipeSettings->alert_threshold]) }}

{{-- 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. --}}
{{ trans('general.name') }} {{ trans('general.remaining') }} {{ trans('general.min_amt') }} {{ trans('table.actions') }}
{{-- 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. --}}
@if ((($snipeSettings->scope_locations_fmcs!='1') && ($snipeSettings->full_multiple_companies_support=='1')))

{{ trans('general.companies') }}

{{ trans('general.name') }} {{ trans('general.people') }} {{ trans('general.asset_count') }} {{ trans('general.accessories_count') }} {{ trans('general.consumables_count') }} {{ trans('general.components_count') }} {{ trans('general.licenses_count') }}
@else

{{ trans('general.locations') }}

{{ trans('general.name') }} {{ trans('general.asset_count') }} {{ trans('general.assigned') }} {{ trans('general.people') }}
@endif

{{ trans('general.categories') }}

{{ trans('general.name') }} {{ trans('general.type') }} {{ trans('general.asset_count') }} {{ trans('general.accessories_count') }} {{ trans('general.consumables_count') }} {{ trans('general.components_count') }} {{ trans('general.licenses_count') }}
@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). --}} @if (Gate::allows('update', \App\Models\Consumable::class) || Gate::allows('update', \App\Models\Accessory::class) || Gate::allows('update', \App\Models\Component::class)) @endif @stop @section('moar_scripts') @include ('partials.bootstrap-table', ['simple_view' => true, 'nopages' => true]) @can('view', \App\Models\Asset::class) {{-- 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. --}} @endcan @stop @push('js') @endpush