43 lines
1.5 KiB
Swift
43 lines
1.5 KiB
Swift
import SwiftUI
|
|
import PDFKit
|
|
import QuickLook
|
|
|
|
struct LeadSigningPreviewView: View {
|
|
let offerID: String
|
|
let url: URL
|
|
let placement: PDFSignaturePlacement?
|
|
@State private var showsPreview = false
|
|
@State private var pageNumber = 1
|
|
@State private var pageCount = 1
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: 8) {
|
|
HStack {
|
|
Text("VORSCHAU · \(offerID)")
|
|
Spacer()
|
|
Button("In Vorschau öffnen", systemImage: "arrow.up.left.and.arrow.down.right") {
|
|
showsPreview = true
|
|
}
|
|
.font(.subheadline)
|
|
.foregroundStyle(.tint)
|
|
}
|
|
.font(.caption).foregroundStyle(.secondary).padding(.horizontal, 16)
|
|
LeadPDFView(url: url, signaturePlacement: placement, fitsWholePage: true) { current, total in
|
|
pageNumber = current
|
|
pageCount = total
|
|
}
|
|
.frame(height: 310)
|
|
.clipShape(.rect(cornerRadius: 12))
|
|
.overlay(RoundedRectangle(cornerRadius: 12).stroke(.gray.opacity(0.25)))
|
|
Text("Seite \(pageNumber) von \(pageCount)")
|
|
.font(.caption)
|
|
.foregroundStyle(.secondary)
|
|
.frame(maxWidth: .infinity, alignment: .trailing)
|
|
.padding(.horizontal, 16)
|
|
}
|
|
.fullScreenCover(isPresented: $showsPreview) {
|
|
LeadDocumentPreview(url: url)
|
|
}
|
|
}
|
|
}
|