@props([ 'type', 'template', ]) {{-- Right-column "Saved Templates" panel shared by the three custom report pages (asset / component / consumable). Report-type-specific bits (Livewire component type, the route name for the save-as-template guard) are derived from $type. --}} @php $saveAsNewRoutes = match ($type) { 'asset' => ['reports/custom'], 'component' => ['reports/custom', 'reports.custom.component'], 'consumable' => ['reports/custom', 'reports.custom.consumable'], }; $isTemplatePage = request()->routeIs('report-templates.show'); $isOwner = $template->created_by == auth()->id(); @endphp @if ($isTemplatePage && $isOwner) {{-- Owner-of-saved-template controls: name, is_shared, Save, Delete. The name + is_shared inputs sit in the sidebar but belong to the main report-config form; form="custom-report-form" wires them in even though they're DOM-detached. The Save button uses the same form attribute plus formaction so it POSTs to the template-update endpoint instead of the main form's download action. --}}

{{ trans('admin/reports/general.template_name') }}

{{-- .delete-asset is the snipeit.js delete-confirm modal trigger class (legacy name, not asset-specific). --}} {{ trans('general.delete') }}
@endif @if ($isTemplatePage && ! $isOwner) {{-- Non-owner viewing a shared template: read-only status, no edit controls. The Download button in the main form is still available for ad-hoc report pulls using the shared config. --}}
{{ $template->name }}
{{ trans('admin/reports/general.template_shared') }}
@endif @if (! $isTemplatePage) @endif @if (request()->routeIs(...$saveAsNewRoutes))
{{-- data-report-save-template hooks the shared submit handler in snipeit.js (form[data-report-save-template]). That handler forwards the template name + type into the main custom-report form and submits it to templates.store. --}}
@csrf

{{ trans('admin/reports/message.about_templates') }}

{!! trans('admin/reports/message.saving_templates_description') !!}

@endif