First Commit

This commit is contained in:
marco
2026-09-01 07:49:48 -03:00
commit 28b1044038
399 changed files with 41659 additions and 0 deletions
+264
View File
@@ -0,0 +1,264 @@
@extends("layouts.app")
@section("title", __("Billing Management"))
@section("header")
<div class="flex justify-between items-center">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">{{ __("Billing Management") }}</h2>
</div>
@endsection
@section("content")
<div class="py-6">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
@if(session("success"))
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded-lg mb-6">{{ session("success") }}</div>
@endif
<!-- Stats -->
<div class="grid grid-cols-1 md:grid-cols-5 gap-4 mb-6">
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-4">
<p class="text-xs font-medium text-gray-500">{{ __("Active Plans") }}</p>
<p class="text-2xl font-bold text-gray-900">{{ $stats["active_plans"] }}</p>
</div>
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-4">
<p class="text-xs font-medium text-gray-500">{{ __("Active Subscriptions") }}</p>
<p class="text-2xl font-bold text-green-600">{{ $stats["active_subscriptions"] }}</p>
</div>
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-4">
<p class="text-xs font-medium text-gray-500">{{ __("Total Revenue") }}</p>
<p class="text-2xl font-bold text-indigo-600">R$ {{ number_format($stats["total_revenue"], 2, ',', '.') }}</p>
</div>
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-4">
<p class="text-xs font-medium text-gray-500">{{ __("Pending Invoices") }}</p>
<p class="text-2xl font-bold text-yellow-600">{{ $stats["pending_invoices"] }}</p>
</div>
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-4">
<p class="text-xs font-medium text-gray-500">{{ __("Expiring Soon") }}</p>
<p class="text-2xl font-bold text-red-600">{{ $stats["expiring_soon"] }}</p>
</div>
</div>
<!-- Plans -->
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6 mb-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold">{{ __("Subscription Plans") }}</h3>
<button onclick="document.getElementById('createPlanModal').classList.remove('hidden')"
class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 text-sm font-medium">
+ {{ __("New Plan") }}
</button>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
@foreach($plans as $plan)
<div class="border rounded-lg p-4 {{ $plan->is_active ? 'border-indigo-200' : 'border-gray-200 opacity-75' }}">
<div class="flex justify-between items-start mb-2">
<h4 class="font-semibold text-gray-900">{{ $plan->name }}</h4>
@if($plan->is_active)
<span class="text-xs bg-green-100 text-green-800 px-2 py-0.5 rounded-full">{{ __("Active") }}</span>
@else
<span class="text-xs bg-gray-100 text-gray-800 px-2 py-0.5 rounded-full">{{ __("Inactive") }}</span>
@endif
</div>
<p class="text-2xl font-bold text-indigo-600 mb-2">
R$ {{ number_format($plan->price, 2, ',', '.') }}
<span class="text-sm font-normal text-gray-500">/{{ $plan->duration_days }}d</span>
</p>
<p class="text-sm text-gray-600 mb-3">{{ $plan->description }}</p>
<div class="text-xs text-gray-500 space-y-1 mb-3">
<p>📅 {{ $plan->duration_days }} {{ __("days") }}</p>
<p>🔤 {{ $plan->token_limit ? number_format($plan->token_limit) . ' tokens' : __('Unlimited tokens') }}</p>
<p>👥 {{ $plan->user_subscriptions_count ?? 0 }} {{ __("subscribers") }}</p>
</div>
<button onclick="openEditPlanModal({{ $plan->id }}, '{{ addslashes($plan->name) }}', '{{ addslashes($plan->description ?? '') }}', {{ $plan->price }}, '{{ $plan->currency }}', {{ $plan->duration_days }}, {{ $plan->token_limit ?? 'null' }}, {{ $plan->is_active ? 'true' : 'false' }})"
class="w-full text-sm px-3 py-1.5 bg-indigo-100 text-indigo-700 rounded-lg hover:bg-indigo-200 transition font-medium">
{{ __("Edit") }}
</button>
</div>
@endforeach
</div>
</div>
<!-- Recent Subscriptions -->
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
<h3 class="text-lg font-semibold mb-4">{{ __("Recent Subscriptions") }}</h3>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">{{ __("User") }}</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">{{ __("Plan") }}</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">{{ __("Status") }}</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">{{ __("Payment") }}</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">{{ __("Period") }}</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">{{ __("Actions") }}</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
@foreach($subscriptions as $sub)
<tr class="hover:bg-gray-50">
<td class="px-4 py-3 text-sm">{{ $sub->user->name }}</td>
<td class="px-4 py-3 text-sm">{{ $sub->plan->name }}</td>
<td class="px-4 py-3">
<span class="px-2 py-0.5 text-xs rounded-full {{ $sub->status === 'active' ? 'bg-green-100 text-green-800' : ($sub->status === 'cancelled' ? 'bg-red-100 text-red-800' : 'bg-gray-100 text-gray-800') }}">
{{ ucfirst($sub->status) }}
</span>
</td>
<td class="px-4 py-3">
@if($sub->payment_approved)
<span class="text-xs text-green-600">✅ {{ __("Approved") }}</span>
@else
<span class="text-xs text-yellow-600">⏳ {{ __("Pending") }}</span>
@endif
</td>
<td class="px-4 py-3 text-xs text-gray-500">
{{ $sub->start_date->format('d/m/Y') }} - {{ $sub->end_date->format('d/m/Y') }}
</td>
<td class="px-4 py-3">
<div class="flex gap-1">
@if(!$sub->payment_approved)
<form action="{{ route("superadmin.billing.approve", $sub) }}" method="POST">
@csrf
<button type="submit" class="px-2 py-1 bg-green-600 text-white text-xs rounded hover:bg-green-700">{{ __("Approve") }}</button>
</form>
@endif
@if($sub->status === 'active')
<form action="{{ route("superadmin.billing.cancel", $sub) }}" method="POST" onsubmit="return confirm('{{ __("Cancel this subscription?") }}')">
@csrf
<button type="submit" class="px-2 py-1 bg-red-600 text-white text-xs rounded hover:bg-red-700">{{ __("Cancel") }}</button>
</form>
@endif
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@if(method_exists($subscriptions, 'links'))
<div class="mt-4">{{ $subscriptions->links() }}</div>
@endif
</div>
</div>
</div>
<!-- Create Plan Modal -->
<div id="createPlanModal" class="hidden fixed inset-0 bg-gray-600 bg-opacity-50 z-50">
<div class="relative top-20 mx-auto p-5 border w-full max-w-md shadow-lg rounded-xl bg-white">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-medium">{{ __("Create Plan") }}</h3>
<button onclick="document.getElementById('createPlanModal').classList.add('hidden')" class="text-gray-400 hover:text-gray-600">&times;</button>
</div>
<form action="{{ route("superadmin.billing.plans.store") }}" method="POST">
@csrf
<div class="mb-3">
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __("Name") }}</label>
<input type="text" name="name" required class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500">
</div>
<div class="mb-3">
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __("Description") }}</label>
<textarea name="description" rows="2" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500"></textarea>
</div>
<div class="grid grid-cols-2 gap-3 mb-3">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __("Price") }}</label>
<input type="number" name="price" step="0.01" min="0" required class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __("Currency") }}</label>
<select name="currency" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500">
<option value="BRL">BRL (R$)</option>
<option value="USD">USD ($)</option>
<option value="EUR">EUR (€)</option>
</select>
</div>
</div>
<div class="grid grid-cols-2 gap-3 mb-3">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __("Duration (days)") }}</label>
<input type="number" name="duration_days" min="1" value="30" required class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __("Token Limit") }}</label>
<input type="number" name="token_limit" min="0" placeholder="{{ __("Unlimited") }}" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500">
</div>
</div>
<div class="flex justify-end gap-2 mt-4">
<button type="button" onclick="document.getElementById('createPlanModal').classList.add('hidden')" class="px-4 py-2 bg-gray-100 rounded-lg hover:bg-gray-200">{{ __("Cancel") }}</button>
<button type="submit" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700">{{ __("Create") }}</button>
</div>
</form>
</div>
</div>
<!-- Edit Plan Modal -->
<div id="editPlanModal" class="hidden fixed inset-0 bg-gray-600 bg-opacity-50 z-50">
<div class="relative top-20 mx-auto p-5 border w-full max-w-md shadow-lg rounded-xl bg-white">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-medium">{{ __("Edit Plan") }}</h3>
<button onclick="document.getElementById('editPlanModal').classList.add('hidden')" class="text-gray-400 hover:text-gray-600">&times;</button>
</div>
<form id="editPlanForm" method="POST">
@csrf
@method("PUT")
<div class="mb-3">
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __("Name") }}</label>
<input type="text" name="name" id="edit_name" required class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500">
</div>
<div class="mb-3">
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __("Description") }}</label>
<textarea name="description" id="edit_description" rows="2" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500"></textarea>
</div>
<div class="grid grid-cols-2 gap-3 mb-3">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __("Price") }}</label>
<input type="number" name="price" id="edit_price" step="0.01" min="0" required class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __("Currency") }}</label>
<select name="currency" id="edit_currency" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500">
<option value="BRL">BRL (R$)</option>
<option value="USD">USD ($)</option>
<option value="EUR">EUR (€)</option>
</select>
</div>
</div>
<div class="grid grid-cols-2 gap-3 mb-3">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __("Duration (days)") }}</label>
<input type="number" name="duration_days" id="edit_duration" min="1" required class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">{{ __("Token Limit") }}</label>
<input type="number" name="token_limit" id="edit_token_limit" min="0" placeholder="{{ __("Unlimited") }}" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500">
</div>
</div>
<div class="mb-3">
<label class="flex items-center">
<input type="checkbox" name="is_active" id="edit_is_active" value="1" class="rounded border-gray-300 text-indigo-600">
<span class="ml-2 text-sm text-gray-700">{{ __("Active") }}</span>
</label>
</div>
<div class="flex justify-end gap-2 mt-4">
<button type="button" onclick="document.getElementById('editPlanModal').classList.add('hidden')" class="px-4 py-2 bg-gray-100 rounded-lg hover:bg-gray-200">{{ __("Cancel") }}</button>
<button type="submit" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700">{{ __("Update") }}</button>
</div>
</form>
</div>
</div>
@endsection
@push("scripts")
<script>
function openEditPlanModal(id, name, description, price, currency, duration, tokenLimit, isActive) {
document.getElementById('edit_name').value = name;
document.getElementById('edit_description').value = description;
document.getElementById('edit_price').value = price;
document.getElementById('edit_currency').value = currency;
document.getElementById('edit_duration').value = duration;
document.getElementById('edit_token_limit').value = tokenLimit || '';
document.getElementById('edit_is_active').checked = isActive;
document.getElementById('editPlanForm').action = '{{ url("superadmin/billing/plans") }}/' + id;
document.getElementById('editPlanModal').classList.remove('hidden');
}
</script>
@endpush
+331
View File
@@ -0,0 +1,331 @@
@extends("layouts.app")
@section("title", __("System Management"))
@section("header")
<div class="flex justify-between items-center">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __("System Management") }}
</h2>
</div>
@endsection
@section("content")
<div class="py-6">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
@if(session("success"))
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded-lg mb-6">
{{ session("success") }}
</div>
@endif
<!-- Statistics -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-6 mb-6">
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
<p class="text-sm font-medium text-gray-500">{{ __("Total Users") }}</p>
<p class="text-3xl font-bold text-gray-900 mt-1">{{ $stats["total_users"] }}</p>
</div>
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
<p class="text-sm font-medium text-gray-500">{{ __("Active Users") }}</p>
<p class="text-3xl font-bold text-green-600 mt-1">{{ $stats["active_users"] }}</p>
</div>
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
<p class="text-sm font-medium text-gray-500">{{ __("Pending Users") }}</p>
<p class="text-3xl font-bold text-yellow-600 mt-1">{{ $stats["pending_users"] }}</p>
</div>
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
<p class="text-sm font-medium text-gray-500">{{ __("Total Subjects") }}</p>
<p class="text-3xl font-bold text-indigo-600 mt-1">{{ $stats["total_subjects"] }}</p>
</div>
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
<p class="text-sm font-medium text-gray-500">{{ __("Total Insights") }}</p>
<p class="text-3xl font-bold text-purple-600 mt-1">{{ $stats["total_insights"] }}</p>
</div>
</div>
<!-- System Subjects Management -->
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6 mb-6">
<div class="flex justify-between items-center mb-6">
<div>
<h3 class="text-xl font-semibold text-gray-900">{{ __("System Subjects") }}</h3>
<p class="text-sm text-gray-500 mt-1">{{ __("Manage global subjects available to all users") }}</p>
</div>
<button onclick="document.getElementById('createSubjectModal').classList.remove('hidden')"
class="inline-flex items-center px-4 py-2 bg-indigo-600 text-white text-sm font-medium rounded-lg hover:bg-indigo-700 transition">
<svg class="w-4 h-4 mr-1.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
</svg>
{{ __("Create System Subject") }}
</button>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">{{ __("Name") }}</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">{{ __("Description") }}</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">{{ __("Subscribers") }}</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">{{ __("Status") }}</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">{{ __("Actions") }}</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
@foreach($subjects as $subject)
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap font-medium text-gray-900">{{ $subject->name }}</td>
<td class="px-6 py-4 text-sm text-gray-500 max-w-xs truncate">{{ $subject->description ?? '-' }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
{{ $subject->userSubjects()->count() }}
</td>
<td class="px-6 py-4 whitespace-nowrap">
@if($subject->is_active)
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">
{{ __("Active") }}
</span>
@else
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800">
{{ __("Inactive") }}
</span>
@endif
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<button onclick="openEditSubjectModal({{ $subject->id }}, '{{ addslashes($subject->name) }}', '{{ addslashes($subject->description ?? '') }}', '{{ addslashes($subject->introduction ?? '') }}', {{ $subject->is_active ? 'true' : 'false' }})"
class="text-indigo-600 hover:text-indigo-900 mr-3">
{{ __("Edit") }}
</button>
<form action="{{ route("superadmin.system.subjects.destroy", $subject) }}" method="POST" class="inline"
onsubmit="return confirm('{{ __("Delete this subject? This action cannot be undone.") }}')">
@csrf
@method("DELETE")
<button type="submit" class="text-red-600 hover:text-red-900">
{{ __("Delete") }}
</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<!-- Quick Actions -->
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
<h3 class="text-lg font-semibold text-gray-900 mb-4">{{ __("Quick Actions") }}</h3>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<a href="{{ route('superadmin.users.index') }}"
class="flex items-center gap-3 p-4 border border-gray-200 rounded-lg hover:bg-gray-50 transition">
<div class="w-10 h-10 bg-indigo-100 rounded-lg flex items-center justify-center">
<svg class="w-5 h-5 text-indigo-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197m13.5-9a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z"/>
</svg>
</div>
<div>
<p class="text-sm font-medium text-gray-900">{{ __("Manage Users") }}</p>
<p class="text-xs text-gray-500">{{ __("Approve, reject, or manage users") }}</p>
</div>
</a>
<a href="{{ route('superadmin.billing.index') }}"
class="flex items-center gap-3 p-4 border border-gray-200 rounded-lg hover:bg-gray-50 transition">
<div class="w-10 h-10 bg-green-100 rounded-lg flex items-center justify-center">
<svg class="w-5 h-5 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
</div>
<div>
<p class="text-sm font-medium text-gray-900">{{ __("Billing") }}</p>
<p class="text-xs text-gray-500">{{ __("Manage plans, subscriptions and invoices") }}</p>
</div>
</a>
</div>
</div>
<!-- AI Settings -->
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6 mb-6">
<div class="mb-6">
<h3 class="text-xl font-semibold text-gray-900">{{ __("AI Settings") }}</h3>
<p class="text-sm text-gray-500 mt-1">{{ __("Configure the default AI provider and model, except for Chat.
") }}</p>
</div>
<form action="{{ route('superadmin.system.ai-settings.update') }}" method="POST">
@csrf
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label for="ai_default_provider" class="block text-sm font-medium text-gray-700 mb-2">{{ __("Default Provider") }}</label>
<select name="ai_default_provider" id="ai_default_provider" required
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
<option value="openrouter" {{ (old('ai_default_provider', $aiDefaultProvider) === 'openrouter') ? 'selected' : '' }}>OpenRouter.ai</option>
<option value="openai" {{ (old('ai_default_provider', $aiDefaultProvider) === 'openai') ? 'selected' : '' }}>OpenAI</option>
<option value="stepfun" {{ (old('ai_default_provider', $aiDefaultProvider) === 'stepfun') ? 'selected' : '' }}>StepFun</option>
<option value="llamacpp" {{ (old('ai_default_provider', $aiDefaultProvider) === 'llamacpp') ? 'selected' : '' }}>llama.cpp (Local)</option>
<option value="qwen" {{ (old('ai_default_provider', $aiDefaultProvider) === 'qwen') ? 'selected' : '' }}>QwenCloud</option>
</select>
</div>
<div>
<label for="ai_default_model" class="block text-sm font-medium text-gray-700 mb-2">{{ __("Default Model") }}</label>
<input type="text" name="ai_default_model" id="ai_default_model" value="{{ old('ai_default_model', $aiDefaultModel) }}" required
placeholder="e.g., deepseek/deepseek-v4-flash-0731"
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
</div>
</div>
<div class="flex justify-end gap-2 mt-6">
<button type="submit" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition font-medium">
{{ __("Save AI Settings") }}
</button>
</div>
</form>
</div>
<!-- Chat Settings -->
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6 mb-6">
<div class="mb-6">
<h3 class="text-xl font-semibold text-gray-900">{{ __("Chat AI Settings") }}</h3>
<p class="text-sm text-gray-500 mt-1">{{ __("Configure default AI provider and model for chat conversations") }}</p>
</div>
<form action="{{ route('superadmin.system.chat-settings.update') }}" method="POST">
@csrf
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label for="chat_default_provider" class="block text-sm font-medium text-gray-700 mb-2">{{ __("Default Chat Provider") }}</label>
<select name="chat_default_provider" id="chat_default_provider" required
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
<option value="openrouter" {{ (old('chat_default_provider', $chatDefaultProvider) === 'openrouter') ? 'selected' : '' }}>OpenRouter.ai</option>
<option value="openai" {{ (old('chat_default_provider', $chatDefaultProvider) === 'openai') ? 'selected' : '' }}>OpenAI</option>
<option value="stepfun" {{ (old('chat_default_provider', $chatDefaultProvider) === 'stepfun') ? 'selected' : '' }}>StepFun</option>
<option value="llamacpp" {{ (old('chat_default_provider', $chatDefaultProvider) === 'llamacpp') ? 'selected' : '' }}>llama.cpp (Local)</option>
<option value="qwen" {{ (old('chat_default_provider', $chatDefaultProvider) === 'qwen') ? 'selected' : '' }}>QwenCloud</option>
</select>
</div>
<div>
<label for="chat_default_model" class="block text-sm font-medium text-gray-700 mb-2">{{ __("Default Chat Model") }}</label>
<input type="text" name="chat_default_model" id="chat_default_model" value="{{ old('chat_default_model', $chatDefaultModel) }}" required
placeholder="e.g., gpt-4o-mini"
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
</div>
</div>
<div class="flex justify-end gap-2 mt-6">
<button type="submit" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition font-medium">
{{ __("Save Chat Settings") }}
</button>
</div>
</form>
</div>
</div>
</div>
<!-- Create Subject Modal -->
<div id="createSubjectModal" class="hidden fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full z-50">
<div class="relative top-20 mx-auto p-5 border w-full max-w-md shadow-lg rounded-xl bg-white">
<div class="mt-3">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-medium text-gray-900">{{ __("Create System Subject") }}</h3>
<button onclick="document.getElementById('createSubjectModal').classList.add('hidden')" class="text-gray-400 hover:text-gray-600">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
</svg>
</button>
</div>
<form action="{{ route("superadmin.system.subjects.store") }}" method="POST">
@csrf
<div class="mb-4">
<label for="name" class="block text-sm font-medium text-gray-700 mb-2">{{ __("Name") }} *</label>
<input type="text" name="name" id="name" required
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
</div>
<div class="mb-4">
<label for="description" class="block text-sm font-medium text-gray-700 mb-2">{{ __("Description") }}</label>
<textarea name="description" id="description" rows="3"
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500"></textarea>
</div>
<div class="mb-4">
<label for="introduction" class="block text-sm font-medium text-gray-700 mb-2">{{ __("Introduction") }}</label>
<textarea name="introduction" id="introduction" rows="3"
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500"></textarea>
</div>
<div class="flex justify-end gap-2 mt-6">
<button type="button" onclick="document.getElementById('createSubjectModal').classList.add('hidden')"
class="px-4 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition font-medium">
{{ __("Cancel") }}
</button>
<button type="submit" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition font-medium">
{{ __("Create") }}
</button>
</div>
</form>
</div>
</div>
</div>
<!-- Edit Subject Modal -->
<div id="editSubjectModal" class="hidden fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full z-50">
<div class="relative top-20 mx-auto p-5 border w-full max-w-md shadow-lg rounded-xl bg-white">
<div class="mt-3">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-medium text-gray-900">{{ __("Edit System Subject") }}</h3>
<button onclick="document.getElementById('editSubjectModal').classList.add('hidden')" class="text-gray-400 hover:text-gray-600">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
</svg>
</button>
</div>
<form id="editSubjectForm" method="POST">
@csrf
@method("PUT")
<div class="mb-4">
<label for="edit_name" class="block text-sm font-medium text-gray-700 mb-2">{{ __("Name") }} *</label>
<input type="text" name="name" id="edit_name" required
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
</div>
<div class="mb-4">
<label for="edit_description" class="block text-sm font-medium text-gray-700 mb-2">{{ __("Description") }}</label>
<textarea name="description" id="edit_description" rows="3"
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500"></textarea>
</div>
<div class="mb-4">
<label for="edit_introduction" class="block text-sm font-medium text-gray-700 mb-2">{{ __("Introduction") }}</label>
<textarea name="introduction" id="edit_introduction" rows="3"
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500"></textarea>
</div>
<div class="mb-4">
<label class="flex items-center">
<input type="checkbox" name="is_active" id="edit_is_active" value="1"
class="rounded border-gray-300 text-indigo-600 shadow-sm focus:ring-indigo-500">
<span class="ml-2 text-sm text-gray-700">{{ __("Active") }}</span>
</label>
</div>
<div class="flex justify-end gap-2 mt-6">
<button type="button" onclick="document.getElementById('editSubjectModal').classList.add('hidden')"
class="px-4 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition font-medium">
{{ __("Cancel") }}
</button>
<button type="submit" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition font-medium">
{{ __("Update") }}
</button>
</div>
</form>
</div>
</div>
</div>
@endsection
@push("scripts")
<script>
function openEditSubjectModal(id, name, description, introduction, isActive) {
document.getElementById('edit_name').value = name;
document.getElementById('edit_description').value = description;
document.getElementById('edit_introduction').value = introduction;
document.getElementById('edit_is_active').checked = isActive;
document.getElementById('editSubjectForm').action = '{{ url("superadmin/system/subjects") }}/' + id;
document.getElementById('editSubjectModal').classList.remove('hidden');
}
// Close modals on Escape key
document.addEventListener('keydown', function(event) {
if (event.key === 'Escape') {
document.getElementById('createSubjectModal').classList.add('hidden');
document.getElementById('editSubjectModal').classList.add('hidden');
}
});
</script>
@endpush
+154
View File
@@ -0,0 +1,154 @@
@extends("layouts.app")
@section("title", __("Edit User"))
@section("header")
<div class="flex justify-between items-center">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __("Edit User") }}
</h2>
</div>
@endsection
@section("content")
<div class="py-6">
<div class="max-w-3xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
<div class="flex items-center gap-4 mb-6">
<span class="w-16 h-16 rounded-full bg-indigo-100 flex items-center justify-center text-xl font-bold text-indigo-600">
{{ substr($user->name, 0, 1) }}
</span>
<div>
<h3 class="text-xl font-semibold text-gray-900">{{ $user->name }}</h3>
<p class="text-sm text-gray-500">{{ $user->email }}</p>
</div>
</div>
<form method="POST" action="{{ route("superadmin.users.update", $user) }}">
@csrf
@method("PUT")
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
<div>
<label for="name" class="block text-sm font-medium text-gray-700 mb-2">{{ __("Name") }}</label>
<input type="text" name="name" id="name" value="{{ old("name", $user->name) }}" required
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
</div>
<div>
<label for="email" class="block text-sm font-medium text-gray-700 mb-2">{{ __("Email") }}</label>
<input type="email" name="email" id="email" value="{{ old("email", $user->email) }}" required
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
</div>
</div>
<div class="mb-6">
<label for="role" class="block text-sm font-medium text-gray-700 mb-2">{{ __("Role") }}</label>
<select name="role" id="role" required
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
<option value="admin" {{ $user->hasRole('admin') ? 'selected' : '' }}>{{ __("Admin") }}</option>
<option value="superadmin" {{ $user->hasRole('superadmin') ? 'selected' : '' }}>{{ __("SuperAdmin") }}</option>
</select>
</div>
<div class="mb-6">
<label for="plan_id" class="block text-sm font-medium text-gray-700 mb-2">{{ __("Subscription Plan") }}</label>
<select name="plan_id" id="plan_id" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
<option value="">{{ __("No plan") }}</option>
@foreach(\App\Models\SubscriptionPlan::where('is_active', true)->get() as $plan)
@php $activeSub = $user->subscriptions()->where('status', 'active')->first(); @endphp
<option value="{{ $plan->id }}" {{ $activeSub && $activeSub->subscription_plan_id == $plan->id ? 'selected' : '' }}>
{{ $plan->name }} - R$ {{ number_format($plan->price, 2, ',', '.') }} / {{ $plan->duration_days }}d
({{ $plan->token_limit ? number_format($plan->token_limit) . ' tokens' : __('Unlimited') }})
</option>
@endforeach
</select>
@if($activeSub ?? false)
<p class="text-xs text-gray-500 mt-1">
{{ __("Current plan ends: :date", ['date' => $activeSub->end_date->format('d/m/Y')]) }}
</p>
@endif
</div>
<div class="mb-6">
<label for="token_limit" class="block text-sm font-medium text-gray-700 mb-2">{{ __("Token Limit") }}</label>
<p class="text-xs text-gray-500 mb-2">{{ __("Maximum tokens this user can consume. Leave empty for unlimited.") }}</p>
<input type="number" name="token_limit" id="token_limit"
value="{{ old("token_limit", $user->token_limit) }}" min="0" step="1000"
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500"
placeholder="{{ __("e.g., 100000 for 100k tokens") }}">
@php
$totalUsed = \App\Models\TokenUsage::where('user_id', $user->id)->sum('total_tokens');
@endphp
@if($totalUsed > 0)
<p class="text-xs text-gray-500 mt-1">
{{ __("Current usage: :used tokens", ['used' => number_format($totalUsed)]) }}
@if($user->token_limit)
| {{ __("Limit: :limit tokens", ['limit' => number_format($user->token_limit)]) }}
| {{ round(($totalUsed / $user->token_limit) * 100) }}% {{ __("used") }}
@endif
</p>
@endif
</div>
<div class="mb-6">
<h3 class="text-lg font-semibold text-gray-900 mb-2">{{ __("Update Password") }}</h3>
<p class="text-xs text-gray-500 mb-4">{{ __("Leave blank to keep current password") }}</p>
<div class="mb-4">
<label for="password" class="block text-sm font-medium text-gray-700 mb-2">{{ __("New Password") }}</label>
<div class="relative">
<input type="password" name="password" id="password"
class="w-full px-3 py-2 pr-10 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
<button type="button" onclick="togglePassword('password', this)" class="absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400 hover:text-gray-600">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
</button>
</div>
@error('password')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
<div class="mb-4">
<label for="password_confirmation" class="block text-sm font-medium text-gray-700 mb-2">{{ __("Confirm New Password") }}</label>
<div class="relative">
<input type="password" name="password_confirmation" id="password_confirmation"
class="w-full px-3 py-2 pr-10 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
<button type="button" onclick="togglePassword('password_confirmation', this)" class="absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400 hover:text-gray-600">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
</button>
</div>
@error('password_confirmation')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
</div>
<div class="flex items-center justify-between pt-4 border-t border-gray-100">
<a href="{{ route("superadmin.users.index") }}"
class="px-4 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition font-medium">
{{ __("Back") }}
</a>
<button type="submit" class="px-6 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition font-medium">
{{ __("Update User") }}
</button>
</div>
</form>
</div>
</div>
</div>
@endsection
@push('scripts')
<script>
function togglePassword(fieldId, btn) {
var input = document.getElementById(fieldId);
if (input.type === 'password') {
input.type = 'text';
btn.innerHTML = '<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"/></svg>';
} else {
input.type = 'password';
btn.innerHTML = '<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>';
}
}
</script>
@endpush
+203
View File
@@ -0,0 +1,203 @@
@extends("layouts.app")
@section("title", __("User Management"))
@section("header")
<div class="flex justify-between items-center">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __("User Management") }}
</h2>
</div>
@endsection
@section("content")
<div class="py-6">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
@if(session("success"))
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded-lg mb-6">
{{ session("success") }}
</div>
@endif
@if(session("info"))
<div class="bg-blue-100 border border-blue-400 text-blue-700 px-4 py-3 rounded-lg mb-6">
{{ session("info") }}
</div>
@endif
<!-- Stats Cards -->
<div class="grid grid-cols-1 md:grid-cols-5 gap-4 mb-6">
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-4">
<p class="text-xs font-medium text-gray-500">{{ __("Total") }}</p>
<p class="text-2xl font-bold text-gray-900">{{ $stats["total"] }}</p>
</div>
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-4">
<p class="text-xs font-medium text-gray-500">{{ __("Pending") }}</p>
<p class="text-2xl font-bold text-yellow-600">{{ $stats["pending"] }}</p>
</div>
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-4">
<p class="text-xs font-medium text-gray-500">{{ __("Active") }}</p>
<p class="text-2xl font-bold text-green-600">{{ $stats["active"] }}</p>
</div>
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-4">
<p class="text-xs font-medium text-gray-500">{{ __("Paused") }}</p>
<p class="text-2xl font-bold text-red-600">{{ $stats["paused"] }}</p>
</div>
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-4">
<p class="text-xs font-medium text-gray-500">{{ __("Unverified") }}</p>
<p class="text-2xl font-bold text-orange-600">{{ $stats["unverified"] }}</p>
</div>
</div>
<!-- Filters -->
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-4 mb-6">
<form method="GET" class="flex flex-wrap gap-3 items-center">
<div class="flex-1 min-w-[200px]">
<input type="text" name="search" value="{{ request('search') }}"
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 text-sm"
placeholder="{{ __("Search by name or email...") }}">
</div>
<select name="status" class="px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 text-sm">
<option value="">{{ __("All Status") }}</option>
<option value="pending" {{ request('status') == 'pending' ? 'selected' : '' }}>{{ __("Pending") }}</option>
<option value="approved" {{ request('status') == 'approved' ? 'selected' : '' }}>{{ __("Approved") }}</option>
<option value="paused" {{ request('status') == 'paused' ? 'selected' : '' }}>{{ __("Paused") }}</option>
<option value="verified" {{ request('status') == 'verified' ? 'selected' : '' }}>{{ __("Verified") }}</option>
<option value="unverified" {{ request('status') == 'unverified' ? 'selected' : '' }}>{{ __("Unverified") }}</option>
</select>
<button type="submit" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition text-sm font-medium">
{{ __("Filter") }}
</button>
@if(request('search') || request('status'))
<a href="{{ route("superadmin.users.index") }}" class="px-4 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition text-sm font-medium">
{{ __("Clear") }}
</a>
@endif
</form>
</div>
<!-- Users Table -->
<div class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">{{ __("User") }}</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">{{ __("Role") }}</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">{{ __("Status") }}</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">{{ __("Email Verified") }}</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">{{ __("Joined") }}</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">{{ __("Actions") }}</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
@forelse($users as $user)
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<span class="w-8 h-8 rounded-full bg-indigo-100 flex items-center justify-center text-xs font-bold text-indigo-600 mr-3">
{{ substr($user->name, 0, 1) }}
</span>
<div>
<p class="text-sm font-medium text-gray-900">{{ $user->name }}</p>
<p class="text-xs text-gray-500">{{ $user->email }}</p>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full {{ $user->hasRole('superadmin') ? 'bg-purple-100 text-purple-800' : 'bg-indigo-100 text-indigo-800' }}">
{{ $user->getRoleNames()->first() ?? __('admin') }}
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex flex-col gap-1">
@if($user->is_approved && $user->is_active)
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">
{{ __("Active") }}
</span>
@elseif(!$user->is_approved)
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">
{{ __("Pending") }}
</span>
@elseif(!$user->is_active)
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800">
{{ __("Paused") }}
</span>
@endif
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
@if($user->hasVerifiedEmail())
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">
{{ __("Verified") }}
</span>
@else
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-orange-100 text-orange-800">
{{ __("Unverified") }}
</span>
@endif
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
{{ $user->created_at->format('d/m/Y') }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm">
<div class="flex flex-col gap-1">
<div class="flex gap-1 flex-wrap">
@if(!$user->is_approved)
<form action="{{ route("superadmin.users.approve", $user) }}" method="POST" class="inline">
@csrf
<button type="submit" class="px-2 py-1 bg-green-600 text-white text-xs rounded hover:bg-green-700">
{{ __("Approve") }}
</button>
</form>
@endif
@if(!$user->hasVerifiedEmail())
<form action="{{ route("superadmin.users.verify-email", $user) }}" method="POST" class="inline">
@csrf
<button type="submit" class="px-2 py-1 bg-blue-600 text-white text-xs rounded hover:bg-blue-700">
{{ __("Verify Email") }}
</button>
</form>
@endif
<form action="{{ route("superadmin.users.toggle-active", $user) }}" method="POST" class="inline">
@csrf
<button type="submit" class="px-2 py-1 {{ $user->is_active ? 'bg-red-600 hover:bg-red-700' : 'bg-green-600 hover:bg-green-700' }} text-white text-xs rounded">
{{ $user->is_active ? __("Pause") : __("Activate") }}
</button>
</form>
<a href="{{ route("superadmin.users.edit", $user) }}"
class="px-2 py-1 bg-indigo-600 text-white text-xs rounded hover:bg-indigo-700 inline-block">
{{ __("Edit") }}
</a>
<form action="{{ route("superadmin.users.destroy", $user) }}" method="POST" class="inline"
onsubmit="return confirm('{{ __("Delete this user? All associated data will be permanently removed.") }}')">
@csrf
@method("DELETE")
<button type="submit" class="px-2 py-1 bg-red-600 text-white text-xs rounded hover:bg-red-700">
{{ __("Delete") }}
</button>
</form>
</div>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="6" class="px-6 py-12 text-center text-gray-500">
{{ __("No users found.") }}
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@if(method_exists($users, 'links'))
<div class="p-4 border-t border-gray-100">
{{ $users->links() }}
</div>
@endif
</div>
</div>
</div>
@endsection