a0bdd2b5b4
Replace all corruption variants with HTML entities across 226 view files: - 3-char UTF-8-as-Win1252 sequences (ae-corruption) - Standalone smart/curly quotes that break C# Razor expressions - Partially re-corrupted variants where the 3rd byte was normalised to ASCII tools/Fix-Encoding.ps1: re-runnable sweep; uses [char] code points so the script itself never contains a literal non-ASCII character; supports -DryRun .githooks/pre-commit: blocks commits containing the ae-corruption byte signature (xc3xa2xe2x82xac); git core.hooksPath = .githooks so the hook is repo-committed and active for all future work on this machine. Build clean; 225 unit tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
153 lines
7.4 KiB
Plaintext
153 lines
7.4 KiB
Plaintext
@using PowderCoating.Core.Entities
|
|
@model List<Budget>
|
|
|
|
@{
|
|
ViewData["Title"] = "Budgets";
|
|
ViewData["PageIcon"] = "bi-pie-chart";
|
|
var byYear = Model.GroupBy(b => b.FiscalYear).OrderByDescending(g => g.Key).ToList();
|
|
}
|
|
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<div></div>
|
|
<div class="d-flex gap-2">
|
|
<a asp-controller="Reports" asp-action="BudgetVsActual" class="btn btn-outline-primary">
|
|
<i class="bi bi-bar-chart-line me-2"></i>Budget vs. Actual Report
|
|
</a>
|
|
<a asp-action="Create" class="btn btn-primary">
|
|
<i class="bi bi-plus-circle me-2"></i>New Budget
|
|
</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>
|
|
}
|
|
|
|
@if (!Model.Any())
|
|
{
|
|
<div class="card border-0 shadow-sm">
|
|
<div class="card-body text-center text-muted py-5">
|
|
<i class="bi bi-pie-chart display-4 d-block mb-3 opacity-25"></i>
|
|
<p class="mb-0">No budgets yet. <a asp-action="Create">Create your first budget</a> to start tracking variance against actual results.</p>
|
|
</div>
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
@foreach (var group in byYear)
|
|
{
|
|
<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-calendar3 me-2 text-primary"></i>Fiscal Year @group.Key</h5>
|
|
</div>
|
|
<div class="card-body p-0">
|
|
<table class="table table-hover align-middle mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>Budget Name</th>
|
|
<th class="text-center">Lines</th>
|
|
<th class="text-end">Total Revenue Budget</th>
|
|
<th class="text-end">Total Expense Budget</th>
|
|
<th class="text-center">Default</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var b in group.OrderBy(b => b.Name))
|
|
{
|
|
var revLines = b.Lines.Where(l => l.Account?.AccountType == PowderCoating.Core.Enums.AccountType.Revenue);
|
|
var expLines = b.Lines.Where(l => l.Account?.AccountType == PowderCoating.Core.Enums.AccountType.Expense);
|
|
<tr>
|
|
<td class="fw-semibold">
|
|
@b.Name
|
|
@if (!string.IsNullOrWhiteSpace(b.Notes))
|
|
{
|
|
<div class="text-muted small">@b.Notes</div>
|
|
}
|
|
</td>
|
|
<td class="text-center">@b.Lines.Count</td>
|
|
<td class="text-end text-success">@b.Lines.Sum(l => l.Annual).ToString("C")</td>
|
|
<td class="text-end text-danger">—</td>
|
|
<td class="text-center">
|
|
@if (b.IsDefault)
|
|
{
|
|
<span class="badge bg-primary">Default</span>
|
|
}
|
|
else
|
|
{
|
|
<form asp-action="SetDefault" asp-route-id="@b.Id" method="post" class="d-inline">
|
|
@Html.AntiForgeryToken()
|
|
<button type="submit" class="btn btn-sm btn-outline-secondary">Set Default</button>
|
|
</form>
|
|
}
|
|
</td>
|
|
<td class="text-end">
|
|
<div class="d-flex gap-1 justify-content-end">
|
|
<a asp-action="Edit" asp-route-id="@b.Id" class="btn btn-sm btn-outline-primary">
|
|
<i class="bi bi-pencil"></i>
|
|
</a>
|
|
<button type="button" class="btn btn-sm btn-outline-secondary"
|
|
data-bs-toggle="modal" data-bs-target="#copyModal"
|
|
data-budget-id="@b.Id" data-budget-name="@b.Name">
|
|
<i class="bi bi-copy"></i>
|
|
</button>
|
|
<form asp-action="Delete" asp-route-id="@b.Id" method="post" class="d-inline"
|
|
onsubmit="return confirm('Delete budget "@b.Name"? This cannot be undone.')">
|
|
@Html.AntiForgeryToken()
|
|
<button type="submit" class="btn btn-sm btn-outline-danger">
|
|
<i class="bi bi-trash"></i>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
}
|
|
}
|
|
|
|
<!-- Copy Modal -->
|
|
<div class="modal fade" id="copyModal" tabindex="-1">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title"><i class="bi bi-copy me-2"></i>Copy Budget</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<form asp-action="Copy" method="post">
|
|
@Html.AntiForgeryToken()
|
|
<input type="hidden" name="id" id="copyBudgetId" />
|
|
<div class="modal-body">
|
|
<p>Copy <strong id="copyBudgetName"></strong> to a new fiscal year as a starting point.</p>
|
|
<div class="mb-3">
|
|
<label class="form-label">New Fiscal Year</label>
|
|
<input type="number" name="newYear" class="form-control" value="@(DateTime.Now.Year + 1)" min="2000" max="2099" required />
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">Cancel</button>
|
|
<button type="submit" class="btn btn-primary"><i class="bi bi-copy me-2"></i>Copy Budget</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@section Scripts {
|
|
<script src="~/js/budget-index.js" asp-append-version="true"></script>
|
|
}
|