├── .DS_Store ├── McDonald's DBMS ├── ATR.jpg ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── CHR.jpg ├── COL.jpg ├── COM.jpg ├── COS.jpg ├── FFL.jpg ├── FFM.jpg ├── FFS.jpg ├── FLR.jpg ├── HCR.jpg ├── ITR.jpg ├── Info.plist ├── PFR.jpg ├── SCR.jpg ├── SWR.jpg ├── VER.jpg ├── invoiceViewController.swift ├── loginViewController.swift ├── menuItemCell.swift ├── menuViewController.swift ├── minus@2x.png ├── plus@2x.png ├── settings@2x.png ├── settingsViewController.swift └── welcomeView.swift ├── McDonald's DBMSTests ├── Info.plist └── McDonald_s_DBMSTests.swift ├── McDonald's DBMSUITests ├── Info.plist └── McDonald_s_DBMSUITests.swift ├── McDonalds Online.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── swapnil.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── swapnil.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── McDonald's DBMS.xcscheme │ └── xcschememanagement.plist ├── PHP ├── addRating.php ├── connect.php ├── deleteCart.php ├── getCart.php ├── getEmployee.php ├── getMenuItems.php ├── insertCustomer.php ├── insertInvoice.php ├── saveCart.php ├── updateCustomer.php └── updateOutlet.php ├── README.md ├── Screenshots ├── DBtables.png ├── ER Diagram.png ├── Relational Model.png ├── cart.png ├── invoice.png ├── invoiceTable.png ├── phoneNumber.png ├── rating.png ├── screenshots.pages ├── screenshots.pdf └── settings.png └── _config.yml /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/.DS_Store -------------------------------------------------------------------------------- /McDonald's DBMS/ATR.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/McDonald's DBMS/ATR.jpg -------------------------------------------------------------------------------- /McDonald's DBMS/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // McDonald's DBMS 4 | // 5 | // Created by Swapnil Dhanwal on 08/04/2017. 6 | // Copyright © 2017 Swapnil Dhanwal. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /McDonald's DBMS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /McDonald's DBMS/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /McDonald's DBMS/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 52 | 53 | 54 | 55 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 100 | 107 | 115 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | -------------------------------------------------------------------------------- /McDonald's DBMS/CHR.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/McDonald's DBMS/CHR.jpg -------------------------------------------------------------------------------- /McDonald's DBMS/COL.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/McDonald's DBMS/COL.jpg -------------------------------------------------------------------------------- /McDonald's DBMS/COM.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/McDonald's DBMS/COM.jpg -------------------------------------------------------------------------------- /McDonald's DBMS/COS.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/McDonald's DBMS/COS.jpg -------------------------------------------------------------------------------- /McDonald's DBMS/FFL.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/McDonald's DBMS/FFL.jpg -------------------------------------------------------------------------------- /McDonald's DBMS/FFM.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/McDonald's DBMS/FFM.jpg -------------------------------------------------------------------------------- /McDonald's DBMS/FFS.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/McDonald's DBMS/FFS.jpg -------------------------------------------------------------------------------- /McDonald's DBMS/FLR.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/McDonald's DBMS/FLR.jpg -------------------------------------------------------------------------------- /McDonald's DBMS/HCR.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/McDonald's DBMS/HCR.jpg -------------------------------------------------------------------------------- /McDonald's DBMS/ITR.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/McDonald's DBMS/ITR.jpg -------------------------------------------------------------------------------- /McDonald's DBMS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /McDonald's DBMS/PFR.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/McDonald's DBMS/PFR.jpg -------------------------------------------------------------------------------- /McDonald's DBMS/SCR.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/McDonald's DBMS/SCR.jpg -------------------------------------------------------------------------------- /McDonald's DBMS/SWR.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/McDonald's DBMS/SWR.jpg -------------------------------------------------------------------------------- /McDonald's DBMS/VER.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/McDonald's DBMS/VER.jpg -------------------------------------------------------------------------------- /McDonald's DBMS/invoiceViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // invoiceViewController.swift 3 | // McDonald's Online 4 | // 5 | // Created by Swapnil Dhanwal on 04/04/2017. 6 | // Copyright © 2017 Swapnil Dhanwal. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class invoiceViewController: UIViewController { 12 | 13 | var _user : [String : AnyObject]! 14 | var user : String! 15 | var region : String! 16 | var phone : String! 17 | var amount : String! 18 | var menuPrice : [String : Int]! 19 | var menuQuantity : [String : Int]! 20 | var menuIds : [String]! 21 | var menuNames : [String : String]! 22 | var totalAmount : Int! 23 | var orderString : String! 24 | var mainView : UIView! 25 | var billTextView : UITextView! 26 | var titleLabel : UILabel! 27 | var Eid : String! 28 | var confirmButton : UIButton! 29 | var cancelButton : UIButton! 30 | var employeeName : String! 31 | var slider : UISlider! 32 | var ratingButton : UIButton! 33 | 34 | override func viewDidLoad() { 35 | super.viewDidLoad() 36 | 37 | if UserDefaults.standard.object(forKey: "user") != nil 38 | { 39 | 40 | self._user = UserDefaults.standard.object(forKey: "user") as! [String : AnyObject] 41 | if let C_name = self._user["C_name"] as? String 42 | { 43 | 44 | self.user = C_name 45 | 46 | } 47 | if let O_name = self._user["O_name"] as? String 48 | { 49 | 50 | self.region = O_name 51 | 52 | } 53 | 54 | } 55 | 56 | self.configureMainView() 57 | // Do any additional setup after loading the view. 58 | } 59 | 60 | func configureMainView() -> Void 61 | { 62 | self.view.backgroundColor = UIColor.white 63 | 64 | //setting up the mainView 65 | self.mainView = UIView(frame: CGRect(x: self.view.bounds.width*0.1, y: self.view.bounds.height*0.1, width: self.view.bounds.width*0.8, height: self.view.bounds.height*0.8)) 66 | self.mainView.backgroundColor = UIColor.red 67 | self.mainView.layer.cornerRadius = 10 68 | self.mainView.clipsToBounds = false 69 | self.mainView.layer.shadowPath = UIBezierPath(roundedRect: self.mainView.bounds, cornerRadius: 10).cgPath 70 | self.mainView.layer.shadowOpacity = 0.3 71 | self.mainView.layer.shadowOffset = CGSize(width: -0.5, height: 0.5) 72 | self.view.addSubview(self.mainView) 73 | 74 | //setting up the titleLabel 75 | self.titleLabel = UILabel(frame: CGRect(x: 0, y: 0, width: self.mainView.bounds.width, height: self.mainView.bounds.height*0.1)) 76 | self.titleLabel.font = UIFont(name: "Avenir Book", size: 20) 77 | self.titleLabel.text = "Your Order Details" 78 | self.titleLabel.textAlignment = .center 79 | self.titleLabel.adjustsFontSizeToFitWidth = true 80 | self.titleLabel.textColor = UIColor.yellow 81 | self.mainView.addSubview(self.titleLabel) 82 | 83 | //setting up the textView 84 | self.billTextView = UITextView(frame: CGRect(x: self.mainView.bounds.width*0.1, y: self.titleLabel.frame.maxY + 10, width: self.mainView.bounds.width*0.8, height: (self.mainView.bounds.height-self.titleLabel.frame.maxY)*0.8)) 85 | self.billTextView.textContainer.lineFragmentPadding = 10 86 | let textTab = NSTextTab(textAlignment: .right, location: self.billTextView.bounds.width-20, options: [:]) 87 | let paragraphStyle = NSMutableParagraphStyle() 88 | paragraphStyle.tabStops = [textTab] 89 | var str = "Item\tAmount\n\n" 90 | var s = NSMutableAttributedString() 91 | if let f = UIFont(name: "Avenir Book", size: 18) 92 | { 93 | 94 | s = NSMutableAttributedString(string: str, attributes: [NSParagraphStyleAttributeName : paragraphStyle, NSFontAttributeName : f, NSUnderlineStyleAttributeName : NSUnderlineStyle.styleThick.rawValue]) 95 | } 96 | var total = 0 97 | for fid in self.menuIds 98 | { 99 | 100 | if (self.menuQuantity[fid]! > 0) 101 | { 102 | 103 | let str = "\(self.menuNames[fid]!) x \(self.menuQuantity[fid]!)\t\(self.menuQuantity[fid]! * self.menuPrice[fid]!)\n\n" 104 | total += self.menuQuantity[fid]! * self.menuPrice[fid]! 105 | if let f = UIFont(name: "Avenir Book", size: 17) 106 | { 107 | 108 | s.append(NSMutableAttributedString(string: str, attributes: [NSParagraphStyleAttributeName : paragraphStyle, NSFontAttributeName : f])) 109 | 110 | } 111 | 112 | 113 | } 114 | 115 | } 116 | str = "Total\t18.0% GST\n" 117 | if let f = UIFont(name: "Avenir Book", size: 18) 118 | { 119 | 120 | s.append(NSMutableAttributedString(string: str, attributes: [NSParagraphStyleAttributeName : paragraphStyle, NSFontAttributeName : f, NSUnderlineStyleAttributeName : NSUnderlineStyle.styleThick.rawValue])) 121 | str = "\(total)\t\(Float(total) * 1.18)" 122 | s.append(NSMutableAttributedString(string: str, attributes: [NSParagraphStyleAttributeName : paragraphStyle, NSFontAttributeName : f])) 123 | self.totalAmount = Int(Float(total) * 1.18) 124 | 125 | } 126 | 127 | self.billTextView.attributedText = s 128 | self.billTextView.isEditable = false 129 | self.billTextView.layer.cornerRadius = 10 130 | self.mainView.addSubview(self.billTextView) 131 | 132 | self.confirmButton = UIButton(type: .custom) 133 | self.confirmButton.frame = CGRect(x: self.mainView.bounds.width*0.1, y: self.billTextView.frame.maxY + 20, width: self.mainView.bounds.width*0.35, height: self.mainView.bounds.height*0.1) 134 | if let f = UIFont(name: "Avenir Book", size: 20) 135 | { 136 | 137 | self.confirmButton.setAttributedTitle(NSMutableAttributedString(string: "Confirm", attributes: [NSFontAttributeName : f, NSForegroundColorAttributeName : UIColor.black]), for: .normal) 138 | 139 | } 140 | self.confirmButton.titleLabel?.textAlignment = .center 141 | self.confirmButton.backgroundColor = UIColor.white 142 | self.confirmButton.layer.cornerRadius = 10 143 | self.confirmButton.addTarget(self, action: #selector(invoiceViewController.confirm), for: .touchUpInside) 144 | self.confirmButton.layer.shadowPath = UIBezierPath(roundedRect: self.confirmButton.bounds, cornerRadius: 10).cgPath 145 | self.confirmButton.layer.shadowOffset = CGSize(width: -0.5, height: 0.5) 146 | self.confirmButton.layer.shadowOpacity = 0.3 147 | self.mainView.addSubview(self.confirmButton) 148 | 149 | self.cancelButton = UIButton(type: .custom) 150 | self.cancelButton.frame = CGRect(x: self.mainView.bounds.width*0.55, y: self.billTextView.frame.maxY + 20, width: self.mainView.bounds.width*0.35, height: self.mainView.bounds.height*0.1) 151 | if let f = UIFont(name: "Avenir Book", size: 20) 152 | { 153 | 154 | self.cancelButton.setAttributedTitle(NSMutableAttributedString(string: "Cancel", attributes: [NSFontAttributeName : f, NSForegroundColorAttributeName : UIColor.black]), for: .normal) 155 | 156 | } 157 | self.cancelButton.titleLabel?.textAlignment = .center 158 | self.cancelButton.backgroundColor = UIColor.white 159 | self.cancelButton.layer.cornerRadius = 10 160 | self.cancelButton.addTarget(self, action: #selector(invoiceViewController.cancel), for: .touchUpInside) 161 | self.cancelButton.layer.shadowPath = UIBezierPath(roundedRect: self.cancelButton.bounds, cornerRadius: 10).cgPath 162 | self.cancelButton.layer.shadowOffset = CGSize(width: -0.5, height: 0.5) 163 | self.cancelButton.layer.shadowOpacity = 0.3 164 | self.mainView.addSubview(self.cancelButton) 165 | 166 | 167 | } 168 | 169 | func randRange (lower: Int , upper: Int) -> Int { 170 | 171 | return lower + Int(arc4random_uniform(UInt32(upper - lower + 1))) 172 | 173 | } 174 | 175 | //MARK : Request Sender methods 176 | 177 | func confirm() -> Void 178 | { 179 | 180 | //send order request to the restaurant 181 | self.sendRequest(orderString) { (success, result) in 182 | 183 | if success == true 184 | { 185 | let randomEid = self.randRange(lower: 1, upper: 4) 186 | self.Eid = String(randomEid) 187 | 188 | if let customer = self._user 189 | { 190 | 191 | if let Phone = customer["Phone"] as? String 192 | { 193 | 194 | if let C_name = customer["C_name"] as? String 195 | { 196 | 197 | if let region = customer["O_name"] as? String 198 | { 199 | 200 | let urlString = "http://127.0.0.1/insertInvoice.php?Phone=\(Phone)&Eid=\(String(randomEid))&CustomerName=\(C_name.addingPercentEncoding(withAllowedCharacters: .alphanumerics)!)&Amount=\(self.totalAmount!)&Region=\(region.addingPercentEncoding(withAllowedCharacters: .alphanumerics)!)" 201 | self.sendRequest(urlString, completion: { (success, result) in 202 | 203 | 204 | let urlString = "http://127.0.0.1/getEmployee.php?Eid=\(String(randomEid))®ion=\(self.region.addingPercentEncoding(withAllowedCharacters: .alphanumerics)!)" 205 | 206 | self.getEmployee(urlString, completion: { (success, result) in 207 | 208 | if success == true 209 | { 210 | 211 | for employee in result 212 | { 213 | 214 | if let E_name = employee["E_name"] as? String 215 | { 216 | 217 | self.employeeName = E_name 218 | 219 | } 220 | 221 | } 222 | self.configureRatingView() 223 | 224 | } 225 | 226 | }) 227 | 228 | 229 | 230 | }) 231 | 232 | 233 | } 234 | 235 | } 236 | 237 | } 238 | 239 | } 240 | 241 | 242 | } 243 | else 244 | { 245 | 246 | self.showAlert("Unable to process request", { 247 | 248 | //do something 249 | 250 | }) 251 | 252 | } 253 | } 254 | 255 | } 256 | 257 | func configureRatingView() -> Void 258 | { 259 | 260 | //clear mainView of all subviews 261 | if self.mainView != nil 262 | { 263 | 264 | for view in self.mainView.subviews 265 | { 266 | 267 | view.removeFromSuperview() 268 | 269 | } 270 | self.mainView.removeFromSuperview() 271 | 272 | } 273 | 274 | //setting up the mainView 275 | self.mainView = UIView(frame: CGRect(x: self.view.bounds.width*0.25, y: self.view.bounds.height*0.3, width: self.view.bounds.width*0.5, height: self.view.bounds.height*0.4)) 276 | self.mainView.backgroundColor = UIColor.red 277 | self.mainView.layer.cornerRadius = 10 278 | self.mainView.clipsToBounds = false 279 | self.mainView.layer.shadowPath = UIBezierPath(roundedRect: self.mainView.bounds, cornerRadius: 10).cgPath 280 | self.mainView.layer.shadowOpacity = 0.3 281 | self.mainView.layer.shadowOffset = CGSize(width: -0.5, height: 0.5) 282 | self.view.addSubview(self.mainView) 283 | 284 | //setting up the titleLabel 285 | self.titleLabel = UILabel(frame: CGRect(x: 0, y: 0, width: self.mainView.bounds.width, height: self.mainView.bounds.height*0.2)) 286 | self.titleLabel.font = UIFont(name: "Avenir Book", size: 20) 287 | self.titleLabel.text = "Your order was delivered by \(employeeName!)\nPlease rate your experience" 288 | self.titleLabel.numberOfLines = 0 289 | self.titleLabel.textAlignment = .center 290 | self.titleLabel.adjustsFontSizeToFitWidth = true 291 | self.titleLabel.textColor = UIColor.yellow 292 | self.mainView.addSubview(self.titleLabel) 293 | 294 | self.slider = UISlider(frame: CGRect(x: self.mainView.bounds.width*0.1, y: self.titleLabel.frame.maxY + 30, width: self.mainView.bounds.width*0.8, height: self.mainView.bounds.height*0.1)) 295 | self.slider.isContinuous = false 296 | self.slider.maximumValue = 5 297 | self.slider.minimumValue = 0 298 | self.slider.setValue(2.5, animated: true) 299 | self.slider.addTarget(self, action: #selector(invoiceViewController.sliderSlid(_:)), for: .valueChanged) 300 | self.mainView.addSubview(self.slider) 301 | 302 | self.ratingButton = UIButton(type: .custom) 303 | self.ratingButton.frame = CGRect(x: self.mainView.bounds.width*0.2, y: self.slider.frame.maxY + 30, width: self.mainView.bounds.width*0.6, height: self.mainView.bounds.height*0.1) 304 | if let f = UIFont(name: "Avenir Book", size: 20) 305 | { 306 | 307 | let s = NSMutableAttributedString(string: "Rate \(Int(self.slider.value))", attributes: [NSFontAttributeName : f, NSForegroundColorAttributeName : UIColor.black]) 308 | self.ratingButton.setAttributedTitle(s, for: .normal) 309 | 310 | } 311 | self.ratingButton.addTarget(self, action: #selector(invoiceViewController.rate(_:)), for: .touchUpInside) 312 | self.ratingButton.backgroundColor = UIColor.white 313 | self.ratingButton.layer.cornerRadius = 10 314 | self.mainView.addSubview(self.ratingButton) 315 | 316 | } 317 | 318 | func rate(_ button : UIButton) -> Void 319 | { 320 | 321 | let rating = Int(self.slider.value) 322 | let urlString = "http://127.0.0.1/addRating.php?Eid=\(self.Eid!)&Region=\(self.region.addingPercentEncoding(withAllowedCharacters: .alphanumerics)!)&Rating=\(rating)" 323 | self.sendRequest(urlString) { (success, result) in 324 | 325 | if (success == true) 326 | { 327 | 328 | self.dismiss(animated: true, completion: { 329 | 330 | //do something 331 | 332 | }) 333 | 334 | } 335 | else 336 | { 337 | 338 | self.showAlert("Could not process request", { 339 | 340 | //do something 341 | 342 | }) 343 | 344 | } 345 | 346 | } 347 | 348 | 349 | } 350 | 351 | 352 | func sliderSlid(_ slider : UISlider) -> Void 353 | { 354 | 355 | var s = NSMutableAttributedString() 356 | if let f = UIFont(name: "Avenir Book", size: 20) 357 | { 358 | 359 | s = NSMutableAttributedString(string: "Rate \(Int(slider.value))", attributes: [NSFontAttributeName : f, NSForegroundColorAttributeName : UIColor.black]) 360 | self.ratingButton.setAttributedTitle(s, for: .normal) 361 | print(Int(slider.value)) 362 | 363 | } 364 | 365 | } 366 | 367 | 368 | func cancel() -> Void 369 | { 370 | 371 | //cancel order and return to menuViewController 372 | self.dismiss(animated: true, completion: nil) 373 | 374 | } 375 | 376 | func getEmployee(_ urlString : String, completion : @escaping (_ success : Bool, _ result : [[String : AnyObject]]) -> Void) 377 | { 378 | 379 | print(urlString) 380 | var request = URLRequest(url: URL(string: urlString)!) 381 | request.httpMethod = "POST" 382 | let task = URLSession.shared.dataTask(with: request) { (data, response, error) in 383 | 384 | if error != nil 385 | { 386 | 387 | DispatchQueue.main.async(execute: { 388 | 389 | self.showAlert((error?.localizedDescription)!, { 390 | 391 | //do something 392 | completion(false, []) 393 | 394 | }) 395 | 396 | }) 397 | 398 | } 399 | 400 | else 401 | { 402 | 403 | if let data = data 404 | { 405 | DispatchQueue.main.async(execute: { 406 | 407 | do 408 | { 409 | let jsonData = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [[String : AnyObject]] 410 | completion(true, jsonData!) 411 | 412 | } 413 | catch 414 | { 415 | self.showAlert("Something went wrong", { 416 | 417 | //do something 418 | completion(false, []) 419 | 420 | }) 421 | 422 | } 423 | 424 | }) 425 | 426 | } 427 | 428 | 429 | } 430 | 431 | } 432 | 433 | task.resume() 434 | } 435 | 436 | 437 | func sendRequest(_ urlString : String, completion : @escaping (_ success : Bool, _ resultJson : [String : AnyObject]) -> Void) 438 | { 439 | 440 | print(urlString) 441 | var request = URLRequest(url: URL(string: urlString)!) 442 | request.httpMethod = "POST" 443 | let task = URLSession.shared.dataTask(with: request) { (data, response, error) in 444 | 445 | if error != nil 446 | { 447 | 448 | DispatchQueue.main.async(execute: { 449 | 450 | self.showAlert((error?.localizedDescription)!, { 451 | 452 | //do something 453 | completion(false, [:]) 454 | 455 | }) 456 | 457 | }) 458 | 459 | } 460 | 461 | else 462 | { 463 | 464 | if let data = data 465 | { 466 | DispatchQueue.main.async(execute: { 467 | 468 | do 469 | { 470 | let jsonData = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [String : AnyObject] 471 | completion(true, jsonData!) 472 | 473 | } 474 | catch 475 | { 476 | 477 | completion(false, [:]) 478 | 479 | } 480 | 481 | }) 482 | 483 | } 484 | 485 | 486 | } 487 | 488 | } 489 | 490 | task.resume() 491 | } 492 | 493 | func clearCart(_ urlString : String, completion : @escaping (_ success : Bool, _ result : [String : AnyObject]) -> Void) -> Void 494 | { 495 | 496 | let url = URL(string: urlString) 497 | var request = URLRequest(url: url!) 498 | request.httpMethod = "POST" 499 | let task = URLSession.shared.dataTask(with: request) { (data, response, error) in 500 | 501 | 502 | if let error = error 503 | { 504 | 505 | DispatchQueue.main.async(execute: { 506 | 507 | self.showAlert(error.localizedDescription, { 508 | 509 | //do something 510 | completion(false, [:]) 511 | 512 | }) 513 | 514 | }) 515 | 516 | } 517 | else 518 | { 519 | 520 | DispatchQueue.main.async(execute: { 521 | 522 | if let data = data 523 | { 524 | 525 | do 526 | { 527 | 528 | let jsonData = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [String : AnyObject] 529 | completion(true, jsonData!) 530 | 531 | } 532 | catch 533 | { 534 | 535 | self.showAlert("Something went wrong", { 536 | 537 | //do something 538 | completion(false, [:]) 539 | 540 | }) 541 | 542 | } 543 | } 544 | 545 | }) 546 | 547 | } 548 | } 549 | task.resume() 550 | 551 | 552 | } 553 | 554 | func showAlert(_ error : String, _ completion : @escaping () -> Void) -> Void 555 | { 556 | 557 | let alert = UIAlertController(title: "An Error Occurred", message: "\(error)", preferredStyle: .alert) 558 | alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { (action) in 559 | 560 | completion() 561 | 562 | })) 563 | self.present(alert, animated: true) { 564 | 565 | //do domething 566 | 567 | } 568 | 569 | } 570 | 571 | override func didReceiveMemoryWarning() { 572 | super.didReceiveMemoryWarning() 573 | // Dispose of any resources that can be recreated. 574 | } 575 | 576 | 577 | /* 578 | // MARK: - Navigation 579 | 580 | // In a storyboard-based application, you will often want to do a little preparation before navigation 581 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 582 | // Get the new view controller using segue.destinationViewController. 583 | // Pass the selected object to the new view controller. 584 | } 585 | */ 586 | 587 | } 588 | -------------------------------------------------------------------------------- /McDonald's DBMS/loginViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // McDonald's DBMS 4 | // 5 | // Created by Swapnil Dhanwal on 08/04/2017. 6 | // Copyright © 2017 Swapnil Dhanwal. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class loginViewController: UIViewController, UITextFieldDelegate, UIPickerViewDelegate, UIPickerViewDataSource { 12 | 13 | var user : [String : AnyObject]! 14 | var region : String! 15 | var welcome : welcomeView! 16 | var phoneNumberView : UIView! 17 | var mainView : UIView! 18 | var phoneLabel : UILabel! 19 | var phoneTextField : UITextField! 20 | var addressTextField : UITextField! 21 | var nameTextField : UITextField! 22 | var phoneButton : UIButton! 23 | var phoneNumber : String? 24 | var pickerView = UIPickerView() 25 | var goButton : UIButton! 26 | var regionsArray : [String]! 27 | var detailsLabel : UILabel! 28 | 29 | 30 | override func viewDidLoad() { 31 | super.viewDidLoad() 32 | 33 | 34 | // Do any additional setup after loading the view, typically from a nib. 35 | } 36 | 37 | override func viewDidAppear(_ animated: Bool) { 38 | 39 | if UserDefaults.standard.object(forKey: "user") != nil 40 | { 41 | 42 | self.user = UserDefaults.standard.object(forKey: "user") as! [String : AnyObject] 43 | for _view in self.view.subviews 44 | { 45 | 46 | _view.removeFromSuperview() 47 | 48 | } 49 | self.configurePhoneNumberView() 50 | } 51 | 52 | if UserDefaults.standard.object(forKey: "user") == nil 53 | { 54 | 55 | //remove all views 56 | for _view in self.view.subviews 57 | { 58 | 59 | _view.removeFromSuperview() 60 | 61 | } 62 | 63 | 64 | //show the welcome screen 65 | let welcomeFrame = CGRect(x: self.view.bounds.width/2-self.view.bounds.width*0.8/2, y: self.view.bounds.height/2-self.view.bounds.height*0.6/2, width: self.view.bounds.width*0.8, height: self.view.bounds.height*0.6) 66 | 67 | self.welcome = welcomeView(welcomeFrame, ["Welcome to McDonald's Online", "If you are an existing customer, please provide your details!"], UIColor.red, UIColor.white, UIColor.white, { 68 | 69 | print("show login controls") 70 | //add keyboard selector 71 | NotificationCenter.default.addObserver(self, selector: #selector(loginViewController.keyboardWillShow(_:)), name: .UIKeyboardWillShow, object: nil) 72 | NotificationCenter.default.addObserver(self, selector: #selector(loginViewController.keyboardWillHide(_:)), name: .UIKeyboardWillHide, object: nil) 73 | self.configurePhoneNumberView() 74 | 75 | }) 76 | 77 | self.view.addSubview(welcome) 78 | 79 | 80 | } 81 | else 82 | { 83 | // print(user) 84 | //load menu 85 | self.performSegue(withIdentifier: "showMenuSegue", sender: self) 86 | 87 | } 88 | 89 | 90 | } 91 | 92 | override func viewWillDisappear(_ animated: Bool) { 93 | 94 | NotificationCenter.default.removeObserver(self) 95 | 96 | } 97 | 98 | func configurePhoneNumberView() -> Void 99 | { 100 | 101 | 102 | self.phoneNumberView = UIView(frame: CGRect(x: self.view.bounds.width*0.05, y: self.view.bounds.height*0.4, width: self.view.bounds.width*0.9, height: self.view.bounds.height*0.2)) 103 | self.phoneNumberView.backgroundColor = UIColor.red 104 | self.phoneNumberView.layer.cornerRadius = 10 105 | let path = UIBezierPath(roundedRect: self.phoneNumberView.bounds, cornerRadius: 10) 106 | self.phoneNumberView.layer.shadowPath = path.cgPath 107 | self.phoneNumberView.layer.shadowOffset = CGSize(width: -0.5, height: 0.5) 108 | self.phoneNumberView.layer.shadowOpacity = 0.3 109 | self.phoneNumberView.alpha = 0 110 | self.view.addSubview(self.phoneNumberView) 111 | 112 | self.phoneLabel = UILabel(frame: CGRect(x: self.phoneNumberView.bounds.width*0.10, y: self.phoneNumberView.bounds.height*0.10, width: self.phoneNumberView.bounds.width*0.35, height: self.phoneNumberView.bounds.height/5)) 113 | self.phoneLabel.text = "Phone number" 114 | self.phoneLabel.font = UIFont(name: "Avenir Book", size: 18) 115 | self.phoneLabel.adjustsFontSizeToFitWidth = true 116 | self.phoneLabel.textColor = UIColor.white 117 | self.phoneLabel.backgroundColor = UIColor.clear 118 | self.phoneNumberView.addSubview(self.phoneLabel) 119 | 120 | self.phoneTextField = UITextField(frame: CGRect(x: self.phoneNumberView.bounds.width*0.90-self.phoneNumberView.bounds.width*0.35, y: self.phoneNumberView.bounds.height*0.10, width: self.phoneNumberView.bounds.width*0.4, height: self.phoneNumberView.bounds.height/5)) 121 | self.phoneTextField.backgroundColor = UIColor.white 122 | self.phoneTextField.font = UIFont(name: "Avenir Book", size: 18) 123 | self.phoneTextField.textColor = UIColor.black 124 | self.phoneTextField.layer.cornerRadius = 10 125 | self.phoneTextField.delegate = self 126 | self.phoneNumberView.addSubview(self.phoneTextField) 127 | 128 | self.phoneButton = UIButton(type: .custom) 129 | self.phoneButton.frame = CGRect(x: self.phoneNumberView.bounds.width/2-self.phoneNumberView.bounds.width*0.5/2, y: (self.phoneNumberView.bounds.height-self.phoneTextField.bounds.maxY)/2 + self.phoneNumberView.bounds.width/2*0.2, width: self.phoneNumberView.bounds.width*0.5, height: self.phoneNumberView.bounds.height*0.2) 130 | self.phoneButton.backgroundColor = UIColor.white 131 | self.phoneButton.layer.cornerRadius = 10 132 | var s = NSMutableAttributedString() 133 | if let f = UIFont(name: "Avenir Book", size: 15) 134 | { 135 | 136 | s = NSMutableAttributedString(string: "OK", attributes: [NSFontAttributeName : f]) 137 | 138 | } 139 | self.phoneButton.setAttributedTitle(s, for: .normal) 140 | self.phoneButton.addTarget(self, action: #selector(loginViewController.ok), for: .touchUpInside) 141 | self.phoneNumberView.addSubview(phoneButton) 142 | 143 | //animation 144 | self.phoneNumberView.layer.setAffineTransform(CGAffineTransform(scaleX: 0.5, y: 0.5)) 145 | UIView.animate(withDuration: 0.3, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.5, options: [], animations: { 146 | 147 | self.phoneNumberView.alpha = 1 148 | self.phoneNumberView.layer.setAffineTransform(CGAffineTransform.identity) 149 | 150 | }) { (success) in 151 | 152 | //do something after animation completes 153 | 154 | } 155 | 156 | 157 | } 158 | 159 | func ok() -> Void 160 | { 161 | 162 | if (self.phoneTextField != nil) 163 | { 164 | 165 | self.phoneTextField.resignFirstResponder() 166 | 167 | } 168 | 169 | if (self.phoneTextField.text == "") 170 | { 171 | 172 | showAlert("Please enter a number", { 173 | 174 | self.phoneTextField.text = "" 175 | 176 | }) 177 | return; 178 | 179 | } 180 | 181 | if ((self.phoneTextField.text?.characters.count)! < 10) 182 | { 183 | 184 | showAlert("Please enter a valid phone number", { 185 | 186 | self.phoneTextField.text = "" 187 | 188 | }) 189 | return; 190 | 191 | } 192 | 193 | for c in (self.phoneTextField.text?.unicodeScalars)! 194 | { 195 | let value = c.value 196 | if !((value >= 48 && value <= 57)) 197 | { 198 | 199 | showAlert("Please enter only alphanumeric characters", { 200 | 201 | self.phoneTextField.text = "" 202 | 203 | }) 204 | return; 205 | 206 | } 207 | 208 | } 209 | 210 | self.phoneNumber = self.phoneTextField.text 211 | //remove phoneNumberView from the screen 212 | UIView.animate(withDuration: 0.3, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.5, options: [], animations: { 213 | 214 | self.phoneNumberView.alpha = 0 215 | self.phoneNumberView.layer.setAffineTransform(CGAffineTransform(scaleX: 0.5, y: 0.5)) 216 | 217 | }) { (success) in 218 | 219 | //do something after animation completes 220 | //show the mainView here 221 | self.getCustomer("http://127.0.0.1/connect.php?number=\(self.phoneNumber!)", { (success, result) in 222 | 223 | if success == true 224 | { 225 | 226 | DispatchQueue.main.async(execute: { 227 | 228 | if result.count == 0 229 | { 230 | 231 | //user does not exist. Create a new entry in the database for user 232 | //show mainView 233 | self.configureAddressScreen() 234 | 235 | } 236 | else 237 | { 238 | 239 | //proceed to main menu 240 | for customer in result 241 | { 242 | 243 | self.user = customer 244 | UserDefaults.standard.set(self.user, forKey: "user") 245 | self.performSegue(withIdentifier: "showMenuSegue", sender: nil) 246 | 247 | } 248 | 249 | 250 | } 251 | 252 | }) 253 | 254 | } 255 | else 256 | { 257 | 258 | self.showAlert("An error occurred", { 259 | 260 | //do something 261 | 262 | }) 263 | 264 | } 265 | 266 | }) 267 | 268 | 269 | } 270 | 271 | } 272 | 273 | //show the user details view 274 | func configureAddressScreen() -> Void 275 | { 276 | 277 | self.mainView = UIView(frame: CGRect(x: self.view.bounds.width/2-self.view.bounds.width*0.8/2, y: self.view.bounds.height/2-self.view.bounds.height*0.8/2, width: self.view.bounds.width*0.8, height: self.view.bounds.height*0.8)) 278 | self.mainView.backgroundColor = UIColor.red 279 | self.mainView.layer.cornerRadius = 10 280 | let path = UIBezierPath(roundedRect: self.mainView.bounds, cornerRadius: 10) 281 | self.mainView.layer.shadowPath = path.cgPath 282 | self.mainView.layer.shadowOffset = CGSize(width: -0.5, height: 0.5) 283 | self.mainView.layer.shadowOpacity = 0.3 284 | self.view.addSubview(self.mainView) 285 | 286 | 287 | //remove all subviews in mainView just in case 288 | for view in self.mainView.subviews 289 | { 290 | 291 | view.removeFromSuperview() 292 | 293 | } 294 | 295 | //configure detailLabel 296 | self.detailsLabel = UILabel(frame: CGRect(x: self.mainView.bounds.width*0.1, y: 297 | 0, width: self.mainView.bounds.width*0.8, height: self.mainView.bounds.height*0.1)) 298 | self.detailsLabel.font = UIFont(name: "Avenir Book", size: 18) 299 | self.detailsLabel.textAlignment = .center 300 | self.detailsLabel.text = "Enter your details" 301 | self.mainView.addSubview(self.detailsLabel) 302 | 303 | //configure nameTextField 304 | self.nameTextField = UITextField(frame: CGRect(x: self.mainView.bounds.width*0.1, y: self.detailsLabel.frame.maxY + 10, width: self.mainView.bounds.width*0.8, height: self.mainView.bounds.height*0.1)) 305 | self.nameTextField.placeholder = "Enter your name" 306 | self.nameTextField.font = UIFont(name: "Avenir Book", size: 15) 307 | self.nameTextField.textAlignment = .center 308 | self.nameTextField.adjustsFontSizeToFitWidth = true 309 | self.nameTextField.backgroundColor = UIColor.white 310 | self.nameTextField.layer.cornerRadius = 10 311 | self.nameTextField.keyboardType = .asciiCapable 312 | self.nameTextField.delegate = self 313 | self.mainView.addSubview(nameTextField) 314 | 315 | //configure phoneTextField 316 | self.addressTextField = UITextField(frame: CGRect(x: self.mainView.bounds.width*0.1, y: self.nameTextField.frame.maxY + self.mainView.bounds.height*0.1, width: self.mainView.bounds.width*0.8, height: self.mainView.bounds.height*0.1)) 317 | self.addressTextField.placeholder = "Enter your street address" 318 | self.addressTextField.font = UIFont(name: "Avenir Book", size: 15) 319 | self.addressTextField.adjustsFontSizeToFitWidth = true 320 | self.addressTextField.textAlignment = .center 321 | self.addressTextField.layer.cornerRadius = 10 322 | self.addressTextField.backgroundColor = UIColor.white 323 | self.addressTextField.keyboardType = .asciiCapable 324 | self.addressTextField.delegate = self 325 | self.mainView.addSubview(addressTextField) 326 | 327 | //configure pickerView 328 | self.pickerView = UIPickerView(frame: CGRect(x: self.mainView.bounds.width*0.1, y: self.addressTextField.frame.maxY + self.mainView.bounds.height*0.1, width: self.mainView.bounds.width*0.8, height: self.mainView.bounds.height*0.2)) 329 | self.pickerView.backgroundColor = UIColor.white 330 | self.pickerView.layer.cornerRadius = 10 331 | self.pickerView.delegate = self 332 | self.pickerView.dataSource = self 333 | self.regionsArray = ["North Delhi", "South Delhi", "East Delhi", "West Delhi"] 334 | self.pickerView.reloadAllComponents() 335 | self.mainView.addSubview(self.pickerView) 336 | 337 | //configure Go button 338 | self.goButton = UIButton(type: .custom) 339 | self.goButton.frame = CGRect(x: self.mainView.bounds.width/2 - self.mainView.bounds.width*0.3/2, y: self.pickerView.frame.maxY + self.mainView.bounds.height*0.1, width: self.mainView.bounds.width*0.3, height: self.mainView.bounds.height*0.1) 340 | self.goButton.addTarget(self, action: #selector(loginViewController.go), for: .touchUpInside) 341 | var s = NSMutableAttributedString() 342 | if let f = UIFont(name: "Avenir Book", size: 20) 343 | { 344 | 345 | s = NSMutableAttributedString(string: "Go!", attributes: [NSFontAttributeName : f]) 346 | 347 | } 348 | self.goButton.layer.cornerRadius = 10 349 | self.goButton.backgroundColor = UIColor.white 350 | self.goButton.setAttributedTitle(s, for: .normal) 351 | self.mainView.addSubview(self.goButton) 352 | 353 | } 354 | 355 | //Function to send request to server to insert new user into the DB 356 | func go() -> Void 357 | { 358 | 359 | 360 | self.region = self.regionsArray[self.pickerView.selectedRow(inComponent: 0)] 361 | 362 | let _region = self.region.addingPercentEncoding(withAllowedCharacters: .alphanumerics) 363 | let name = self.nameTextField.text?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) 364 | let streetAddress = self.addressTextField.text?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) 365 | 366 | let urlString = "http://127.0.0.1/insertCustomer.php?name=\(name!)&streetAddress=\(streetAddress!)®ion=\(_region!)&phoneNumber=\(self.phoneNumber!)" 367 | 368 | self.addCustomer(urlString) { (success, result) in 369 | 370 | if (success == true) 371 | { 372 | 373 | print("user added!") 374 | if result.count > 0 375 | { 376 | 377 | for customer in result 378 | { 379 | 380 | self.user = customer 381 | UserDefaults.standard.set(self.user, forKey: "user") 382 | self.performSegue(withIdentifier: "showMenuSegue", sender: self) 383 | 384 | } 385 | 386 | } 387 | 388 | } 389 | 390 | } 391 | 392 | } 393 | 394 | 395 | //MARK : Keyboard notifications 396 | 397 | func keyboardWillShow(_ notification : NSNotification) -> Void 398 | { 399 | 400 | let keyboardFrame = (notification.userInfo![UIKeyboardFrameEndUserInfoKey] as! NSValue).cgRectValue 401 | if (self.phoneTextField != nil) 402 | { 403 | 404 | if (keyboardFrame.minY < self.phoneTextField.frame.maxY) 405 | { 406 | 407 | let dy = self.phoneTextField.frame.maxY - keyboardFrame.minY 408 | UIView.animate(withDuration: 0.3, animations: { 409 | 410 | self.phoneTextField.layer.setAffineTransform(CGAffineTransform(translationX: 0, y: dy)) 411 | 412 | }) 413 | 414 | 415 | } 416 | 417 | } 418 | else if (self.addressTextField != nil) 419 | { 420 | 421 | if (keyboardFrame.minY < self.addressTextField.frame.maxY) 422 | { 423 | 424 | let dy = self.addressTextField.frame.maxY - keyboardFrame.minY 425 | UIView.animate(withDuration: 0.3, animations: { 426 | 427 | self.addressTextField.layer.setAffineTransform(CGAffineTransform(translationX: 0, y: dy)) 428 | 429 | }) 430 | 431 | 432 | } 433 | 434 | } 435 | else if (self.nameTextField != nil) 436 | { 437 | 438 | if (keyboardFrame.minY < self.nameTextField.frame.maxY) 439 | { 440 | 441 | let dy = self.nameTextField.frame.maxY - keyboardFrame.minY 442 | UIView.animate(withDuration: 0.3, animations: { 443 | 444 | self.nameTextField.layer.setAffineTransform(CGAffineTransform(translationX: 0, y: dy)) 445 | 446 | }) 447 | 448 | 449 | } 450 | 451 | 452 | } 453 | 454 | } 455 | 456 | func keyboardWillHide(_ notification : NSNotification) -> Void 457 | { 458 | 459 | UIView.animate(withDuration: 0.3, animations: { 460 | 461 | if (self.phoneTextField != nil) 462 | { 463 | 464 | self.phoneTextField.layer.setAffineTransform(CGAffineTransform.identity) 465 | 466 | 467 | } 468 | if (self.addressTextField != nil) 469 | { 470 | 471 | self.addressTextField.layer.setAffineTransform(CGAffineTransform.identity) 472 | 473 | } 474 | if (self.nameTextField != nil) 475 | { 476 | 477 | self.addressTextField.layer.setAffineTransform(CGAffineTransform.identity) 478 | 479 | } 480 | 481 | }) 482 | 483 | 484 | } 485 | 486 | func getCustomer(_ urlString : String, _ completion : @escaping (_ success : Bool, _ result : [[String : AnyObject]]) -> Void) -> Void 487 | { 488 | 489 | var request = URLRequest(url: URL(string: urlString)!) 490 | request.httpMethod = "POST" 491 | print(urlString) 492 | let task = URLSession.shared.dataTask(with: request) { (data, response, error) in 493 | 494 | if let error = error 495 | { 496 | 497 | DispatchQueue.main.async(execute: { 498 | 499 | self.showAlert("\(error.localizedDescription)", { 500 | 501 | completion(false, []) 502 | 503 | }) 504 | 505 | }) 506 | 507 | } 508 | else 509 | { 510 | DispatchQueue.main.async(execute: { 511 | 512 | if let data = data 513 | { 514 | 515 | do 516 | { 517 | 518 | let jsonData = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [[String : AnyObject]] 519 | 520 | completion(true, jsonData!) 521 | 522 | } 523 | catch 524 | { 525 | 526 | self.showAlert("Unable to fetch data", { 527 | 528 | completion(false, []) 529 | 530 | }) 531 | 532 | } 533 | 534 | } 535 | 536 | }) 537 | 538 | } 539 | 540 | } 541 | task.resume() 542 | 543 | 544 | } 545 | 546 | func addCustomer(_ urlString : String, _ completion : @escaping (_ success : Bool, _ result : [[String : AnyObject]]) -> Void) -> Void 547 | { 548 | 549 | var request = URLRequest(url: URL(string: urlString)!) 550 | request.httpMethod = "POST" 551 | print(urlString) 552 | let task = URLSession.shared.dataTask(with: request) { (data, response, error) in 553 | 554 | if let error = error 555 | { 556 | 557 | DispatchQueue.main.async(execute: { 558 | 559 | self.showAlert(error.localizedDescription, { 560 | 561 | //do something 562 | completion(false, []) 563 | 564 | }) 565 | 566 | }) 567 | 568 | } 569 | else 570 | { 571 | 572 | DispatchQueue.main.async(execute: { 573 | 574 | if let data = data 575 | { 576 | 577 | do 578 | { 579 | 580 | let jsonData = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [[String : AnyObject]] 581 | 582 | completion(true, jsonData!) 583 | 584 | } 585 | catch 586 | { 587 | 588 | self.showAlert("Could not connect to the server", { 589 | 590 | completion(false, []) 591 | 592 | }) 593 | 594 | } 595 | 596 | } 597 | 598 | }) 599 | 600 | } 601 | 602 | } 603 | task.resume() 604 | 605 | } 606 | 607 | func showAlert(_ error : String, _ completion : @escaping () -> Void) -> Void 608 | { 609 | 610 | let alert = UIAlertController(title: "An Error Occurred", message: "\(error)", preferredStyle: .alert) 611 | alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { (action) in 612 | 613 | completion() 614 | 615 | })) 616 | self.present(alert, animated: true) { 617 | 618 | //do domething 619 | 620 | } 621 | 622 | } 623 | 624 | //MARK : Delegate and Datasource methods 625 | 626 | internal func numberOfComponents(in pickerView: UIPickerView) -> Int 627 | { 628 | 629 | return 1 630 | 631 | } 632 | 633 | internal func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int 634 | { 635 | 636 | return self.regionsArray.count 637 | 638 | } 639 | 640 | 641 | func pickerView(_ pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? { 642 | 643 | var s = NSMutableAttributedString() 644 | if let f = UIFont(name: "Avenir Book", size: 18) 645 | { 646 | 647 | s = NSMutableAttributedString(string: self.regionsArray[row], attributes: [NSFontAttributeName : f]) 648 | 649 | } 650 | return s 651 | 652 | } 653 | 654 | func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat { 655 | 656 | if component == 0 657 | { 658 | 659 | return 20 660 | 661 | } 662 | return 10 663 | 664 | } 665 | 666 | //UITextField delegate methods 667 | 668 | func textFieldDidEndEditing(_ textField: UITextField, reason: UITextFieldDidEndEditingReason) { 669 | 670 | for c in (textField.text?.unicodeScalars)! 671 | { 672 | let value = c.value 673 | if !((value >= 65 && value <= 90) || (value >= 97 && value <= 122) || (value >= 48 && value <= 57) || c == " " || c == ",") 674 | { 675 | 676 | showAlert("Please enter only alphanumeric characters", { 677 | 678 | textField.text = "" 679 | textField.resignFirstResponder() 680 | 681 | }) 682 | 683 | } 684 | 685 | } 686 | 687 | } 688 | 689 | func textFieldShouldReturn(_ textField: UITextField) -> Bool { 690 | 691 | textField.resignFirstResponder() 692 | return true 693 | 694 | } 695 | 696 | 697 | override func didReceiveMemoryWarning() { 698 | super.didReceiveMemoryWarning() 699 | // Dispose of any resources that can be recreated. 700 | } 701 | 702 | 703 | } 704 | 705 | -------------------------------------------------------------------------------- /McDonald's DBMS/menuItemCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // menuItemCell.swift 3 | // McDonald's Online 4 | // 5 | // Created by Swapnil Dhanwal on 04/04/2017. 6 | // Copyright © 2017 Swapnil Dhanwal. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class menuItemCell: UITableViewCell { 12 | 13 | @IBOutlet weak var paddingView: UIView! 14 | @IBOutlet weak var itemName: UILabel! 15 | @IBOutlet weak var quantity: UILabel! 16 | @IBOutlet weak var thumbnailImageView: UIImageView! 17 | 18 | @IBOutlet weak var plusOutlet: UIButton! 19 | 20 | @IBOutlet weak var minusOutlet: UIButton! 21 | 22 | @IBAction func plus(_ sender: Any) { 23 | 24 | quantity.text = String(Int(quantity.text!)! + 1) 25 | 26 | } 27 | @IBAction func minus(_ sender: Any) { 28 | 29 | 30 | if (quantity.text != "0") 31 | { 32 | 33 | quantity.text = String(Int(quantity.text!)! - 1) 34 | 35 | } 36 | 37 | } 38 | 39 | 40 | 41 | override func awakeFromNib() { 42 | super.awakeFromNib() 43 | // Initialization code 44 | } 45 | 46 | override func setSelected(_ selected: Bool, animated: Bool) { 47 | super.setSelected(selected, animated: animated) 48 | 49 | // Configure the view for the selected state 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /McDonald's DBMS/menuViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // menuViewController.swift 3 | // McDonald's Online 4 | // 5 | // Created by Swapnil Dhanwal on 04/04/2017. 6 | // Copyright © 2017 Swapnil Dhanwal. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class menuViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { 12 | 13 | 14 | @IBOutlet weak var nameLabel: UILabel! 15 | @IBOutlet weak var menuTableView: UITableView! 16 | var region : String! 17 | var _user : [String : AnyObject]! 18 | var user : String! 19 | var menuItems : [String]! 20 | var menuIds = [String]() 21 | var menuQuantity = [String : Int]() 22 | var menuPrices = [String : Int]() 23 | var menuNames = [String : String]() 24 | @IBOutlet weak var placeOrderOutlet: UIButton! 25 | 26 | @IBAction func placeOrder(_ sender: Any) { 27 | 28 | //send request to place order 29 | let orderString = self.generateOrderString() 30 | 31 | if (orderString == "") 32 | { 33 | 34 | showAlert("Please select at least one menu item", { 35 | 36 | //do something 37 | 38 | }) 39 | 40 | } 41 | else 42 | { 43 | 44 | let updateOutletString = "http://127.0.0.1/updateOutlet.php?region=\(region.addingPercentEncoding(withAllowedCharacters: .alphanumerics)!)&\(orderString)" 45 | 46 | if let customer = self._user 47 | { 48 | 49 | if let Phone = customer["Phone"] as? String 50 | { 51 | 52 | 53 | let clearUrlString = "http://127.0.0.1/deleteCart.php?number=\(Phone)®ion=\(self.region.addingPercentEncoding(withAllowedCharacters: .alphanumerics)!)" 54 | 55 | self.clearCart(clearUrlString, completion: { (success, result) in 56 | 57 | if success == true 58 | { 59 | 60 | let urlString = "http://127.0.0.1/saveCart.php?number=\(Phone)®ion=\(self.region.addingPercentEncoding(withAllowedCharacters: .alphanumerics)!)&\(orderString)" 61 | 62 | self.saveCart(urlString, completion: { (success, result) in 63 | 64 | if success == true 65 | { 66 | 67 | let invoiceVC = invoiceViewController() 68 | invoiceVC.region = self.region 69 | invoiceVC.menuIds = self.menuIds 70 | invoiceVC.menuQuantity = self.menuQuantity 71 | invoiceVC.menuPrice = self.menuPrices 72 | invoiceVC.menuNames = self.menuNames 73 | invoiceVC.orderString = updateOutletString 74 | self.present(invoiceVC, animated: true, completion: nil) 75 | 76 | } 77 | 78 | }) 79 | 80 | 81 | } 82 | 83 | }) 84 | 85 | 86 | } 87 | 88 | } 89 | 90 | } 91 | } 92 | 93 | override func viewWillAppear(_ animated: Bool) { 94 | 95 | if UserDefaults.standard.object(forKey: "user") != nil 96 | { 97 | 98 | self._user = UserDefaults.standard.object(forKey: "user") as! [String : AnyObject] 99 | if let C_name = self._user["C_name"] as? String 100 | { 101 | 102 | self.user = C_name 103 | 104 | } 105 | if let O_name = self._user["O_name"] as? String 106 | { 107 | 108 | self.region = O_name 109 | 110 | } 111 | 112 | 113 | 114 | self.nameLabel.adjustsFontSizeToFitWidth = true 115 | self.nameLabel.text = "Welcome \(self.user!)!" 116 | 117 | self.menuItems.removeAll() 118 | self.menuIds.removeAll() 119 | self.menuPrices.removeAll() 120 | self.menuNames.removeAll() 121 | self.menuQuantity.removeAll() 122 | 123 | let urlString = "http://127.0.0.1/getMenuItems.php?region=\(self.region.addingPercentEncoding(withAllowedCharacters: .alphanumerics)!)" 124 | self.getMenu(urlString) { (success, result) in 125 | 126 | if (success == true) 127 | { 128 | 129 | for item in result 130 | { 131 | 132 | if let F_name = item["F_name"] as? String 133 | { 134 | 135 | self.menuItems.append(F_name) 136 | 137 | } 138 | if let F_id = item["F_id"] as? String 139 | { 140 | 141 | self.menuIds.append(F_id) 142 | self.menuQuantity[F_id] = 0 143 | 144 | if let F_price = item["F_price"] as? String 145 | { 146 | 147 | self.menuPrices[F_id] = Int(F_price) 148 | 149 | } 150 | 151 | if let F_name = item["F_name"] as? String 152 | { 153 | 154 | self.menuNames[F_id] = F_name 155 | 156 | } 157 | 158 | } 159 | 160 | } 161 | 162 | if let customer = self._user 163 | { 164 | 165 | if let number = customer["Phone"] as? String 166 | { 167 | 168 | let urlString = "http://127.0.0.1/getCart.php?number=\(number)" 169 | self.getCart(urlString, completion: { (success, result) in 170 | 171 | if (success == true) 172 | { 173 | 174 | for item in result 175 | { 176 | 177 | if let F_id = item["F_id"] as? String 178 | { 179 | 180 | if let qty = item["Qty"] as? String 181 | { 182 | 183 | self.menuQuantity[F_id] = Int(qty) 184 | 185 | } 186 | 187 | } 188 | 189 | } 190 | self.menuTableView.reloadData() 191 | 192 | } 193 | 194 | }) 195 | 196 | } 197 | 198 | } 199 | 200 | } 201 | 202 | } 203 | 204 | 205 | } 206 | else 207 | { 208 | 209 | self.dismiss(animated: true, completion: { 210 | 211 | //do something 212 | 213 | }) 214 | 215 | } 216 | 217 | 218 | } 219 | 220 | override func viewDidLoad() { 221 | super.viewDidLoad() 222 | 223 | //configure tableView 224 | if UserDefaults.standard.object(forKey: "user") == nil 225 | { 226 | 227 | self.dismiss(animated: true, completion: { 228 | 229 | //do something 230 | 231 | }) 232 | 233 | } 234 | self.configureView() 235 | 236 | } 237 | 238 | //MARK : UI Configuration 239 | 240 | func configureView() -> Void 241 | { 242 | 243 | self.menuTableView.delegate = self 244 | self.menuTableView.dataSource = self 245 | self.menuItems = [] 246 | self.menuIds = [] 247 | self.menuTableView.separatorColor = UIColor.clear 248 | self.placeOrderOutlet.layer.cornerRadius = 10 249 | self.placeOrderOutlet.layer.shadowPath = UIBezierPath(roundedRect: self.placeOrderOutlet.bounds, cornerRadius: 10).cgPath 250 | self.placeOrderOutlet.layer.shadowOffset = CGSize(width: -0.5, height: 0.5) 251 | self.placeOrderOutlet.layer.shadowOpacity = 0.4 252 | 253 | 254 | 255 | } 256 | 257 | //MARK : Request sender methods 258 | 259 | func generateOrderString() -> String 260 | { 261 | 262 | var orderString = "" 263 | 264 | for fid in self.menuIds 265 | { 266 | var partialString = "" 267 | if (self.menuQuantity[fid]! > 0) 268 | { 269 | 270 | let cost : Int = self.menuQuantity[fid]! //* self.menuPrices[fid]!; 271 | partialString = "\(fid)=\(cost)&" 272 | 273 | } 274 | if (orderString == "") 275 | { 276 | orderString = partialString 277 | } 278 | else 279 | { 280 | orderString.append(partialString) 281 | } 282 | } 283 | 284 | return String(orderString.characters.dropLast()) 285 | 286 | } 287 | 288 | func getCart(_ urlString : String, completion : @escaping (_ success : Bool, _ result : [[String : AnyObject]]) -> Void) -> Void 289 | { 290 | 291 | let url = URL(string : urlString) 292 | var request = URLRequest(url: url!) 293 | request.httpMethod = "POST" 294 | let task = URLSession.shared.dataTask(with: request) { (data, response, error) in 295 | 296 | if let error = error 297 | { 298 | 299 | DispatchQueue.main.async(execute: { 300 | 301 | self.showAlert(error.localizedDescription, { 302 | 303 | //do something 304 | completion(false, []) 305 | 306 | }) 307 | 308 | }) 309 | 310 | } 311 | else 312 | { 313 | DispatchQueue.main.async(execute: { 314 | 315 | if let data = data 316 | { 317 | 318 | do 319 | { 320 | 321 | let jsonData = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [[String : AnyObject]] 322 | completion(true, jsonData!) 323 | 324 | } 325 | catch 326 | { 327 | 328 | self.showAlert("Something went wrong", { 329 | 330 | completion(false, []) 331 | 332 | }) 333 | 334 | } 335 | 336 | } 337 | 338 | 339 | }) 340 | 341 | } 342 | 343 | } 344 | task.resume() 345 | 346 | } 347 | 348 | func getMenu(_ urlString : String, completion : @escaping (_ success : Bool, _ resultJson : [[String : AnyObject]]) -> Void) 349 | { 350 | 351 | var request = URLRequest(url: URL(string: urlString)!) 352 | request.httpMethod = "POST" 353 | let task = URLSession.shared.dataTask(with: request) { (data, response, error) in 354 | 355 | if error != nil 356 | { 357 | 358 | DispatchQueue.main.async(execute: { 359 | 360 | self.showAlert((error?.localizedDescription)!, { 361 | 362 | //do something 363 | 364 | }) 365 | 366 | }) 367 | 368 | } 369 | 370 | else 371 | { 372 | 373 | if let data = data 374 | { 375 | DispatchQueue.main.async(execute: { 376 | 377 | do 378 | { 379 | let jsonData = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [[String : AnyObject]] 380 | completion(true, jsonData!) 381 | 382 | } 383 | catch 384 | { 385 | 386 | //do something 387 | completion(false, []) 388 | 389 | } 390 | 391 | }) 392 | 393 | } 394 | 395 | 396 | } 397 | 398 | } 399 | 400 | task.resume() 401 | } 402 | 403 | func saveCart(_ urlString : String, completion : @escaping (_ success : Bool, _ result : [String : AnyObject]) -> Void) -> Void 404 | { 405 | 406 | let url = URL(string: urlString) 407 | print(urlString) 408 | var request = URLRequest(url: url!) 409 | request.httpMethod = "POST" 410 | let task = URLSession.shared.dataTask(with: request) { (data, response, error) in 411 | 412 | 413 | if let error = error 414 | { 415 | 416 | DispatchQueue.main.async(execute: { 417 | 418 | self.showAlert(error.localizedDescription, { 419 | 420 | //do something 421 | completion(false, [:]) 422 | 423 | }) 424 | 425 | }) 426 | 427 | } 428 | else 429 | { 430 | 431 | DispatchQueue.main.async(execute: { 432 | 433 | if let data = data 434 | { 435 | 436 | do 437 | { 438 | 439 | let jsonData = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [String : AnyObject] 440 | completion(true, jsonData!) 441 | 442 | } 443 | catch 444 | { 445 | 446 | self.showAlert("Something went wrong", { 447 | 448 | //do something 449 | completion(false, [:]) 450 | 451 | }) 452 | 453 | } 454 | } 455 | 456 | }) 457 | 458 | } 459 | } 460 | task.resume() 461 | } 462 | 463 | func clearCart(_ urlString : String, completion : @escaping (_ success : Bool, _ result : [String : AnyObject]) -> Void) -> Void 464 | { 465 | 466 | let url = URL(string: urlString) 467 | print(urlString) 468 | var request = URLRequest(url: url!) 469 | request.httpMethod = "POST" 470 | let task = URLSession.shared.dataTask(with: request) { (data, response, error) in 471 | 472 | 473 | if let error = error 474 | { 475 | 476 | DispatchQueue.main.async(execute: { 477 | 478 | self.showAlert(error.localizedDescription, { 479 | 480 | //do something 481 | completion(false, [:]) 482 | 483 | }) 484 | 485 | }) 486 | 487 | } 488 | else 489 | { 490 | 491 | DispatchQueue.main.async(execute: { 492 | 493 | if let data = data 494 | { 495 | 496 | do 497 | { 498 | 499 | let jsonData = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [String : AnyObject] 500 | completion(true, jsonData!) 501 | 502 | } 503 | catch 504 | { 505 | 506 | self.showAlert("Something went wrong", { 507 | 508 | //do something 509 | completion(false, [:]) 510 | 511 | }) 512 | 513 | } 514 | } 515 | 516 | }) 517 | 518 | } 519 | } 520 | task.resume() 521 | 522 | 523 | } 524 | 525 | 526 | func showAlert(_ error : String, _ completion : @escaping () -> Void) -> Void 527 | { 528 | 529 | let alert = UIAlertController(title: "An Error Occurred", message: "\(error)", preferredStyle: .alert) 530 | alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { (action) in 531 | 532 | completion() 533 | 534 | })) 535 | self.present(alert, animated: true) { 536 | 537 | //do domething 538 | 539 | } 540 | 541 | } 542 | 543 | //MARK : Delegate and datasource methods 544 | 545 | //UITableView delegate and datasource methods 546 | internal func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int 547 | { 548 | 549 | return self.menuItems.count 550 | 551 | } 552 | 553 | internal func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell 554 | { 555 | 556 | let cell = self.menuTableView.dequeueReusableCell(withIdentifier: "menuItemCell") as? menuItemCell 557 | let fid = self.menuIds[indexPath.row] 558 | cell?.quantity.text = String(describing: self.menuQuantity[fid]!) 559 | cell?.itemName.text = self.menuItems[indexPath.row] 560 | cell?.paddingView.layer.cornerRadius = 5 561 | cell?.paddingView.layer.shadowPath = UIBezierPath(roundedRect: cell!.paddingView.bounds, cornerRadius: 5).cgPath 562 | cell?.paddingView.layer.shadowOffset = CGSize(width: -0.5, height: 0.5) 563 | cell?.paddingView.clipsToBounds = false 564 | cell?.paddingView.layer.shadowOpacity = 0.3 565 | cell?.plusOutlet.tag = indexPath.row 566 | cell?.minusOutlet.tag = indexPath.row 567 | cell?.plusOutlet.addTarget(self, action: #selector(menuViewController.plus(_:)), for: .touchUpInside) 568 | cell?.minusOutlet.addTarget(self, action: #selector(menuViewController.minus(_:)), for: .touchUpInside) 569 | cell?.thumbnailImageView.image = UIImage(named: "\(self.menuIds[indexPath.row]).jpg") 570 | cell?.thumbnailImageView.clipsToBounds = true 571 | let circlePath = CAShapeLayer() 572 | cell?.thumbnailImageView.layer.cornerRadius = (cell?.thumbnailImageView.bounds.width)!/2 573 | cell?.thumbnailImageView.layer.masksToBounds = true 574 | circlePath.path = UIBezierPath(arcCenter: cell!.thumbnailImageView.center, radius: cell!.thumbnailImageView.bounds.height, startAngle: 0, endAngle: 5, clockwise: true).cgPath 575 | cell?.thumbnailImageView.layer.mask = circlePath 576 | cell?.thumbnailImageView.layer.borderColor = UIColor.black.cgColor 577 | cell?.thumbnailImageView.layer.borderWidth = 2 578 | return cell! 579 | 580 | 581 | } 582 | 583 | func plus(_ button : UIButton) -> Void 584 | { 585 | 586 | let curId : String = menuIds[button.tag] 587 | self.menuQuantity[curId]! += 1 588 | 589 | } 590 | 591 | func minus(_ button : UIButton) -> Void 592 | { 593 | 594 | let curId : String = menuIds[button.tag] 595 | let curQty = self.menuQuantity[curId]! 596 | if (curQty != 0) 597 | { 598 | 599 | self.menuQuantity[curId]! -= 1 600 | 601 | } 602 | 603 | 604 | } 605 | 606 | override func didReceiveMemoryWarning() { 607 | super.didReceiveMemoryWarning() 608 | // Dispose of any resources that can be recreated. 609 | } 610 | 611 | } 612 | -------------------------------------------------------------------------------- /McDonald's DBMS/minus@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/McDonald's DBMS/minus@2x.png -------------------------------------------------------------------------------- /McDonald's DBMS/plus@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/McDonald's DBMS/plus@2x.png -------------------------------------------------------------------------------- /McDonald's DBMS/settings@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/McDonald's DBMS/settings@2x.png -------------------------------------------------------------------------------- /McDonald's DBMS/settingsViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // settingsViewController.swift 3 | // McDonald's DBMS 4 | // 5 | // Created by Swapnil Dhanwal on 08/04/2017. 6 | // Copyright © 2017 Swapnil Dhanwal. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class settingsViewController: UIViewController, UITextFieldDelegate, UIPickerViewDelegate, UIPickerViewDataSource { 12 | 13 | var phoneNumberView : UIView! 14 | var mainView : UIView! 15 | var phoneLabel : UILabel! 16 | var phoneTextField : UITextField! 17 | var addressTextField : UITextField! 18 | var nameTextField : UITextField! 19 | var phoneButton : UIButton! 20 | var phoneNumber : String? 21 | var pickerView = UIPickerView() 22 | var goButton : UIButton! 23 | var cancelButton : UIButton! 24 | var regionsArray : [String]! 25 | var detailsLabel : UILabel! 26 | var region : String! 27 | var user : String! 28 | var _user : [String : AnyObject]! 29 | var logoutButton : UIButton! 30 | 31 | override func viewDidLoad() { 32 | super.viewDidLoad() 33 | 34 | UIView.animate(withDuration: 0.3, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0.5, options: [], animations: { 35 | 36 | self.configureAddressScreen() 37 | if UserDefaults.standard.object(forKey: "user") != nil 38 | { 39 | 40 | self._user = UserDefaults.standard.object(forKey: "user") as! [String : AnyObject] 41 | 42 | } 43 | 44 | 45 | }) { (success) in 46 | 47 | //do something 48 | //add keyboard selector 49 | NotificationCenter.default.addObserver(self, selector: #selector(loginViewController.keyboardWillShow(_:)), name: .UIKeyboardWillShow, object: nil) 50 | NotificationCenter.default.addObserver(self, selector: #selector(loginViewController.keyboardWillHide(_:)), name: .UIKeyboardWillHide, object: nil) 51 | 52 | } 53 | 54 | // Do any additional setup after loading the view. 55 | } 56 | 57 | override func didReceiveMemoryWarning() { 58 | super.didReceiveMemoryWarning() 59 | // Dispose of any resources that can be recreated. 60 | } 61 | 62 | override func viewDidDisappear(_ animated: Bool) { 63 | 64 | NotificationCenter.default.removeObserver(self) 65 | 66 | } 67 | 68 | //show the user details view 69 | func configureAddressScreen() -> Void 70 | { 71 | 72 | 73 | 74 | self.mainView = UIView(frame: CGRect(x: self.view.bounds.width/2-self.view.bounds.width*0.8/2, y: self.view.bounds.height/2-self.view.bounds.height*0.8/2, width: self.view.bounds.width*0.8, height: self.view.bounds.height*0.8)) 75 | self.mainView.backgroundColor = UIColor.red 76 | self.mainView.layer.cornerRadius = 10 77 | let path = UIBezierPath(roundedRect: self.mainView.bounds, cornerRadius: 10) 78 | self.mainView.layer.shadowPath = path.cgPath 79 | self.mainView.layer.shadowOffset = CGSize(width: -0.5, height: 0.5) 80 | self.mainView.layer.shadowOpacity = 0.3 81 | self.view.addSubview(self.mainView) 82 | 83 | 84 | //remove all subviews in mainView just in case 85 | for view in self.mainView.subviews 86 | { 87 | 88 | view.removeFromSuperview() 89 | 90 | } 91 | 92 | //configure detailLabel 93 | self.detailsLabel = UILabel(frame: CGRect(x: self.mainView.bounds.width*0.1, y: 94 | 0, width: self.mainView.bounds.width*0.8, height: self.mainView.bounds.height*0.1)) 95 | self.detailsLabel.font = UIFont(name: "Avenir Book", size: 18) 96 | self.detailsLabel.textAlignment = .center 97 | self.detailsLabel.text = "Enter your details" 98 | self.mainView.addSubview(self.detailsLabel) 99 | 100 | //configure nameTextField 101 | self.nameTextField = UITextField(frame: CGRect(x: self.mainView.bounds.width*0.1, y: self.detailsLabel.frame.maxY + 10, width: self.mainView.bounds.width*0.8, height: self.mainView.bounds.height*0.1)) 102 | self.nameTextField.placeholder = "Enter your name" 103 | self.nameTextField.font = UIFont(name: "Avenir Book", size: 15) 104 | self.nameTextField.textAlignment = .center 105 | self.nameTextField.adjustsFontSizeToFitWidth = true 106 | self.nameTextField.backgroundColor = UIColor.white 107 | self.nameTextField.layer.cornerRadius = 10 108 | self.nameTextField.keyboardType = .asciiCapable 109 | self.nameTextField.delegate = self 110 | self.mainView.addSubview(nameTextField) 111 | 112 | //configure phoneTextField 113 | self.addressTextField = UITextField(frame: CGRect(x: self.mainView.bounds.width*0.1, y: self.nameTextField.frame.maxY + self.mainView.bounds.height*0.1, width: self.mainView.bounds.width*0.8, height: self.mainView.bounds.height*0.1)) 114 | self.addressTextField.placeholder = "Enter your street address" 115 | self.addressTextField.font = UIFont(name: "Avenir Book", size: 15) 116 | self.addressTextField.adjustsFontSizeToFitWidth = true 117 | self.addressTextField.textAlignment = .center 118 | self.addressTextField.layer.cornerRadius = 10 119 | self.addressTextField.backgroundColor = UIColor.white 120 | self.addressTextField.keyboardType = .asciiCapable 121 | self.addressTextField.delegate = self 122 | self.mainView.addSubview(addressTextField) 123 | 124 | //configure pickerView 125 | self.pickerView = UIPickerView(frame: CGRect(x: self.mainView.bounds.width*0.1, y: self.addressTextField.frame.maxY + self.mainView.bounds.height*0.1, width: self.mainView.bounds.width*0.8, height: self.mainView.bounds.height*0.2)) 126 | self.pickerView.backgroundColor = UIColor.white 127 | self.pickerView.layer.cornerRadius = 10 128 | self.pickerView.delegate = self 129 | self.pickerView.dataSource = self 130 | self.regionsArray = ["North Delhi", "South Delhi", "East Delhi", "West Delhi"] 131 | self.pickerView.reloadAllComponents() 132 | self.mainView.addSubview(self.pickerView) 133 | 134 | //configure Go button 135 | self.goButton = UIButton(type: .custom) 136 | self.goButton.frame = CGRect(x: self.mainView.bounds.width*0.025, y: self.pickerView.frame.maxY + self.mainView.bounds.height*0.1, width: self.mainView.bounds.width*0.3, height: self.mainView.bounds.height*0.1) 137 | self.goButton.addTarget(self, action: #selector(settingsViewController.go), for: .touchUpInside) 138 | var s = NSMutableAttributedString() 139 | if let f = UIFont(name: "Avenir Book", size: 20) 140 | { 141 | 142 | s = NSMutableAttributedString(string: "Go!", attributes: [NSFontAttributeName : f]) 143 | 144 | } 145 | self.goButton.layer.cornerRadius = 10 146 | self.goButton.backgroundColor = UIColor.white 147 | self.goButton.setAttributedTitle(s, for: .normal) 148 | self.mainView.addSubview(self.goButton) 149 | 150 | //configure the logout button 151 | self.logoutButton = UIButton(type: .custom) 152 | self.logoutButton.frame = CGRect(x: self.mainView.bounds.width*(0.3 + 0.05), y: self.pickerView.frame.maxY + self.mainView.bounds.height*0.1, width: self.mainView.bounds.width*0.3, height: self.mainView.bounds.height*0.1) 153 | self.logoutButton.addTarget(self, action: #selector(settingsViewController.logout), for: .touchUpInside) 154 | if let f = UIFont(name: "Avenir Book", size: 20) 155 | { 156 | 157 | s = NSMutableAttributedString(string: "Logout", attributes: [NSFontAttributeName : f]) 158 | 159 | } 160 | self.logoutButton.layer.cornerRadius = 10 161 | self.logoutButton.backgroundColor = UIColor.white 162 | self.logoutButton.setAttributedTitle(s, for: .normal) 163 | self.mainView.addSubview(self.logoutButton) 164 | 165 | //configure the cancel button 166 | self.cancelButton = UIButton(type: .custom) 167 | self.cancelButton.frame = CGRect(x: self.mainView.bounds.width*(0.65+0.025), y: self.pickerView.frame.maxY + self.mainView.bounds.height*0.1, width: self.mainView.bounds.width*0.3, height: self.mainView.bounds.height*0.1) 168 | self.cancelButton.addTarget(self, action: #selector(settingsViewController.cancel), for: .touchUpInside) 169 | if let f = UIFont(name: "Avenir Book", size: 20) 170 | { 171 | 172 | s = NSMutableAttributedString(string: "Cancel!", attributes: [NSFontAttributeName : f]) 173 | 174 | } 175 | self.cancelButton.layer.cornerRadius = 10 176 | self.cancelButton.backgroundColor = UIColor.white 177 | self.cancelButton.setAttributedTitle(s, for: .normal) 178 | self.mainView.addSubview(self.cancelButton) 179 | 180 | } 181 | 182 | //Function to logout the user 183 | func logout() -> Void 184 | { 185 | 186 | self._user = nil 187 | // UserDefaults.standard.removeObject(forKey: "user") 188 | UserDefaults.standard.removePersistentDomain(forName: Bundle.main.bundleIdentifier!) 189 | self.dismiss(animated: true) { 190 | 191 | //do something 192 | 193 | 194 | } 195 | 196 | } 197 | 198 | //Function to cancel the details update 199 | func cancel() -> Void 200 | { 201 | 202 | self.dismiss(animated: true) { 203 | 204 | //do something 205 | 206 | } 207 | 208 | } 209 | 210 | //Function to send request to server to insert new user into the DB 211 | func go() -> Void 212 | { 213 | 214 | for view in self.mainView.subviews 215 | { 216 | 217 | if (view is UITextField) 218 | { 219 | 220 | if (view as? UITextField)?.text == "" 221 | { 222 | 223 | self.showAlert("Please enter a valid value", { 224 | 225 | //do something 226 | 227 | }) 228 | return; 229 | 230 | } 231 | 232 | } 233 | 234 | } 235 | 236 | self.region = self.regionsArray[self.pickerView.selectedRow(inComponent: 0)] 237 | 238 | let _region = self.region.addingPercentEncoding(withAllowedCharacters: .alphanumerics) 239 | let name = self.nameTextField.text?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) 240 | let streetAddress = self.addressTextField.text?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) 241 | 242 | if let user = self._user 243 | { 244 | 245 | if let phone = user["Phone"] as? String 246 | { 247 | 248 | self.phoneNumber = phone 249 | 250 | } 251 | 252 | } 253 | 254 | let urlString = "http://127.0.0.1/updateCustomer.php?newName=\(name!)&newAddress=\(streetAddress!)&newRegion=\(_region!)&number=\(self.phoneNumber!)" 255 | 256 | self.updateCustomer(urlString) { (success, result) in 257 | 258 | if (success == true) 259 | { 260 | 261 | print("Done!") 262 | 263 | self.dismiss(animated: true, completion: nil) 264 | 265 | 266 | 267 | } 268 | else 269 | { 270 | 271 | self.showAlert("Something went wrong", { 272 | 273 | //do something 274 | 275 | }) 276 | 277 | } 278 | 279 | } 280 | 281 | } 282 | 283 | func updateCustomer(_ urlString : String, _ completion : @escaping (_ success : Bool, _ result : [String : AnyObject]) -> Void) -> Void 284 | { 285 | 286 | let url = URL(string : urlString) 287 | var request = URLRequest(url: url!) 288 | request.httpMethod = "POST" 289 | print(urlString) 290 | let task = URLSession.shared.dataTask(with: request) { (data, response, error) in 291 | 292 | if let error = error 293 | { 294 | 295 | DispatchQueue.main.async { 296 | 297 | 298 | self.showAlert("\(error.localizedDescription)", { 299 | 300 | //do something 301 | completion(false, [:]) 302 | 303 | }) 304 | 305 | } 306 | 307 | } 308 | else 309 | { 310 | 311 | DispatchQueue.main.async(execute: { 312 | 313 | if let data = data 314 | { 315 | 316 | do 317 | { 318 | 319 | let jsonData = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [[String : AnyObject]] 320 | for item in jsonData! 321 | { 322 | 323 | 324 | self._user = item 325 | UserDefaults.standard.set(self._user, forKey: "user") 326 | completion(true, item) 327 | 328 | if let success = item["Success"] as? String 329 | { 330 | 331 | if success == "0" 332 | { 333 | 334 | completion(false, [:]) 335 | 336 | } 337 | 338 | } 339 | 340 | } 341 | 342 | } 343 | catch 344 | { 345 | 346 | self.showAlert("Could not connect to the server", { 347 | 348 | //do something 349 | completion(false, [:]) 350 | 351 | }) 352 | 353 | } 354 | 355 | } 356 | 357 | }) 358 | 359 | } 360 | 361 | } 362 | task.resume() 363 | 364 | } 365 | 366 | func showAlert(_ error : String, _ completion : @escaping () -> Void) -> Void 367 | { 368 | 369 | let alert = UIAlertController(title: "An Error Occurred", message: "\(error)", preferredStyle: .alert) 370 | alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { (action) in 371 | 372 | completion() 373 | 374 | })) 375 | self.present(alert, animated: true) { 376 | 377 | //do domething 378 | 379 | } 380 | 381 | } 382 | 383 | func textFieldDidEndEditing(_ textField: UITextField, reason: UITextFieldDidEndEditingReason) { 384 | 385 | for c in (textField.text?.unicodeScalars)! 386 | { 387 | let value = c.value 388 | if !((value >= 65 && value <= 90) || (value >= 97 && value <= 122) || (value >= 48 && value <= 57) || c == " " || c == ",") 389 | { 390 | 391 | showAlert("Please enter only alphanumeric characters", { 392 | 393 | textField.text = "" 394 | textField.resignFirstResponder() 395 | 396 | }) 397 | 398 | } 399 | 400 | } 401 | 402 | } 403 | 404 | func textFieldShouldReturn(_ textField: UITextField) -> Bool { 405 | 406 | textField.resignFirstResponder() 407 | return true 408 | 409 | } 410 | 411 | 412 | //MARK : Keyboard notifications 413 | 414 | func keyboardWillShow(_ notification : NSNotification) -> Void 415 | { 416 | 417 | let keyboardFrame = (notification.userInfo![UIKeyboardFrameEndUserInfoKey] as! NSValue).cgRectValue 418 | if (self.phoneTextField != nil) 419 | { 420 | 421 | if (keyboardFrame.minY < self.phoneTextField.frame.maxY) 422 | { 423 | 424 | let dy = self.phoneTextField.frame.maxY - keyboardFrame.minY 425 | UIView.animate(withDuration: 0.3, animations: { 426 | 427 | self.phoneTextField.layer.setAffineTransform(CGAffineTransform(translationX: 0, y: dy)) 428 | 429 | }) 430 | 431 | 432 | } 433 | 434 | } 435 | else if (self.addressTextField != nil) 436 | { 437 | 438 | if (keyboardFrame.minY < self.addressTextField.frame.maxY) 439 | { 440 | 441 | let dy = self.addressTextField.frame.maxY - keyboardFrame.minY 442 | UIView.animate(withDuration: 0.3, animations: { 443 | 444 | self.addressTextField.layer.setAffineTransform(CGAffineTransform(translationX: 0, y: dy)) 445 | 446 | }) 447 | 448 | 449 | } 450 | 451 | } 452 | else if (self.nameTextField != nil) 453 | { 454 | 455 | if (keyboardFrame.minY < self.nameTextField.frame.maxY) 456 | { 457 | 458 | let dy = self.nameTextField.frame.maxY - keyboardFrame.minY 459 | UIView.animate(withDuration: 0.3, animations: { 460 | 461 | self.nameTextField.layer.setAffineTransform(CGAffineTransform(translationX: 0, y: dy)) 462 | 463 | }) 464 | 465 | 466 | } 467 | 468 | 469 | } 470 | 471 | } 472 | 473 | func keyboardWillHide(_ notification : NSNotification) -> Void 474 | { 475 | 476 | UIView.animate(withDuration: 0.3, animations: { 477 | 478 | if (self.phoneTextField != nil) 479 | { 480 | 481 | self.phoneTextField.layer.setAffineTransform(CGAffineTransform.identity) 482 | 483 | 484 | } 485 | if (self.addressTextField != nil) 486 | { 487 | 488 | self.addressTextField.layer.setAffineTransform(CGAffineTransform.identity) 489 | 490 | } 491 | if (self.nameTextField != nil) 492 | { 493 | 494 | self.addressTextField.layer.setAffineTransform(CGAffineTransform.identity) 495 | 496 | } 497 | 498 | }) 499 | 500 | 501 | } 502 | 503 | //MARK : Delegate and Datasource methods 504 | 505 | internal func numberOfComponents(in pickerView: UIPickerView) -> Int 506 | { 507 | 508 | return 1 509 | 510 | } 511 | 512 | internal func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int 513 | { 514 | 515 | return self.regionsArray.count 516 | 517 | } 518 | 519 | 520 | func pickerView(_ pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? { 521 | 522 | var s = NSMutableAttributedString() 523 | if let f = UIFont(name: "Avenir Book", size: 18) 524 | { 525 | 526 | s = NSMutableAttributedString(string: self.regionsArray[row], attributes: [NSFontAttributeName : f]) 527 | 528 | } 529 | return s 530 | 531 | } 532 | 533 | func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat { 534 | 535 | if component == 0 536 | { 537 | 538 | return 20 539 | 540 | } 541 | return 10 542 | 543 | } 544 | 545 | } 546 | -------------------------------------------------------------------------------- /McDonald's DBMS/welcomeView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // welcomeView.swift 3 | // ieeeID 4 | // 5 | // Created by Swapnil Dhanwal on 27/01/17. 6 | // Copyright © 2017 Swapnil Dhanwal. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class welcomeView: UIView { 12 | 13 | var pages = Int() 14 | var messages = [String]() 15 | var mainView = UIView() 16 | var pageIndex = Int() 17 | var messageLabel = UILabel() 18 | var completionHandler : () -> Void 19 | var nextButton = UIButton() 20 | var nextButtonColor = UIColor() 21 | var textCol = UIColor() 22 | var backCol = UIColor() 23 | var showShadow = Bool() 24 | public var textAlignment : NSTextAlignment 25 | 26 | init(_ frame : CGRect, _ messagesArray : [String], _ backgroundColor : UIColor, _ textColor : UIColor, _ buttonColor : UIColor, _ completion : @escaping () -> Void) 27 | { 28 | 29 | pages = messagesArray.count 30 | messages = messagesArray 31 | pageIndex = 0 32 | completionHandler = completion 33 | nextButtonColor = buttonColor 34 | backCol = backgroundColor 35 | textCol = textColor 36 | textAlignment = NSTextAlignment.center 37 | showShadow = true 38 | super.init(frame: frame) 39 | self.frame = frame 40 | self.messageLabel.textAlignment = .left 41 | presentPage(backgroundColor, textColor, buttonColor, 0) 42 | self.autoresizingMask = [.flexibleLeftMargin, .flexibleBottomMargin, .flexibleTopMargin, .flexibleRightMargin] 43 | if (self.showShadow == true) 44 | { 45 | 46 | let path = UIBezierPath(roundedRect: self.mainView.bounds, cornerRadius: 10) 47 | self.mainView.layer.shadowPath = path.cgPath 48 | self.mainView.layer.shadowOpacity = 0.3 49 | self.mainView.layer.shadowOffset = CGSize(width: -0.5, height: 0.5) 50 | 51 | } 52 | 53 | } 54 | 55 | func showMainView(_ backgroundColor : UIColor, _ message : String, _ textColor : UIColor, _ buttonColor : UIColor) -> Void 56 | { 57 | 58 | for view in self.subviews 59 | { 60 | 61 | view.removeFromSuperview() 62 | 63 | } 64 | 65 | //configure mainView 66 | self.mainView = UIView(frame: self.bounds) 67 | self.mainView.autoresizingMask = [.flexibleBottomMargin, .flexibleLeftMargin, .flexibleRightMargin, .flexibleTopMargin] 68 | self.mainView.backgroundColor = backgroundColor 69 | self.mainView.layer.cornerRadius = 10 70 | if (self.showShadow == true) 71 | { 72 | 73 | let path = UIBezierPath(roundedRect: self.mainView.bounds, cornerRadius: 10) 74 | self.mainView.layer.shadowPath = path.cgPath 75 | self.mainView.layer.shadowOpacity = 0.3 76 | self.mainView.layer.shadowOffset = CGSize(width: -0.5, height: 0.5) 77 | 78 | } 79 | self.addSubview(self.mainView) 80 | 81 | //configure messageLabel 82 | self.configureLabel(message, textColor) 83 | 84 | //configure nextButton 85 | self.configureNextButton(buttonColor) 86 | 87 | //animate the view from alpha 0 and 0.75X scale to alpha 1 and 1X scale 88 | self.alpha = 0 89 | self.layer.setAffineTransform(CGAffineTransform(scaleX: 0.75, y: 0.75)) 90 | UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 1, options: [], animations: { 91 | 92 | self.alpha = 1 93 | self.layer.setAffineTransform(CGAffineTransform.identity) 94 | 95 | }) { (success) in 96 | 97 | 98 | 99 | } 100 | 101 | } 102 | 103 | func configureLabel(_ message : String, _ textColor : UIColor) 104 | { 105 | 106 | self.messageLabel = UILabel() 107 | let frame = CGRect(x: self.mainView.bounds.width*0.1, y: self.mainView.bounds.height*0.1, width: self.mainView.bounds.width*0.8, height: self.mainView.bounds.height*0.6) 108 | self.messageLabel.frame = frame 109 | self.messageLabel.numberOfLines = -1 110 | var attributedText = NSMutableAttributedString() 111 | if let f = UIFont(name: "Avenir Book", size: 30) 112 | { 113 | 114 | attributedText = NSMutableAttributedString(string: message, attributes: [NSFontAttributeName : f]) 115 | self.messageLabel.attributedText = attributedText 116 | self.messageLabel.textColor = self.textCol 117 | 118 | } 119 | self.mainView.addSubview(messageLabel) 120 | 121 | } 122 | 123 | func configureNextButton(_ buttonColor : UIColor) 124 | { 125 | self.nextButton = UIButton(type: .roundedRect) 126 | self.nextButton.frame = CGRect(x: self.mainView.bounds.width*0.2, y: self.messageLabel.frame.maxY+self.mainView.frame.height*0.075, width: self.mainView.bounds.width*0.6, height: self.mainView.bounds.height*0.15) 127 | self.nextButton.backgroundColor = buttonColor 128 | var attributedTitle = NSMutableAttributedString() 129 | if let f = UIFont(name: "Avenir Book", size: 20) 130 | { 131 | 132 | attributedTitle = NSMutableAttributedString(string: "Next", attributes: [NSFontAttributeName : f]) 133 | self.nextButton.setAttributedTitle(attributedTitle, for: .normal) 134 | 135 | } 136 | self.nextButton.layer.cornerRadius = 10 137 | self.nextButton.addTarget(self, action: #selector(welcomeView.next as (welcomeView) -> () -> ()), for: .touchUpInside) 138 | self.mainView.addSubview(nextButton) 139 | 140 | } 141 | 142 | func next() 143 | { 144 | 145 | self.makeInvisible { 146 | 147 | self.nextUtil(self.backCol, self.textCol, self.nextButtonColor, self.pageIndex) 148 | 149 | } 150 | 151 | } 152 | 153 | func nextUtil(_ backgroundColor : UIColor, _ textColor : UIColor, _ buttonColor : UIColor, _ pageIndex : Int) 154 | { 155 | 156 | self.pageIndex += 1 157 | self.presentPage(backgroundColor, textColor, buttonColor, self.pageIndex) 158 | 159 | } 160 | 161 | func remove() 162 | { 163 | 164 | UIView.animate(withDuration: 0.4, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 1, options: [], animations: { 165 | 166 | self.alpha = 0 167 | self.layer.setAffineTransform(CGAffineTransform(scaleX: 0.5, y: 0.5)) 168 | 169 | }) { (success) in 170 | 171 | self.removeFromSuperview() 172 | 173 | } 174 | 175 | } 176 | 177 | func makeInvisible(_ completion : @escaping () -> Void) 178 | { 179 | 180 | UIView.animate(withDuration: 0.1, animations: { 181 | 182 | self.alpha = 0 183 | self.layer.setAffineTransform(CGAffineTransform(scaleX: 0.5, y: 0.5)) 184 | 185 | }) { (success) in 186 | 187 | completion() 188 | 189 | } 190 | 191 | } 192 | 193 | func presentPage(_ backgroundColor : UIColor, _ textColor : UIColor, _ buttonColor : UIColor, _ pageIndex : Int) 194 | { 195 | 196 | if (pageIndex == self.pages) 197 | { 198 | 199 | makeInvisible({ 200 | 201 | self.completionHandler() 202 | self.removeFromSuperview() 203 | 204 | }) 205 | 206 | } 207 | else 208 | { 209 | 210 | let currentMessage = self.messages[pageIndex] 211 | self.showMainView(backgroundColor, currentMessage, textColor, buttonColor) 212 | 213 | } 214 | 215 | } 216 | 217 | 218 | required init?(coder aDecoder: NSCoder) { 219 | fatalError("init(coder:) has not been implemented") 220 | } 221 | 222 | /* 223 | // Only override draw() if you perform custom drawing. 224 | // An empty implementation adversely affects performance during animation. 225 | override func draw(_ rect: CGRect) { 226 | // Drawing code 227 | } 228 | */ 229 | 230 | } 231 | -------------------------------------------------------------------------------- /McDonald's DBMSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /McDonald's DBMSTests/McDonald_s_DBMSTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // McDonald_s_DBMSTests.swift 3 | // McDonald's DBMSTests 4 | // 5 | // Created by Swapnil Dhanwal on 08/04/2017. 6 | // Copyright © 2017 Swapnil Dhanwal. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import McDonald_s_DBMS 11 | 12 | class McDonald_s_DBMSTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /McDonald's DBMSUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /McDonald's DBMSUITests/McDonald_s_DBMSUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // McDonald_s_DBMSUITests.swift 3 | // McDonald's DBMSUITests 4 | // 5 | // Created by Swapnil Dhanwal on 08/04/2017. 6 | // Copyright © 2017 Swapnil Dhanwal. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class McDonald_s_DBMSUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | 18 | // In UI tests it is usually best to stop immediately when a failure occurs. 19 | continueAfterFailure = false 20 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 21 | XCUIApplication().launch() 22 | 23 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 24 | } 25 | 26 | override func tearDown() { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | super.tearDown() 29 | } 30 | 31 | func testExample() { 32 | // Use recording to get started writing UI tests. 33 | // Use XCTAssert and related functions to verify your tests produce the correct results. 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /McDonalds Online.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 557A0C5A1E990297005AD7E5 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 557A0C591E990297005AD7E5 /* AppDelegate.swift */; }; 11 | 557A0C5C1E990297005AD7E5 /* loginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 557A0C5B1E990297005AD7E5 /* loginViewController.swift */; }; 12 | 557A0C5F1E990297005AD7E5 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 557A0C5D1E990297005AD7E5 /* Main.storyboard */; }; 13 | 557A0C611E990297005AD7E5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 557A0C601E990297005AD7E5 /* Assets.xcassets */; }; 14 | 557A0C641E990297005AD7E5 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 557A0C621E990297005AD7E5 /* LaunchScreen.storyboard */; }; 15 | 557A0C6F1E990297005AD7E5 /* McDonald_s_DBMSTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 557A0C6E1E990297005AD7E5 /* McDonald_s_DBMSTests.swift */; }; 16 | 557A0C7A1E990297005AD7E5 /* McDonald_s_DBMSUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 557A0C791E990297005AD7E5 /* McDonald_s_DBMSUITests.swift */; }; 17 | 557A0C881E990419005AD7E5 /* welcomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 557A0C871E990419005AD7E5 /* welcomeView.swift */; }; 18 | 557A0C8A1E99360B005AD7E5 /* menuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 557A0C891E99360B005AD7E5 /* menuViewController.swift */; }; 19 | 557A0C8C1E993614005AD7E5 /* menuItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 557A0C8B1E993614005AD7E5 /* menuItemCell.swift */; }; 20 | 557A0C8E1E993900005AD7E5 /* invoiceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 557A0C8D1E993900005AD7E5 /* invoiceViewController.swift */; }; 21 | 557A0C901E993D53005AD7E5 /* settingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 557A0C8F1E993D53005AD7E5 /* settingsViewController.swift */; }; 22 | 557A0CA01E994775005AD7E5 /* COS.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 557A0C911E994775005AD7E5 /* COS.jpg */; }; 23 | 557A0CA11E994775005AD7E5 /* COM.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 557A0C921E994775005AD7E5 /* COM.jpg */; }; 24 | 557A0CA21E994775005AD7E5 /* FFM.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 557A0C931E994775005AD7E5 /* FFM.jpg */; }; 25 | 557A0CA31E994775005AD7E5 /* FFS.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 557A0C941E994775005AD7E5 /* FFS.jpg */; }; 26 | 557A0CA41E994775005AD7E5 /* ATR.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 557A0C951E994775005AD7E5 /* ATR.jpg */; }; 27 | 557A0CA51E994775005AD7E5 /* CHR.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 557A0C961E994775005AD7E5 /* CHR.jpg */; }; 28 | 557A0CA61E994775005AD7E5 /* COL.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 557A0C971E994775005AD7E5 /* COL.jpg */; }; 29 | 557A0CA71E994775005AD7E5 /* FFL.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 557A0C981E994775005AD7E5 /* FFL.jpg */; }; 30 | 557A0CA81E994775005AD7E5 /* FLR.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 557A0C991E994775005AD7E5 /* FLR.jpg */; }; 31 | 557A0CA91E994775005AD7E5 /* HCR.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 557A0C9A1E994775005AD7E5 /* HCR.jpg */; }; 32 | 557A0CAA1E994775005AD7E5 /* ITR.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 557A0C9B1E994775005AD7E5 /* ITR.jpg */; }; 33 | 557A0CAB1E994775005AD7E5 /* PFR.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 557A0C9C1E994775005AD7E5 /* PFR.jpg */; }; 34 | 557A0CAC1E994775005AD7E5 /* SCR.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 557A0C9D1E994775005AD7E5 /* SCR.jpg */; }; 35 | 557A0CAD1E994775005AD7E5 /* SWR.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 557A0C9E1E994775005AD7E5 /* SWR.jpg */; }; 36 | 557A0CAE1E994775005AD7E5 /* VER.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 557A0C9F1E994775005AD7E5 /* VER.jpg */; }; 37 | 557A0CB21E9947A9005AD7E5 /* plus@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 557A0CB01E9947A9005AD7E5 /* plus@2x.png */; }; 38 | 557A0CB31E9947A9005AD7E5 /* minus@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 557A0CB11E9947A9005AD7E5 /* minus@2x.png */; }; 39 | 55A0CF3B1E99F2A7006E19F0 /* settings@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 55A0CF3A1E99F2A7006E19F0 /* settings@2x.png */; }; 40 | /* End PBXBuildFile section */ 41 | 42 | /* Begin PBXContainerItemProxy section */ 43 | 557A0C6B1E990297005AD7E5 /* PBXContainerItemProxy */ = { 44 | isa = PBXContainerItemProxy; 45 | containerPortal = 557A0C4E1E990297005AD7E5 /* Project object */; 46 | proxyType = 1; 47 | remoteGlobalIDString = 557A0C551E990297005AD7E5; 48 | remoteInfo = "McDonald's DBMS"; 49 | }; 50 | 557A0C761E990297005AD7E5 /* PBXContainerItemProxy */ = { 51 | isa = PBXContainerItemProxy; 52 | containerPortal = 557A0C4E1E990297005AD7E5 /* Project object */; 53 | proxyType = 1; 54 | remoteGlobalIDString = 557A0C551E990297005AD7E5; 55 | remoteInfo = "McDonald's DBMS"; 56 | }; 57 | /* End PBXContainerItemProxy section */ 58 | 59 | /* Begin PBXFileReference section */ 60 | 557A0C561E990297005AD7E5 /* McDonalds Online.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "McDonalds Online.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 61 | 557A0C591E990297005AD7E5 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 62 | 557A0C5B1E990297005AD7E5 /* loginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = loginViewController.swift; sourceTree = ""; }; 63 | 557A0C5E1E990297005AD7E5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 64 | 557A0C601E990297005AD7E5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 65 | 557A0C631E990297005AD7E5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 66 | 557A0C651E990297005AD7E5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 67 | 557A0C6A1E990297005AD7E5 /* McDonalds OnlineTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "McDonalds OnlineTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 68 | 557A0C6E1E990297005AD7E5 /* McDonald_s_DBMSTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = McDonald_s_DBMSTests.swift; sourceTree = ""; }; 69 | 557A0C701E990297005AD7E5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 70 | 557A0C751E990297005AD7E5 /* McDonalds OnlineUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "McDonalds OnlineUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 71 | 557A0C791E990297005AD7E5 /* McDonald_s_DBMSUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = McDonald_s_DBMSUITests.swift; sourceTree = ""; }; 72 | 557A0C7B1E990297005AD7E5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 73 | 557A0C871E990419005AD7E5 /* welcomeView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = welcomeView.swift; sourceTree = ""; }; 74 | 557A0C891E99360B005AD7E5 /* menuViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = menuViewController.swift; sourceTree = ""; }; 75 | 557A0C8B1E993614005AD7E5 /* menuItemCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = menuItemCell.swift; sourceTree = ""; }; 76 | 557A0C8D1E993900005AD7E5 /* invoiceViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = invoiceViewController.swift; sourceTree = ""; }; 77 | 557A0C8F1E993D53005AD7E5 /* settingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = settingsViewController.swift; sourceTree = ""; }; 78 | 557A0C911E994775005AD7E5 /* COS.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = COS.jpg; sourceTree = ""; }; 79 | 557A0C921E994775005AD7E5 /* COM.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = COM.jpg; sourceTree = ""; }; 80 | 557A0C931E994775005AD7E5 /* FFM.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = FFM.jpg; sourceTree = ""; }; 81 | 557A0C941E994775005AD7E5 /* FFS.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = FFS.jpg; sourceTree = ""; }; 82 | 557A0C951E994775005AD7E5 /* ATR.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = ATR.jpg; sourceTree = ""; }; 83 | 557A0C961E994775005AD7E5 /* CHR.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = CHR.jpg; sourceTree = ""; }; 84 | 557A0C971E994775005AD7E5 /* COL.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = COL.jpg; sourceTree = ""; }; 85 | 557A0C981E994775005AD7E5 /* FFL.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = FFL.jpg; sourceTree = ""; }; 86 | 557A0C991E994775005AD7E5 /* FLR.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = FLR.jpg; sourceTree = ""; }; 87 | 557A0C9A1E994775005AD7E5 /* HCR.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = HCR.jpg; sourceTree = ""; }; 88 | 557A0C9B1E994775005AD7E5 /* ITR.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = ITR.jpg; sourceTree = ""; }; 89 | 557A0C9C1E994775005AD7E5 /* PFR.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = PFR.jpg; sourceTree = ""; }; 90 | 557A0C9D1E994775005AD7E5 /* SCR.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = SCR.jpg; sourceTree = ""; }; 91 | 557A0C9E1E994775005AD7E5 /* SWR.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = SWR.jpg; sourceTree = ""; }; 92 | 557A0C9F1E994775005AD7E5 /* VER.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = VER.jpg; sourceTree = ""; }; 93 | 557A0CB01E9947A9005AD7E5 /* plus@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "plus@2x.png"; sourceTree = ""; }; 94 | 557A0CB11E9947A9005AD7E5 /* minus@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "minus@2x.png"; sourceTree = ""; }; 95 | 55A0CF3A1E99F2A7006E19F0 /* settings@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "settings@2x.png"; sourceTree = ""; }; 96 | /* End PBXFileReference section */ 97 | 98 | /* Begin PBXFrameworksBuildPhase section */ 99 | 557A0C531E990297005AD7E5 /* Frameworks */ = { 100 | isa = PBXFrameworksBuildPhase; 101 | buildActionMask = 2147483647; 102 | files = ( 103 | ); 104 | runOnlyForDeploymentPostprocessing = 0; 105 | }; 106 | 557A0C671E990297005AD7E5 /* Frameworks */ = { 107 | isa = PBXFrameworksBuildPhase; 108 | buildActionMask = 2147483647; 109 | files = ( 110 | ); 111 | runOnlyForDeploymentPostprocessing = 0; 112 | }; 113 | 557A0C721E990297005AD7E5 /* Frameworks */ = { 114 | isa = PBXFrameworksBuildPhase; 115 | buildActionMask = 2147483647; 116 | files = ( 117 | ); 118 | runOnlyForDeploymentPostprocessing = 0; 119 | }; 120 | /* End PBXFrameworksBuildPhase section */ 121 | 122 | /* Begin PBXGroup section */ 123 | 557A0C4D1E990297005AD7E5 = { 124 | isa = PBXGroup; 125 | children = ( 126 | 557A0C581E990297005AD7E5 /* McDonald's DBMS */, 127 | 557A0C6D1E990297005AD7E5 /* McDonald's DBMSTests */, 128 | 557A0C781E990297005AD7E5 /* McDonald's DBMSUITests */, 129 | 557A0C571E990297005AD7E5 /* Products */, 130 | ); 131 | sourceTree = ""; 132 | }; 133 | 557A0C571E990297005AD7E5 /* Products */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 557A0C561E990297005AD7E5 /* McDonalds Online.app */, 137 | 557A0C6A1E990297005AD7E5 /* McDonalds OnlineTests.xctest */, 138 | 557A0C751E990297005AD7E5 /* McDonalds OnlineUITests.xctest */, 139 | ); 140 | name = Products; 141 | sourceTree = ""; 142 | }; 143 | 557A0C581E990297005AD7E5 /* McDonald's DBMS */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | 557A0CAF1E994780005AD7E5 /* Image Assets */, 147 | 557A0C591E990297005AD7E5 /* AppDelegate.swift */, 148 | 557A0C8F1E993D53005AD7E5 /* settingsViewController.swift */, 149 | 557A0C5B1E990297005AD7E5 /* loginViewController.swift */, 150 | 557A0C891E99360B005AD7E5 /* menuViewController.swift */, 151 | 557A0C8D1E993900005AD7E5 /* invoiceViewController.swift */, 152 | 557A0C8B1E993614005AD7E5 /* menuItemCell.swift */, 153 | 557A0C871E990419005AD7E5 /* welcomeView.swift */, 154 | 557A0C5D1E990297005AD7E5 /* Main.storyboard */, 155 | 557A0C601E990297005AD7E5 /* Assets.xcassets */, 156 | 557A0C621E990297005AD7E5 /* LaunchScreen.storyboard */, 157 | 557A0C651E990297005AD7E5 /* Info.plist */, 158 | ); 159 | path = "McDonald's DBMS"; 160 | sourceTree = ""; 161 | }; 162 | 557A0C6D1E990297005AD7E5 /* McDonald's DBMSTests */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | 557A0C6E1E990297005AD7E5 /* McDonald_s_DBMSTests.swift */, 166 | 557A0C701E990297005AD7E5 /* Info.plist */, 167 | ); 168 | path = "McDonald's DBMSTests"; 169 | sourceTree = ""; 170 | }; 171 | 557A0C781E990297005AD7E5 /* McDonald's DBMSUITests */ = { 172 | isa = PBXGroup; 173 | children = ( 174 | 557A0C791E990297005AD7E5 /* McDonald_s_DBMSUITests.swift */, 175 | 557A0C7B1E990297005AD7E5 /* Info.plist */, 176 | ); 177 | path = "McDonald's DBMSUITests"; 178 | sourceTree = ""; 179 | }; 180 | 557A0CAF1E994780005AD7E5 /* Image Assets */ = { 181 | isa = PBXGroup; 182 | children = ( 183 | 557A0C911E994775005AD7E5 /* COS.jpg */, 184 | 557A0C921E994775005AD7E5 /* COM.jpg */, 185 | 557A0C931E994775005AD7E5 /* FFM.jpg */, 186 | 557A0C941E994775005AD7E5 /* FFS.jpg */, 187 | 557A0C951E994775005AD7E5 /* ATR.jpg */, 188 | 557A0C961E994775005AD7E5 /* CHR.jpg */, 189 | 557A0C971E994775005AD7E5 /* COL.jpg */, 190 | 557A0C981E994775005AD7E5 /* FFL.jpg */, 191 | 557A0C991E994775005AD7E5 /* FLR.jpg */, 192 | 557A0C9A1E994775005AD7E5 /* HCR.jpg */, 193 | 557A0C9B1E994775005AD7E5 /* ITR.jpg */, 194 | 557A0C9C1E994775005AD7E5 /* PFR.jpg */, 195 | 557A0C9D1E994775005AD7E5 /* SCR.jpg */, 196 | 557A0C9E1E994775005AD7E5 /* SWR.jpg */, 197 | 557A0C9F1E994775005AD7E5 /* VER.jpg */, 198 | 557A0CB01E9947A9005AD7E5 /* plus@2x.png */, 199 | 557A0CB11E9947A9005AD7E5 /* minus@2x.png */, 200 | 55A0CF3A1E99F2A7006E19F0 /* settings@2x.png */, 201 | ); 202 | name = "Image Assets"; 203 | sourceTree = ""; 204 | }; 205 | /* End PBXGroup section */ 206 | 207 | /* Begin PBXNativeTarget section */ 208 | 557A0C551E990297005AD7E5 /* McDonalds Online */ = { 209 | isa = PBXNativeTarget; 210 | buildConfigurationList = 557A0C7E1E990297005AD7E5 /* Build configuration list for PBXNativeTarget "McDonalds Online" */; 211 | buildPhases = ( 212 | 557A0C521E990297005AD7E5 /* Sources */, 213 | 557A0C531E990297005AD7E5 /* Frameworks */, 214 | 557A0C541E990297005AD7E5 /* Resources */, 215 | ); 216 | buildRules = ( 217 | ); 218 | dependencies = ( 219 | ); 220 | name = "McDonalds Online"; 221 | productName = "McDonald's DBMS"; 222 | productReference = 557A0C561E990297005AD7E5 /* McDonalds Online.app */; 223 | productType = "com.apple.product-type.application"; 224 | }; 225 | 557A0C691E990297005AD7E5 /* McDonalds OnlineTests */ = { 226 | isa = PBXNativeTarget; 227 | buildConfigurationList = 557A0C811E990297005AD7E5 /* Build configuration list for PBXNativeTarget "McDonalds OnlineTests" */; 228 | buildPhases = ( 229 | 557A0C661E990297005AD7E5 /* Sources */, 230 | 557A0C671E990297005AD7E5 /* Frameworks */, 231 | 557A0C681E990297005AD7E5 /* Resources */, 232 | ); 233 | buildRules = ( 234 | ); 235 | dependencies = ( 236 | 557A0C6C1E990297005AD7E5 /* PBXTargetDependency */, 237 | ); 238 | name = "McDonalds OnlineTests"; 239 | productName = "McDonald's DBMSTests"; 240 | productReference = 557A0C6A1E990297005AD7E5 /* McDonalds OnlineTests.xctest */; 241 | productType = "com.apple.product-type.bundle.unit-test"; 242 | }; 243 | 557A0C741E990297005AD7E5 /* McDonalds OnlineUITests */ = { 244 | isa = PBXNativeTarget; 245 | buildConfigurationList = 557A0C841E990297005AD7E5 /* Build configuration list for PBXNativeTarget "McDonalds OnlineUITests" */; 246 | buildPhases = ( 247 | 557A0C711E990297005AD7E5 /* Sources */, 248 | 557A0C721E990297005AD7E5 /* Frameworks */, 249 | 557A0C731E990297005AD7E5 /* Resources */, 250 | ); 251 | buildRules = ( 252 | ); 253 | dependencies = ( 254 | 557A0C771E990297005AD7E5 /* PBXTargetDependency */, 255 | ); 256 | name = "McDonalds OnlineUITests"; 257 | productName = "McDonald's DBMSUITests"; 258 | productReference = 557A0C751E990297005AD7E5 /* McDonalds OnlineUITests.xctest */; 259 | productType = "com.apple.product-type.bundle.ui-testing"; 260 | }; 261 | /* End PBXNativeTarget section */ 262 | 263 | /* Begin PBXProject section */ 264 | 557A0C4E1E990297005AD7E5 /* Project object */ = { 265 | isa = PBXProject; 266 | attributes = { 267 | LastSwiftUpdateCheck = 0820; 268 | LastUpgradeCheck = 0820; 269 | ORGANIZATIONNAME = "Swapnil Dhanwal"; 270 | TargetAttributes = { 271 | 557A0C551E990297005AD7E5 = { 272 | CreatedOnToolsVersion = 8.2; 273 | DevelopmentTeam = 3A9TH8N8KH; 274 | ProvisioningStyle = Automatic; 275 | }; 276 | 557A0C691E990297005AD7E5 = { 277 | CreatedOnToolsVersion = 8.2; 278 | DevelopmentTeam = 3A9TH8N8KH; 279 | ProvisioningStyle = Automatic; 280 | TestTargetID = 557A0C551E990297005AD7E5; 281 | }; 282 | 557A0C741E990297005AD7E5 = { 283 | CreatedOnToolsVersion = 8.2; 284 | DevelopmentTeam = 3A9TH8N8KH; 285 | ProvisioningStyle = Automatic; 286 | TestTargetID = 557A0C551E990297005AD7E5; 287 | }; 288 | }; 289 | }; 290 | buildConfigurationList = 557A0C511E990297005AD7E5 /* Build configuration list for PBXProject "McDonalds Online" */; 291 | compatibilityVersion = "Xcode 3.2"; 292 | developmentRegion = English; 293 | hasScannedForEncodings = 0; 294 | knownRegions = ( 295 | en, 296 | Base, 297 | ); 298 | mainGroup = 557A0C4D1E990297005AD7E5; 299 | productRefGroup = 557A0C571E990297005AD7E5 /* Products */; 300 | projectDirPath = ""; 301 | projectRoot = ""; 302 | targets = ( 303 | 557A0C551E990297005AD7E5 /* McDonalds Online */, 304 | 557A0C691E990297005AD7E5 /* McDonalds OnlineTests */, 305 | 557A0C741E990297005AD7E5 /* McDonalds OnlineUITests */, 306 | ); 307 | }; 308 | /* End PBXProject section */ 309 | 310 | /* Begin PBXResourcesBuildPhase section */ 311 | 557A0C541E990297005AD7E5 /* Resources */ = { 312 | isa = PBXResourcesBuildPhase; 313 | buildActionMask = 2147483647; 314 | files = ( 315 | 557A0C641E990297005AD7E5 /* LaunchScreen.storyboard in Resources */, 316 | 557A0C611E990297005AD7E5 /* Assets.xcassets in Resources */, 317 | 557A0CA31E994775005AD7E5 /* FFS.jpg in Resources */, 318 | 557A0C5F1E990297005AD7E5 /* Main.storyboard in Resources */, 319 | 557A0CA61E994775005AD7E5 /* COL.jpg in Resources */, 320 | 557A0CAA1E994775005AD7E5 /* ITR.jpg in Resources */, 321 | 557A0CA21E994775005AD7E5 /* FFM.jpg in Resources */, 322 | 557A0CA81E994775005AD7E5 /* FLR.jpg in Resources */, 323 | 557A0CAD1E994775005AD7E5 /* SWR.jpg in Resources */, 324 | 557A0CAE1E994775005AD7E5 /* VER.jpg in Resources */, 325 | 557A0CA41E994775005AD7E5 /* ATR.jpg in Resources */, 326 | 557A0CAB1E994775005AD7E5 /* PFR.jpg in Resources */, 327 | 557A0CB21E9947A9005AD7E5 /* plus@2x.png in Resources */, 328 | 557A0CA51E994775005AD7E5 /* CHR.jpg in Resources */, 329 | 557A0CA11E994775005AD7E5 /* COM.jpg in Resources */, 330 | 557A0CA91E994775005AD7E5 /* HCR.jpg in Resources */, 331 | 55A0CF3B1E99F2A7006E19F0 /* settings@2x.png in Resources */, 332 | 557A0CA71E994775005AD7E5 /* FFL.jpg in Resources */, 333 | 557A0CB31E9947A9005AD7E5 /* minus@2x.png in Resources */, 334 | 557A0CAC1E994775005AD7E5 /* SCR.jpg in Resources */, 335 | 557A0CA01E994775005AD7E5 /* COS.jpg in Resources */, 336 | ); 337 | runOnlyForDeploymentPostprocessing = 0; 338 | }; 339 | 557A0C681E990297005AD7E5 /* Resources */ = { 340 | isa = PBXResourcesBuildPhase; 341 | buildActionMask = 2147483647; 342 | files = ( 343 | ); 344 | runOnlyForDeploymentPostprocessing = 0; 345 | }; 346 | 557A0C731E990297005AD7E5 /* Resources */ = { 347 | isa = PBXResourcesBuildPhase; 348 | buildActionMask = 2147483647; 349 | files = ( 350 | ); 351 | runOnlyForDeploymentPostprocessing = 0; 352 | }; 353 | /* End PBXResourcesBuildPhase section */ 354 | 355 | /* Begin PBXSourcesBuildPhase section */ 356 | 557A0C521E990297005AD7E5 /* Sources */ = { 357 | isa = PBXSourcesBuildPhase; 358 | buildActionMask = 2147483647; 359 | files = ( 360 | 557A0C5C1E990297005AD7E5 /* loginViewController.swift in Sources */, 361 | 557A0C5A1E990297005AD7E5 /* AppDelegate.swift in Sources */, 362 | 557A0C8E1E993900005AD7E5 /* invoiceViewController.swift in Sources */, 363 | 557A0C881E990419005AD7E5 /* welcomeView.swift in Sources */, 364 | 557A0C8C1E993614005AD7E5 /* menuItemCell.swift in Sources */, 365 | 557A0C8A1E99360B005AD7E5 /* menuViewController.swift in Sources */, 366 | 557A0C901E993D53005AD7E5 /* settingsViewController.swift in Sources */, 367 | ); 368 | runOnlyForDeploymentPostprocessing = 0; 369 | }; 370 | 557A0C661E990297005AD7E5 /* Sources */ = { 371 | isa = PBXSourcesBuildPhase; 372 | buildActionMask = 2147483647; 373 | files = ( 374 | 557A0C6F1E990297005AD7E5 /* McDonald_s_DBMSTests.swift in Sources */, 375 | ); 376 | runOnlyForDeploymentPostprocessing = 0; 377 | }; 378 | 557A0C711E990297005AD7E5 /* Sources */ = { 379 | isa = PBXSourcesBuildPhase; 380 | buildActionMask = 2147483647; 381 | files = ( 382 | 557A0C7A1E990297005AD7E5 /* McDonald_s_DBMSUITests.swift in Sources */, 383 | ); 384 | runOnlyForDeploymentPostprocessing = 0; 385 | }; 386 | /* End PBXSourcesBuildPhase section */ 387 | 388 | /* Begin PBXTargetDependency section */ 389 | 557A0C6C1E990297005AD7E5 /* PBXTargetDependency */ = { 390 | isa = PBXTargetDependency; 391 | target = 557A0C551E990297005AD7E5 /* McDonalds Online */; 392 | targetProxy = 557A0C6B1E990297005AD7E5 /* PBXContainerItemProxy */; 393 | }; 394 | 557A0C771E990297005AD7E5 /* PBXTargetDependency */ = { 395 | isa = PBXTargetDependency; 396 | target = 557A0C551E990297005AD7E5 /* McDonalds Online */; 397 | targetProxy = 557A0C761E990297005AD7E5 /* PBXContainerItemProxy */; 398 | }; 399 | /* End PBXTargetDependency section */ 400 | 401 | /* Begin PBXVariantGroup section */ 402 | 557A0C5D1E990297005AD7E5 /* Main.storyboard */ = { 403 | isa = PBXVariantGroup; 404 | children = ( 405 | 557A0C5E1E990297005AD7E5 /* Base */, 406 | ); 407 | name = Main.storyboard; 408 | sourceTree = ""; 409 | }; 410 | 557A0C621E990297005AD7E5 /* LaunchScreen.storyboard */ = { 411 | isa = PBXVariantGroup; 412 | children = ( 413 | 557A0C631E990297005AD7E5 /* Base */, 414 | ); 415 | name = LaunchScreen.storyboard; 416 | sourceTree = ""; 417 | }; 418 | /* End PBXVariantGroup section */ 419 | 420 | /* Begin XCBuildConfiguration section */ 421 | 557A0C7C1E990297005AD7E5 /* Debug */ = { 422 | isa = XCBuildConfiguration; 423 | buildSettings = { 424 | ALWAYS_SEARCH_USER_PATHS = NO; 425 | CLANG_ANALYZER_NONNULL = YES; 426 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 427 | CLANG_CXX_LIBRARY = "libc++"; 428 | CLANG_ENABLE_MODULES = YES; 429 | CLANG_ENABLE_OBJC_ARC = YES; 430 | CLANG_WARN_BOOL_CONVERSION = YES; 431 | CLANG_WARN_CONSTANT_CONVERSION = YES; 432 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 433 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 434 | CLANG_WARN_EMPTY_BODY = YES; 435 | CLANG_WARN_ENUM_CONVERSION = YES; 436 | CLANG_WARN_INFINITE_RECURSION = YES; 437 | CLANG_WARN_INT_CONVERSION = YES; 438 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 439 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 440 | CLANG_WARN_UNREACHABLE_CODE = YES; 441 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 442 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 443 | COPY_PHASE_STRIP = NO; 444 | DEBUG_INFORMATION_FORMAT = dwarf; 445 | ENABLE_STRICT_OBJC_MSGSEND = YES; 446 | ENABLE_TESTABILITY = YES; 447 | GCC_C_LANGUAGE_STANDARD = gnu99; 448 | GCC_DYNAMIC_NO_PIC = NO; 449 | GCC_NO_COMMON_BLOCKS = YES; 450 | GCC_OPTIMIZATION_LEVEL = 0; 451 | GCC_PREPROCESSOR_DEFINITIONS = ( 452 | "DEBUG=1", 453 | "$(inherited)", 454 | ); 455 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 456 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 457 | GCC_WARN_UNDECLARED_SELECTOR = YES; 458 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 459 | GCC_WARN_UNUSED_FUNCTION = YES; 460 | GCC_WARN_UNUSED_VARIABLE = YES; 461 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 462 | MTL_ENABLE_DEBUG_INFO = YES; 463 | ONLY_ACTIVE_ARCH = YES; 464 | SDKROOT = iphoneos; 465 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 466 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 467 | }; 468 | name = Debug; 469 | }; 470 | 557A0C7D1E990297005AD7E5 /* Release */ = { 471 | isa = XCBuildConfiguration; 472 | buildSettings = { 473 | ALWAYS_SEARCH_USER_PATHS = NO; 474 | CLANG_ANALYZER_NONNULL = YES; 475 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 476 | CLANG_CXX_LIBRARY = "libc++"; 477 | CLANG_ENABLE_MODULES = YES; 478 | CLANG_ENABLE_OBJC_ARC = YES; 479 | CLANG_WARN_BOOL_CONVERSION = YES; 480 | CLANG_WARN_CONSTANT_CONVERSION = YES; 481 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 482 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 483 | CLANG_WARN_EMPTY_BODY = YES; 484 | CLANG_WARN_ENUM_CONVERSION = YES; 485 | CLANG_WARN_INFINITE_RECURSION = YES; 486 | CLANG_WARN_INT_CONVERSION = YES; 487 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 488 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 489 | CLANG_WARN_UNREACHABLE_CODE = YES; 490 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 491 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 492 | COPY_PHASE_STRIP = NO; 493 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 494 | ENABLE_NS_ASSERTIONS = NO; 495 | ENABLE_STRICT_OBJC_MSGSEND = YES; 496 | GCC_C_LANGUAGE_STANDARD = gnu99; 497 | GCC_NO_COMMON_BLOCKS = YES; 498 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 499 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 500 | GCC_WARN_UNDECLARED_SELECTOR = YES; 501 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 502 | GCC_WARN_UNUSED_FUNCTION = YES; 503 | GCC_WARN_UNUSED_VARIABLE = YES; 504 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 505 | MTL_ENABLE_DEBUG_INFO = NO; 506 | SDKROOT = iphoneos; 507 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 508 | VALIDATE_PRODUCT = YES; 509 | }; 510 | name = Release; 511 | }; 512 | 557A0C7F1E990297005AD7E5 /* Debug */ = { 513 | isa = XCBuildConfiguration; 514 | buildSettings = { 515 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 516 | DEVELOPMENT_TEAM = 3A9TH8N8KH; 517 | INFOPLIST_FILE = "McDonald's DBMS/Info.plist"; 518 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 519 | PRODUCT_BUNDLE_IDENTIFIER = "com.Swapnil-Dhanwal..McDonald-s-DBMS"; 520 | PRODUCT_NAME = "$(TARGET_NAME)"; 521 | SWIFT_VERSION = 3.0; 522 | }; 523 | name = Debug; 524 | }; 525 | 557A0C801E990297005AD7E5 /* Release */ = { 526 | isa = XCBuildConfiguration; 527 | buildSettings = { 528 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 529 | DEVELOPMENT_TEAM = 3A9TH8N8KH; 530 | INFOPLIST_FILE = "McDonald's DBMS/Info.plist"; 531 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 532 | PRODUCT_BUNDLE_IDENTIFIER = "com.Swapnil-Dhanwal..McDonald-s-DBMS"; 533 | PRODUCT_NAME = "$(TARGET_NAME)"; 534 | SWIFT_VERSION = 3.0; 535 | }; 536 | name = Release; 537 | }; 538 | 557A0C821E990297005AD7E5 /* Debug */ = { 539 | isa = XCBuildConfiguration; 540 | buildSettings = { 541 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 542 | BUNDLE_LOADER = "$(TEST_HOST)"; 543 | DEVELOPMENT_TEAM = 3A9TH8N8KH; 544 | INFOPLIST_FILE = "McDonald's DBMSTests/Info.plist"; 545 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 546 | PRODUCT_BUNDLE_IDENTIFIER = "com.Swapnil-Dhanwal..McDonald-s-DBMSTests"; 547 | PRODUCT_NAME = "$(TARGET_NAME)"; 548 | SWIFT_VERSION = 3.0; 549 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/McDonalds Online.app/McDonalds Online"; 550 | }; 551 | name = Debug; 552 | }; 553 | 557A0C831E990297005AD7E5 /* Release */ = { 554 | isa = XCBuildConfiguration; 555 | buildSettings = { 556 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 557 | BUNDLE_LOADER = "$(TEST_HOST)"; 558 | DEVELOPMENT_TEAM = 3A9TH8N8KH; 559 | INFOPLIST_FILE = "McDonald's DBMSTests/Info.plist"; 560 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 561 | PRODUCT_BUNDLE_IDENTIFIER = "com.Swapnil-Dhanwal..McDonald-s-DBMSTests"; 562 | PRODUCT_NAME = "$(TARGET_NAME)"; 563 | SWIFT_VERSION = 3.0; 564 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/McDonalds Online.app/McDonalds Online"; 565 | }; 566 | name = Release; 567 | }; 568 | 557A0C851E990297005AD7E5 /* Debug */ = { 569 | isa = XCBuildConfiguration; 570 | buildSettings = { 571 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 572 | DEVELOPMENT_TEAM = 3A9TH8N8KH; 573 | INFOPLIST_FILE = "McDonald's DBMSUITests/Info.plist"; 574 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 575 | PRODUCT_BUNDLE_IDENTIFIER = "com.Swapnil-Dhanwal..McDonald-s-DBMSUITests"; 576 | PRODUCT_NAME = "$(TARGET_NAME)"; 577 | SWIFT_VERSION = 3.0; 578 | TEST_TARGET_NAME = "McDonald's DBMS"; 579 | }; 580 | name = Debug; 581 | }; 582 | 557A0C861E990297005AD7E5 /* Release */ = { 583 | isa = XCBuildConfiguration; 584 | buildSettings = { 585 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 586 | DEVELOPMENT_TEAM = 3A9TH8N8KH; 587 | INFOPLIST_FILE = "McDonald's DBMSUITests/Info.plist"; 588 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 589 | PRODUCT_BUNDLE_IDENTIFIER = "com.Swapnil-Dhanwal..McDonald-s-DBMSUITests"; 590 | PRODUCT_NAME = "$(TARGET_NAME)"; 591 | SWIFT_VERSION = 3.0; 592 | TEST_TARGET_NAME = "McDonald's DBMS"; 593 | }; 594 | name = Release; 595 | }; 596 | /* End XCBuildConfiguration section */ 597 | 598 | /* Begin XCConfigurationList section */ 599 | 557A0C511E990297005AD7E5 /* Build configuration list for PBXProject "McDonalds Online" */ = { 600 | isa = XCConfigurationList; 601 | buildConfigurations = ( 602 | 557A0C7C1E990297005AD7E5 /* Debug */, 603 | 557A0C7D1E990297005AD7E5 /* Release */, 604 | ); 605 | defaultConfigurationIsVisible = 0; 606 | defaultConfigurationName = Release; 607 | }; 608 | 557A0C7E1E990297005AD7E5 /* Build configuration list for PBXNativeTarget "McDonalds Online" */ = { 609 | isa = XCConfigurationList; 610 | buildConfigurations = ( 611 | 557A0C7F1E990297005AD7E5 /* Debug */, 612 | 557A0C801E990297005AD7E5 /* Release */, 613 | ); 614 | defaultConfigurationIsVisible = 0; 615 | defaultConfigurationName = Release; 616 | }; 617 | 557A0C811E990297005AD7E5 /* Build configuration list for PBXNativeTarget "McDonalds OnlineTests" */ = { 618 | isa = XCConfigurationList; 619 | buildConfigurations = ( 620 | 557A0C821E990297005AD7E5 /* Debug */, 621 | 557A0C831E990297005AD7E5 /* Release */, 622 | ); 623 | defaultConfigurationIsVisible = 0; 624 | defaultConfigurationName = Release; 625 | }; 626 | 557A0C841E990297005AD7E5 /* Build configuration list for PBXNativeTarget "McDonalds OnlineUITests" */ = { 627 | isa = XCConfigurationList; 628 | buildConfigurations = ( 629 | 557A0C851E990297005AD7E5 /* Debug */, 630 | 557A0C861E990297005AD7E5 /* Release */, 631 | ); 632 | defaultConfigurationIsVisible = 0; 633 | defaultConfigurationName = Release; 634 | }; 635 | /* End XCConfigurationList section */ 636 | }; 637 | rootObject = 557A0C4E1E990297005AD7E5 /* Project object */; 638 | } 639 | -------------------------------------------------------------------------------- /McDonalds Online.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /McDonalds Online.xcodeproj/project.xcworkspace/xcuserdata/swapnil.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/McDonalds Online.xcodeproj/project.xcworkspace/xcuserdata/swapnil.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /McDonalds Online.xcodeproj/xcuserdata/swapnil.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /McDonalds Online.xcodeproj/xcuserdata/swapnil.xcuserdatad/xcschemes/McDonald's DBMS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /McDonalds Online.xcodeproj/xcuserdata/swapnil.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | McDonald's DBMS.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 557A0C551E990297005AD7E5 16 | 17 | primary 18 | 19 | 20 | 557A0C691E990297005AD7E5 21 | 22 | primary 23 | 24 | 25 | 557A0C741E990297005AD7E5 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /PHP/addRating.php: -------------------------------------------------------------------------------- 1 | 1, "Query" => $query); 50 | 51 | echo json_encode($r); 52 | 53 | mysqli_close($db); 54 | 55 | ?> -------------------------------------------------------------------------------- /PHP/connect.php: -------------------------------------------------------------------------------- 1 | 0)); 37 | 38 | echo json_encode($r); 39 | 40 | } 41 | 42 | mysqli_close($db); 43 | 44 | 45 | ?> -------------------------------------------------------------------------------- /PHP/deleteCart.php: -------------------------------------------------------------------------------- 1 | 1); 34 | echo json_encode($r); 35 | 36 | } 37 | else 38 | { 39 | 40 | mysqli_query($db, "rollback;") or die('rollback error'); 41 | $r = array("Success" => 0); 42 | echo json_encode($r); 43 | 44 | } 45 | 46 | mysqli_close($db); 47 | 48 | ?> 49 | -------------------------------------------------------------------------------- /PHP/getCart.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PHP/getEmployee.php: -------------------------------------------------------------------------------- 1 | 0); 47 | 48 | echo json_encode($r); 49 | 50 | } 51 | 52 | 53 | 54 | mysqli_close($db); 55 | 56 | ?> -------------------------------------------------------------------------------- /PHP/getMenuItems.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PHP/insertCustomer.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PHP/insertInvoice.php: -------------------------------------------------------------------------------- 1 | 1, "Query" => $query); 66 | 67 | echo json_encode($r); 68 | 69 | mysqli_close($db); 70 | 71 | ?> -------------------------------------------------------------------------------- /PHP/saveCart.php: -------------------------------------------------------------------------------- 1 | $value) { 13 | 14 | if ($key == 'region') 15 | { 16 | 17 | $region = $value; 18 | continue; 19 | 20 | } 21 | else if ($key == 'number') 22 | { 23 | 24 | $number = $value; 25 | 26 | } 27 | else 28 | { 29 | 30 | $query = "insert into cart (Phone, F_id, Qty, O_name) values ('$number', '$key', $value, '$region');"; 31 | $flag = mysqli_query($db, $query) or die('Query Error'); 32 | if (!$flag) 33 | { 34 | 35 | break; 36 | 37 | } 38 | 39 | } 40 | 41 | } 42 | } 43 | 44 | if ($flag) 45 | { 46 | 47 | mysqli_query($db, "commit;"); 48 | echo json_encode(array("Success" => 1)); 49 | 50 | } 51 | else 52 | { 53 | mysqli_query($db, "rollback;"); 54 | echo json_encode(array("Success" => 0)); 55 | 56 | } 57 | 58 | mysqli_close($db); 59 | 60 | ?> -------------------------------------------------------------------------------- /PHP/updateCustomer.php: -------------------------------------------------------------------------------- 1 | 0); 70 | echo json_encode($r); 71 | 72 | } 73 | 74 | mysqli_close($db); 75 | 76 | ?> -------------------------------------------------------------------------------- /PHP/updateOutlet.php: -------------------------------------------------------------------------------- 1 | $value) { 15 | 16 | if ($key == 'region') 17 | { 18 | 19 | $region = $value; 20 | continue; 21 | 22 | } 23 | else 24 | { 25 | 26 | $query = "update Outlet set Qty_sold = Qty_sold + $value where O_name = '$region' and F_id = '$key';"; 27 | 28 | $flag = mysqli_query($db, $query) or die('Query error'); 29 | 30 | if (!$flag) 31 | { 32 | 33 | mysqli_query($db, "rollback;"); 34 | $r = array("Success" => 0); 35 | echo json_encode($r); 36 | 37 | } 38 | 39 | } 40 | 41 | } 42 | } 43 | 44 | if ($flag) 45 | { 46 | 47 | mysqli_query($db, "commit") or die("Query error"); 48 | $r = array("Success" => 1); 49 | echo json_encode($r); 50 | 51 | } 52 | 53 | mysqli_close($db); 54 | 55 | ?> -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DBMS-Project 2 | 3 | - [Problem Statement](#problem-statement) 4 | - [E-R Model](#entity-relation-model) 5 | - [Relational Model](#relational-model) 6 | - [Screenshots](#screenshots) 7 | - [How to build](#how-to-build) 8 | - [Project Maintainers](#project-maintainers) 9 | 10 | ## Problem Statement 11 | 12 | The McDonald’s Online Ordering System is a database system designed to facilitate the process of online food ordering. The system will provide a set of features to access unique menu items available in different branches of the aforementioned fast food chain in Delhi, and ordering. 13 | The database will include a set of all branches in the Delhi region, a set of menu items, a set of employee data to keep track of performance of employees along with their details, a set of existing customers, a set of menu items currently being selected by a customer (cart) and a set of all the invoices generated. 14 | Each customer will be identified by his/her phone number wherein customers with the same address but different phone numbers will be treated as different customers. Upon launching the application, the users will be prompted to enter their phone number where if a match is found, they will be directed to the menu of the closest branch (according to the customer’s address). Otherwise, the customer will be treated as a first time customer and will enter his/her information and then proceed towards the menu. 15 | Once a customer has registered he/she need not register again. The customer can choose from a variety of food items, in different portion sizes. The customer will be notified with the status of his/her order and name of the delivery person. The customer is expected to rate his/her experience upon (notification of) delivery of the order. 16 | 17 | ## Entity Relation Model 18 | 19 | 20 | 21 | ## Relational Model 22 | 23 | 24 | 25 | ## Screenshots 26 | 27 |

Phone Number 28 | Cart 29 | User Settings 30 | Invoice 31 |

32 | 33 | # How to build 34 | You will need: 35 | 1. Xcode 8.x 36 | 2. Apache server, MYSQL server (We used XAMPP) 37 | 3. Git clone this repository into a directory of your choice. 38 | 4. If you're using XAMPP, copy the php files into the htdocs folder. Else, change their path in the urls. 39 | 5. Run! 40 | 41 | # Project Maintainers 42 | This repository is actively maintained by Swapnil, Vishnu and Tanya. For any queries, please send an email on: 43 | 44 | *swapnildhanwal@hotmail.com* 45 | 46 | *tanya.agarwal23696@gmail.com* 47 | 48 | *vishnubhaskar.vb@gmail.com* 49 | -------------------------------------------------------------------------------- /Screenshots/DBtables.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/Screenshots/DBtables.png -------------------------------------------------------------------------------- /Screenshots/ER Diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/Screenshots/ER Diagram.png -------------------------------------------------------------------------------- /Screenshots/Relational Model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/Screenshots/Relational Model.png -------------------------------------------------------------------------------- /Screenshots/cart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/Screenshots/cart.png -------------------------------------------------------------------------------- /Screenshots/invoice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/Screenshots/invoice.png -------------------------------------------------------------------------------- /Screenshots/invoiceTable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/Screenshots/invoiceTable.png -------------------------------------------------------------------------------- /Screenshots/phoneNumber.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/Screenshots/phoneNumber.png -------------------------------------------------------------------------------- /Screenshots/rating.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/Screenshots/rating.png -------------------------------------------------------------------------------- /Screenshots/screenshots.pages: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/Screenshots/screenshots.pages -------------------------------------------------------------------------------- /Screenshots/screenshots.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/Screenshots/screenshots.pdf -------------------------------------------------------------------------------- /Screenshots/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Swapnil52/DBMS-Project/26d9d88dca9799ae00fa47771bee525891cdff13/Screenshots/settings.png -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman --------------------------------------------------------------------------------