Files
team-tryouts/app/templates/pages/tryout_form.html

117 lines
6.5 KiB
HTML

{% extends "layouts/base.html" %}
{% block title %}{% if tryout %}Edit Tryout{% else %}Create Tryout{% endif %} - UdeS team manager{% endblock %}
{% block page_title %}{% if tryout %}Edit Tryout{% else %}Create Tryout{% endif %}{% endblock %}
{% block breadcrumb %}
<span class="breadcrumb">
Home / <a href="{{ url_for('tryouts.list_tryouts') }}">Tryouts</a>
{% if tryout %}
/ <a href="{{ url_for('tryouts.view_tryout', tryout_id=tryout.id) }}">{{ tryout.title }}</a>
/ Edit
{% else %}
/ Create
{% endif %}
</span>
{% endblock %}
{% block content %}
<div class="card">
<div class="card-body">
<form method="POST" action="{% if tryout %}{{ url_for('tryouts.edit_tryout', tryout_id=tryout.id) }}{% else %}{{ url_for('tryouts.create_tryout') }}{% endif %}" class="form">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<div class="form-row">
<div class="form-group col-12">
<label for="title">{{ _('Tryout Title') }}</label>
<input type="text" id="title" name="title" value="{{ tryout.title if tryout else '' }}" placeholder="{{ _('e.g., Spring Season Tryouts') }}" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-6">
<label for="game">{{ _('Game') }}</label>
<select id="game" name="game" class="form-select" required>
<option value="">{{ _('-- Select a game --') }}</option>
{% for game in esport_games %}
<option value="{{ game }}" {% if tryout and tryout.game == game %}selected{% endif %}>{{ game }}</option>
{% endfor %}
</select>
</div>
<div class="form-group col-3">
<label for="date">{{ _('Start Date') }}</label>
<input type="date" id="date" name="date" value="{{ tryout.date.strftime('%Y-%m-%d') if tryout else '' }}" required>
</div>
<div class="form-group col-3">
<label for="end_date">{{ _('End Date') }}</label>
<input type="date" id="end_date" name="end_date" value="{{ tryout.end_date.strftime('%Y-%m-%d') if tryout and tryout.end_date else '' }}">
<small class="text-muted">{{ _('Optional. Leave blank for single-day tryout.') }}</small>
</div>
</div>
<div class="form-row">
<div class="form-group col-6">
<label for="location">{{ _('Location') }}</label>
<input type="text" id="location" name="location" value="{{ tryout.location or '' if tryout else '' }}" placeholder="{{ _('e.g., Online') }}">
</div>
<div class="form-group col-6">
<label for="max_players">{{ _('Max Players') }}</label>
<input type="number" id="max_players" name="max_players" value="{{ tryout.max_players or '' if tryout else '' }}" placeholder="{{ _('Leave blank for unlimited') }}" min="1">
</div>
</div>
<div class="form-row">
<div class="form-group col-6">
<label for="target_org_team_id">{{ _('Target Team') }}</label>
<select id="target_org_team_id" name="target_org_team_id" class="form-select">
<option value="">{{ _('-- No target team --') }}</option>
{% for team in org_teams %}
<option value="{{ team.id }}" {% if tryout and tryout.target_org_team_id == team.id %}selected{% endif %}>
{{ team.name }}{% if team.coach %} (Coach: {{ team.coach.username }}){% endif %}
</option>
{% endfor %}
</select>
</div>
<div class="form-group col-6">
<label for="manager_id">{{ _('Assigned Manager') }}</label>
<select id="manager_id" name="manager_id" class="form-select">
<option value="">{{ _('-- No manager assigned --') }}</option>
{% for manager in managers %}
<option value="{{ manager.id }}" {% if tryout and tryout.manager_id == manager.id %}selected{% endif %}>
{{ manager.username }}
</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-12">
<label>{{ _('Assigned Coaches') }}</label>
<div class="checkbox-grid">
{% for coach in coaches %}
{% set is_checked = false %}
{% if tryout %}
{% for c in tryout.coaches %}
{% if c.id == coach.id %}{% set is_checked = true %}{% endif %}
{% endfor %}
{% if tryout.coach_id == coach.id %}{% set is_checked = true %}{% endif %}
{% endif %}
<label class="checkbox-label">
<input type="checkbox" name="coach_ids" value="{{ coach.id }}" {% if is_checked %}checked{% endif %}>
<span>{{ coach.username }}</span>
</label>
{% endfor %}
</div>
<small class="text-muted">{{ _('Select one or more coaches for this tryout.') }}</small>
</div>
</div>
<div class="form-group">
<label for="description">{{ _('Description') }}</label>
<textarea id="description" name="description" rows="4" placeholder="{{ _('Enter any details about the tryout...') }}">{% if tryout %}{{ tryout.description or '' }}{% endif %}</textarea>
</div>
<div class="form-actions">
<a href="{% if tryout %}{{ url_for('tryouts.view_tryout', tryout_id=tryout.id) }}{% else %}{{ url_for('tryouts.list_tryouts') }}{% endif %}" class="btn btn-secondary">
Cancel
</a>
<button type="submit" class="btn btn-primary">
{% if tryout %}Save Changes{% else %}Create Tryout{% endif %}
</button>
</div>
</form>
</div>
</div>
{% endblock %}