55 lines
3.4 KiB
PHP
55 lines
3.4 KiB
PHP
@extends('admin.layout')
|
|
|
|
@section('content')
|
|
<div class="mb-8 flex items-center justify-between">
|
|
<div>
|
|
<h2 class="text-2xl font-bold text-white tracking-tight">{{ ucfirst($dashboard) }} Settings</h2>
|
|
<p class="text-slate-400 mt-2">Adjust constants and parameters specific to this dashboard.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<form action="/admin/settings/{{ $dashboard }}" method="POST" class="glass rounded-2xl p-8 max-w-3xl border-t-4 border-t-red-700">
|
|
@csrf
|
|
|
|
<div class="space-y-6">
|
|
@foreach($schema as $field)
|
|
@php
|
|
// Retrieve existing value from DB or fallback to default
|
|
$currentValue = isset($settings[$field['key']]) ? $settings[$field['key']]->value : $field['default'];
|
|
@endphp
|
|
|
|
<div class="border-b border-white/5 pb-6 last:border-0 last:pb-0">
|
|
<label for="{{ $field['key'] }}" class="block text-sm font-semibold text-slate-200 mb-1">
|
|
{{ $field['name'] }}
|
|
</label>
|
|
<p class="text-xs text-slate-500 mb-3">{{ $field['description'] }}</p>
|
|
|
|
@if($field['type'] === 'boolean')
|
|
<div class="flex items-center gap-3">
|
|
<label class="relative inline-flex items-center cursor-pointer">
|
|
<input type="hidden" name="{{ $field['key'] }}" value="0">
|
|
<input type="checkbox" name="{{ $field['key'] }}" id="{{ $field['key'] }}" value="1" class="sr-only peer" {{ $currentValue ? 'checked' : '' }}>
|
|
<div class="w-11 h-6 bg-white/10 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-red-500/50 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-red-600"></div>
|
|
</label>
|
|
</div>
|
|
@else
|
|
<input type="{{ $field['type'] === 'integer' ? 'number' : 'text' }}"
|
|
name="{{ $field['key'] }}"
|
|
id="{{ $field['key'] }}"
|
|
value="{{ $currentValue }}"
|
|
class="w-full bg-white/5 border border-white/10 rounded-lg px-4 py-2 text-sm text-white focus:border-red-500 focus:outline-none focus:ring-1 focus:ring-red-500/30 transition-colors"
|
|
>
|
|
@endif
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
|
|
<div class="mt-8 pt-6 border-t border-white/10 flex items-center justify-end">
|
|
<button type="submit" class="px-6 py-2.5 text-sm font-semibold rounded-lg bg-red-700 hover:bg-red-600 border border-red-500/50 transition-colors shadow-lg shadow-red-900/20 text-white flex items-center gap-2">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4"/></svg>
|
|
Save Changes
|
|
</button>
|
|
</div>
|
|
</form>
|
|
@endsection
|