{{define "title"}}Error - SMTP Management{{end}}

{{define "content"}}
<div class="row">
    <div class="col-12">
        <div class="card border-danger">
            <div class="card-header bg-danger text-white">
                <div class="d-flex align-items-center">
                    <i class="fas fa-exclamation-triangle me-2"></i>
                    <h5 class="mb-0">Error Occurred</h5>
                </div>
            </div>
            <div class="card-body">
                {{if .error_code}}
                <div class="row mb-3">
                    <div class="col-sm-3"><strong>Error Code:</strong></div>
                    <div class="col-sm-9"><span class="badge bg-danger fs-6">{{.error_code}}</span></div>
                </div>
                {{end}}

                {{if .error_message}}
                <div class="row mb-3">
                    <div class="col-sm-3"><strong>Message:</strong></div>
                    <div class="col-sm-9"><div class="alert alert-danger mb-0">{{.error_message}}</div></div>
                </div>
                {{end}}

                {{if .error_details}}
                <div class="row mb-3">
                    <div class="col-sm-3"><strong>Details:</strong></div>
                    <div class="col-sm-9">
                        <div class="bg-dark text-light p-3 rounded">
                            <pre class="mb-0"><code>{{.error_details}}</code></pre>
                        </div>
                    </div>
                </div>
                {{end}}

                <div class="row mb-3">
                    <div class="col-sm-3"><strong>Timestamp:</strong></div>
                    <div class="col-sm-9"><span class="text-muted">{{if .current_time}}{{strftime "%Y-%m-%d %H:%M:%S" .current_time}}{{else}}Unknown{{end}}</span></div>
                </div>

                <div class="row">
                    <div class="col-sm-3"><strong>Request URL:</strong></div>
                    <div class="col-sm-9"><code>{{dget . "request_url"}}</code></div>
                </div>
            </div>
            <div class="card-footer">
                <div class="d-flex justify-content-between align-items-center">
                    <div>
                        <a href="/pymta-manager/" class="btn btn-primary">
                            <i class="fas fa-home me-1"></i>
                            Return to Dashboard
                        </a>
                        <button onclick="history.back()" class="btn btn-secondary">
                            <i class="fas fa-arrow-left me-1"></i>
                            Go Back
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{{end}}
