@extends('layouts.admin')

@section('content')
<div class="container-fluid">
    <div class="row">
        <div class="col-12">
            <div class="page-title-box">
                <div class="page-title-right">
                    <a href="{{ route('admin.payment-transactions.index') }}" class="btn btn-secondary">
                        <i class="fas fa-arrow-left"></i> Back
                    </a>
                </div>
                <h4 class="page-title">Transaction Detail</h4>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-body">
                    <div class="row">
                        <div class="col-md-6">
                            <table class="table table-bordered">
                                <tr>
                                    <th style="width: 200px;">Transaction ID</th>
                                    <td><code>{{ $paymentTransaction->transaction_id }}</code></td>
                                </tr>
                                <tr>
                                    <th>Order</th>
                                    <td>#{{ $paymentTransaction->order_id }}</td>
                                </tr>
                                <tr>
                                    <th>Gateway</th>
                                    <td>{{ $paymentTransaction->gateway?->name ?? 'N/A' }}</td>
                                </tr>
                                <tr>
                                    <th>Amount</th>
                                    <td>{{ number_format($paymentTransaction->amount, 2) }} {{ $paymentTransaction->currency }}</td>
                                </tr>
                                <tr>
                                    <th>Currency</th>
                                    <td>{{ $paymentTransaction->currency }}</td>
                                </tr>
                                <tr>
                                    <th>Status</th>
                                    <td>
                                        <span class="badge bg-{{ $paymentTransaction->status == 'completed' ? 'success' : ($paymentTransaction->status == 'pending' ? 'warning' : 'danger') }}">
                                            {{ ucfirst($paymentTransaction->status) }}
                                        </span>
                                    </td>
                                </tr>
                                <tr>
                                    <th>Date</th>
                                    <td>{{ $paymentTransaction->created_at->format('M d, Y H:i:s') }}</td>
                                </tr>
                            </table>
                        </div>
                        <div class="col-md-6">
                            <div class="mb-3">
                                <label class="form-label fw-bold">Response Data</label>
                                <pre class="bg-light p-3 rounded border">{{ json_encode($paymentTransaction->response_data, JSON_PRETTY_PRINT) }}</pre>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
