1. Prototyp
This commit is contained in:
1 parent
e723eee440
commit
c24bc91768
37 files changed
+11610
No files matched your search
@@ -0,0 +1,143 @@
|
||||
import SwiftUI
|
||||
import LektorenPlanCore
|
||||
|
||||
struct PlanResultSheet: View {
|
||||
@EnvironmentObject private var model: PlanModel
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
if let result = model.planResult {
|
||||
SheetHeader(
|
||||
icon: result.unfilled.isEmpty ? "checkmark.seal" : "exclamationmark.triangle",
|
||||
title: result.unfilled.isEmpty ? "Planung abgeschlossen" : "Planung mit Lücken",
|
||||
subtitle: result.message,
|
||||
tint: result.unfilled.isEmpty ? LP.success : LP.open
|
||||
)
|
||||
|
||||
Hairline()
|
||||
|
||||
ScrollView {
|
||||
VStack(alignment: .leading, spacing: 18) {
|
||||
HStack(spacing: 12) {
|
||||
resultTile(
|
||||
icon: "checkmark.circle",
|
||||
value: "\(result.filledCount)",
|
||||
label: "neu besetzte Dienste",
|
||||
tint: LP.success
|
||||
)
|
||||
resultTile(
|
||||
icon: "circle.dashed",
|
||||
value: "\(result.unfilled.count)",
|
||||
label: "offene Dienste",
|
||||
tint: LP.open
|
||||
)
|
||||
resultTile(
|
||||
icon: "person.2",
|
||||
value: "\(model.stats.assignmentCount)",
|
||||
label: "Einsätze im Zeitraum",
|
||||
tint: LP.accent
|
||||
)
|
||||
}
|
||||
|
||||
if result.unfilled.isEmpty {
|
||||
HStack(alignment: .top, spacing: 9) {
|
||||
Image(systemName: "sparkles")
|
||||
.foregroundStyle(LP.gold)
|
||||
Text("Alle Dienste im gewählten Zeitraum konnten unter Berücksichtigung von Abwesenheiten, Einsatztagen und Monatslimits besetzt werden. Gesperrte Einsätze wurden nicht verändert.")
|
||||
.font(.system(size: 10.5))
|
||||
.foregroundStyle(LP.inkSecondary)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
.padding(12)
|
||||
.background(RoundedRectangle(cornerRadius: 10).fill(LP.successSoft.opacity(0.6)))
|
||||
} else {
|
||||
FormSection(
|
||||
title: "Nicht besetzbare Dienste",
|
||||
subtitle: "Die genannten Gründe zeigen, warum keine geeignete Person gefunden wurde."
|
||||
) {
|
||||
VStack(spacing: 0) {
|
||||
ForEach(Array(result.unfilled.enumerated()), id: \.element.id) { index, slot in
|
||||
HStack(alignment: .top, spacing: 10) {
|
||||
VStack(alignment: .leading, spacing: 1) {
|
||||
Text(DayMath.shortWeekdayName(slot.service.date).uppercased())
|
||||
.font(.system(size: 7.5, weight: .bold, design: .rounded))
|
||||
.foregroundStyle(LP.inkTertiary)
|
||||
Text("\(DayMath.dayNumber(slot.service.date)).")
|
||||
.font(.system(size: 14, weight: .semibold, design: .serif))
|
||||
.foregroundStyle(LP.ink)
|
||||
Text(DayMath.shortMonthName(slot.service.date))
|
||||
.font(.system(size: 8))
|
||||
.foregroundStyle(LP.inkTertiary)
|
||||
}
|
||||
.frame(width: 34)
|
||||
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
HStack(spacing: 5) {
|
||||
Text(slot.service.timeLabel)
|
||||
.font(.system(size: 9.5, weight: .bold, design: .rounded))
|
||||
.foregroundStyle(LP.accent)
|
||||
Text(slot.service.title)
|
||||
.font(.system(size: 10.5, weight: .medium))
|
||||
.foregroundStyle(LP.ink)
|
||||
}
|
||||
Text("\(slot.churchName) · \(slot.role.title)")
|
||||
.font(.system(size: 9))
|
||||
.foregroundStyle(LP.inkTertiary)
|
||||
Text(slot.reason)
|
||||
.font(.system(size: 9.5))
|
||||
.foregroundStyle(LP.open)
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.padding(.horizontal, 10)
|
||||
.padding(.vertical, 7)
|
||||
.background(index % 2 == 0 ? LP.cardMuted.opacity(0.4) : Color.clear)
|
||||
}
|
||||
}
|
||||
.clipShape(RoundedRectangle(cornerRadius: 9))
|
||||
.overlay(RoundedRectangle(cornerRadius: 9).strokeBorder(LP.line.opacity(0.55), lineWidth: 0.8))
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(22)
|
||||
}
|
||||
|
||||
SheetFooter {
|
||||
Spacer()
|
||||
SecondaryActionButton(title: "Statistik ansehen", icon: "chart.xyaxis.line") {
|
||||
model.planResult = nil
|
||||
model.section = .statistics
|
||||
dismiss()
|
||||
}
|
||||
PrimaryActionButton(title: "Schließen", icon: "checkmark") {
|
||||
model.planResult = nil
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ProgressView()
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
}
|
||||
}
|
||||
.sheetSurface(width: 620, height: 560)
|
||||
}
|
||||
|
||||
private func resultTile(icon: String, value: String, label: String, tint: Color) -> some View {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Image(systemName: icon)
|
||||
.font(.system(size: 13, weight: .semibold))
|
||||
.foregroundStyle(tint)
|
||||
Text(value)
|
||||
.font(.system(size: 22, weight: .bold, design: .rounded))
|
||||
.foregroundStyle(LP.ink)
|
||||
Text(label)
|
||||
.font(.system(size: 9))
|
||||
.foregroundStyle(LP.inkTertiary)
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(12)
|
||||
.background(RoundedRectangle(cornerRadius: 10).fill(LP.cardMuted))
|
||||
.overlay(RoundedRectangle(cornerRadius: 10).strokeBorder(LP.line.opacity(0.55), lineWidth: 0.8))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user