Added value conservation on error to sports.event portal edit and create forms.

This commit is contained in:
Denis Durepos 2025-08-20 13:28:20 -04:00
parent c03886e812
commit 8ca4ef5af3

View file

@ -67,7 +67,7 @@
<!-- Event Name -->
<div class="mb-3">
<label for="name" class="form-label">Event Name *</label>
<input type="text" class="form-control" id="name" name="name" required="true"/>
<input type="text" class="form-control" id="name" name="name" t-att-value="name" required="true"/>
<div class="invalid-feedback">
Please provide a valid event name.
</div>
@ -77,11 +77,11 @@
<div class="mb-3">
<label for="event_type" class="form-label">Event Type</label>
<select class="form-select" id="event_type" name="event_type">
<option value="game">Game</option>
<option value="practice">Practice</option>
<option value="training">Training</option>
<option value="meeting">Team Meeting</option>
<option value="other">Other</option>
<option value="game" t-att-selected="event_type == 'game'">Game</option>
<option value="practice" t-att-selected="event_type == 'practice'">Practice</option>
<option value="training" t-att-selected="event_type == 'training'">Training</option>
<option value="meeting" t-att-selected="event_type == 'meeting'">Team Meeting</option>
<option value="other" t-att-selected="event_type == 'other'">Other</option>
</select>
</div>
@ -89,11 +89,11 @@
<div class="mb-3">
<label for="state" class="form-label">Status</label>
<select class="form-select" id="state" name="state">
<option value="draft">Draft</option>
<option value="confirmed" selected="selected">Confirmed</option>
<option value="in_progress">In Progress</option>
<option value="completed">Completed</option>
<option value="cancelled">Cancelled</option>
<option value="draft" t-att-selected="state == 'draft'">Draft</option>
<option value="confirmed" t-att-selected="(state or 'confirmed') == 'confirmed'">Confirmed</option>
<option value="in_progress" t-att-selected="state == 'in_progress'">In Progress</option>
<option value="completed" t-att-selected="state == 'completed'">Completed</option>
<option value="cancelled" t-att-selected="state == 'cancelled'">Cancelled</option>
</select>
</div>
</div>
@ -105,7 +105,7 @@
<select class="form-select" id="team_id" name="team_id" required="true">
<option value="">Select a team...</option>
<t t-foreach="teams" t-as="team">
<option t-att-value="team.id">
<option t-att-value="team.id" t-att-selected="team_id_selected == team.id">
<t t-esc="team.name"/>
</option>
</t>
@ -122,7 +122,7 @@
<select class="form-select" id="venue_id" name="venue_id">
<option value="">Select a venue...</option>
<t t-foreach="venues" t-as="venue">
<option t-att-value="venue.id">
<option t-att-value="venue.id" t-att-selected="venue_id_selected == venue.id">
<t t-esc="venue.name"/>
</option>
</t>
@ -139,12 +139,13 @@
<div class="mb-3">
<label for="description_editor" class="form-label">Description</label>
<!-- Hidden field actually submitted -->
<input type="hidden" id="description" name="description" value=""/>
<input type="hidden" id="description" name="description" t-att-value="description_html or ''"/>
<!-- Simple rich-text editor -->
<div id="description_editor"
class="form-control"
style="min-height: 150px; overflow:auto;"
contenteditable="true">
<t t-raw="description_html"/>
</div>
<small class="form-text text-muted">You can paste formatted text. The formatted content will be saved.</small>
</div>
@ -176,7 +177,7 @@
<!-- Event Start -->
<div class="mb-3">
<label for="date_start" class="form-label">Event Start *</label>
<input type="datetime-local" class="form-control" id="date_start" name="date_start" required="true"/>
<input type="datetime-local" class="form-control" id="date_start" name="date_start" t-att-value="date_start_local" required="true"/>
<div class="invalid-feedback">
Please provide an event start time.
</div>
@ -185,7 +186,7 @@
<!-- Therapist Start -->
<div class="mb-3">
<label for="therapist_start" class="form-label">Therapist Start</label>
<input type="datetime-local" class="form-control" id="therapist_start" name="therapist_start"/>
<input type="datetime-local" class="form-control" id="therapist_start" name="therapist_start" t-att-value="therapist_start_local"/>
<small class="form-text text-muted">Leave empty to use event start time</small>
</div>
</div>
@ -194,7 +195,7 @@
<!-- Event End -->
<div class="mb-3">
<label for="date_end" class="form-label">Event End *</label>
<input type="datetime-local" class="form-control" id="date_end" name="date_end" required="true"/>
<input type="datetime-local" class="form-control" id="date_end" name="date_end" t-att-value="date_end_local" required="true"/>
<div class="invalid-feedback">
Please provide an event end time.
</div>
@ -203,7 +204,7 @@
<!-- Therapist End -->
<div class="mb-3">
<label for="therapist_end" class="form-label">Therapist End</label>
<input type="datetime-local" class="form-control" id="therapist_end" name="therapist_end"/>
<input type="datetime-local" class="form-control" id="therapist_end" name="therapist_end" t-att-value="therapist_end_local"/>
<small class="form-text text-muted">Leave empty to use event end time</small>
</div>
</div>
@ -228,7 +229,8 @@
<input class="form-check-input" type="checkbox"
t-att-id="'staff_%s' % professional.id"
name="assigned_staff_ids[]"
t-att-value="professional.id"/>
t-att-value="professional.id"
t-att-checked="assigned_staff_selected and professional.id in assigned_staff_selected"/>
<label class="form-check-label" t-att-for="'staff_%s' % professional.id">
<span t-esc="professional.name"/>
<small class="text-muted d-block" t-esc="professional.email"/>