mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-25 00:11:09 -05:00
here we go
This commit is contained in:
@@ -4,24 +4,31 @@
|
||||
{% block title %}{{ company.name }} - ThrillWiki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container mx-auto px-4">
|
||||
<div class="container px-4 mx-auto">
|
||||
<!-- Company Header -->
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-6 mb-6">
|
||||
<div class="flex flex-col md:flex-row justify-between items-start md:items-center">
|
||||
<div class="p-6 mb-6 bg-white rounded-lg shadow dark:bg-gray-800">
|
||||
<div class="flex flex-col items-start justify-between md:flex-row md:items-center">
|
||||
<div>
|
||||
<h1 class="text-3xl font-bold text-gray-900 dark:text-white mb-2">{{ company.name }}</h1>
|
||||
<h1 class="mb-2 text-3xl font-bold text-gray-900 dark:text-white">{{ company.name }}</h1>
|
||||
{% if company.headquarters %}
|
||||
<p class="text-gray-600 dark:text-gray-400">
|
||||
<i class="fas fa-map-marker-alt mr-2"></i>{{ company.headquarters }}
|
||||
<i class="mr-2 fas fa-map-marker-alt"></i>{{ company.headquarters }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if company.website %}
|
||||
<a href="{{ company.website }}" target="_blank" rel="noopener noreferrer"
|
||||
class="btn-secondary mt-4 md:mt-0">
|
||||
<i class="fas fa-external-link-alt mr-2"></i>Visit Website
|
||||
</a>
|
||||
{% endif %}
|
||||
<div class="flex gap-2 mt-4 md:mt-0">
|
||||
{% if company.website %}
|
||||
<a href="{{ company.website }}" target="_blank" rel="noopener noreferrer"
|
||||
class="btn-secondary">
|
||||
<i class="mr-2 fas fa-external-link-alt"></i>Visit Website
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if user.is_authenticated %}
|
||||
<a href="{% url 'companies:company_edit' slug=company.slug %}" class="btn-secondary">
|
||||
<i class="mr-2 fas fa-edit"></i>Edit
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if company.description %}
|
||||
@@ -32,22 +39,22 @@
|
||||
</div>
|
||||
|
||||
<!-- Company Stats -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6">
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-6 text-center">
|
||||
<div class="grid grid-cols-1 gap-6 mb-6 md:grid-cols-3">
|
||||
<div class="p-6 text-center bg-white rounded-lg shadow dark:bg-gray-800">
|
||||
<div class="text-3xl font-bold text-blue-600 dark:text-blue-400">
|
||||
{{ parks.count }}
|
||||
</div>
|
||||
<div class="text-gray-600 dark:text-gray-400 mt-1">Theme Parks</div>
|
||||
<div class="mt-1 text-gray-600 dark:text-gray-400">Theme Parks</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-6 text-center">
|
||||
<div class="p-6 text-center bg-white rounded-lg shadow dark:bg-gray-800">
|
||||
<div class="text-3xl font-bold text-blue-600 dark:text-blue-400">
|
||||
{{ parks|length }}
|
||||
</div>
|
||||
<div class="text-gray-600 dark:text-gray-400 mt-1">Active Parks</div>
|
||||
<div class="mt-1 text-gray-600 dark:text-gray-400">Active Parks</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-6 text-center">
|
||||
<div class="p-6 text-center bg-white rounded-lg shadow dark:bg-gray-800">
|
||||
<div class="text-3xl font-bold text-blue-600 dark:text-blue-400">
|
||||
{% with total_rides=0 %}
|
||||
{% for park in parks %}
|
||||
@@ -56,42 +63,42 @@
|
||||
{{ total_rides }}
|
||||
{% endwith %}
|
||||
</div>
|
||||
<div class="text-gray-600 dark:text-gray-400 mt-1">Total Attractions</div>
|
||||
<div class="mt-1 text-gray-600 dark:text-gray-400">Total Attractions</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Parks List -->
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-6">
|
||||
<h2 class="text-2xl font-bold text-gray-900 dark:text-white mb-6">Theme Parks</h2>
|
||||
<div class="p-6 bg-white rounded-lg shadow dark:bg-gray-800">
|
||||
<h2 class="mb-6 text-2xl font-bold text-gray-900 dark:text-white">Theme Parks</h2>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
<div class="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
|
||||
{% for park in parks %}
|
||||
<div class="bg-gray-50 dark:bg-gray-700 rounded-lg overflow-hidden">
|
||||
<div class="overflow-hidden rounded-lg bg-gray-50 dark:bg-gray-700">
|
||||
{% if park.photos.exists %}
|
||||
<img src="{{ park.photos.first.image.url }}"
|
||||
alt="{{ park.name }}"
|
||||
class="w-full h-48 object-cover">
|
||||
class="object-cover w-full h-48">
|
||||
{% else %}
|
||||
<div class="w-full h-48 bg-gray-200 dark:bg-gray-600 flex items-center justify-center">
|
||||
<div class="flex items-center justify-center w-full h-48 bg-gray-200 dark:bg-gray-600">
|
||||
<span class="text-gray-400">No image available</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="p-4">
|
||||
<h3 class="text-lg font-semibold mb-2">
|
||||
<h3 class="mb-2 text-lg font-semibold">
|
||||
<a href="{% url 'parks:park_detail' park.slug %}"
|
||||
class="text-blue-600 dark:text-blue-400 hover:underline">
|
||||
{{ park.name }}
|
||||
</a>
|
||||
</h3>
|
||||
<p class="text-gray-600 dark:text-gray-400 mb-2">{{ park.location }}</p>
|
||||
<div class="flex justify-between items-center">
|
||||
<p class="mb-2 text-gray-600 dark:text-gray-400">{{ park.location }}</p>
|
||||
<div class="flex items-center justify-between">
|
||||
<span class="text-sm text-gray-500 dark:text-gray-400">
|
||||
{{ park.rides.count }} attractions
|
||||
</span>
|
||||
{% if park.average_rating %}
|
||||
<div class="flex items-center">
|
||||
<span class="text-yellow-400 mr-1">★</span>
|
||||
<span class="mr-1 text-yellow-400">★</span>
|
||||
<span class="text-gray-600 dark:text-gray-400">
|
||||
{{ park.average_rating|floatformat:1 }}/10
|
||||
</span>
|
||||
@@ -101,7 +108,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{% empty %}
|
||||
<div class="col-span-full text-center py-8">
|
||||
<div class="py-8 text-center col-span-full">
|
||||
<p class="text-gray-500 dark:text-gray-400">No parks found for this company.</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
128
templates/companies/company_form.html
Normal file
128
templates/companies/company_form.html
Normal file
@@ -0,0 +1,128 @@
|
||||
{% extends 'base/base.html' %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}{% if is_edit %}Edit{% else %}Add{% endif %} Company - ThrillWiki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container px-4 mx-auto">
|
||||
<div class="max-w-3xl mx-auto">
|
||||
<div class="p-6 bg-white rounded-lg shadow dark:bg-gray-800">
|
||||
<h1 class="mb-6 text-3xl font-bold text-gray-900 dark:text-white">{% if is_edit %}Edit{% else %}Add{% endif %} Company</h1>
|
||||
|
||||
<form method="post" class="space-y-6">
|
||||
{% csrf_token %}
|
||||
|
||||
<!-- Name field -->
|
||||
<div>
|
||||
<label for="{{ form.name.id_for_label }}" class="block mb-1 text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
Name
|
||||
</label>
|
||||
<div>
|
||||
{{ form.name }}
|
||||
</div>
|
||||
{% if form.name.errors %}
|
||||
<div class="mt-1 text-sm text-red-600 dark:text-red-400">
|
||||
{{ form.name.errors }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Headquarters field -->
|
||||
<div x-data="locationAutocomplete('country', false)" class="relative">
|
||||
<label for="{{ form.headquarters.id_for_label }}" class="block mb-1 text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
Headquarters
|
||||
</label>
|
||||
<input type="text"
|
||||
id="{{ form.headquarters.id_for_label }}"
|
||||
name="headquarters"
|
||||
x-model="query"
|
||||
@input.debounce.300ms="fetchSuggestions()"
|
||||
@focus="fetchSuggestions()"
|
||||
@click.away="suggestions = []"
|
||||
class="w-full border-gray-300 rounded-lg form-input dark:border-gray-600 dark:bg-gray-700 dark:text-white"
|
||||
placeholder="e.g., Orlando, Florida, United States"
|
||||
value="{{ form.headquarters.value|default:'' }}"
|
||||
autocomplete="off">
|
||||
<!-- Suggestions Dropdown -->
|
||||
<ul x-show="suggestions.length > 0"
|
||||
x-cloak
|
||||
class="absolute z-50 w-full py-1 mt-1 overflow-auto bg-white rounded-md shadow-lg dark:bg-gray-700 max-h-60">
|
||||
<template x-for="suggestion in suggestions" :key="suggestion">
|
||||
<li @click="selectSuggestion(suggestion)"
|
||||
x-text="suggestion"
|
||||
class="px-4 py-2 text-gray-700 cursor-pointer dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-600">
|
||||
</li>
|
||||
</template>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Website field -->
|
||||
<div>
|
||||
<label for="{{ form.website.id_for_label }}" class="block mb-1 text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
Website
|
||||
</label>
|
||||
<div>
|
||||
{{ form.website }}
|
||||
</div>
|
||||
{% if form.website.errors %}
|
||||
<div class="mt-1 text-sm text-red-600 dark:text-red-400">
|
||||
{{ form.website.errors }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Description field -->
|
||||
<div>
|
||||
<label for="{{ form.description.id_for_label }}" class="block mb-1 text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
Description
|
||||
</label>
|
||||
<div>
|
||||
{{ form.description }}
|
||||
</div>
|
||||
{% if form.description.errors %}
|
||||
<div class="mt-1 text-sm text-red-600 dark:text-red-400">
|
||||
{{ form.description.errors }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if not user.role == 'MODERATOR' and not user.role == 'ADMIN' and not user.role == 'SUPERUSER' %}
|
||||
<div class="space-y-4">
|
||||
<div>
|
||||
<label for="reason" class="block mb-1 text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
Reason for {% if is_edit %}Edit{% else %}Addition{% endif %}
|
||||
</label>
|
||||
<textarea name="reason"
|
||||
id="reason"
|
||||
class="w-full border-gray-300 rounded-lg form-textarea dark:border-gray-600 dark:bg-gray-700 dark:text-white"
|
||||
rows="3"
|
||||
required
|
||||
placeholder="Please explain why you're {% if is_edit %}editing{% else %}adding{% endif %} this company and provide any relevant details."></textarea>
|
||||
</div>
|
||||
<div>
|
||||
<label for="source" class="block mb-1 text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
Source (Optional)
|
||||
</label>
|
||||
<input type="text"
|
||||
name="source"
|
||||
id="source"
|
||||
class="w-full border-gray-300 rounded-lg form-input dark:border-gray-600 dark:bg-gray-700 dark:text-white"
|
||||
placeholder="Link to official website, news article, or other source">
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="flex justify-end space-x-4">
|
||||
<a href="{% if is_edit %}{% url 'companies:company_detail' slug=object.slug %}{% else %}{% url 'companies:company_list' %}{% endif %}"
|
||||
class="px-4 py-2 text-gray-700 bg-gray-200 rounded-lg hover:bg-gray-300 dark:bg-gray-600 dark:text-gray-200 dark:hover:bg-gray-500">
|
||||
Cancel
|
||||
</a>
|
||||
<button type="submit" class="px-4 py-2 text-white bg-blue-600 rounded-lg hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600">
|
||||
{% if is_edit %}Save Changes{% else %}Submit{% endif %}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -16,12 +16,19 @@
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if manufacturer.website %}
|
||||
<a href="{{ manufacturer.website }}" target="_blank" rel="noopener noreferrer"
|
||||
class="mt-4 btn-secondary md:mt-0">
|
||||
<i class="mr-2 fas fa-external-link-alt"></i>Visit Website
|
||||
</a>
|
||||
{% endif %}
|
||||
<div class="flex gap-2 mt-4 md:mt-0">
|
||||
{% if manufacturer.website %}
|
||||
<a href="{{ manufacturer.website }}" target="_blank" rel="noopener noreferrer"
|
||||
class="btn-secondary">
|
||||
<i class="mr-2 fas fa-external-link-alt"></i>Visit Website
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if user.is_authenticated %}
|
||||
<a href="{% url 'companies:manufacturer_edit' slug=manufacturer.slug %}" class="btn-secondary">
|
||||
<i class="mr-2 fas fa-edit"></i>Edit
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if manufacturer.description %}
|
||||
|
||||
128
templates/companies/manufacturer_form.html
Normal file
128
templates/companies/manufacturer_form.html
Normal file
@@ -0,0 +1,128 @@
|
||||
{% extends 'base/base.html' %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}{% if is_edit %}Edit{% else %}Add{% endif %} Manufacturer - ThrillWiki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container px-4 mx-auto">
|
||||
<div class="max-w-3xl mx-auto">
|
||||
<div class="p-6 bg-white rounded-lg shadow dark:bg-gray-800">
|
||||
<h1 class="mb-6 text-3xl font-bold text-gray-900 dark:text-white">{% if is_edit %}Edit{% else %}Add{% endif %} Manufacturer</h1>
|
||||
|
||||
<form method="post" class="space-y-6">
|
||||
{% csrf_token %}
|
||||
|
||||
<!-- Name field -->
|
||||
<div>
|
||||
<label for="{{ form.name.id_for_label }}" class="block mb-1 text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
Name
|
||||
</label>
|
||||
<div>
|
||||
{{ form.name }}
|
||||
</div>
|
||||
{% if form.name.errors %}
|
||||
<div class="mt-1 text-sm text-red-600 dark:text-red-400">
|
||||
{{ form.name.errors }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Headquarters field -->
|
||||
<div x-data="locationAutocomplete('country', false)" class="relative">
|
||||
<label for="{{ form.headquarters.id_for_label }}" class="block mb-1 text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
Headquarters
|
||||
</label>
|
||||
<input type="text"
|
||||
id="{{ form.headquarters.id_for_label }}"
|
||||
name="headquarters"
|
||||
x-model="query"
|
||||
@input.debounce.300ms="fetchSuggestions()"
|
||||
@focus="fetchSuggestions()"
|
||||
@click.away="suggestions = []"
|
||||
class="w-full border-gray-300 rounded-lg form-input dark:border-gray-600 dark:bg-gray-700 dark:text-white"
|
||||
placeholder="e.g., Altoona, Pennsylvania, United States"
|
||||
value="{{ form.headquarters.value|default:'' }}"
|
||||
autocomplete="off">
|
||||
<!-- Suggestions Dropdown -->
|
||||
<ul x-show="suggestions.length > 0"
|
||||
x-cloak
|
||||
class="absolute z-50 w-full py-1 mt-1 overflow-auto bg-white rounded-md shadow-lg dark:bg-gray-700 max-h-60">
|
||||
<template x-for="suggestion in suggestions" :key="suggestion">
|
||||
<li @click="selectSuggestion(suggestion)"
|
||||
x-text="suggestion"
|
||||
class="px-4 py-2 text-gray-700 cursor-pointer dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-600">
|
||||
</li>
|
||||
</template>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Website field -->
|
||||
<div>
|
||||
<label for="{{ form.website.id_for_label }}" class="block mb-1 text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
Website
|
||||
</label>
|
||||
<div>
|
||||
{{ form.website }}
|
||||
</div>
|
||||
{% if form.website.errors %}
|
||||
<div class="mt-1 text-sm text-red-600 dark:text-red-400">
|
||||
{{ form.website.errors }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Description field -->
|
||||
<div>
|
||||
<label for="{{ form.description.id_for_label }}" class="block mb-1 text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
Description
|
||||
</label>
|
||||
<div>
|
||||
{{ form.description }}
|
||||
</div>
|
||||
{% if form.description.errors %}
|
||||
<div class="mt-1 text-sm text-red-600 dark:text-red-400">
|
||||
{{ form.description.errors }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if not user.role == 'MODERATOR' and not user.role == 'ADMIN' and not user.role == 'SUPERUSER' %}
|
||||
<div class="space-y-4">
|
||||
<div>
|
||||
<label for="reason" class="block mb-1 text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
Reason for {% if is_edit %}Edit{% else %}Addition{% endif %}
|
||||
</label>
|
||||
<textarea name="reason"
|
||||
id="reason"
|
||||
class="w-full border-gray-300 rounded-lg form-textarea dark:border-gray-600 dark:bg-gray-700 dark:text-white"
|
||||
rows="3"
|
||||
required
|
||||
placeholder="Please explain why you're {% if is_edit %}editing{% else %}adding{% endif %} this manufacturer and provide any relevant details."></textarea>
|
||||
</div>
|
||||
<div>
|
||||
<label for="source" class="block mb-1 text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
Source (Optional)
|
||||
</label>
|
||||
<input type="text"
|
||||
name="source"
|
||||
id="source"
|
||||
class="w-full border-gray-300 rounded-lg form-input dark:border-gray-600 dark:bg-gray-700 dark:text-white"
|
||||
placeholder="Link to official website, news article, or other source">
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="flex justify-end space-x-4">
|
||||
<a href="{% if is_edit %}{% url 'companies:manufacturer_detail' slug=object.slug %}{% else %}{% url 'companies:manufacturer_list' %}{% endif %}"
|
||||
class="px-4 py-2 text-gray-700 bg-gray-200 rounded-lg hover:bg-gray-300 dark:bg-gray-600 dark:text-gray-200 dark:hover:bg-gray-500">
|
||||
Cancel
|
||||
</a>
|
||||
<button type="submit" class="px-4 py-2 text-white bg-blue-600 rounded-lg hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600">
|
||||
{% if is_edit %}Save Changes{% else %}Submit{% endif %}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user