Add lead workflows, PDF signing, AR projects and photo gallery integration
This commit is contained in:
74
GasTankAR/Views/Leads/Detail/LeadDetailHeaderView.swift
Normal file
74
GasTankAR/Views/Leads/Detail/LeadDetailHeaderView.swift
Normal file
@ -0,0 +1,74 @@
|
||||
import SwiftUI
|
||||
|
||||
struct LeadDetailHeaderView: View {
|
||||
let detail: LeadDetail
|
||||
let canStartAR: Bool
|
||||
let onStartAR: () -> Void
|
||||
@Environment(\.openURL) private var openURL
|
||||
@Environment(\.dynamicTypeSize) private var dynamicTypeSize
|
||||
@State private var actionUnavailable = false
|
||||
|
||||
var body: some View {
|
||||
let layout = dynamicTypeSize.isAccessibilitySize
|
||||
? AnyLayout(VStackLayout(alignment: .leading, spacing: 16))
|
||||
: AnyLayout(HStackLayout(spacing: 20))
|
||||
layout {
|
||||
HStack(spacing: 18) {
|
||||
Text(detail.initials)
|
||||
.font(.title2.weight(.medium))
|
||||
.frame(width: 64, height: 64)
|
||||
.background(.gray.gradient, in: .circle)
|
||||
.foregroundStyle(.white)
|
||||
.accessibilityHidden(true)
|
||||
VStack(alignment: .leading, spacing: 6) {
|
||||
Text(detail.lead.displayName).font(.title.bold())
|
||||
Text("\(detail.lead.id) · \(detail.customerType) · \(detail.lead.address.city)")
|
||||
.font(.subheadline).foregroundStyle(.secondary)
|
||||
}
|
||||
}
|
||||
Spacer(minLength: 0)
|
||||
HStack(spacing: 24) {
|
||||
HStack(spacing: 8) {
|
||||
action("Anrufen", icon: "phone.fill", url: detail.phoneURL)
|
||||
action("E-Mail", icon: "envelope.fill", url: detail.emailURL)
|
||||
action("Route", icon: "location.fill", url: detail.routeURL)
|
||||
}
|
||||
Button(action: onStartAR) {
|
||||
VStack(spacing: 8) {
|
||||
Image(systemName: "arkit").font(.title3)
|
||||
Text("AR").font(.caption)
|
||||
}
|
||||
.frame(minWidth: 60, minHeight: 56)
|
||||
.padding(6)
|
||||
.foregroundStyle(.white)
|
||||
.background(LeadDetailStyle.blue, in: .rect(cornerRadius: 14))
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.opacity(canStartAR ? 1 : 0.5)
|
||||
.disabled(!canStartAR)
|
||||
.accessibilityLabel("AR-Modus starten")
|
||||
}
|
||||
}
|
||||
.alert("Aktion nicht verfügbar", isPresented: $actionUnavailable) {
|
||||
Button("OK", role: .cancel) {}
|
||||
} message: {
|
||||
Text("Auf diesem Gerät ist keine passende App für diese Aktion verfügbar.")
|
||||
}
|
||||
}
|
||||
|
||||
private func action(_ title: LocalizedStringKey, icon: String, url: URL?) -> some View {
|
||||
Button {
|
||||
guard let url else { return }
|
||||
openURL(url) { accepted in actionUnavailable = !accepted }
|
||||
} label: {
|
||||
VStack(spacing: 8) {
|
||||
Image(systemName: icon).font(.title3)
|
||||
Text(title).font(.caption)
|
||||
}
|
||||
.frame(minWidth: 60, minHeight: 56)
|
||||
.padding(6)
|
||||
.background(LeadDetailStyle.card, in: .rect(cornerRadius: 14))
|
||||
}
|
||||
.disabled(url == nil)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user