Files
laravel-llm-gateway/laravel-app/resources/views/budgets/edit.blade.php
wtrinkl b1363aeab9 Initial commit: Any-LLM Gateway with Laravel Admin Interface
- 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
2025-11-16 12:38:05 +01:00

103 lines
5.9 KiB
PHP

<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
Edit 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.update', $budget->budget_id) }}" method="POST">
@csrf
@method('PUT')
<!-- Budget ID (read-only) -->
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700">Budget ID</label>
<input type="text" value="{{ $budget->budget_id }}"
class="mt-1 block w-full rounded-md border-gray-300 bg-gray-100 shadow-sm"
disabled>
</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', $budget->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"
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', $budgetType) == 'daily' ? 'selected' : '' }}>Daily (24 hours)</option>
<option value="weekly" {{ old('budget_type', $budgetType) == 'weekly' ? 'selected' : '' }}>Weekly (7 days)</option>
<option value="monthly" {{ old('budget_type', $budgetType) == 'monthly' ? 'selected' : '' }}>Monthly (30 days)</option>
<option value="custom" {{ old('budget_type', $budgetType) == 'custom' ? 'selected' : '' }}>Custom Duration</option>
<option value="unlimited" {{ old('budget_type', $budgetType) == '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 -->
<div class="mb-4" id="custom_duration_field" style="display: {{ $budgetType == 'custom' ? 'block' : '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', $budget->budget_duration_sec ? floor($budget->budget_duration_sec / 86400) : '') }}"
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>
<!-- Warning Box -->
<div class="mb-6 p-4 bg-yellow-50 rounded-lg">
<h4 class="text-sm font-medium text-yellow-900 mb-2">⚠️ Warning</h4>
<p class="text-sm text-yellow-700">
This budget is currently assigned to <strong>{{ $budget->gatewayUsers()->count() }} user(s)</strong>.
Changes will affect all assigned users.
</p>
</div>
<!-- Actions -->
<div class="flex items-center justify-end gap-4">
<a href="{{ route('budgets.show', $budget->budget_id) }}" 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">
Update Budget
</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';
}
});
</script>
@endpush
</x-app-layout>