@extends('admin.main') @section('styles') @endsection @section('content') @if (auth()->guard('admins')->user()->can('edit invoice'))
@if ($invoice->vm_id) @endif
Client Name {{ $invoice->customer->firstname . ' ' . $invoice->customer->lastname }}
Invoice Date {{ \Carbon\Carbon::parse($invoice->date)->format('d/m/Y H:i:s') }}
Due Date {{ \Carbon\Carbon::parse($invoice->due_date)->format('d/m/Y H:i:s') }}
Total Due {{ number_format($invoice->total, 0, ',', ',') }}đ
VM ID {{ $invoice->vm_id }}

{!! $invoice->getStatus() !!}

Payment Method: {{ $invoice->payment->name ?? 'Free' }}

@method('put') @csrf
@method('put') @csrf
@method('put') @csrf

Invoice Items

@if ($invoice->invoiceItem->count()) @foreach ($invoice->invoiceItem->all() as $item) @endforeach @endif
Item Product Description Addons Amount Tax
@if ($item->type) {{ $item->type->name }} @endif @php $product = null; if ($item->product_type == 3 && $item->hosting) { $product = $item->hosting; } elseif ($item->product_type == 4 && $item->vps) { $product = $item->vps; } @endphp @if ($product)
{{ $product->name }} @if ($item->product_type == 4)
CPU: {{ $product->cpu }} vCore | RAM: {{ $product->ram }} GB | Disk: {{ $product->disk }} GB @if ($product->gpu) | GPU: {{ $product->gpu }} @endif
@elseif ($item->product_type == 3)
Disk: {{ $product->disk }} GB | RAM: {{ $product->ram }} GB | Bandwidth: {{ $product->bandwidth }} GB @if ($product->cpu) | CPU: {{ $product->cpu }} @endif
@endif @if ($item->os)
{{ $item->os->name }}
@endif
@else No product info @endif
{{ $item->description }} @if ($item->addons->count() > 0)
@foreach ($item->addons as $addon)
{{ $addon->addonItems->name ?? 'Unknown Addon' }} @if ($addon->qty > 1) (x{{ $addon->qty }}) @endif {{ number_format($addon->price, 0, ',', '.') }} đ
@endforeach
@else No addons @endif
{{ number_format($item->amount, 0, ',', '.') }} đ
@php $totalAddonCost = 0; foreach ($invoice->invoiceItem as $item) { foreach ($item->addons as $addon) { $totalAddonCost += $addon->price; } } @endphp @if ($totalAddonCost > 0)
Addon Summary: Total addon cost: {{ number_format($totalAddonCost, 0, ',', '.') }} đ
@endif @php $productTypes = []; foreach ($invoice->invoiceItem as $item) { $product = null; if ($item->product_type == 3 && $item->hosting) { $product = $item->hosting; } elseif ($item->product_type == 4 && $item->vps) { $product = $item->vps; } if ($product) { $typeName = $item->product_type == 3 ? 'Hosting' : ($item->product_type == 4 ? 'VPS' : 'Other'); if (!isset($productTypes[$typeName])) { $productTypes[$typeName] = 0; } $productTypes[$typeName]++; } } @endphp @if (!empty($productTypes))
Product Summary: @foreach ($productTypes as $type => $count) {{ $type }}: {{ $count }} @endforeach
@endif
@else
Access Denied - You are not assigned to any Invoice management department
@endif @endsection