106 lines
6.9 KiB
HTML
106 lines
6.9 KiB
HTML
{% extends "admin_base.html" %}
|
|
|
|
{% block title %}New Plant{% endblock %}
|
|
|
|
{% block admin_content %}
|
|
<div class="max-w-2xl mx-auto">
|
|
<h1 class="text-3xl font-bold mb-6 text-center">Add New Plant</h1>
|
|
<div class="bg-white shadow-lg rounded-xl p-8">
|
|
<form method="POST" enctype="multipart/form-data" class="space-y-6">
|
|
<div>
|
|
<label for="name" class="block text-sm font-semibold text-gray-700 mb-1">Name</label>
|
|
<input type="text" name="name" id="name" required
|
|
class="mt-1 block w-full rounded-lg border border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 px-3 py-2">
|
|
</div>
|
|
<div>
|
|
<label for="picture" class="block text-sm font-semibold text-gray-700 mb-1">Picture</label>
|
|
<input type="file" name="picture" id="picture"
|
|
class="mt-1 block w-full text-sm text-gray-700 border border-gray-300 rounded-lg px-3 py-2 bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
</div>
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div>
|
|
<label for="climate_id" class="block text-sm font-medium text-gray-700">Climate</label>
|
|
<select name="climate_id" id="climate_id" required
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
<option value="">Select a climate</option>
|
|
{% for climate in climates %}
|
|
<option value="{{ climate.id }}">{{ climate.name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="environment_id" class="block text-sm font-medium text-gray-700">Environment</label>
|
|
<select name="environment_id" id="environment_id" required
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
<option value="">Select an environment</option>
|
|
{% for environment in environments %}
|
|
<option value="{{ environment.id }}">{{ environment.name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="light_id" class="block text-sm font-medium text-gray-700">Light</label>
|
|
<select name="light_id" id="light_id" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
<option value="">Select light requirement</option>
|
|
{% for light in lights %}
|
|
<option value="{{ light.id }}">{{ light.name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="toxicity_id" class="block text-sm font-medium text-gray-700">Toxicity</label>
|
|
<select name="toxicity_id" id="toxicity_id" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
<option value="">Select toxicity level</option>
|
|
{% for toxicity in toxicities %}
|
|
<option value="{{ toxicity.id }}">{{ toxicity.name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="size_id" class="block text-sm font-medium text-gray-700">Size</label>
|
|
<select name="size_id" id="size_id" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
<option value="">Select size category</option>
|
|
{% for size in sizes %}
|
|
<option value="{{ size.id }}">{{ size.name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="care_difficulty_id" class="block text-sm font-medium text-gray-700">Care Difficulty</label>
|
|
<select name="care_difficulty_id" id="care_difficulty_id" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
<option value="">Select difficulty level</option>
|
|
{% for difficulty in difficulties %}
|
|
<option value="{{ difficulty.id }}">{{ difficulty.name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="growth_rate_id" class="block text-sm font-medium text-gray-700">Growth Rate</label>
|
|
<select name="growth_rate_id" id="growth_rate_id" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
<option value="">Select growth rate</option>
|
|
{% for rate in growth_rates %}
|
|
<option value="{{ rate.id }}">{{ rate.name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="md:col-span-2">
|
|
<label for="product_ids" class="block text-sm font-medium text-gray-700">Products</label>
|
|
<select name="product_ids" id="product_ids" multiple required
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
{% for product in products %}
|
|
<option value="{{ product.id }}">{{ product.name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
<p class="mt-1 text-sm text-gray-500">Hold Ctrl (or Cmd on Mac) to select multiple products</p>
|
|
</div>
|
|
<div class="md:col-span-2">
|
|
<label for="description" class="block text-sm font-medium text-gray-700">Description</label>
|
|
<textarea name="description" id="description" rows="6" required
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"></textarea>
|
|
</div>
|
|
<button type="submit" class="w-full btn-main text-lg font-semibold">Add Plant</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{% endblock %} |