@extends('layouts.app') @section('title', $assignment->number()) @section('content') @php $a = $assignment; $total = $a->total(); $paid = $a->paid(); $due = $a->due(); $pct = $total > 0 ? min(100, round($paid / $total * 100)) : 0; @endphp @if ($due > 0.004) @can('payments.create') Pay this assignment @endcan @endif @can('vendor_assignments.edit') Edit @endcan @can('vendor_assignments.delete') @endcan
Amount
{{ money($total) }}
Agreed{{ money($a->assigned_amount) }}
Extra costs{{ money($a->extra()) }}
Paid{{ money($paid) }}
Balance{{ money($due) }}
Details{{ $a->statusLabel() }}
Vendor
{{ $a->vendor->name }}
Order
{{ $a->order->order_no }} · {{ $a->order->client->name }}
Assigned on
{{ $a->assigned_on->format('d M Y') }}
Due by
{{ $a->due_date?->format('d M Y') ?? '—' }}
Manager
{{ $a->manager->name ?? '—' }}
Work
{{ $a->description ?: '—' }}
@if ($a->notes)
Notes
{!! nl2br(e($a->notes)) !!}
@endif
@can('vendor_assignments.edit')
Add extra cost
@csrf
@endcan
@can('work.view_all')
Work progress
{{ $a->manager ? 'Manager: '.$a->manager->name : 'No manager assigned' }}@if ($a->isStale()) · no update for {{ config('erp.work.stale_days') }}+ days@endif
{{ $a->isCompleted() ? 'Completed '.$a->completed_at?->timezone(config('erp.timezone'))->format('d M Y') : $a->progress.'% done' }} @if ($a->isCompleted()) @can('vendor_assignments.edit')
@csrf
@endcan @endif
@include('partials.work-timeline', ['updates' => $updates])
@endcan @if ($a->items->isNotEmpty())
ProductsAgreed amount per product
@foreach ($a->items as $it) @endforeach
ProductAgreedPaidBalance
{{ $it->label() }} {{ money($it->amount) }} {{ money($it->paid()) }} {{ money($it->due()) }}
@endif
Extra costs
@forelse ($a->extras as $x) @empty @endforelse
DateDescriptionAmount
{{ $x->bill_date->format('d M Y') }} {{ $x->description }} {{ money($x->amount) }} @can('vendor_assignments.edit') @endcan
@can('payments.view')
Payments for this assignment
@forelse ($payments as $p) @empty @endforelse
DateForMethodReferenceAmount
{{ $p->paid_on->format('d M Y') }} {{ $p->vendorAssignmentItem ? $p->vendorAssignmentItem->label() : 'Whole assignment' }} {{ \App\Models\Payment::METHODS[$p->method] ?? $p->method }} {{ $p->reference ?: '—' }} −{{ money($p->amount) }}
@can('vendor_assignments.edit') @if ($due > 0.004 && $pool->isNotEmpty())
Use a general payment
Money paid to {{ $a->vendor->name }} that is not tied to anything yet
@csrf
@if ($a->items->isNotEmpty())
@endif
Allocating less than the full payment splits it; the rest stays general.
@endif @endcan @endcan
@endsection