80 lines
3.9 KiB
PHP
80 lines
3.9 KiB
PHP
@extends('admin.layouts.app')
|
|
|
|
@section('title', '系统配置')
|
|
@section('page_title', '系统配置')
|
|
|
|
@section('content')
|
|
<div class="card mb-20">
|
|
<p class="mt-0">系统配置已经从静态骨架切到数据库读取,当前已支持基础编辑、保存和缓存刷新。</p>
|
|
<div class="muted">当前系统配置列表已接入缓存读取。</div>
|
|
<div class="muted">当前配置分组数:{{ $groupedCount }}</div>
|
|
</div>
|
|
|
|
@foreach($systemSettings->groupBy('group') as $group => $items)
|
|
<div class="card mb-20">
|
|
<h3 class="mt-0">配置分组:{{ $group }}</h3>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>配置键</th>
|
|
<th>名称</th>
|
|
<th>配置值</th>
|
|
<th>类型</th>
|
|
<th>自动加载</th>
|
|
<th>备注</th>
|
|
<th>操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($items as $item)
|
|
@php
|
|
$isEditing = $editingConfigId === $item->id;
|
|
$configName = $isEditing ? old('config_name', $item->config_name) : $item->config_name;
|
|
$configValue = $isEditing ? old('config_value', $item->config_value) : $item->config_value;
|
|
$valueType = $isEditing ? old('value_type', $item->value_type) : $item->value_type;
|
|
$autoload = $isEditing ? old('autoload', $item->autoload) : $item->autoload;
|
|
$remark = $isEditing ? old('remark', $item->remark) : $item->remark;
|
|
@endphp
|
|
<tr>
|
|
<form method="post" action="/admin/settings/system/{{ $item->id }}">
|
|
@csrf
|
|
<td>{{ $item->config_key }}<input type="hidden" name="group" value="{{ $item->group }}"></td>
|
|
<td><input name="config_name" value="{{ $configName }}"></td>
|
|
<td>
|
|
@if($valueType === 'json')
|
|
<textarea name="config_value" rows="4" class="w-full">{{ $configValue }}</textarea>
|
|
@if($isEditing && $errors->has('config_value'))
|
|
<div class="mt-6 muted" role="alert">{{ $errors->first('config_value') }}</div>
|
|
@endif
|
|
@elseif($valueType === 'boolean')
|
|
<select name="config_value">
|
|
<option value="1" @selected($configValue == '1')>true</option>
|
|
<option value="0" @selected($configValue == '0')>false</option>
|
|
</select>
|
|
@elseif($valueType === 'number')
|
|
<input type="number" step="any" name="config_value" value="{{ $configValue }}">
|
|
@else
|
|
<input name="config_value" value="{{ $configValue }}">
|
|
@endif
|
|
</td>
|
|
<td>
|
|
<select name="value_type">
|
|
@foreach($valueTypeOptions as $type)
|
|
<option value="{{ $type }}" @selected($valueType === $type)>{{ $type }}</option>
|
|
@endforeach
|
|
</select>
|
|
</td>
|
|
<td>
|
|
<label><input type="checkbox" name="autoload" value="1" @checked((bool) $autoload)> yes</label>
|
|
</td>
|
|
<td><input name="remark" value="{{ $remark }}"></td>
|
|
<td><button type="submit">保存</button></td>
|
|
</form>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endforeach
|
|
@endsection
|