Saved your changes before starting work

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 5e584ab0-c340-4432-97ef-1972582b60e9
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: 6d4dbe7c-69e4-4510-bd62-638ff9c78d5c
This commit is contained in:
abhiramtx
2025-11-08 22:13:45 +00:00
parent c8cb73cd14
commit befc3160be
64 changed files with 2588 additions and 1707 deletions

View File

@@ -0,0 +1,259 @@
{% extends "admin/base.html" %}
{% block title %}Members & Mentors Management{% endblock %}
{% block extra_styles %}
<style>
.section {
margin-bottom: 48px;
}
.section-title {
font-family: var(--font-display);
font-size: 28px;
color: var(--white);
margin-bottom: 24px;
}
.add-form {
background: #1a1a1a;
border: 1px solid #333;
border-radius: 16px;
padding: 24px;
margin-bottom: 32px;
}
.form-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px;
margin-bottom: 16px;
}
.form-group {
margin-bottom: 16px;
}
.form-label {
display: block;
color: var(--gray-300);
margin-bottom: 6px;
font-family: var(--font-body);
font-size: 14px;
}
.form-input, .form-select {
width: 100%;
padding: 10px 12px;
background: #0d0d0d;
border: 1px solid #333;
border-radius: 8px;
color: #fff;
font-size: 14px;
}
.form-input:focus, .form-select:focus {
outline: none;
border-color: #3b82f6;
}
.members-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 24px;
}
.member-card-admin {
background: #1a1a1a;
border: 1px solid #333;
border-radius: 16px;
padding: 20px;
}
.member-image-admin {
width: 100%;
height: 200px;
object-fit: cover;
border-radius: 12px;
margin-bottom: 16px;
}
.member-name-admin {
font-family: var(--font-display);
font-size: 20px;
color: var(--white);
margin-bottom: 8px;
}
.member-role-admin {
color: var(--gray-400);
font-family: var(--font-body);
font-size: 14px;
margin-bottom: 16px;
}
.btn {
padding: 10px 20px;
border-radius: 8px;
border: none;
font-family: var(--font-body);
font-size: 14px;
cursor: pointer;
transition: all 0.2s ease;
margin-right: 8px;
}
.btn-primary {
background: var(--blue);
color: var(--white);
}
.btn-primary:hover {
background: var(--blue-light);
transform: translateY(-2px);
}
.btn-danger {
background: rgba(239, 68, 68, 0.2);
color: #ef4444;
}
.btn-danger:hover {
background: rgba(239, 68, 68, 0.3);
}
.btn-edit {
background: rgba(59, 130, 246, 0.2);
color: var(--blue);
}
.btn-edit:hover {
background: rgba(59, 130, 246, 0.3);
}
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
z-index: 1000;
align-items: center;
justify-content: center;
}
.modal.active {
display: flex;
}
.modal-content {
background: #1a1a1a;
border: 1px solid #333;
border-radius: 16px;
padding: 32px;
max-width: 500px;
width: 90%;
}
.modal-close {
float: right;
font-size: 28px;
cursor: pointer;
color: var(--gray-400);
}
.modal-close:hover {
color: var(--white);
}
</style>
{% endblock %}
{% block content %}
<h1 class="admin-header">Members & Mentors Management</h1>
<div class="section">
<h2 class="section-title">Add New Member/Mentor</h2>
<div class="add-form">
<form method="POST" action="{{ url_for('add_member') }}" enctype="multipart/form-data">
<div class="form-row">
<div class="form-group">
<label class="form-label">Name</label>
<input type="text" name="name" class="form-input" required>
</div>
<div class="form-group">
<label class="form-label">Role</label>
<input type="text" name="role" class="form-input" placeholder="e.g., SOFTWARE, HARDWARE" required>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label class="form-label">Type</label>
<select name="type" class="form-select" required>
<option value="member">Team Member</option>
<option value="mentor">Mentor</option>
</select>
</div>
<div class="form-group">
<label class="form-label">Profile Image</label>
<input type="file" name="image" class="form-input" accept="image/*">
</div>
</div>
<button type="submit" class="btn btn-primary">Add</button>
</form>
</div>
</div>
<div class="section">
<h2 class="section-title">Mentors</h2>
<div class="members-grid">
{% for mentor in mentors %}
<div class="member-card-admin">
<img src="{{ url_for('static', filename=mentor.image_path) }}" class="member-image-admin" alt="{{ mentor.name }}">
<h3 class="member-name-admin">{{ mentor.name }}</h3>
<p class="member-role-admin">{{ mentor.role }}</p>
<button onclick="openEditModal('mentor', {{ mentor.id }}, '{{ mentor.name }}', '{{ mentor.role }}')" class="btn btn-edit">Edit</button>
<form method="POST" action="{{ url_for('delete_member') }}" style="display: inline;">
<input type="hidden" name="id" value="{{ mentor.id }}">
<input type="hidden" name="type" value="mentor">
<button type="submit" class="btn btn-danger" onclick="return confirm('Are you sure?')">Delete</button>
</form>
</div>
{% endfor %}
</div>
</div>
<div class="section">
<h2 class="section-title">Team Members</h2>
<div class="members-grid">
{% for member in members %}
<div class="member-card-admin">
<img src="{{ url_for('static', filename=member.image_path) }}" class="member-image-admin" alt="{{ member.name }}">
<h3 class="member-name-admin">{{ member.name }}</h3>
<p class="member-role-admin">{{ member.role }}</p>
<button onclick="openEditModal('member', {{ member.id }}, '{{ member.name }}', '{{ member.role }}')" class="btn btn-edit">Edit</button>
<form method="POST" action="{{ url_for('delete_member') }}" style="display: inline;">
<input type="hidden" name="id" value="{{ member.id }}">
<input type="hidden" name="type" value="member">
<button type="submit" class="btn btn-danger" onclick="return confirm('Are you sure?')">Delete</button>
</form>
</div>
{% endfor %}
</div>
</div>
<div id="editModal" class="modal">
<div class="modal-content">
<span class="modal-close" onclick="closeEditModal()">&times;</span>
<h2 class="section-title">Edit Member</h2>
<form method="POST" action="{{ url_for('update_member') }}" enctype="multipart/form-data">
<input type="hidden" name="id" id="edit-id">
<input type="hidden" name="type" id="edit-type">
<div class="form-group">
<label class="form-label">Name</label>
<input type="text" name="name" id="edit-name" class="form-input" required>
</div>
<div class="form-group">
<label class="form-label">Role</label>
<input type="text" name="role" id="edit-role" class="form-input" required>
</div>
<div class="form-group">
<label class="form-label">Profile Image (optional)</label>
<input type="file" name="image" class="form-input" accept="image/*">
</div>
<button type="submit" class="btn btn-primary">Update</button>
</form>
</div>
</div>
<script>
function openEditModal(type, id, name, role) {
document.getElementById('edit-id').value = id;
document.getElementById('edit-type').value = type;
document.getElementById('edit-name').value = name;
document.getElementById('edit-role').value = role;
document.getElementById('editModal').classList.add('active');
}
function closeEditModal() {
document.getElementById('editModal').classList.remove('active');
}
</script>
{% endblock %}