@extends('layouts.app') @section('title', $opportunity->renewal_number) @section('content') @php $entityName = $opportunity->customer?->full_name_en ?? $opportunity->corporateEmployee?->full_name ?? $opportunity->company?->name_en ?? $opportunity->employee?->full_name ?? auth()->user()->tenant->company_name; $days = (int) now()->startOfDay()->diffInDays($opportunity->expiry_date->copy()->startOfDay(), false); @endphp
@include('tenant.partials.typist-page-nav')
Back to renewal documents

{{ $opportunity->renewal_number }}

{{ str($opportunity->status)->replace('_',' ') }}{{ str($opportunity->document_status)->replace('_',' ') }}

{{ $entityName }} · {{ str($opportunity->document_type)->replace('_',' ')->title() }} · {{ $opportunity->document_number ?: 'No document number' }}

Expiry{{ $opportunity->expiry_date->format('d M Y') }}
Remaining{{ $days < 0 ? abs($days).' days overdue' : $days.' days' }}
Owner{{ $opportunity->assignedUser?->name ?? 'Unassigned' }}
Next reminder{{ $opportunity->next_reminder_at?->format('d M, h:i A') ?? 'Not scheduled' }}

Renewal Document Record

Current document identity, expiry and reminder controls.

{{ str($opportunity->document_status)->replace('_',' ')->title() }}
@foreach([ ['Entity', $entityName, str($opportunity->entity_type)->replace('_',' ')->title()], ['Document', str($opportunity->document_type)->replace('_',' ')->title(), $opportunity->document_number ?: 'Number not recorded'], ['Reminder control', $opportunity->reminder_enabled ? 'Enabled' : 'Disabled', $opportunity->reminder_channel ? str($opportunity->reminder_channel)->replace('_',' ')->title() : 'Automatic rules'], ['Last reminder', $opportunity->last_reminder_at?->format('d M Y, h:i A') ?? 'Not sent', $opportunity->reminderLogs->count().' reminder records'], ] as [$label,$value,$note])

{{ $label }}

{{ $value }}{{ $note }}
@endforeach
@if($opportunity->application)

Linked Service Accountability

Administrators can see who attended the customer and who typed the service.

Open Application 360

Application

{{ $opportunity->application->application_number }}

Customer attended by

{{ $opportunity->application->attendedBy?->name ?? 'Not recorded' }}

Service typed by

{{ $opportunity->application->typedByUser?->name ?? 'Typing not started' }}
@endif

Pipeline History

Every renewal stage change and responsible user.

@forelse($opportunity->statusHistory as $history)

{{ str($history->to_status)->replace('_',' ')->title() }}

{{ $history->notes ?: 'Pipeline status updated.' }}

By {{ $history->changedByUser?->name ?? 'Automation' }}
@empty

No pipeline history.

@endforelse

Reminder History

Scheduled, queued and delivered renewal notices.

{{ $opportunity->reminderLogs->count() }} records
@forelse($opportunity->reminderLogs->sortByDesc('id') as $log)
{{ str($log->channel)->replace('_',' ') }}{{ $log->recipient }}
{{ ucfirst($log->status) }}

{{ $log->notes ?: 'Standard renewal reminder' }}

{{ $log->scheduled_at ? 'Scheduled '.$log->scheduled_at->format('d M Y, h:i A') : ($log->sent_at ? 'Processed '.$log->sent_at->format('d M Y, h:i A') : 'Automatic schedule') }} · By {{ $log->creator?->name ?? 'Automation' }}

@empty

No reminders scheduled for this cycle.

@endforelse
@endsection