Missing Field Handling
This commit is contained in:
@@ -215,13 +215,13 @@ private struct SafetyAlertsSection: View {
|
||||
VStack(spacing: 8) {
|
||||
ForEach(expired) { chem in
|
||||
AlertRow(
|
||||
message: "\(chem.chemicalName) expired \(-viewModel.daysUntil(chem.expirationDate ?? ""))d ago — verify disposal",
|
||||
message: "\(chem.displayName) expired \(-viewModel.daysUntil(chem.expirationDate ?? ""))d ago — verify disposal",
|
||||
severity: .critical
|
||||
)
|
||||
}
|
||||
ForEach(lowStockAlerts) { chem in
|
||||
AlertRow(
|
||||
message: "\(chem.chemicalName) is \(Int(chem.percentageFull ?? 0))% full — consider reordering",
|
||||
message: "\(chem.displayName) is \(Int(chem.percentageFull ?? 0))% full — consider reordering",
|
||||
severity: .warning
|
||||
)
|
||||
}
|
||||
@@ -275,8 +275,8 @@ private struct LowStockSection: View {
|
||||
VStack(spacing: 0) {
|
||||
ForEach(viewModel.lowStock.prefix(3)) { chem in
|
||||
ChemAlertRow(
|
||||
name: chem.chemicalName,
|
||||
subtitle: "\(chem.lab) · \(chem.storageLocation)",
|
||||
name: chem.displayName,
|
||||
subtitle: "\(chem.lab ?? "—") · \(chem.storageLocation ?? "—")",
|
||||
badge: "\(Int(chem.percentageFull ?? 0))% full",
|
||||
badgeColor: .orange
|
||||
)
|
||||
@@ -304,8 +304,8 @@ private struct ExpiringSection: View {
|
||||
ForEach(viewModel.expiringSoon.prefix(4)) { chem in
|
||||
let days = viewModel.daysUntil(chem.expirationDate ?? "")
|
||||
ChemAlertRow(
|
||||
name: chem.chemicalName,
|
||||
subtitle: "\(chem.lab) · \(chem.storageLocation)",
|
||||
name: chem.displayName,
|
||||
subtitle: "\(chem.lab ?? "—") · \(chem.storageLocation ?? "—")",
|
||||
badge: days <= 0 ? "Expired \(-days)d ago" : "In \(days)d",
|
||||
badgeColor: days <= 0 ? .red : .orange
|
||||
)
|
||||
@@ -336,7 +336,7 @@ private struct RecentActivitySection: View {
|
||||
.foregroundStyle(Color(.brandPrimary))
|
||||
.font(.title3)
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text("Added \(chem.chemicalName) to inventory")
|
||||
Text("Added \(chem.displayName) to inventory")
|
||||
.font(.subheadline)
|
||||
.lineLimit(1)
|
||||
Text(viewModel.relativeTime(chem.createdAt))
|
||||
|
||||
Reference in New Issue
Block a user