@extends('layouts.app')
@section('title',$contra->contra_number)
@section('page_title','Contra Settlement')
@section('content')
@php($s=$contra->status instanceof \App\Enums\DocumentStatus?$contra->status->value:$contra->status)
<div class="page-head"><div><h1>{{ $contra->contra_number }}</h1><p>{{ $contra->party?->legal_name }} · <span class="badge status-{{ $s }}">{{ ucwords(str_replace('_',' ',$s)) }}</span></p></div><div class="actions"><a class="btn btn-secondary" href="{{ route('contra.index') }}">Back</a>@if(in_array($s,['draft','rejected']))<a class="btn btn-primary" href="{{ route('contra.edit',$contra) }}">Edit</a>@endif</div></div>
<div class="card"><div class="card-body"><div class="detail-grid"><div class="detail"><div class="detail-label">Settlement Date</div><div class="detail-value">{{ $contra->settlement_date->format('d M Y') }}</div></div><div class="detail"><div class="detail-label">Amount</div><div class="detail-value">AED {{ number_format((float)$contra->amount,2) }}</div></div><div class="detail"><div class="detail-label">Party</div><div class="detail-value">{{ $contra->party?->legal_name }}</div></div><div class="detail"><div class="detail-label">Customer Invoice</div><div class="detail-value"><a href="{{ route('invoices.show',$contra->invoice) }}">{{ $contra->invoice?->invoice_number }}</a></div></div><div class="detail"><div class="detail-label">Vendor Bill</div><div class="detail-value"><a href="{{ route('bills.show',$contra->bill) }}">{{ $contra->bill?->bill_number }}</a></div></div><div class="detail"><div class="detail-label">Reason</div><div class="detail-value">{{ $contra->reason }}</div></div></div></div></div>
@include('components.workflow-actions',['document'=>$contra,'routePrefix'=>'contra','permissionPrefix'=>'contra_settlements','status'=>$s,'postLabel'=>'Post Contra'])
@endsection
