@extends('layouts.account') @section('title', __('Negotiation')) @section('heading', $negotiation->listing?->title ?? __('Negotiation')) @section('subheading', $negotiation->isSeller($user) ? __('With :name', ['name' => $negotiation->buyer?->name]) : __('With :name', ['name' => $negotiation->seller?->name])) @section('account') @if (session('error')) {{ session('error') }} @endif @php($yourTurn = $negotiation->awaitingReplyFrom($user)) @php($yours = $pending?->isFrom($user))
{{-- The history, oldest first. Nothing here is ever edited — each round answers the one before it, which is what makes "they came down twice" a fact rather than a recollection. --}}

{{ __('History') }}

    @foreach ($negotiation->history as $offer) @php($mine = $offer->isFrom($user))
  1. $mine])>
    $mine, 'border border-border bg-surface' => ! $mine, ])>

    {{ $offer->formattedAmount() }} {{ $offer->status->label() }}

    {{ $mine ? __('You') : $offer->user?->name }} · {{ $offer->created_at->format('j M Y, H:i') }}

    @if ($offer->message)

    “{{ $offer->message }}”

    @endif @if ($offer->conditions)

    {{ __('Conditions') }} {{ $offer->conditions }}

    @endif
  2. @endforeach
@if ($negotiation->status->isOpen() && $pending)

{{ $yourTurn ? __('Your answer') : __('Waiting for a reply') }}

@if ($yourTurn)
@csrf
@foreach ([ 'accept' => __('Accept'), 'counter' => __('Counter'), 'reject' => __('Reject'), ] as $value => $label) @endforeach
@error('amount')

{{ $message }}

@enderror
@else

{{ __('Your offer of :amount is with them.', ['amount' => $pending->formattedAmount()]) }} @if ($pending->expires_at) {{ __('It stands until :date.', ['date' => $pending->expires_at->format('j M Y')]) }} @endif

@if ($yours)
@csrf
@endif @endif
@endif
@if ($negotiation->listing)

{{ $negotiation->listing->title }}

{{ __('Asking') }}
{{ $negotiation->listing->formattedPrice() }}
{{ __('Latest offer') }}
{{ $negotiation->formattedLatest() }}
@if (($gap = $negotiation->gapToAsking()) !== null)
{{ __('Difference') }}
$gap < 0, 'text-success' => $gap >= 0, ])>{{ $gap > 0 ? '+' : '' }}{{ $gap }}%
@endif
@endif
@endsection