<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
    <meta charset="UTF-8">
    <title>系统设置</title>
</head>
<body>
<th:block th:replace="layout :: content">
    <div class="row">
        <div class="col-lg-8 mx-auto">
            <div class="card">
                <div class="card-header bg-dark text-white">
                    <i class="fas fa-gear me-2"></i>系统设置
                </div>
                <div class="card-body">
                    <form th:action="@{/settings}" th:object="${settings}" method="post">
                        <input type="hidden" th:field="*{id}">
                        <h5 class="mb-3">基础信息</h5>
                        <div class="mb-3">
                            <label class="form-label">站点名称</label>
                            <input type="text" class="form-control" th:field="*{siteName}" maxlength="100" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">站点副标题</label>
                            <input type="text" class="form-control" th:field="*{siteSubtitle}" maxlength="150" required>
                        </div>
                        <div class="row mb-3">
                            <div class="col-md-6">
                                <div class="form-check form-switch">
                                    <input class="form-check-input" type="checkbox" th:field="*{registrationOpen}">
                                    <label class="form-check-label">开放注册</label>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-check form-switch">
                                    <input class="form-check-input" type="checkbox" th:field="*{maintenanceMode}">
                                    <label class="form-check-label">维护模式</label>
                                </div>
                            </div>
                        </div>
                        <div class="row mb-4">
                            <div class="col-md-6">
                                <div class="form-check form-switch">
                                    <input class="form-check-input" type="checkbox" th:field="*{enableAlipay}">
                                    <label class="form-check-label">启用支付宝</label>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-check form-switch">
                                    <input class="form-check-input" type="checkbox" th:field="*{enablePaypal}">
                                    <label class="form-check-label">启用 PayPal</label>
                                </div>
                            </div>
                        </div>
                        <div class="mb-4">
                            <label class="form-label">联系邮箱</label>
                            <input type="email" class="form-control" th:field="*{contactEmail}" maxlength="120">
                        </div>

                        <h5 class="mb-3">套餐与扣点</h5>
                        <div class="mb-3">
                            <label class="form-label">标准版价格（元）</label>
                            <input type="number" class="form-control" th:field="*{standardPriceCny}" min="0" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">专业版价格（元）</label>
                            <input type="number" class="form-control" th:field="*{proPriceCny}" min="0" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">每次生成消耗资源点</label>
                            <input type="number" class="form-control" th:field="*{pointsPerGeneration}" min="0" required>
                        </div>

                        <h5 class="mb-3">API 配置</h5>
                        <div class="mb-3">
                            <label class="form-label">AI API Base URL</label>
                            <input type="text" class="form-control" th:field="*{aiApiBaseUrl}" placeholder="https://ai.comfly.chat">
                            <div class="form-text">视频生成、图片生成、提示词优化统一使用此地址</div>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">AI API Key</label>
                            <input type="password" class="form-control" th:field="*{aiApiKey}" placeholder="留空则不修改">
                            <div class="form-text">API 密钥，留空表示不修改</div>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">提示词优化模型</label>
                            <input type="text" class="form-control" th:field="*{promptOptimizationModel}" placeholder="gpt-5.1-thinking">
                        </div>
                        <div class="mb-3">
                            <label class="form-label">分镜图系统引导词</label>
                            <textarea class="form-control" th:field="*{storyboardSystemPrompt}" rows="3" placeholder="可选的系统引导词"></textarea>
                        </div>
                        <div class="text-end">
                            <button type="submit" class="btn btn-primary">
                                <i class="fas fa-save me-1"></i>保存
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</th:block>

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>


