@extends('layouts.dashboard') @section('title', $tutorRequest->title) @section('page_title', __('Tutor request')) @section('content') @php($r = $tutorRequest) @php($tutor = $r->acceptedBid?->instructor) @php($steps = ['open' => __('Posted'), 'awarded' => __('Tutor chosen'), 'in_progress' => __('Paid & in progress'), 'completed' => __('Completed')]) @php($stepIndex = array_search($r->status, array_keys($steps), true))
{{ __('Back to marketplace') }}
{{-- Request --}}

{{ $r->title }}

{{ $r->statusLabel() }}
{{ $r->subject ?: __('Any subject') }} {{ $r->budget ? money($r->budget) : __('Budget flexible') }} @if($r->deadline){{ $r->deadline->format('d M Y') }}@endif {{ $r->created_at->diffForHumans() }}
{!! nl2br(e($r->description)) !!}

{{ $r->student->name }}
{{ __('Student') }}
@if($isTutor)
@csrf
@endif
{{-- Instructor: place / edit bid --}} @if($isInstructor && ! $isOwner && $r->isOpen() && (! $myBid || $myBid->status === 'pending'))
{{ $myBid ? __('Update your bid') : __('Place your bid') }}
@csrf
@error('amount')
{{ $message }}
@enderror
@error('proposal')
{{ $message }}
@enderror
@if($myBid) @endif
@if($myBid)
@csrf
@endif
@endif {{-- Bids --}} @if($bids->isNotEmpty())
{{ $isOwner || $isAdmin ? trans_choice('{1} 1 bid|[2,*] :count bids', $bids->count(), ['count' => $bids->count()]) : __('Your bid') }}
@foreach($bids as $bid)
{{ $bid->instructor->name }} @if($bid->instructor->username){{ __('Profile') }}@endif
{{ status_label($bid->status) }} {{ money($bid->amount) }}
@if($bid->delivery_days){{ trans_choice(':n day delivery|:n days delivery', $bid->delivery_days, ['n' => $bid->delivery_days]) }} · @endif {{ $bid->updated_at->diffForHumans() }}

{!! nl2br(e($bid->proposal)) !!}

@if($isOwner && $r->isOpen() && $bid->status === 'pending')
@csrf
@endif
@endforeach @elseif($isOwner && $r->isOpen())
{{ __('No bids yet — instructors are notified as they browse the marketplace.') }}
@endif
{{-- Sidebar: progress + actions --}}
{{ __('Progress') }}
@if(in_array($r->status, ['closed', 'cancelled'], true))
{{ __('This request was :status on :date.', ['status' => strtolower($r->statusLabel()), 'date' => optional($r->closed_at)->format('d M Y')]) }}
@else
    @foreach($steps as $key => $label) @php($i = array_search($key, array_keys($steps), true))
  1. @if($i < $stepIndex)@else{{ $i + 1 }}@endif {{ $label }}
  2. @endforeach
@endif
@if($tutor)
{{ __('Tutor') }}
{{ $tutor->name }}
{{ money($r->acceptedBid->amount) }}@if($r->acceptedBid->delivery_days) · {{ trans_choice(':n day|:n days', $r->acceptedBid->delivery_days, ['n' => $r->acceptedBid->delivery_days]) }}@endif
@if($isOwner || $isTutor)
@csrf
@endif
@endif @if($isOwner) @if($r->status === 'awarded' && $r->order)
{{ __('Payment due') }}

{{ __('Pay :amount to start the work. The tutor is notified as soon as the payment clears.', ['amount' => money($r->order->total)]) }}

{{ __('Pay now') }}
@endif @if($r->status === 'in_progress')
{{ __('Done with the tutor?') }}
@csrf
@endif @if(in_array($r->status, ['open', 'awarded'], true))
@csrf
@endif @endif @if($r->status === 'completed')
{{ __('Completed :date', ['date' => $r->completed_at->format('d M Y')]) }}
@if($r->rating)
{{ str_repeat('★', $r->rating) }}{{ str_repeat('★', 5 - $r->rating) }}
@endif @if($r->feedback)
“{{ $r->feedback }}”
@endif
@endif @if($r->order && ($isOwner || $isAdmin))
{{ __('Order') }} {{ $r->order->order_no }} · {{ status_label($r->order->payment_status) }}
@endif
@endsection