@@ -20,15 +20,19 @@ struct StepsRampForm: View, QuestForm {
2020 ImageData ( id: " ramp_stroller " , type: " stroller " , imageName: " ramp_stroller " , tag: " ramp:stroller " , optionName: LocalizedStrings . questStepsRampStroller. localized) ,
2121 ImageData ( id: " ramp_wheelchair " , type: " wheelchair " , imageName: " ramp_wheelchair " , tag: " ramp:wheelchair " , optionName: LocalizedStrings . questStepsRampWheelchair. localized) ,
2222 ]
23+ var isBicycleRamp : Bool {
24+ selectedImage. contains ( " ramp:bicycle " )
25+ }
26+ var isStrollerRamp : Bool {
27+ selectedImage. contains ( " ramp:stroller " )
28+ }
2329 var body : some View {
2430 VStack ( alignment: . leading) {
2531 QuestionHeader ( icon: Image ( " ic_quest_steps_ramp " ) , title: LocalizedStrings . questStepsRampTitle. localized, subtitle: " North 88th Street " ) . padding ( . bottom, 10 )
2632 VStack ( alignment: . leading) {
2733 Text ( LocalizedStrings . select. localized) . font ( . caption) . foregroundColor ( . gray)
2834 ImageGridItemView ( gridCount: 2 , isLabelBelow: false , imageData: imageData, isImageRotated: false , isDisplayImageOnly: false , isScrollable: false , allowMultipleSelection: true , onTap: { ( selectedImage) in
29- print ( " Clicked Tag: \( selectedImage) " )
3035 } , selectedImages: $selectedImage)
31-
3236 Divider ( )
3337 HStack ( ) {
3438 Spacer ( )
@@ -43,12 +47,10 @@ struct StepsRampForm: View, QuestForm {
4347 Spacer ( )
4448 if !selectedImage. isEmpty {
4549 Button ( ) {
46- /// applying final selected answer
4750 if selectedImage. contains ( " ramp:wheelchair " ) {
4851 showWheelchairAlert = true
4952 } else {
50- //TODO: none/bicycle/stroller type answer
51- let answer = StepsRampAnswer ( bicycleRamp: true , strollerRamp: true , wheelchairRamp: . NO)
53+ let answer = StepsRampAnswer ( bicycleRamp: isBicycleRamp, strollerRamp: isStrollerRamp, wheelchairRamp: . NO)
5254 action ? ( answer)
5355 }
5456 } label: {
@@ -59,10 +61,12 @@ struct StepsRampForm: View, QuestForm {
5961 /// displayed only when selected answers contains wheelchair
6062 . alert ( LocalizedStrings . questStepsRampSeparateWheelchair. localized, isPresented: $showWheelchairAlert) {
6163 Button ( LocalizedStrings . questStepsRampSeparateWheelchairConfirm. localized. uppercased ( ) , action: {
62- //TODO: wheelchair type answer separate
64+ let answer = StepsRampAnswer ( bicycleRamp: isBicycleRamp, strollerRamp: isStrollerRamp, wheelchairRamp: WheelchairRampStatus . SEPARATE)
65+ action ? ( answer)
6366 } )
6467 Button ( LocalizedStrings . questStepsRampSeparateWheelchairDecline. localized. uppercased ( ) , action: {
65- //TODO: wheelchair type answer not separate
68+ let answer = StepsRampAnswer ( bicycleRamp: isBicycleRamp, strollerRamp: isStrollerRamp, wheelchairRamp: WheelchairRampStatus . YES)
69+ action ? ( answer)
6670 } )
6771 /// no action to be taken
6872 Button ( LocalizedStrings . questGenericConfirmationNo. localized, role: . cancel, action: { } )
0 commit comments