110 lines
4.3 KiB
Plaintext
110 lines
4.3 KiB
Plaintext
@using HrynCo.NotificationService.DAL.Abstract.Templates
|
|
@model IReadOnlyList<EmailTemplate>
|
|
@{
|
|
ViewData["Title"] = "Email Templates";
|
|
var serviceNameFilter = ViewData["ServiceNameFilter"] as string ?? string.Empty;
|
|
var keyFilter = ViewData["KeyFilter"] as string ?? string.Empty;
|
|
}
|
|
|
|
<div class="page-header">
|
|
<h2><i class="bi bi-envelope-paper"></i> Email Templates</h2>
|
|
<a href="/admin/templates/create" class="btn btn-primary btn-sm">
|
|
<i class="bi bi-plus-lg me-1"></i> Create New Template
|
|
</a>
|
|
</div>
|
|
|
|
<div class="card shadow-sm mb-3">
|
|
<div class="card-body">
|
|
<form method="get" action="/admin/templates" class="row g-2 align-items-end">
|
|
<div class="col-12 col-md-5">
|
|
<label class="form-label fw-semibold" for="serviceName">Service Name</label>
|
|
<input id="serviceName"
|
|
name="serviceName"
|
|
value="@serviceNameFilter"
|
|
class="form-control"
|
|
placeholder="Filter by service name" />
|
|
</div>
|
|
<div class="col-12 col-md-5">
|
|
<label class="form-label fw-semibold" for="key">Key</label>
|
|
<input id="key"
|
|
name="key"
|
|
value="@keyFilter"
|
|
class="form-control"
|
|
placeholder="Filter by key" />
|
|
</div>
|
|
<div class="col-12 col-md-2 d-flex gap-2">
|
|
<button type="submit" class="btn btn-primary w-100">Filter</button>
|
|
<a href="/admin/templates" class="btn btn-outline-secondary w-100">Clear</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
@if (!ViewData.ModelState.IsValid)
|
|
{
|
|
<div class="alert alert-danger">
|
|
@foreach (var error in ViewData.ModelState.Values.SelectMany(v => v.Errors))
|
|
{
|
|
<div>@error.ErrorMessage</div>
|
|
}
|
|
</div>
|
|
}
|
|
|
|
@if (Model is null || Model.Count == 0)
|
|
{
|
|
<div class="card shadow-sm table-card">
|
|
<div class="empty-state">
|
|
<i class="bi bi-envelope-paper"></i>
|
|
<p class="mt-2 mb-0">No email templates found.</p>
|
|
<a href="/admin/templates/create" class="btn btn-primary btn-sm mt-3">
|
|
<i class="bi bi-plus-lg me-1"></i> Create First Template
|
|
</a>
|
|
</div>
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<div class="card shadow-sm table-card">
|
|
<div class="table-responsive">
|
|
<table class="table table-hover table-sm mb-0">
|
|
<thead class="table-dark">
|
|
<tr>
|
|
<th>Service Name</th>
|
|
<th>Key</th>
|
|
<th>Language</th>
|
|
<th>Subject</th>
|
|
<th class="text-end">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var t in Model)
|
|
{
|
|
<tr>
|
|
<td>@t.ServiceName</td>
|
|
<td>@t.Key</td>
|
|
<td>@t.LanguageCode</td>
|
|
<td>@t.Subject</td>
|
|
<td class="text-end">
|
|
<a href="/admin/templates/@t.ServiceName/@t.Key/@t.LanguageCode"
|
|
class="btn btn-sm btn-outline-primary me-1">
|
|
<i class="bi bi-pencil"></i> Edit
|
|
</a>
|
|
<form method="post"
|
|
action="/admin/templates/@t.ServiceName/@t.Key/@t.LanguageCode/delete"
|
|
class="d-inline">
|
|
@Html.AntiForgeryToken()
|
|
<button type="submit"
|
|
class="btn btn-sm btn-outline-danger"
|
|
onclick="return confirm('Delete this template?')">
|
|
<i class="bi bi-trash"></i> Delete
|
|
</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
}
|