@extends('layouts.app') @section('content') @include('business_documents.styles')

{{ $type['single'] }}: {{ $document->reference }}

Back @if(auth()->user()->hasPermission($type['permission'].'.print'))Print@endif @if($document->status==='draft' && auth()->user()->hasPermission($type['permission'].'.update'))Edit Draft@endif @if($document->kind==='requisition' && $canApprove && auth()->user()->hasPermission('requisitions.update'))Edit Requisition@endif @if($document->status==='draft' && auth()->user()->hasPermission($type['permission'].'.submit'))
@csrf
@endif @if($document->kind==='requisition' && $document->status==='approved' && auth()->user()->canAccessModule('purchases') && auth()->user()->hasPermission('purchase_orders.create'))Create LPO@endif @if($document->kind==='sales_order' && $document->status==='confirmed' && auth()->user()->hasPermission('sales_orders.close'))
@csrf
@endif
@if(session('success'))
{{ session('success') }}
@endif @if($errors->any())@endif
Status
{{ ucfirst($document->status) }}
Branch
{{ $document->branch?->name }}
Prepared By
{{ $document->user?->name }}
{{ $type['kind']==='sales_order'?'Customer':'Supplier' }}
{{ $document->partner_name?:'-' }}
Document Date
{{ $document->document_date->format('d M Y') }}
Expected Date / Expiry
{{ $document->expected_date?->format('d M Y')?:'-' }} / {{ $document->expiry_date?->format('d M Y')?:'-' }}
External Reference
{{ $document->external_reference?:'-' }}
Payment Terms
{{ $document->details['payment_terms']??'-' }}
Freight / Delivery Method
{{ $document->details['freight']??'-' }} / {{ $document->details['delivery_method']??'-' }}
Shipping To
{{ $document->details['shipping_to']??'-' }}
@if($document->source)

Requisition: {{ $document->source->reference }}

@endif @if($document->derived)

LPO: {{ $document->derived->reference }}

@endif @include('business_documents.items') @if($document->note)

Note

{{ $document->note }}

@endif @if($document->approvals->isNotEmpty())

Approval History

@foreach($document->approvals as $approval)@endforeach
LevelApprover RoleStatusReviewed ByDateComment
{{ $approval->level }}. {{ $approval->name }}{{ $approval->role?->name?:'Role removed' }}{{ ucfirst($approval->status) }}{{ $approval->reviewer?->name?:'-' }}{{ $approval->reviewed_at?->format('d M Y H:i')?:'-' }}{{ $approval->comment?:'-' }}
@endif @if($canApprove)

Review: {{ $next->name }}

@csrf
@endif @if(!in_array($document->status,['cancelled','converted','closed'],true) && auth()->user()->hasPermission($type['permission'].'.cancel'))
@csrf
@endif
@endsection