66 lines
2.2 KiB
Swift
66 lines
2.2 KiB
Swift
//
|
|
// ResiliationCheckStepsScreen.swift
|
|
// Sequoia
|
|
//
|
|
// Created by Victor on 10/10/2024.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct ResiliationCheckStepsScreen: View {
|
|
@StateObject var viewModel: ResiliationViewModel
|
|
@State private var selectedSteps: Set<ResiliationCheckStep> = []
|
|
@State private var navigateToReasonScreen = false
|
|
|
|
var allStepsSelected: Bool {
|
|
selectedSteps.count == viewModel.resiliationCheckSteps.count
|
|
}
|
|
|
|
var body: some View {
|
|
ScrollView {
|
|
VStack(spacing: 16) {
|
|
SQText("En résiliant votre abonnement vous renoncez à :", size: 18, font: .bold)
|
|
.multilineTextAlignment(.center)
|
|
ForEach(viewModel.resiliationCheckSteps, id: \.self) { step in
|
|
ResiliationCheckStepView(
|
|
checkStep: step,
|
|
isSelected: Binding(
|
|
get: { selectedSteps.contains(step) },
|
|
set: { isSelected in
|
|
if isSelected {
|
|
selectedSteps.insert(step)
|
|
} else {
|
|
selectedSteps.remove(step)
|
|
}
|
|
}
|
|
)
|
|
)
|
|
}
|
|
|
|
if viewModel.resiliationType == .apProWithTrial || viewModel.resiliationType == .apProWithTrialWithBooster {
|
|
TrialWarningCellView()
|
|
}
|
|
|
|
HStack {
|
|
SQButton("Annuler") {}
|
|
.buttonType(.glass)
|
|
SQButton("Continuer") {
|
|
navigateToReasonScreen = true
|
|
}
|
|
.disabled(!allStepsSelected)
|
|
}
|
|
.padding()
|
|
}
|
|
.padding()
|
|
}
|
|
.navigationDestination(isPresented: $navigateToReasonScreen) {
|
|
ResiliationReasonScreen(viewModel: viewModel)
|
|
}
|
|
.sqNavigationBar(title: "Demander la résiliation")
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
ResiliationCheckStepsScreen(viewModel: ResiliationViewModel(resiliationType: .apPart))
|
|
}
|