Untitled
unknown
swift
2 years ago
6.1 kB
6
Indexable
// // MyWalletView.swift // Garageworks-iOS-Revamp // // Created by DigitalFlake Kapil Dongre on 15/01/23. // import SwiftUI struct MyWalletView: View { @Environment(\.presentationMode) var presentationMode @StateObject var getWalletHistoryObserver = GetWalletHistoryObserver() @StateObject var getCustomerWalletBalance = GetCustomerWalletObserver() @State var isShown = false var body: some View { //NavigationView{ GeometryReader{geometry in VStack{ HStack(spacing: 20){ Button(){ print("Back navigationCross button pressed") self.presentationMode.wrappedValue.dismiss() }label: { Image("arrow-left") .resizable() .frame(width: 20, height: 20) } Text("My Address View") .font(.system(size: 16, weight: .regular)) Spacer() } .padding(.leading, 20) // VStack{ // Text("MyAddressView") // } // Spacer() VStack{ VStack{ VStack{ HStack{ Image("walletPayment") .resizable() .frame(width: 60, height: 60) VStack(spacing: 5){ Text("Balance") .font(.system(size: 13)) Text("\(rsUnicode) \(getCustomerWalletBalance.customerWalletObserver?.balance ?? "")") .font(.system(size: 24)) } Spacer() Button(action: { print("Add Money to wallet pressed") isShown = true }, label: { Text("Add Money") .font(.system(size: 12)) .frame(width: 80) .foregroundColor(.white) .padding([.top, .bottom], 8) .padding([.leading, .trailing], 10) .background(.orange) .cornerRadius(10) }) .padding(.trailing, 15) } } .frame(width: geometry.size.width * 0.8, height: 90) .padding(.all, 15) .background() .cornerRadius(10) .padding(.top, 20) VStack(alignment: .leading){ Text("History") .padding(.leading, 20) ScrollView{ WalletHistoryView().environmentObject(getWalletHistoryObserver) } .padding([.top, .bottom], 20) } .padding(.top, 25) }.frame(maxWidth: UIScreen.main.bounds.width, maxHeight: UIScreen.main.bounds.height).background(Color(red: 0.945, green: 0.949, blue: 0.992)).cornerRadius(25, corners: [.topLeft, .topRight]).edgesIgnoringSafeArea(.bottom) } } .onAppear(){ getWalletHistoryObserver.getWalletHistory(customer_id: "\(UserDefaultsManager.fetchCustomer()?.customer_id! ?? "")") getCustomerWalletBalance.getCustomerWalletBalance(customer_id: "\(UserDefaultsManager.fetchCustomer()?.customer_id! ?? "")") } if(isShown){ VStack{ } .frame(width:UIScreen.main.bounds.width ,height:UIScreen.main.bounds.height,alignment: .top) .background(Color.black.opacity(0.5)) .disabled(true) AddMoneyAlertView(isShown: $isShown) // RepairsAlertView(isShowRepairsAlertView: $isShowRepairsAlertView) } // } } } func dateConverterInDDMM(dateString: String) -> String { var dayOfTheWeekString = "" // Create String let string = dateString // Create Date Formatter let dateFormatter = DateFormatter() // Set Date Format dateFormatter.dateFormat = "yy/MM/dd" // Convert String to Date var convertedDate = dateFormatter.date(from: string) let dateFormatter1 = DateFormatter() dateFormatter1.dateFormat = "dd/MM" dayOfTheWeekString = dateFormatter1.string(from: convertedDate!) // print(dayOfTheWeekString) return dayOfTheWeekString } } struct MyWalletView_Previews: PreviewProvider { static var previews: some View { MyWalletView() } }
Editor is loading...