76 lines
3.0 KiB
Swift
76 lines
3.0 KiB
Swift
import SwiftUI
|
|
|
|
struct LeadCardView: View {
|
|
let lead: Lead
|
|
let isBusy: Bool
|
|
let onOpen: () -> Void
|
|
let onBookmark: () -> Void
|
|
|
|
var body: some View {
|
|
ZStack(alignment: .topTrailing) {
|
|
Button(action: onOpen) {
|
|
VStack(alignment: .leading, spacing: 0) {
|
|
VStack(alignment: .leading, spacing: 8) {
|
|
Text(lead.id)
|
|
.font(.caption)
|
|
.foregroundStyle(.secondary)
|
|
.padding(.trailing, 36)
|
|
Text(lead.displayName)
|
|
.font(.headline)
|
|
.foregroundStyle(.primary)
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
Text(lead.fullAddress)
|
|
.font(.subheadline)
|
|
.foregroundStyle(.secondary)
|
|
Label(lead.phoneNumber ?? " ", systemImage: "phone.fill")
|
|
.font(.subheadline)
|
|
.foregroundStyle(LeadOverviewStyle.blue)
|
|
.hidden()
|
|
.accessibilityHidden(true)
|
|
}
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
.padding(18)
|
|
Divider()
|
|
HStack(spacing: 12) {
|
|
LeadStatusView(offerCount: lead.offerCount, unsignedContractCount: lead.unsignedContractCount)
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
Image(systemName: "chevron.forward")
|
|
.font(.caption.weight(.semibold))
|
|
.foregroundStyle(.tertiary)
|
|
.accessibilityHidden(true)
|
|
}
|
|
.padding(.horizontal, 18)
|
|
.padding(.vertical, 12)
|
|
.background(Color.primary.opacity(0.025), in: .rect)
|
|
}
|
|
.background(Color(uiColor: .secondarySystemGroupedBackground), in: .rect(cornerRadius: 18))
|
|
.clipShape(.rect(cornerRadius: 18))
|
|
.contentShape(.rect)
|
|
}
|
|
.buttonStyle(.plain)
|
|
.accessibilityHint("Interessentendetails öffnen")
|
|
|
|
LeadBookmarkButton(isBookmarked: lead.isBookmarked, isBusy: isBusy, action: onBookmark)
|
|
.padding(6)
|
|
}
|
|
}
|
|
}
|
|
|
|
struct LeadBookmarkButton: View {
|
|
let isBookmarked: Bool
|
|
let isBusy: Bool
|
|
let action: () -> Void
|
|
|
|
var body: some View {
|
|
Button(action: action) {
|
|
Image(systemName: isBookmarked ? "bookmark.fill" : "bookmark")
|
|
.foregroundStyle(isBookmarked ? Color.red : Color.secondary)
|
|
.frame(width: 44, height: 44)
|
|
.contentShape(.rect)
|
|
}
|
|
.buttonStyle(.plain)
|
|
.disabled(isBusy)
|
|
.accessibilityLabel(isBookmarked ? "Nicht mehr merken" : "Interessent merken")
|
|
}
|
|
}
|