Initial commit
This commit is contained in:
@@ -0,0 +1,137 @@
|
||||
@model List<PowderCoating.Application.DTOs.GiftCertificate.GiftCertificateListDto>
|
||||
@using PowderCoating.Core.Enums
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Gift Certificates";
|
||||
ViewData["PageIcon"] = "bi-gift";
|
||||
}
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<p class="text-muted mb-0">@ViewBag.TotalActive active certificates — @((ViewBag.TotalValue as decimal? ?? 0m).ToString("C")) outstanding value</p>
|
||||
<a asp-action="Create" class="btn btn-primary">
|
||||
<i class="bi bi-plus-circle me-2"></i>New Certificate
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Filters -->
|
||||
<div class="card border-0 shadow-sm mb-4">
|
||||
<div class="card-body py-3">
|
||||
<form method="get" class="row g-2 align-items-end">
|
||||
<div class="col-md-5">
|
||||
<input type="text" name="searchTerm" class="form-control" placeholder="Search code, recipient name or email..."
|
||||
value="@ViewBag.SearchTerm" />
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<select name="statusFilter" class="form-select">
|
||||
<option value="">All statuses</option>
|
||||
@foreach (var s in Enum.GetValues<GiftCertificateStatus>())
|
||||
{
|
||||
<option value="@s" selected="@(ViewBag.StatusFilter == s.ToString())">@s</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-auto">
|
||||
<button type="submit" class="btn btn-outline-primary">
|
||||
<i class="bi bi-search me-1"></i>Filter
|
||||
</button>
|
||||
<a asp-action="Index" class="btn btn-outline-secondary ms-1">Clear</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (!Model.Any())
|
||||
{
|
||||
<div class="text-center py-5 text-muted">
|
||||
<i class="bi bi-gift" style="font-size: 3rem;"></i>
|
||||
<p class="mt-3">No gift certificates found.</p>
|
||||
<a asp-action="Create" class="btn btn-primary mt-2">Create First Certificate</a>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="card border-0 shadow-sm">
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th class="ps-3">Certificate Code</th>
|
||||
<th>Recipient</th>
|
||||
<th>Reason</th>
|
||||
<th class="text-end">Face Value</th>
|
||||
<th class="text-end">Remaining</th>
|
||||
<th>Status</th>
|
||||
<th>Issued</th>
|
||||
<th>Expires</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var cert in Model)
|
||||
{
|
||||
<tr>
|
||||
<td class="ps-3">
|
||||
<a asp-action="Details" asp-route-id="@cert.Id" class="fw-semibold text-decoration-none font-monospace">
|
||||
@cert.CertificateCode
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
@if (!string.IsNullOrEmpty(cert.RecipientName))
|
||||
{
|
||||
<span>@cert.RecipientName</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="text-muted">—</span>
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(cert.RecipientEmail))
|
||||
{
|
||||
<div class="text-muted small">@cert.RecipientEmail</div>
|
||||
}
|
||||
</td>
|
||||
<td><span class="badge bg-secondary-subtle text-secondary">@cert.IssuedReason</span></td>
|
||||
<td class="text-end">@cert.OriginalAmount.ToString("C")</td>
|
||||
<td class="text-end fw-semibold @(cert.RemainingBalance > 0 ? "text-success" : "text-muted")">
|
||||
@cert.RemainingBalance.ToString("C")
|
||||
</td>
|
||||
<td>
|
||||
@{
|
||||
var (badgeClass, label) = cert.Status switch
|
||||
{
|
||||
GiftCertificateStatus.Active => ("bg-success", "Active"),
|
||||
GiftCertificateStatus.PartiallyRedeemed => ("bg-info text-dark", "Partial"),
|
||||
GiftCertificateStatus.FullyRedeemed => ("bg-secondary", "Used"),
|
||||
GiftCertificateStatus.Expired => ("bg-warning text-dark", "Expired"),
|
||||
GiftCertificateStatus.Voided => ("bg-danger", "Voided"),
|
||||
_ => ("bg-secondary", cert.Status.ToString())
|
||||
};
|
||||
}
|
||||
<span class="badge @badgeClass">@label</span>
|
||||
</td>
|
||||
<td class="small text-muted">@cert.IssueDate.Tz(ViewBag.CompanyTimeZone as string).ToString("MM/dd/yy")</td>
|
||||
<td class="small">
|
||||
@if (cert.ExpiryDate.HasValue)
|
||||
{
|
||||
<span class="@(cert.ExpiryDate.Value < DateTime.Now ? "text-danger" : "text-muted")">
|
||||
@cert.ExpiryDate.Value.ToString("MM/dd/yy")
|
||||
</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="text-muted">No expiry</span>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<a asp-action="Details" asp-route-id="@cert.Id" class="btn btn-sm btn-outline-primary">
|
||||
<i class="bi bi-eye"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
Reference in New Issue
Block a user