Files
PowderCoatingLogix/src/PowderCoating.Web/Views/FixedAssets/Index.cshtml
T
spouliot f467862877 Add mobile card views to 12 high-priority list pages
Pages were blank on phones because mobile-cards.css hides .table-responsive
below 992px. Added .mobile-card-view sections to: GiftCertificates, PurchaseOrders,
CreditMemos, VendorCredits, JournalEntries, Appointments, InAppNotifications,
BankReconciliations, FixedAssets, RecurringTemplates, SmsAgreements, SmsConsentAudit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 23:07:52 -04:00

244 lines
12 KiB
Plaintext

@using PowderCoating.Core.Entities
@model List<FixedAsset>
@{
ViewData["Title"] = "Fixed Assets";
ViewData["PageIcon"] = "bi-building-gear";
var now = DateTime.Now;
}
<div class="d-flex justify-content-between align-items-center mb-4">
<div></div>
<div class="d-flex gap-2">
<a asp-action="Create" class="btn btn-primary">
<i class="bi bi-plus-circle me-2"></i>Add Asset
</a>
</div>
</div>
@if (TempData["Success"] != null)
{
<div class="alert alert-success alert-permanent alert-dismissible fade show" role="alert">
<i class="bi bi-check-circle me-2"></i>@TempData["Success"]
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
}
@if (TempData["Error"] != null)
{
<div class="alert alert-danger alert-permanent alert-dismissible fade show" role="alert">
<i class="bi bi-exclamation-triangle me-2"></i>@TempData["Error"]
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
}
<!-- Summary Cards -->
<div class="row g-3 mb-4">
<div class="col-md-3">
<div class="card border-0 shadow-sm text-center">
<div class="card-body py-3">
<div class="text-muted small">Active Assets</div>
<div class="fs-3 fw-bold text-primary">@ViewBag.ActiveCount</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card border-0 shadow-sm text-center">
<div class="card-body py-3">
<div class="text-muted small">Total Cost</div>
<div class="fs-3 fw-bold">@((ViewBag.TotalCost as decimal? ?? 0).ToString("C"))</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card border-0 shadow-sm text-center">
<div class="card-body py-3">
<div class="text-muted small">Accum. Depreciation</div>
<div class="fs-3 fw-bold text-danger">@((ViewBag.TotalAccumDeprec as decimal? ?? 0).ToString("C"))</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card border-0 shadow-sm text-center">
<div class="card-body py-3">
<div class="text-muted small">Total Book Value</div>
<div class="fs-3 fw-bold text-success">@((ViewBag.TotalBookValue as decimal? ?? 0).ToString("C"))</div>
</div>
</div>
</div>
</div>
<!-- Post Depreciation -->
<div class="card border-0 shadow-sm mb-4">
<div class="card-header bg-white border-0 py-3 d-flex justify-content-between align-items-center">
<h5 class="mb-0 fw-semibold"><i class="bi bi-calendar-check me-2 text-primary"></i>Post Monthly Depreciation</h5>
</div>
<div class="card-body">
<form asp-action="PostDepreciation" method="post" class="row g-3 align-items-end">
@Html.AntiForgeryToken()
<div class="col-md-3">
<label class="form-label">Year</label>
<input type="number" name="year" class="form-control" value="@now.Year" min="2000" max="2099" required />
</div>
<div class="col-md-3">
<label class="form-label">Month</label>
<select name="month" class="form-select">
@for (int m = 1; m <= 12; m++)
{
<option value="@m" selected="@(m == now.Month ? "selected" : null)">
@(new DateTime(now.Year, m, 1).ToString("MMMM"))
</option>
}
</select>
</div>
<div class="col-md-3">
<button type="submit" class="btn btn-outline-primary"
onclick="return confirm('Post straight-line depreciation for all active assets for this period? Assets already posted for the period will be skipped.')">
<i class="bi bi-send me-2"></i>Post Depreciation
</button>
</div>
<div class="col-md-3 text-muted small">
Creates one Journal Entry per asset. Fully-depreciated and disposed assets are skipped.
</div>
</form>
</div>
</div>
<!-- Asset Table -->
<div class="card border-0 shadow-sm">
<div class="card-header bg-white border-0 py-3">
<h5 class="mb-0 fw-semibold"><i class="bi bi-table me-2 text-primary"></i>Asset Register</h5>
</div>
<div class="card-body p-0">
@if (!Model.Any())
{
<div class="text-center text-muted py-5">
<i class="bi bi-building-gear display-4 d-block mb-3 opacity-25"></i>
<p>No fixed assets yet. <a asp-action="Create">Add your first asset</a> to start tracking depreciation.</p>
</div>
}
else
{
<div class="mobile-card-view">
<div class="mobile-card-list">
@foreach (var a in Model)
{
var fd = a.AccumulatedDepreciation >= (a.PurchaseCost - a.SalvageValue);
<div class="mobile-data-card" onclick="window.location='@Url.Action("Details", new { id = a.Id })'">
<div class="mobile-card-header">
<div class="mobile-card-icon" style="background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);">
<i class="bi bi-building-gear"></i>
</div>
<div class="mobile-card-title">
<h6>@a.Name</h6>
<small>Purchased @a.PurchaseDate.ToLocalTime().ToString("MM/dd/yyyy")</small>
</div>
</div>
<div class="mobile-card-body">
<div class="mobile-card-row">
<span class="mobile-card-label">Status</span>
<span class="mobile-card-value">
@if (a.IsDisposed)
{
<span class="badge bg-secondary">Disposed</span>
}
else if (fd)
{
<span class="badge bg-light text-dark border">Fully Depreciated</span>
}
else
{
<span class="badge bg-success">Active</span>
}
</span>
</div>
<div class="mobile-card-row">
<span class="mobile-card-label">Cost</span>
<span class="mobile-card-value">@a.PurchaseCost.ToString("C")</span>
</div>
<div class="mobile-card-row">
<span class="mobile-card-label">Book Value</span>
<span class="mobile-card-value @(a.BookValue <= 0 ? "text-muted" : "text-success fw-semibold")">
@a.BookValue.ToString("C")
</span>
</div>
<div class="mobile-card-row">
<span class="mobile-card-label">Monthly Depr.</span>
<span class="mobile-card-value">@a.MonthlyDepreciation.ToString("C")</span>
</div>
</div>
<div class="mobile-card-footer">
<a asp-action="Details" asp-route-id="@a.Id" class="btn btn-sm btn-outline-secondary" onclick="event.stopPropagation()">
<i class="bi bi-eye me-1"></i>View
</a>
</div>
</div>
}
</div>
</div>
<div class="table-responsive">
<table class="table table-hover align-middle mb-0">
<thead class="table-light">
<tr>
<th>Asset</th>
<th>Purchase Date</th>
<th class="text-end">Cost</th>
<th class="text-end">Salvage Value</th>
<th class="text-center">Life (mo.)</th>
<th class="text-end">Monthly Depr.</th>
<th class="text-end">Accum. Depr.</th>
<th class="text-end">Book Value</th>
<th class="text-center">Status</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var a in Model)
{
var fullyDeprec = a.AccumulatedDepreciation >= (a.PurchaseCost - a.SalvageValue);
<tr>
<td>
<a asp-action="Details" asp-route-id="@a.Id" class="fw-semibold text-decoration-none">
@a.Name
</a>
@if (!string.IsNullOrWhiteSpace(a.Description))
{
<div class="text-muted small">@a.Description</div>
}
</td>
<td>@a.PurchaseDate.ToLocalTime().ToString("MM/dd/yyyy")</td>
<td class="text-end">@a.PurchaseCost.ToString("C")</td>
<td class="text-end">@a.SalvageValue.ToString("C")</td>
<td class="text-center">@a.UsefulLifeMonths</td>
<td class="text-end">@a.MonthlyDepreciation.ToString("C")</td>
<td class="text-end text-danger">@a.AccumulatedDepreciation.ToString("C")</td>
<td class="text-end @(a.BookValue <= 0 ? "text-muted" : "text-success fw-semibold")">
@a.BookValue.ToString("C")
</td>
<td class="text-center">
@if (a.IsDisposed)
{
<span class="badge bg-secondary">Disposed</span>
}
else if (fullyDeprec)
{
<span class="badge bg-light text-dark border">Fully Depreciated</span>
}
else
{
<span class="badge bg-success">Active</span>
}
</td>
<td>
<a asp-action="Details" asp-route-id="@a.Id" class="btn btn-sm btn-outline-secondary">
<i class="bi bi-eye"></i>
</a>
</td>
</tr>
}
</tbody>
</table>
</div>
}
</div>
</div>