@extends('admin.layouts.master') @section('title', 'Company Orders') @section('content')

Company Info

Company Name: {{ $company->company }}
Customer: {{ $company->name }}
Email: {{ $company->email }}
Phone No: {{ $company->phone }}

{{ __('Pending Orders') }}

@php use Carbon\Carbon; $sumTotalAmount = 0; @endphp @foreach ($orders as $id => $order) @php // $totalAmount = optional($order->invoice->order)->total_amount ?? 0; // $sumTotalAmount += $totalAmount; $latestPromise = $order->invoice?->promises ->sortByDesc('promise_date') ->first(); @endphp @endforeach
# Issue Date Order No Amount Due Date Promises
{{ ++$id }} {{ $order->invoice ? \Carbon\Carbon::parse($order->invoice->date)->format('d M, Y') : '' }} {{ $order->order_number }} {{ $order->grand_total }} {{ $order->invoice ? \Carbon\Carbon::parse($order->invoice->due_date)->format('d M, Y') : '' }} @if ($order->invoice?->promises->count() > 0)
Latest: {{ $latestPromise ? Carbon::parse($latestPromise->promise_date)->format('d M Y') : 'N/A' }} @else No Promises @endif
Total: {{ $orders->sum('grand_total') }}
@endsection @section('js') @endsection