Untitled

 avatar
unknown
swift
2 years ago
4.4 kB
5
Indexable
//
//  AddMoneyAlertView.swift
//  Garageworks-iOS-Revamp
//
//  Created by DigitalFlake Kapil Dongre on 16/01/23.
//

import SwiftUI

struct AddMoneyAlertView: View {
    
    //var booking : CustomerBookingModel.CustomerBooking
//    var booking : CustomerBookingModel.CustomerBooking
    
    @Binding var isShown: Bool
    
    @State private var amount: String = ""
    
    @StateObject var razorPayObserver: FetchWalletSDKParams = FetchWalletSDKParams()
    
    var body: some View {
        //NavigationView{
        GeometryReader {geometry in
            //NavigationView{}
            VStack{
                
                VStack(spacing: 30){
                    //1st section
                    VStack{
                        
                        HStack{
                            
                            Text("Add Money")
                            
                            Spacer()
                            Image("close-circle")
                                .onTapGesture {
                                    print("Close the alert view")
                                    isShown = false
                                }
                            //.padding(.trailing, 20)
                            
                        }
                        .padding(.bottom, 30)
                        //.frame(width: geometry.size.width * 0.9)
                        
                        VStack(alignment: .leading){
                            
                            Text("Amount")
                                .padding(.bottom, 12)
                            
                            TextField("Enter Amount", text: $amount)
                            //.frame(height: 58)
                                .padding()
                                .background(Color(hex: "\(Colors.color_bg_lightGray)"))
                                .cornerRadius(10)
                        }
                        .padding(.bottom, 30)
                        
                        NavigationLink(destination: WalletRazorView(fetchWalletSDK: razorPayObserver), tag: "complete", selection: $razorPayObserver.isLinkActive){
                            Button(action: {
                                print("Add money button pressed")
                                //                            razorPayObserver.fetchSDKParams(package_name: <#T##String#>, amount: <#T##String#>, name: <#T##String#>, mobile: <#T##String#>, email: <#T##String#>, city: <#T##String#>, payment_description: <#T##String#>, is_wallet_balance_selected: <#T##String#>, customer_id: <#T##String#>)
                                
                                razorPayObserver.fetchSDKParams(package_name:  "Wallet Recharge",
                                                                amount: amount, name: "\(UserDefaultsManager.fetchCustomer()?.name! ?? "")", mobile:  "8999153610", email: "\(UserDefaultsManager.fetchCustomer()?.email ?? "")", city: "\(UserDefaultsManager.fetchCustomer()?.city! ?? "")", payment_description: "Wallet Recharge", customer_id: "\(UserDefaultsManager.fetchCustomer()?.customer_id! ?? "")")
                                
                                
                               
                            }, label: {
                                
                                Text("Add Money")
                                    .foregroundColor(.white)
                                    .frame(width: 285)
                                    .padding([.top, .bottom], 15)
                                    .background(.orange)
                                    .cornerRadius(10)
                            })
                        }
                        
                    }
                    .frame(width: geometry.size.width * 0.7)
                    .padding()
                    .background()
                    .cornerRadius(10)
                    
                    
                    
                }
            }
            .frame(width:geometry.size.width ,height:geometry.size.height)
            //.background(.green)
            
        }
    //}
    }
    //}
}
//struct AddMoneyAlertView_Previews: PreviewProvider {
//    static var previews: some View {
//        AddMoneyAlertView(booking: <#CustomerBookingModel.CustomerBooking#>, isShown: .constant(false))
//    }
//}
Editor is loading...