Add lead workflows, PDF signing, AR projects and photo gallery integration
This commit is contained in:
73
GasTankAR/Views/Leads/Overview/LeadStatusView.swift
Normal file
73
GasTankAR/Views/Leads/Overview/LeadStatusView.swift
Normal file
@ -0,0 +1,73 @@
|
||||
import SwiftUI
|
||||
|
||||
struct LeadStatusView: View {
|
||||
let offerCount: Int
|
||||
let unsignedContractCount: Int
|
||||
var highlighted = false
|
||||
|
||||
var body: some View {
|
||||
ViewThatFits(in: .horizontal) {
|
||||
HStack(spacing: 8) {
|
||||
LeadOfferBadge(count: offerCount, highlighted: highlighted)
|
||||
contractStatus
|
||||
}
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
LeadOfferBadge(count: offerCount, highlighted: highlighted)
|
||||
contractStatus
|
||||
}
|
||||
}
|
||||
.font(.footnote)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var contractStatus: some View {
|
||||
if offerCount > 0 && unsignedContractCount == 0 {
|
||||
HStack(spacing: 5) {
|
||||
Image(systemName: "checkmark.circle.fill")
|
||||
.symbolRenderingMode(.palette)
|
||||
.foregroundStyle(.white, LeadOverviewStyle.successGreen)
|
||||
.font(.title3)
|
||||
Text("signiert")
|
||||
.foregroundStyle(highlighted ? Color.white.opacity(0.9) : Color.secondary)
|
||||
}
|
||||
.accessibilityElement(children: .ignore)
|
||||
.accessibilityLabel("Alle Verträge unterschrieben")
|
||||
} else {
|
||||
Text(contractLabel)
|
||||
.foregroundStyle(highlighted ? Color.white.opacity(0.9) : Color.secondary)
|
||||
}
|
||||
}
|
||||
|
||||
private var contractLabel: LocalizedStringResource {
|
||||
switch unsignedContractCount {
|
||||
case 0: "Nichts zu unterschreiben"
|
||||
case 1: "1 Vertrag offen"
|
||||
default: "\(unsignedContractCount) Verträge offen"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct LeadOfferBadge: View {
|
||||
let count: Int
|
||||
let highlighted: Bool
|
||||
|
||||
var body: some View {
|
||||
Text(label)
|
||||
.fontWeight(.medium)
|
||||
.padding(.horizontal, 10)
|
||||
.padding(.vertical, 5)
|
||||
.foregroundStyle(highlighted ? .white : (count == 0 ? Color.secondary : LeadOverviewStyle.blue))
|
||||
.background(
|
||||
highlighted ? Color.white.opacity(0.25) : (count == 0 ? Color.primary.opacity(0.05) : LeadOverviewStyle.blue.opacity(0.08)),
|
||||
in: .capsule
|
||||
)
|
||||
}
|
||||
|
||||
private var label: LocalizedStringResource {
|
||||
switch count {
|
||||
case 0: "Kein Angebot"
|
||||
case 1: "1 Angebot"
|
||||
default: "\(count) Angebote"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user