@extends('layouts.app')

@section('content')
<div class="container-xxl flex-grow-1 container-p-y">

    <div class="card">
        <div class="card-header">
            <div class="row align-items-center">
                <div class="col-md-6">
                    <h5 class="mb-0">Expense Detail</h5>
                </div>

                <div class="col-md-6 text-end">
                    <a href="{{ route('expenses.index') }}" class="btn btn-secondary">
                        Back
                    </a>
                </div>
            </div>
            <hr>
        </div>

        <div class="card-body">
            <table class="table table-bordered">
                <tr>
                    <th width="220">Cattle Category</th>
                    <td>{{ $expense->cattleCategory->title ?? '-' }}</td>
                </tr>

                <tr>
                    <th>Expense Category</th>
                    <td>{{ $expense->expenseCategory->title ?? '-' }}</td>
                </tr>

                <tr>
                    <th>Title</th>
                    <td>{{ $expense->title ?? '-' }}</td>
                </tr>

                <tr>
                    <th>Expense Date</th>
                    <td>
                        {{ $expense->expense_date ? \Carbon\Carbon::parse($expense->expense_date)->format('d M Y') : '-' }}
                    </td>
                </tr>

                <tr>
                    <th>Amount</th>
                    <td>{{ number_format($expense->amount, 2) }}</td>
                </tr>

                <tr>
                    <th>Description</th>
                    <td>{{ $expense->description ?? '-' }}</td>
                </tr>

                <tr>
                    <th>Created At</th>
                    <td>{{ $expense->created_at->format('d M Y h:i A') }}</td>
                </tr>
            </table>
        </div>
    </div>

</div>
@endsection