1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
{% extends "layout.html.tera" %}
{% block title %}Internal Server Error - AdminX{% endblock title %}
{% block content %}
<div class="min-h-[60vh] flex items-center justify-center">
<div class="text-center">
<!-- 500 Illustration -->
<div class="mb-8">
<svg class="mx-auto h-32 w-32 text-red-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.667-.833-2.464 0L4.35 16.5c-.77.833.192 2.5 1.732 2.5z"/>
</svg>
</div>
<!-- Error Code -->
<div class="mb-4">
<h1 class="text-6xl font-bold text-gray-900 dark:text-white">500</h1>
</div>
<!-- Error Message -->
<div class="mb-8">
<h2 class="text-2xl font-semibold text-gray-900 dark:text-white mb-2">Internal Server Error</h2>
<p class="text-gray-600 dark:text-gray-400 max-w-md mx-auto">
{% if error_message %}
{{ error_message }}
{% else %}
Something went wrong on our end. We're working to fix the issue. Please try again later.
{% endif %}
</p>
</div>
<!-- Action Buttons -->
<div class="flex flex-col sm:flex-row gap-4 justify-center items-center">
<button onclick="location.reload()"
class="inline-flex items-center px-6 py-3 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
</svg>
Try Again
</button>
<a href="/adminx"
class="inline-flex items-center px-6 py-3 border border-gray-300 shadow-sm text-base font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-gray-200 dark:border-gray-600 dark:hover:bg-gray-600">
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"/>
</svg>
Go to Dashboard
</a>
</div>
<!-- Error Details (Only for admins or development) -->
{% if current_user and (current_user.role == "admin" or current_user.role == "superadmin") or app_environment == "development" %}
<div class="mt-12 border-t border-gray-200 dark:border-gray-700 pt-8">
<h3 class="text-lg font-medium text-gray-900 dark:text-white mb-4">Error Details</h3>
<div class="bg-red-50 dark:bg-red-900 dark:bg-opacity-20 border border-red-200 dark:border-red-800 rounded-lg p-4 max-w-2xl mx-auto">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-red-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.667-.833-2.464 0L4.35 16.5c-.77.833.192 2.5 1.732 2.5z"/>
</svg>
</div>
<div class="ml-3 text-left">
<h4 class="text-sm font-medium text-red-800 dark:text-red-200">
Technical Information
</h4>
<div class="mt-2 text-sm text-red-700 dark:text-red-300">
<ul class="list-disc list-inside space-y-1">
<li><strong>Error Type:</strong> {{ error_type | default(value="Internal Server Error") }}</li>
<li><strong>Template:</strong> {{ template_name | default(value="Unknown") }}</li>
{% if error %}
<li><strong>Details:</strong> {{ error | truncate(length=100) }}</li>
{% endif %}
<li><strong>Timestamp:</strong> {{ now() | date(format="%Y-%m-%d %H:%M:%S UTC") }}</li>
</ul>
</div>
</div>
</div>
</div>
</div>
{% endif %}
<!-- Support Information -->
<div class="mt-12 border-t border-gray-200 dark:border-gray-700 pt-8">
<h3 class="text-lg font-medium text-gray-900 dark:text-white mb-4">What to do next?</h3>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-6 max-w-2xl mx-auto">
<div class="text-center">
<div class="bg-blue-100 dark:bg-blue-900 dark:bg-opacity-30 rounded-lg p-4 mb-3">
<svg class="w-6 h-6 text-blue-600 dark:text-blue-400 mx-auto" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
</div>
<h4 class="text-sm font-medium text-gray-900 dark:text-white">Wait a moment</h4>
<p class="text-xs text-gray-500 dark:text-gray-400 mt-1">The issue might be temporary. Try refreshing the page in a few minutes.</p>
</div>
<div class="text-center">
<div class="bg-green-100 dark:bg-green-900 dark:bg-green-opacity-30 rounded-lg p-4 mb-3">
<svg class="w-6 h-6 text-green-600 dark:text-green-400 mx-auto" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6-4h6m2 5.291A7.962 7.962 0 0118 12a8 8 0 01-8 8 8 8 0 01-8-8 8 8 0 018-8c2.027 0 3.896.753 5.291 2"/>
</svg>
</div>
<h4 class="text-sm font-medium text-gray-900 dark:text-white">Check System Status</h4>
<p class="text-xs text-gray-500 dark:text-gray-400 mt-1">Visit the dashboard to see if there are any known issues.</p>
</div>
</div>
</div>
<!-- Development Debug Info -->
{% if app_environment == "development" %}
<div class="mt-8 p-4 bg-gray-100 dark:bg-gray-800 rounded-lg text-left max-w-4xl mx-auto">
<h4 class="text-sm font-medium text-gray-900 dark:text-white mb-2">Debug Information (Development)</h4>
<div class="text-xs text-gray-600 dark:text-gray-400 font-mono space-y-1">
<p><strong>Request URL:</strong> {{ request_url | default(value="Unknown") }}</p>
<p><strong>Method:</strong> {{ request_method | default(value="Unknown") }}</p>
<p><strong>User Agent:</strong> {{ user_agent | default(value="Unknown") }}</p>
<p><strong>Referer:</strong> {{ referer | default(value="None") }}</p>
{% if current_user %}
<p><strong>User:</strong> {{ current_user.email }} ({{ current_user.role }})</p>
{% endif %}
{% if error %}
<div class="mt-3 p-3 bg-red-100 dark:bg-red-900 dark:bg-opacity-40 rounded border border-red-300 dark:border-red-700">
<p><strong>Full Error:</strong></p>
<pre class="whitespace-pre-wrap text-xs mt-1">{{ error }}</pre>
</div>
{% endif %}
</div>
</div>
{% endif %}
<!-- Footer Note -->
<div class="mt-8 text-xs text-gray-400 dark:text-gray-500">
If this problem persists, please contact your system administrator.
</div>
</div>
</div>
{% endblock content %}