{% extends "base.html" %}

{% block title %}发布新杯赛 - 智联青云{% endblock %}

{% block content %}
<div class="max-w-3xl mx-auto py-8">
    <div class="bg-white shadow-sm rounded-lg border border-slate-200 p-6">
        <h1 class="text-2xl font-bold text-slate-900 mb-6">发布新杯赛</h1>
        <form method="POST" action="/admin/contests/create" class="space-y-6">
            <div>
                <label for="name" class="block text-sm font-medium text-slate-700 mb-1">杯赛名称 <span class="text-red-500">*</span></label>
                <input type="text" id="name" name="name" required
                       class="w-full px-3 py-2 border border-slate-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm"
                       placeholder="例如：2026年星火杯">
            </div>
            <div>
                <label for="organizer" class="block text-sm font-medium text-slate-700 mb-1">主办方 <span class="text-red-500">*</span></label>
                <input type="text" id="organizer" name="organizer" required
                       class="w-full px-3 py-2 border border-slate-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm"
                       placeholder="例如：星火杯组委会">
            </div>
            <div>
                <label for="description" class="block text-sm font-medium text-slate-700 mb-1">描述</label>
                <textarea id="description" name="description" rows="4"
                          class="w-full px-3 py-2 border border-slate-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm"
                          placeholder="简要介绍杯赛的目的、规则等"></textarea>
            </div>
            <div>
                <label for="status" class="block text-sm font-medium text-slate-700 mb-1">初始状态</label>
                <select id="status" name="status"
                        class="w-full px-3 py-2 border border-slate-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm">
                    <option value="upcoming">即将开始</option>
                    <option value="registering">报名中</option>
                </select>
            </div>
            <div class="grid grid-cols-2 gap-4">
                <div>
                    <label for="start_date" class="block text-sm font-medium text-slate-700 mb-1">开始日期</label>
                    <input type="date" id="start_date" name="start_date"
                           class="w-full px-3 py-2 border border-slate-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm">
                </div>
                <div>
                    <label for="end_date" class="block text-sm font-medium text-slate-700 mb-1">结束日期</label>
                    <input type="date" id="end_date" name="end_date"
                           class="w-full px-3 py-2 border border-slate-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm">
                </div>
            </div>
            <div>
                <label for="total_score" class="block text-sm font-medium text-slate-700 mb-1">杯赛满分</label>
                <input type="number" id="total_score" name="total_score" min="1" value="150"
                       class="w-full px-3 py-2 border border-slate-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm">
            </div>
            <!-- 报备信息 -->
            <div class="border-t border-slate-200 pt-6 mt-2">
                <h2 class="text-lg font-semibold text-slate-900 mb-4">报备信息</h2>
                <div class="space-y-4">
                    <div>
                        <label for="responsible_person" class="block text-sm font-medium text-slate-700 mb-1">责任人姓名</label>
                        <input type="text" id="responsible_person" name="responsible_person"
                               class="w-full px-3 py-2 border border-slate-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm"
                               placeholder="赛事责任人真实姓名">
                    </div>
                    <div>
                        <label for="responsible_phone" class="block text-sm font-medium text-slate-700 mb-1">责任人电话</label>
                        <input type="tel" id="responsible_phone" name="responsible_phone"
                               class="w-full px-3 py-2 border border-slate-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm"
                               placeholder="11位手机号码">
                    </div>
                    <div>
                        <label for="responsible_email" class="block text-sm font-medium text-slate-700 mb-1">责任人邮箱</label>
                        <input type="email" id="responsible_email" name="responsible_email"
                               class="w-full px-3 py-2 border border-slate-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm"
                               placeholder="example@email.com">
                    </div>
                    <div>
                        <label for="organization" class="block text-sm font-medium text-slate-700 mb-1">所属机构/学校</label>
                        <input type="text" id="organization" name="organization"
                               class="w-full px-3 py-2 border border-slate-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm"
                               placeholder="例如：XX大学、XX教育机构">
                    </div>
                </div>
            </div>
            <div class="flex justify-end gap-3">
                <a href="{{ url_for('contest_list') }}" class="px-5 py-2.5 border border-slate-300 rounded-md text-sm font-medium text-slate-700 bg-white hover:bg-slate-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
                    取消
                </a>
                <button type="submit"
                        class="px-5 py-2.5 bg-primary text-white rounded-md text-sm font-medium hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
                    创建并发布
                </button>
            </div>
        </form>
    </div>
</div>
{% endblock %}
