@model PagedResult @{ ViewData["Title"] = "Customers"; ViewData["PageIcon"] = "bi-people"; ViewData["PageHelpTitle"] = "Customers"; ViewData["PageHelpContent"] = "Customers are companies or individuals who bring in work. Commercial customers get business features like payment terms, credit limits, and pricing tier discounts. Individual customers are typically walk-in or one-off jobs. Balance shown here is the total outstanding across all unpaid invoices."; }
@await Html.PartialAsync("_Metric", (Label: "TOTAL", Value: Model.TotalCount.ToString(), Delta: (string?)null, DeltaDir: (string?)null))
@await Html.PartialAsync("_Metric", (Label: "ACTIVE", Value: Model.Items.Count(c => c.IsActive).ToString(), Delta: (string?)null, DeltaDir: (string?)null))
@await Html.PartialAsync("_Metric", (Label: "COMMERCIAL", Value: Model.Items.Count(c => c.IsCommercial).ToString(), Delta: (string?)null, DeltaDir: (string?)null))
@await Html.PartialAsync("_Metric", (Label: "TOTAL BALANCE", Value: Model.Items.Sum(c => c.CurrentBalance).ToString("C0"), Delta: (string?)null, DeltaDir: (string?)null))
@if (!string.IsNullOrEmpty(ViewBag.SearchTerm)) { Clear }
Add Customer Add
@if (!Model.Items.Any()) { var isCustomerListFiltered = !string.IsNullOrEmpty(ViewBag.SearchTerm as string);
No customers found

@(isCustomerListFiltered ? "No customers match your search." : "Get started by adding your first customer.")

@(isCustomerListFiltered ? "Add Customer" : "Add Your First Customer")
} else {
@foreach (var customer in Model.Items) { }
Company Contact Email Phone Type Balance Status Notifications Actions
@{ var initial = "?"; if (!string.IsNullOrEmpty(customer.CompanyName) && customer.CompanyName.Length > 0) { initial = customer.CompanyName.Substring(0, 1).ToUpper(); } else if (!string.IsNullOrEmpty(customer.ContactName) && customer.ContactName.Length > 0) { initial = customer.ContactName.Substring(0, 1).ToUpper(); } } @initial
@(string.IsNullOrEmpty(customer.CompanyName) ? customer.ContactName ?? "Individual Customer" : customer.CompanyName)
@if (customer.LastContactDate.HasValue) { Last contact: @customer.LastContactDate.Value.ToString("MMM dd, yyyy") }
@if (!string.IsNullOrEmpty(customer.ContactName)) { @customer.ContactName } else { } @if (!string.IsNullOrEmpty(customer.Email)) { @customer.Email } else { } @if (!string.IsNullOrEmpty(customer.Phone)) { @customer.Phone } else { } @await Html.PartialAsync("_StatusChip", (Kind: customer.IsCommercial ? "cool" : "neutral", Text: customer.IsCommercial ? "Commercial" : "Individual")) @customer.CurrentBalance.ToString("C") @await Html.PartialAsync("_StatusChip", (Kind: StatusChipHelper.Active(customer.IsActive), Text: customer.IsActive ? "Active" : "Inactive"))
@if (!Model.Items.Any()) { var isMobileCustomerListFiltered = !string.IsNullOrEmpty(ViewBag.SearchTerm as string);
No customers found

@(isMobileCustomerListFiltered ? "No customers match your search." : "Get started by adding your first customer.")

@(isMobileCustomerListFiltered ? "Add Customer" : "Add Your First Customer")
} else {
@foreach (var customer in Model.Items) {
@(string.IsNullOrEmpty(customer.CompanyName) ? customer.ContactName ?? "Individual Customer" : customer.CompanyName)
@customer.Email
@if (!string.IsNullOrEmpty(customer.ContactName)) {
Contact @customer.ContactName
}
Phone @(customer.Phone ?? "—")
Type @if (customer.IsCommercial) { Commercial } else { Individual }
Balance @customer.CurrentBalance.ToString("C")
Status @if (customer.IsActive) { Active } else { Inactive }
@if (customer.LastContactDate.HasValue) {
Last Contact @customer.LastContactDate.Value.ToString("MMM dd, yyyy")
}
}
}
}
@if (Model.TotalCount > 0) { @await Html.PartialAsync("_Pagination", Model) }
@section Scripts { }