429 lines
11 KiB
HTML
429 lines
11 KiB
HTML
<!-- templates/base.html (final version - completely fixed) -->
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>{% block title %}Health History Tracker{% endblock %}</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
|
<style>
|
|
:root {
|
|
--primary: #4361ee;
|
|
--secondary: #3a0ca3;
|
|
--accent: #f72585;
|
|
--light: #f8f9fa;
|
|
--dark: #212529;
|
|
--success: #4cc9f0;
|
|
--warning: #f72585;
|
|
--gray: #6c757d;
|
|
--light-gray: #e9ecef;
|
|
}
|
|
|
|
body {
|
|
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
|
min-height: 100vh;
|
|
padding: 20px;
|
|
color: var(--dark);
|
|
}
|
|
|
|
.header {
|
|
background: linear-gradient(to right, var(--primary), var(--secondary));
|
|
color: white;
|
|
padding: 20px;
|
|
border-radius: 10px;
|
|
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
|
|
margin-bottom: 30px;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
.logo {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 15px;
|
|
}
|
|
|
|
.logo i {
|
|
font-size: 2.5rem;
|
|
}
|
|
|
|
.logo h1 {
|
|
font-size: 2.2rem;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.user-section {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 15px;
|
|
}
|
|
|
|
.user-info {
|
|
text-align: right;
|
|
}
|
|
|
|
.user-info h3 {
|
|
font-size: 1.2rem;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
.user-info p {
|
|
font-size: 0.9rem;
|
|
opacity: 0.9;
|
|
}
|
|
|
|
.btn-primary {
|
|
background: var(--primary);
|
|
border: none;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
background: var(--secondary);
|
|
}
|
|
|
|
.sidebar {
|
|
background: white;
|
|
border-radius: 10px;
|
|
padding: 25px;
|
|
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
|
|
height: fit-content;
|
|
margin-bottom: 25px;
|
|
}
|
|
|
|
.sidebar h2 {
|
|
margin-bottom: 20px;
|
|
color: var(--secondary);
|
|
padding-bottom: 10px;
|
|
border-bottom: 2px solid var(--light-gray);
|
|
}
|
|
|
|
.nav-links {
|
|
list-style: none;
|
|
}
|
|
|
|
.nav-links li {
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.nav-links a {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
text-decoration: none;
|
|
color: var(--dark);
|
|
padding: 12px 15px;
|
|
border-radius: 8px;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.nav-links a:hover, .nav-links a.active {
|
|
background: var(--light-gray);
|
|
color: var(--primary);
|
|
}
|
|
|
|
.main-content {
|
|
background: white;
|
|
border-radius: 10px;
|
|
padding: 25px;
|
|
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
|
|
}
|
|
|
|
.content-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 25px;
|
|
padding-bottom: 15px;
|
|
border-bottom: 2px solid var(--light-gray);
|
|
}
|
|
|
|
.content-header h2 {
|
|
color: var(--secondary);
|
|
}
|
|
|
|
.stats-container {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 20px;
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
.stat-card {
|
|
background: var(--light);
|
|
border-radius: 10px;
|
|
padding: 20px;
|
|
text-align: center;
|
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
|
|
transition: transform 0.3s ease;
|
|
}
|
|
|
|
.stat-card:hover {
|
|
transform: translateY(-5px);
|
|
}
|
|
|
|
.stat-card i {
|
|
font-size: 2.5rem;
|
|
margin-bottom: 15px;
|
|
color: var(--primary);
|
|
}
|
|
|
|
.stat-card h3 {
|
|
font-size: 2rem;
|
|
margin-bottom: 5px;
|
|
color: var(--secondary);
|
|
}
|
|
|
|
.stat-card p {
|
|
color: var(--gray);
|
|
font-size: 0.9rem;
|
|
}
|
|
|
|
.record-form {
|
|
background: var(--light);
|
|
border-radius: 10px;
|
|
padding: 25px;
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
.form-title {
|
|
margin-bottom: 20px;
|
|
color: var(--secondary);
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
}
|
|
|
|
.form-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
|
gap: 20px;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.form-group label {
|
|
display: block;
|
|
margin-bottom: 8px;
|
|
font-weight: 600;
|
|
color: var(--dark);
|
|
}
|
|
|
|
.form-group input,
|
|
.form-group textarea,
|
|
.form-group select {
|
|
width: 100%;
|
|
padding: 12px 15px;
|
|
border: 1px solid var(--light-gray);
|
|
border-radius: 8px;
|
|
font-size: 1rem;
|
|
transition: border-color 0.3s ease;
|
|
}
|
|
|
|
.form-group input:focus,
|
|
.form-group textarea:focus,
|
|
.form-group select:focus {
|
|
outline: none;
|
|
border-color: var(--primary);
|
|
box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
|
|
}
|
|
|
|
.records-container {
|
|
margin-top: 30px;
|
|
}
|
|
|
|
.records-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.records-list {
|
|
list-style: none;
|
|
}
|
|
|
|
.record-item {
|
|
background: white;
|
|
border-radius: 10px;
|
|
padding: 20px;
|
|
margin-bottom: 15px;
|
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
|
|
border-left: 5px solid var(--primary);
|
|
transition: transform 0.3s ease;
|
|
}
|
|
|
|
.record-item:hover {
|
|
transform: translateX(5px);
|
|
}
|
|
|
|
.record-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.record-title {
|
|
font-size: 1.3rem;
|
|
color: var(--secondary);
|
|
}
|
|
|
|
.record-date {
|
|
background: var(--light-gray);
|
|
padding: 5px 12px;
|
|
border-radius: 20px;
|
|
font-size: 0.85rem;
|
|
}
|
|
|
|
.record-details {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 15px;
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.detail-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
}
|
|
|
|
.detail-item i {
|
|
color: var(--primary);
|
|
width: 24px;
|
|
}
|
|
|
|
.record-description {
|
|
line-height: 1.6;
|
|
color: var(--gray);
|
|
}
|
|
|
|
.actions {
|
|
display: flex;
|
|
gap: 10px;
|
|
margin-top: 15px;
|
|
}
|
|
|
|
.actions button {
|
|
padding: 8px 15px;
|
|
border-radius: 5px;
|
|
border: none;
|
|
cursor: pointer;
|
|
font-weight: 600;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 5px;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.edit-btn {
|
|
background: var(--light-gray);
|
|
color: var(--dark);
|
|
}
|
|
|
|
.delete-btn {
|
|
background: #ffebee;
|
|
color: var(--warning);
|
|
}
|
|
|
|
.empty-state {
|
|
text-align: center;
|
|
padding: 40px 20px;
|
|
color: var(--gray);
|
|
}
|
|
|
|
.empty-state i {
|
|
font-size: 4rem;
|
|
margin-bottom: 20px;
|
|
color: var(--light-gray);
|
|
}
|
|
|
|
.empty-state h3 {
|
|
margin-bottom: 15px;
|
|
color: var(--dark);
|
|
}
|
|
|
|
.alert {
|
|
border-radius: 8px;
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
footer {
|
|
text-align: center;
|
|
padding: 20px;
|
|
color: var(--gray);
|
|
font-size: 0.9rem;
|
|
margin-top: 30px;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.header {
|
|
flex-direction: column;
|
|
gap: 20px;
|
|
text-align: center;
|
|
}
|
|
|
|
.user-section {
|
|
justify-content: center;
|
|
}
|
|
|
|
.content-header {
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
gap: 15px;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<header class="header">
|
|
<div class="logo">
|
|
<i class="fas fa-heartbeat"></i>
|
|
<h1>Health History Tracker</h1>
|
|
</div>
|
|
{% if session.user_id %}
|
|
<div class="user-section">
|
|
<div class="user-info">
|
|
<h3>{{ session.username }}</h3>
|
|
<p>Member since {{ user.created_at.strftime('%b %Y') if user and user.created_at else '' }}</p>
|
|
</div>
|
|
<a href="{{ url_for('logout') }}" class="btn btn-outline-light">Logout</a>
|
|
</div>
|
|
{% endif %}
|
|
</header>
|
|
|
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
|
{% if messages %}
|
|
{% for category, message in messages %}
|
|
<div class="alert alert-{{ 'danger' if category == 'error' else category }} alert-dismissible fade show" role="alert">
|
|
{{ message }}
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
|
</div>
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endwith %}
|
|
|
|
{% block content %}{% endblock %}
|
|
|
|
<footer>
|
|
<p>Health History Tracker © 2023 | All your health records in one place</p>
|
|
</footer>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script>
|
|
// Set today's date as default for diagnosis date
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const today = new Date().toISOString().split('T')[0];
|
|
document.getElementById('diagnosis-date').value = today;
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|