@extends('layouts.users.main') @section('content')
{{-- Breadcrumb --}} {{-- ------------- ALERTS ------------- --}} @if (session('success')) @endif @if (session('error')) @endif {{-- ------------- HEADER: Title & Status ------------- --}}

{{ __('Ticket #:id', ['id' => $ticket->id]) }}

{{ __('Update the machine request, manage its status and collaborate with the team.') }}

{{ ucfirst($ticket->status->label()) }} {{ ucfirst($ticket->stage->label()) }}
{{-- ===================== STATIC SIDEBAR (tabs) ===================== --}}
{{ __('Ticket setup') }}
{{ __('Control panel') }}
{{-- ===================== TAB CONTENT ===================== --}}
{{-- ===== TAB 1: Ticket Details (form maestro con su botón dentro del card) ===== --}}
{{-- ===== TAB 2: Management (status + channels, controles admin de purchase) ===== --}} {{-- ===== TAB 2: Workflow (status + channels + secciones en offcanvas + danger zone) ===== --}}
{{-- Status Management --}} @if ($statusOptions)
{{ __('Ticket status') }}
{{ __('Manage the lifecycle and administrative status of this purchase record.') }}
@csrf @method('PATCH')
@endif {{-- Social Channels (solo en etapa de búsqueda de máquina) --}} @if ($ticket->stage === App\Enums\PurchaseTicketStageEnum::MACHINE_SEARCH)
{{ __('Social channels') }}
{{ __('Select the channels where this machine is being actively searched.') }}
@csrf @method('PATCH')
@foreach ($channelOptions as $channel)
value, $channelKeys ?? []))>
@endforeach
@endif {{-- Quick actions: return with comments (no aprobado) + activity + team hub --}}
@if (! $ticket->isApproved())
@endif
{{-- Danger zone: system actions. El carril del stage ya está garantizado (para abrir esta página el controller autoriza `edit`, que usa el mismo carril que `archived`), así que aquí solo falta el permiso plano de archivar. --}} @if (! $ticket->isApproved() && $ticket->status != \App\Enums\PurchaseTicketStatusEnum::ARCHIVED && auth()->user()->can('archive_purchase_ticket'))
{{ __('System actions') }}
{{ __('Critical operations. Use with caution.') }}
@csrf @method('PATCH')
@endif
{{-- ===================== OFFCANVAS: Return / Activity / Team Hub ===================== --}} @if (! $ticket->isApproved())
{{ __('Return with comments') }}

{{ __('Send back to customer for corrections. Visible to the client.') }}

@include('purchase-ticket.partials._observations-list') @if ($ticket->status !== \App\Enums\PurchaseTicketStatusEnum::RETURNED)
@include('purchase-ticket.observations.create')
@endif
@endif
{{ __('Activity timeline') }}
@include('components.tickets.activity-history', ['activities' => $activities, 'bootstrap' => true])
{{ __('Team hub') }}
@endsection