@extends('layouts.app')
@section('title','Loss Analysis')
@section('content')<main class="nxl-container"><div class="nxl-content"><div class="page-header"><h4>Loss analysis</h4></div><div class="main-content"><div class="card"><div class="card-body"><form class="row g-2 mb-3"><div class="col-md-3"><input type="date" name="from" value="{{ request('from') }}" class="form-control"></div><div class="col-md-3"><input type="date" name="to" value="{{ request('to') }}" class="form-control"></div><div class="col-auto"><button class="btn btn-primary">Filter</button></div></form><table class="table table-sm"><thead><tr><th>Deal</th><th>Owner</th><th>Category</th><th>Competitor</th><th>Factors</th><th>Products</th><th>Closed</th></tr></thead><tbody>@forelse($deals as $deal)<tr><td>{{ $deal->name }}</td><td>{{ $deal->owner?->name }}</td><td>{{ $deal->loss_category }}</td><td>{{ $deal->lost_competitor }}</td><td>{{ collect(['Price'=>$deal->loss_price_factor,'Fit'=>$deal->loss_fit_factor,'Service'=>$deal->loss_service_factor])->filter()->keys()->join(', ') }}</td><td>{{ $deal->dealProductLine->pluck('product_name_snapshot')->filter()->join(', ') }}</td><td>{{ $deal->closing_date }}</td></tr>@empty<tr><td colspan="7">No lost deals in this period.</td></tr>@endforelse</tbody></table></div></div></div></div></main>@endsection
