Fix ride category, status, and park area selection in moderation submission edit view

This commit is contained in:
pacnpal
2024-11-14 01:32:37 +00:00
parent da0ee1acfa
commit d9990ae241

View File

@@ -175,24 +175,31 @@
<select name="{{ field }}" <select name="{{ field }}"
x-model="category" x-model="category"
class="w-full px-3 py-2 text-gray-900 bg-white border rounded-lg dark:text-gray-300 dark:bg-gray-900 border-gray-200/50 dark:border-gray-700/50 focus:ring-2 focus:ring-blue-500"> class="w-full px-3 py-2 text-gray-900 bg-white border rounded-lg dark:text-gray-300 dark:bg-gray-900 border-gray-200/50 dark:border-gray-700/50 focus:ring-2 focus:ring-blue-500">
{% for choice in submission.content_object.CATEGORY_CHOICES %} <option value="">Select ride type</option>
<option value="{{ choice.0 }}" {% if choice.0 == value %}selected{% endif %}>{{ choice.1 }}</option> <option value="RC" {% if value == 'RC' %}selected{% endif %}>Roller Coaster</option>
{% endfor %} <option value="DR" {% if value == 'DR' %}selected{% endif %}>Dark Ride</option>
<option value="FR" {% if value == 'FR' %}selected{% endif %}>Flat Ride</option>
<option value="WR" {% if value == 'WR' %}selected{% endif %}>Water Ride</option>
<option value="TR" {% if value == 'TR' %}selected{% endif %}>Transport</option>
<option value="OT" {% if value == 'OT' %}selected{% endif %}>Other</option>
</select> </select>
{% elif field == 'status' %} {% elif field == 'status' %}
<select name="{{ field }}" <select name="{{ field }}"
x-model="status" x-model="status"
class="w-full px-3 py-2 text-gray-900 bg-white border rounded-lg dark:text-gray-300 dark:bg-gray-900 border-gray-200/50 dark:border-gray-700/50 focus:ring-2 focus:ring-blue-500"> class="w-full px-3 py-2 text-gray-900 bg-white border rounded-lg dark:text-gray-300 dark:bg-gray-900 border-gray-200/50 dark:border-gray-700/50 focus:ring-2 focus:ring-blue-500">
{% for choice in submission.content_object.STATUS_CHOICES %} <option value="OPERATING" {% if value == 'OPERATING' %}selected{% endif %}>Operating</option>
<option value="{{ choice.0 }}" {% if choice.0 == value %}selected{% endif %}>{{ choice.1 }}</option> <option value="SBNO" {% if value == 'SBNO' %}selected{% endif %}>Standing But Not Operating</option>
{% endfor %} <option value="CLOSING" {% if value == 'CLOSING' %}selected{% endif %}>Closing</option>
<option value="CLOSED_PERM" {% if value == 'CLOSED_PERM' %}selected{% endif %}>Permanently Closed</option>
<option value="UNDER_CONSTRUCTION" {% if value == 'UNDER_CONSTRUCTION' %}selected{% endif %}>Under Construction</option>
<option value="DEMOLISHED" {% if value == 'DEMOLISHED' %}selected{% endif %}>Demolished</option>
<option value="RELOCATED" {% if value == 'RELOCATED' %}selected{% endif %}>Relocated</option>
</select> </select>
{% elif field == 'post_closing_status' %} {% elif field == 'post_closing_status' %}
<select name="{{ field }}" <select name="{{ field }}"
class="w-full px-3 py-2 text-gray-900 bg-white border rounded-lg dark:text-gray-300 dark:bg-gray-900 border-gray-200/50 dark:border-gray-700/50 focus:ring-2 focus:ring-blue-500"> class="w-full px-3 py-2 text-gray-900 bg-white border rounded-lg dark:text-gray-300 dark:bg-gray-900 border-gray-200/50 dark:border-gray-700/50 focus:ring-2 focus:ring-blue-500">
{% for choice in submission.content_object.POST_CLOSING_STATUS_CHOICES %} <option value="SBNO" {% if value == 'SBNO' %}selected{% endif %}>Standing But Not Operating</option>
<option value="{{ choice.0 }}" {% if choice.0 == value %}selected{% endif %}>{{ choice.1 }}</option> <option value="CLOSED_PERM" {% if value == 'CLOSED_PERM' %}selected{% endif %}>Permanently Closed</option>
{% endfor %}
</select> </select>
{% elif field == 'opening_date' or field == 'closing_date' or field == 'status_since' %} {% elif field == 'opening_date' or field == 'closing_date' or field == 'status_since' %}
<input type="date" <input type="date"
@@ -227,6 +234,15 @@
hx-get="/parks/areas/" hx-get="/parks/areas/"
hx-target="#park-area-select-{{ submission.id }}"> hx-target="#park-area-select-{{ submission.id }}">
</div> </div>
{% elif field == 'park_area' %}
<select name="{{ field }}"
id="park-area-select-{{ submission.id }}"
class="w-full px-3 py-2 text-gray-900 bg-white border rounded-lg dark:text-gray-300 dark:bg-gray-900 border-gray-200/50 dark:border-gray-700/50 focus:ring-2 focus:ring-blue-500">
<option value="">Select area</option>
{% for area_id, area_name in park_areas %}
<option value="{{ area_id }}" {% if value == area_id %}selected{% endif %}>{{ area_name }}</option>
{% endfor %}
</select>
{% elif field == 'manufacturer' %} {% elif field == 'manufacturer' %}
<div class="relative space-y-2"> <div class="relative space-y-2">
<input type="text" <input type="text"