@php use App\Models\Crm\Proposal; $statusColors = \App\Livewire\Crm\Proposals\Show::STATUS_COLORS; $control = 'mt-1 block w-full rounded-xl border-slate-300 text-sm shadow-sm focus:border-indigo-500 focus:ring-indigo-500'; $tz = config('app.display_timezone'); $seg = 'inline-flex h-9 items-center gap-1.5 whitespace-nowrap px-3 text-xs font-medium transition'; $issueTone = ['fix' => ['pill' => 'bg-rose-50 text-rose-700 ring-rose-100', 'dot' => 'bg-rose-500'], 'tip' => ['pill' => 'bg-amber-50 text-amber-700 ring-amber-100', 'dot' => 'bg-amber-400']]; $score = (int) ($writing['score'] ?? 0); $scoreTone = $score >= 85 ? 'text-emerald-600 ring-emerald-200 bg-emerald-50' : ($score >= 60 ? 'text-amber-600 ring-amber-200 bg-amber-50' : 'text-rose-600 ring-rose-200 bg-rose-50'); @endphp
{{ __('Proposals') }} {{ __(Proposal::STATUSES[$proposal->status] ?? $proposal->status) }} {{-- The document itself: on the letterhead, as a preview or a PDF. --}} @if ($editable && ! $editing) {{ __('Write') }} {{ __('Ask a director to review') }} @endif @if ($proposal->status === 'in_review' && $isDirector) {{ __('Send back') }} {{ __('Approve') }} @endif @if ($proposal->status === 'approved' && $canEdit) {{ __('Mark as submitted') }} @endif @if ($proposal->status === 'submitted' && $canEdit) {{ __('Declined') }} {{ __('Accepted') }} @endif @if ($proposal->isLocked() && $canNewVersion) {{ __('Start a new version') }} @endif @if ($proposal->isLocked())

{{ __('This version was submitted on :date and is read-only. Any change is a new version.', ['date' => $proposal->submitted_at?->timezone($tz)->format('j M Y') ?? __('a date not recorded')]) }}

@elseif ($proposal->status === 'in_review')

{{ __('With :name for review. It cannot change until it is approved or sent back.', ['name' => $proposal->reviewer?->name ?? __('a director')]) }}

@elseif ($proposal->status === 'draft' && $proposal->review_note)

{{ __('Sent back by :name:', ['name' => $proposal->reviewer?->name ?? __('a director')]) }} {{ $proposal->review_note }}

@endif
{{-- The document --}} @if ($editing) {{-- Writing mode: the same editor as Letters, saved as the version's text. --}}

{{ __('Writing version :v', ['v' => $proposal->version]) }}

{{ __('Printed on the company letterhead. The price stays on the quote.') }}

@if (trim(strip_tags($body)) !== '') {{ __('Use the outline') }} @else {{ __('Use the outline') }} @endif {{ __('Check the writing') }} {{ __('Reading…') }}
{{-- The writing check --}} @if ($writing !== []) @php $issues = $writing['issues'] ?? []; $fixes = collect($issues)->where('kind', 'fix')->count(); @endphp
{{ $score }}

@if ($issues === []) {{ __('Reads well. Nothing to fix.') }} @else {{ trans_choice(':n point to look at|:n points to look at', count($issues), ['n' => count($issues)]) }} @if ($fixes > 0) · {{ trans_choice(':n to fix|:n to fix', $fixes, ['n' => $fixes]) }} @endif @endif

{{ __(':w words · :s sentences · longest :l words · :h headings', ['w' => $writing['stats']['words'], 's' => $writing['stats']['sentences'], 'l' => $writing['stats']['longest'], 'h' => $writing['stats']['headings']]) }} @if ($writing['ai']['used'] ?? false) · {{ __('with the deeper AI review') }} @endif

@if (! empty($writing['ai']['polished'])) {{ __('Use the polished version') }} @endif
@if (! empty($writing['ai']['note']))

{{ $writing['ai']['note'] }}

@endif @if ($issues !== [])
    @foreach ($issues as $i => $issue)
  • {{ $issue['category'] }} @if ($issue['excerpt'] !== '') “{{ $issue['excerpt'] }}” @endif

    {{ $issue['message'] }}

    @if (! empty($issue['suggestion']))

    {{ __('Try:') }} {{ $issue['suggestion'] }}

    @endif
  • @endforeach
@endif
@elseif (! $aiAvailable)

{{ __('Check the writing looks for spelling, grammar, tone and structure. The deeper AI review needs the AI assistant key on this installation.') }}

@endif
{{ __('Cancel') }} {{ __('Save draft') }} {{ __('Saving…') }}
@else

{{ __('Content') }}

@if ($proposal->document_url) {{ __('Open the linked document') }} @endif
@if ($bodyHtml !== '')
{!! $bodyHtml !!}
@else @endif
@endif

{{ __('For') }}

@if ($proposal->opportunity)
{{ __('Opportunity') }}
{{ $proposal->opportunity->title }}
@endif @if ($proposal->partnership)
{{ __('Partnership') }}
{{ $proposal->partnership->name }}
@endif
{{ __('Organisation') }}
@if ($proposal->customer) {{ $proposal->customer->name }} @else {{ __('Not linked') }} @endif
@if ($proposal->approvedBy)
{{ __('Approved by') }}
{{ $proposal->approvedBy->name }} · {{ $proposal->approved_at?->timezone($tz)->format('j M Y') }}
@endif

{{ __('Price') }}

{{ __('A proposal carries no price. It points at the quote that does.') }}

@if ($proposal->quote)

{{ $proposal->quote->quote_number }}

{{ ucfirst(strtolower((string) $proposal->quote->status)) }}

{{ $proposal->quote->currency_code }} {{ number_format((float) $proposal->quote->total, 2) }}
@if ($canViewQuotes) {{ __('View the quote') }} @endif @else

{{ __('No quote linked.') }}

@endif @if ($editable)
@if ($quotes->isEmpty())

{{ $proposal->opportunity_id ? __('No quote is linked to the opportunity yet. Request one on its Quotes tab.') : __('No quote for this organisation yet.') }}

@endif {{ __('Save link') }}
@endif

{{ __('Versions') }}

    @foreach ($versions as $version)
  • @if ($version->id === $proposal->id) {{ __('Version :v', ['v' => $version->version]) }} @else {{ __('Version :v', ['v' => $version->version]) }} @endif

    {{ $version->author?->name ?? __('Not available') }} @if ($version->submitted_at) · {{ __('submitted :date', ['date' => $version->submitted_at->timezone($tz)->format('j M Y')]) }} @endif

    {{ __(Proposal::STATUSES[$version->status] ?? $version->status) }}
  • @endforeach
@if ($editable) {{ __('Ask a director to review') }}

{{ __('Only directors approve proposals. The director you choose gets a review task; the draft is frozen until they approve it or send it back.') }}

{{ __('Cancel') }} {{ __('Send for review') }} {{ __('Sending…') }}
@endif @if ($proposal->status === 'in_review' && $isDirector) {{ $decision === 'changes' ? __('Send back for changes') : __('Approve version :v', ['v' => $proposal->version]) }} {{ __('Cancel') }} {{ $decision === 'changes' ? __('Send back') : __('Approve') }} {{ __('Saving…') }} @endif