first
This commit is contained in:
78
views/emails.ejs
Normal file
78
views/emails.ejs
Normal file
@@ -0,0 +1,78 @@
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1 class="h3">Emails reçus</h1>
|
||||
|
||||
<div class="btn-group">
|
||||
<a href="/emails" class="btn btn-outline-primary <%= !filter ? 'active' : '' %>">Tous</a>
|
||||
<a href="/emails?read=false" class="btn btn-outline-primary <%= filter === 'false' ? 'active' : '' %>">Non lus</a>
|
||||
<a href="/emails?read=true" class="btn btn-outline-primary <%= filter === 'true' ? 'active' : '' %>">Lus</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card shadow">
|
||||
<div class="card-body">
|
||||
<% if(emails && emails.length > 0) { %>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Date</th>
|
||||
<th scope="col">De</th>
|
||||
<th scope="col">Sujet</th>
|
||||
<th scope="col">Statut</th>
|
||||
<th scope="col">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% emails.forEach(email => { %>
|
||||
<tr class="<%= !email.read ? 'table-warning' : '' %>">
|
||||
<td>
|
||||
<span class="timestamp" data-timestamp="<%= email.receivedAt %>">
|
||||
<%= new Date(email.receivedAt).toLocaleString() %>
|
||||
</span>
|
||||
</td>
|
||||
<td><%= email.from %></td>
|
||||
<td><%= email.subject %></td>
|
||||
<td>
|
||||
<% if(email.read) { %>
|
||||
<span class="badge bg-success">Lu</span>
|
||||
<% } else { %>
|
||||
<span class="badge bg-warning">Non lu</span>
|
||||
<% } %>
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<a href="/emails/<%= email.id %>" class="btn btn-sm btn-info">
|
||||
<i class="fas fa-eye"></i>
|
||||
</a>
|
||||
<form action="/emails/<%= email.id %>?_method=DELETE" method="POST" onsubmit="return confirm('Êtes-vous sûr de vouloir supprimer cet email?');" class="d-inline">
|
||||
<button type="submit" class="btn btn-sm btn-danger">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% }); %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<% } else { %>
|
||||
<div class="text-center py-5">
|
||||
<i class="fas fa-inbox fa-4x text-muted mb-3"></i>
|
||||
<h5>Aucun email trouvé</h5>
|
||||
<p class="text-muted">
|
||||
<% if (filter === 'true') { %>
|
||||
Il n'y a pas d'emails lus.
|
||||
<% } else if (filter === 'false') { %>
|
||||
Il n'y a pas d'emails non lus.
|
||||
<% } else { %>
|
||||
Les emails reçus apparaîtront ici.
|
||||
<% } %>
|
||||
</p>
|
||||
</div>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user