- Any-LLM Gateway setup with Docker Compose - Laravel 11 admin interface with Livewire - Dashboard with usage statistics and charts - Gateway Users management with budget tracking - API Keys management with revocation - Budget templates with assignment - Usage Logs with filtering and CSV export - Model Pricing management with calculator - PostgreSQL database integration - Complete authentication system for admins
114 lines
6.4 KiB
PHP
114 lines
6.4 KiB
PHP
<x-app-layout>
|
||
<x-slot name="header">
|
||
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||
Create Budget Template
|
||
</h2>
|
||
</x-slot>
|
||
|
||
<div class="py-12">
|
||
<div class="max-w-3xl mx-auto sm:px-6 lg:px-8">
|
||
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
|
||
<div class="p-6 text-gray-900">
|
||
<form action="{{ route('budgets.store') }}" method="POST">
|
||
@csrf
|
||
|
||
<!-- Budget Name (for display purposes) -->
|
||
<div class="mb-4">
|
||
<label for="budget_name" class="block text-sm font-medium text-gray-700">Budget Template Name</label>
|
||
<input type="text" name="budget_name" id="budget_name"
|
||
value="{{ old('budget_name') }}"
|
||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"
|
||
placeholder="e.g., Standard Monthly Budget"
|
||
required>
|
||
@error('budget_name')
|
||
<p class="text-red-500 text-xs mt-1">{{ $message }}</p>
|
||
@enderror
|
||
</div>
|
||
|
||
<!-- Max Budget -->
|
||
<div class="mb-4">
|
||
<label for="max_budget" class="block text-sm font-medium text-gray-700">Maximum Budget ($)</label>
|
||
<input type="number" name="max_budget" id="max_budget"
|
||
value="{{ old('max_budget') }}"
|
||
step="0.01" min="0"
|
||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"
|
||
placeholder="100.00"
|
||
required>
|
||
@error('max_budget')
|
||
<p class="text-red-500 text-xs mt-1">{{ $message }}</p>
|
||
@enderror
|
||
</div>
|
||
|
||
<!-- Budget Type -->
|
||
<div class="mb-4">
|
||
<label for="budget_type" class="block text-sm font-medium text-gray-700 mb-2">Budget Duration</label>
|
||
<select name="budget_type" id="budget_type"
|
||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"
|
||
required>
|
||
<option value="daily" {{ old('budget_type') == 'daily' ? 'selected' : '' }}>Daily (24 hours)</option>
|
||
<option value="weekly" {{ old('budget_type') == 'weekly' ? 'selected' : '' }}>Weekly (7 days)</option>
|
||
<option value="monthly" {{ old('budget_type') == 'monthly' ? 'selected' : '' }}>Monthly (30 days)</option>
|
||
<option value="custom" {{ old('budget_type') == 'custom' ? 'selected' : '' }}>Custom Duration</option>
|
||
<option value="unlimited" {{ old('budget_type') == 'unlimited' ? 'selected' : '' }}>Unlimited (No Reset)</option>
|
||
</select>
|
||
@error('budget_type')
|
||
<p class="text-red-500 text-xs mt-1">{{ $message }}</p>
|
||
@enderror
|
||
</div>
|
||
|
||
<!-- Custom Duration (shown when custom is selected) -->
|
||
<div class="mb-4" id="custom_duration_field" style="display: none;">
|
||
<label for="custom_duration_days" class="block text-sm font-medium text-gray-700">Custom Duration (Days)</label>
|
||
<input type="number" name="custom_duration_days" id="custom_duration_days"
|
||
value="{{ old('custom_duration_days') }}"
|
||
min="1"
|
||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"
|
||
placeholder="e.g., 14">
|
||
@error('custom_duration_days')
|
||
<p class="text-red-500 text-xs mt-1">{{ $message }}</p>
|
||
@enderror
|
||
</div>
|
||
|
||
<!-- Info Box -->
|
||
<div class="mb-6 p-4 bg-blue-50 rounded-lg">
|
||
<h4 class="text-sm font-medium text-blue-900 mb-2">ℹ️ Budget Template Info</h4>
|
||
<ul class="text-sm text-blue-700 space-y-1">
|
||
<li>• Budget templates can be assigned to multiple users</li>
|
||
<li>• Users will automatically reset when duration expires</li>
|
||
<li>• "Unlimited" budgets never reset automatically</li>
|
||
</ul>
|
||
</div>
|
||
|
||
<!-- Actions -->
|
||
<div class="flex items-center justify-end gap-4">
|
||
<a href="{{ route('budgets.index') }}" class="text-gray-600 hover:text-gray-900">Cancel</a>
|
||
<button type="submit" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
|
||
Create Budget Template
|
||
</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
@push('scripts')
|
||
<script>
|
||
// Toggle custom duration field
|
||
document.getElementById('budget_type').addEventListener('change', function() {
|
||
const customField = document.getElementById('custom_duration_field');
|
||
if (this.value === 'custom') {
|
||
customField.style.display = 'block';
|
||
} else {
|
||
customField.style.display = 'none';
|
||
}
|
||
});
|
||
|
||
// Trigger on page load if custom was selected
|
||
if (document.getElementById('budget_type').value === 'custom') {
|
||
document.getElementById('custom_duration_field').style.display = 'block';
|
||
}
|
||
</script>
|
||
@endpush
|
||
</x-app-layout>
|