@extends('layouts.app') @section('title', $contract->contract_number) @section('breadcrumb')Contracts {{ $contract->contract_number }}@endsection @section('content')

{{ $contract->contract_number }}

@php $sc = match($contract->status) { 'draft' => 'gray', 'sent' => 'blue', 'signed' => 'green', 'deposit_paid' => 'teal', 'in_progress' => 'purple', 'completed' => 'emerald', default => 'gray' }; @endphp {{ $contract->statusLabel() }}

{{ $contract->contact?->full_name }} — {{ $contract->job?->job_number }}

${{ number_format($contract->contract_price ?? 0) }}

Contract Progress

@foreach([['Draft','draft'],['Sent','sent'],['Signed','signed'],['In Progress','in_progress'],['Completed','completed']] as $i => [$label, $key]) @php $step = $contract->stepNumber(); @endphp
@if($i + 1 < $step)@else{{ $i + 1 }}@endif
{{ $label }}
@if($i < 4)
@endif @endforeach

Payment Schedule

@foreach([ ['Deposit', 'deposit_pct', 'deposit_paid', fn() => $contract->depositAmount()], ['Check Measure', 'cm_pct', 'cm_paid', fn() => $contract->cmAmount()], ['Delivery', 'delivery_pct', 'delivery_paid', fn() => $contract->deliveryAmount()], ['Completion', 'completion_pct', 'completion_paid', fn() => $contract->completionAmount()], ] as [$label, $pctField, $paidField, $amountFn])
@if($contract->$paidField) @else @endif
{{ $label }} ({{ $contract->$pctField ?? 0 }}%)
{{ $contract->$paidField ? 'Paid' : 'Pending' }}
${{ number_format($amountFn(), 2) }}
@endforeach
@if($contract->inclusions)

Inclusions

{{ $contract->inclusions }}

@endif @if($contract->exclusions)

Exclusions

{{ $contract->exclusions }}

@endif @if($contract->terms)

Terms & Conditions

{{ $contract->terms }}

@endif

Contract Value

${{ number_format($contract->contract_price ?? 0) }}
@if($contract->signed_date)
Signed {{ $contract->signed_date->format('d M Y') }}
@endif
@if($contract->contact)

Client

{{ $contract->contact->initials }}
{{ $contract->contact->full_name }}
@if($contract->contact->email) {{ $contract->contact->email }} @endif
@endif
Edit Contract @if($contract->status === 'draft')
@csrf
@endif @if(in_array($contract->status, ['sent', 'draft']))
@csrf
@endif @if(! $contract->deposit_paid && in_array($contract->status, ['signed', 'deposit_paid', 'in_progress']))
@csrf
@endif @if(! $contract->cm_paid && $contract->deposit_paid)
@csrf
@endif @if(! $contract->delivery_paid && $contract->cm_paid)
@csrf
@endif @if(! $contract->completion_paid && $contract->delivery_paid)
@csrf
@endif @if(!in_array($contract->status, ['completed', 'cancelled']))
@csrf @method('DELETE')
@endif
@include('partials.document-panel', [ 'documents' => $contract->documents, 'documentableType' => 'Contract', 'documentableId' => $contract->id, ])
@endsection