TiledViz
Loading...
Searching...
No Matches
my_projects.html
1{% extends "base_main_template.html" %}
2
3{% block additional_scripts_css %}
4<style>
5.card {
6 background-color: #ffffff !important;
7 color: #333333 !important;
8 border: 2px solid #e9ecef;
9 box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
10}
11
12.card-header {
13 border-bottom: 2px solid #e9ecef;
14}
15
16.table {
17 background-color: #ffffff !important;
18 color: #333333 !important;
19}
20
21.table th {
22 background-color: #f8f9fa !important;
23 color: #495057 !important;
24 border-color: #dee2e6 !important;
25}
26
27.table td {
28 border-color: #dee2e6 !important;
29 color: #333333 !important;
30}
31
32.form-control, .form-select {
33 background-color: #ffffff !important;
34 color: #333333 !important;
35 border: 2px solid #ced4da !important;
36}
37
38.form-control:focus, .form-select:focus {
39 border-color: #80bdff !important;
40 box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
41}
42
43.btn {
44 font-weight: 600;
45 text-shadow: none;
46}
47
48.alert {
49 border: 2px solid #e9ecef;
50 background-color: #ffffff !important;
51 color: #333333 !important;
52}
53
54h1, h2, h3, h4, h5, h6, p, label {
55 color: #333333 !important;
56}
57
58.badge {
59 font-size: 0.9em;
60 padding: 0.5em 0.8em;
61}
62</style>
63{% endblock %}
64
65{% block content %}
66
67<div class="container mt-4">
68 <div class="row">
69 <div class="col-12">
70 <div class="card">
71 <div class="card-header bg-primary text-white">
72 <h3 class="mb-0">
73 <i class="fas fa-folder-open me-2"></i>
74 My Projects
75 </h3>
76 </div>
77 <div class="card-body">
78 <!-- Project Selection Section -->
79 {% if projects_by_role.owned or projects_by_role.admin%}
80 <div class="card mb-4">
81 <div class="card-header bg-primary text-white">
82 <h5 class="mb-0">
83 <i class="fas fa-crown me-2"></i>
84 Manage Project Members
85 </h5>
86 </div>
87 <div class="card-body">
88 <form method="GET" action="#" id="projectSelectForm">
89 <div class="row">
90 <div class="col-md-8">
91 <label for="project_select" class="form-label text-dark">Select a project to manage members:</label>
92 <select class="form-select" id="project_select" name="project_id" onchange="redirectToProject()">
93 <option value="">Choose a project...</option>
94 {% for project_info in projects_by_role.owned %}
95 <option value="{{ project_info.project.id }}" data-url="{{ url_for('project_members', project_id=project_info.project.id) }}">
96 {{ project_info.project.name }} (Owner)
97 </option>
98 {% endfor %}
99 {% for project_info in projects_by_role.admin %}
100 <option value="{{ project_info.project.id }}" data-url="{{ url_for('project_members', project_id=project_info.project.id) }}">
101 {{ project_info.project.name }} (Admin)
102 </option>
103 {% endfor %}
104 </select>
105 </div>
106 <div class="col-md-4">
107 <label class="form-label">&nbsp;</label>
108 <button type="button" class="btn btn-primary w-100" onclick="goToSelectedProject()" disabled id="manageBtn">
109 <i class="fas fa-users me-2"></i>Manage Members
110 </button>
111 </div>
112 </div>
113 </form>
114 </div>
115 </div>
116 {% endif %}
117
118 <!-- Admin Projects Section -->
119 {% if projects_by_role.admin %}
120 <div class="card mb-4">
121 <div class="card-header bg-warning text-dark">
122 <h5 class="mb-0">
123 <i class="fas fa-user-shield me-2"></i>
124 Projects I Admin ({{ projects_by_role.admin|length }})
125 </h5>
126 </div>
127 <div class="card-body">
128 <div class="table-responsive">
129 <table class="table table-striped">
130 <thead class="table-dark">
131 <tr>
132 <th>Project Name</th>
133 <th>Description</th>
134 <th>Created</th>
135 <th>Role</th>
136 <th>Actions</th>
137 </tr>
138 </thead>
139 <tbody>
140 {% for project_info in projects_by_role.admin %}
141 <tr>
142 <td><strong>{{ project_info.project.name }}</strong></td>
143 <td>{{ project_info.project.description or 'No description' }}</td>
144 <td>{{ project_info.project.creation_date.strftime('%Y-%m-%d %H:%M:%S') if project_info.project.creation_date else 'Unknown' }}</td>
145 <td>
146 <span class="badge bg-warning text-dark">Admin</span>
147 </td>
148 <td>
149 <div class="btn-group" role="group">
150 <a href="{{ url_for('project_members', project_id=project_info.project.id) }}" class="btn btn-sm btn-primary">
151 <i class="fas fa-users me-1"></i>Manage Members
152 </a>
153 <a href="{{ url_for('project') }}" class="btn btn-sm btn-info">
154 <i class="fas fa-cog me-1"></i>Settings
155 </a>
156 </div>
157 </td>
158 </tr>
159 {% endfor %}
160 </tbody>
161 </table>
162 </div>
163 </div>
164 </div>
165 {% endif %}
166
167 <!-- Member Projects Section -->
168 {% if projects_by_role.member %}
169 <div class="card mb-4">
170 <div class="card-header bg-info text-white">
171 <h5 class="mb-0">
172 <i class="fas fa-user me-2"></i>
173 Projects I'm Member Of ({{ projects_by_role.member|length }})
174 </h5>
175 </div>
176 <div class="card-body">
177 <div class="table-responsive">
178 <table class="table table-striped">
179 <thead class="table-dark">
180 <tr>
181 <th>Project Name</th>
182 <th>Description</th>
183 <th>Created</th>
184 <th>Role</th>
185 <th>Actions</th>
186 </tr>
187 </thead>
188 <tbody>
189 {% for project_info in projects_by_role.member %}
190 <tr>
191 <td><strong>{{ project_info.project.name }}</strong></td>
192 <td>{{ project_info.project.description or 'No description' }}</td>
193 <td>{{ project_info.project.creation_date.strftime('%Y-%m-%d %H:%M:%S') if project_info.project.creation_date else 'Unknown' }}</td>
194 <td>
195 {% if project_info.role == 'editor' %}
196 <span class="badge bg-primary">Editor</span>
197 {% elif project_info.role == 'viewer' %}
198 <span class="badge bg-info">Viewer</span>
199 {% elif project_info.role == 'guest' %}
200 <span class="badge bg-secondary">Guest</span>
201 {% else %}
202 <span class="badge bg-secondary">{{ project_info.role }}</span>
203 {% endif %}
204 </td>
205 <td>
206 <a href="{{ url_for('project') }}" class="btn btn-sm btn-outline-info">
207 <i class="fas fa-eye me-1"></i>View
208 </a>
209 </td>
210 </tr>
211 {% endfor %}
212 </tbody>
213 </table>
214 </div>
215 </div>
216 </div>
217 {% endif %}
218
219 <!-- No Projects Message -->
220 {% if not projects_by_role.owned and not projects_by_role.admin and not projects_by_role.member %}
221 <div class="alert alert-info">
222 <i class="fas fa-info-circle me-2"></i>
223 You don't have any projects yet.
224 <a href="{{ url_for('project') }}" class="alert-link">Create your first project</a> or ask an administrator to add you to an existing project.
225 </div>
226 {% endif %}
227
228 <!-- Action Buttons -->
229 <div class="mt-4">
230 <a href="{{ url_for('project') }}" class="btn btn-primary">
231 <i class="fas fa-plus me-2"></i>Create New Project
232 </a>
233 </div>
234 </div>
235 </div>
236 </div>
237 </div>
238</div>
239
240<script>
241 function redirectToProject() {
242 const select = document.getElementById('project_select');
243 const manageBtn = document.getElementById('manageBtn');
244
245 if (select.value) {
246 manageBtn.disabled = false;
247 } else {
248 manageBtn.disabled = true;
249 }
250 }
251
252 function goToSelectedProject() {
253 const select = document.getElementById('project_select');
254 const selectedOption = select.options[select.selectedIndex];
255
256 if (selectedOption && selectedOption.dataset.url) {
257 window.location.href = selectedOption.dataset.url;
258 }
259 }
260
261 // Initialize button state
262 document.addEventListener('DOMContentLoaded', function() {
263 redirectToProject();
264 });
265 </script>
266{% endblock %}