Initial commit with project setup
This commit is contained in:
161
templates/base.html
Normal file
161
templates/base.html
Normal file
@@ -0,0 +1,161 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}{% endblock %} - Verpot Je Lot</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@500;700&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='styles/planty.css') }}">
|
||||
</head>
|
||||
<body class="min-h-screen bg-gradient-to-br from-[#e6ebe0] via-[#b7c7a3] to-[#6b8f71] bg-fixed">
|
||||
<nav class="bg-[#f5f7f2]/95 shadow-lg backdrop-blur-md" id="main-navbar">
|
||||
<div class="container mx-auto px-4">
|
||||
<div class="flex justify-between">
|
||||
<div class="flex space-x-7">
|
||||
<div>
|
||||
<a href="{{ url_for('home') }}" class="flex items-center py-4">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-7 h-7 text-[#6b8f71] mr-2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M12 2C7 2 2 7 2 12c0 5 5 10 10 10s10-5 10-10c0-5-5-10-10-10zm0 0c0 4 4 8 8 8" />
|
||||
</svg>
|
||||
<span class="font-bold text-[#3e5637] text-xl tracking-tight">Verpot Je Lot</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center space-x-3">
|
||||
<!-- Admin links moved to footer -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="container mx-auto px-4 py-8">
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
{% for category, message in messages %}
|
||||
<div class="mb-4 p-4 rounded-lg {% if category == 'success' %}bg-green-100 text-green-700{% else %}bg-red-100 text-red-700{% endif %} shadow">
|
||||
{{ message }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
|
||||
{% if request.endpoint == 'home' %}
|
||||
<footer class="bg-[#f5f7f2]/95 text-[#3e5637] text-sm py-2 px-4 flex justify-between items-center shadow-t z-40 mt-8">
|
||||
<span>Made by Kobe Amerijckx and Roos Amerijckx</span>
|
||||
{% if is_logged_in %}
|
||||
<a href="{{ url_for('manage_environments') }}" class="py-1 px-3 bg-[#6b8f71] hover:bg-[#4e6b50] text-white rounded-lg transition duration-200 shadow">Admin Panel</a>
|
||||
<a href="{{ url_for('logout') }}" class="py-1 px-3 bg-[#e6ebe0] hover:bg-[#b7c7a3] text-[#3e5637] rounded-lg transition duration-200 ml-2">Logout</a>
|
||||
{% else %}
|
||||
<a href="{{ url_for('login') }}" class="py-1 px-3 bg-[#6b8f71] hover:bg-[#4e6b50] text-white rounded-lg transition duration-200 shadow">Admin Login</a>
|
||||
{% endif %}
|
||||
</footer>
|
||||
{% endif %}
|
||||
|
||||
<!-- Delete Confirmation Modal -->
|
||||
<div id="delete-modal" class="fixed inset-0 bg-black bg-opacity-50 hidden items-center justify-center z-50">
|
||||
<div class="bg-white rounded-lg p-6 max-w-md w-full mx-4 transform transition-all">
|
||||
<div class="text-center mb-6">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-16 w-16 text-red-500 mx-auto mb-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
|
||||
</svg>
|
||||
<h3 class="text-xl font-bold text-gray-900 mb-2">Confirm Deletion</h3>
|
||||
<p class="text-gray-600" id="delete-modal-message">Are you sure you want to delete this item?</p>
|
||||
</div>
|
||||
<div class="flex justify-end space-x-3">
|
||||
<button onclick="closeDeleteModal()" class="px-4 py-2 bg-gray-200 text-gray-800 rounded-lg hover:bg-gray-300 transition duration-200">
|
||||
Cancel
|
||||
</button>
|
||||
<form id="delete-form" method="POST" class="inline">
|
||||
<button type="submit" class="px-4 py-2 bg-red-500 text-white rounded-lg hover:bg-red-600 transition duration-200">
|
||||
Delete
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function showDeleteModal(formId, message) {
|
||||
const modal = document.getElementById('delete-modal');
|
||||
const form = document.getElementById(formId);
|
||||
const modalForm = document.getElementById('delete-form');
|
||||
const messageEl = document.getElementById('delete-modal-message');
|
||||
|
||||
// Set the message
|
||||
messageEl.textContent = message || 'Are you sure you want to delete this item?';
|
||||
|
||||
// Set the form action
|
||||
modalForm.action = form.action;
|
||||
|
||||
// Show the modal
|
||||
modal.classList.remove('hidden');
|
||||
modal.classList.add('flex');
|
||||
|
||||
// Add animation
|
||||
const modalContent = modal.querySelector('.bg-white');
|
||||
modalContent.classList.add('scale-95', 'opacity-0');
|
||||
requestAnimationFrame(() => {
|
||||
modalContent.classList.remove('scale-95', 'opacity-0');
|
||||
});
|
||||
}
|
||||
|
||||
function closeDeleteModal() {
|
||||
const modal = document.getElementById('delete-modal');
|
||||
const modalContent = modal.querySelector('.bg-white');
|
||||
|
||||
// Add animation
|
||||
modalContent.classList.add('scale-95', 'opacity-0');
|
||||
|
||||
// Hide after animation
|
||||
setTimeout(() => {
|
||||
modal.classList.remove('flex');
|
||||
modal.classList.add('hidden');
|
||||
modalContent.classList.remove('scale-95', 'opacity-0');
|
||||
}, 200);
|
||||
}
|
||||
|
||||
// Close modal when clicking outside
|
||||
document.getElementById('delete-modal').addEventListener('click', function(e) {
|
||||
if (e.target === this) {
|
||||
closeDeleteModal();
|
||||
}
|
||||
});
|
||||
|
||||
// Animate plant cards on scroll
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const cards = document.querySelectorAll('.plant-card');
|
||||
if ('IntersectionObserver' in window) {
|
||||
const observer = new IntersectionObserver((entries, obs) => {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting) {
|
||||
entry.target.classList.remove('opacity-0', 'translate-y-8');
|
||||
entry.target.classList.add('opacity-100', 'translate-y-0');
|
||||
obs.unobserve(entry.target);
|
||||
}
|
||||
});
|
||||
}, { threshold: 0.15 });
|
||||
cards.forEach(card => observer.observe(card));
|
||||
} else {
|
||||
// Fallback: show all
|
||||
cards.forEach(card => card.classList.remove('opacity-0', 'translate-y-8'));
|
||||
}
|
||||
|
||||
// Localize all .local-date elements
|
||||
document.querySelectorAll('.local-date').forEach(function(el) {
|
||||
const date = new Date(el.dataset.date);
|
||||
el.textContent = date.toLocaleDateString(undefined, { day: '2-digit', month: '2-digit', year: 'numeric' }) +
|
||||
' ' + date.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' });
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
.plant-card {
|
||||
will-change: opacity, transform;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user